zartui 3.1.63 → 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 +121 -28
- 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 +121 -28
- package/lib/multiple-picker/index.d.ts +9 -0
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +122 -29
- package/lib/zartui.es.js +122 -29
- package/lib/zartui.js +122 -29
- package/lib/zartui.min.js +1 -1
- package/package.json +4 -4
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
|
@@ -77,7 +77,7 @@ import { Timeline } from "./timeline/index.mjs";
|
|
|
77
77
|
import { Toast } from "./toast/index.mjs";
|
|
78
78
|
import { Uploader } from "./uploader/index.mjs";
|
|
79
79
|
import { Video } from "./video/index.mjs";
|
|
80
|
-
const version = "3.1.
|
|
80
|
+
const version = "3.1.65";
|
|
81
81
|
function install(app) {
|
|
82
82
|
const components = [
|
|
83
83
|
ActionSheet,
|
|
@@ -37,6 +37,10 @@ declare const multiplePickerProps: {
|
|
|
37
37
|
type: import("vue").PropType<PickerOption[]>;
|
|
38
38
|
default: () => PickerOption[];
|
|
39
39
|
};
|
|
40
|
+
filteredOptions: {
|
|
41
|
+
type: import("vue").PropType<PickerOption[]>;
|
|
42
|
+
default: () => PickerOption[];
|
|
43
|
+
};
|
|
40
44
|
toolbarPosition: {
|
|
41
45
|
type: import("vue").PropType<string>;
|
|
42
46
|
default: string;
|
|
@@ -106,6 +110,10 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
106
110
|
type: import("vue").PropType<PickerOption[]>;
|
|
107
111
|
default: () => PickerOption[];
|
|
108
112
|
};
|
|
113
|
+
filteredOptions: {
|
|
114
|
+
type: import("vue").PropType<PickerOption[]>;
|
|
115
|
+
default: () => PickerOption[];
|
|
116
|
+
};
|
|
109
117
|
toolbarPosition: {
|
|
110
118
|
type: import("vue").PropType<string>;
|
|
111
119
|
default: string;
|
|
@@ -167,6 +175,10 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
167
175
|
type: import("vue").PropType<PickerOption[]>;
|
|
168
176
|
default: () => PickerOption[];
|
|
169
177
|
};
|
|
178
|
+
filteredOptions: {
|
|
179
|
+
type: import("vue").PropType<PickerOption[]>;
|
|
180
|
+
default: () => PickerOption[];
|
|
181
|
+
};
|
|
170
182
|
toolbarPosition: {
|
|
171
183
|
type: import("vue").PropType<string>;
|
|
172
184
|
default: string;
|
|
@@ -213,6 +225,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
213
225
|
textKey: string;
|
|
214
226
|
itemHeight: string | number;
|
|
215
227
|
columnCounts: number;
|
|
228
|
+
filteredOptions: PickerOption[];
|
|
216
229
|
toolbarPosition: string;
|
|
217
230
|
selectedIndex: number[];
|
|
218
231
|
selectedValue: Numeric[];
|
|
@@ -24,6 +24,7 @@ const multiplePickerProps = {
|
|
|
24
24
|
showToolbar: truthProp,
|
|
25
25
|
showTitle: truthProp,
|
|
26
26
|
options: makeArrayProp(),
|
|
27
|
+
filteredOptions: makeArrayProp(),
|
|
27
28
|
toolbarPosition: makeStringProp("bottom"),
|
|
28
29
|
textKey: makeStringProp("text"),
|
|
29
30
|
columnCounts: makeNumberProp(3),
|
|
@@ -43,13 +44,33 @@ var stdin_default = defineComponent({
|
|
|
43
44
|
const currentOptions = ref(props.options);
|
|
44
45
|
const currentSelectedIndex = computed(() => props.selectedIndex);
|
|
45
46
|
const currentSelectedValue = computed(() => props.selectedValue);
|
|
47
|
+
const allSelectedOptions = ref([]);
|
|
46
48
|
const confirmIndexes = ref(props.selectedIndex);
|
|
47
49
|
const confirmValues = ref(props.selectedValue);
|
|
50
|
+
const displayOptions = computed(() => {
|
|
51
|
+
return props.filteredOptions && props.filteredOptions.length > 0 ? props.filteredOptions : currentOptions.value;
|
|
52
|
+
});
|
|
53
|
+
const displaySelectedIndexes = computed(() => {
|
|
54
|
+
if (!props.filteredOptions || props.filteredOptions.length === 0) {
|
|
55
|
+
return confirmIndexes.value;
|
|
56
|
+
}
|
|
57
|
+
const selectedValues = new Set(confirmIndexes.value.filter((idx) => idx >= 0 && idx < currentOptions.value.length).map((idx) => {
|
|
58
|
+
var _a;
|
|
59
|
+
return (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
60
|
+
}));
|
|
61
|
+
const result = [];
|
|
62
|
+
displayOptions.value.forEach((option, index) => {
|
|
63
|
+
if (selectedValues.has(option.value)) {
|
|
64
|
+
result.push(index);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return result;
|
|
68
|
+
});
|
|
48
69
|
const isIndeterminate = computed(() => {
|
|
49
|
-
return
|
|
70
|
+
return displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length < displayOptions.value.length;
|
|
50
71
|
});
|
|
51
72
|
const isAllSelected = computed(() => {
|
|
52
|
-
return
|
|
73
|
+
return displayOptions.value.length > 0 && displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length === displayOptions.value.length;
|
|
53
74
|
});
|
|
54
75
|
const resetOptions = (props2) => {
|
|
55
76
|
currentOptions.value = props2.options;
|
|
@@ -62,14 +83,39 @@ var stdin_default = defineComponent({
|
|
|
62
83
|
emit("update:selectedValue", confirmValues.value);
|
|
63
84
|
};
|
|
64
85
|
const onUpdateCurrentIndexes = (newVal) => {
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
87
|
+
const selectedValues = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
|
|
88
|
+
var _a;
|
|
89
|
+
return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
|
|
90
|
+
});
|
|
91
|
+
const newSelectedIndexes = /* @__PURE__ */ new Set();
|
|
92
|
+
confirmIndexes.value.forEach((idx) => {
|
|
93
|
+
var _a;
|
|
94
|
+
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
95
|
+
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
96
|
+
const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
|
|
97
|
+
if (!isInFilteredList) {
|
|
98
|
+
newSelectedIndexes.add(idx);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
selectedValues.forEach((value) => {
|
|
103
|
+
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === value);
|
|
104
|
+
if (originalIndex >= 0) {
|
|
105
|
+
newSelectedIndexes.add(originalIndex);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
confirmIndexes.value = Array.from(newSelectedIndexes);
|
|
109
|
+
} else {
|
|
110
|
+
confirmIndexes.value = newVal;
|
|
111
|
+
}
|
|
112
|
+
if (confirmIndexes.value.length > 0) {
|
|
67
113
|
getValuesByIndexes();
|
|
68
114
|
} else {
|
|
69
115
|
confirmValues.value = [];
|
|
70
116
|
}
|
|
71
|
-
getValuesByIndexes();
|
|
72
117
|
emit("update:selectedValue", confirmValues.value);
|
|
118
|
+
updateAllSelectedOptions();
|
|
73
119
|
};
|
|
74
120
|
const getIndexesByValues = () => {
|
|
75
121
|
var _a;
|
|
@@ -121,20 +167,27 @@ var stdin_default = defineComponent({
|
|
|
121
167
|
};
|
|
122
168
|
const updateShow = (value) => emit("update:showPicker", value);
|
|
123
169
|
const getOptions = () => {
|
|
124
|
-
|
|
170
|
+
return allSelectedOptions.value;
|
|
171
|
+
};
|
|
172
|
+
const onChange = () => {
|
|
173
|
+
updateAllSelectedOptions();
|
|
174
|
+
emit("change", getOptions());
|
|
175
|
+
};
|
|
176
|
+
const updateAllSelectedOptions = () => {
|
|
125
177
|
const result = [];
|
|
178
|
+
const indexes = confirmIndexes.value;
|
|
126
179
|
indexes == null ? void 0 : indexes.forEach((index) => {
|
|
127
180
|
if (index > -1 && index < currentOptions.value.length && currentOptions.value[index]) {
|
|
181
|
+
const option = currentOptions.value[index];
|
|
128
182
|
result.push({
|
|
129
|
-
[props.textKey]:
|
|
130
|
-
value:
|
|
183
|
+
[props.textKey]: option[props.textKey],
|
|
184
|
+
value: option.value,
|
|
131
185
|
initialIndex: index
|
|
132
186
|
});
|
|
133
187
|
}
|
|
134
188
|
});
|
|
135
|
-
|
|
189
|
+
allSelectedOptions.value = result;
|
|
136
190
|
};
|
|
137
|
-
const onChange = () => emit("change", getOptions());
|
|
138
191
|
const confirm = () => {
|
|
139
192
|
const options = getOptions();
|
|
140
193
|
emit("confirm", options);
|
|
@@ -210,7 +263,6 @@ var stdin_default = defineComponent({
|
|
|
210
263
|
"class": bem("toolbar-checkbox"),
|
|
211
264
|
"shape": "square",
|
|
212
265
|
"modelValue": isAllSelected.value,
|
|
213
|
-
"onUpdate:modelValue": ($event) => isAllSelected.value = $event,
|
|
214
266
|
"indeterminate": isIndeterminate.value,
|
|
215
267
|
"onClick": handleSelectAll
|
|
216
268
|
}, {
|
|
@@ -219,33 +271,74 @@ var stdin_default = defineComponent({
|
|
|
219
271
|
"class": bem("toolbar-divider")
|
|
220
272
|
}, null), _createVNode("span", {
|
|
221
273
|
"class": bem("toolbar-checkbox-text")
|
|
222
|
-
}, [_createTextVNode("\u5DF2\u9009 "),
|
|
274
|
+
}, [_createTextVNode("\u5DF2\u9009 "), allSelectedOptions.value.length])]);
|
|
223
275
|
const handleSelectAll = () => {
|
|
224
|
-
|
|
276
|
+
if (!isAllSelected.value) {
|
|
277
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
278
|
+
const selectedIndexes = [];
|
|
279
|
+
displayOptions.value.forEach((option) => {
|
|
280
|
+
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
281
|
+
if (originalIndex >= 0) {
|
|
282
|
+
selectedIndexes.push(originalIndex);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
confirmIndexes.value = selectedIndexes;
|
|
286
|
+
} else {
|
|
287
|
+
confirmIndexes.value = currentOptions.value.map((_, index) => index);
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
confirmIndexes.value = [];
|
|
291
|
+
}
|
|
292
|
+
updateAllSelectedOptions();
|
|
225
293
|
};
|
|
226
294
|
const onSelectOther = () => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
295
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
296
|
+
const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
|
|
297
|
+
const currentSelectedInFiltered = /* @__PURE__ */ new Set();
|
|
298
|
+
confirmIndexes.value.forEach((idx) => {
|
|
299
|
+
var _a;
|
|
300
|
+
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
301
|
+
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
302
|
+
if (filteredValues.has(value)) {
|
|
303
|
+
currentSelectedInFiltered.add(idx);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
const newSelectedIndexes = [];
|
|
308
|
+
displayOptions.value.forEach((option) => {
|
|
309
|
+
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
310
|
+
if (originalIndex >= 0) {
|
|
311
|
+
if (!currentSelectedInFiltered.has(originalIndex)) {
|
|
312
|
+
newSelectedIndexes.push(originalIndex);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
confirmIndexes.value = newSelectedIndexes;
|
|
317
|
+
} else {
|
|
318
|
+
const temp = new Array();
|
|
319
|
+
currentOptions.value.forEach((_, index) => {
|
|
320
|
+
if (!confirmIndexes.value.includes(index)) {
|
|
321
|
+
temp.push(index);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
confirmIndexes.value = temp;
|
|
325
|
+
}
|
|
326
|
+
updateAllSelectedOptions();
|
|
234
327
|
};
|
|
235
|
-
const genOptionItems =
|
|
328
|
+
const genOptionItems = () => {
|
|
236
329
|
let formatOptions = [];
|
|
237
|
-
if (
|
|
238
|
-
formatOptions =
|
|
330
|
+
if (displayOptions.value && displayOptions.value[0] && typeof displayOptions.value[0] !== "object") {
|
|
331
|
+
formatOptions = displayOptions.value.map((v) => ({
|
|
239
332
|
value: v,
|
|
240
333
|
text: v
|
|
241
334
|
}));
|
|
242
335
|
} else {
|
|
243
|
-
formatOptions =
|
|
336
|
+
formatOptions = displayOptions.value;
|
|
244
337
|
}
|
|
245
338
|
return _createVNode(MultiplePickerOptions, {
|
|
246
339
|
"ref": pickerOptions,
|
|
247
|
-
"currentIndexes":
|
|
248
|
-
"onUpdate:currentIndexes": [($event) =>
|
|
340
|
+
"currentIndexes": displaySelectedIndexes.value,
|
|
341
|
+
"onUpdate:currentIndexes": [($event) => displaySelectedIndexes.value = $event, onUpdateCurrentIndexes],
|
|
249
342
|
"columnCounts": props.columnCounts,
|
|
250
343
|
"initialOptions": formatOptions,
|
|
251
344
|
"allowHtml": props.allowHtml,
|
|
@@ -256,10 +349,10 @@ var stdin_default = defineComponent({
|
|
|
256
349
|
}, {
|
|
257
350
|
option: slots.option
|
|
258
351
|
});
|
|
259
|
-
}
|
|
352
|
+
};
|
|
260
353
|
const genOptions = () => _createVNode("div", {
|
|
261
354
|
"class": bem("options")
|
|
262
|
-
}, [genOptionItems
|
|
355
|
+
}, [genOptionItems()]);
|
|
263
356
|
const renderMultiplePicker = () => _createVNode("div", {
|
|
264
357
|
"class": bem()
|
|
265
358
|
}, [genTitle(), props.loading ? _createVNode(Loading, {
|
|
@@ -36,6 +36,10 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
36
36
|
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
37
37
|
default: () => import("./types").PickerOption[];
|
|
38
38
|
};
|
|
39
|
+
filteredOptions: {
|
|
40
|
+
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
41
|
+
default: () => import("./types").PickerOption[];
|
|
42
|
+
};
|
|
39
43
|
toolbarPosition: {
|
|
40
44
|
type: import("vue").PropType<string>;
|
|
41
45
|
default: string;
|
|
@@ -97,6 +101,10 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
97
101
|
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
98
102
|
default: () => import("./types").PickerOption[];
|
|
99
103
|
};
|
|
104
|
+
filteredOptions: {
|
|
105
|
+
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
106
|
+
default: () => import("./types").PickerOption[];
|
|
107
|
+
};
|
|
100
108
|
toolbarPosition: {
|
|
101
109
|
type: import("vue").PropType<string>;
|
|
102
110
|
default: string;
|
|
@@ -143,6 +151,7 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
143
151
|
textKey: string;
|
|
144
152
|
itemHeight: string | number;
|
|
145
153
|
columnCounts: number;
|
|
154
|
+
filteredOptions: import("./types").PickerOption[];
|
|
146
155
|
toolbarPosition: string;
|
|
147
156
|
selectedIndex: number[];
|
|
148
157
|
selectedValue: import("../utils").Numeric[];
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -182,7 +182,7 @@ __reExport(stdin_exports, require("./timeline"), module.exports);
|
|
|
182
182
|
__reExport(stdin_exports, require("./toast"), module.exports);
|
|
183
183
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
|
184
184
|
__reExport(stdin_exports, require("./video"), module.exports);
|
|
185
|
-
const version = "3.1.
|
|
185
|
+
const version = "3.1.65";
|
|
186
186
|
function install(app) {
|
|
187
187
|
const components = [
|
|
188
188
|
import_action_sheet.ActionSheet,
|
|
@@ -37,6 +37,10 @@ declare const multiplePickerProps: {
|
|
|
37
37
|
type: import("vue").PropType<PickerOption[]>;
|
|
38
38
|
default: () => PickerOption[];
|
|
39
39
|
};
|
|
40
|
+
filteredOptions: {
|
|
41
|
+
type: import("vue").PropType<PickerOption[]>;
|
|
42
|
+
default: () => PickerOption[];
|
|
43
|
+
};
|
|
40
44
|
toolbarPosition: {
|
|
41
45
|
type: import("vue").PropType<string>;
|
|
42
46
|
default: string;
|
|
@@ -106,6 +110,10 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
106
110
|
type: import("vue").PropType<PickerOption[]>;
|
|
107
111
|
default: () => PickerOption[];
|
|
108
112
|
};
|
|
113
|
+
filteredOptions: {
|
|
114
|
+
type: import("vue").PropType<PickerOption[]>;
|
|
115
|
+
default: () => PickerOption[];
|
|
116
|
+
};
|
|
109
117
|
toolbarPosition: {
|
|
110
118
|
type: import("vue").PropType<string>;
|
|
111
119
|
default: string;
|
|
@@ -167,6 +175,10 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
167
175
|
type: import("vue").PropType<PickerOption[]>;
|
|
168
176
|
default: () => PickerOption[];
|
|
169
177
|
};
|
|
178
|
+
filteredOptions: {
|
|
179
|
+
type: import("vue").PropType<PickerOption[]>;
|
|
180
|
+
default: () => PickerOption[];
|
|
181
|
+
};
|
|
170
182
|
toolbarPosition: {
|
|
171
183
|
type: import("vue").PropType<string>;
|
|
172
184
|
default: string;
|
|
@@ -213,6 +225,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
213
225
|
textKey: string;
|
|
214
226
|
itemHeight: string | number;
|
|
215
227
|
columnCounts: number;
|
|
228
|
+
filteredOptions: PickerOption[];
|
|
216
229
|
toolbarPosition: string;
|
|
217
230
|
selectedIndex: number[];
|
|
218
231
|
selectedValue: Numeric[];
|
|
@@ -56,6 +56,7 @@ const multiplePickerProps = {
|
|
|
56
56
|
showToolbar: import_utils.truthProp,
|
|
57
57
|
showTitle: import_utils.truthProp,
|
|
58
58
|
options: (0, import_utils.makeArrayProp)(),
|
|
59
|
+
filteredOptions: (0, import_utils.makeArrayProp)(),
|
|
59
60
|
toolbarPosition: (0, import_utils.makeStringProp)("bottom"),
|
|
60
61
|
textKey: (0, import_utils.makeStringProp)("text"),
|
|
61
62
|
columnCounts: (0, import_utils.makeNumberProp)(3),
|
|
@@ -75,13 +76,33 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
75
76
|
const currentOptions = (0, import_vue.ref)(props.options);
|
|
76
77
|
const currentSelectedIndex = (0, import_vue.computed)(() => props.selectedIndex);
|
|
77
78
|
const currentSelectedValue = (0, import_vue.computed)(() => props.selectedValue);
|
|
79
|
+
const allSelectedOptions = (0, import_vue.ref)([]);
|
|
78
80
|
const confirmIndexes = (0, import_vue.ref)(props.selectedIndex);
|
|
79
81
|
const confirmValues = (0, import_vue.ref)(props.selectedValue);
|
|
82
|
+
const displayOptions = (0, import_vue.computed)(() => {
|
|
83
|
+
return props.filteredOptions && props.filteredOptions.length > 0 ? props.filteredOptions : currentOptions.value;
|
|
84
|
+
});
|
|
85
|
+
const displaySelectedIndexes = (0, import_vue.computed)(() => {
|
|
86
|
+
if (!props.filteredOptions || props.filteredOptions.length === 0) {
|
|
87
|
+
return confirmIndexes.value;
|
|
88
|
+
}
|
|
89
|
+
const selectedValues = new Set(confirmIndexes.value.filter((idx) => idx >= 0 && idx < currentOptions.value.length).map((idx) => {
|
|
90
|
+
var _a;
|
|
91
|
+
return (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
92
|
+
}));
|
|
93
|
+
const result = [];
|
|
94
|
+
displayOptions.value.forEach((option, index) => {
|
|
95
|
+
if (selectedValues.has(option.value)) {
|
|
96
|
+
result.push(index);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return result;
|
|
100
|
+
});
|
|
80
101
|
const isIndeterminate = (0, import_vue.computed)(() => {
|
|
81
|
-
return
|
|
102
|
+
return displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length < displayOptions.value.length;
|
|
82
103
|
});
|
|
83
104
|
const isAllSelected = (0, import_vue.computed)(() => {
|
|
84
|
-
return
|
|
105
|
+
return displayOptions.value.length > 0 && displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length === displayOptions.value.length;
|
|
85
106
|
});
|
|
86
107
|
const resetOptions = (props2) => {
|
|
87
108
|
currentOptions.value = props2.options;
|
|
@@ -94,14 +115,39 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
94
115
|
emit("update:selectedValue", confirmValues.value);
|
|
95
116
|
};
|
|
96
117
|
const onUpdateCurrentIndexes = (newVal) => {
|
|
97
|
-
|
|
98
|
-
|
|
118
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
119
|
+
const selectedValues = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
|
|
120
|
+
var _a;
|
|
121
|
+
return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
|
|
122
|
+
});
|
|
123
|
+
const newSelectedIndexes = /* @__PURE__ */ new Set();
|
|
124
|
+
confirmIndexes.value.forEach((idx) => {
|
|
125
|
+
var _a;
|
|
126
|
+
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
127
|
+
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
128
|
+
const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
|
|
129
|
+
if (!isInFilteredList) {
|
|
130
|
+
newSelectedIndexes.add(idx);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
selectedValues.forEach((value) => {
|
|
135
|
+
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === value);
|
|
136
|
+
if (originalIndex >= 0) {
|
|
137
|
+
newSelectedIndexes.add(originalIndex);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
confirmIndexes.value = Array.from(newSelectedIndexes);
|
|
141
|
+
} else {
|
|
142
|
+
confirmIndexes.value = newVal;
|
|
143
|
+
}
|
|
144
|
+
if (confirmIndexes.value.length > 0) {
|
|
99
145
|
getValuesByIndexes();
|
|
100
146
|
} else {
|
|
101
147
|
confirmValues.value = [];
|
|
102
148
|
}
|
|
103
|
-
getValuesByIndexes();
|
|
104
149
|
emit("update:selectedValue", confirmValues.value);
|
|
150
|
+
updateAllSelectedOptions();
|
|
105
151
|
};
|
|
106
152
|
const getIndexesByValues = () => {
|
|
107
153
|
var _a;
|
|
@@ -153,20 +199,27 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
153
199
|
};
|
|
154
200
|
const updateShow = (value) => emit("update:showPicker", value);
|
|
155
201
|
const getOptions = () => {
|
|
156
|
-
|
|
202
|
+
return allSelectedOptions.value;
|
|
203
|
+
};
|
|
204
|
+
const onChange = () => {
|
|
205
|
+
updateAllSelectedOptions();
|
|
206
|
+
emit("change", getOptions());
|
|
207
|
+
};
|
|
208
|
+
const updateAllSelectedOptions = () => {
|
|
157
209
|
const result = [];
|
|
210
|
+
const indexes = confirmIndexes.value;
|
|
158
211
|
indexes == null ? void 0 : indexes.forEach((index) => {
|
|
159
212
|
if (index > -1 && index < currentOptions.value.length && currentOptions.value[index]) {
|
|
213
|
+
const option = currentOptions.value[index];
|
|
160
214
|
result.push({
|
|
161
|
-
[props.textKey]:
|
|
162
|
-
value:
|
|
215
|
+
[props.textKey]: option[props.textKey],
|
|
216
|
+
value: option.value,
|
|
163
217
|
initialIndex: index
|
|
164
218
|
});
|
|
165
219
|
}
|
|
166
220
|
});
|
|
167
|
-
|
|
221
|
+
allSelectedOptions.value = result;
|
|
168
222
|
};
|
|
169
|
-
const onChange = () => emit("change", getOptions());
|
|
170
223
|
const confirm = () => {
|
|
171
224
|
const options = getOptions();
|
|
172
225
|
emit("confirm", options);
|
|
@@ -242,7 +295,6 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
242
295
|
"class": bem("toolbar-checkbox"),
|
|
243
296
|
"shape": "square",
|
|
244
297
|
"modelValue": isAllSelected.value,
|
|
245
|
-
"onUpdate:modelValue": ($event) => isAllSelected.value = $event,
|
|
246
298
|
"indeterminate": isIndeterminate.value,
|
|
247
299
|
"onClick": handleSelectAll
|
|
248
300
|
}, {
|
|
@@ -251,33 +303,74 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
251
303
|
"class": bem("toolbar-divider")
|
|
252
304
|
}, null), (0, import_vue.createVNode)("span", {
|
|
253
305
|
"class": bem("toolbar-checkbox-text")
|
|
254
|
-
}, [(0, import_vue.createTextVNode)("\u5DF2\u9009 "),
|
|
306
|
+
}, [(0, import_vue.createTextVNode)("\u5DF2\u9009 "), allSelectedOptions.value.length])]);
|
|
255
307
|
const handleSelectAll = () => {
|
|
256
|
-
|
|
308
|
+
if (!isAllSelected.value) {
|
|
309
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
310
|
+
const selectedIndexes = [];
|
|
311
|
+
displayOptions.value.forEach((option) => {
|
|
312
|
+
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
313
|
+
if (originalIndex >= 0) {
|
|
314
|
+
selectedIndexes.push(originalIndex);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
confirmIndexes.value = selectedIndexes;
|
|
318
|
+
} else {
|
|
319
|
+
confirmIndexes.value = currentOptions.value.map((_, index) => index);
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
confirmIndexes.value = [];
|
|
323
|
+
}
|
|
324
|
+
updateAllSelectedOptions();
|
|
257
325
|
};
|
|
258
326
|
const onSelectOther = () => {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
327
|
+
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
328
|
+
const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
|
|
329
|
+
const currentSelectedInFiltered = /* @__PURE__ */ new Set();
|
|
330
|
+
confirmIndexes.value.forEach((idx) => {
|
|
331
|
+
var _a;
|
|
332
|
+
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
333
|
+
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
334
|
+
if (filteredValues.has(value)) {
|
|
335
|
+
currentSelectedInFiltered.add(idx);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
const newSelectedIndexes = [];
|
|
340
|
+
displayOptions.value.forEach((option) => {
|
|
341
|
+
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
342
|
+
if (originalIndex >= 0) {
|
|
343
|
+
if (!currentSelectedInFiltered.has(originalIndex)) {
|
|
344
|
+
newSelectedIndexes.push(originalIndex);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
confirmIndexes.value = newSelectedIndexes;
|
|
349
|
+
} else {
|
|
350
|
+
const temp = new Array();
|
|
351
|
+
currentOptions.value.forEach((_, index) => {
|
|
352
|
+
if (!confirmIndexes.value.includes(index)) {
|
|
353
|
+
temp.push(index);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
confirmIndexes.value = temp;
|
|
357
|
+
}
|
|
358
|
+
updateAllSelectedOptions();
|
|
266
359
|
};
|
|
267
|
-
const genOptionItems = (
|
|
360
|
+
const genOptionItems = () => {
|
|
268
361
|
let formatOptions = [];
|
|
269
|
-
if (
|
|
270
|
-
formatOptions =
|
|
362
|
+
if (displayOptions.value && displayOptions.value[0] && typeof displayOptions.value[0] !== "object") {
|
|
363
|
+
formatOptions = displayOptions.value.map((v) => ({
|
|
271
364
|
value: v,
|
|
272
365
|
text: v
|
|
273
366
|
}));
|
|
274
367
|
} else {
|
|
275
|
-
formatOptions =
|
|
368
|
+
formatOptions = displayOptions.value;
|
|
276
369
|
}
|
|
277
370
|
return (0, import_vue.createVNode)(import_MultiplePickerOptions.default, {
|
|
278
371
|
"ref": pickerOptions,
|
|
279
|
-
"currentIndexes":
|
|
280
|
-
"onUpdate:currentIndexes": [($event) =>
|
|
372
|
+
"currentIndexes": displaySelectedIndexes.value,
|
|
373
|
+
"onUpdate:currentIndexes": [($event) => displaySelectedIndexes.value = $event, onUpdateCurrentIndexes],
|
|
281
374
|
"columnCounts": props.columnCounts,
|
|
282
375
|
"initialOptions": formatOptions,
|
|
283
376
|
"allowHtml": props.allowHtml,
|
|
@@ -288,10 +381,10 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
288
381
|
}, {
|
|
289
382
|
option: slots.option
|
|
290
383
|
});
|
|
291
|
-
}
|
|
384
|
+
};
|
|
292
385
|
const genOptions = () => (0, import_vue.createVNode)("div", {
|
|
293
386
|
"class": bem("options")
|
|
294
|
-
}, [genOptionItems
|
|
387
|
+
}, [genOptionItems()]);
|
|
295
388
|
const renderMultiplePicker = () => (0, import_vue.createVNode)("div", {
|
|
296
389
|
"class": bem()
|
|
297
390
|
}, [genTitle(), props.loading ? (0, import_vue.createVNode)(import_loading.default, {
|
|
@@ -36,6 +36,10 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
36
36
|
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
37
37
|
default: () => import("./types").PickerOption[];
|
|
38
38
|
};
|
|
39
|
+
filteredOptions: {
|
|
40
|
+
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
41
|
+
default: () => import("./types").PickerOption[];
|
|
42
|
+
};
|
|
39
43
|
toolbarPosition: {
|
|
40
44
|
type: import("vue").PropType<string>;
|
|
41
45
|
default: string;
|
|
@@ -97,6 +101,10 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
97
101
|
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
98
102
|
default: () => import("./types").PickerOption[];
|
|
99
103
|
};
|
|
104
|
+
filteredOptions: {
|
|
105
|
+
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
106
|
+
default: () => import("./types").PickerOption[];
|
|
107
|
+
};
|
|
100
108
|
toolbarPosition: {
|
|
101
109
|
type: import("vue").PropType<string>;
|
|
102
110
|
default: string;
|
|
@@ -143,6 +151,7 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
143
151
|
textKey: string;
|
|
144
152
|
itemHeight: string | number;
|
|
145
153
|
columnCounts: number;
|
|
154
|
+
filteredOptions: import("./types").PickerOption[];
|
|
146
155
|
toolbarPosition: string;
|
|
147
156
|
selectedIndex: number[];
|
|
148
157
|
selectedValue: import("../utils").Numeric[];
|