zartui 3.1.25 → 3.1.27
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 +6 -0
- package/es/multiple-picker/MultiplePicker.mjs +50 -13
- package/es/multiple-picker/MultiplePickerOptions.mjs +8 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/multiple-picker/MultiplePicker.d.ts +6 -0
- package/lib/multiple-picker/MultiplePicker.js +50 -13
- package/lib/multiple-picker/MultiplePickerOptions.js +7 -3
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +57 -17
- package/lib/zartui.es.js +57 -17
- package/lib/zartui.js +57 -17
- package/lib/zartui.min.js +1 -1
- package/package.json +7 -7
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
|
@@ -76,7 +76,7 @@ import { Timeline } from "./timeline/index.mjs";
|
|
|
76
76
|
import { Toast } from "./toast/index.mjs";
|
|
77
77
|
import { Uploader } from "./uploader/index.mjs";
|
|
78
78
|
import { Video } from "./video/index.mjs";
|
|
79
|
-
const version = "3.1.
|
|
79
|
+
const version = "3.1.27";
|
|
80
80
|
function install(app) {
|
|
81
81
|
const components = [
|
|
82
82
|
ActionSheet,
|
|
@@ -61,6 +61,12 @@ declare const multiplePickerProps: {
|
|
|
61
61
|
default: true;
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
+
export type MultiplePickerExpose = {
|
|
65
|
+
resetOptions: (props: {
|
|
66
|
+
options: Array<PickerOption>;
|
|
67
|
+
selectedIndex: Array<number>;
|
|
68
|
+
}) => void;
|
|
69
|
+
};
|
|
64
70
|
export type MultiplePickerProps = ExtractPropTypes<typeof multiplePickerProps>;
|
|
65
71
|
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
66
72
|
title: StringConstructor;
|
|
@@ -6,6 +6,7 @@ import Loading from "../loading/index.mjs";
|
|
|
6
6
|
import MultiplePickerOptions from "./MultiplePickerOptions.mjs";
|
|
7
7
|
import Popup from "../popup/index.mjs";
|
|
8
8
|
import Button from "../button/index.mjs";
|
|
9
|
+
import { useExpose } from "../composables/use-expose.mjs";
|
|
9
10
|
const [name, bem] = createNamespace("multiple-picker");
|
|
10
11
|
const multiplePickerProps = {
|
|
11
12
|
title: String,
|
|
@@ -36,13 +37,36 @@ var stdin_default = defineComponent({
|
|
|
36
37
|
emit,
|
|
37
38
|
slots
|
|
38
39
|
}) {
|
|
40
|
+
const currentOptions = ref(props.options);
|
|
41
|
+
const currentSelectedIndex = computed(() => props.selectedIndex);
|
|
42
|
+
const currentSelectedValue = computed(() => props.selectedValue);
|
|
39
43
|
const confirmIndexes = ref(props.selectedIndex);
|
|
40
44
|
const confirmValues = ref(props.selectedValue);
|
|
45
|
+
const resetOptions = (props2) => {
|
|
46
|
+
currentOptions.value = props2.options;
|
|
47
|
+
confirmIndexes.value = props2.selectedIndex;
|
|
48
|
+
if (confirmIndexes.value.length > 0) {
|
|
49
|
+
getValuesByIndexes();
|
|
50
|
+
} else {
|
|
51
|
+
confirmValues.value = [];
|
|
52
|
+
}
|
|
53
|
+
emit("update:selectedValue", confirmValues.value);
|
|
54
|
+
};
|
|
55
|
+
const onUpdateCurrentIndexes = (newVal) => {
|
|
56
|
+
confirmIndexes.value = newVal;
|
|
57
|
+
if (newVal.length > 0) {
|
|
58
|
+
getValuesByIndexes();
|
|
59
|
+
} else {
|
|
60
|
+
confirmValues.value = [];
|
|
61
|
+
}
|
|
62
|
+
getValuesByIndexes();
|
|
63
|
+
emit("update:selectedValue", confirmValues.value);
|
|
64
|
+
};
|
|
41
65
|
const getIndexesByValues = () => {
|
|
42
66
|
var _a;
|
|
43
67
|
if (confirmValues.value && confirmValues.value.length > 0) {
|
|
44
68
|
confirmIndexes.value.splice(0, confirmIndexes.value.length);
|
|
45
|
-
(_a =
|
|
69
|
+
(_a = currentOptions.value) == null ? void 0 : _a.forEach((option, index) => {
|
|
46
70
|
if (option.value && confirmValues.value.includes(option.value)) {
|
|
47
71
|
confirmIndexes.value.push(index);
|
|
48
72
|
}
|
|
@@ -50,6 +74,16 @@ var stdin_default = defineComponent({
|
|
|
50
74
|
}
|
|
51
75
|
};
|
|
52
76
|
getIndexesByValues();
|
|
77
|
+
const getValuesByIndexes = () => {
|
|
78
|
+
if (confirmIndexes.value && confirmIndexes.value.length > 0) {
|
|
79
|
+
confirmValues.value.splice(0, confirmValues.value.length);
|
|
80
|
+
confirmIndexes.value.forEach((index) => {
|
|
81
|
+
if (index > -1 && index < currentOptions.value.length) {
|
|
82
|
+
confirmValues.value.push(currentOptions.value[index].value);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
53
87
|
const pickerOptions = ref();
|
|
54
88
|
const currentShow = ref(props.showPicker);
|
|
55
89
|
const DEFAULT_ITEM_HEIGHT = ref(36);
|
|
@@ -57,8 +91,8 @@ var stdin_default = defineComponent({
|
|
|
57
91
|
if (newValue !== props.showPicker) {
|
|
58
92
|
emit("update:showPicker", newValue);
|
|
59
93
|
}
|
|
60
|
-
confirmIndexes.value = deepClone(
|
|
61
|
-
confirmValues.value = deepClone(
|
|
94
|
+
confirmIndexes.value = deepClone(currentSelectedIndex.value);
|
|
95
|
+
confirmValues.value = deepClone(currentSelectedValue.value);
|
|
62
96
|
getIndexesByValues();
|
|
63
97
|
});
|
|
64
98
|
watch(() => props.showPicker, (newValue) => {
|
|
@@ -80,10 +114,10 @@ var stdin_default = defineComponent({
|
|
|
80
114
|
const indexes = confirmIndexes.value;
|
|
81
115
|
const result = [];
|
|
82
116
|
indexes == null ? void 0 : indexes.forEach((index) => {
|
|
83
|
-
if (index > -1 && index <
|
|
117
|
+
if (index > -1 && index < currentOptions.value.length && currentOptions.value[index]) {
|
|
84
118
|
result.push({
|
|
85
|
-
[props.textKey]:
|
|
86
|
-
value:
|
|
119
|
+
[props.textKey]: currentOptions.value[index][props.textKey],
|
|
120
|
+
value: currentOptions.value[index].value,
|
|
87
121
|
initialIndex: index
|
|
88
122
|
});
|
|
89
123
|
}
|
|
@@ -139,20 +173,20 @@ var stdin_default = defineComponent({
|
|
|
139
173
|
}, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
|
|
140
174
|
}
|
|
141
175
|
};
|
|
142
|
-
const genOptionItems = () => {
|
|
176
|
+
const genOptionItems = computed(() => {
|
|
143
177
|
let formatOptions = [];
|
|
144
|
-
if (
|
|
145
|
-
formatOptions =
|
|
178
|
+
if (currentOptions.value && currentOptions.value[0] && typeof currentOptions.value[0] !== "object") {
|
|
179
|
+
formatOptions = currentOptions.value.map((v) => ({
|
|
146
180
|
value: v,
|
|
147
181
|
text: v
|
|
148
182
|
}));
|
|
149
183
|
} else {
|
|
150
|
-
formatOptions =
|
|
184
|
+
formatOptions = currentOptions.value;
|
|
151
185
|
}
|
|
152
186
|
return _createVNode(MultiplePickerOptions, {
|
|
153
187
|
"ref": pickerOptions,
|
|
154
188
|
"currentIndexes": confirmIndexes.value,
|
|
155
|
-
"onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
|
|
189
|
+
"onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
|
|
156
190
|
"columnCounts": props.columnCounts,
|
|
157
191
|
"initialOptions": formatOptions,
|
|
158
192
|
"allowHtml": props.allowHtml,
|
|
@@ -163,15 +197,18 @@ var stdin_default = defineComponent({
|
|
|
163
197
|
}, {
|
|
164
198
|
option: slots.option
|
|
165
199
|
});
|
|
166
|
-
};
|
|
200
|
+
});
|
|
167
201
|
const genOptions = () => _createVNode("div", {
|
|
168
202
|
"class": bem("options")
|
|
169
|
-
}, [genOptionItems
|
|
203
|
+
}, [genOptionItems.value]);
|
|
170
204
|
const renderMultiplePicker = () => _createVNode("div", {
|
|
171
205
|
"class": bem()
|
|
172
206
|
}, [genTitle(), props.loading ? _createVNode(Loading, {
|
|
173
207
|
"class": bem("loading")
|
|
174
208
|
}, null) : "", genOptions(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
|
|
209
|
+
useExpose({
|
|
210
|
+
resetOptions
|
|
211
|
+
});
|
|
175
212
|
return () => {
|
|
176
213
|
if (props.popup) {
|
|
177
214
|
return _createVNode(Popup, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, defineComponent, reactive, createVNode as _createVNode } from "vue";
|
|
1
|
+
import { ref, defineComponent, reactive, computed, createVNode as _createVNode } from "vue";
|
|
2
2
|
import { createNamespace, isObject, makeArrayProp, makeNumberProp, makeStringProp } from "../utils/index.mjs";
|
|
3
3
|
import { deepClone } from "../utils/deep-clone.mjs";
|
|
4
4
|
import { useExpose } from "../composables/use-expose.mjs";
|
|
@@ -20,11 +20,15 @@ var stdin_default = defineComponent({
|
|
|
20
20
|
emit,
|
|
21
21
|
slots
|
|
22
22
|
}) {
|
|
23
|
+
const currentOptions = computed(() => {
|
|
24
|
+
return props.initialOptions;
|
|
25
|
+
});
|
|
23
26
|
const state = reactive({
|
|
24
|
-
options: props.initialOptions,
|
|
25
27
|
confirmed: false
|
|
26
28
|
});
|
|
27
|
-
const currentIndexes =
|
|
29
|
+
const currentIndexes = computed(() => {
|
|
30
|
+
return props.currentIndexes;
|
|
31
|
+
});
|
|
28
32
|
const columnCounts = ref(props.columnCounts);
|
|
29
33
|
const onClickItem = (index) => {
|
|
30
34
|
if (props.readonly) {
|
|
@@ -62,7 +66,7 @@ var stdin_default = defineComponent({
|
|
|
62
66
|
height: `${props.itemHeight + 8}px`,
|
|
63
67
|
width: `${1 / columnCounts.value * 100}%`
|
|
64
68
|
};
|
|
65
|
-
return
|
|
69
|
+
return currentOptions.value.map((option, index) => {
|
|
66
70
|
const text = getOptionText(option);
|
|
67
71
|
const disabled = isOptionDisabled(option);
|
|
68
72
|
const childData = {
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -180,7 +180,7 @@ __reExport(stdin_exports, require("./timeline"), module.exports);
|
|
|
180
180
|
__reExport(stdin_exports, require("./toast"), module.exports);
|
|
181
181
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
|
182
182
|
__reExport(stdin_exports, require("./video"), module.exports);
|
|
183
|
-
const version = "3.1.
|
|
183
|
+
const version = "3.1.27";
|
|
184
184
|
function install(app) {
|
|
185
185
|
const components = [
|
|
186
186
|
import_action_sheet.ActionSheet,
|
|
@@ -61,6 +61,12 @@ declare const multiplePickerProps: {
|
|
|
61
61
|
default: true;
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
+
export type MultiplePickerExpose = {
|
|
65
|
+
resetOptions: (props: {
|
|
66
|
+
options: Array<PickerOption>;
|
|
67
|
+
selectedIndex: Array<number>;
|
|
68
|
+
}) => void;
|
|
69
|
+
};
|
|
64
70
|
export type MultiplePickerProps = ExtractPropTypes<typeof multiplePickerProps>;
|
|
65
71
|
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
66
72
|
title: StringConstructor;
|
|
@@ -38,6 +38,7 @@ var import_loading = __toESM(require("../loading"));
|
|
|
38
38
|
var import_MultiplePickerOptions = __toESM(require("./MultiplePickerOptions"));
|
|
39
39
|
var import_popup = __toESM(require("../popup"));
|
|
40
40
|
var import_button = __toESM(require("../button"));
|
|
41
|
+
var import_use_expose = require("../composables/use-expose");
|
|
41
42
|
const [name, bem] = (0, import_utils.createNamespace)("multiple-picker");
|
|
42
43
|
const multiplePickerProps = {
|
|
43
44
|
title: String,
|
|
@@ -68,13 +69,36 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
68
69
|
emit,
|
|
69
70
|
slots
|
|
70
71
|
}) {
|
|
72
|
+
const currentOptions = (0, import_vue.ref)(props.options);
|
|
73
|
+
const currentSelectedIndex = (0, import_vue.computed)(() => props.selectedIndex);
|
|
74
|
+
const currentSelectedValue = (0, import_vue.computed)(() => props.selectedValue);
|
|
71
75
|
const confirmIndexes = (0, import_vue.ref)(props.selectedIndex);
|
|
72
76
|
const confirmValues = (0, import_vue.ref)(props.selectedValue);
|
|
77
|
+
const resetOptions = (props2) => {
|
|
78
|
+
currentOptions.value = props2.options;
|
|
79
|
+
confirmIndexes.value = props2.selectedIndex;
|
|
80
|
+
if (confirmIndexes.value.length > 0) {
|
|
81
|
+
getValuesByIndexes();
|
|
82
|
+
} else {
|
|
83
|
+
confirmValues.value = [];
|
|
84
|
+
}
|
|
85
|
+
emit("update:selectedValue", confirmValues.value);
|
|
86
|
+
};
|
|
87
|
+
const onUpdateCurrentIndexes = (newVal) => {
|
|
88
|
+
confirmIndexes.value = newVal;
|
|
89
|
+
if (newVal.length > 0) {
|
|
90
|
+
getValuesByIndexes();
|
|
91
|
+
} else {
|
|
92
|
+
confirmValues.value = [];
|
|
93
|
+
}
|
|
94
|
+
getValuesByIndexes();
|
|
95
|
+
emit("update:selectedValue", confirmValues.value);
|
|
96
|
+
};
|
|
73
97
|
const getIndexesByValues = () => {
|
|
74
98
|
var _a;
|
|
75
99
|
if (confirmValues.value && confirmValues.value.length > 0) {
|
|
76
100
|
confirmIndexes.value.splice(0, confirmIndexes.value.length);
|
|
77
|
-
(_a =
|
|
101
|
+
(_a = currentOptions.value) == null ? void 0 : _a.forEach((option, index) => {
|
|
78
102
|
if (option.value && confirmValues.value.includes(option.value)) {
|
|
79
103
|
confirmIndexes.value.push(index);
|
|
80
104
|
}
|
|
@@ -82,6 +106,16 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
82
106
|
}
|
|
83
107
|
};
|
|
84
108
|
getIndexesByValues();
|
|
109
|
+
const getValuesByIndexes = () => {
|
|
110
|
+
if (confirmIndexes.value && confirmIndexes.value.length > 0) {
|
|
111
|
+
confirmValues.value.splice(0, confirmValues.value.length);
|
|
112
|
+
confirmIndexes.value.forEach((index) => {
|
|
113
|
+
if (index > -1 && index < currentOptions.value.length) {
|
|
114
|
+
confirmValues.value.push(currentOptions.value[index].value);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
85
119
|
const pickerOptions = (0, import_vue.ref)();
|
|
86
120
|
const currentShow = (0, import_vue.ref)(props.showPicker);
|
|
87
121
|
const DEFAULT_ITEM_HEIGHT = (0, import_vue.ref)(36);
|
|
@@ -89,8 +123,8 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
89
123
|
if (newValue !== props.showPicker) {
|
|
90
124
|
emit("update:showPicker", newValue);
|
|
91
125
|
}
|
|
92
|
-
confirmIndexes.value = (0, import_deep_clone.deepClone)(
|
|
93
|
-
confirmValues.value = (0, import_deep_clone.deepClone)(
|
|
126
|
+
confirmIndexes.value = (0, import_deep_clone.deepClone)(currentSelectedIndex.value);
|
|
127
|
+
confirmValues.value = (0, import_deep_clone.deepClone)(currentSelectedValue.value);
|
|
94
128
|
getIndexesByValues();
|
|
95
129
|
});
|
|
96
130
|
(0, import_vue.watch)(() => props.showPicker, (newValue) => {
|
|
@@ -112,10 +146,10 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
112
146
|
const indexes = confirmIndexes.value;
|
|
113
147
|
const result = [];
|
|
114
148
|
indexes == null ? void 0 : indexes.forEach((index) => {
|
|
115
|
-
if (index > -1 && index <
|
|
149
|
+
if (index > -1 && index < currentOptions.value.length && currentOptions.value[index]) {
|
|
116
150
|
result.push({
|
|
117
|
-
[props.textKey]:
|
|
118
|
-
value:
|
|
151
|
+
[props.textKey]: currentOptions.value[index][props.textKey],
|
|
152
|
+
value: currentOptions.value[index].value,
|
|
119
153
|
initialIndex: index
|
|
120
154
|
});
|
|
121
155
|
}
|
|
@@ -171,20 +205,20 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
171
205
|
}, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
|
|
172
206
|
}
|
|
173
207
|
};
|
|
174
|
-
const genOptionItems = () => {
|
|
208
|
+
const genOptionItems = (0, import_vue.computed)(() => {
|
|
175
209
|
let formatOptions = [];
|
|
176
|
-
if (
|
|
177
|
-
formatOptions =
|
|
210
|
+
if (currentOptions.value && currentOptions.value[0] && typeof currentOptions.value[0] !== "object") {
|
|
211
|
+
formatOptions = currentOptions.value.map((v) => ({
|
|
178
212
|
value: v,
|
|
179
213
|
text: v
|
|
180
214
|
}));
|
|
181
215
|
} else {
|
|
182
|
-
formatOptions =
|
|
216
|
+
formatOptions = currentOptions.value;
|
|
183
217
|
}
|
|
184
218
|
return (0, import_vue.createVNode)(import_MultiplePickerOptions.default, {
|
|
185
219
|
"ref": pickerOptions,
|
|
186
220
|
"currentIndexes": confirmIndexes.value,
|
|
187
|
-
"onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
|
|
221
|
+
"onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
|
|
188
222
|
"columnCounts": props.columnCounts,
|
|
189
223
|
"initialOptions": formatOptions,
|
|
190
224
|
"allowHtml": props.allowHtml,
|
|
@@ -195,15 +229,18 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
195
229
|
}, {
|
|
196
230
|
option: slots.option
|
|
197
231
|
});
|
|
198
|
-
};
|
|
232
|
+
});
|
|
199
233
|
const genOptions = () => (0, import_vue.createVNode)("div", {
|
|
200
234
|
"class": bem("options")
|
|
201
|
-
}, [genOptionItems
|
|
235
|
+
}, [genOptionItems.value]);
|
|
202
236
|
const renderMultiplePicker = () => (0, import_vue.createVNode)("div", {
|
|
203
237
|
"class": bem()
|
|
204
238
|
}, [genTitle(), props.loading ? (0, import_vue.createVNode)(import_loading.default, {
|
|
205
239
|
"class": bem("loading")
|
|
206
240
|
}, null) : "", genOptions(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
|
|
241
|
+
(0, import_use_expose.useExpose)({
|
|
242
|
+
resetOptions
|
|
243
|
+
});
|
|
207
244
|
return () => {
|
|
208
245
|
if (props.popup) {
|
|
209
246
|
return (0, import_vue.createVNode)(import_popup.default, {
|
|
@@ -42,11 +42,15 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
42
42
|
emit,
|
|
43
43
|
slots
|
|
44
44
|
}) {
|
|
45
|
+
const currentOptions = (0, import_vue.computed)(() => {
|
|
46
|
+
return props.initialOptions;
|
|
47
|
+
});
|
|
45
48
|
const state = (0, import_vue.reactive)({
|
|
46
|
-
options: props.initialOptions,
|
|
47
49
|
confirmed: false
|
|
48
50
|
});
|
|
49
|
-
const currentIndexes = (0, import_vue.
|
|
51
|
+
const currentIndexes = (0, import_vue.computed)(() => {
|
|
52
|
+
return props.currentIndexes;
|
|
53
|
+
});
|
|
50
54
|
const columnCounts = (0, import_vue.ref)(props.columnCounts);
|
|
51
55
|
const onClickItem = (index) => {
|
|
52
56
|
if (props.readonly) {
|
|
@@ -84,7 +88,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
84
88
|
height: `${props.itemHeight + 8}px`,
|
|
85
89
|
width: `${1 / columnCounts.value * 100}%`
|
|
86
90
|
};
|
|
87
|
-
return
|
|
91
|
+
return currentOptions.value.map((option, index) => {
|
|
88
92
|
const text = getOptionText(option);
|
|
89
93
|
const disabled = isOptionDisabled(option);
|
|
90
94
|
const childData = {
|