zartui 3.1.32 → 3.1.33
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/dropdown-item/DropdownItem.mjs +15 -16
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/lib/dropdown-item/DropdownItem.js +14 -15
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +15 -16
- package/lib/zartui.es.js +15 -16
- package/lib/zartui.js +15 -16
- package/lib/zartui.min.js +1 -1
- package/package.json +27 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive, Teleport, defineComponent, computed, createVNode as _createVNode, vShow as _vShow, withDirectives as _withDirectives, createTextVNode as _createTextVNode, mergeProps as _mergeProps } from "vue";
|
|
1
|
+
import { reactive, Teleport, defineComponent, computed, ref, createVNode as _createVNode, vShow as _vShow, withDirectives as _withDirectives, createTextVNode as _createTextVNode, mergeProps as _mergeProps } from "vue";
|
|
2
2
|
import { truthProp, unknownProp, getZIndexStyle, createNamespace, makeArrayProp, HAPTICS_FEEDBACK, extend, makeStringProp } from "../utils/index.mjs";
|
|
3
3
|
import { DROPDOWN_KEY } from "../dropdown-menu/DropdownMenu.mjs";
|
|
4
4
|
import { useParent } from "@zartui/use";
|
|
@@ -48,7 +48,7 @@ var stdin_default = defineComponent({
|
|
|
48
48
|
parent,
|
|
49
49
|
index
|
|
50
50
|
} = useParent(DROPDOWN_KEY);
|
|
51
|
-
const modelArray =
|
|
51
|
+
const modelArray = ref(props.modelValueArray);
|
|
52
52
|
if (!parent) {
|
|
53
53
|
if (process.env.NODE_ENV !== "production") {
|
|
54
54
|
console.error("[ZartUI] <DropdownItem> must be a child component of <DropdownMenu>.");
|
|
@@ -60,7 +60,7 @@ var stdin_default = defineComponent({
|
|
|
60
60
|
const onOpened = getEmitter("opened");
|
|
61
61
|
const onClose = () => {
|
|
62
62
|
if (props.multiSelect) {
|
|
63
|
-
emit("close", modelArray);
|
|
63
|
+
emit("close", modelArray.value);
|
|
64
64
|
} else {
|
|
65
65
|
emit("close");
|
|
66
66
|
}
|
|
@@ -68,7 +68,7 @@ var stdin_default = defineComponent({
|
|
|
68
68
|
const onClosed = () => {
|
|
69
69
|
state.showWrapper = false;
|
|
70
70
|
if (props.multiSelect) {
|
|
71
|
-
emit("closed", modelArray);
|
|
71
|
+
emit("closed", modelArray.value);
|
|
72
72
|
} else {
|
|
73
73
|
emit("closed");
|
|
74
74
|
}
|
|
@@ -80,14 +80,14 @@ var stdin_default = defineComponent({
|
|
|
80
80
|
};
|
|
81
81
|
const onClickReset = () => {
|
|
82
82
|
var _a;
|
|
83
|
-
modelArray.splice(0);
|
|
84
|
-
modelArray.push(...(_a = props.resetDefaultValue) != null ? _a : []);
|
|
83
|
+
modelArray.value.splice(0);
|
|
84
|
+
modelArray.value.push(...(_a = props.resetDefaultValue) != null ? _a : []);
|
|
85
85
|
state.showPopup = false;
|
|
86
86
|
emit("reset");
|
|
87
87
|
};
|
|
88
88
|
const onClickConfirm = () => {
|
|
89
89
|
state.showPopup = false;
|
|
90
|
-
emit("confirm", modelArray);
|
|
90
|
+
emit("confirm", modelArray.value);
|
|
91
91
|
};
|
|
92
92
|
const toggle = (show = !state.showPopup, options = {}) => {
|
|
93
93
|
if (show === state.showPopup) {
|
|
@@ -110,7 +110,7 @@ var stdin_default = defineComponent({
|
|
|
110
110
|
if (props.multiSelect) {
|
|
111
111
|
let title = "";
|
|
112
112
|
props.options.forEach((item) => {
|
|
113
|
-
if (modelArray.indexOf(item.value) > -1) {
|
|
113
|
+
if (modelArray.value.indexOf(item.value) > -1) {
|
|
114
114
|
title += item[fields.value.text] + "\u3001";
|
|
115
115
|
}
|
|
116
116
|
});
|
|
@@ -123,6 +123,7 @@ var stdin_default = defineComponent({
|
|
|
123
123
|
return match ? match[fields.value.text] : "";
|
|
124
124
|
};
|
|
125
125
|
const renderOption = (option) => {
|
|
126
|
+
var _a;
|
|
126
127
|
const {
|
|
127
128
|
activeColor
|
|
128
129
|
} = parent.props;
|
|
@@ -130,7 +131,7 @@ var stdin_default = defineComponent({
|
|
|
130
131
|
const text = option[fields.value.text];
|
|
131
132
|
let active = false;
|
|
132
133
|
if (props.multiSelect) {
|
|
133
|
-
if (modelArray == null ? void 0 :
|
|
134
|
+
if ((_a = modelArray.value) == null ? void 0 : _a.includes(value)) {
|
|
134
135
|
active = true;
|
|
135
136
|
option.selected = true;
|
|
136
137
|
} else {
|
|
@@ -143,20 +144,17 @@ var stdin_default = defineComponent({
|
|
|
143
144
|
if (props.multiSelect) {
|
|
144
145
|
let isCancelSelect = true;
|
|
145
146
|
if (option.selected) {
|
|
146
|
-
modelArray.splice(modelArray.indexOf(value), 1);
|
|
147
|
-
emit("update:modelValue", -value);
|
|
147
|
+
modelArray.value.splice(modelArray.value.indexOf(value), 1);
|
|
148
148
|
emit("change", -value);
|
|
149
149
|
} else {
|
|
150
|
-
modelArray.push(value);
|
|
150
|
+
modelArray.value.push(value);
|
|
151
151
|
isCancelSelect = false;
|
|
152
|
-
emit("update:modelValue", value);
|
|
153
152
|
emit("change", value);
|
|
154
153
|
}
|
|
155
154
|
emit("item-select", value, isCancelSelect);
|
|
156
155
|
} else {
|
|
157
156
|
state.showPopup = false;
|
|
158
157
|
if (option.value !== props.modelValue) {
|
|
159
|
-
emit("update:modelValue", value);
|
|
160
158
|
emit("change", value);
|
|
161
159
|
}
|
|
162
160
|
emit("item-select", value);
|
|
@@ -303,11 +301,12 @@ var stdin_default = defineComponent({
|
|
|
303
301
|
})]), [[_vShow, state.showWrapper]]);
|
|
304
302
|
};
|
|
305
303
|
const updateInnerValue = (updateValue = []) => {
|
|
306
|
-
modelArray.splice(0);
|
|
307
|
-
modelArray.push(...updateValue);
|
|
304
|
+
modelArray.value.splice(0);
|
|
305
|
+
modelArray.value.push(...updateValue);
|
|
308
306
|
};
|
|
309
307
|
useExpose({
|
|
310
308
|
state,
|
|
309
|
+
modelArray,
|
|
311
310
|
toggle,
|
|
312
311
|
renderTitle,
|
|
313
312
|
updateInnerValue
|
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.33";
|
|
80
80
|
function install(app) {
|
|
81
81
|
const components = [
|
|
82
82
|
ActionSheet,
|
|
@@ -71,7 +71,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
71
71
|
parent,
|
|
72
72
|
index
|
|
73
73
|
} = (0, import_use.useParent)(import_DropdownMenu.DROPDOWN_KEY);
|
|
74
|
-
const modelArray = (0, import_vue.
|
|
74
|
+
const modelArray = (0, import_vue.ref)(props.modelValueArray);
|
|
75
75
|
if (!parent) {
|
|
76
76
|
if (process.env.NODE_ENV !== "production") {
|
|
77
77
|
console.error("[ZartUI] <DropdownItem> must be a child component of <DropdownMenu>.");
|
|
@@ -83,7 +83,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
83
83
|
const onOpened = getEmitter("opened");
|
|
84
84
|
const onClose = () => {
|
|
85
85
|
if (props.multiSelect) {
|
|
86
|
-
emit("close", modelArray);
|
|
86
|
+
emit("close", modelArray.value);
|
|
87
87
|
} else {
|
|
88
88
|
emit("close");
|
|
89
89
|
}
|
|
@@ -91,7 +91,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
91
91
|
const onClosed = () => {
|
|
92
92
|
state.showWrapper = false;
|
|
93
93
|
if (props.multiSelect) {
|
|
94
|
-
emit("closed", modelArray);
|
|
94
|
+
emit("closed", modelArray.value);
|
|
95
95
|
} else {
|
|
96
96
|
emit("closed");
|
|
97
97
|
}
|
|
@@ -103,14 +103,14 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
103
103
|
};
|
|
104
104
|
const onClickReset = () => {
|
|
105
105
|
var _a;
|
|
106
|
-
modelArray.splice(0);
|
|
107
|
-
modelArray.push(...(_a = props.resetDefaultValue) != null ? _a : []);
|
|
106
|
+
modelArray.value.splice(0);
|
|
107
|
+
modelArray.value.push(...(_a = props.resetDefaultValue) != null ? _a : []);
|
|
108
108
|
state.showPopup = false;
|
|
109
109
|
emit("reset");
|
|
110
110
|
};
|
|
111
111
|
const onClickConfirm = () => {
|
|
112
112
|
state.showPopup = false;
|
|
113
|
-
emit("confirm", modelArray);
|
|
113
|
+
emit("confirm", modelArray.value);
|
|
114
114
|
};
|
|
115
115
|
const toggle = (show = !state.showPopup, options = {}) => {
|
|
116
116
|
if (show === state.showPopup) {
|
|
@@ -133,7 +133,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
133
133
|
if (props.multiSelect) {
|
|
134
134
|
let title = "";
|
|
135
135
|
props.options.forEach((item) => {
|
|
136
|
-
if (modelArray.indexOf(item.value) > -1) {
|
|
136
|
+
if (modelArray.value.indexOf(item.value) > -1) {
|
|
137
137
|
title += item[fields.value.text] + "\u3001";
|
|
138
138
|
}
|
|
139
139
|
});
|
|
@@ -146,6 +146,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
146
146
|
return match ? match[fields.value.text] : "";
|
|
147
147
|
};
|
|
148
148
|
const renderOption = (option) => {
|
|
149
|
+
var _a;
|
|
149
150
|
const {
|
|
150
151
|
activeColor
|
|
151
152
|
} = parent.props;
|
|
@@ -153,7 +154,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
153
154
|
const text = option[fields.value.text];
|
|
154
155
|
let active = false;
|
|
155
156
|
if (props.multiSelect) {
|
|
156
|
-
if (modelArray == null ? void 0 :
|
|
157
|
+
if ((_a = modelArray.value) == null ? void 0 : _a.includes(value)) {
|
|
157
158
|
active = true;
|
|
158
159
|
option.selected = true;
|
|
159
160
|
} else {
|
|
@@ -166,20 +167,17 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
166
167
|
if (props.multiSelect) {
|
|
167
168
|
let isCancelSelect = true;
|
|
168
169
|
if (option.selected) {
|
|
169
|
-
modelArray.splice(modelArray.indexOf(value), 1);
|
|
170
|
-
emit("update:modelValue", -value);
|
|
170
|
+
modelArray.value.splice(modelArray.value.indexOf(value), 1);
|
|
171
171
|
emit("change", -value);
|
|
172
172
|
} else {
|
|
173
|
-
modelArray.push(value);
|
|
173
|
+
modelArray.value.push(value);
|
|
174
174
|
isCancelSelect = false;
|
|
175
|
-
emit("update:modelValue", value);
|
|
176
175
|
emit("change", value);
|
|
177
176
|
}
|
|
178
177
|
emit("item-select", value, isCancelSelect);
|
|
179
178
|
} else {
|
|
180
179
|
state.showPopup = false;
|
|
181
180
|
if (option.value !== props.modelValue) {
|
|
182
|
-
emit("update:modelValue", value);
|
|
183
181
|
emit("change", value);
|
|
184
182
|
}
|
|
185
183
|
emit("item-select", value);
|
|
@@ -326,11 +324,12 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
326
324
|
})]), [[import_vue.vShow, state.showWrapper]]);
|
|
327
325
|
};
|
|
328
326
|
const updateInnerValue = (updateValue = []) => {
|
|
329
|
-
modelArray.splice(0);
|
|
330
|
-
modelArray.push(...updateValue);
|
|
327
|
+
modelArray.value.splice(0);
|
|
328
|
+
modelArray.value.push(...updateValue);
|
|
331
329
|
};
|
|
332
330
|
(0, import_use_expose.useExpose)({
|
|
333
331
|
state,
|
|
332
|
+
modelArray,
|
|
334
333
|
toggle,
|
|
335
334
|
renderTitle,
|
|
336
335
|
updateInnerValue
|
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.33";
|
|
184
184
|
function install(app) {
|
|
185
185
|
const components = [
|
|
186
186
|
import_action_sheet.ActionSheet,
|