zartui 3.1.84 → 3.1.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/drawer-select/DrawerSelect.d.ts +45 -2
- package/es/drawer-select/DrawerSelect.mjs +163 -3
- package/es/drawer-select/index.css +1 -1
- package/es/drawer-select/index.d.ts +32 -2
- package/es/drawer-select/types.d.ts +22 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/media-picker/MediaPicker.mjs +36 -5
- package/lib/drawer-select/DrawerSelect.d.ts +45 -2
- package/lib/drawer-select/DrawerSelect.js +163 -3
- package/lib/drawer-select/index.css +1 -1
- package/lib/drawer-select/index.d.ts +32 -2
- package/lib/drawer-select/types.d.ts +22 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/media-picker/MediaPicker.js +35 -4
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +198 -8
- package/lib/zartui.es.js +198 -8
- package/lib/zartui.js +198 -8
- package/lib/zartui.min.js +2 -2
- package/package.json +6 -6
package/lib/zartui.js
CHANGED
|
@@ -9301,12 +9301,19 @@ var __publicField = (obj, key, value) => {
|
|
|
9301
9301
|
default: false
|
|
9302
9302
|
},
|
|
9303
9303
|
defaultSelectNode: Object,
|
|
9304
|
-
activeClassName: makeStringProp("")
|
|
9304
|
+
activeClassName: makeStringProp(""),
|
|
9305
|
+
commonTypeList: makeArrayProp(),
|
|
9306
|
+
showCommonTypes: {
|
|
9307
|
+
type: Boolean,
|
|
9308
|
+
default: false
|
|
9309
|
+
},
|
|
9310
|
+
commonTypeVisibleCount: Number,
|
|
9311
|
+
hotTypeList: makeArrayProp()
|
|
9305
9312
|
};
|
|
9306
9313
|
var stdin_default$14 = vue.defineComponent({
|
|
9307
9314
|
name: name$L,
|
|
9308
9315
|
props: drawerSelectProps,
|
|
9309
|
-
emits: ["change", "select"],
|
|
9316
|
+
emits: ["change", "select", "clearAll"],
|
|
9310
9317
|
setup(props, {
|
|
9311
9318
|
emit
|
|
9312
9319
|
}) {
|
|
@@ -9318,8 +9325,17 @@ var __publicField = (obj, key, value) => {
|
|
|
9318
9325
|
const searchRef = vue.ref();
|
|
9319
9326
|
const offset2 = vue.ref(0);
|
|
9320
9327
|
const historyList = vue.ref([]);
|
|
9328
|
+
const showAllCommonTypes = vue.ref(false);
|
|
9329
|
+
const selectCommonId = vue.ref(-1);
|
|
9321
9330
|
const defaultTreeNode = vue.ref(props.treeData);
|
|
9322
9331
|
const fields = vue.computed(() => assignDefaultFields$1(props.treeFieldName));
|
|
9332
|
+
const visibleCommonTypeList = vue.computed(() => {
|
|
9333
|
+
const count = props.commonTypeVisibleCount;
|
|
9334
|
+
if (typeof count !== "number") {
|
|
9335
|
+
return props.commonTypeList;
|
|
9336
|
+
}
|
|
9337
|
+
return props.commonTypeList.slice(0, Math.max(0, count));
|
|
9338
|
+
});
|
|
9323
9339
|
const {
|
|
9324
9340
|
value,
|
|
9325
9341
|
children,
|
|
@@ -9403,6 +9419,37 @@ var __publicField = (obj, key, value) => {
|
|
|
9403
9419
|
updateOffset();
|
|
9404
9420
|
});
|
|
9405
9421
|
const isEmpty = (item) => !item[children] || item[children].length === 0;
|
|
9422
|
+
const syncExpandNodeByParent = (item) => {
|
|
9423
|
+
var _a, _b, _c;
|
|
9424
|
+
const parent = (_a = item.parent) != null ? _a : [];
|
|
9425
|
+
if (parent.length >= 2) {
|
|
9426
|
+
const parentValue = (_b = parent[parent.length - 2]) == null ? void 0 : _b[value];
|
|
9427
|
+
if (parentValue !== void 0) {
|
|
9428
|
+
const stack = [...props.treeData];
|
|
9429
|
+
while (stack.length > 0) {
|
|
9430
|
+
const current2 = stack.shift();
|
|
9431
|
+
if (!current2)
|
|
9432
|
+
continue;
|
|
9433
|
+
if (current2[value] === parentValue) {
|
|
9434
|
+
expandNode.value = {
|
|
9435
|
+
text: current2[key],
|
|
9436
|
+
value: current2[value],
|
|
9437
|
+
children: current2[children]
|
|
9438
|
+
};
|
|
9439
|
+
return;
|
|
9440
|
+
}
|
|
9441
|
+
if ((_c = current2[children]) == null ? void 0 : _c.length) {
|
|
9442
|
+
stack.push(...current2[children]);
|
|
9443
|
+
}
|
|
9444
|
+
}
|
|
9445
|
+
}
|
|
9446
|
+
}
|
|
9447
|
+
expandNode.value = {
|
|
9448
|
+
text: allData[key],
|
|
9449
|
+
value: allData[value],
|
|
9450
|
+
children: allData[children]
|
|
9451
|
+
};
|
|
9452
|
+
};
|
|
9406
9453
|
const onLabelClick = (item, assign = true) => {
|
|
9407
9454
|
const {
|
|
9408
9455
|
text,
|
|
@@ -9419,6 +9466,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9419
9466
|
}
|
|
9420
9467
|
if (isEmpty(item)) {
|
|
9421
9468
|
selectNode.value = item;
|
|
9469
|
+
selectCommonId.value = item[value2];
|
|
9422
9470
|
emit("select", item);
|
|
9423
9471
|
}
|
|
9424
9472
|
item.checked = !item.checked;
|
|
@@ -9481,6 +9529,117 @@ var __publicField = (obj, key, value) => {
|
|
|
9481
9529
|
}));
|
|
9482
9530
|
}
|
|
9483
9531
|
};
|
|
9532
|
+
const findCommonTypeNode = (id) => {
|
|
9533
|
+
return flatArray.value.find((item) => item[value] === id);
|
|
9534
|
+
};
|
|
9535
|
+
const onCommonTypeClick = (item) => {
|
|
9536
|
+
const matchNode = findCommonTypeNode(item.types.id);
|
|
9537
|
+
if (!matchNode)
|
|
9538
|
+
return;
|
|
9539
|
+
selectCommonId.value = item.types.id;
|
|
9540
|
+
syncExpandNodeByParent(matchNode);
|
|
9541
|
+
selectNode.value = matchNode;
|
|
9542
|
+
emit("select", Object.assign(matchNode, {
|
|
9543
|
+
parent: matchNode.parent
|
|
9544
|
+
}));
|
|
9545
|
+
};
|
|
9546
|
+
const onClearCommonTypes = () => {
|
|
9547
|
+
selectCommonId.value = -1;
|
|
9548
|
+
showAllCommonTypes.value = false;
|
|
9549
|
+
emit("clearAll");
|
|
9550
|
+
};
|
|
9551
|
+
const findHotTypeNode = (id) => {
|
|
9552
|
+
return flatArray.value.find((item) => item[value] === id);
|
|
9553
|
+
};
|
|
9554
|
+
const renderCommonTypeButton = (item) => {
|
|
9555
|
+
const active = item.types.id === selectCommonId.value;
|
|
9556
|
+
return vue.createVNode(stdin_default$1L, {
|
|
9557
|
+
"size": "small",
|
|
9558
|
+
"class": [bem$L("common-types--btn")],
|
|
9559
|
+
"type": active ? "primary" : "default",
|
|
9560
|
+
"backgroundColor": active ? "#3388ff" : "var(--zt-background)",
|
|
9561
|
+
"borderColor": active ? "#3388ff" : "var(--zt-border-color)",
|
|
9562
|
+
"color": active ? "var(--zt-white)" : "var(--zt-text-color)",
|
|
9563
|
+
"onClick": () => onCommonTypeClick(item)
|
|
9564
|
+
}, {
|
|
9565
|
+
default: () => [item.types.name]
|
|
9566
|
+
});
|
|
9567
|
+
};
|
|
9568
|
+
const onHotTypeClick = (item) => {
|
|
9569
|
+
const matchNode = findHotTypeNode(item.id);
|
|
9570
|
+
if (!matchNode)
|
|
9571
|
+
return;
|
|
9572
|
+
selectCommonId.value = item.id;
|
|
9573
|
+
syncExpandNodeByParent(matchNode);
|
|
9574
|
+
selectNode.value = matchNode;
|
|
9575
|
+
emit("select", Object.assign(matchNode, {
|
|
9576
|
+
parent: matchNode.parent
|
|
9577
|
+
}));
|
|
9578
|
+
};
|
|
9579
|
+
const renderHotTypeButton = (item) => {
|
|
9580
|
+
const active = item.id === selectCommonId.value;
|
|
9581
|
+
return vue.createVNode(stdin_default$1L, {
|
|
9582
|
+
"size": "small",
|
|
9583
|
+
"class": [bem$L("common-types--btn")],
|
|
9584
|
+
"type": active ? "primary" : "default",
|
|
9585
|
+
"backgroundColor": active ? "#3388ff" : "var(--zt-background)",
|
|
9586
|
+
"borderColor": active ? "#3388ff" : "var(--zt-border-color)",
|
|
9587
|
+
"color": active ? "var(--zt-white)" : "var(--zt-text-color)",
|
|
9588
|
+
"onClick": () => onHotTypeClick(item)
|
|
9589
|
+
}, {
|
|
9590
|
+
default: () => [item.text || item.name]
|
|
9591
|
+
});
|
|
9592
|
+
};
|
|
9593
|
+
const renderCommonTypes = () => {
|
|
9594
|
+
if (!props.showCommonTypes)
|
|
9595
|
+
return null;
|
|
9596
|
+
return vue.createVNode("section", {
|
|
9597
|
+
"class": [bem$L("common-types")]
|
|
9598
|
+
}, [vue.createVNode("div", {
|
|
9599
|
+
"class": [bem$L("common-types--head")]
|
|
9600
|
+
}, [vue.createVNode("span", {
|
|
9601
|
+
"class": [bem$L("common-types--label")]
|
|
9602
|
+
}, [vue.createTextVNode("常用小类")]), visibleCommonTypeList.value.length > 0 ? vue.createVNode("div", {
|
|
9603
|
+
"class": [bem$L("common-types--mask")]
|
|
9604
|
+
}, [vue.createVNode("div", {
|
|
9605
|
+
"class": [bem$L("common-types--viewport")]
|
|
9606
|
+
}, [vue.createVNode("div", {
|
|
9607
|
+
"class": [bem$L("common-types--list")]
|
|
9608
|
+
}, [visibleCommonTypeList.value.map(renderCommonTypeButton)])])]) : vue.createVNode("div", {
|
|
9609
|
+
"class": [bem$L("common-types--empty")]
|
|
9610
|
+
}, [vue.createTextVNode("暂无常用小类")]), visibleCommonTypeList.value.length > 0 && vue.createVNode("div", {
|
|
9611
|
+
"class": [bem$L("common-types--icon")],
|
|
9612
|
+
"onClick": () => showAllCommonTypes.value = !showAllCommonTypes.value
|
|
9613
|
+
}, [vue.createVNode(stdin_default$1_, {
|
|
9614
|
+
"size": "24",
|
|
9615
|
+
"name": showAllCommonTypes.value ? "keyboard-arrow-up" : "keyboard-arrow-down",
|
|
9616
|
+
"color": showAllCommonTypes.value ? "var(--zt-primary-color)" : void 0
|
|
9617
|
+
}, null)])]), showAllCommonTypes.value && visibleCommonTypeList.value.length > 0 && vue.createVNode("div", {
|
|
9618
|
+
"class": [bem$L("common-types--panel")]
|
|
9619
|
+
}, [vue.createVNode("div", {
|
|
9620
|
+
"class": [bem$L("common-types--panel-list")]
|
|
9621
|
+
}, [visibleCommonTypeList.value.map(renderCommonTypeButton)]), vue.createVNode("div", {
|
|
9622
|
+
"class": [bem$L("common-types--clear")],
|
|
9623
|
+
"onClick": onClearCommonTypes
|
|
9624
|
+
}, [vue.createVNode(stdin_default$1_, {
|
|
9625
|
+
"name": "delete",
|
|
9626
|
+
"size": "20"
|
|
9627
|
+
}, null), vue.createVNode("span", {
|
|
9628
|
+
"class": [bem$L("common-types--clear-text")]
|
|
9629
|
+
}, [vue.createTextVNode("清空常用小类")])])])]);
|
|
9630
|
+
};
|
|
9631
|
+
const renderHotTypes = () => {
|
|
9632
|
+
var _a;
|
|
9633
|
+
if (!((_a = props.hotTypeList) == null ? void 0 : _a.length))
|
|
9634
|
+
return null;
|
|
9635
|
+
return vue.createVNode("section", {
|
|
9636
|
+
"class": [bem$L("hot-types")]
|
|
9637
|
+
}, [vue.createVNode("div", {
|
|
9638
|
+
"class": [bem$L("hot-types--label")]
|
|
9639
|
+
}, [vue.createTextVNode("热点小类")]), vue.createVNode("div", {
|
|
9640
|
+
"class": [bem$L("hot-types--list")]
|
|
9641
|
+
}, [props.hotTypeList.map(renderHotTypeButton)])]);
|
|
9642
|
+
};
|
|
9484
9643
|
const renderSecondTree = (item) => {
|
|
9485
9644
|
var _a, _b;
|
|
9486
9645
|
const text = item[fields.value.text];
|
|
@@ -9616,7 +9775,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9616
9775
|
}, null), vue.createTextVNode("清空搜索历史")])]), historyList.value.length === 0 && vue.createVNode("div", {
|
|
9617
9776
|
"class": [bem$L("empty")]
|
|
9618
9777
|
}, [vue.createTextVNode("暂无搜索记录")])])]
|
|
9619
|
-
})]), [[vue.vShow, show.value]])]), vue.createVNode("div", {
|
|
9778
|
+
})]), [[vue.vShow, show.value]])]), renderCommonTypes(), renderHotTypes(), vue.createVNode("div", {
|
|
9620
9779
|
"class": [bem$L("name"), "zt-hairline--bottom"]
|
|
9621
9780
|
}, [props.title]), vue.createVNode("main", {
|
|
9622
9781
|
"class": [bem$L("tree")]
|
|
@@ -21404,11 +21563,29 @@ var __publicField = (obj, key, value) => {
|
|
|
21404
21563
|
const gridRef = vue.ref();
|
|
21405
21564
|
const mediaListPlaceholder = vue.ref([]);
|
|
21406
21565
|
const sort = vue.ref();
|
|
21407
|
-
|
|
21566
|
+
const shouldIsolateSortableTouch = () => props.sortable && props.mediaList.length > 0;
|
|
21567
|
+
const stopSortableTouchStartPropagation = (event) => {
|
|
21568
|
+
if (!shouldIsolateSortableTouch()) {
|
|
21569
|
+
return;
|
|
21570
|
+
}
|
|
21571
|
+
event.stopPropagation();
|
|
21572
|
+
};
|
|
21573
|
+
const destroySortable = () => {
|
|
21408
21574
|
var _a;
|
|
21409
|
-
if (sort.value
|
|
21575
|
+
if ((_a = sort.value) == null ? void 0 : _a.destroy) {
|
|
21576
|
+
sort.value.destroy();
|
|
21577
|
+
}
|
|
21578
|
+
sort.value = void 0;
|
|
21579
|
+
};
|
|
21580
|
+
const initSortable = () => __async$2(this, null, function* () {
|
|
21581
|
+
var _a;
|
|
21582
|
+
if (sort.value || !props.sortable || !props.mediaList.length)
|
|
21583
|
+
return;
|
|
21584
|
+
yield vue.nextTick();
|
|
21585
|
+
const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
|
|
21586
|
+
if (!gridEl)
|
|
21410
21587
|
return;
|
|
21411
|
-
sort.value = Sortable.create(
|
|
21588
|
+
sort.value = Sortable.create(gridEl, {
|
|
21412
21589
|
animation: 200,
|
|
21413
21590
|
handle: ".zt-grid-item",
|
|
21414
21591
|
onEnd: (evt) => {
|
|
@@ -22139,6 +22316,18 @@ var __publicField = (obj, key, value) => {
|
|
|
22139
22316
|
actionVisible.value = false;
|
|
22140
22317
|
action.func && action.func();
|
|
22141
22318
|
};
|
|
22319
|
+
vue.watch(() => [props.sortable, props.mediaList.length], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
|
|
22320
|
+
if (!sortable || !mediaCount) {
|
|
22321
|
+
destroySortable();
|
|
22322
|
+
return;
|
|
22323
|
+
}
|
|
22324
|
+
yield initSortable();
|
|
22325
|
+
}), {
|
|
22326
|
+
immediate: true
|
|
22327
|
+
});
|
|
22328
|
+
vue.onBeforeUnmount(() => {
|
|
22329
|
+
destroySortable();
|
|
22330
|
+
});
|
|
22142
22331
|
useExpose({
|
|
22143
22332
|
mediaPickAction,
|
|
22144
22333
|
handleInputFiles,
|
|
@@ -22176,7 +22365,8 @@ var __publicField = (obj, key, value) => {
|
|
|
22176
22365
|
"border": false,
|
|
22177
22366
|
"square": true,
|
|
22178
22367
|
"gutter": "4",
|
|
22179
|
-
"class": bem$v("grid")
|
|
22368
|
+
"class": bem$v("grid"),
|
|
22369
|
+
"onTouchstart": stopSortableTouchStartPropagation
|
|
22180
22370
|
}, {
|
|
22181
22371
|
default: () => [renderMediaList()]
|
|
22182
22372
|
}), [[vue.vShow, props.mediaList.length]]), vue.withDirectives(vue.createVNode(stdin_default$Y, {
|
|
@@ -31183,7 +31373,7 @@ var __publicField = (obj, key, value) => {
|
|
|
31183
31373
|
});
|
|
31184
31374
|
}
|
|
31185
31375
|
};
|
|
31186
|
-
const version = "3.1.
|
|
31376
|
+
const version = "3.1.86";
|
|
31187
31377
|
function install(app) {
|
|
31188
31378
|
const components = [
|
|
31189
31379
|
ActionSheet,
|