vue-devui 1.0.0-rc.6 → 1.0.0-rc.9
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/README.md +5 -0
- package/alert/index.es.js +37 -11
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +311 -77
- package/auto-complete/index.umd.js +3 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +81 -70
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +29 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5632 -87
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +56 -29
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +364 -234
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +310 -157
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +28 -3
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +125 -45
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +437 -22
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +490 -605
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +29 -5
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +71 -50
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +109 -13
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +34 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +330 -130
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +272 -199
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +34 -6
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +34 -10
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +126 -27
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +125 -25
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/formControlProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/overlay/index.es.js +31 -9
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +2 -1
- package/pagination/index.es.js +135 -124
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/popover/index.es.js +198 -83
- package/popover/index.umd.js +16 -16
- package/popover/style.css +1 -1
- package/progress/index.es.js +76 -20
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +161 -140
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +48 -16
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +108 -12
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +379 -167
- package/search/index.umd.js +17 -17
- package/search/style.css +1 -1
- package/select/index.es.js +7339 -556
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +37 -12
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +34 -10
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +201 -84
- package/splitter/index.umd.js +14 -14
- package/splitter/style.css +1 -1
- package/status/index.es.js +26 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +30 -6
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +6808 -585
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +136 -70
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +31 -7
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +5631 -80
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/timeline/index.es.js +108 -12
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +190 -74
- package/tooltip/index.umd.js +17 -17
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +376 -256
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +138 -34
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +6770 -5769
- package/vue-devui.umd.js +27 -21
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -84
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/commentProps.js +0 -3
- package/nuxt/components/readTipProps.js +0 -3
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -261
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
package/tree/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { createVNode, defineComponent, toRefs, inject, computed,
|
|
20
|
+
import { createVNode, defineComponent, toRefs, inject, computed, toRef, provide, mergeProps, renderSlot, useSlots, ref, watch } from "vue";
|
|
21
21
|
const USE_TREE_TOKEN = "use-tree-token";
|
|
22
22
|
const NODE_HEIGHT = 30;
|
|
23
23
|
const NODE_INDENT = 24;
|
|
@@ -69,6 +69,29 @@ const IconOpen = () => createVNode("svg", {
|
|
|
69
69
|
"height": "2",
|
|
70
70
|
"fill": "#5e7ce0"
|
|
71
71
|
}, null)])]);
|
|
72
|
+
function createBem(namespace, element, modifier) {
|
|
73
|
+
let cls = namespace;
|
|
74
|
+
if (element) {
|
|
75
|
+
cls += `__${element}`;
|
|
76
|
+
}
|
|
77
|
+
if (modifier) {
|
|
78
|
+
cls += `--${modifier}`;
|
|
79
|
+
}
|
|
80
|
+
return cls;
|
|
81
|
+
}
|
|
82
|
+
function useNamespace(block, needDot = false) {
|
|
83
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
84
|
+
const b = () => createBem(namespace);
|
|
85
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
86
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
87
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
88
|
+
return {
|
|
89
|
+
b,
|
|
90
|
+
e,
|
|
91
|
+
m,
|
|
92
|
+
em
|
|
93
|
+
};
|
|
94
|
+
}
|
|
72
95
|
var DTreeNodeToggle = defineComponent({
|
|
73
96
|
name: "DTreeNodeToggle",
|
|
74
97
|
props: {
|
|
@@ -84,10 +107,11 @@ var DTreeNodeToggle = defineComponent({
|
|
|
84
107
|
const {
|
|
85
108
|
toggleNode
|
|
86
109
|
} = inject(USE_TREE_TOKEN);
|
|
110
|
+
const ns2 = useNamespace("tree");
|
|
87
111
|
return () => {
|
|
88
112
|
var _a;
|
|
89
113
|
return createVNode("span", {
|
|
90
|
-
"class": ["
|
|
114
|
+
"class": [ns2.e("node-folder"), ((_a = data.value) == null ? void 0 : _a.disableToggle) && "toggle-disabled"],
|
|
91
115
|
"onClick": (event) => {
|
|
92
116
|
event.stopPropagation();
|
|
93
117
|
if (toggleNode) {
|
|
@@ -95,7 +119,7 @@ var DTreeNodeToggle = defineComponent({
|
|
|
95
119
|
}
|
|
96
120
|
}
|
|
97
121
|
}, [data.value.isLeaf ? createVNode("span", {
|
|
98
|
-
"class": "
|
|
122
|
+
"class": ns2.e("node-indent")
|
|
99
123
|
}, null) : data.value.expanded ? createVNode(IconOpen, {
|
|
100
124
|
"class": "mr-xs"
|
|
101
125
|
}, null) : createVNode(IconClose, {
|
|
@@ -104,13 +128,12 @@ var DTreeNodeToggle = defineComponent({
|
|
|
104
128
|
};
|
|
105
129
|
}
|
|
106
130
|
});
|
|
107
|
-
var checkbox = "";
|
|
108
131
|
const commonProps = {
|
|
109
132
|
name: {
|
|
110
133
|
type: String,
|
|
111
134
|
default: void 0
|
|
112
135
|
},
|
|
113
|
-
|
|
136
|
+
halfChecked: {
|
|
114
137
|
type: Boolean,
|
|
115
138
|
default: false
|
|
116
139
|
},
|
|
@@ -136,27 +159,23 @@ const commonProps = {
|
|
|
136
159
|
beforeChange: {
|
|
137
160
|
type: Function,
|
|
138
161
|
default: void 0
|
|
162
|
+
},
|
|
163
|
+
size: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: "md"
|
|
139
166
|
}
|
|
140
167
|
};
|
|
141
168
|
const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
142
|
-
halfchecked: {
|
|
143
|
-
type: Boolean,
|
|
144
|
-
default: false
|
|
145
|
-
},
|
|
146
169
|
checked: {
|
|
147
170
|
type: Boolean,
|
|
148
171
|
default: false
|
|
149
172
|
},
|
|
150
173
|
value: {
|
|
151
|
-
type: String
|
|
174
|
+
type: [Number, String]
|
|
152
175
|
},
|
|
153
176
|
label: {
|
|
154
177
|
type: String,
|
|
155
|
-
default:
|
|
156
|
-
},
|
|
157
|
-
title: {
|
|
158
|
-
type: String,
|
|
159
|
-
default: void 0
|
|
178
|
+
default: ""
|
|
160
179
|
},
|
|
161
180
|
"onUpdate:checked": {
|
|
162
181
|
type: Function,
|
|
@@ -171,6 +190,10 @@ const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
|
171
190
|
},
|
|
172
191
|
"onUpdate:modelValue": {
|
|
173
192
|
type: Function
|
|
193
|
+
},
|
|
194
|
+
border: {
|
|
195
|
+
type: Boolean,
|
|
196
|
+
default: false
|
|
174
197
|
}
|
|
175
198
|
});
|
|
176
199
|
const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
@@ -197,158 +220,260 @@ const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
|
197
220
|
"onUpdate:modelValue": {
|
|
198
221
|
type: Function,
|
|
199
222
|
default: void 0
|
|
223
|
+
},
|
|
224
|
+
border: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
default: false
|
|
227
|
+
},
|
|
228
|
+
max: {
|
|
229
|
+
type: Number,
|
|
230
|
+
default: void 0
|
|
231
|
+
},
|
|
232
|
+
textColor: {
|
|
233
|
+
type: String,
|
|
234
|
+
default: ""
|
|
200
235
|
}
|
|
201
236
|
});
|
|
202
237
|
const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
|
|
238
|
+
function useCheckbox(props, ctx) {
|
|
239
|
+
const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
|
|
240
|
+
const isChecked = computed(() => props.checked || props.modelValue);
|
|
241
|
+
const mergedChecked = computed(() => {
|
|
242
|
+
var _a, _b;
|
|
243
|
+
return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
|
|
244
|
+
});
|
|
245
|
+
const isLimitDisabled = computed(() => {
|
|
246
|
+
const max = checkboxGroupConf == null ? void 0 : checkboxGroupConf.max.value;
|
|
247
|
+
return !!max && (checkboxGroupConf == null ? void 0 : checkboxGroupConf.modelValue.value.length) >= max && !mergedChecked.value;
|
|
248
|
+
});
|
|
249
|
+
const mergedDisabled = computed(() => {
|
|
250
|
+
return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled || isLimitDisabled.value;
|
|
251
|
+
});
|
|
252
|
+
const mergedIsShowTitle = computed(() => {
|
|
253
|
+
var _a;
|
|
254
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
|
|
255
|
+
});
|
|
256
|
+
const mergedShowAnimation = computed(() => {
|
|
257
|
+
var _a;
|
|
258
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
|
|
259
|
+
});
|
|
260
|
+
const mergedColor = computed(() => {
|
|
261
|
+
var _a;
|
|
262
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
|
|
263
|
+
});
|
|
264
|
+
const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
|
|
265
|
+
const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
|
|
266
|
+
const canChange = (checked, val) => {
|
|
267
|
+
var _a;
|
|
268
|
+
if (mergedDisabled.value) {
|
|
269
|
+
return Promise.resolve(false);
|
|
270
|
+
}
|
|
271
|
+
const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
|
|
272
|
+
if (beforeChange) {
|
|
273
|
+
const res = beforeChange(checked, val);
|
|
274
|
+
if (typeof res === "boolean") {
|
|
275
|
+
return Promise.resolve(res);
|
|
276
|
+
}
|
|
277
|
+
return res;
|
|
278
|
+
}
|
|
279
|
+
return Promise.resolve(true);
|
|
280
|
+
};
|
|
281
|
+
const toggle = () => {
|
|
282
|
+
const current = !isChecked.value;
|
|
283
|
+
checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
|
|
284
|
+
ctx.emit("update:checked", current);
|
|
285
|
+
ctx.emit("update:modelValue", current);
|
|
286
|
+
ctx.emit("change", current);
|
|
287
|
+
};
|
|
288
|
+
const handleClick = () => {
|
|
289
|
+
canChange(!isChecked.value, props.label).then((res) => res && toggle());
|
|
290
|
+
};
|
|
291
|
+
const size = computed(() => {
|
|
292
|
+
var _a;
|
|
293
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.size.value) != null ? _a : props.size;
|
|
294
|
+
});
|
|
295
|
+
const border = computed(() => {
|
|
296
|
+
var _a;
|
|
297
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.border.value) != null ? _a : props.border;
|
|
298
|
+
});
|
|
299
|
+
return {
|
|
300
|
+
mergedChecked,
|
|
301
|
+
mergedDisabled,
|
|
302
|
+
mergedIsShowTitle,
|
|
303
|
+
mergedShowAnimation,
|
|
304
|
+
mergedColor,
|
|
305
|
+
itemWidth,
|
|
306
|
+
direction,
|
|
307
|
+
handleClick,
|
|
308
|
+
size,
|
|
309
|
+
border
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
function useCheckboxGroup(props, ctx) {
|
|
313
|
+
const valList = toRef(props, "modelValue");
|
|
314
|
+
const defaultOpt = {
|
|
315
|
+
checked: false,
|
|
316
|
+
isShowTitle: true,
|
|
317
|
+
halfChecked: false,
|
|
318
|
+
showAnimation: true,
|
|
319
|
+
disabled: false
|
|
320
|
+
};
|
|
321
|
+
const toggleGroupVal = (val) => {
|
|
322
|
+
let index2 = -1;
|
|
323
|
+
if (["string", "number"].includes(typeof valList.value[0])) {
|
|
324
|
+
index2 = valList.value.findIndex((item) => item === val);
|
|
325
|
+
} else if (typeof valList.value[0] === "object") {
|
|
326
|
+
index2 = valList.value.findIndex((item) => item.value === val);
|
|
327
|
+
}
|
|
328
|
+
if (index2 === -1) {
|
|
329
|
+
if (typeof props.options[0] === "object") {
|
|
330
|
+
const newOne = props.options.find((item) => item.value === val);
|
|
331
|
+
const res2 = [...valList.value, newOne];
|
|
332
|
+
ctx.emit("update:modelValue", res2);
|
|
333
|
+
ctx.emit("change", res2);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const res = [...valList.value, val];
|
|
337
|
+
ctx.emit("update:modelValue", res);
|
|
338
|
+
ctx.emit("change", res);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
valList.value.splice(index2, 1);
|
|
342
|
+
ctx.emit("update:modelValue", valList.value);
|
|
343
|
+
ctx.emit("change", valList.value);
|
|
344
|
+
};
|
|
345
|
+
const isItemChecked = (itemVal) => {
|
|
346
|
+
if (["string", "number"].includes(typeof valList.value[0])) {
|
|
347
|
+
return valList.value.includes(itemVal);
|
|
348
|
+
} else if (typeof valList.value[0] === "object") {
|
|
349
|
+
return valList.value.some((item) => item.value === itemVal);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
provide(checkboxGroupInjectionKey, {
|
|
353
|
+
disabled: toRef(props, "disabled"),
|
|
354
|
+
isShowTitle: toRef(props, "isShowTitle"),
|
|
355
|
+
color: toRef(props, "color"),
|
|
356
|
+
showAnimation: toRef(props, "showAnimation"),
|
|
357
|
+
beforeChange: props.beforeChange,
|
|
358
|
+
isItemChecked,
|
|
359
|
+
toggleGroupVal,
|
|
360
|
+
itemWidth: toRef(props, "itemWidth"),
|
|
361
|
+
direction: toRef(props, "direction"),
|
|
362
|
+
size: toRef(props, "size"),
|
|
363
|
+
border: toRef(props, "border"),
|
|
364
|
+
max: toRef(props, "max"),
|
|
365
|
+
modelValue: toRef(props, "modelValue"),
|
|
366
|
+
textColor: toRef(props, "textColor")
|
|
367
|
+
});
|
|
368
|
+
return { defaultOpt };
|
|
369
|
+
}
|
|
370
|
+
function useCheckboxButton() {
|
|
371
|
+
const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
|
|
372
|
+
const mergedTextColor = computed(() => {
|
|
373
|
+
var _a;
|
|
374
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.textColor.value) != null ? _a : void 0;
|
|
375
|
+
});
|
|
376
|
+
return {
|
|
377
|
+
mergedTextColor
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
var checkbox = "";
|
|
203
381
|
var Checkbox = defineComponent({
|
|
204
382
|
name: "DCheckbox",
|
|
205
383
|
props: checkboxProps,
|
|
206
384
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
207
385
|
setup(props, ctx) {
|
|
208
|
-
const
|
|
209
|
-
const isChecked = computed(() => props.checked || props.modelValue);
|
|
210
|
-
const mergedDisabled = computed(() => {
|
|
211
|
-
return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
|
|
212
|
-
});
|
|
213
|
-
const mergedChecked = computed(() => {
|
|
214
|
-
var _a, _b;
|
|
215
|
-
return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
|
|
216
|
-
});
|
|
217
|
-
const mergedIsShowTitle = computed(() => {
|
|
218
|
-
var _a;
|
|
219
|
-
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
|
|
220
|
-
});
|
|
221
|
-
const mergedShowAnimation = computed(() => {
|
|
222
|
-
var _a;
|
|
223
|
-
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
|
|
224
|
-
});
|
|
225
|
-
const mergedColor = computed(() => {
|
|
226
|
-
var _a;
|
|
227
|
-
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
|
|
228
|
-
});
|
|
229
|
-
const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
|
|
230
|
-
const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
|
|
231
|
-
const canChange = (checked, val) => {
|
|
232
|
-
var _a;
|
|
233
|
-
if (mergedDisabled.value) {
|
|
234
|
-
return Promise.resolve(false);
|
|
235
|
-
}
|
|
236
|
-
const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
|
|
237
|
-
if (beforeChange) {
|
|
238
|
-
const res = beforeChange(checked, val);
|
|
239
|
-
if (typeof res === "boolean") {
|
|
240
|
-
return Promise.resolve(res);
|
|
241
|
-
}
|
|
242
|
-
return res;
|
|
243
|
-
}
|
|
244
|
-
return Promise.resolve(true);
|
|
245
|
-
};
|
|
246
|
-
const toggle = () => {
|
|
247
|
-
const current = !isChecked.value;
|
|
248
|
-
checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
|
|
249
|
-
ctx.emit("update:checked", current);
|
|
250
|
-
ctx.emit("update:modelValue", current);
|
|
251
|
-
ctx.emit("change", current);
|
|
252
|
-
};
|
|
253
|
-
const handleClick = () => {
|
|
254
|
-
canChange(!isChecked.value, props.label).then((res) => res && toggle());
|
|
255
|
-
};
|
|
256
|
-
return {
|
|
257
|
-
itemWidth,
|
|
258
|
-
direction,
|
|
259
|
-
mergedColor,
|
|
260
|
-
mergedDisabled,
|
|
261
|
-
mergedIsShowTitle,
|
|
262
|
-
mergedChecked,
|
|
263
|
-
mergedShowAnimation,
|
|
264
|
-
handleClick
|
|
265
|
-
};
|
|
266
|
-
},
|
|
267
|
-
render() {
|
|
268
|
-
var _a;
|
|
386
|
+
const ns2 = useNamespace("checkbox");
|
|
269
387
|
const {
|
|
270
|
-
itemWidth,
|
|
271
|
-
direction,
|
|
272
388
|
mergedChecked,
|
|
273
389
|
mergedDisabled,
|
|
274
390
|
mergedIsShowTitle,
|
|
275
391
|
mergedShowAnimation,
|
|
276
|
-
halfchecked,
|
|
277
|
-
title,
|
|
278
|
-
label,
|
|
279
|
-
handleClick,
|
|
280
|
-
name,
|
|
281
|
-
value,
|
|
282
392
|
mergedColor,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
"
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
"
|
|
329
|
-
|
|
330
|
-
"
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
"
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
393
|
+
itemWidth,
|
|
394
|
+
direction,
|
|
395
|
+
handleClick,
|
|
396
|
+
size,
|
|
397
|
+
border
|
|
398
|
+
} = useCheckbox(props, ctx);
|
|
399
|
+
return () => {
|
|
400
|
+
var _a, _b;
|
|
401
|
+
const wrapperCls = {
|
|
402
|
+
[ns2.e("column-margin")]: direction === "column",
|
|
403
|
+
[ns2.e("wrap")]: typeof itemWidth !== "undefined"
|
|
404
|
+
};
|
|
405
|
+
const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
|
|
406
|
+
const checkboxCls = {
|
|
407
|
+
[ns2.b()]: true,
|
|
408
|
+
active: mergedChecked.value,
|
|
409
|
+
"half-checked": props.halfChecked,
|
|
410
|
+
disabled: mergedDisabled.value,
|
|
411
|
+
unchecked: !mergedChecked.value
|
|
412
|
+
};
|
|
413
|
+
const labelTitle = mergedIsShowTitle.value ? props.title || props.label : "";
|
|
414
|
+
const bgImgStyle = mergedColor.value && props.halfChecked || mergedColor.value ? `linear-gradient(${mergedColor.value}, ${mergedColor.value})` : "";
|
|
415
|
+
const spanStyle = [`border-color:${(mergedChecked.value || props.halfChecked) && mergedColor.value ? mergedColor.value : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor.value && props.halfChecked ? mergedColor.value : ""}`];
|
|
416
|
+
const spanCls = {
|
|
417
|
+
[ns2.e("material")]: true,
|
|
418
|
+
"custom-color": mergedColor.value,
|
|
419
|
+
[ns2.m("no-label")]: !props.label && !ctx.slots.default,
|
|
420
|
+
[ns2.m("no-animation")]: !mergedShowAnimation.value,
|
|
421
|
+
[ns2.e("default-background")]: !props.halfChecked
|
|
422
|
+
};
|
|
423
|
+
const polygonCls = {
|
|
424
|
+
[ns2.e("tick")]: true,
|
|
425
|
+
[ns2.m("no-animation")]: !mergedShowAnimation.value
|
|
426
|
+
};
|
|
427
|
+
const labelCls = {
|
|
428
|
+
[ns2.m(size.value)]: border.value,
|
|
429
|
+
[ns2.m("bordered")]: border.value
|
|
430
|
+
};
|
|
431
|
+
const stopPropagation = ($event) => $event.stopPropagation();
|
|
432
|
+
const inputProps = {
|
|
433
|
+
indeterminate: props.halfChecked
|
|
434
|
+
};
|
|
435
|
+
return createVNode("div", {
|
|
436
|
+
"class": wrapperCls,
|
|
437
|
+
"style": wrapperStyle
|
|
438
|
+
}, [createVNode("div", {
|
|
439
|
+
"class": checkboxCls
|
|
440
|
+
}, [createVNode("label", {
|
|
441
|
+
"title": labelTitle,
|
|
442
|
+
"onClick": handleClick,
|
|
443
|
+
"class": labelCls,
|
|
444
|
+
"style": {
|
|
445
|
+
width: itemWidth ? "100%" : "auto"
|
|
446
|
+
}
|
|
447
|
+
}, [createVNode("input", mergeProps({
|
|
448
|
+
"name": props.name || props.value,
|
|
449
|
+
"class": ns2.e("input"),
|
|
450
|
+
"type": "checkbox"
|
|
451
|
+
}, inputProps, {
|
|
452
|
+
"checked": mergedChecked.value,
|
|
453
|
+
"disabled": mergedDisabled.value,
|
|
454
|
+
"onClick": stopPropagation,
|
|
455
|
+
"onChange": stopPropagation
|
|
456
|
+
}), null), createVNode("span", {
|
|
457
|
+
"style": spanStyle,
|
|
458
|
+
"class": spanCls
|
|
459
|
+
}, [createVNode("span", {
|
|
460
|
+
"class": ns2.e("halfchecked-bg")
|
|
461
|
+
}, null), createVNode("svg", {
|
|
462
|
+
"viewBox": "0 0 16 16",
|
|
463
|
+
"version": "1.1",
|
|
464
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
465
|
+
"class": ns2.e("tick-wrap")
|
|
466
|
+
}, [createVNode("g", {
|
|
467
|
+
"stroke": "none",
|
|
468
|
+
"stroke-width": "1",
|
|
469
|
+
"fill": "none",
|
|
470
|
+
"fill-rule": "evenodd"
|
|
471
|
+
}, [createVNode("polygon", {
|
|
472
|
+
"fill-rule": "nonzero",
|
|
473
|
+
"points": "5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",
|
|
474
|
+
"class": polygonCls
|
|
475
|
+
}, null)])])]), props.label || ((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a))])])]);
|
|
476
|
+
};
|
|
352
477
|
}
|
|
353
478
|
});
|
|
354
479
|
var checkboxGroup = "";
|
|
@@ -357,102 +482,105 @@ defineComponent({
|
|
|
357
482
|
props: checkboxGroupProps,
|
|
358
483
|
emits: ["change", "update:modelValue"],
|
|
359
484
|
setup(props, ctx) {
|
|
360
|
-
const
|
|
361
|
-
const
|
|
362
|
-
checked: false,
|
|
363
|
-
isShowTitle: true,
|
|
364
|
-
halfchecked: false,
|
|
365
|
-
showAnimation: true,
|
|
366
|
-
disabled: false
|
|
367
|
-
};
|
|
368
|
-
const toggleGroupVal = (val) => {
|
|
369
|
-
let index2 = -1;
|
|
370
|
-
if (typeof valList.value[0] === "string") {
|
|
371
|
-
index2 = valList.value.findIndex((item) => item === val);
|
|
372
|
-
} else if (typeof valList.value[0] === "object") {
|
|
373
|
-
index2 = valList.value.findIndex((item) => item.value === val);
|
|
374
|
-
}
|
|
375
|
-
if (index2 === -1) {
|
|
376
|
-
if (typeof props.options[0] === "object") {
|
|
377
|
-
const newOne = props.options.find((item) => item.value === val);
|
|
378
|
-
const res2 = [...valList.value, newOne];
|
|
379
|
-
ctx.emit("update:modelValue", res2);
|
|
380
|
-
ctx.emit("change", res2);
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
const res = [...valList.value, val];
|
|
384
|
-
ctx.emit("update:modelValue", res);
|
|
385
|
-
ctx.emit("change", res);
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
valList.value.splice(index2, 1);
|
|
389
|
-
ctx.emit("update:modelValue", valList.value);
|
|
390
|
-
ctx.emit("change", valList.value);
|
|
391
|
-
};
|
|
392
|
-
const isItemChecked = (itemVal) => {
|
|
393
|
-
if (typeof valList.value[0] === "string") {
|
|
394
|
-
return valList.value.includes(itemVal);
|
|
395
|
-
} else if (typeof valList.value[0] === "object") {
|
|
396
|
-
return valList.value.some((item) => item.value === itemVal);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
provide(checkboxGroupInjectionKey, {
|
|
400
|
-
disabled: toRef(props, "disabled"),
|
|
401
|
-
isShowTitle: toRef(props, "isShowTitle"),
|
|
402
|
-
color: toRef(props, "color"),
|
|
403
|
-
showAnimation: toRef(props, "showAnimation"),
|
|
404
|
-
beforeChange: props.beforeChange,
|
|
405
|
-
isItemChecked,
|
|
406
|
-
toggleGroupVal,
|
|
407
|
-
itemWidth: toRef(props, "itemWidth"),
|
|
408
|
-
direction: toRef(props, "direction")
|
|
409
|
-
});
|
|
410
|
-
return {
|
|
485
|
+
const ns2 = useNamespace("checkbox");
|
|
486
|
+
const {
|
|
411
487
|
defaultOpt
|
|
488
|
+
} = useCheckboxGroup(props, ctx);
|
|
489
|
+
return () => {
|
|
490
|
+
var _a, _b;
|
|
491
|
+
let children = (_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a);
|
|
492
|
+
const getContent = () => {
|
|
493
|
+
var _a2;
|
|
494
|
+
if (children) {
|
|
495
|
+
return children;
|
|
496
|
+
} else {
|
|
497
|
+
if (((_a2 = props.options) == null ? void 0 : _a2.length) > 0) {
|
|
498
|
+
children = props.options.map((opt) => {
|
|
499
|
+
let mergedOpt = null;
|
|
500
|
+
if (typeof opt === "string") {
|
|
501
|
+
mergedOpt = Object.assign({}, defaultOpt, {
|
|
502
|
+
label: opt,
|
|
503
|
+
value: opt
|
|
504
|
+
});
|
|
505
|
+
} else if (typeof opt === "object") {
|
|
506
|
+
mergedOpt = Object.assign({}, defaultOpt, __spreadProps(__spreadValues({}, opt), {
|
|
507
|
+
label: opt.name
|
|
508
|
+
}));
|
|
509
|
+
}
|
|
510
|
+
return createVNode(Checkbox, mergedOpt, null);
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
return children;
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
return createVNode("div", {
|
|
517
|
+
"class": ns2.e("group")
|
|
518
|
+
}, [createVNode("div", {
|
|
519
|
+
"class": {
|
|
520
|
+
[ns2.m("list-inline")]: props.direction === "row"
|
|
521
|
+
}
|
|
522
|
+
}, [getContent()])]);
|
|
412
523
|
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
var checkboxButton = "";
|
|
527
|
+
defineComponent({
|
|
528
|
+
name: "DCheckboxButton",
|
|
529
|
+
props: checkboxProps,
|
|
530
|
+
emits: ["change", "update:checked", "update:modelValue"],
|
|
531
|
+
setup(props, ctx) {
|
|
532
|
+
const ns2 = useNamespace("checkbox-button");
|
|
416
533
|
const {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
"
|
|
443
|
-
"
|
|
444
|
-
|
|
445
|
-
|
|
534
|
+
mergedChecked,
|
|
535
|
+
mergedDisabled,
|
|
536
|
+
mergedIsShowTitle,
|
|
537
|
+
mergedColor,
|
|
538
|
+
handleClick,
|
|
539
|
+
size
|
|
540
|
+
} = useCheckbox(props, ctx);
|
|
541
|
+
const {
|
|
542
|
+
mergedTextColor
|
|
543
|
+
} = useCheckboxButton();
|
|
544
|
+
return () => {
|
|
545
|
+
var _a, _b;
|
|
546
|
+
const labelTitle = mergedIsShowTitle.value ? props.title || props.label : "";
|
|
547
|
+
const spanStyle = [`border-color:${mergedChecked.value && mergedColor.value ? mergedColor.value : ""}`, `background-color:${mergedChecked.value && mergedColor.value ? mergedColor.value : ""}`, `color:${mergedChecked.value && mergedTextColor.value ? mergedTextColor.value : ""}`];
|
|
548
|
+
const labelCls = {
|
|
549
|
+
[ns2.b()]: true,
|
|
550
|
+
active: mergedChecked.value,
|
|
551
|
+
disabled: mergedDisabled.value,
|
|
552
|
+
unchecked: !mergedChecked.value
|
|
553
|
+
};
|
|
554
|
+
const spanCls = {
|
|
555
|
+
[ns2.e("content")]: true,
|
|
556
|
+
[ns2.m(size.value)]: true
|
|
557
|
+
};
|
|
558
|
+
const stopPropagation = ($event) => $event.stopPropagation();
|
|
559
|
+
return createVNode("label", {
|
|
560
|
+
"title": labelTitle,
|
|
561
|
+
"onClick": handleClick,
|
|
562
|
+
"class": labelCls
|
|
563
|
+
}, [createVNode("input", {
|
|
564
|
+
"name": props.name || props.value,
|
|
565
|
+
"class": ns2.e("input"),
|
|
566
|
+
"type": "checkbox",
|
|
567
|
+
"checked": mergedChecked.value,
|
|
568
|
+
"disabled": mergedDisabled.value,
|
|
569
|
+
"onClick": stopPropagation,
|
|
570
|
+
"onChange": stopPropagation
|
|
571
|
+
}, null), createVNode("span", {
|
|
572
|
+
"style": spanStyle,
|
|
573
|
+
"class": spanCls
|
|
574
|
+
}, [props.label || ((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a))])]);
|
|
575
|
+
};
|
|
446
576
|
}
|
|
447
577
|
});
|
|
578
|
+
const ns = useNamespace("tree");
|
|
448
579
|
function useTreeNode(data) {
|
|
449
580
|
const { getChildren } = inject(USE_TREE_TOKEN);
|
|
450
581
|
const nodeClass = computed(() => {
|
|
451
582
|
var _a;
|
|
452
|
-
return [
|
|
453
|
-
"devui-tree-node",
|
|
454
|
-
((_a = data.value) == null ? void 0 : _a.expanded) && "devui-tree-node__open"
|
|
455
|
-
];
|
|
583
|
+
return [ns.e("node"), ((_a = data.value) == null ? void 0 : _a.expanded) && ns.em("node", "open")];
|
|
456
584
|
});
|
|
457
585
|
const nodeStyle = computed(() => {
|
|
458
586
|
var _a;
|
|
@@ -460,9 +588,7 @@ function useTreeNode(data) {
|
|
|
460
588
|
});
|
|
461
589
|
const nodeVLineClass = computed(() => {
|
|
462
590
|
var _a, _b;
|
|
463
|
-
return [
|
|
464
|
-
!((_a = data.value) == null ? void 0 : _a.isLeaf) && ((_b = data.value) == null ? void 0 : _b.expanded) && "devui-tree-node__vline"
|
|
465
|
-
];
|
|
591
|
+
return [!((_a = data.value) == null ? void 0 : _a.isLeaf) && ((_b = data.value) == null ? void 0 : _b.expanded) && ns.e("node-vline")];
|
|
466
592
|
});
|
|
467
593
|
const nodeVLineStyle = computed(() => {
|
|
468
594
|
var _a;
|
|
@@ -474,23 +600,15 @@ function useTreeNode(data) {
|
|
|
474
600
|
});
|
|
475
601
|
const nodeHLineClass = computed(() => {
|
|
476
602
|
var _a;
|
|
477
|
-
return [
|
|
478
|
-
((_a = data.value) == null ? void 0 : _a.level) !== 1 && "devui-tree-node__hline"
|
|
479
|
-
];
|
|
603
|
+
return [((_a = data.value) == null ? void 0 : _a.level) !== 1 && ns.e("node-hline")];
|
|
480
604
|
});
|
|
481
605
|
const nodeContentClass = computed(() => {
|
|
482
606
|
var _a;
|
|
483
|
-
return [
|
|
484
|
-
"devui-tree-node__content",
|
|
485
|
-
((_a = data.value) == null ? void 0 : _a.selected) && "active"
|
|
486
|
-
];
|
|
607
|
+
return [ns.e("node-content"), ((_a = data.value) == null ? void 0 : _a.selected) && "active"];
|
|
487
608
|
});
|
|
488
609
|
const nodeTitleClass = computed(() => {
|
|
489
610
|
var _a;
|
|
490
|
-
return [
|
|
491
|
-
"devui-tree-node__title",
|
|
492
|
-
((_a = data.value) == null ? void 0 : _a.disableSelect) && "select-disabled"
|
|
493
|
-
];
|
|
611
|
+
return [ns.e("node-title"), ((_a = data.value) == null ? void 0 : _a.disableSelect) && "select-disabled"];
|
|
494
612
|
});
|
|
495
613
|
return {
|
|
496
614
|
nodeClass,
|
|
@@ -550,6 +668,7 @@ var DTreeNode = defineComponent({
|
|
|
550
668
|
toggleNode,
|
|
551
669
|
getChildren
|
|
552
670
|
} = inject(USE_TREE_TOKEN);
|
|
671
|
+
const ns2 = useNamespace("tree");
|
|
553
672
|
const {
|
|
554
673
|
nodeClass,
|
|
555
674
|
nodeStyle,
|
|
@@ -600,7 +719,7 @@ var DTreeNode = defineComponent({
|
|
|
600
719
|
}) : createVNode(DTreeNodeToggle, {
|
|
601
720
|
"data": data.value
|
|
602
721
|
}, null), createVNode("div", {
|
|
603
|
-
"class": "
|
|
722
|
+
"class": ns2.em("node-content", "value-wrapper"),
|
|
604
723
|
"style": {
|
|
605
724
|
height: `${NODE_HEIGHT}px`
|
|
606
725
|
}
|
|
@@ -964,6 +1083,7 @@ var Tree = defineComponent({
|
|
|
964
1083
|
data,
|
|
965
1084
|
check
|
|
966
1085
|
} = toRefs(props);
|
|
1086
|
+
const ns2 = useNamespace("tree");
|
|
967
1087
|
const userPlugins = [useSelect(), useOperate(), useMergeNodes()];
|
|
968
1088
|
const checkOptions = ref({
|
|
969
1089
|
checkStrategy: check.value || "both"
|
|
@@ -987,7 +1107,7 @@ var Tree = defineComponent({
|
|
|
987
1107
|
});
|
|
988
1108
|
return () => {
|
|
989
1109
|
return createVNode("div", {
|
|
990
|
-
"class":
|
|
1110
|
+
"class": ns2.b()
|
|
991
1111
|
}, [getExpendedTree == null ? void 0 : getExpendedTree().value.map((treeNode) => slots.default ? renderSlot(useSlots(), "default", {
|
|
992
1112
|
treeFactory,
|
|
993
1113
|
nodeData: treeNode
|