mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-23 04:14:35 +08:00
update
This commit is contained in:
parent
aadd7475d6
commit
54f6a8c37d
28
README.md
28
README.md
@ -18,3 +18,31 @@ QML插件
|
||||
|
||||
[macos-link]: https://github.com/zhuzichu520/FluentUI/actions?query=workflow%3AMacOS "MacOSAction"
|
||||
[macos-badge]: https://github.com/zhuzichu520/FluentUI/workflows/MacOS/badge.svg "MacOS"
|
||||
|
||||
## 支持的组件
|
||||
|
||||
|目录|说明|备注|
|
||||
|----|----|----|
|
||||
|FluApp|初始化入口|支持路由跳转|
|
||||
|FluWindow|无边框窗口|解决windows拖动闪烁问题|
|
||||
|FluAppBar|窗口顶部标题栏|支持拖动窗口,最小化、最大化、关闭窗口|
|
||||
|FluText|Text文本||
|
||||
|FluButton|按钮||
|
||||
|FluFilledButton|实心按钮||
|
||||
|FluIconButton|图标按钮||
|
||||
|FluTextButton|文本按钮||
|
||||
|FluIcon|图标||
|
||||
|FluRadioButton|单选按钮||
|
||||
|FluTextBox|单行输入框||
|
||||
|FluMultiLineTextBox|多行输入框||
|
||||
|FluToggleSwitch|开关按钮||
|
||||
|FluSlider|拖动条||
|
||||
|FluInfoBar|提示Toast||
|
||||
|FluContentDialog|对话框||
|
||||
|FluProgressBar|条形进度条||
|
||||
|FluProgressRing|圆形进度条||
|
||||
|FluRectangle|矩形|支持部分圆角、clip|
|
||||
|FluMenu|菜单框||
|
||||
|FluTooltip|tooltip提示框||
|
||||
|FluTreeView|树控件||
|
||||
|FluTheme|主题设置|支持主题颜色切换,夜间模式|
|
@ -123,6 +123,10 @@ Item {
|
||||
showError("当前非选择模式,没有选中的数据")
|
||||
}
|
||||
if(tree_view.selectionMode === FluTreeView.Single){
|
||||
if(!tree_view.signleData()){
|
||||
showError("没有选中数据")
|
||||
return
|
||||
}
|
||||
showSuccess(tree_view.signleData().text)
|
||||
}
|
||||
if(tree_view.selectionMode === FluTreeView.Multiple){
|
||||
|
@ -20,8 +20,6 @@ Rectangle {
|
||||
property var currentElement
|
||||
property var currentParentElement
|
||||
|
||||
property var multipElement: []
|
||||
|
||||
property var rootModel: tree_model.get(0).items
|
||||
|
||||
signal itemClicked(var item)
|
||||
@ -31,9 +29,11 @@ Rectangle {
|
||||
ListElement{
|
||||
text: "根节点"
|
||||
expanded:true
|
||||
items:[]
|
||||
key:"123456"
|
||||
multipSelected:false
|
||||
items:[]
|
||||
multipIndex:0
|
||||
multipParentKey:""
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,12 +166,9 @@ Rectangle {
|
||||
text:""
|
||||
checked: itemModel.multipSelected
|
||||
visible: selectionMode === FluTreeView.Multiple
|
||||
checkClicked:function(){
|
||||
if(hasChild){
|
||||
|
||||
}else{
|
||||
itemModel.multipSelected = !itemModel.multipSelected
|
||||
Layout.leftMargin: 5
|
||||
|
||||
function refreshCheckBox(){
|
||||
const stack = [tree_model.get(0)];
|
||||
const result = [];
|
||||
while (stack.length > 0) {
|
||||
@ -179,50 +176,48 @@ Rectangle {
|
||||
result.unshift(curr);
|
||||
if (curr.items) {
|
||||
for(var i=0 ; i<curr.items.count ; i++){
|
||||
curr.items.setProperty(i,"multipIndex",i)
|
||||
curr.items.setProperty(i,"multipParentKey",curr.key)
|
||||
stack.push(curr.items.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var j=0 ; j<result.length ; j++){
|
||||
for(var j=0 ; j<result.length-1 ; j++){
|
||||
var item = result[j]
|
||||
let obj = result.find(function(o) {
|
||||
return o.key === item.multipParentKey;
|
||||
});
|
||||
if((item.items !== undefined) && (item.items.count !== 0)){
|
||||
console.debug(item.index)
|
||||
var items = item.items
|
||||
for(var k=0 ; k<items.count ; k++){
|
||||
|
||||
|
||||
|
||||
if(items.get(k).multipSelected === false){
|
||||
items.setProperty(k,"multipSelected",false)
|
||||
obj.items.setProperty(item.multipIndex,"multipSelected",false)
|
||||
break
|
||||
}
|
||||
items.setProperty(k,"multipSelected",true)
|
||||
obj.items.setProperty(item.multipIndex,"multipSelected",true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// const stack = [tree_model.get(0)];
|
||||
// while (stack.length > 0) {
|
||||
// const node = stack.pop();
|
||||
// for (var i = 0 ; i <node.items.count; i i--) {
|
||||
// const item = node.items.get(i)
|
||||
// if((item.items !== undefined) && (item.items.count !== 0)){
|
||||
}
|
||||
|
||||
// console.debug(item.text)
|
||||
// var items = item.items
|
||||
// for(var j=0 ; j<items.count ; j++){
|
||||
// if(items.get(j).multipSelected === false){
|
||||
// node.items.setProperty(i,"multipSelected",false)
|
||||
// break
|
||||
// }
|
||||
// node.items.setProperty(i,"multipSelected",true)
|
||||
// }
|
||||
// }
|
||||
// stack.push(item);
|
||||
// }
|
||||
// }
|
||||
checkClicked:function(){
|
||||
if(hasChild){
|
||||
const stack = [itemModel];
|
||||
while (stack.length > 0) {
|
||||
const curr = stack.pop();
|
||||
if (curr.items) {
|
||||
for(var i=0 ; i<curr.items.count ; i++){
|
||||
curr.items.setProperty(i,"multipSelected",!itemModel.multipSelected)
|
||||
stack.push(curr.items.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshCheckBox()
|
||||
}else{
|
||||
itemModel.multipSelected = !itemModel.multipSelected
|
||||
refreshCheckBox()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,9 +265,7 @@ Rectangle {
|
||||
delegate: delegate_items
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,7 +282,6 @@ Rectangle {
|
||||
ScrollBar.horizontal: ScrollBar { }
|
||||
}
|
||||
|
||||
|
||||
function updateData(items){
|
||||
rootModel.clear()
|
||||
rootModel.append(items)
|
||||
@ -300,14 +292,25 @@ Rectangle {
|
||||
}
|
||||
|
||||
function multipData(){
|
||||
return multipElement
|
||||
const stack = [tree_model.get(0)];
|
||||
const result = [];
|
||||
while (stack.length > 0) {
|
||||
const curr = stack.pop();
|
||||
if(curr.multipSelected){
|
||||
result.push(curr)
|
||||
}
|
||||
|
||||
for(var i=0 ; i<curr.items.count ; i++){
|
||||
stack.push(curr.items.get(i));
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function createItem(text="Title",expanded=true,items=[]){
|
||||
return {text:text,expanded:expanded,items:items,key:uniqueRandom(),multipSelected:false};
|
||||
return {text:text,expanded:expanded,items:items,key:uniqueRandom(),multipSelected:false,multipIndex:0,multipParentKey:""};
|
||||
}
|
||||
|
||||
|
||||
function uniqueRandom() {
|
||||
var timestamp = Date.now();
|
||||
var random = Math.floor(Math.random() * 1000000);
|
||||
|
Loading…
Reference in New Issue
Block a user