@wfrog/vc-ui 1.11.10 → 1.11.12
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/dist/es/chunk/Bw0Rhd-r.mjs +110 -0
- package/dist/es/chunk/CqTdDZkE.mjs +31 -0
- package/dist/es/chunk/{DAnWZLYj.mjs → CzWfBa_8.mjs} +96 -2
- package/dist/es/chunk/D229kQ56.mjs +28 -0
- package/dist/es/chunk/{Cxx_YWUC.mjs → DcouM6gM.mjs} +6 -548
- package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
- package/dist/es/chunk/KanuIcmc.mjs +412 -0
- package/dist/es/chunk/{B71xEPfK.mjs → uuUHUjSk.mjs} +4 -35
- package/dist/es/components/backbottom/backbottom.mjs +3 -2
- package/dist/es/components/button/button.mjs +14 -13
- package/dist/es/components/choice/choice.mjs +11 -9
- package/dist/es/components/choice/index.css +1 -1
- package/dist/es/components/choice-boolean/choice-boolean.mjs +3 -3
- package/dist/es/components/color-switch/color-switch.mjs +73 -1046
- package/dist/es/components/color-switch/index.css +1 -1
- package/dist/es/components/cropper/cropper.mjs +11 -117
- package/dist/es/components/cropper/index.css +1 -1
- package/dist/es/components/currency/currency.mjs +10 -12
- package/dist/es/components/daterange-picker/daterange-picker.mjs +10 -6255
- package/dist/es/components/dialog/dialog.mjs +14 -408
- package/dist/es/components/dialog/index.css +1 -1
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +11 -14
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +4 -4
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +14 -1380
- package/dist/es/components/dialog-upload-images/index.css +1 -1
- package/dist/es/components/drag-verify/drag-verify.mjs +3 -2
- package/dist/es/components/drawer/drawer.mjs +16 -359
- package/dist/es/components/drawer/index.css +3 -3
- package/dist/es/components/easy-pagination/easy-pagination.mjs +3 -2
- package/dist/es/components/explorer/explorer.mjs +8 -8
- package/dist/es/components/explorer-column-table/explorer-column-table.mjs +5 -7
- package/dist/es/components/explorer-column-table/index.css +1 -1
- package/dist/es/components/explorer-container/explorer-container.d.ts +1 -1
- package/dist/es/components/explorer-container/explorer-container.mjs +4 -3
- package/dist/es/components/explorer-filter/explorer-filter.mjs +5 -4
- package/dist/es/components/explorer-footer/explorer-footer.mjs +4 -8
- package/dist/es/components/explorer-form/explorer-form.mjs +4 -3
- package/dist/es/components/explorer-list/explorer-list.mjs +18 -13
- package/dist/es/components/explorer-list/explorer-list.vue.d.ts +1 -1
- package/dist/es/components/explorer-list/index.css +16 -16
- package/dist/es/components/explorer-modal-form/explorer-modal-form.mjs +8 -7
- package/dist/es/components/explorer-panel/explorer-panel.mjs +3 -3
- package/dist/es/components/explorer-query/explorer-query.mjs +9 -2201
- package/dist/es/components/explorer-query/index.css +1 -1
- package/dist/es/components/explorer-table/explorer-table.mjs +5 -8
- package/dist/es/components/explorer-tools/explorer-tools.mjs +23 -271
- package/dist/es/components/explorer-tools/index.css +9 -9
- package/dist/es/components/explorer-tree/explorer-tree.mjs +4 -5
- package/dist/es/components/explorer-tree/explorer-tree.vue.d.ts +1 -1
- package/dist/es/components/form-item/form-item.mjs +3 -3
- package/dist/es/components/icon-picker/icon-picker.mjs +8 -12
- package/dist/es/components/image/image.mjs +4 -4
- package/dist/es/components/info-tooltip/info-tooltip.mjs +336 -4
- package/dist/es/components/input/input.mjs +3 -2
- package/dist/es/components/input-number/input-number.mjs +3 -3
- package/dist/es/components/pca-picker/index.css +1 -1
- package/dist/es/components/pca-picker/pca-picker.mjs +443 -601
- package/dist/es/components/screenfull/screenfull.mjs +4 -3
- package/dist/es/components/scrollbar/index.css +1 -1
- package/dist/es/components/scrollbar/scrollbar.mjs +10 -10
- package/dist/es/components/select/index.css +1 -1
- package/dist/es/components/select/select.mjs +9 -10
- package/dist/es/components/single-player/index.css +1 -1
- package/dist/es/components/single-player/single-player.mjs +10 -1087
- package/dist/es/components/splitter/splitter.mjs +3 -3
- package/dist/es/components/splitter-panel/splitter-panel.mjs +3 -3
- package/dist/es/components/switch/index.css +1 -1
- package/dist/es/components/switch/switch.mjs +9 -395
- package/dist/es/components/tags/tags.mjs +7 -9
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +3 -3
- package/dist/es/components/thousand-input/thousand-input.mjs +39 -8
- package/dist/es/components/tinymce/tinymce.mjs +4 -3
- package/dist/es/components/transfer/transfer.mjs +3 -4
- package/dist/es/components/transfer-panel/transfer-panel.mjs +5 -4
- package/dist/es/components/tree-picker/popover-cascader.css +1 -1
- package/dist/es/components/tree-picker/tree-picker.mjs +5 -10
- package/dist/es/index.mjs +1 -1
- package/dist/index.css +41 -68
- package/package.json +1 -1
- package/dist/es/chunk/B-rxnVJv.mjs +0 -3
- package/dist/es/chunk/B5HpgPRt.mjs +0 -69
- package/dist/es/chunk/BBhZKpIc.mjs +0 -2179
- package/dist/es/chunk/BDcsaNYa.mjs +0 -59
- package/dist/es/chunk/BTSSEFfD.mjs +0 -319
- package/dist/es/chunk/BTpNRPQW.mjs +0 -55
- package/dist/es/chunk/BVBK1U57.mjs +0 -96
- package/dist/es/chunk/Bc6yUGLs.mjs +0 -45
- package/dist/es/chunk/BjVI1XMz.mjs +0 -40
- package/dist/es/chunk/BlzQCBDu.mjs +0 -5741
- package/dist/es/chunk/BpJKnxlF.mjs +0 -476
- package/dist/es/chunk/Brp-qSBw.mjs +0 -2003
- package/dist/es/chunk/BunQI8Jb.mjs +0 -390
- package/dist/es/chunk/C0XgBrDz.mjs +0 -775
- package/dist/es/chunk/C0pTANRX.mjs +0 -109
- package/dist/es/chunk/CBMjhoFP.mjs +0 -101
- package/dist/es/chunk/CBiNtNvQ.mjs +0 -242
- package/dist/es/chunk/CBlJeNBO.mjs +0 -890
- package/dist/es/chunk/CCVL_Zj-.mjs +0 -427
- package/dist/es/chunk/CEl4MyfJ.mjs +0 -252
- package/dist/es/chunk/CJK5_jsA.mjs +0 -53
- package/dist/es/chunk/CKOcwq5V.mjs +0 -44
- package/dist/es/chunk/COs9dJZa.mjs +0 -66
- package/dist/es/chunk/CPt6MxJW.mjs +0 -375
- package/dist/es/chunk/CVqW0jzp.mjs +0 -107
- package/dist/es/chunk/CccIsEqA.mjs +0 -128
- package/dist/es/chunk/CjLR27-a.mjs +0 -582
- package/dist/es/chunk/CoGexPPD.mjs +0 -2192
- package/dist/es/chunk/CsLIbnzG.mjs +0 -64
- package/dist/es/chunk/Ct6q2FXg.mjs +0 -5
- package/dist/es/chunk/Cuq5meQh.mjs +0 -184
- package/dist/es/chunk/CvYIOfT1.mjs +0 -23
- package/dist/es/chunk/CxHJBf4l.mjs +0 -31
- package/dist/es/chunk/CzdaOBtA.mjs +0 -66
- package/dist/es/chunk/D0QTifnI.mjs +0 -54
- package/dist/es/chunk/D1QnA2iT.mjs +0 -229
- package/dist/es/chunk/D3AvJlVX.mjs +0 -188
- package/dist/es/chunk/D9Lr0Bzb.mjs +0 -1136
- package/dist/es/chunk/DCkPv0hy.mjs +0 -29
- package/dist/es/chunk/DRwwUUhy.mjs +0 -49
- package/dist/es/chunk/DX-2VRY2.mjs +0 -836
- package/dist/es/chunk/DZ2oTFad.mjs +0 -687
- package/dist/es/chunk/D_bou1py.mjs +0 -55
- package/dist/es/chunk/Da199A5L.mjs +0 -314
- package/dist/es/chunk/DbhQlaOz.mjs +0 -94
- package/dist/es/chunk/Dgu95mOy.mjs +0 -237
- package/dist/es/chunk/DhGOsWxx.mjs +0 -6
- package/dist/es/chunk/Dm_Sj5aH.mjs +0 -487
- package/dist/es/chunk/Dmi-1GRO.mjs +0 -163
- package/dist/es/chunk/DodoD9a9.mjs +0 -52
- package/dist/es/chunk/DrrVDcwm.mjs +0 -955
- package/dist/es/chunk/Du_zJ1Fz.mjs +0 -49
- package/dist/es/chunk/DxxbB5jY.mjs +0 -34
- package/dist/es/chunk/Gk1J52Yw.mjs +0 -207
- package/dist/es/chunk/NsldgdCh.mjs +0 -704
- package/dist/es/chunk/V6KjsUQN.mjs +0 -35
- package/dist/es/chunk/eEsLFV3s.mjs +0 -76
- package/dist/es/chunk/fqiLhk0V.mjs +0 -2065
- package/dist/es/chunk/nxVM7re4.mjs +0 -35
- package/dist/es/chunk/s7HLrANj.mjs +0 -215
- package/dist/es/chunk/vPhxogl3.mjs +0 -19
- package/dist/es/components/icon/icon2.mjs +0 -27
|
@@ -1,704 +0,0 @@
|
|
|
1
|
-
import { inject, computed, getCurrentInstance, watch, nextTick, ref, toRaw, defineComponent, useSlots, createBlock, openBlock, resolveDynamicComponent, unref, normalizeClass, withCtx, createElementVNode, createElementBlock, createCommentVNode, withDirectives, mergeProps, isRef, withModifiers, vModelCheckbox, renderSlot, Fragment, createTextVNode, toDisplayString, normalizeStyle, provide, toRefs, renderList } from 'vue';
|
|
2
|
-
import { u as useSizeProp } from './vPhxogl3.mjs';
|
|
3
|
-
import { u as useAriaProps, p as pick } from './BunQI8Jb.mjs';
|
|
4
|
-
import { U as UPDATE_MODEL_EVENT, C as CHANGE_EVENT } from './Ct6q2FXg.mjs';
|
|
5
|
-
import { i as isString, a as debugWarn, c as isArray, j as isObject, u as useNamespace, b as buildProps, d as definePropType } from './Gk1J52Yw.mjs';
|
|
6
|
-
import { b as isNumber, d as isBoolean, c as isUndefined, g as isPropAbsent } from './Bc6yUGLs.mjs';
|
|
7
|
-
import { _ as _export_sfc, a as withNoopInstall, w as withInstall } from './V6KjsUQN.mjs';
|
|
8
|
-
import { f as formContextKey } from './nxVM7re4.mjs';
|
|
9
|
-
import { a as useFormDisabled, u as useFormItem, c as useFormSize, b as useFormItemInputId } from './CBMjhoFP.mjs';
|
|
10
|
-
import { i as isEqual } from './B71xEPfK.mjs';
|
|
11
|
-
import { u as useDeprecated } from './CvYIOfT1.mjs';
|
|
12
|
-
import { o as omit } from './CBiNtNvQ.mjs';
|
|
13
|
-
|
|
14
|
-
const checkboxProps = {
|
|
15
|
-
modelValue: {
|
|
16
|
-
type: [Number, String, Boolean],
|
|
17
|
-
default: void 0
|
|
18
|
-
},
|
|
19
|
-
label: {
|
|
20
|
-
type: [String, Boolean, Number, Object],
|
|
21
|
-
default: void 0
|
|
22
|
-
},
|
|
23
|
-
value: {
|
|
24
|
-
type: [String, Boolean, Number, Object],
|
|
25
|
-
default: void 0
|
|
26
|
-
},
|
|
27
|
-
indeterminate: Boolean,
|
|
28
|
-
disabled: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: void 0
|
|
31
|
-
},
|
|
32
|
-
checked: Boolean,
|
|
33
|
-
name: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: void 0
|
|
36
|
-
},
|
|
37
|
-
trueValue: {
|
|
38
|
-
type: [String, Number],
|
|
39
|
-
default: void 0
|
|
40
|
-
},
|
|
41
|
-
falseValue: {
|
|
42
|
-
type: [String, Number],
|
|
43
|
-
default: void 0
|
|
44
|
-
},
|
|
45
|
-
trueLabel: {
|
|
46
|
-
type: [String, Number],
|
|
47
|
-
default: void 0
|
|
48
|
-
},
|
|
49
|
-
falseLabel: {
|
|
50
|
-
type: [String, Number],
|
|
51
|
-
default: void 0
|
|
52
|
-
},
|
|
53
|
-
id: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: void 0
|
|
56
|
-
},
|
|
57
|
-
border: Boolean,
|
|
58
|
-
size: useSizeProp,
|
|
59
|
-
tabindex: [String, Number],
|
|
60
|
-
validateEvent: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: true
|
|
63
|
-
},
|
|
64
|
-
ariaLabel: String,
|
|
65
|
-
...useAriaProps(["ariaControls"])
|
|
66
|
-
};
|
|
67
|
-
const checkboxEmits = {
|
|
68
|
-
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
|
|
69
|
-
change: (val) => isString(val) || isNumber(val) || isBoolean(val)
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
|
|
73
|
-
|
|
74
|
-
const useCheckboxDisabled = ({
|
|
75
|
-
model,
|
|
76
|
-
isChecked
|
|
77
|
-
}) => {
|
|
78
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
79
|
-
const formContext = inject(formContextKey, void 0);
|
|
80
|
-
const isLimitDisabled = computed(() => {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
|
|
83
|
-
const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
|
|
84
|
-
return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
|
|
85
|
-
});
|
|
86
|
-
const isDisabled = useFormDisabled(
|
|
87
|
-
computed(() => {
|
|
88
|
-
var _a, _b;
|
|
89
|
-
if (checkboxGroup === void 0) {
|
|
90
|
-
return (_a = formContext == null ? void 0 : formContext.disabled) != null ? _a : isLimitDisabled.value;
|
|
91
|
-
} else {
|
|
92
|
-
return ((_b = checkboxGroup.disabled) == null ? void 0 : _b.value) || isLimitDisabled.value;
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
return {
|
|
97
|
-
isDisabled,
|
|
98
|
-
isLimitDisabled
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const useCheckboxEvent = (props, {
|
|
103
|
-
model,
|
|
104
|
-
isLimitExceeded,
|
|
105
|
-
hasOwnLabel,
|
|
106
|
-
isDisabled,
|
|
107
|
-
isLabeledByFormItem
|
|
108
|
-
}) => {
|
|
109
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
110
|
-
const { formItem } = useFormItem();
|
|
111
|
-
const { emit } = getCurrentInstance();
|
|
112
|
-
function getLabeledValue(value) {
|
|
113
|
-
var _a, _b, _c, _d;
|
|
114
|
-
return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
|
|
115
|
-
}
|
|
116
|
-
function emitChangeEvent(checked, e) {
|
|
117
|
-
emit(CHANGE_EVENT, getLabeledValue(checked), e);
|
|
118
|
-
}
|
|
119
|
-
function handleChange(e) {
|
|
120
|
-
if (isLimitExceeded.value)
|
|
121
|
-
return;
|
|
122
|
-
const target = e.target;
|
|
123
|
-
emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
|
|
124
|
-
}
|
|
125
|
-
async function onClickRoot(e) {
|
|
126
|
-
if (isLimitExceeded.value)
|
|
127
|
-
return;
|
|
128
|
-
if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
|
|
129
|
-
const eventTargets = e.composedPath();
|
|
130
|
-
const hasLabel = eventTargets.some(
|
|
131
|
-
(item) => item.tagName === "LABEL"
|
|
132
|
-
);
|
|
133
|
-
if (!hasLabel) {
|
|
134
|
-
model.value = getLabeledValue(
|
|
135
|
-
[false, props.falseValue, props.falseLabel].includes(model.value)
|
|
136
|
-
);
|
|
137
|
-
await nextTick();
|
|
138
|
-
emitChangeEvent(model.value, e);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
const validateEvent = computed(
|
|
143
|
-
() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent
|
|
144
|
-
);
|
|
145
|
-
watch(
|
|
146
|
-
() => props.modelValue,
|
|
147
|
-
() => {
|
|
148
|
-
if (validateEvent.value) {
|
|
149
|
-
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
return {
|
|
154
|
-
handleChange,
|
|
155
|
-
onClickRoot
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const useCheckboxModel = (props) => {
|
|
160
|
-
const selfModel = ref(false);
|
|
161
|
-
const { emit } = getCurrentInstance();
|
|
162
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
163
|
-
const isGroup = computed(() => isUndefined(checkboxGroup) === false);
|
|
164
|
-
const isLimitExceeded = ref(false);
|
|
165
|
-
const model = computed({
|
|
166
|
-
get() {
|
|
167
|
-
var _a, _b;
|
|
168
|
-
return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
|
|
169
|
-
},
|
|
170
|
-
set(val) {
|
|
171
|
-
var _a, _b;
|
|
172
|
-
if (isGroup.value && isArray(val)) {
|
|
173
|
-
isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
|
|
174
|
-
isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
|
|
175
|
-
} else {
|
|
176
|
-
emit(UPDATE_MODEL_EVENT, val);
|
|
177
|
-
selfModel.value = val;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
return {
|
|
182
|
-
model,
|
|
183
|
-
isGroup,
|
|
184
|
-
isLimitExceeded
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const useCheckboxStatus = (props, slots, { model }) => {
|
|
189
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
190
|
-
const isFocused = ref(false);
|
|
191
|
-
const actualValue = computed(() => {
|
|
192
|
-
if (!isPropAbsent(props.value)) {
|
|
193
|
-
return props.value;
|
|
194
|
-
}
|
|
195
|
-
return props.label;
|
|
196
|
-
});
|
|
197
|
-
const isChecked = computed(() => {
|
|
198
|
-
const value = model.value;
|
|
199
|
-
if (isBoolean(value)) {
|
|
200
|
-
return value;
|
|
201
|
-
} else if (isArray(value)) {
|
|
202
|
-
if (isObject(actualValue.value)) {
|
|
203
|
-
return value.map(toRaw).some((o) => isEqual(o, actualValue.value));
|
|
204
|
-
} else {
|
|
205
|
-
return value.map(toRaw).includes(actualValue.value);
|
|
206
|
-
}
|
|
207
|
-
} else if (value !== null && value !== void 0) {
|
|
208
|
-
return value === props.trueValue || value === props.trueLabel;
|
|
209
|
-
} else {
|
|
210
|
-
return !!value;
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
const checkboxButtonSize = useFormSize(
|
|
214
|
-
computed(() => {
|
|
215
|
-
var _a;
|
|
216
|
-
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
217
|
-
}),
|
|
218
|
-
{
|
|
219
|
-
prop: true
|
|
220
|
-
}
|
|
221
|
-
);
|
|
222
|
-
const checkboxSize = useFormSize(computed(() => {
|
|
223
|
-
var _a;
|
|
224
|
-
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
225
|
-
}));
|
|
226
|
-
const hasOwnLabel = computed(() => {
|
|
227
|
-
return !!slots.default || !isPropAbsent(actualValue.value);
|
|
228
|
-
});
|
|
229
|
-
return {
|
|
230
|
-
checkboxButtonSize,
|
|
231
|
-
isChecked,
|
|
232
|
-
isFocused,
|
|
233
|
-
checkboxSize,
|
|
234
|
-
hasOwnLabel,
|
|
235
|
-
actualValue
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const useCheckbox = (props, slots) => {
|
|
240
|
-
const { formItem: elFormItem } = useFormItem();
|
|
241
|
-
const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
|
|
242
|
-
const {
|
|
243
|
-
isFocused,
|
|
244
|
-
isChecked,
|
|
245
|
-
checkboxButtonSize,
|
|
246
|
-
checkboxSize,
|
|
247
|
-
hasOwnLabel,
|
|
248
|
-
actualValue
|
|
249
|
-
} = useCheckboxStatus(props, slots, { model });
|
|
250
|
-
const { isDisabled } = useCheckboxDisabled({ model, isChecked });
|
|
251
|
-
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
252
|
-
formItemContext: elFormItem,
|
|
253
|
-
disableIdGeneration: hasOwnLabel,
|
|
254
|
-
disableIdManagement: isGroup
|
|
255
|
-
});
|
|
256
|
-
const { handleChange, onClickRoot } = useCheckboxEvent(props, {
|
|
257
|
-
model,
|
|
258
|
-
isLimitExceeded,
|
|
259
|
-
hasOwnLabel,
|
|
260
|
-
isDisabled,
|
|
261
|
-
isLabeledByFormItem
|
|
262
|
-
});
|
|
263
|
-
const setStoreValue = () => {
|
|
264
|
-
function addToStore() {
|
|
265
|
-
var _a, _b;
|
|
266
|
-
if (isArray(model.value) && !model.value.includes(actualValue.value)) {
|
|
267
|
-
model.value.push(actualValue.value);
|
|
268
|
-
} else {
|
|
269
|
-
model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
props.checked && addToStore();
|
|
273
|
-
};
|
|
274
|
-
setStoreValue();
|
|
275
|
-
useDeprecated(
|
|
276
|
-
{
|
|
277
|
-
from: "label act as value",
|
|
278
|
-
replacement: "value",
|
|
279
|
-
version: "3.0.0",
|
|
280
|
-
scope: "el-checkbox",
|
|
281
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
282
|
-
},
|
|
283
|
-
computed(() => isGroup.value && isPropAbsent(props.value))
|
|
284
|
-
);
|
|
285
|
-
useDeprecated(
|
|
286
|
-
{
|
|
287
|
-
from: "true-label",
|
|
288
|
-
replacement: "true-value",
|
|
289
|
-
version: "3.0.0",
|
|
290
|
-
scope: "el-checkbox",
|
|
291
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
292
|
-
},
|
|
293
|
-
computed(() => !!props.trueLabel)
|
|
294
|
-
);
|
|
295
|
-
useDeprecated(
|
|
296
|
-
{
|
|
297
|
-
from: "false-label",
|
|
298
|
-
replacement: "false-value",
|
|
299
|
-
version: "3.0.0",
|
|
300
|
-
scope: "el-checkbox",
|
|
301
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
302
|
-
},
|
|
303
|
-
computed(() => !!props.falseLabel)
|
|
304
|
-
);
|
|
305
|
-
return {
|
|
306
|
-
inputId,
|
|
307
|
-
isLabeledByFormItem,
|
|
308
|
-
isChecked,
|
|
309
|
-
isDisabled,
|
|
310
|
-
isFocused,
|
|
311
|
-
checkboxButtonSize,
|
|
312
|
-
checkboxSize,
|
|
313
|
-
hasOwnLabel,
|
|
314
|
-
model,
|
|
315
|
-
actualValue,
|
|
316
|
-
handleChange,
|
|
317
|
-
onClickRoot
|
|
318
|
-
};
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
const _hoisted_1$1 = ["id", "indeterminate", "name", "tabindex", "disabled"];
|
|
322
|
-
const _sfc_main$2 = defineComponent({
|
|
323
|
-
...{
|
|
324
|
-
name: "ElCheckbox"
|
|
325
|
-
},
|
|
326
|
-
__name: "checkbox",
|
|
327
|
-
props: checkboxProps,
|
|
328
|
-
emits: checkboxEmits,
|
|
329
|
-
setup(__props) {
|
|
330
|
-
const props = __props;
|
|
331
|
-
const slots = useSlots();
|
|
332
|
-
const {
|
|
333
|
-
inputId,
|
|
334
|
-
isLabeledByFormItem,
|
|
335
|
-
isChecked,
|
|
336
|
-
isDisabled,
|
|
337
|
-
isFocused,
|
|
338
|
-
checkboxSize,
|
|
339
|
-
hasOwnLabel,
|
|
340
|
-
model,
|
|
341
|
-
actualValue,
|
|
342
|
-
handleChange,
|
|
343
|
-
onClickRoot
|
|
344
|
-
} = useCheckbox(props, slots);
|
|
345
|
-
const inputBindings = computed(() => {
|
|
346
|
-
var _a, _b, _c, _d;
|
|
347
|
-
if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
|
|
348
|
-
return {
|
|
349
|
-
"true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
|
|
350
|
-
"false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
return {
|
|
354
|
-
value: actualValue.value
|
|
355
|
-
};
|
|
356
|
-
});
|
|
357
|
-
const ns = useNamespace("checkbox");
|
|
358
|
-
const compKls = computed(() => {
|
|
359
|
-
return [
|
|
360
|
-
ns.b(),
|
|
361
|
-
ns.m(checkboxSize.value),
|
|
362
|
-
ns.is("disabled", isDisabled.value),
|
|
363
|
-
ns.is("bordered", props.border),
|
|
364
|
-
ns.is("checked", isChecked.value)
|
|
365
|
-
];
|
|
366
|
-
});
|
|
367
|
-
const spanKls = computed(() => {
|
|
368
|
-
return [
|
|
369
|
-
ns.e("input"),
|
|
370
|
-
ns.is("disabled", isDisabled.value),
|
|
371
|
-
ns.is("checked", isChecked.value),
|
|
372
|
-
ns.is("indeterminate", props.indeterminate),
|
|
373
|
-
ns.is("focus", isFocused.value)
|
|
374
|
-
];
|
|
375
|
-
});
|
|
376
|
-
return (_ctx, _cache) => {
|
|
377
|
-
return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
|
|
378
|
-
for: !unref(hasOwnLabel) && unref(isLabeledByFormItem) ? null : unref(inputId),
|
|
379
|
-
class: normalizeClass(compKls.value),
|
|
380
|
-
"aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
|
|
381
|
-
"aria-checked": _ctx.indeterminate ? "mixed" : void 0,
|
|
382
|
-
"aria-label": _ctx.ariaLabel,
|
|
383
|
-
onClick: unref(onClickRoot)
|
|
384
|
-
}, {
|
|
385
|
-
default: withCtx(() => [
|
|
386
|
-
createElementVNode(
|
|
387
|
-
"span",
|
|
388
|
-
{
|
|
389
|
-
class: normalizeClass(spanKls.value)
|
|
390
|
-
},
|
|
391
|
-
[
|
|
392
|
-
withDirectives(createElementVNode("input", mergeProps({
|
|
393
|
-
id: unref(inputId),
|
|
394
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
395
|
-
class: unref(ns).e("original"),
|
|
396
|
-
type: "checkbox",
|
|
397
|
-
indeterminate: _ctx.indeterminate,
|
|
398
|
-
name: _ctx.name,
|
|
399
|
-
tabindex: _ctx.tabindex,
|
|
400
|
-
disabled: unref(isDisabled)
|
|
401
|
-
}, inputBindings.value, {
|
|
402
|
-
onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
|
|
403
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
|
|
404
|
-
onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
|
|
405
|
-
onClick: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
406
|
-
}, ["stop"]))
|
|
407
|
-
}), null, 16, _hoisted_1$1), [
|
|
408
|
-
[vModelCheckbox, unref(model)]
|
|
409
|
-
]),
|
|
410
|
-
createElementVNode(
|
|
411
|
-
"span",
|
|
412
|
-
{
|
|
413
|
-
class: normalizeClass(unref(ns).e("inner"))
|
|
414
|
-
},
|
|
415
|
-
null,
|
|
416
|
-
2
|
|
417
|
-
)
|
|
418
|
-
],
|
|
419
|
-
2
|
|
420
|
-
),
|
|
421
|
-
unref(hasOwnLabel) ? (openBlock(), createElementBlock(
|
|
422
|
-
"span",
|
|
423
|
-
{
|
|
424
|
-
key: 0,
|
|
425
|
-
class: normalizeClass(unref(ns).e("label"))
|
|
426
|
-
},
|
|
427
|
-
[
|
|
428
|
-
renderSlot(_ctx.$slots, "default"),
|
|
429
|
-
!_ctx.$slots.default ? (openBlock(), createElementBlock(
|
|
430
|
-
Fragment,
|
|
431
|
-
{ key: 0 },
|
|
432
|
-
[
|
|
433
|
-
createTextVNode(
|
|
434
|
-
toDisplayString(_ctx.label),
|
|
435
|
-
1
|
|
436
|
-
)
|
|
437
|
-
],
|
|
438
|
-
64
|
|
439
|
-
)) : createCommentVNode("v-if", true)
|
|
440
|
-
],
|
|
441
|
-
2
|
|
442
|
-
)) : createCommentVNode("v-if", true)
|
|
443
|
-
]),
|
|
444
|
-
_: 3
|
|
445
|
-
}, 8, ["for", "class", "aria-controls", "aria-checked", "aria-label", "onClick"]);
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
|
|
450
|
-
|
|
451
|
-
const _hoisted_1 = ["name", "tabindex", "disabled"];
|
|
452
|
-
const _sfc_main$1 = defineComponent({
|
|
453
|
-
...{
|
|
454
|
-
name: "ElCheckboxButton"
|
|
455
|
-
},
|
|
456
|
-
__name: "checkbox-button",
|
|
457
|
-
props: checkboxProps,
|
|
458
|
-
emits: checkboxEmits,
|
|
459
|
-
setup(__props) {
|
|
460
|
-
const props = __props;
|
|
461
|
-
const slots = useSlots();
|
|
462
|
-
const {
|
|
463
|
-
isFocused,
|
|
464
|
-
isChecked,
|
|
465
|
-
isDisabled,
|
|
466
|
-
checkboxButtonSize,
|
|
467
|
-
model,
|
|
468
|
-
actualValue,
|
|
469
|
-
handleChange
|
|
470
|
-
} = useCheckbox(props, slots);
|
|
471
|
-
const inputBindings = computed(() => {
|
|
472
|
-
var _a, _b, _c, _d;
|
|
473
|
-
if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
|
|
474
|
-
return {
|
|
475
|
-
"true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
|
|
476
|
-
"false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
return {
|
|
480
|
-
value: actualValue.value
|
|
481
|
-
};
|
|
482
|
-
});
|
|
483
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
484
|
-
const ns = useNamespace("checkbox");
|
|
485
|
-
const activeStyle = computed(() => {
|
|
486
|
-
var _a, _b, _c, _d;
|
|
487
|
-
const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
|
|
488
|
-
return {
|
|
489
|
-
backgroundColor: fillValue,
|
|
490
|
-
borderColor: fillValue,
|
|
491
|
-
color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
|
|
492
|
-
boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
|
|
493
|
-
};
|
|
494
|
-
});
|
|
495
|
-
const labelKls = computed(() => {
|
|
496
|
-
return [
|
|
497
|
-
ns.b("button"),
|
|
498
|
-
ns.bm("button", checkboxButtonSize.value),
|
|
499
|
-
ns.is("disabled", isDisabled.value),
|
|
500
|
-
ns.is("checked", isChecked.value),
|
|
501
|
-
ns.is("focus", isFocused.value)
|
|
502
|
-
];
|
|
503
|
-
});
|
|
504
|
-
return (_ctx, _cache) => {
|
|
505
|
-
return openBlock(), createElementBlock(
|
|
506
|
-
"label",
|
|
507
|
-
{
|
|
508
|
-
class: normalizeClass(labelKls.value)
|
|
509
|
-
},
|
|
510
|
-
[
|
|
511
|
-
withDirectives(createElementVNode("input", mergeProps({
|
|
512
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
513
|
-
class: unref(ns).be("button", "original"),
|
|
514
|
-
type: "checkbox",
|
|
515
|
-
name: _ctx.name,
|
|
516
|
-
tabindex: _ctx.tabindex,
|
|
517
|
-
disabled: unref(isDisabled)
|
|
518
|
-
}, inputBindings.value, {
|
|
519
|
-
onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
|
|
520
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
|
|
521
|
-
onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
|
|
522
|
-
onClick: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
523
|
-
}, ["stop"]))
|
|
524
|
-
}), null, 16, _hoisted_1), [
|
|
525
|
-
[vModelCheckbox, unref(model)]
|
|
526
|
-
]),
|
|
527
|
-
_ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock(
|
|
528
|
-
"span",
|
|
529
|
-
{
|
|
530
|
-
key: 0,
|
|
531
|
-
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
532
|
-
style: normalizeStyle(unref(isChecked) ? activeStyle.value : void 0)
|
|
533
|
-
},
|
|
534
|
-
[
|
|
535
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
536
|
-
createTextVNode(
|
|
537
|
-
toDisplayString(_ctx.label),
|
|
538
|
-
1
|
|
539
|
-
)
|
|
540
|
-
])
|
|
541
|
-
],
|
|
542
|
-
6
|
|
543
|
-
)) : createCommentVNode("v-if", true)
|
|
544
|
-
],
|
|
545
|
-
2
|
|
546
|
-
);
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
|
|
551
|
-
|
|
552
|
-
const checkboxGroupProps = buildProps({
|
|
553
|
-
modelValue: {
|
|
554
|
-
type: definePropType(Array),
|
|
555
|
-
default: () => []
|
|
556
|
-
},
|
|
557
|
-
disabled: {
|
|
558
|
-
type: Boolean,
|
|
559
|
-
default: void 0
|
|
560
|
-
},
|
|
561
|
-
min: Number,
|
|
562
|
-
max: Number,
|
|
563
|
-
size: useSizeProp,
|
|
564
|
-
fill: String,
|
|
565
|
-
textColor: String,
|
|
566
|
-
tag: {
|
|
567
|
-
type: String,
|
|
568
|
-
default: "div"
|
|
569
|
-
},
|
|
570
|
-
validateEvent: {
|
|
571
|
-
type: Boolean,
|
|
572
|
-
default: true
|
|
573
|
-
},
|
|
574
|
-
options: {
|
|
575
|
-
type: definePropType(Array)
|
|
576
|
-
},
|
|
577
|
-
props: {
|
|
578
|
-
type: definePropType(Object),
|
|
579
|
-
default: () => checkboxDefaultProps
|
|
580
|
-
},
|
|
581
|
-
type: {
|
|
582
|
-
type: String,
|
|
583
|
-
values: ["checkbox", "button"],
|
|
584
|
-
default: "checkbox"
|
|
585
|
-
},
|
|
586
|
-
...useAriaProps(["ariaLabel"])
|
|
587
|
-
});
|
|
588
|
-
const checkboxGroupEmits = {
|
|
589
|
-
[UPDATE_MODEL_EVENT]: (val) => isArray(val),
|
|
590
|
-
change: (val) => isArray(val)
|
|
591
|
-
};
|
|
592
|
-
const checkboxDefaultProps = {
|
|
593
|
-
label: "label",
|
|
594
|
-
value: "value",
|
|
595
|
-
disabled: "disabled"
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
const _sfc_main = defineComponent({
|
|
599
|
-
...{
|
|
600
|
-
name: "ElCheckboxGroup"
|
|
601
|
-
},
|
|
602
|
-
__name: "checkbox-group",
|
|
603
|
-
props: checkboxGroupProps,
|
|
604
|
-
emits: checkboxGroupEmits,
|
|
605
|
-
setup(__props, { emit: __emit }) {
|
|
606
|
-
const props = __props;
|
|
607
|
-
const emit = __emit;
|
|
608
|
-
const ns = useNamespace("checkbox");
|
|
609
|
-
const checkboxDisabled = useFormDisabled();
|
|
610
|
-
const { formItem } = useFormItem();
|
|
611
|
-
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
612
|
-
formItemContext: formItem
|
|
613
|
-
});
|
|
614
|
-
const changeEvent = async (value) => {
|
|
615
|
-
emit(UPDATE_MODEL_EVENT, value);
|
|
616
|
-
await nextTick();
|
|
617
|
-
emit(CHANGE_EVENT, value);
|
|
618
|
-
};
|
|
619
|
-
const modelValue = computed({
|
|
620
|
-
get() {
|
|
621
|
-
return props.modelValue;
|
|
622
|
-
},
|
|
623
|
-
set(val) {
|
|
624
|
-
changeEvent(val);
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
const aliasProps = computed(() => ({
|
|
628
|
-
...checkboxDefaultProps,
|
|
629
|
-
...props.props
|
|
630
|
-
}));
|
|
631
|
-
const getOptionProps = (option) => {
|
|
632
|
-
const { label, value, disabled } = aliasProps.value;
|
|
633
|
-
const base = {
|
|
634
|
-
label: option[label],
|
|
635
|
-
value: option[value],
|
|
636
|
-
disabled: option[disabled]
|
|
637
|
-
};
|
|
638
|
-
return { ...omit(option, [label, value, disabled]), ...base };
|
|
639
|
-
};
|
|
640
|
-
const optionComponent = computed(
|
|
641
|
-
() => props.type === "button" ? CheckboxButton : Checkbox
|
|
642
|
-
);
|
|
643
|
-
provide(checkboxGroupContextKey, {
|
|
644
|
-
...pick(toRefs(props), [
|
|
645
|
-
"size",
|
|
646
|
-
"min",
|
|
647
|
-
"max",
|
|
648
|
-
"validateEvent",
|
|
649
|
-
"fill",
|
|
650
|
-
"textColor"
|
|
651
|
-
]),
|
|
652
|
-
disabled: checkboxDisabled,
|
|
653
|
-
modelValue,
|
|
654
|
-
changeEvent
|
|
655
|
-
});
|
|
656
|
-
watch(
|
|
657
|
-
() => props.modelValue,
|
|
658
|
-
(newVal, oldValue) => {
|
|
659
|
-
if (props.validateEvent && !isEqual(newVal, oldValue)) {
|
|
660
|
-
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
);
|
|
664
|
-
return (_ctx, _cache) => {
|
|
665
|
-
var _a;
|
|
666
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
667
|
-
id: unref(groupId),
|
|
668
|
-
class: normalizeClass(unref(ns).b("group")),
|
|
669
|
-
role: "group",
|
|
670
|
-
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
|
|
671
|
-
"aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
|
|
672
|
-
}, {
|
|
673
|
-
default: withCtx(() => [
|
|
674
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
675
|
-
(openBlock(true), createElementBlock(
|
|
676
|
-
Fragment,
|
|
677
|
-
null,
|
|
678
|
-
renderList(_ctx.options, (item, index) => {
|
|
679
|
-
return openBlock(), createBlock(
|
|
680
|
-
resolveDynamicComponent(optionComponent.value),
|
|
681
|
-
mergeProps({ key: index }, { ref_for: true }, getOptionProps(item)),
|
|
682
|
-
null,
|
|
683
|
-
16
|
|
684
|
-
);
|
|
685
|
-
}),
|
|
686
|
-
128
|
|
687
|
-
))
|
|
688
|
-
])
|
|
689
|
-
]),
|
|
690
|
-
_: 3
|
|
691
|
-
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
});
|
|
695
|
-
var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
|
|
696
|
-
|
|
697
|
-
const ElCheckbox = withInstall(Checkbox, {
|
|
698
|
-
CheckboxButton,
|
|
699
|
-
CheckboxGroup
|
|
700
|
-
});
|
|
701
|
-
withNoopInstall(CheckboxButton);
|
|
702
|
-
const ElCheckboxGroup = withNoopInstall(CheckboxGroup);
|
|
703
|
-
|
|
704
|
-
export { ElCheckboxGroup as E, ElCheckbox as a };
|