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
30
README.md
30
README.md
@ -17,4 +17,32 @@ QML插件
|
|||||||
[ubuntu-badge]: https://github.com/zhuzichu520/FluentUI/workflows/Ubuntu/badge.svg "Ubuntu"
|
[ubuntu-badge]: https://github.com/zhuzichu520/FluentUI/workflows/Ubuntu/badge.svg "Ubuntu"
|
||||||
|
|
||||||
[macos-link]: https://github.com/zhuzichu520/FluentUI/actions?query=workflow%3AMacOS "MacOSAction"
|
[macos-link]: https://github.com/zhuzichu520/FluentUI/actions?query=workflow%3AMacOS "MacOSAction"
|
||||||
[macos-badge]: https://github.com/zhuzichu520/FluentUI/workflows/MacOS/badge.svg "MacOS"
|
[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("当前非选择模式,没有选中的数据")
|
showError("当前非选择模式,没有选中的数据")
|
||||||
}
|
}
|
||||||
if(tree_view.selectionMode === FluTreeView.Single){
|
if(tree_view.selectionMode === FluTreeView.Single){
|
||||||
|
if(!tree_view.signleData()){
|
||||||
|
showError("没有选中数据")
|
||||||
|
return
|
||||||
|
}
|
||||||
showSuccess(tree_view.signleData().text)
|
showSuccess(tree_view.signleData().text)
|
||||||
}
|
}
|
||||||
if(tree_view.selectionMode === FluTreeView.Multiple){
|
if(tree_view.selectionMode === FluTreeView.Multiple){
|
||||||
|
@ -20,8 +20,6 @@ Rectangle {
|
|||||||
property var currentElement
|
property var currentElement
|
||||||
property var currentParentElement
|
property var currentParentElement
|
||||||
|
|
||||||
property var multipElement: []
|
|
||||||
|
|
||||||
property var rootModel: tree_model.get(0).items
|
property var rootModel: tree_model.get(0).items
|
||||||
|
|
||||||
signal itemClicked(var item)
|
signal itemClicked(var item)
|
||||||
@ -31,9 +29,11 @@ Rectangle {
|
|||||||
ListElement{
|
ListElement{
|
||||||
text: "根节点"
|
text: "根节点"
|
||||||
expanded:true
|
expanded:true
|
||||||
|
items:[]
|
||||||
key:"123456"
|
key:"123456"
|
||||||
multipSelected:false
|
multipSelected:false
|
||||||
items:[]
|
multipIndex:0
|
||||||
|
multipParentKey:""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,63 +166,58 @@ Rectangle {
|
|||||||
text:""
|
text:""
|
||||||
checked: itemModel.multipSelected
|
checked: itemModel.multipSelected
|
||||||
visible: selectionMode === FluTreeView.Multiple
|
visible: selectionMode === FluTreeView.Multiple
|
||||||
|
Layout.leftMargin: 5
|
||||||
|
|
||||||
|
function refreshCheckBox(){
|
||||||
|
const stack = [tree_model.get(0)];
|
||||||
|
const result = [];
|
||||||
|
while (stack.length > 0) {
|
||||||
|
const curr = stack.pop();
|
||||||
|
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-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)){
|
||||||
|
var items = item.items
|
||||||
|
for(var k=0 ; k<items.count ; k++){
|
||||||
|
if(items.get(k).multipSelected === false){
|
||||||
|
obj.items.setProperty(item.multipIndex,"multipSelected",false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
obj.items.setProperty(item.multipIndex,"multipSelected",true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
checkClicked:function(){
|
checkClicked:function(){
|
||||||
if(hasChild){
|
if(hasChild){
|
||||||
|
const stack = [itemModel];
|
||||||
}else{
|
|
||||||
itemModel.multipSelected = !itemModel.multipSelected
|
|
||||||
|
|
||||||
const stack = [tree_model.get(0)];
|
|
||||||
const result = [];
|
|
||||||
while (stack.length > 0) {
|
while (stack.length > 0) {
|
||||||
const curr = stack.pop();
|
const curr = stack.pop();
|
||||||
result.unshift(curr);
|
|
||||||
if (curr.items) {
|
if (curr.items) {
|
||||||
for(var i=0 ; i<curr.items.count ; i++){
|
for(var i=0 ; i<curr.items.count ; i++){
|
||||||
|
curr.items.setProperty(i,"multipSelected",!itemModel.multipSelected)
|
||||||
stack.push(curr.items.get(i));
|
stack.push(curr.items.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
refreshCheckBox()
|
||||||
for(var j=0 ; j<result.length ; j++){
|
}else{
|
||||||
var item = result[j]
|
itemModel.multipSelected = !itemModel.multipSelected
|
||||||
if((item.items !== undefined) && (item.items.count !== 0)){
|
refreshCheckBox()
|
||||||
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)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
items.setProperty(k,"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);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,9 +265,7 @@ Rectangle {
|
|||||||
delegate: delegate_items
|
delegate: delegate_items
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +282,6 @@ Rectangle {
|
|||||||
ScrollBar.horizontal: ScrollBar { }
|
ScrollBar.horizontal: ScrollBar { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateData(items){
|
function updateData(items){
|
||||||
rootModel.clear()
|
rootModel.clear()
|
||||||
rootModel.append(items)
|
rootModel.append(items)
|
||||||
@ -300,14 +292,25 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function multipData(){
|
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=[]){
|
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() {
|
function uniqueRandom() {
|
||||||
var timestamp = Date.now();
|
var timestamp = Date.now();
|
||||||
var random = Math.floor(Math.random() * 1000000);
|
var random = Math.floor(Math.random() * 1000000);
|
||||||
|
Loading…
Reference in New Issue
Block a user