mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-05 01:25:25 +08:00
update
This commit is contained in:
@ -4,12 +4,12 @@ import FluentUI 1.0
|
||||
|
||||
TextField{
|
||||
|
||||
property var values:[]
|
||||
property var items:[]
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
property int iconSource: 0
|
||||
property bool disabled: false
|
||||
signal itemClicked(string data)
|
||||
signal itemClicked(var data)
|
||||
signal handleClicked
|
||||
id:input
|
||||
width: 300
|
||||
@ -211,7 +211,7 @@ TextField{
|
||||
function handleClick(){
|
||||
input_popup.close()
|
||||
input.itemClicked(modelData)
|
||||
input.text = modelData
|
||||
input.text = modelData.title
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
@ -227,37 +227,12 @@ TextField{
|
||||
}
|
||||
}
|
||||
contentItem: FluText{
|
||||
text:modelData
|
||||
text:modelData.title
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Item{
|
||||
// height: 38
|
||||
// width: input.width
|
||||
// Rectangle{
|
||||
// anchors.fill: parent
|
||||
// anchors.topMargin: 2
|
||||
// anchors.bottomMargin: 2
|
||||
// anchors.leftMargin: 5
|
||||
// anchors.rightMargin: 5
|
||||
|
||||
// radius: 3
|
||||
// MouseArea{
|
||||
// id:item_mouse
|
||||
// anchors.fill: parent
|
||||
// hoverEnabled: true
|
||||
// onClicked: {
|
||||
// input_popup.close()
|
||||
// input.itemClicked(modelData)
|
||||
// input.text = modelData
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -268,12 +243,12 @@ TextField{
|
||||
|
||||
function searchData(){
|
||||
var result = []
|
||||
if(values==null){
|
||||
if(items==null){
|
||||
list_view.model = result
|
||||
return
|
||||
}
|
||||
values.map(function(item){
|
||||
if(item.indexOf(input.text)!==-1){
|
||||
items.map(function(item){
|
||||
if(item.title.indexOf(input.text)!==-1){
|
||||
result.push(item)
|
||||
}
|
||||
})
|
||||
|
@ -7,10 +7,12 @@ import FluentUI 1.0
|
||||
Item {
|
||||
|
||||
property alias logo : image_logo.source
|
||||
property string title: ""
|
||||
property FluObject items
|
||||
property FluObject footerItems
|
||||
property int displayMode: width<=700 ? FluNavigationView.Minimal : FluNavigationView.Open
|
||||
property bool displaMinimalMenu : false
|
||||
property Component autoSuggestBox
|
||||
|
||||
id:root
|
||||
|
||||
@ -214,7 +216,7 @@ Item {
|
||||
}
|
||||
FluText{
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text:"FluentUI"
|
||||
text:root.title
|
||||
Layout.leftMargin: 12
|
||||
fontStyle: FluText.Body
|
||||
}
|
||||
@ -257,6 +259,17 @@ Item {
|
||||
Rectangle{
|
||||
id:layout_list
|
||||
width: 300
|
||||
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
|
||||
border.width: displayMode === FluNavigationView.Minimal ? 1 : 0
|
||||
color: {
|
||||
if(displayMode === FluNavigationView.Minimal){
|
||||
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
if(window && window.active){
|
||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
anchors{
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
@ -273,70 +286,29 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
color: {
|
||||
if(displayMode === FluNavigationView.Minimal){
|
||||
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
if(window && window.active){
|
||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
Behavior on color{
|
||||
ColorAnimation {
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
|
||||
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
|
||||
border.width: displayMode === FluNavigationView.Minimal ? 1 : 0
|
||||
|
||||
Item{
|
||||
id:layout_header
|
||||
width: layout_list.width
|
||||
y:nav_app_bar.height
|
||||
height: textbox_search.height
|
||||
|
||||
FluAutoSuggestBox{
|
||||
id:textbox_search
|
||||
width: 280
|
||||
anchors.centerIn: parent
|
||||
iconSource: FluentIcons.Zoom
|
||||
values: {
|
||||
var arr = []
|
||||
if(items==null)
|
||||
return arr
|
||||
if(items.children==null)
|
||||
return arr
|
||||
for(var i=0;i<items.children.length;i++){
|
||||
var item = items.children[i]
|
||||
if(item instanceof FluPaneItem){
|
||||
arr.push(item.title)
|
||||
}
|
||||
}
|
||||
return arr
|
||||
height: {
|
||||
if(loader_auto_suggest_box.item){
|
||||
return loader_auto_suggest_box.item.height
|
||||
}
|
||||
placeholderText: "查找"
|
||||
onItemClicked:
|
||||
(data)=>{
|
||||
var arr = []
|
||||
if(items==null)
|
||||
return arr
|
||||
if(items.children==null)
|
||||
return arr
|
||||
for(var i=0;i<items.children.length;i++){
|
||||
if(items.children[i].title === data){
|
||||
if(nav_list.currentIndex === i){
|
||||
return
|
||||
}
|
||||
items.children[i].tap()
|
||||
nav_list.currentIndex = i
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
Loader{
|
||||
id:loader_auto_suggest_box
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
sourceComponent: autoSuggestBox
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id:nav_list
|
||||
property bool enableStack: true
|
||||
@ -349,6 +321,7 @@ Item {
|
||||
right: parent.right
|
||||
bottom: layout_footer.top
|
||||
}
|
||||
highlightMoveDuration: 150
|
||||
currentIndex: -1
|
||||
onCurrentIndexChanged: {
|
||||
if(enableStack){
|
||||
@ -418,17 +391,8 @@ Item {
|
||||
nav_list.currentIndex = index
|
||||
}
|
||||
|
||||
function startPageByTitle(title){
|
||||
for(var i=0;i<items.children.length;i++){
|
||||
if(items.children[i].title === title){
|
||||
if(nav_list.currentIndex === i){
|
||||
return
|
||||
}
|
||||
items.children[i].tap()
|
||||
nav_list.currentIndex = i
|
||||
return
|
||||
}
|
||||
}
|
||||
function getCurrentIndex(){
|
||||
return nav_list.currentIndex
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,14 @@
|
||||
import QtQuick 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
QtObject {
|
||||
readonly property string key : FluApp.uuid()
|
||||
property string title
|
||||
property var icon
|
||||
property int icon
|
||||
property bool recentlyAdded: false
|
||||
property bool recentlyUpdated: false
|
||||
property string desc
|
||||
property var image
|
||||
signal tap
|
||||
signal repTap
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
QtObject {
|
||||
readonly property string key : FluApp.uuid()
|
||||
property string title
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
QtObject {
|
||||
|
||||
readonly property string key : FluApp.uuid()
|
||||
}
|
||||
|
Reference in New Issue
Block a user