zartui 3.1.64 → 3.1.65
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/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/multiple-picker/MultiplePicker.d.ts +13 -0
- package/es/multiple-picker/MultiplePicker.mjs +118 -24
- package/es/multiple-picker/index.d.ts +9 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/multiple-picker/MultiplePicker.d.ts +13 -0
- package/lib/multiple-picker/MultiplePicker.js +118 -24
- package/lib/multiple-picker/index.d.ts +9 -0
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +119 -25
- package/lib/zartui.es.js +119 -25
- package/lib/zartui.js +119 -25
- package/lib/zartui.min.js +1 -1
- package/package.json +4 -4
package/lib/zartui.cjs.js
CHANGED
|
@@ -16941,6 +16941,7 @@ const multiplePickerProps = {
|
|
|
16941
16941
|
showToolbar: truthProp,
|
|
16942
16942
|
showTitle: truthProp,
|
|
16943
16943
|
options: makeArrayProp(),
|
|
16944
|
+
filteredOptions: makeArrayProp(),
|
|
16944
16945
|
toolbarPosition: makeStringProp("bottom"),
|
|
16945
16946
|
textKey: makeStringProp("text"),
|
|
16946
16947
|
columnCounts: makeNumberProp(3),
|
|
@@ -16960,13 +16961,33 @@ var stdin_default$A = vue.defineComponent({
|
|
|
16960
16961
|
const currentOptions2 = vue.ref(props.options);
|
|
16961
16962
|
const currentSelectedIndex = vue.computed(() => props.selectedIndex);
|
|
16962
16963
|
const currentSelectedValue = vue.computed(() => props.selectedValue);
|
|
16964
|
+
const allSelectedOptions = vue.ref([]);
|
|
16963
16965
|
const confirmIndexes = vue.ref(props.selectedIndex);
|
|
16964
16966
|
const confirmValues = vue.ref(props.selectedValue);
|
|
16967
|
+
const displayOptions = vue.computed(() => {
|
|
16968
|
+
return props.filteredOptions && props.filteredOptions.length > 0 ? props.filteredOptions : currentOptions2.value;
|
|
16969
|
+
});
|
|
16970
|
+
const displaySelectedIndexes = vue.computed(() => {
|
|
16971
|
+
if (!props.filteredOptions || props.filteredOptions.length === 0) {
|
|
16972
|
+
return confirmIndexes.value;
|
|
16973
|
+
}
|
|
16974
|
+
const selectedValues = new Set(confirmIndexes.value.filter((idx) => idx >= 0 && idx < currentOptions2.value.length).map((idx) => {
|
|
16975
|
+
var _a;
|
|
16976
|
+
return (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
16977
|
+
}));
|
|
16978
|
+
const result = [];
|
|
16979
|
+
displayOptions.value.forEach((option2, index2) => {
|
|
16980
|
+
if (selectedValues.has(option2.value)) {
|
|
16981
|
+
result.push(index2);
|
|
16982
|
+
}
|
|
16983
|
+
});
|
|
16984
|
+
return result;
|
|
16985
|
+
});
|
|
16965
16986
|
const isIndeterminate = vue.computed(() => {
|
|
16966
|
-
return
|
|
16987
|
+
return displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length < displayOptions.value.length;
|
|
16967
16988
|
});
|
|
16968
16989
|
const isAllSelected = vue.computed(() => {
|
|
16969
|
-
return
|
|
16990
|
+
return displayOptions.value.length > 0 && displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length === displayOptions.value.length;
|
|
16970
16991
|
});
|
|
16971
16992
|
const resetOptions = (props2) => {
|
|
16972
16993
|
currentOptions2.value = props2.options;
|
|
@@ -16979,14 +17000,39 @@ var stdin_default$A = vue.defineComponent({
|
|
|
16979
17000
|
emit("update:selectedValue", confirmValues.value);
|
|
16980
17001
|
};
|
|
16981
17002
|
const onUpdateCurrentIndexes = (newVal) => {
|
|
16982
|
-
|
|
16983
|
-
|
|
17003
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
17004
|
+
const selectedValues = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
|
|
17005
|
+
var _a;
|
|
17006
|
+
return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
|
|
17007
|
+
});
|
|
17008
|
+
const newSelectedIndexes = /* @__PURE__ */ new Set();
|
|
17009
|
+
confirmIndexes.value.forEach((idx) => {
|
|
17010
|
+
var _a;
|
|
17011
|
+
if (idx >= 0 && idx < currentOptions2.value.length) {
|
|
17012
|
+
const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
17013
|
+
const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
|
|
17014
|
+
if (!isInFilteredList) {
|
|
17015
|
+
newSelectedIndexes.add(idx);
|
|
17016
|
+
}
|
|
17017
|
+
}
|
|
17018
|
+
});
|
|
17019
|
+
selectedValues.forEach((value) => {
|
|
17020
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === value);
|
|
17021
|
+
if (originalIndex >= 0) {
|
|
17022
|
+
newSelectedIndexes.add(originalIndex);
|
|
17023
|
+
}
|
|
17024
|
+
});
|
|
17025
|
+
confirmIndexes.value = Array.from(newSelectedIndexes);
|
|
17026
|
+
} else {
|
|
17027
|
+
confirmIndexes.value = newVal;
|
|
17028
|
+
}
|
|
17029
|
+
if (confirmIndexes.value.length > 0) {
|
|
16984
17030
|
getValuesByIndexes();
|
|
16985
17031
|
} else {
|
|
16986
17032
|
confirmValues.value = [];
|
|
16987
17033
|
}
|
|
16988
|
-
getValuesByIndexes();
|
|
16989
17034
|
emit("update:selectedValue", confirmValues.value);
|
|
17035
|
+
updateAllSelectedOptions();
|
|
16990
17036
|
};
|
|
16991
17037
|
const getIndexesByValues = () => {
|
|
16992
17038
|
var _a;
|
|
@@ -17038,20 +17084,27 @@ var stdin_default$A = vue.defineComponent({
|
|
|
17038
17084
|
};
|
|
17039
17085
|
const updateShow = (value) => emit("update:showPicker", value);
|
|
17040
17086
|
const getOptions = () => {
|
|
17041
|
-
|
|
17087
|
+
return allSelectedOptions.value;
|
|
17088
|
+
};
|
|
17089
|
+
const onChange = () => {
|
|
17090
|
+
updateAllSelectedOptions();
|
|
17091
|
+
emit("change", getOptions());
|
|
17092
|
+
};
|
|
17093
|
+
const updateAllSelectedOptions = () => {
|
|
17042
17094
|
const result = [];
|
|
17095
|
+
const indexes = confirmIndexes.value;
|
|
17043
17096
|
indexes == null ? void 0 : indexes.forEach((index2) => {
|
|
17044
17097
|
if (index2 > -1 && index2 < currentOptions2.value.length && currentOptions2.value[index2]) {
|
|
17098
|
+
const option2 = currentOptions2.value[index2];
|
|
17045
17099
|
result.push({
|
|
17046
|
-
[props.textKey]:
|
|
17047
|
-
value:
|
|
17100
|
+
[props.textKey]: option2[props.textKey],
|
|
17101
|
+
value: option2.value,
|
|
17048
17102
|
initialIndex: index2
|
|
17049
17103
|
});
|
|
17050
17104
|
}
|
|
17051
17105
|
});
|
|
17052
|
-
|
|
17106
|
+
allSelectedOptions.value = result;
|
|
17053
17107
|
};
|
|
17054
|
-
const onChange = () => emit("change", getOptions());
|
|
17055
17108
|
const confirm = () => {
|
|
17056
17109
|
const options = getOptions();
|
|
17057
17110
|
emit("confirm", options);
|
|
@@ -17135,33 +17188,74 @@ var stdin_default$A = vue.defineComponent({
|
|
|
17135
17188
|
"class": bem$s("toolbar-divider")
|
|
17136
17189
|
}, null), vue.createVNode("span", {
|
|
17137
17190
|
"class": bem$s("toolbar-checkbox-text")
|
|
17138
|
-
}, [vue.createTextVNode("已选 "),
|
|
17191
|
+
}, [vue.createTextVNode("已选 "), allSelectedOptions.value.length])]);
|
|
17139
17192
|
const handleSelectAll = () => {
|
|
17140
|
-
|
|
17193
|
+
if (!isAllSelected.value) {
|
|
17194
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
17195
|
+
const selectedIndexes = [];
|
|
17196
|
+
displayOptions.value.forEach((option2) => {
|
|
17197
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
|
|
17198
|
+
if (originalIndex >= 0) {
|
|
17199
|
+
selectedIndexes.push(originalIndex);
|
|
17200
|
+
}
|
|
17201
|
+
});
|
|
17202
|
+
confirmIndexes.value = selectedIndexes;
|
|
17203
|
+
} else {
|
|
17204
|
+
confirmIndexes.value = currentOptions2.value.map((_, index2) => index2);
|
|
17205
|
+
}
|
|
17206
|
+
} else {
|
|
17207
|
+
confirmIndexes.value = [];
|
|
17208
|
+
}
|
|
17209
|
+
updateAllSelectedOptions();
|
|
17141
17210
|
};
|
|
17142
17211
|
const onSelectOther = () => {
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
|
|
17148
|
-
|
|
17149
|
-
|
|
17212
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
17213
|
+
const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
|
|
17214
|
+
const currentSelectedInFiltered = /* @__PURE__ */ new Set();
|
|
17215
|
+
confirmIndexes.value.forEach((idx) => {
|
|
17216
|
+
var _a;
|
|
17217
|
+
if (idx >= 0 && idx < currentOptions2.value.length) {
|
|
17218
|
+
const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
17219
|
+
if (filteredValues.has(value)) {
|
|
17220
|
+
currentSelectedInFiltered.add(idx);
|
|
17221
|
+
}
|
|
17222
|
+
}
|
|
17223
|
+
});
|
|
17224
|
+
const newSelectedIndexes = [];
|
|
17225
|
+
displayOptions.value.forEach((option2) => {
|
|
17226
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
|
|
17227
|
+
if (originalIndex >= 0) {
|
|
17228
|
+
if (!currentSelectedInFiltered.has(originalIndex)) {
|
|
17229
|
+
newSelectedIndexes.push(originalIndex);
|
|
17230
|
+
}
|
|
17231
|
+
}
|
|
17232
|
+
});
|
|
17233
|
+
confirmIndexes.value = newSelectedIndexes;
|
|
17234
|
+
} else {
|
|
17235
|
+
const temp = new Array();
|
|
17236
|
+
currentOptions2.value.forEach((_, index2) => {
|
|
17237
|
+
if (!confirmIndexes.value.includes(index2)) {
|
|
17238
|
+
temp.push(index2);
|
|
17239
|
+
}
|
|
17240
|
+
});
|
|
17241
|
+
confirmIndexes.value = temp;
|
|
17242
|
+
}
|
|
17243
|
+
updateAllSelectedOptions();
|
|
17150
17244
|
};
|
|
17151
17245
|
const genOptionItems = () => {
|
|
17152
17246
|
let formatOptions = [];
|
|
17153
|
-
if (
|
|
17154
|
-
formatOptions =
|
|
17247
|
+
if (displayOptions.value && displayOptions.value[0] && typeof displayOptions.value[0] !== "object") {
|
|
17248
|
+
formatOptions = displayOptions.value.map((v) => ({
|
|
17155
17249
|
value: v,
|
|
17156
17250
|
text: v
|
|
17157
17251
|
}));
|
|
17158
17252
|
} else {
|
|
17159
|
-
formatOptions =
|
|
17253
|
+
formatOptions = displayOptions.value;
|
|
17160
17254
|
}
|
|
17161
17255
|
return vue.createVNode(stdin_default$B, {
|
|
17162
17256
|
"ref": pickerOptions,
|
|
17163
|
-
"currentIndexes":
|
|
17164
|
-
"onUpdate:currentIndexes": [($event) =>
|
|
17257
|
+
"currentIndexes": displaySelectedIndexes.value,
|
|
17258
|
+
"onUpdate:currentIndexes": [($event) => displaySelectedIndexes.value = $event, onUpdateCurrentIndexes],
|
|
17165
17259
|
"columnCounts": props.columnCounts,
|
|
17166
17260
|
"initialOptions": formatOptions,
|
|
17167
17261
|
"allowHtml": props.allowHtml,
|
|
@@ -23268,7 +23362,7 @@ const Lazyload = {
|
|
|
23268
23362
|
});
|
|
23269
23363
|
}
|
|
23270
23364
|
};
|
|
23271
|
-
const version = "3.1.
|
|
23365
|
+
const version = "3.1.65";
|
|
23272
23366
|
function install(app) {
|
|
23273
23367
|
const components = [
|
|
23274
23368
|
ActionSheet,
|
package/lib/zartui.es.js
CHANGED
|
@@ -16939,6 +16939,7 @@ const multiplePickerProps = {
|
|
|
16939
16939
|
showToolbar: truthProp,
|
|
16940
16940
|
showTitle: truthProp,
|
|
16941
16941
|
options: makeArrayProp(),
|
|
16942
|
+
filteredOptions: makeArrayProp(),
|
|
16942
16943
|
toolbarPosition: makeStringProp("bottom"),
|
|
16943
16944
|
textKey: makeStringProp("text"),
|
|
16944
16945
|
columnCounts: makeNumberProp(3),
|
|
@@ -16958,13 +16959,33 @@ var stdin_default$A = defineComponent({
|
|
|
16958
16959
|
const currentOptions2 = ref(props.options);
|
|
16959
16960
|
const currentSelectedIndex = computed(() => props.selectedIndex);
|
|
16960
16961
|
const currentSelectedValue = computed(() => props.selectedValue);
|
|
16962
|
+
const allSelectedOptions = ref([]);
|
|
16961
16963
|
const confirmIndexes = ref(props.selectedIndex);
|
|
16962
16964
|
const confirmValues = ref(props.selectedValue);
|
|
16965
|
+
const displayOptions = computed(() => {
|
|
16966
|
+
return props.filteredOptions && props.filteredOptions.length > 0 ? props.filteredOptions : currentOptions2.value;
|
|
16967
|
+
});
|
|
16968
|
+
const displaySelectedIndexes = computed(() => {
|
|
16969
|
+
if (!props.filteredOptions || props.filteredOptions.length === 0) {
|
|
16970
|
+
return confirmIndexes.value;
|
|
16971
|
+
}
|
|
16972
|
+
const selectedValues = new Set(confirmIndexes.value.filter((idx) => idx >= 0 && idx < currentOptions2.value.length).map((idx) => {
|
|
16973
|
+
var _a;
|
|
16974
|
+
return (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
16975
|
+
}));
|
|
16976
|
+
const result = [];
|
|
16977
|
+
displayOptions.value.forEach((option2, index2) => {
|
|
16978
|
+
if (selectedValues.has(option2.value)) {
|
|
16979
|
+
result.push(index2);
|
|
16980
|
+
}
|
|
16981
|
+
});
|
|
16982
|
+
return result;
|
|
16983
|
+
});
|
|
16963
16984
|
const isIndeterminate = computed(() => {
|
|
16964
|
-
return
|
|
16985
|
+
return displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length < displayOptions.value.length;
|
|
16965
16986
|
});
|
|
16966
16987
|
const isAllSelected = computed(() => {
|
|
16967
|
-
return
|
|
16988
|
+
return displayOptions.value.length > 0 && displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length === displayOptions.value.length;
|
|
16968
16989
|
});
|
|
16969
16990
|
const resetOptions = (props2) => {
|
|
16970
16991
|
currentOptions2.value = props2.options;
|
|
@@ -16977,14 +16998,39 @@ var stdin_default$A = defineComponent({
|
|
|
16977
16998
|
emit("update:selectedValue", confirmValues.value);
|
|
16978
16999
|
};
|
|
16979
17000
|
const onUpdateCurrentIndexes = (newVal) => {
|
|
16980
|
-
|
|
16981
|
-
|
|
17001
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
17002
|
+
const selectedValues = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
|
|
17003
|
+
var _a;
|
|
17004
|
+
return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
|
|
17005
|
+
});
|
|
17006
|
+
const newSelectedIndexes = /* @__PURE__ */ new Set();
|
|
17007
|
+
confirmIndexes.value.forEach((idx) => {
|
|
17008
|
+
var _a;
|
|
17009
|
+
if (idx >= 0 && idx < currentOptions2.value.length) {
|
|
17010
|
+
const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
17011
|
+
const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
|
|
17012
|
+
if (!isInFilteredList) {
|
|
17013
|
+
newSelectedIndexes.add(idx);
|
|
17014
|
+
}
|
|
17015
|
+
}
|
|
17016
|
+
});
|
|
17017
|
+
selectedValues.forEach((value) => {
|
|
17018
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === value);
|
|
17019
|
+
if (originalIndex >= 0) {
|
|
17020
|
+
newSelectedIndexes.add(originalIndex);
|
|
17021
|
+
}
|
|
17022
|
+
});
|
|
17023
|
+
confirmIndexes.value = Array.from(newSelectedIndexes);
|
|
17024
|
+
} else {
|
|
17025
|
+
confirmIndexes.value = newVal;
|
|
17026
|
+
}
|
|
17027
|
+
if (confirmIndexes.value.length > 0) {
|
|
16982
17028
|
getValuesByIndexes();
|
|
16983
17029
|
} else {
|
|
16984
17030
|
confirmValues.value = [];
|
|
16985
17031
|
}
|
|
16986
|
-
getValuesByIndexes();
|
|
16987
17032
|
emit("update:selectedValue", confirmValues.value);
|
|
17033
|
+
updateAllSelectedOptions();
|
|
16988
17034
|
};
|
|
16989
17035
|
const getIndexesByValues = () => {
|
|
16990
17036
|
var _a;
|
|
@@ -17036,20 +17082,27 @@ var stdin_default$A = defineComponent({
|
|
|
17036
17082
|
};
|
|
17037
17083
|
const updateShow = (value) => emit("update:showPicker", value);
|
|
17038
17084
|
const getOptions = () => {
|
|
17039
|
-
|
|
17085
|
+
return allSelectedOptions.value;
|
|
17086
|
+
};
|
|
17087
|
+
const onChange = () => {
|
|
17088
|
+
updateAllSelectedOptions();
|
|
17089
|
+
emit("change", getOptions());
|
|
17090
|
+
};
|
|
17091
|
+
const updateAllSelectedOptions = () => {
|
|
17040
17092
|
const result = [];
|
|
17093
|
+
const indexes = confirmIndexes.value;
|
|
17041
17094
|
indexes == null ? void 0 : indexes.forEach((index2) => {
|
|
17042
17095
|
if (index2 > -1 && index2 < currentOptions2.value.length && currentOptions2.value[index2]) {
|
|
17096
|
+
const option2 = currentOptions2.value[index2];
|
|
17043
17097
|
result.push({
|
|
17044
|
-
[props.textKey]:
|
|
17045
|
-
value:
|
|
17098
|
+
[props.textKey]: option2[props.textKey],
|
|
17099
|
+
value: option2.value,
|
|
17046
17100
|
initialIndex: index2
|
|
17047
17101
|
});
|
|
17048
17102
|
}
|
|
17049
17103
|
});
|
|
17050
|
-
|
|
17104
|
+
allSelectedOptions.value = result;
|
|
17051
17105
|
};
|
|
17052
|
-
const onChange = () => emit("change", getOptions());
|
|
17053
17106
|
const confirm = () => {
|
|
17054
17107
|
const options = getOptions();
|
|
17055
17108
|
emit("confirm", options);
|
|
@@ -17133,33 +17186,74 @@ var stdin_default$A = defineComponent({
|
|
|
17133
17186
|
"class": bem$s("toolbar-divider")
|
|
17134
17187
|
}, null), createVNode("span", {
|
|
17135
17188
|
"class": bem$s("toolbar-checkbox-text")
|
|
17136
|
-
}, [createTextVNode("已选 "),
|
|
17189
|
+
}, [createTextVNode("已选 "), allSelectedOptions.value.length])]);
|
|
17137
17190
|
const handleSelectAll = () => {
|
|
17138
|
-
|
|
17191
|
+
if (!isAllSelected.value) {
|
|
17192
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
17193
|
+
const selectedIndexes = [];
|
|
17194
|
+
displayOptions.value.forEach((option2) => {
|
|
17195
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
|
|
17196
|
+
if (originalIndex >= 0) {
|
|
17197
|
+
selectedIndexes.push(originalIndex);
|
|
17198
|
+
}
|
|
17199
|
+
});
|
|
17200
|
+
confirmIndexes.value = selectedIndexes;
|
|
17201
|
+
} else {
|
|
17202
|
+
confirmIndexes.value = currentOptions2.value.map((_, index2) => index2);
|
|
17203
|
+
}
|
|
17204
|
+
} else {
|
|
17205
|
+
confirmIndexes.value = [];
|
|
17206
|
+
}
|
|
17207
|
+
updateAllSelectedOptions();
|
|
17139
17208
|
};
|
|
17140
17209
|
const onSelectOther = () => {
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
|
|
17210
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
17211
|
+
const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
|
|
17212
|
+
const currentSelectedInFiltered = /* @__PURE__ */ new Set();
|
|
17213
|
+
confirmIndexes.value.forEach((idx) => {
|
|
17214
|
+
var _a;
|
|
17215
|
+
if (idx >= 0 && idx < currentOptions2.value.length) {
|
|
17216
|
+
const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
17217
|
+
if (filteredValues.has(value)) {
|
|
17218
|
+
currentSelectedInFiltered.add(idx);
|
|
17219
|
+
}
|
|
17220
|
+
}
|
|
17221
|
+
});
|
|
17222
|
+
const newSelectedIndexes = [];
|
|
17223
|
+
displayOptions.value.forEach((option2) => {
|
|
17224
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
|
|
17225
|
+
if (originalIndex >= 0) {
|
|
17226
|
+
if (!currentSelectedInFiltered.has(originalIndex)) {
|
|
17227
|
+
newSelectedIndexes.push(originalIndex);
|
|
17228
|
+
}
|
|
17229
|
+
}
|
|
17230
|
+
});
|
|
17231
|
+
confirmIndexes.value = newSelectedIndexes;
|
|
17232
|
+
} else {
|
|
17233
|
+
const temp = new Array();
|
|
17234
|
+
currentOptions2.value.forEach((_, index2) => {
|
|
17235
|
+
if (!confirmIndexes.value.includes(index2)) {
|
|
17236
|
+
temp.push(index2);
|
|
17237
|
+
}
|
|
17238
|
+
});
|
|
17239
|
+
confirmIndexes.value = temp;
|
|
17240
|
+
}
|
|
17241
|
+
updateAllSelectedOptions();
|
|
17148
17242
|
};
|
|
17149
17243
|
const genOptionItems = () => {
|
|
17150
17244
|
let formatOptions = [];
|
|
17151
|
-
if (
|
|
17152
|
-
formatOptions =
|
|
17245
|
+
if (displayOptions.value && displayOptions.value[0] && typeof displayOptions.value[0] !== "object") {
|
|
17246
|
+
formatOptions = displayOptions.value.map((v) => ({
|
|
17153
17247
|
value: v,
|
|
17154
17248
|
text: v
|
|
17155
17249
|
}));
|
|
17156
17250
|
} else {
|
|
17157
|
-
formatOptions =
|
|
17251
|
+
formatOptions = displayOptions.value;
|
|
17158
17252
|
}
|
|
17159
17253
|
return createVNode(stdin_default$B, {
|
|
17160
17254
|
"ref": pickerOptions,
|
|
17161
|
-
"currentIndexes":
|
|
17162
|
-
"onUpdate:currentIndexes": [($event) =>
|
|
17255
|
+
"currentIndexes": displaySelectedIndexes.value,
|
|
17256
|
+
"onUpdate:currentIndexes": [($event) => displaySelectedIndexes.value = $event, onUpdateCurrentIndexes],
|
|
17163
17257
|
"columnCounts": props.columnCounts,
|
|
17164
17258
|
"initialOptions": formatOptions,
|
|
17165
17259
|
"allowHtml": props.allowHtml,
|
|
@@ -23266,7 +23360,7 @@ const Lazyload = {
|
|
|
23266
23360
|
});
|
|
23267
23361
|
}
|
|
23268
23362
|
};
|
|
23269
|
-
const version = "3.1.
|
|
23363
|
+
const version = "3.1.65";
|
|
23270
23364
|
function install(app) {
|
|
23271
23365
|
const components = [
|
|
23272
23366
|
ActionSheet,
|
package/lib/zartui.js
CHANGED
|
@@ -18717,6 +18717,7 @@
|
|
|
18717
18717
|
showToolbar: truthProp,
|
|
18718
18718
|
showTitle: truthProp,
|
|
18719
18719
|
options: makeArrayProp(),
|
|
18720
|
+
filteredOptions: makeArrayProp(),
|
|
18720
18721
|
toolbarPosition: makeStringProp("bottom"),
|
|
18721
18722
|
textKey: makeStringProp("text"),
|
|
18722
18723
|
columnCounts: makeNumberProp(3),
|
|
@@ -18736,13 +18737,33 @@
|
|
|
18736
18737
|
const currentOptions2 = vue.ref(props.options);
|
|
18737
18738
|
const currentSelectedIndex = vue.computed(() => props.selectedIndex);
|
|
18738
18739
|
const currentSelectedValue = vue.computed(() => props.selectedValue);
|
|
18740
|
+
const allSelectedOptions = vue.ref([]);
|
|
18739
18741
|
const confirmIndexes = vue.ref(props.selectedIndex);
|
|
18740
18742
|
const confirmValues = vue.ref(props.selectedValue);
|
|
18743
|
+
const displayOptions = vue.computed(() => {
|
|
18744
|
+
return props.filteredOptions && props.filteredOptions.length > 0 ? props.filteredOptions : currentOptions2.value;
|
|
18745
|
+
});
|
|
18746
|
+
const displaySelectedIndexes = vue.computed(() => {
|
|
18747
|
+
if (!props.filteredOptions || props.filteredOptions.length === 0) {
|
|
18748
|
+
return confirmIndexes.value;
|
|
18749
|
+
}
|
|
18750
|
+
const selectedValues = new Set(confirmIndexes.value.filter((idx) => idx >= 0 && idx < currentOptions2.value.length).map((idx) => {
|
|
18751
|
+
var _a;
|
|
18752
|
+
return (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
18753
|
+
}));
|
|
18754
|
+
const result = [];
|
|
18755
|
+
displayOptions.value.forEach((option, index2) => {
|
|
18756
|
+
if (selectedValues.has(option.value)) {
|
|
18757
|
+
result.push(index2);
|
|
18758
|
+
}
|
|
18759
|
+
});
|
|
18760
|
+
return result;
|
|
18761
|
+
});
|
|
18741
18762
|
const isIndeterminate = vue.computed(() => {
|
|
18742
|
-
return
|
|
18763
|
+
return displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length < displayOptions.value.length;
|
|
18743
18764
|
});
|
|
18744
18765
|
const isAllSelected = vue.computed(() => {
|
|
18745
|
-
return
|
|
18766
|
+
return displayOptions.value.length > 0 && displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length === displayOptions.value.length;
|
|
18746
18767
|
});
|
|
18747
18768
|
const resetOptions = (props2) => {
|
|
18748
18769
|
currentOptions2.value = props2.options;
|
|
@@ -18755,14 +18776,39 @@
|
|
|
18755
18776
|
emit("update:selectedValue", confirmValues.value);
|
|
18756
18777
|
};
|
|
18757
18778
|
const onUpdateCurrentIndexes = (newVal) => {
|
|
18758
|
-
|
|
18759
|
-
|
|
18779
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
18780
|
+
const selectedValues = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
|
|
18781
|
+
var _a;
|
|
18782
|
+
return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
|
|
18783
|
+
});
|
|
18784
|
+
const newSelectedIndexes = /* @__PURE__ */ new Set();
|
|
18785
|
+
confirmIndexes.value.forEach((idx) => {
|
|
18786
|
+
var _a;
|
|
18787
|
+
if (idx >= 0 && idx < currentOptions2.value.length) {
|
|
18788
|
+
const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
18789
|
+
const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
|
|
18790
|
+
if (!isInFilteredList) {
|
|
18791
|
+
newSelectedIndexes.add(idx);
|
|
18792
|
+
}
|
|
18793
|
+
}
|
|
18794
|
+
});
|
|
18795
|
+
selectedValues.forEach((value) => {
|
|
18796
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === value);
|
|
18797
|
+
if (originalIndex >= 0) {
|
|
18798
|
+
newSelectedIndexes.add(originalIndex);
|
|
18799
|
+
}
|
|
18800
|
+
});
|
|
18801
|
+
confirmIndexes.value = Array.from(newSelectedIndexes);
|
|
18802
|
+
} else {
|
|
18803
|
+
confirmIndexes.value = newVal;
|
|
18804
|
+
}
|
|
18805
|
+
if (confirmIndexes.value.length > 0) {
|
|
18760
18806
|
getValuesByIndexes();
|
|
18761
18807
|
} else {
|
|
18762
18808
|
confirmValues.value = [];
|
|
18763
18809
|
}
|
|
18764
|
-
getValuesByIndexes();
|
|
18765
18810
|
emit("update:selectedValue", confirmValues.value);
|
|
18811
|
+
updateAllSelectedOptions();
|
|
18766
18812
|
};
|
|
18767
18813
|
const getIndexesByValues = () => {
|
|
18768
18814
|
var _a;
|
|
@@ -18814,20 +18860,27 @@
|
|
|
18814
18860
|
};
|
|
18815
18861
|
const updateShow = (value) => emit("update:showPicker", value);
|
|
18816
18862
|
const getOptions = () => {
|
|
18817
|
-
|
|
18863
|
+
return allSelectedOptions.value;
|
|
18864
|
+
};
|
|
18865
|
+
const onChange = () => {
|
|
18866
|
+
updateAllSelectedOptions();
|
|
18867
|
+
emit("change", getOptions());
|
|
18868
|
+
};
|
|
18869
|
+
const updateAllSelectedOptions = () => {
|
|
18818
18870
|
const result = [];
|
|
18871
|
+
const indexes = confirmIndexes.value;
|
|
18819
18872
|
indexes == null ? void 0 : indexes.forEach((index2) => {
|
|
18820
18873
|
if (index2 > -1 && index2 < currentOptions2.value.length && currentOptions2.value[index2]) {
|
|
18874
|
+
const option = currentOptions2.value[index2];
|
|
18821
18875
|
result.push({
|
|
18822
|
-
[props.textKey]:
|
|
18823
|
-
value:
|
|
18876
|
+
[props.textKey]: option[props.textKey],
|
|
18877
|
+
value: option.value,
|
|
18824
18878
|
initialIndex: index2
|
|
18825
18879
|
});
|
|
18826
18880
|
}
|
|
18827
18881
|
});
|
|
18828
|
-
|
|
18882
|
+
allSelectedOptions.value = result;
|
|
18829
18883
|
};
|
|
18830
|
-
const onChange = () => emit("change", getOptions());
|
|
18831
18884
|
const confirm = () => {
|
|
18832
18885
|
const options = getOptions();
|
|
18833
18886
|
emit("confirm", options);
|
|
@@ -18911,33 +18964,74 @@
|
|
|
18911
18964
|
"class": bem$s("toolbar-divider")
|
|
18912
18965
|
}, null), vue.createVNode("span", {
|
|
18913
18966
|
"class": bem$s("toolbar-checkbox-text")
|
|
18914
|
-
}, [vue.createTextVNode("已选 "),
|
|
18967
|
+
}, [vue.createTextVNode("已选 "), allSelectedOptions.value.length])]);
|
|
18915
18968
|
const handleSelectAll = () => {
|
|
18916
|
-
|
|
18969
|
+
if (!isAllSelected.value) {
|
|
18970
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
18971
|
+
const selectedIndexes = [];
|
|
18972
|
+
displayOptions.value.forEach((option) => {
|
|
18973
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option.value);
|
|
18974
|
+
if (originalIndex >= 0) {
|
|
18975
|
+
selectedIndexes.push(originalIndex);
|
|
18976
|
+
}
|
|
18977
|
+
});
|
|
18978
|
+
confirmIndexes.value = selectedIndexes;
|
|
18979
|
+
} else {
|
|
18980
|
+
confirmIndexes.value = currentOptions2.value.map((_, index2) => index2);
|
|
18981
|
+
}
|
|
18982
|
+
} else {
|
|
18983
|
+
confirmIndexes.value = [];
|
|
18984
|
+
}
|
|
18985
|
+
updateAllSelectedOptions();
|
|
18917
18986
|
};
|
|
18918
18987
|
const onSelectOther = () => {
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18988
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
18989
|
+
const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
|
|
18990
|
+
const currentSelectedInFiltered = /* @__PURE__ */ new Set();
|
|
18991
|
+
confirmIndexes.value.forEach((idx) => {
|
|
18992
|
+
var _a;
|
|
18993
|
+
if (idx >= 0 && idx < currentOptions2.value.length) {
|
|
18994
|
+
const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
|
|
18995
|
+
if (filteredValues.has(value)) {
|
|
18996
|
+
currentSelectedInFiltered.add(idx);
|
|
18997
|
+
}
|
|
18998
|
+
}
|
|
18999
|
+
});
|
|
19000
|
+
const newSelectedIndexes = [];
|
|
19001
|
+
displayOptions.value.forEach((option) => {
|
|
19002
|
+
const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option.value);
|
|
19003
|
+
if (originalIndex >= 0) {
|
|
19004
|
+
if (!currentSelectedInFiltered.has(originalIndex)) {
|
|
19005
|
+
newSelectedIndexes.push(originalIndex);
|
|
19006
|
+
}
|
|
19007
|
+
}
|
|
19008
|
+
});
|
|
19009
|
+
confirmIndexes.value = newSelectedIndexes;
|
|
19010
|
+
} else {
|
|
19011
|
+
const temp = new Array();
|
|
19012
|
+
currentOptions2.value.forEach((_, index2) => {
|
|
19013
|
+
if (!confirmIndexes.value.includes(index2)) {
|
|
19014
|
+
temp.push(index2);
|
|
19015
|
+
}
|
|
19016
|
+
});
|
|
19017
|
+
confirmIndexes.value = temp;
|
|
19018
|
+
}
|
|
19019
|
+
updateAllSelectedOptions();
|
|
18926
19020
|
};
|
|
18927
19021
|
const genOptionItems = () => {
|
|
18928
19022
|
let formatOptions = [];
|
|
18929
|
-
if (
|
|
18930
|
-
formatOptions =
|
|
19023
|
+
if (displayOptions.value && displayOptions.value[0] && typeof displayOptions.value[0] !== "object") {
|
|
19024
|
+
formatOptions = displayOptions.value.map((v) => ({
|
|
18931
19025
|
value: v,
|
|
18932
19026
|
text: v
|
|
18933
19027
|
}));
|
|
18934
19028
|
} else {
|
|
18935
|
-
formatOptions =
|
|
19029
|
+
formatOptions = displayOptions.value;
|
|
18936
19030
|
}
|
|
18937
19031
|
return vue.createVNode(stdin_default$B, {
|
|
18938
19032
|
"ref": pickerOptions,
|
|
18939
|
-
"currentIndexes":
|
|
18940
|
-
"onUpdate:currentIndexes": [($event) =>
|
|
19033
|
+
"currentIndexes": displaySelectedIndexes.value,
|
|
19034
|
+
"onUpdate:currentIndexes": [($event) => displaySelectedIndexes.value = $event, onUpdateCurrentIndexes],
|
|
18941
19035
|
"columnCounts": props.columnCounts,
|
|
18942
19036
|
"initialOptions": formatOptions,
|
|
18943
19037
|
"allowHtml": props.allowHtml,
|
|
@@ -27328,7 +27422,7 @@
|
|
|
27328
27422
|
});
|
|
27329
27423
|
}
|
|
27330
27424
|
};
|
|
27331
|
-
const version = "3.1.
|
|
27425
|
+
const version = "3.1.65";
|
|
27332
27426
|
function install(app) {
|
|
27333
27427
|
const components = [
|
|
27334
27428
|
ActionSheet,
|