zartui 3.1.66 → 3.1.68
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 +22 -22
- package/es/multiple-picker/MultiplePicker.mjs +53 -26
- package/es/multiple-picker/index.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/multiple-picker/MultiplePicker.d.ts +22 -22
- package/lib/multiple-picker/MultiplePicker.js +53 -26
- package/lib/multiple-picker/index.d.ts +2 -2
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +54 -27
- package/lib/zartui.es.js +54 -27
- package/lib/zartui.js +54 -27
- package/lib/zartui.min.js +1 -1
- package/package.json +5 -5
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.68";
|
|
81
81
|
function install(app) {
|
|
82
82
|
const components = [
|
|
83
83
|
ActionSheet,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtractPropTypes } from 'vue';
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { Numeric } from '../utils';
|
|
3
3
|
import { PickerOption } from './types';
|
|
4
4
|
declare const multiplePickerProps: {
|
|
@@ -34,19 +34,19 @@ declare const multiplePickerProps: {
|
|
|
34
34
|
default: true;
|
|
35
35
|
};
|
|
36
36
|
options: {
|
|
37
|
-
type:
|
|
37
|
+
type: PropType<PickerOption[]>;
|
|
38
38
|
default: () => PickerOption[];
|
|
39
39
|
};
|
|
40
40
|
filteredOptions: {
|
|
41
|
-
type:
|
|
42
|
-
default:
|
|
41
|
+
type: PropType<PickerOption[]>;
|
|
42
|
+
default: undefined;
|
|
43
43
|
};
|
|
44
44
|
toolbarPosition: {
|
|
45
|
-
type:
|
|
45
|
+
type: PropType<string>;
|
|
46
46
|
default: string;
|
|
47
47
|
};
|
|
48
48
|
textKey: {
|
|
49
|
-
type:
|
|
49
|
+
type: PropType<string>;
|
|
50
50
|
default: string;
|
|
51
51
|
};
|
|
52
52
|
columnCounts: {
|
|
@@ -54,11 +54,11 @@ declare const multiplePickerProps: {
|
|
|
54
54
|
default: number;
|
|
55
55
|
};
|
|
56
56
|
selectedIndex: {
|
|
57
|
-
type:
|
|
57
|
+
type: PropType<number[]>;
|
|
58
58
|
default: () => number[];
|
|
59
59
|
};
|
|
60
60
|
selectedValue: {
|
|
61
|
-
type:
|
|
61
|
+
type: PropType<Numeric[]>;
|
|
62
62
|
default: () => Numeric[];
|
|
63
63
|
};
|
|
64
64
|
popup: {
|
|
@@ -107,19 +107,19 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
107
107
|
default: true;
|
|
108
108
|
};
|
|
109
109
|
options: {
|
|
110
|
-
type:
|
|
110
|
+
type: PropType<PickerOption[]>;
|
|
111
111
|
default: () => PickerOption[];
|
|
112
112
|
};
|
|
113
113
|
filteredOptions: {
|
|
114
|
-
type:
|
|
115
|
-
default:
|
|
114
|
+
type: PropType<PickerOption[]>;
|
|
115
|
+
default: undefined;
|
|
116
116
|
};
|
|
117
117
|
toolbarPosition: {
|
|
118
|
-
type:
|
|
118
|
+
type: PropType<string>;
|
|
119
119
|
default: string;
|
|
120
120
|
};
|
|
121
121
|
textKey: {
|
|
122
|
-
type:
|
|
122
|
+
type: PropType<string>;
|
|
123
123
|
default: string;
|
|
124
124
|
};
|
|
125
125
|
columnCounts: {
|
|
@@ -127,11 +127,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
127
127
|
default: number;
|
|
128
128
|
};
|
|
129
129
|
selectedIndex: {
|
|
130
|
-
type:
|
|
130
|
+
type: PropType<number[]>;
|
|
131
131
|
default: () => number[];
|
|
132
132
|
};
|
|
133
133
|
selectedValue: {
|
|
134
|
-
type:
|
|
134
|
+
type: PropType<Numeric[]>;
|
|
135
135
|
default: () => Numeric[];
|
|
136
136
|
};
|
|
137
137
|
popup: {
|
|
@@ -172,19 +172,19 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
172
172
|
default: true;
|
|
173
173
|
};
|
|
174
174
|
options: {
|
|
175
|
-
type:
|
|
175
|
+
type: PropType<PickerOption[]>;
|
|
176
176
|
default: () => PickerOption[];
|
|
177
177
|
};
|
|
178
178
|
filteredOptions: {
|
|
179
|
-
type:
|
|
180
|
-
default:
|
|
179
|
+
type: PropType<PickerOption[]>;
|
|
180
|
+
default: undefined;
|
|
181
181
|
};
|
|
182
182
|
toolbarPosition: {
|
|
183
|
-
type:
|
|
183
|
+
type: PropType<string>;
|
|
184
184
|
default: string;
|
|
185
185
|
};
|
|
186
186
|
textKey: {
|
|
187
|
-
type:
|
|
187
|
+
type: PropType<string>;
|
|
188
188
|
default: string;
|
|
189
189
|
};
|
|
190
190
|
columnCounts: {
|
|
@@ -192,11 +192,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
192
192
|
default: number;
|
|
193
193
|
};
|
|
194
194
|
selectedIndex: {
|
|
195
|
-
type:
|
|
195
|
+
type: PropType<number[]>;
|
|
196
196
|
default: () => number[];
|
|
197
197
|
};
|
|
198
198
|
selectedValue: {
|
|
199
|
-
type:
|
|
199
|
+
type: PropType<Numeric[]>;
|
|
200
200
|
default: () => Numeric[];
|
|
201
201
|
};
|
|
202
202
|
popup: {
|
|
@@ -25,7 +25,10 @@ const multiplePickerProps = {
|
|
|
25
25
|
showToolbar: truthProp,
|
|
26
26
|
showTitle: truthProp,
|
|
27
27
|
options: makeArrayProp(),
|
|
28
|
-
filteredOptions:
|
|
28
|
+
filteredOptions: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
29
32
|
toolbarPosition: makeStringProp("bottom"),
|
|
30
33
|
textKey: makeStringProp("text"),
|
|
31
34
|
columnCounts: makeNumberProp(3),
|
|
@@ -49,7 +52,7 @@ var stdin_default = defineComponent({
|
|
|
49
52
|
const confirmIndexes = ref(props.selectedIndex);
|
|
50
53
|
const confirmValues = ref(props.selectedValue);
|
|
51
54
|
const displayOptions = computed(() => {
|
|
52
|
-
return props.filteredOptions
|
|
55
|
+
return props.filteredOptions !== void 0 ? props.filteredOptions : currentOptions.value;
|
|
53
56
|
});
|
|
54
57
|
const displaySelectedIndexes = computed(() => {
|
|
55
58
|
if (!props.filteredOptions || props.filteredOptions.length === 0) {
|
|
@@ -85,22 +88,22 @@ var stdin_default = defineComponent({
|
|
|
85
88
|
};
|
|
86
89
|
const onUpdateCurrentIndexes = (newVal) => {
|
|
87
90
|
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
88
|
-
const
|
|
91
|
+
const selectedValuesInFiltered = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
|
|
89
92
|
var _a;
|
|
90
93
|
return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
|
|
91
94
|
});
|
|
92
95
|
const newSelectedIndexes = /* @__PURE__ */ new Set();
|
|
96
|
+
const filteredValuesSet = new Set(displayOptions.value.map((opt) => opt.value));
|
|
93
97
|
confirmIndexes.value.forEach((idx) => {
|
|
94
98
|
var _a;
|
|
95
99
|
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
96
100
|
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
97
|
-
|
|
98
|
-
if (!isInFilteredList) {
|
|
101
|
+
if (!filteredValuesSet.has(value)) {
|
|
99
102
|
newSelectedIndexes.add(idx);
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
});
|
|
103
|
-
|
|
106
|
+
selectedValuesInFiltered.forEach((value) => {
|
|
104
107
|
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === value);
|
|
105
108
|
if (originalIndex >= 0) {
|
|
106
109
|
newSelectedIndexes.add(originalIndex);
|
|
@@ -147,11 +150,13 @@ var stdin_default = defineComponent({
|
|
|
147
150
|
if (newValue !== props.showPicker) {
|
|
148
151
|
emit("update:showPicker", newValue);
|
|
149
152
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
if (newValue) {
|
|
154
|
+
currentOptions.value = deepClone(props.options);
|
|
155
|
+
confirmIndexes.value = deepClone(currentSelectedIndex.value);
|
|
156
|
+
confirmValues.value = deepClone(currentSelectedValue.value);
|
|
157
|
+
getIndexesByValues();
|
|
158
|
+
updateAllSelectedOptions();
|
|
159
|
+
}
|
|
155
160
|
});
|
|
156
161
|
watch(() => props.showPicker, (newValue) => {
|
|
157
162
|
var _a;
|
|
@@ -277,65 +282,87 @@ var stdin_default = defineComponent({
|
|
|
277
282
|
const handleSelectAll = () => {
|
|
278
283
|
if (props.filteredOptions && props.filteredOptions.length === 0) {
|
|
279
284
|
confirmIndexes.value = [];
|
|
285
|
+
confirmValues.value = [];
|
|
286
|
+
emit("update:selectedValue", confirmValues.value);
|
|
287
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
280
288
|
updateAllSelectedOptions();
|
|
289
|
+
onChange();
|
|
281
290
|
return;
|
|
282
291
|
}
|
|
292
|
+
let newIndexes = [];
|
|
283
293
|
if (!isAllSelected.value) {
|
|
284
294
|
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
285
|
-
const selectedIndexes = [];
|
|
286
295
|
displayOptions.value.forEach((option) => {
|
|
287
296
|
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
288
297
|
if (originalIndex >= 0) {
|
|
289
|
-
|
|
298
|
+
newIndexes.push(originalIndex);
|
|
290
299
|
}
|
|
291
300
|
});
|
|
292
|
-
confirmIndexes.value = selectedIndexes;
|
|
293
301
|
} else {
|
|
294
|
-
|
|
302
|
+
newIndexes = currentOptions.value.map((_, index) => index);
|
|
295
303
|
}
|
|
296
304
|
} else {
|
|
297
|
-
|
|
305
|
+
newIndexes = [];
|
|
306
|
+
}
|
|
307
|
+
confirmIndexes.value = newIndexes;
|
|
308
|
+
if (confirmIndexes.value.length > 0) {
|
|
309
|
+
getValuesByIndexes();
|
|
310
|
+
} else {
|
|
311
|
+
confirmValues.value = [];
|
|
298
312
|
}
|
|
313
|
+
emit("update:selectedValue", confirmValues.value);
|
|
314
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
299
315
|
updateAllSelectedOptions();
|
|
316
|
+
onChange();
|
|
300
317
|
};
|
|
301
318
|
const onSelectOther = () => {
|
|
302
319
|
if (props.filteredOptions && props.filteredOptions.length === 0) {
|
|
303
320
|
confirmIndexes.value = [];
|
|
321
|
+
confirmValues.value = [];
|
|
322
|
+
emit("update:selectedValue", confirmValues.value);
|
|
323
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
304
324
|
updateAllSelectedOptions();
|
|
325
|
+
onChange();
|
|
305
326
|
return;
|
|
306
327
|
}
|
|
328
|
+
let newIndexes = [];
|
|
307
329
|
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
308
|
-
const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
|
|
309
330
|
const currentSelectedInFiltered = /* @__PURE__ */ new Set();
|
|
310
331
|
confirmIndexes.value.forEach((idx) => {
|
|
311
332
|
var _a;
|
|
312
333
|
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
313
334
|
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
314
|
-
|
|
335
|
+
const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
|
|
336
|
+
if (isInFilteredList) {
|
|
315
337
|
currentSelectedInFiltered.add(idx);
|
|
316
338
|
}
|
|
317
339
|
}
|
|
318
340
|
});
|
|
319
|
-
const newSelectedIndexes = [];
|
|
320
341
|
displayOptions.value.forEach((option) => {
|
|
321
342
|
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
322
343
|
if (originalIndex >= 0) {
|
|
323
344
|
if (!currentSelectedInFiltered.has(originalIndex)) {
|
|
324
|
-
|
|
345
|
+
newIndexes.push(originalIndex);
|
|
325
346
|
}
|
|
326
347
|
}
|
|
327
348
|
});
|
|
328
|
-
confirmIndexes.value = newSelectedIndexes;
|
|
329
349
|
} else {
|
|
330
|
-
const temp = new Array();
|
|
331
350
|
currentOptions.value.forEach((_, index) => {
|
|
332
351
|
if (!confirmIndexes.value.includes(index)) {
|
|
333
|
-
|
|
352
|
+
newIndexes.push(index);
|
|
334
353
|
}
|
|
335
354
|
});
|
|
336
|
-
confirmIndexes.value = temp;
|
|
337
355
|
}
|
|
356
|
+
confirmIndexes.value = newIndexes;
|
|
357
|
+
if (confirmIndexes.value.length > 0) {
|
|
358
|
+
getValuesByIndexes();
|
|
359
|
+
} else {
|
|
360
|
+
confirmValues.value = [];
|
|
361
|
+
}
|
|
362
|
+
emit("update:selectedValue", confirmValues.value);
|
|
363
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
338
364
|
updateAllSelectedOptions();
|
|
365
|
+
onChange();
|
|
339
366
|
};
|
|
340
367
|
const genOptionItems = () => {
|
|
341
368
|
let formatOptions = [];
|
|
@@ -350,7 +377,7 @@ var stdin_default = defineComponent({
|
|
|
350
377
|
return _createVNode(MultiplePickerOptions, {
|
|
351
378
|
"ref": pickerOptions,
|
|
352
379
|
"currentIndexes": displaySelectedIndexes.value,
|
|
353
|
-
"onUpdate:currentIndexes":
|
|
380
|
+
"onUpdate:currentIndexes": onUpdateCurrentIndexes,
|
|
354
381
|
"columnCounts": props.columnCounts,
|
|
355
382
|
"initialOptions": formatOptions,
|
|
356
383
|
"allowHtml": props.allowHtml,
|
|
@@ -363,7 +390,7 @@ var stdin_default = defineComponent({
|
|
|
363
390
|
});
|
|
364
391
|
};
|
|
365
392
|
const genOptions = () => {
|
|
366
|
-
const showEmpty =
|
|
393
|
+
const showEmpty = !displayOptions.value || displayOptions.value.length === 0;
|
|
367
394
|
return _createVNode("div", {
|
|
368
395
|
"class": bem("options")
|
|
369
396
|
}, [showEmpty ? _createVNode(Empty, {
|
|
@@ -38,7 +38,7 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
38
38
|
};
|
|
39
39
|
filteredOptions: {
|
|
40
40
|
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
41
|
-
default:
|
|
41
|
+
default: undefined;
|
|
42
42
|
};
|
|
43
43
|
toolbarPosition: {
|
|
44
44
|
type: import("vue").PropType<string>;
|
|
@@ -103,7 +103,7 @@ export declare const MultiplePicker: import("../utils").WithInstall<import("vue"
|
|
|
103
103
|
};
|
|
104
104
|
filteredOptions: {
|
|
105
105
|
type: import("vue").PropType<import("./types").PickerOption[]>;
|
|
106
|
-
default:
|
|
106
|
+
default: undefined;
|
|
107
107
|
};
|
|
108
108
|
toolbarPosition: {
|
|
109
109
|
type: import("vue").PropType<string>;
|
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.68";
|
|
186
186
|
function install(app) {
|
|
187
187
|
const components = [
|
|
188
188
|
import_action_sheet.ActionSheet,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtractPropTypes } from 'vue';
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { Numeric } from '../utils';
|
|
3
3
|
import { PickerOption } from './types';
|
|
4
4
|
declare const multiplePickerProps: {
|
|
@@ -34,19 +34,19 @@ declare const multiplePickerProps: {
|
|
|
34
34
|
default: true;
|
|
35
35
|
};
|
|
36
36
|
options: {
|
|
37
|
-
type:
|
|
37
|
+
type: PropType<PickerOption[]>;
|
|
38
38
|
default: () => PickerOption[];
|
|
39
39
|
};
|
|
40
40
|
filteredOptions: {
|
|
41
|
-
type:
|
|
42
|
-
default:
|
|
41
|
+
type: PropType<PickerOption[]>;
|
|
42
|
+
default: undefined;
|
|
43
43
|
};
|
|
44
44
|
toolbarPosition: {
|
|
45
|
-
type:
|
|
45
|
+
type: PropType<string>;
|
|
46
46
|
default: string;
|
|
47
47
|
};
|
|
48
48
|
textKey: {
|
|
49
|
-
type:
|
|
49
|
+
type: PropType<string>;
|
|
50
50
|
default: string;
|
|
51
51
|
};
|
|
52
52
|
columnCounts: {
|
|
@@ -54,11 +54,11 @@ declare const multiplePickerProps: {
|
|
|
54
54
|
default: number;
|
|
55
55
|
};
|
|
56
56
|
selectedIndex: {
|
|
57
|
-
type:
|
|
57
|
+
type: PropType<number[]>;
|
|
58
58
|
default: () => number[];
|
|
59
59
|
};
|
|
60
60
|
selectedValue: {
|
|
61
|
-
type:
|
|
61
|
+
type: PropType<Numeric[]>;
|
|
62
62
|
default: () => Numeric[];
|
|
63
63
|
};
|
|
64
64
|
popup: {
|
|
@@ -107,19 +107,19 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
107
107
|
default: true;
|
|
108
108
|
};
|
|
109
109
|
options: {
|
|
110
|
-
type:
|
|
110
|
+
type: PropType<PickerOption[]>;
|
|
111
111
|
default: () => PickerOption[];
|
|
112
112
|
};
|
|
113
113
|
filteredOptions: {
|
|
114
|
-
type:
|
|
115
|
-
default:
|
|
114
|
+
type: PropType<PickerOption[]>;
|
|
115
|
+
default: undefined;
|
|
116
116
|
};
|
|
117
117
|
toolbarPosition: {
|
|
118
|
-
type:
|
|
118
|
+
type: PropType<string>;
|
|
119
119
|
default: string;
|
|
120
120
|
};
|
|
121
121
|
textKey: {
|
|
122
|
-
type:
|
|
122
|
+
type: PropType<string>;
|
|
123
123
|
default: string;
|
|
124
124
|
};
|
|
125
125
|
columnCounts: {
|
|
@@ -127,11 +127,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
127
127
|
default: number;
|
|
128
128
|
};
|
|
129
129
|
selectedIndex: {
|
|
130
|
-
type:
|
|
130
|
+
type: PropType<number[]>;
|
|
131
131
|
default: () => number[];
|
|
132
132
|
};
|
|
133
133
|
selectedValue: {
|
|
134
|
-
type:
|
|
134
|
+
type: PropType<Numeric[]>;
|
|
135
135
|
default: () => Numeric[];
|
|
136
136
|
};
|
|
137
137
|
popup: {
|
|
@@ -172,19 +172,19 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
172
172
|
default: true;
|
|
173
173
|
};
|
|
174
174
|
options: {
|
|
175
|
-
type:
|
|
175
|
+
type: PropType<PickerOption[]>;
|
|
176
176
|
default: () => PickerOption[];
|
|
177
177
|
};
|
|
178
178
|
filteredOptions: {
|
|
179
|
-
type:
|
|
180
|
-
default:
|
|
179
|
+
type: PropType<PickerOption[]>;
|
|
180
|
+
default: undefined;
|
|
181
181
|
};
|
|
182
182
|
toolbarPosition: {
|
|
183
|
-
type:
|
|
183
|
+
type: PropType<string>;
|
|
184
184
|
default: string;
|
|
185
185
|
};
|
|
186
186
|
textKey: {
|
|
187
|
-
type:
|
|
187
|
+
type: PropType<string>;
|
|
188
188
|
default: string;
|
|
189
189
|
};
|
|
190
190
|
columnCounts: {
|
|
@@ -192,11 +192,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
192
192
|
default: number;
|
|
193
193
|
};
|
|
194
194
|
selectedIndex: {
|
|
195
|
-
type:
|
|
195
|
+
type: PropType<number[]>;
|
|
196
196
|
default: () => number[];
|
|
197
197
|
};
|
|
198
198
|
selectedValue: {
|
|
199
|
-
type:
|
|
199
|
+
type: PropType<Numeric[]>;
|
|
200
200
|
default: () => Numeric[];
|
|
201
201
|
};
|
|
202
202
|
popup: {
|
|
@@ -57,7 +57,10 @@ const multiplePickerProps = {
|
|
|
57
57
|
showToolbar: import_utils.truthProp,
|
|
58
58
|
showTitle: import_utils.truthProp,
|
|
59
59
|
options: (0, import_utils.makeArrayProp)(),
|
|
60
|
-
filteredOptions:
|
|
60
|
+
filteredOptions: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
61
64
|
toolbarPosition: (0, import_utils.makeStringProp)("bottom"),
|
|
62
65
|
textKey: (0, import_utils.makeStringProp)("text"),
|
|
63
66
|
columnCounts: (0, import_utils.makeNumberProp)(3),
|
|
@@ -81,7 +84,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
81
84
|
const confirmIndexes = (0, import_vue.ref)(props.selectedIndex);
|
|
82
85
|
const confirmValues = (0, import_vue.ref)(props.selectedValue);
|
|
83
86
|
const displayOptions = (0, import_vue.computed)(() => {
|
|
84
|
-
return props.filteredOptions
|
|
87
|
+
return props.filteredOptions !== void 0 ? props.filteredOptions : currentOptions.value;
|
|
85
88
|
});
|
|
86
89
|
const displaySelectedIndexes = (0, import_vue.computed)(() => {
|
|
87
90
|
if (!props.filteredOptions || props.filteredOptions.length === 0) {
|
|
@@ -117,22 +120,22 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
117
120
|
};
|
|
118
121
|
const onUpdateCurrentIndexes = (newVal) => {
|
|
119
122
|
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
120
|
-
const
|
|
123
|
+
const selectedValuesInFiltered = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
|
|
121
124
|
var _a;
|
|
122
125
|
return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
|
|
123
126
|
});
|
|
124
127
|
const newSelectedIndexes = /* @__PURE__ */ new Set();
|
|
128
|
+
const filteredValuesSet = new Set(displayOptions.value.map((opt) => opt.value));
|
|
125
129
|
confirmIndexes.value.forEach((idx) => {
|
|
126
130
|
var _a;
|
|
127
131
|
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
128
132
|
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
129
|
-
|
|
130
|
-
if (!isInFilteredList) {
|
|
133
|
+
if (!filteredValuesSet.has(value)) {
|
|
131
134
|
newSelectedIndexes.add(idx);
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
});
|
|
135
|
-
|
|
138
|
+
selectedValuesInFiltered.forEach((value) => {
|
|
136
139
|
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === value);
|
|
137
140
|
if (originalIndex >= 0) {
|
|
138
141
|
newSelectedIndexes.add(originalIndex);
|
|
@@ -179,11 +182,13 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
179
182
|
if (newValue !== props.showPicker) {
|
|
180
183
|
emit("update:showPicker", newValue);
|
|
181
184
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
if (newValue) {
|
|
186
|
+
currentOptions.value = (0, import_deep_clone.deepClone)(props.options);
|
|
187
|
+
confirmIndexes.value = (0, import_deep_clone.deepClone)(currentSelectedIndex.value);
|
|
188
|
+
confirmValues.value = (0, import_deep_clone.deepClone)(currentSelectedValue.value);
|
|
189
|
+
getIndexesByValues();
|
|
190
|
+
updateAllSelectedOptions();
|
|
191
|
+
}
|
|
187
192
|
});
|
|
188
193
|
(0, import_vue.watch)(() => props.showPicker, (newValue) => {
|
|
189
194
|
var _a;
|
|
@@ -309,65 +314,87 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
309
314
|
const handleSelectAll = () => {
|
|
310
315
|
if (props.filteredOptions && props.filteredOptions.length === 0) {
|
|
311
316
|
confirmIndexes.value = [];
|
|
317
|
+
confirmValues.value = [];
|
|
318
|
+
emit("update:selectedValue", confirmValues.value);
|
|
319
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
312
320
|
updateAllSelectedOptions();
|
|
321
|
+
onChange();
|
|
313
322
|
return;
|
|
314
323
|
}
|
|
324
|
+
let newIndexes = [];
|
|
315
325
|
if (!isAllSelected.value) {
|
|
316
326
|
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
317
|
-
const selectedIndexes = [];
|
|
318
327
|
displayOptions.value.forEach((option) => {
|
|
319
328
|
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
320
329
|
if (originalIndex >= 0) {
|
|
321
|
-
|
|
330
|
+
newIndexes.push(originalIndex);
|
|
322
331
|
}
|
|
323
332
|
});
|
|
324
|
-
confirmIndexes.value = selectedIndexes;
|
|
325
333
|
} else {
|
|
326
|
-
|
|
334
|
+
newIndexes = currentOptions.value.map((_, index) => index);
|
|
327
335
|
}
|
|
328
336
|
} else {
|
|
329
|
-
|
|
337
|
+
newIndexes = [];
|
|
338
|
+
}
|
|
339
|
+
confirmIndexes.value = newIndexes;
|
|
340
|
+
if (confirmIndexes.value.length > 0) {
|
|
341
|
+
getValuesByIndexes();
|
|
342
|
+
} else {
|
|
343
|
+
confirmValues.value = [];
|
|
330
344
|
}
|
|
345
|
+
emit("update:selectedValue", confirmValues.value);
|
|
346
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
331
347
|
updateAllSelectedOptions();
|
|
348
|
+
onChange();
|
|
332
349
|
};
|
|
333
350
|
const onSelectOther = () => {
|
|
334
351
|
if (props.filteredOptions && props.filteredOptions.length === 0) {
|
|
335
352
|
confirmIndexes.value = [];
|
|
353
|
+
confirmValues.value = [];
|
|
354
|
+
emit("update:selectedValue", confirmValues.value);
|
|
355
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
336
356
|
updateAllSelectedOptions();
|
|
357
|
+
onChange();
|
|
337
358
|
return;
|
|
338
359
|
}
|
|
360
|
+
let newIndexes = [];
|
|
339
361
|
if (props.filteredOptions && props.filteredOptions.length > 0) {
|
|
340
|
-
const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
|
|
341
362
|
const currentSelectedInFiltered = /* @__PURE__ */ new Set();
|
|
342
363
|
confirmIndexes.value.forEach((idx) => {
|
|
343
364
|
var _a;
|
|
344
365
|
if (idx >= 0 && idx < currentOptions.value.length) {
|
|
345
366
|
const value = (_a = currentOptions.value[idx]) == null ? void 0 : _a.value;
|
|
346
|
-
|
|
367
|
+
const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
|
|
368
|
+
if (isInFilteredList) {
|
|
347
369
|
currentSelectedInFiltered.add(idx);
|
|
348
370
|
}
|
|
349
371
|
}
|
|
350
372
|
});
|
|
351
|
-
const newSelectedIndexes = [];
|
|
352
373
|
displayOptions.value.forEach((option) => {
|
|
353
374
|
const originalIndex = currentOptions.value.findIndex((opt) => opt.value === option.value);
|
|
354
375
|
if (originalIndex >= 0) {
|
|
355
376
|
if (!currentSelectedInFiltered.has(originalIndex)) {
|
|
356
|
-
|
|
377
|
+
newIndexes.push(originalIndex);
|
|
357
378
|
}
|
|
358
379
|
}
|
|
359
380
|
});
|
|
360
|
-
confirmIndexes.value = newSelectedIndexes;
|
|
361
381
|
} else {
|
|
362
|
-
const temp = new Array();
|
|
363
382
|
currentOptions.value.forEach((_, index) => {
|
|
364
383
|
if (!confirmIndexes.value.includes(index)) {
|
|
365
|
-
|
|
384
|
+
newIndexes.push(index);
|
|
366
385
|
}
|
|
367
386
|
});
|
|
368
|
-
confirmIndexes.value = temp;
|
|
369
387
|
}
|
|
388
|
+
confirmIndexes.value = newIndexes;
|
|
389
|
+
if (confirmIndexes.value.length > 0) {
|
|
390
|
+
getValuesByIndexes();
|
|
391
|
+
} else {
|
|
392
|
+
confirmValues.value = [];
|
|
393
|
+
}
|
|
394
|
+
emit("update:selectedValue", confirmValues.value);
|
|
395
|
+
emit("update:selectedIndex", confirmIndexes.value);
|
|
370
396
|
updateAllSelectedOptions();
|
|
397
|
+
onChange();
|
|
371
398
|
};
|
|
372
399
|
const genOptionItems = () => {
|
|
373
400
|
let formatOptions = [];
|
|
@@ -382,7 +409,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
382
409
|
return (0, import_vue.createVNode)(import_MultiplePickerOptions.default, {
|
|
383
410
|
"ref": pickerOptions,
|
|
384
411
|
"currentIndexes": displaySelectedIndexes.value,
|
|
385
|
-
"onUpdate:currentIndexes":
|
|
412
|
+
"onUpdate:currentIndexes": onUpdateCurrentIndexes,
|
|
386
413
|
"columnCounts": props.columnCounts,
|
|
387
414
|
"initialOptions": formatOptions,
|
|
388
415
|
"allowHtml": props.allowHtml,
|
|
@@ -395,7 +422,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
395
422
|
});
|
|
396
423
|
};
|
|
397
424
|
const genOptions = () => {
|
|
398
|
-
const showEmpty =
|
|
425
|
+
const showEmpty = !displayOptions.value || displayOptions.value.length === 0;
|
|
399
426
|
return (0, import_vue.createVNode)("div", {
|
|
400
427
|
"class": bem("options")
|
|
401
428
|
}, [showEmpty ? (0, import_vue.createVNode)(import_empty.default, {
|