@wfrog/vc-ui 1.1.0 → 1.2.0
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 +3 -3
- package/dist/es/chunk/{OEa4tYPF.mjs → -ga82G_B.mjs} +1 -1
- package/dist/es/chunk/B1BnPYNG.mjs +163 -0
- package/dist/es/chunk/{DFOLES4O.mjs → BA2yoAwy.mjs} +403 -502
- package/dist/es/chunk/{BpqBBo4z.mjs → BDyXj_90.mjs} +2 -2
- package/dist/es/chunk/{BI0vrXwX.mjs → BI-fNJhk.mjs} +6 -3
- package/dist/es/chunk/{BsGCX4td.mjs → BK4T_2ha.mjs} +1 -1
- package/dist/es/chunk/{73YgKz3H.mjs → BLLKi_0v.mjs} +1 -1
- package/dist/es/chunk/{DTLPXrjb.mjs → BTsEMnf_.mjs} +1 -1
- package/dist/es/chunk/{B5UQmWXg.mjs → BUf50Y7Y.mjs} +41 -21
- package/dist/es/chunk/{BzedaLtg.mjs → BYVaz5Or.mjs} +2 -2
- package/dist/es/chunk/BaJ7k5Lg.mjs +209 -0
- package/dist/es/chunk/{Bp9jXKX0.mjs → BambM7zX.mjs} +2 -2
- package/dist/es/chunk/{CizMbf5K.mjs → Bl0WQiki.mjs} +1 -1
- package/dist/es/chunk/{CLbj8G-F.mjs → Bnot0Gwc.mjs} +12 -4
- package/dist/es/chunk/{4eyJqDa9.mjs → BoGGHTrJ.mjs} +4 -2
- package/dist/es/chunk/C7Dgjpd1.mjs +242 -0
- package/dist/es/chunk/{D0LB3gF-.mjs → CKbkzlkO.mjs} +104 -72
- package/dist/es/chunk/{DrgvuOYH.mjs → CL5WTCB3.mjs} +4 -2
- package/dist/es/chunk/{XwSiBVsA.mjs → CM_I1FoA.mjs} +2 -2
- package/dist/es/chunk/{DouIsSPi.mjs → CNILa-hz.mjs} +1 -1
- package/dist/es/chunk/{DRoyW749.mjs → CcKUdl3e.mjs} +12 -6
- package/dist/es/chunk/CidLkmft.mjs +188 -0
- package/dist/es/chunk/{HAog8AWU.mjs → CitH0taR.mjs} +816 -539
- package/dist/es/chunk/{Cu6erWl4.mjs → CzqeSQn4.mjs} +73 -38
- package/dist/es/chunk/{CLCfXfvv.mjs → D7JQbDFE.mjs} +154 -118
- package/dist/es/chunk/{DaCDeO95.mjs → D9iEroQw.mjs} +1 -207
- package/dist/es/chunk/{cPBw23yt.mjs → DEPZhJ0Z.mjs} +21 -16
- package/dist/es/chunk/{CPERtDRX.mjs → DHpbQMGk.mjs} +32 -22
- package/dist/es/chunk/{BHsNc7jl.mjs → DKpRXDRE.mjs} +82 -55
- package/dist/es/chunk/{CLMc8GzD.mjs → DMYHOxhk.mjs} +462 -311
- package/dist/es/chunk/{CBSopeeE.mjs → DQHGjqG5.mjs} +9 -4
- package/dist/es/chunk/DTEM_vYZ.mjs +23 -0
- package/dist/es/chunk/{NQBKROII.mjs → DWcIzeMM.mjs} +1 -1
- package/dist/es/chunk/{FHvLvzEB.mjs → DX38FfmL.mjs} +1088 -697
- package/dist/es/chunk/{DZD-YnCt.mjs → Dcm-lOj8.mjs} +4 -4
- package/dist/es/chunk/{09Ec85_u.mjs → DdmNdV7I.mjs} +398 -278
- package/dist/es/chunk/{f0-vIQGp.mjs → DfHTA5LW.mjs} +3 -3
- package/dist/es/chunk/DgFT6snA.mjs +835 -0
- package/dist/es/chunk/{DwKWIlzw.mjs → DgSzI6Fw.mjs} +106 -71
- package/dist/es/chunk/{BcTuAX8r.mjs → Dsye5ZEp.mjs} +5 -3
- package/dist/es/chunk/{BsLJxiSC.mjs → Dw-yyl2m.mjs} +1 -1
- package/dist/es/chunk/{DXPWe_a5.mjs → U13Qpiki.mjs} +19 -13
- package/dist/es/chunk/{axpwSky6.mjs → _8u_XVHh.mjs} +168 -120
- package/dist/es/chunk/egk9EEzo.mjs +66 -0
- package/dist/es/chunk/{BUEEWLrd.mjs → ezK_XQQd.mjs} +15 -6
- package/dist/es/chunk/{Bl2KlMdP.mjs → oW98L-44.mjs} +8 -3
- package/dist/es/chunk/{Dk6Bx0KT.mjs → plK2vnjp.mjs} +8 -5
- package/dist/es/components/awesome-icon/awesome-icon.mjs +2 -1
- package/dist/es/components/backbottom/backbottom.mjs +2 -2
- package/dist/es/components/button/button.mjs +105 -76
- package/dist/es/components/choice/choice.mjs +2 -2
- package/dist/es/components/config-provider/config-provider.d.ts +1 -0
- package/dist/es/components/config-provider/config-provider.mjs +13 -5
- package/dist/es/components/cropper/cropper.mjs +44 -33
- package/dist/es/components/currency/currency.mjs +5 -5
- package/dist/es/components/daterange-picker/daterange-picker.mjs +2267 -1522
- package/dist/es/components/dialog/dialog.mjs +213 -172
- package/dist/es/components/dialog/index.css +1 -1
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +11 -11
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +5 -4
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +495 -314
- package/dist/es/components/dialog-upload-images/index.css +1 -1
- package/dist/es/components/drag-verify/drag-verify.mjs +3 -3
- package/dist/es/components/drawer/drawer.mjs +136 -94
- package/dist/es/components/drawer/index.css +1 -1
- package/dist/es/components/easy-pagination/easy-pagination.mjs +2 -2
- package/dist/es/components/el-icon/el-icon.mjs +1 -1
- package/dist/es/components/el-icon/index.css +3 -2
- package/dist/es/components/flag/flag.mjs +2 -1
- package/dist/es/components/icon/icon.mjs +10 -31
- package/dist/es/components/icon/icon.vue.d.ts +1 -1
- package/dist/es/components/icon/icon2.mjs +1 -1
- package/dist/es/components/icon/index.mjs +2 -2
- package/dist/es/components/icon-picker/components/collections.vue.d.ts +625 -0
- package/dist/es/components/icon-picker/components/panel.vue.d.ts +9 -0
- package/dist/es/components/icon-picker/icon-picker.d.ts +40 -0
- package/dist/es/components/icon-picker/icon-picker.mjs +1375 -0
- package/dist/es/components/icon-picker/icon-picker.vue.d.ts +9 -0
- package/dist/es/components/icon-picker/index.css +121 -0
- package/dist/es/components/icon-picker/index.d.ts +4 -0
- package/dist/es/components/icon-picker/index.mjs +6 -0
- package/dist/es/components/iconify-icon/iconify-icon.d.ts +5 -0
- package/dist/es/components/iconify-icon/iconify-icon.mjs +1860 -0
- package/dist/es/components/iconify-icon/iconify-icon.vue.d.ts +6 -0
- package/dist/es/components/iconify-icon/index.css +11 -0
- package/dist/es/components/iconify-icon/index.d.ts +4 -0
- package/dist/es/components/iconify-icon/index.mjs +6 -0
- package/dist/es/components/image/image.mjs +5 -5
- package/dist/es/components/input/input.mjs +4 -4
- package/dist/es/components/input/input.vue.d.ts +63 -54
- package/dist/es/components/input-number/input-number.mjs +5 -5
- package/dist/es/components/pca-picker/components/c.vue.d.ts +4 -4
- package/dist/es/components/pca-picker/index.css +1 -1
- package/dist/es/components/pca-picker/pca-picker.mjs +154 -160
- package/dist/es/components/pca-picker/pca-picker.vue.d.ts +12 -11
- package/dist/es/components/qr-code/qr-code.mjs +2 -1
- package/dist/es/components/screenfull/screenfull.mjs +6 -5
- package/dist/es/components/scrollbar/index.css +18 -0
- package/dist/es/components/scrollbar/index.d.ts +4 -0
- package/dist/es/components/scrollbar/index.mjs +6 -0
- package/dist/es/components/scrollbar/scrollbar.d.ts +4 -0
- package/dist/es/components/scrollbar/scrollbar.mjs +65 -0
- package/dist/es/components/scrollbar/scrollbar.vue.d.ts +588 -0
- package/dist/es/components/select/select.mjs +7 -7
- package/dist/es/components/single-player/index.css +1 -1
- package/dist/es/components/single-player/single-player.mjs +265 -166
- package/dist/es/components/svg-icon/index.css +3 -2
- package/dist/es/components/svg-icon/svg-icon.mjs +3 -3
- package/dist/es/components/switch/switch.mjs +2 -2
- package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +2 -2
- package/dist/es/components/tags/tags.mjs +9 -9
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +4 -4
- package/dist/es/components/thousand-input/thousand-input.mjs +5 -4
- package/dist/es/components/thousand-input/thousand-input.vue.d.ts +126 -108
- package/dist/es/components/tinymce/index.css +1 -1
- package/dist/es/components/tinymce/tinymce.mjs +9 -8
- package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +179 -141
- package/dist/es/components/tree-picker/popover-cascader.css +1 -1
- package/dist/es/components/tree-picker/tree-picker.mjs +10 -10
- package/dist/es/components/tree-picker/tree-picker.vue.d.ts +12 -11
- package/dist/es/components/upload-file/upload-file.mjs +3 -3
- package/dist/es/index.d.ts +3 -0
- package/dist/es/index.mjs +41 -31
- package/dist/global.d.ts +3 -0
- package/dist/index.css +166 -22
- package/package.json +8 -2
- package/dist/es/chunk/BtTIs3tG.mjs +0 -138
- package/dist/es/chunk/C7wQNvSS.mjs +0 -728
- package/dist/es/chunk/Cbhe4I9Z.mjs +0 -16
- package/dist/es/chunk/DihosKp1.mjs +0 -140
- package/dist/es/components/icon/index.css +0 -9
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { defineComponent, inject, createVNode, Comment, computed, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, createBlock, withModifiers, withCtx, createElementVNode, Fragment, getCurrentInstance, ref, renderList, createTextVNode, toDisplayString, renderSlot, useSlots, provide, reactive, watch, onBeforeUpdate, onMounted, nextTick, useAttrs, withDirectives,
|
|
1
|
+
import { defineComponent, inject, createVNode, Comment, computed, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, createBlock, withModifiers, withCtx, createElementVNode, Fragment, getCurrentInstance, ref, renderList, createTextVNode, toDisplayString, renderSlot, useSlots, provide, reactive, watch, onBeforeUpdate, onMounted, nextTick, useAttrs, withDirectives, vShow, normalizeStyle, createSlots, resolveDynamicComponent, withKeys, vModelText, Transition, mergeProps, toHandlers, onUpdated, h, onBeforeUnmount, resolveComponent, useTemplateRef, isRef } from 'vue';
|
|
2
2
|
import { isClient, useDebounceFn, useResizeObserver, useCssVar, useEventListener, useVModel } from '@vueuse/core';
|
|
3
|
-
import { E as ElInput } from './
|
|
4
|
-
import { g as unique, c as castArray, u as useTooltipContentProps, E as Ee, a as ElTooltip } from './
|
|
5
|
-
import { E as ElScrollbar } from './
|
|
6
|
-
import { t as tagProps, E as ElTag } from './
|
|
7
|
-
import { E as ElIcon } from './
|
|
3
|
+
import { E as ElInput } from './DgFT6snA.mjs';
|
|
4
|
+
import { g as unique, c as castArray, u as useTooltipContentProps, E as Ee, a as ElTooltip } from './DMYHOxhk.mjs';
|
|
5
|
+
import { E as ElScrollbar } from './_8u_XVHh.mjs';
|
|
6
|
+
import { t as tagProps, E as ElTag } from './B1BnPYNG.mjs';
|
|
7
|
+
import { E as ElIcon } from './DEPZhJ0Z.mjs';
|
|
8
8
|
import { Check, Loading, ArrowRight, CircleClose, ArrowDown, CaretRight } from '@element-plus/icons-vue';
|
|
9
|
-
import { u as useNamespace, i as isArray, a as isEmpty, j as isFunction, g as isUndefined, v as isPropAbsent, c as buildProps, N as NOOP, d as definePropType, q as isBoolean, e as debugWarn, y as isPromise, z as hasOwn, k as isNil, h as isString, p as isObject } from './
|
|
10
|
-
import { u as useSizeProp, c as componentSizes } from './
|
|
9
|
+
import { u as useNamespace, i as isArray, a as isEmpty, j as isFunction, g as isUndefined, v as isPropAbsent, c as buildProps, N as NOOP, d as definePropType, q as isBoolean, e as debugWarn, y as isPromise, z as hasOwn, k as isNil, h as isString, p as isObject } from './CcKUdl3e.mjs';
|
|
10
|
+
import { u as useSizeProp, c as componentSizes } from './BK4T_2ha.mjs';
|
|
11
11
|
import { i as iconPropType } from '../components/icon/icon2.mjs';
|
|
12
|
-
import { u as useEmptyValuesProps, a as useEmptyValues } from './
|
|
12
|
+
import { u as useEmptyValuesProps, a as useEmptyValues } from './Dsye5ZEp.mjs';
|
|
13
13
|
import { C as CHANGE_EVENT, U as UPDATE_MODEL_EVENT } from './Ct6q2FXg.mjs';
|
|
14
|
-
import { _ as _export_sfc, w as withInstall } from './
|
|
15
|
-
import { C as ClickOutside } from './
|
|
16
|
-
import { u as useLocale } from './
|
|
17
|
-
import { u as useFormItem, b as useFormDisabled, c as useFormSize } from './
|
|
18
|
-
import { a as useComposition, u as useFocusController } from './
|
|
14
|
+
import { _ as _export_sfc, w as withInstall } from './BTsEMnf_.mjs';
|
|
15
|
+
import { C as ClickOutside } from './CL5WTCB3.mjs';
|
|
16
|
+
import { u as useLocale } from './plK2vnjp.mjs';
|
|
17
|
+
import { u as useFormItem, b as useFormDisabled, c as useFormSize } from './U13Qpiki.mjs';
|
|
18
|
+
import { a as useComposition, u as useFocusController } from './CM_I1FoA.mjs';
|
|
19
19
|
import { g as getEventCode, E as EVENT_CODE } from './BTpNRPQW.mjs';
|
|
20
20
|
import { b as isLeaf, c as focusNode, g as getSibling } from './CsLIbnzG.mjs';
|
|
21
|
-
import { c as cloneDeep } from './
|
|
22
|
-
import { b as ElCheckbox, c as ElRadio } from './
|
|
23
|
-
import { r as removeClass, b as addClass } from './
|
|
24
|
-
import { u as useId, f as formItemContextKey } from './
|
|
25
|
-
import { i as isEqual } from './
|
|
26
|
-
import { s as scrollIntoView } from './
|
|
27
|
-
import { b as baseFlatten } from './
|
|
21
|
+
import { c as cloneDeep } from './CNILa-hz.mjs';
|
|
22
|
+
import { b as ElCheckbox, c as ElRadio } from './BA2yoAwy.mjs';
|
|
23
|
+
import { r as removeClass, b as addClass } from './Bl0WQiki.mjs';
|
|
24
|
+
import { u as useId, f as formItemContextKey } from './DQHGjqG5.mjs';
|
|
25
|
+
import { i as isEqual } from './Dw-yyl2m.mjs';
|
|
26
|
+
import { s as scrollIntoView } from './oW98L-44.mjs';
|
|
27
|
+
import { b as baseFlatten } from './BDyXj_90.mjs';
|
|
28
28
|
import { _ as _export_sfc$1 } from './pcqpp-6-.mjs';
|
|
29
29
|
|
|
30
30
|
/** Used as references for various `Number` constants. */
|
|
@@ -89,11 +89,12 @@ var NodeContent$1 = defineComponent({
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
const _hoisted_1$2 = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
|
|
93
|
+
const _sfc_main$9 = defineComponent({
|
|
94
|
+
...{
|
|
95
|
+
name: "ElCascaderNode"
|
|
96
|
+
},
|
|
97
|
+
__name: "node",
|
|
97
98
|
props: {
|
|
98
99
|
node: {
|
|
99
100
|
type: Object,
|
|
@@ -102,8 +103,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
102
103
|
menuId: String
|
|
103
104
|
},
|
|
104
105
|
emits: ["expand"],
|
|
105
|
-
setup(__props, { emit }) {
|
|
106
|
+
setup(__props, { emit: __emit }) {
|
|
106
107
|
const props = __props;
|
|
108
|
+
const emit = __emit;
|
|
107
109
|
const panel = inject(CASCADER_PANEL_INJECTION_KEY);
|
|
108
110
|
const ns = useNamespace("cascader-node");
|
|
109
111
|
const isHoverMenu = computed(() => panel.isHoverMenu);
|
|
@@ -116,9 +118,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
116
118
|
});
|
|
117
119
|
const isDisabled = computed(() => props.node.isDisabled);
|
|
118
120
|
const isLeaf = computed(() => props.node.isLeaf);
|
|
119
|
-
const expandable = computed(
|
|
121
|
+
const expandable = computed(
|
|
122
|
+
() => checkStrictly.value && !isLeaf.value || !isDisabled.value
|
|
123
|
+
);
|
|
120
124
|
const inExpandingPath = computed(() => isInPath(panel.expandingNode));
|
|
121
|
-
const inCheckedPath = computed(
|
|
125
|
+
const inCheckedPath = computed(
|
|
126
|
+
() => checkStrictly.value && panel.checkedNodes.some(isInPath)
|
|
127
|
+
);
|
|
122
128
|
const isInPath = (node) => {
|
|
123
129
|
var _a;
|
|
124
130
|
const { level, uid } = props.node;
|
|
@@ -184,46 +190,51 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
184
190
|
return openBlock(), createElementBlock("li", {
|
|
185
191
|
id: `${__props.menuId}-${__props.node.uid}`,
|
|
186
192
|
role: "menuitem",
|
|
187
|
-
"aria-haspopup": !
|
|
188
|
-
"aria-owns":
|
|
189
|
-
"aria-expanded":
|
|
190
|
-
tabindex:
|
|
193
|
+
"aria-haspopup": !isLeaf.value,
|
|
194
|
+
"aria-owns": isLeaf.value ? void 0 : __props.menuId,
|
|
195
|
+
"aria-expanded": inExpandingPath.value,
|
|
196
|
+
tabindex: expandable.value ? -1 : void 0,
|
|
191
197
|
class: normalizeClass([
|
|
192
198
|
unref(ns).b(),
|
|
193
|
-
unref(ns).is("selectable",
|
|
199
|
+
unref(ns).is("selectable", checkStrictly.value),
|
|
194
200
|
unref(ns).is("active", __props.node.checked),
|
|
195
|
-
unref(ns).is("disabled", !
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
unref(ns).is("disabled", !expandable.value),
|
|
202
|
+
inExpandingPath.value && "in-active-path",
|
|
203
|
+
inCheckedPath.value && "in-checked-path"
|
|
198
204
|
]),
|
|
199
205
|
onMouseenter: handleHoverExpand,
|
|
200
206
|
onFocus: handleHoverExpand,
|
|
201
207
|
onClick: handleClick
|
|
202
208
|
}, [
|
|
203
209
|
createCommentVNode(" prefix "),
|
|
204
|
-
|
|
210
|
+
multiple.value && showPrefix.value ? (openBlock(), createBlock(unref(ElCheckbox), {
|
|
205
211
|
key: 0,
|
|
206
212
|
"model-value": __props.node.checked,
|
|
207
213
|
indeterminate: __props.node.indeterminate,
|
|
208
|
-
disabled:
|
|
209
|
-
onClick: withModifiers(() => {
|
|
210
|
-
}, ["stop"]),
|
|
214
|
+
disabled: isDisabled.value,
|
|
215
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
216
|
+
}, ["stop"])),
|
|
211
217
|
"onUpdate:modelValue": handleSelectCheck
|
|
212
|
-
}, null, 8, ["model-value", "indeterminate", "disabled"
|
|
218
|
+
}, null, 8, ["model-value", "indeterminate", "disabled"])) : checkStrictly.value && showPrefix.value ? (openBlock(), createBlock(unref(ElRadio), {
|
|
213
219
|
key: 1,
|
|
214
|
-
"model-value":
|
|
220
|
+
"model-value": checkedNodeId.value,
|
|
215
221
|
label: __props.node.uid,
|
|
216
|
-
disabled:
|
|
222
|
+
disabled: isDisabled.value,
|
|
217
223
|
"onUpdate:modelValue": handleSelectCheck,
|
|
218
|
-
onClick: withModifiers(() => {
|
|
219
|
-
}, ["stop"])
|
|
224
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
225
|
+
}, ["stop"]))
|
|
220
226
|
}, {
|
|
221
227
|
default: withCtx(() => [
|
|
222
228
|
createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
|
|
223
|
-
createElementVNode(
|
|
229
|
+
_cache[2] || (_cache[2] = createElementVNode(
|
|
230
|
+
"span",
|
|
231
|
+
null,
|
|
232
|
+
null,
|
|
233
|
+
-1
|
|
234
|
+
))
|
|
224
235
|
]),
|
|
225
236
|
_: 1
|
|
226
|
-
}, 8, ["model-value", "label", "disabled"
|
|
237
|
+
}, 8, ["model-value", "label", "disabled"])) : isLeaf.value && __props.node.checked ? (openBlock(), createBlock(unref(ElIcon), {
|
|
227
238
|
key: 2,
|
|
228
239
|
class: normalizeClass(unref(ns).e("prefix"))
|
|
229
240
|
}, {
|
|
@@ -235,36 +246,41 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
235
246
|
createCommentVNode(" content "),
|
|
236
247
|
createVNode(unref(NodeContent$1), { node: __props.node }, null, 8, ["node"]),
|
|
237
248
|
createCommentVNode(" postfix "),
|
|
238
|
-
!
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
!isLeaf.value ? (openBlock(), createElementBlock(
|
|
250
|
+
Fragment,
|
|
251
|
+
{ key: 3 },
|
|
252
|
+
[
|
|
253
|
+
__props.node.loading ? (openBlock(), createBlock(unref(ElIcon), {
|
|
254
|
+
key: 0,
|
|
255
|
+
class: normalizeClass([unref(ns).is("loading"), unref(ns).e("postfix")])
|
|
256
|
+
}, {
|
|
257
|
+
default: withCtx(() => [
|
|
258
|
+
createVNode(unref(Loading))
|
|
259
|
+
]),
|
|
260
|
+
_: 1
|
|
261
|
+
}, 8, ["class"])) : (openBlock(), createBlock(unref(ElIcon), {
|
|
262
|
+
key: 1,
|
|
263
|
+
class: normalizeClass(["arrow-right", unref(ns).e("postfix")])
|
|
264
|
+
}, {
|
|
265
|
+
default: withCtx(() => [
|
|
266
|
+
createVNode(unref(ArrowRight))
|
|
267
|
+
]),
|
|
268
|
+
_: 1
|
|
269
|
+
}, 8, ["class"]))
|
|
270
|
+
],
|
|
271
|
+
64
|
|
272
|
+
)) : createCommentVNode("v-if", true)
|
|
273
|
+
], 42, _hoisted_1$2);
|
|
258
274
|
};
|
|
259
275
|
}
|
|
260
276
|
});
|
|
261
|
-
var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "node.vue"]]);
|
|
277
|
+
var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
|
|
262
278
|
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
279
|
+
const _sfc_main$8 = defineComponent({
|
|
280
|
+
...{
|
|
281
|
+
name: "ElCascaderMenu"
|
|
282
|
+
},
|
|
283
|
+
__name: "menu",
|
|
268
284
|
props: {
|
|
269
285
|
nodes: {
|
|
270
286
|
type: Array,
|
|
@@ -326,55 +342,87 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
326
342
|
};
|
|
327
343
|
return (_ctx, _cache) => {
|
|
328
344
|
return openBlock(), createBlock(unref(ElScrollbar), {
|
|
329
|
-
key:
|
|
345
|
+
key: menuId.value,
|
|
330
346
|
tag: "ul",
|
|
331
347
|
role: "menu",
|
|
332
348
|
class: normalizeClass(unref(ns).b()),
|
|
333
349
|
"wrap-class": unref(ns).e("wrap"),
|
|
334
|
-
"view-class": [unref(ns).e("list"), unref(ns).is("empty",
|
|
350
|
+
"view-class": [unref(ns).e("list"), unref(ns).is("empty", isEmpty.value)],
|
|
335
351
|
onMousemove: handleMouseMove,
|
|
336
352
|
onMouseleave: clearHoverZone
|
|
337
353
|
}, {
|
|
338
354
|
default: withCtx(() => {
|
|
339
355
|
var _a;
|
|
340
356
|
return [
|
|
341
|
-
(openBlock(true), createElementBlock(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
357
|
+
(openBlock(true), createElementBlock(
|
|
358
|
+
Fragment,
|
|
359
|
+
null,
|
|
360
|
+
renderList(__props.nodes, (node) => {
|
|
361
|
+
return openBlock(), createBlock(ElCascaderNode, {
|
|
362
|
+
key: node.uid,
|
|
363
|
+
node,
|
|
364
|
+
"menu-id": menuId.value,
|
|
365
|
+
onExpand: handleExpand
|
|
366
|
+
}, null, 8, ["node", "menu-id"]);
|
|
367
|
+
}),
|
|
368
|
+
128
|
|
369
|
+
)),
|
|
370
|
+
isLoading.value ? (openBlock(), createElementBlock(
|
|
371
|
+
"div",
|
|
372
|
+
{
|
|
373
|
+
key: 0,
|
|
374
|
+
class: normalizeClass(unref(ns).e("empty-text"))
|
|
375
|
+
},
|
|
376
|
+
[
|
|
377
|
+
createVNode(unref(ElIcon), {
|
|
378
|
+
size: "14",
|
|
379
|
+
class: normalizeClass(unref(ns).is("loading"))
|
|
380
|
+
}, {
|
|
381
|
+
default: withCtx(() => [
|
|
382
|
+
createVNode(unref(Loading))
|
|
383
|
+
]),
|
|
384
|
+
_: 1
|
|
385
|
+
}, 8, ["class"]),
|
|
386
|
+
createTextVNode(
|
|
387
|
+
" " + toDisplayString(unref(t)("el.cascader.loading")),
|
|
388
|
+
1
|
|
389
|
+
)
|
|
390
|
+
],
|
|
391
|
+
2
|
|
392
|
+
)) : isEmpty.value ? (openBlock(), createElementBlock(
|
|
393
|
+
"div",
|
|
394
|
+
{
|
|
395
|
+
key: 1,
|
|
396
|
+
class: normalizeClass(unref(ns).e("empty-text"))
|
|
397
|
+
},
|
|
398
|
+
[
|
|
399
|
+
renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
400
|
+
createTextVNode(
|
|
401
|
+
toDisplayString(unref(t)("el.cascader.noData")),
|
|
402
|
+
1
|
|
403
|
+
)
|
|
404
|
+
])
|
|
405
|
+
],
|
|
406
|
+
2
|
|
407
|
+
)) : ((_a = unref(panel)) == null ? void 0 : _a.isHoverMenu) ? (openBlock(), createElementBlock(
|
|
408
|
+
Fragment,
|
|
409
|
+
{ key: 2 },
|
|
410
|
+
[
|
|
411
|
+
createCommentVNode(" eslint-disable vue/html-self-closing "),
|
|
412
|
+
(openBlock(), createElementBlock(
|
|
413
|
+
"svg",
|
|
414
|
+
{
|
|
415
|
+
ref_key: "hoverZone",
|
|
416
|
+
ref: hoverZone,
|
|
417
|
+
class: normalizeClass(unref(ns).e("hover-zone"))
|
|
418
|
+
},
|
|
419
|
+
null,
|
|
420
|
+
2
|
|
421
|
+
))
|
|
422
|
+
],
|
|
423
|
+
2112
|
|
424
|
+
)) : createCommentVNode("v-if", true),
|
|
425
|
+
createCommentVNode(" eslint-enable vue/html-self-closing ")
|
|
378
426
|
];
|
|
379
427
|
}),
|
|
380
428
|
_: 3
|
|
@@ -382,7 +430,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
382
430
|
};
|
|
383
431
|
}
|
|
384
432
|
});
|
|
385
|
-
var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "menu.vue"]]);
|
|
433
|
+
var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
|
|
386
434
|
|
|
387
435
|
let uid = 0;
|
|
388
436
|
const calculatePathNodes = (node) => {
|
|
@@ -414,7 +462,9 @@ let Node$1 = class Node {
|
|
|
414
462
|
this.pathValues = pathNodes.map((node) => node.value);
|
|
415
463
|
this.pathLabels = pathNodes.map((node) => node.label);
|
|
416
464
|
this.childrenData = childrenData;
|
|
417
|
-
this.children = (childrenData || []).map(
|
|
465
|
+
this.children = (childrenData || []).map(
|
|
466
|
+
(child) => new Node(child, config, this)
|
|
467
|
+
);
|
|
418
468
|
this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
|
|
419
469
|
this.text = "";
|
|
420
470
|
}
|
|
@@ -514,7 +564,9 @@ const flatNodes = (nodes, leafOnly) => {
|
|
|
514
564
|
class Store {
|
|
515
565
|
constructor(data, config) {
|
|
516
566
|
this.config = config;
|
|
517
|
-
const nodes = (data || []).map(
|
|
567
|
+
const nodes = (data || []).map(
|
|
568
|
+
(nodeData) => new Node$1(nodeData, this.config)
|
|
569
|
+
);
|
|
518
570
|
this.nodes = nodes;
|
|
519
571
|
this.allNodes = flatNodes(nodes, false);
|
|
520
572
|
this.leafNodes = flatNodes(nodes, true);
|
|
@@ -550,13 +602,17 @@ class Store {
|
|
|
550
602
|
getNodeByValue(value, leafOnly = false) {
|
|
551
603
|
if (isPropAbsent(value))
|
|
552
604
|
return null;
|
|
553
|
-
const node = this.getFlattedNodes(leafOnly).find(
|
|
605
|
+
const node = this.getFlattedNodes(leafOnly).find(
|
|
606
|
+
(node2) => isEqual(node2.value, value) || isEqual(node2.pathValues, value)
|
|
607
|
+
);
|
|
554
608
|
return node || null;
|
|
555
609
|
}
|
|
556
610
|
getSameNode(node) {
|
|
557
611
|
if (!node)
|
|
558
612
|
return null;
|
|
559
|
-
const node_ = this.getFlattedNodes(false).find(
|
|
613
|
+
const node_ = this.getFlattedNodes(false).find(
|
|
614
|
+
({ value, level }) => isEqual(node.value, value) && node.level === level
|
|
615
|
+
);
|
|
560
616
|
return node_ || null;
|
|
561
617
|
}
|
|
562
618
|
}
|
|
@@ -647,15 +703,16 @@ const sortByOriginalOrder = (oldNodes, newNodes) => {
|
|
|
647
703
|
return res;
|
|
648
704
|
};
|
|
649
705
|
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
706
|
+
const _sfc_main$7 = defineComponent({
|
|
707
|
+
...{
|
|
708
|
+
name: "ElCascaderPanel"
|
|
709
|
+
},
|
|
710
|
+
__name: "index",
|
|
655
711
|
props: cascaderPanelProps,
|
|
656
712
|
emits: cascaderPanelEmits,
|
|
657
|
-
setup(__props, { expose, emit }) {
|
|
713
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
658
714
|
const props = __props;
|
|
715
|
+
const emit = __emit;
|
|
659
716
|
let manualChecked = false;
|
|
660
717
|
const ns = useNamespace("cascader");
|
|
661
718
|
const config = useCascaderConfig(props);
|
|
@@ -778,7 +835,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
778
835
|
if (!initialLoaded.value || manualChecked || !forced && isEqual(modelValue, checkedValue.value))
|
|
779
836
|
return;
|
|
780
837
|
if (lazy && !loaded) {
|
|
781
|
-
const values = unique(
|
|
838
|
+
const values = unique(
|
|
839
|
+
flattenDeep(castArray(modelValue))
|
|
840
|
+
);
|
|
782
841
|
const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
|
|
783
842
|
if (nodes.length) {
|
|
784
843
|
nodes.forEach((node) => {
|
|
@@ -789,7 +848,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
789
848
|
}
|
|
790
849
|
} else {
|
|
791
850
|
const values = multiple ? castArray(modelValue) : [modelValue];
|
|
792
|
-
const nodes = unique(
|
|
851
|
+
const nodes = unique(
|
|
852
|
+
values.map(
|
|
853
|
+
(val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)
|
|
854
|
+
)
|
|
855
|
+
);
|
|
793
856
|
syncMenuState(nodes, forced);
|
|
794
857
|
checkedValue.value = cloneDeep(modelValue != null ? modelValue : void 0);
|
|
795
858
|
}
|
|
@@ -797,7 +860,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
797
860
|
const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
|
|
798
861
|
const { checkStrictly } = config.value;
|
|
799
862
|
const oldNodes = checkedNodes.value;
|
|
800
|
-
const newNodes = newCheckedNodes.filter(
|
|
863
|
+
const newNodes = newCheckedNodes.filter(
|
|
864
|
+
(node) => !!node && (checkStrictly || node.isLeaf)
|
|
865
|
+
);
|
|
801
866
|
const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
|
|
802
867
|
const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
|
|
803
868
|
if (newExpandingNode) {
|
|
@@ -816,8 +881,18 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
816
881
|
menuList.value.forEach((menu) => {
|
|
817
882
|
const menuElement = menu == null ? void 0 : menu.$el;
|
|
818
883
|
if (menuElement) {
|
|
819
|
-
const container = menuElement.querySelector(
|
|
820
|
-
|
|
884
|
+
const container = menuElement.querySelector(
|
|
885
|
+
`.${ns.namespace.value}-scrollbar__wrap`
|
|
886
|
+
);
|
|
887
|
+
let activeNode = menuElement.querySelector(
|
|
888
|
+
`.${ns.b("node")}.in-active-path`
|
|
889
|
+
);
|
|
890
|
+
if (!activeNode) {
|
|
891
|
+
const activeElements = menuElement.querySelectorAll(
|
|
892
|
+
`.${ns.b("node")}.${ns.is("active")}`
|
|
893
|
+
);
|
|
894
|
+
activeNode = activeElements[activeElements.length - 1];
|
|
895
|
+
}
|
|
821
896
|
scrollIntoView(container, activeNode);
|
|
822
897
|
}
|
|
823
898
|
});
|
|
@@ -830,20 +905,30 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
830
905
|
case EVENT_CODE.down: {
|
|
831
906
|
e.preventDefault();
|
|
832
907
|
const distance = code === EVENT_CODE.up ? -1 : 1;
|
|
833
|
-
focusNode(
|
|
908
|
+
focusNode(
|
|
909
|
+
getSibling(
|
|
910
|
+
target,
|
|
911
|
+
distance,
|
|
912
|
+
`.${ns.b("node")}[tabindex="-1"]`
|
|
913
|
+
)
|
|
914
|
+
);
|
|
834
915
|
break;
|
|
835
916
|
}
|
|
836
917
|
case EVENT_CODE.left: {
|
|
837
918
|
e.preventDefault();
|
|
838
919
|
const preMenu = menuList.value[getMenuIndex(target) - 1];
|
|
839
|
-
const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(
|
|
920
|
+
const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(
|
|
921
|
+
`.${ns.b("node")}[aria-expanded="true"]`
|
|
922
|
+
);
|
|
840
923
|
focusNode(expandedNode);
|
|
841
924
|
break;
|
|
842
925
|
}
|
|
843
926
|
case EVENT_CODE.right: {
|
|
844
927
|
e.preventDefault();
|
|
845
928
|
const nextMenu = menuList.value[getMenuIndex(target) + 1];
|
|
846
|
-
const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(
|
|
929
|
+
const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(
|
|
930
|
+
`.${ns.b("node")}[tabindex="-1"]`
|
|
931
|
+
);
|
|
847
932
|
focusNode(firstNode);
|
|
848
933
|
break;
|
|
849
934
|
}
|
|
@@ -853,39 +938,53 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
853
938
|
break;
|
|
854
939
|
}
|
|
855
940
|
};
|
|
856
|
-
provide(
|
|
941
|
+
provide(
|
|
942
|
+
CASCADER_PANEL_INJECTION_KEY,
|
|
943
|
+
reactive({
|
|
944
|
+
config,
|
|
945
|
+
expandingNode,
|
|
946
|
+
checkedNodes,
|
|
947
|
+
isHoverMenu,
|
|
948
|
+
initialLoaded,
|
|
949
|
+
renderLabelFn,
|
|
950
|
+
lazyLoad,
|
|
951
|
+
expandNode,
|
|
952
|
+
handleCheckChange
|
|
953
|
+
})
|
|
954
|
+
);
|
|
955
|
+
watch(
|
|
857
956
|
config,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
watch(config, (newVal, oldVal) => {
|
|
868
|
-
if (isEqual(newVal, oldVal))
|
|
869
|
-
return;
|
|
870
|
-
initStore();
|
|
871
|
-
}, {
|
|
872
|
-
immediate: true
|
|
873
|
-
});
|
|
957
|
+
(newVal, oldVal) => {
|
|
958
|
+
if (isEqual(newVal, oldVal))
|
|
959
|
+
return;
|
|
960
|
+
initStore();
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
immediate: true
|
|
964
|
+
}
|
|
965
|
+
);
|
|
874
966
|
watch(() => props.options, initStore, {
|
|
875
967
|
deep: true
|
|
876
968
|
});
|
|
877
|
-
watch(
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
emit(UPDATE_MODEL_EVENT, val);
|
|
886
|
-
emit(CHANGE_EVENT, val);
|
|
969
|
+
watch(
|
|
970
|
+
() => props.modelValue,
|
|
971
|
+
() => {
|
|
972
|
+
manualChecked = false;
|
|
973
|
+
syncCheckedValue();
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
deep: true
|
|
887
977
|
}
|
|
888
|
-
|
|
978
|
+
);
|
|
979
|
+
watch(
|
|
980
|
+
() => checkedValue.value,
|
|
981
|
+
(val) => {
|
|
982
|
+
if (!isEqual(val, props.modelValue)) {
|
|
983
|
+
emit(UPDATE_MODEL_EVENT, val);
|
|
984
|
+
emit(CHANGE_EVENT, val);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
);
|
|
889
988
|
const loadLazyRootNodes = () => {
|
|
890
989
|
if (initialLoadedOnce.value)
|
|
891
990
|
return;
|
|
@@ -893,7 +992,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
893
992
|
};
|
|
894
993
|
onBeforeUpdate(() => menuList.value = []);
|
|
895
994
|
onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
|
|
896
|
-
|
|
995
|
+
__expose({
|
|
897
996
|
menuList,
|
|
898
997
|
menus,
|
|
899
998
|
checkedNodes,
|
|
@@ -907,29 +1006,39 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
907
1006
|
loadLazyRootNodes
|
|
908
1007
|
});
|
|
909
1008
|
return (_ctx, _cache) => {
|
|
910
|
-
return openBlock(), createElementBlock(
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
1009
|
+
return openBlock(), createElementBlock(
|
|
1010
|
+
"div",
|
|
1011
|
+
{
|
|
1012
|
+
class: normalizeClass([unref(ns).b("panel"), unref(ns).is("bordered", _ctx.border)]),
|
|
1013
|
+
onKeydown: handleKeyDown
|
|
1014
|
+
},
|
|
1015
|
+
[
|
|
1016
|
+
(openBlock(true), createElementBlock(
|
|
1017
|
+
Fragment,
|
|
1018
|
+
null,
|
|
1019
|
+
renderList(menus.value, (menu, index) => {
|
|
1020
|
+
return openBlock(), createBlock(ElCascaderMenu, {
|
|
1021
|
+
key: index,
|
|
1022
|
+
ref_for: true,
|
|
1023
|
+
ref: (item) => menuList.value[index] = item,
|
|
1024
|
+
index,
|
|
1025
|
+
nodes: [...menu]
|
|
1026
|
+
}, {
|
|
1027
|
+
empty: withCtx(() => [
|
|
1028
|
+
renderSlot(_ctx.$slots, "empty")
|
|
1029
|
+
]),
|
|
1030
|
+
_: 3
|
|
1031
|
+
}, 8, ["index", "nodes"]);
|
|
1032
|
+
}),
|
|
1033
|
+
128
|
|
1034
|
+
))
|
|
1035
|
+
],
|
|
1036
|
+
34
|
|
1037
|
+
);
|
|
929
1038
|
};
|
|
930
1039
|
}
|
|
931
1040
|
});
|
|
932
|
-
var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "index.vue"]]);
|
|
1041
|
+
var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
|
|
933
1042
|
|
|
934
1043
|
const ElCascaderPanel = withInstall(CascaderPanel);
|
|
935
1044
|
|
|
@@ -948,7 +1057,9 @@ const cascaderProps = buildProps({
|
|
|
948
1057
|
},
|
|
949
1058
|
filterable: Boolean,
|
|
950
1059
|
filterMethod: {
|
|
951
|
-
type: definePropType(
|
|
1060
|
+
type: definePropType(
|
|
1061
|
+
Function
|
|
1062
|
+
),
|
|
952
1063
|
default: (node, keyword) => node.text.includes(keyword)
|
|
953
1064
|
},
|
|
954
1065
|
separator: {
|
|
@@ -1026,15 +1137,16 @@ const cascaderEmits = {
|
|
|
1026
1137
|
removeTag: (val) => !!val
|
|
1027
1138
|
};
|
|
1028
1139
|
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1140
|
+
const _hoisted_1$1 = ["placeholder"];
|
|
1141
|
+
const _hoisted_2$1 = ["onClick"];
|
|
1142
|
+
const _sfc_main$6 = defineComponent({
|
|
1143
|
+
...{
|
|
1144
|
+
name: "ElCascader"
|
|
1145
|
+
},
|
|
1146
|
+
__name: "cascader",
|
|
1034
1147
|
props: cascaderProps,
|
|
1035
1148
|
emits: cascaderEmits,
|
|
1036
|
-
setup(__props, { expose, emit }) {
|
|
1037
|
-
const props = __props;
|
|
1149
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1038
1150
|
const popperOptions = {
|
|
1039
1151
|
modifiers: [
|
|
1040
1152
|
{
|
|
@@ -1053,11 +1165,19 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1053
1165
|
}
|
|
1054
1166
|
]
|
|
1055
1167
|
};
|
|
1168
|
+
const props = __props;
|
|
1169
|
+
const emit = __emit;
|
|
1056
1170
|
const attrs = useAttrs();
|
|
1171
|
+
const slots = useSlots();
|
|
1057
1172
|
let inputInitialHeight = 0;
|
|
1058
1173
|
let pressDeleteCount = 0;
|
|
1059
1174
|
const nsCascader = useNamespace("cascader");
|
|
1060
1175
|
const nsInput = useNamespace("input");
|
|
1176
|
+
const sizeMapPadding = {
|
|
1177
|
+
small: 7,
|
|
1178
|
+
default: 11,
|
|
1179
|
+
large: 15
|
|
1180
|
+
};
|
|
1061
1181
|
const { t } = useLocale();
|
|
1062
1182
|
const { formItem } = useFormItem();
|
|
1063
1183
|
const isDisabled = useFormDisabled();
|
|
@@ -1097,20 +1217,30 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1097
1217
|
const cascaderStyle = computed(() => {
|
|
1098
1218
|
return attrs.style;
|
|
1099
1219
|
});
|
|
1100
|
-
const inputPlaceholder = computed(
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1220
|
+
const inputPlaceholder = computed(
|
|
1221
|
+
() => {
|
|
1222
|
+
var _a;
|
|
1223
|
+
return (_a = props.placeholder) != null ? _a : t("el.cascader.placeholder");
|
|
1224
|
+
}
|
|
1225
|
+
);
|
|
1226
|
+
const currentPlaceholder = computed(
|
|
1227
|
+
() => searchInputValue.value || tags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value
|
|
1228
|
+
);
|
|
1105
1229
|
const realSize = useFormSize();
|
|
1106
|
-
const tagSize = computed(
|
|
1230
|
+
const tagSize = computed(
|
|
1231
|
+
() => realSize.value === "small" ? "small" : "default"
|
|
1232
|
+
);
|
|
1107
1233
|
const multiple = computed(() => !!props.props.multiple);
|
|
1108
1234
|
const readonly = computed(() => !props.filterable || multiple.value);
|
|
1109
|
-
const searchKeyword = computed(
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1235
|
+
const searchKeyword = computed(
|
|
1236
|
+
() => multiple.value ? searchInputValue.value : inputValue.value
|
|
1237
|
+
);
|
|
1238
|
+
const checkedNodes = computed(
|
|
1239
|
+
() => {
|
|
1240
|
+
var _a;
|
|
1241
|
+
return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
|
|
1242
|
+
}
|
|
1243
|
+
);
|
|
1114
1244
|
const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
|
|
1115
1245
|
disabled: isDisabled,
|
|
1116
1246
|
beforeBlur(event) {
|
|
@@ -1176,7 +1306,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1176
1306
|
togglePopperVisible(false);
|
|
1177
1307
|
};
|
|
1178
1308
|
const togglePopperVisible = (visible) => {
|
|
1179
|
-
var _a, _b
|
|
1309
|
+
var _a, _b;
|
|
1180
1310
|
if (isDisabled.value)
|
|
1181
1311
|
return;
|
|
1182
1312
|
visible = visible != null ? visible : !popperVisible.value;
|
|
@@ -1185,7 +1315,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1185
1315
|
(_b = (_a = inputRef.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
|
|
1186
1316
|
if (visible) {
|
|
1187
1317
|
updatePopperPosition();
|
|
1188
|
-
|
|
1318
|
+
cascaderPanelRef.value && nextTick(cascaderPanelRef.value.scrollToExpandingNode);
|
|
1189
1319
|
} else if (props.filterable) {
|
|
1190
1320
|
syncPresentTextValue();
|
|
1191
1321
|
}
|
|
@@ -1225,7 +1355,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1225
1355
|
case "parent": {
|
|
1226
1356
|
const clickedNodes = getCheckedNodes(false);
|
|
1227
1357
|
const clickedNodesValue = clickedNodes.map((o) => o.value);
|
|
1228
|
-
const parentNodes = clickedNodes.filter(
|
|
1358
|
+
const parentNodes = clickedNodes.filter(
|
|
1359
|
+
(o) => !o.parent || !clickedNodesValue.includes(o.parent.value)
|
|
1360
|
+
);
|
|
1229
1361
|
return parentNodes;
|
|
1230
1362
|
}
|
|
1231
1363
|
default:
|
|
@@ -1262,9 +1394,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1262
1394
|
var _a;
|
|
1263
1395
|
let firstNode;
|
|
1264
1396
|
if (filtering.value && suggestionPanel.value) {
|
|
1265
|
-
firstNode = suggestionPanel.value.$el.querySelector(
|
|
1397
|
+
firstNode = suggestionPanel.value.$el.querySelector(
|
|
1398
|
+
`.${nsCascader.e("suggestion-item")}`
|
|
1399
|
+
);
|
|
1266
1400
|
} else {
|
|
1267
|
-
firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(
|
|
1401
|
+
firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(
|
|
1402
|
+
`.${nsCascader.b("node")}[tabindex="-1"]`
|
|
1403
|
+
);
|
|
1268
1404
|
}
|
|
1269
1405
|
if (firstNode) {
|
|
1270
1406
|
firstNode.focus();
|
|
@@ -1272,20 +1408,37 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1272
1408
|
}
|
|
1273
1409
|
};
|
|
1274
1410
|
const updateStyle = () => {
|
|
1275
|
-
var _a, _b;
|
|
1411
|
+
var _a, _b, _c;
|
|
1276
1412
|
const inputInner = (_a = inputRef.value) == null ? void 0 : _a.input;
|
|
1277
1413
|
const tagWrapperEl = tagWrapper.value;
|
|
1278
1414
|
const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
|
|
1279
1415
|
if (!isClient || !inputInner)
|
|
1280
1416
|
return;
|
|
1281
1417
|
if (suggestionPanelEl) {
|
|
1282
|
-
const suggestionList = suggestionPanelEl.querySelector(
|
|
1418
|
+
const suggestionList = suggestionPanelEl.querySelector(
|
|
1419
|
+
`.${nsCascader.e("suggestion-list")}`
|
|
1420
|
+
);
|
|
1283
1421
|
suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
|
|
1284
1422
|
}
|
|
1285
1423
|
if (tagWrapperEl) {
|
|
1286
1424
|
const { offsetHeight } = tagWrapperEl;
|
|
1287
1425
|
const height = tags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
|
|
1288
1426
|
inputInner.style.height = height;
|
|
1427
|
+
if (slots.prefix) {
|
|
1428
|
+
const prefix = (_c = inputRef.value) == null ? void 0 : _c.$el.querySelector(
|
|
1429
|
+
`.${nsInput.e("prefix")}`
|
|
1430
|
+
);
|
|
1431
|
+
let left = 0;
|
|
1432
|
+
if (prefix) {
|
|
1433
|
+
left = prefix.offsetWidth;
|
|
1434
|
+
if (left > 0) {
|
|
1435
|
+
left += sizeMapPadding[realSize.value || "default"];
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
tagWrapperEl.style.left = `${left}px`;
|
|
1439
|
+
} else {
|
|
1440
|
+
tagWrapperEl.style.left = `0`;
|
|
1441
|
+
}
|
|
1289
1442
|
updatePopperPosition();
|
|
1290
1443
|
}
|
|
1291
1444
|
};
|
|
@@ -1355,7 +1508,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1355
1508
|
case EVENT_CODE.down: {
|
|
1356
1509
|
e.preventDefault();
|
|
1357
1510
|
const distance = code === EVENT_CODE.up ? -1 : 1;
|
|
1358
|
-
focusNode(
|
|
1511
|
+
focusNode(
|
|
1512
|
+
getSibling(
|
|
1513
|
+
target,
|
|
1514
|
+
distance,
|
|
1515
|
+
`.${nsCascader.e("suggestion-item")}[tabindex="-1"]`
|
|
1516
|
+
)
|
|
1517
|
+
);
|
|
1359
1518
|
break;
|
|
1360
1519
|
}
|
|
1361
1520
|
case EVENT_CODE.enter:
|
|
@@ -1396,7 +1555,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1396
1555
|
return;
|
|
1397
1556
|
val ? handleFilter() : hideSuggestionPanel();
|
|
1398
1557
|
};
|
|
1399
|
-
const getInputInnerHeight = (inputInner) => Number.parseFloat(
|
|
1558
|
+
const getInputInnerHeight = (inputInner) => Number.parseFloat(
|
|
1559
|
+
useCssVar(nsInput.cssVarName("input-height"), inputInner).value
|
|
1560
|
+
) - 2;
|
|
1400
1561
|
const focus = () => {
|
|
1401
1562
|
var _a;
|
|
1402
1563
|
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
@@ -1406,12 +1567,15 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1406
1567
|
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
1407
1568
|
};
|
|
1408
1569
|
watch(filtering, updatePopperPosition);
|
|
1409
|
-
watch(
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1570
|
+
watch(
|
|
1571
|
+
[
|
|
1572
|
+
checkedNodes,
|
|
1573
|
+
isDisabled,
|
|
1574
|
+
() => props.collapseTags,
|
|
1575
|
+
() => props.maxCollapseTags
|
|
1576
|
+
],
|
|
1577
|
+
calculatePresentTags
|
|
1578
|
+
);
|
|
1415
1579
|
watch(tags, () => {
|
|
1416
1580
|
nextTick(() => updateStyle());
|
|
1417
1581
|
});
|
|
@@ -1422,19 +1586,22 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1422
1586
|
updateStyle();
|
|
1423
1587
|
});
|
|
1424
1588
|
watch(presentText, syncPresentTextValue, { immediate: true });
|
|
1425
|
-
watch(
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1589
|
+
watch(
|
|
1590
|
+
() => popperVisible.value,
|
|
1591
|
+
(val) => {
|
|
1592
|
+
var _a;
|
|
1593
|
+
if (val && props.props.lazy && props.props.lazyLoad) {
|
|
1594
|
+
(_a = cascaderPanelRef.value) == null ? void 0 : _a.loadLazyRootNodes();
|
|
1595
|
+
}
|
|
1429
1596
|
}
|
|
1430
|
-
|
|
1597
|
+
);
|
|
1431
1598
|
onMounted(() => {
|
|
1432
1599
|
const inputInner = inputRef.value.input;
|
|
1433
1600
|
const inputInnerHeight = getInputInnerHeight(inputInner);
|
|
1434
1601
|
inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
|
|
1435
1602
|
useResizeObserver(inputInner, updateStyle);
|
|
1436
1603
|
});
|
|
1437
|
-
|
|
1604
|
+
__expose({
|
|
1438
1605
|
getCheckedNodes,
|
|
1439
1606
|
cascaderPanelRef,
|
|
1440
1607
|
togglePopperVisible,
|
|
@@ -1463,204 +1630,255 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1463
1630
|
onHide: hideSuggestionPanel
|
|
1464
1631
|
}, {
|
|
1465
1632
|
default: withCtx(() => [
|
|
1466
|
-
withDirectives((openBlock(), createElementBlock(
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
(
|
|
1501
|
-
]),
|
|
1502
|
-
_: 1
|
|
1503
|
-
}, 8, ["class", "onClick"])) : (openBlock(), createBlock(unref(ElIcon), {
|
|
1504
|
-
key: "arrow-down",
|
|
1505
|
-
class: normalizeClass(unref(cascaderIconKls)),
|
|
1506
|
-
onClick: withModifiers(($event) => togglePopperVisible(), ["stop"])
|
|
1507
|
-
}, {
|
|
1508
|
-
default: withCtx(() => [
|
|
1509
|
-
createVNode(unref(ArrowDown))
|
|
1510
|
-
]),
|
|
1511
|
-
_: 1
|
|
1512
|
-
}, 8, ["class", "onClick"]))
|
|
1513
|
-
]),
|
|
1514
|
-
_: 2
|
|
1515
|
-
}, [
|
|
1516
|
-
_ctx.$slots.prefix ? {
|
|
1517
|
-
name: "prefix",
|
|
1518
|
-
fn: withCtx(() => [
|
|
1519
|
-
renderSlot(_ctx.$slots, "prefix")
|
|
1520
|
-
])
|
|
1521
|
-
} : void 0
|
|
1522
|
-
]), 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
|
|
1523
|
-
unref(multiple) ? (openBlock(), createElementBlock("div", {
|
|
1524
|
-
key: 0,
|
|
1525
|
-
ref_key: "tagWrapper",
|
|
1526
|
-
ref: tagWrapper,
|
|
1527
|
-
class: normalizeClass([
|
|
1528
|
-
unref(nsCascader).e("tags"),
|
|
1529
|
-
unref(nsCascader).is("validate", Boolean(unref(validateState)))
|
|
1530
|
-
])
|
|
1531
|
-
}, [
|
|
1532
|
-
renderSlot(_ctx.$slots, "tag", {
|
|
1533
|
-
data: tags.value,
|
|
1534
|
-
deleteTag
|
|
1535
|
-
}, () => [
|
|
1536
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(showTagList), (tag) => {
|
|
1537
|
-
return openBlock(), createBlock(unref(ElTag), {
|
|
1538
|
-
key: tag.key,
|
|
1539
|
-
type: _ctx.tagType,
|
|
1540
|
-
size: unref(tagSize),
|
|
1541
|
-
effect: _ctx.tagEffect,
|
|
1542
|
-
hit: tag.hitState,
|
|
1543
|
-
closable: tag.closable,
|
|
1544
|
-
"disable-transitions": "",
|
|
1545
|
-
onClose: ($event) => deleteTag(tag)
|
|
1633
|
+
withDirectives((openBlock(), createElementBlock(
|
|
1634
|
+
"div",
|
|
1635
|
+
{
|
|
1636
|
+
ref_key: "wrapperRef",
|
|
1637
|
+
ref: wrapperRef,
|
|
1638
|
+
class: normalizeClass(cascaderKls.value),
|
|
1639
|
+
style: normalizeStyle(cascaderStyle.value),
|
|
1640
|
+
onClick: _cache[8] || (_cache[8] = () => togglePopperVisible(readonly.value ? void 0 : true)),
|
|
1641
|
+
onKeydown: handleKeyDown,
|
|
1642
|
+
onMouseenter: _cache[9] || (_cache[9] = ($event) => inputHover.value = true),
|
|
1643
|
+
onMouseleave: _cache[10] || (_cache[10] = ($event) => inputHover.value = false)
|
|
1644
|
+
},
|
|
1645
|
+
[
|
|
1646
|
+
createVNode(unref(ElInput), {
|
|
1647
|
+
ref_key: "inputRef",
|
|
1648
|
+
ref: inputRef,
|
|
1649
|
+
modelValue: inputValue.value,
|
|
1650
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
|
|
1651
|
+
placeholder: currentPlaceholder.value,
|
|
1652
|
+
readonly: readonly.value,
|
|
1653
|
+
disabled: unref(isDisabled),
|
|
1654
|
+
"validate-event": false,
|
|
1655
|
+
size: unref(realSize),
|
|
1656
|
+
class: normalizeClass(inputClass.value),
|
|
1657
|
+
tabindex: multiple.value && _ctx.filterable && !unref(isDisabled) ? -1 : void 0,
|
|
1658
|
+
onCompositionstart: unref(handleComposition),
|
|
1659
|
+
onCompositionupdate: unref(handleComposition),
|
|
1660
|
+
onCompositionend: unref(handleComposition),
|
|
1661
|
+
onInput: handleInput
|
|
1662
|
+
}, createSlots({
|
|
1663
|
+
suffix: withCtx(() => [
|
|
1664
|
+
clearBtnVisible.value ? (openBlock(), createBlock(unref(ElIcon), {
|
|
1665
|
+
key: "clear",
|
|
1666
|
+
class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
|
|
1667
|
+
onClick: withModifiers(handleClear, ["stop"])
|
|
1546
1668
|
}, {
|
|
1547
1669
|
default: withCtx(() => [
|
|
1548
|
-
|
|
1670
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
|
|
1549
1671
|
]),
|
|
1550
|
-
_:
|
|
1551
|
-
},
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
key: 0,
|
|
1556
|
-
ref_key: "tagTooltipRef",
|
|
1557
|
-
ref: tagTooltipRef,
|
|
1558
|
-
disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
|
|
1559
|
-
"fallback-placements": ["bottom", "top", "right", "left"],
|
|
1560
|
-
placement: "bottom",
|
|
1561
|
-
"popper-class": _ctx.popperClass,
|
|
1562
|
-
"popper-style": _ctx.popperStyle,
|
|
1563
|
-
effect: _ctx.effect,
|
|
1564
|
-
persistent: _ctx.persistent
|
|
1565
|
-
}, {
|
|
1566
|
-
default: withCtx(() => [
|
|
1567
|
-
createVNode(unref(ElTag), {
|
|
1568
|
-
closable: false,
|
|
1569
|
-
size: unref(tagSize),
|
|
1570
|
-
type: _ctx.tagType,
|
|
1571
|
-
effect: _ctx.tagEffect,
|
|
1572
|
-
"disable-transitions": ""
|
|
1672
|
+
_: 1
|
|
1673
|
+
}, 8, ["class"])) : (openBlock(), createBlock(unref(ElIcon), {
|
|
1674
|
+
key: "arrow-down",
|
|
1675
|
+
class: normalizeClass(cascaderIconKls.value),
|
|
1676
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => togglePopperVisible(), ["stop"]))
|
|
1573
1677
|
}, {
|
|
1574
1678
|
default: withCtx(() => [
|
|
1575
|
-
|
|
1576
|
-
class: normalizeClass(unref(nsCascader).e("tags-text"))
|
|
1577
|
-
}, " + " + toDisplayString(tags.value.length - _ctx.maxCollapseTags), 3)
|
|
1679
|
+
createVNode(unref(ArrowDown))
|
|
1578
1680
|
]),
|
|
1579
1681
|
_: 1
|
|
1580
|
-
}, 8, ["
|
|
1682
|
+
}, 8, ["class"]))
|
|
1581
1683
|
]),
|
|
1582
|
-
|
|
1583
|
-
|
|
1684
|
+
_: 2
|
|
1685
|
+
}, [
|
|
1686
|
+
_ctx.$slots.prefix ? {
|
|
1687
|
+
name: "prefix",
|
|
1688
|
+
fn: withCtx(() => [
|
|
1689
|
+
renderSlot(_ctx.$slots, "prefix")
|
|
1690
|
+
]),
|
|
1691
|
+
key: "0"
|
|
1692
|
+
} : void 0
|
|
1693
|
+
]), 1032, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
|
|
1694
|
+
multiple.value ? (openBlock(), createElementBlock(
|
|
1695
|
+
"div",
|
|
1696
|
+
{
|
|
1697
|
+
key: 0,
|
|
1698
|
+
ref_key: "tagWrapper",
|
|
1699
|
+
ref: tagWrapper,
|
|
1700
|
+
class: normalizeClass([
|
|
1701
|
+
unref(nsCascader).e("tags"),
|
|
1702
|
+
unref(nsCascader).is("validate", Boolean(validateState.value))
|
|
1703
|
+
])
|
|
1704
|
+
},
|
|
1705
|
+
[
|
|
1706
|
+
renderSlot(_ctx.$slots, "tag", {
|
|
1707
|
+
data: tags.value,
|
|
1708
|
+
deleteTag
|
|
1709
|
+
}, () => [
|
|
1710
|
+
(openBlock(true), createElementBlock(
|
|
1711
|
+
Fragment,
|
|
1712
|
+
null,
|
|
1713
|
+
renderList(showTagList.value, (tag) => {
|
|
1714
|
+
return openBlock(), createBlock(unref(ElTag), {
|
|
1715
|
+
key: tag.key,
|
|
1716
|
+
type: _ctx.tagType,
|
|
1717
|
+
size: tagSize.value,
|
|
1718
|
+
effect: _ctx.tagEffect,
|
|
1719
|
+
hit: tag.hitState,
|
|
1720
|
+
closable: tag.closable,
|
|
1721
|
+
"disable-transitions": "",
|
|
1722
|
+
onClose: ($event) => deleteTag(tag)
|
|
1723
|
+
}, {
|
|
1724
|
+
default: withCtx(() => [
|
|
1725
|
+
createElementVNode(
|
|
1726
|
+
"span",
|
|
1727
|
+
null,
|
|
1728
|
+
toDisplayString(tag.text),
|
|
1729
|
+
1
|
|
1730
|
+
)
|
|
1731
|
+
]),
|
|
1732
|
+
_: 2
|
|
1733
|
+
}, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
|
|
1734
|
+
}),
|
|
1735
|
+
128
|
|
1736
|
+
))
|
|
1737
|
+
]),
|
|
1738
|
+
_ctx.collapseTags && tags.value.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(unref(ElTooltip), {
|
|
1739
|
+
key: 0,
|
|
1740
|
+
ref_key: "tagTooltipRef",
|
|
1741
|
+
ref: tagTooltipRef,
|
|
1742
|
+
disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
|
|
1743
|
+
"fallback-placements": ["bottom", "top", "right", "left"],
|
|
1744
|
+
placement: "bottom",
|
|
1745
|
+
"popper-class": _ctx.popperClass,
|
|
1746
|
+
"popper-style": _ctx.popperStyle,
|
|
1747
|
+
effect: _ctx.effect,
|
|
1748
|
+
persistent: _ctx.persistent
|
|
1749
|
+
}, {
|
|
1584
1750
|
default: withCtx(() => [
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1751
|
+
createVNode(unref(ElTag), {
|
|
1752
|
+
closable: false,
|
|
1753
|
+
size: tagSize.value,
|
|
1754
|
+
type: _ctx.tagType,
|
|
1755
|
+
effect: _ctx.tagEffect,
|
|
1756
|
+
"disable-transitions": ""
|
|
1757
|
+
}, {
|
|
1758
|
+
default: withCtx(() => [
|
|
1759
|
+
createElementVNode(
|
|
1760
|
+
"span",
|
|
1761
|
+
{
|
|
1762
|
+
class: normalizeClass(unref(nsCascader).e("tags-text"))
|
|
1763
|
+
},
|
|
1764
|
+
" + " + toDisplayString(tags.value.length - _ctx.maxCollapseTags),
|
|
1765
|
+
3
|
|
1766
|
+
)
|
|
1767
|
+
]),
|
|
1768
|
+
_: 1
|
|
1769
|
+
}, 8, ["size", "type", "effect"])
|
|
1770
|
+
]),
|
|
1771
|
+
content: withCtx(() => [
|
|
1772
|
+
createVNode(unref(ElScrollbar), { "max-height": _ctx.maxCollapseTagsTooltipHeight }, {
|
|
1773
|
+
default: withCtx(() => [
|
|
1774
|
+
createElementVNode(
|
|
1775
|
+
"div",
|
|
1776
|
+
{
|
|
1777
|
+
class: normalizeClass(unref(nsCascader).e("collapse-tags"))
|
|
1778
|
+
},
|
|
1779
|
+
[
|
|
1780
|
+
(openBlock(true), createElementBlock(
|
|
1781
|
+
Fragment,
|
|
1782
|
+
null,
|
|
1783
|
+
renderList(collapseTagList.value, (tag, idx) => {
|
|
1784
|
+
return openBlock(), createElementBlock(
|
|
1785
|
+
"div",
|
|
1786
|
+
{
|
|
1787
|
+
key: idx,
|
|
1788
|
+
class: normalizeClass(unref(nsCascader).e("collapse-tag"))
|
|
1789
|
+
},
|
|
1790
|
+
[
|
|
1791
|
+
(openBlock(), createBlock(unref(ElTag), {
|
|
1792
|
+
key: tag.key,
|
|
1793
|
+
class: "in-tooltip",
|
|
1794
|
+
type: _ctx.tagType,
|
|
1795
|
+
size: tagSize.value,
|
|
1796
|
+
effect: _ctx.tagEffect,
|
|
1797
|
+
hit: tag.hitState,
|
|
1798
|
+
closable: tag.closable,
|
|
1799
|
+
"disable-transitions": "",
|
|
1800
|
+
onClose: ($event) => deleteTag(tag)
|
|
1801
|
+
}, {
|
|
1802
|
+
default: withCtx(() => [
|
|
1803
|
+
createElementVNode(
|
|
1804
|
+
"span",
|
|
1805
|
+
null,
|
|
1806
|
+
toDisplayString(tag.text),
|
|
1807
|
+
1
|
|
1808
|
+
)
|
|
1809
|
+
]),
|
|
1810
|
+
_: 2
|
|
1811
|
+
}, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
|
|
1812
|
+
],
|
|
1813
|
+
2
|
|
1814
|
+
);
|
|
1815
|
+
}),
|
|
1816
|
+
128
|
|
1817
|
+
))
|
|
1818
|
+
],
|
|
1819
|
+
2
|
|
1820
|
+
)
|
|
1821
|
+
]),
|
|
1822
|
+
_: 1
|
|
1823
|
+
}, 8, ["max-height"])
|
|
1612
1824
|
]),
|
|
1613
1825
|
_: 1
|
|
1614
|
-
}, 8, ["
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
],
|
|
1634
|
-
|
|
1635
|
-
|
|
1826
|
+
}, 8, ["disabled", "popper-class", "popper-style", "effect", "persistent"])) : createCommentVNode("v-if", true),
|
|
1827
|
+
_ctx.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
1828
|
+
key: 1,
|
|
1829
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event),
|
|
1830
|
+
type: "text",
|
|
1831
|
+
class: normalizeClass(unref(nsCascader).e("search-input")),
|
|
1832
|
+
placeholder: presentText.value ? "" : inputPlaceholder.value,
|
|
1833
|
+
onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)),
|
|
1834
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(($event) => togglePopperVisible(true), ["stop"])),
|
|
1835
|
+
onKeydown: withKeys(handleDelete, ["delete"]),
|
|
1836
|
+
onCompositionstart: _cache[5] || (_cache[5] = (...args) => unref(handleComposition) && unref(handleComposition)(...args)),
|
|
1837
|
+
onCompositionupdate: _cache[6] || (_cache[6] = (...args) => unref(handleComposition) && unref(handleComposition)(...args)),
|
|
1838
|
+
onCompositionend: _cache[7] || (_cache[7] = (...args) => unref(handleComposition) && unref(handleComposition)(...args))
|
|
1839
|
+
}, null, 42, _hoisted_1$1)), [
|
|
1840
|
+
[vModelText, searchInputValue.value]
|
|
1841
|
+
]) : createCommentVNode("v-if", true)
|
|
1842
|
+
],
|
|
1843
|
+
2
|
|
1844
|
+
)) : createCommentVNode("v-if", true)
|
|
1845
|
+
],
|
|
1846
|
+
38
|
|
1847
|
+
)), [
|
|
1848
|
+
[unref(ClickOutside), handleClickOutside, contentRef.value]
|
|
1636
1849
|
])
|
|
1637
1850
|
]),
|
|
1638
1851
|
content: withCtx(() => [
|
|
1639
|
-
_ctx.$slots.header ? (openBlock(), createElementBlock(
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1852
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock(
|
|
1853
|
+
"div",
|
|
1854
|
+
{
|
|
1855
|
+
key: 0,
|
|
1856
|
+
class: normalizeClass(unref(nsCascader).e("header")),
|
|
1857
|
+
onClick: _cache[11] || (_cache[11] = withModifiers(() => {
|
|
1858
|
+
}, ["stop"]))
|
|
1859
|
+
},
|
|
1860
|
+
[
|
|
1861
|
+
renderSlot(_ctx.$slots, "header")
|
|
1862
|
+
],
|
|
1863
|
+
2
|
|
1864
|
+
)) : createCommentVNode("v-if", true),
|
|
1647
1865
|
withDirectives(createVNode(unref(ElCascaderPanel), {
|
|
1648
1866
|
ref_key: "cascaderPanelRef",
|
|
1649
1867
|
ref: cascaderPanelRef,
|
|
1650
|
-
modelValue:
|
|
1651
|
-
"onUpdate:modelValue": ($event) =>
|
|
1868
|
+
modelValue: checkedValue.value,
|
|
1869
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => checkedValue.value = $event),
|
|
1652
1870
|
options: _ctx.options,
|
|
1653
1871
|
props: props.props,
|
|
1654
1872
|
border: false,
|
|
1655
1873
|
"render-label": _ctx.$slots.default,
|
|
1656
1874
|
onExpandChange: handleExpandChange,
|
|
1657
|
-
onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
|
|
1875
|
+
onClose: _cache[13] || (_cache[13] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false)))
|
|
1658
1876
|
}, {
|
|
1659
1877
|
empty: withCtx(() => [
|
|
1660
1878
|
renderSlot(_ctx.$slots, "empty")
|
|
1661
1879
|
]),
|
|
1662
1880
|
_: 3
|
|
1663
|
-
}, 8, ["modelValue", "
|
|
1881
|
+
}, 8, ["modelValue", "options", "props", "render-label"]), [
|
|
1664
1882
|
[vShow, !filtering.value]
|
|
1665
1883
|
]),
|
|
1666
1884
|
_ctx.filterable ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
|
|
@@ -1673,59 +1891,79 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1673
1891
|
onKeydown: handleSuggestionKeyDown
|
|
1674
1892
|
}, {
|
|
1675
1893
|
default: withCtx(() => [
|
|
1676
|
-
suggestions.value.length ? (openBlock(true), createElementBlock(
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1894
|
+
suggestions.value.length ? (openBlock(true), createElementBlock(
|
|
1895
|
+
Fragment,
|
|
1896
|
+
{ key: 0 },
|
|
1897
|
+
renderList(suggestions.value, (item) => {
|
|
1898
|
+
return openBlock(), createElementBlock("li", {
|
|
1899
|
+
key: item.uid,
|
|
1900
|
+
class: normalizeClass([
|
|
1901
|
+
unref(nsCascader).e("suggestion-item"),
|
|
1902
|
+
unref(nsCascader).is("checked", item.checked)
|
|
1903
|
+
]),
|
|
1904
|
+
tabindex: -1,
|
|
1905
|
+
onClick: ($event) => handleSuggestionClick(item)
|
|
1906
|
+
}, [
|
|
1907
|
+
renderSlot(_ctx.$slots, "suggestion-item", { item }, () => [
|
|
1908
|
+
createElementVNode(
|
|
1909
|
+
"span",
|
|
1910
|
+
null,
|
|
1911
|
+
toDisplayString(item.text),
|
|
1912
|
+
1
|
|
1913
|
+
),
|
|
1914
|
+
item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
|
1915
|
+
default: withCtx(() => [
|
|
1916
|
+
createVNode(unref(Check))
|
|
1917
|
+
]),
|
|
1918
|
+
_: 1
|
|
1919
|
+
})) : createCommentVNode("v-if", true)
|
|
1920
|
+
])
|
|
1921
|
+
], 10, _hoisted_2$1);
|
|
1922
|
+
}),
|
|
1923
|
+
128
|
|
1924
|
+
)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
1925
|
+
createElementVNode(
|
|
1926
|
+
"li",
|
|
1927
|
+
{
|
|
1928
|
+
class: normalizeClass(unref(nsCascader).e("empty-text"))
|
|
1929
|
+
},
|
|
1930
|
+
toDisplayString(unref(t)("el.cascader.noMatch")),
|
|
1931
|
+
3
|
|
1932
|
+
)
|
|
1700
1933
|
])
|
|
1701
1934
|
]),
|
|
1702
1935
|
_: 3
|
|
1703
1936
|
}, 8, ["class", "view-class"])), [
|
|
1704
1937
|
[vShow, filtering.value]
|
|
1705
1938
|
]) : createCommentVNode("v-if", true),
|
|
1706
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock(
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1939
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock(
|
|
1940
|
+
"div",
|
|
1941
|
+
{
|
|
1942
|
+
key: 2,
|
|
1943
|
+
class: normalizeClass(unref(nsCascader).e("footer")),
|
|
1944
|
+
onClick: _cache[14] || (_cache[14] = withModifiers(() => {
|
|
1945
|
+
}, ["stop"]))
|
|
1946
|
+
},
|
|
1947
|
+
[
|
|
1948
|
+
renderSlot(_ctx.$slots, "footer")
|
|
1949
|
+
],
|
|
1950
|
+
2
|
|
1951
|
+
)) : createCommentVNode("v-if", true)
|
|
1714
1952
|
]),
|
|
1715
1953
|
_: 3
|
|
1716
1954
|
}, 8, ["visible", "teleported", "popper-class", "popper-style", "fallback-placements", "placement", "transition", "effect", "persistent"]);
|
|
1717
1955
|
};
|
|
1718
1956
|
}
|
|
1719
1957
|
});
|
|
1720
|
-
var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "cascader.vue"]]);
|
|
1958
|
+
var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/cascader.vue"]]);
|
|
1721
1959
|
|
|
1722
1960
|
const ElCascader = withInstall(Cascader);
|
|
1723
1961
|
|
|
1724
|
-
const
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1962
|
+
const _sfc_main$5 = defineComponent({
|
|
1963
|
+
...{
|
|
1964
|
+
name: "ElCollapseTransition"
|
|
1965
|
+
},
|
|
1966
|
+
__name: "collapse-transition",
|
|
1729
1967
|
setup(__props) {
|
|
1730
1968
|
const ns = useNamespace("collapse-transition");
|
|
1731
1969
|
const reset = (el) => {
|
|
@@ -1803,7 +2041,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1803
2041
|
};
|
|
1804
2042
|
}
|
|
1805
2043
|
});
|
|
1806
|
-
var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "collapse-transition.vue"]]);
|
|
2044
|
+
var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse-transition/src/collapse-transition.vue"]]);
|
|
1807
2045
|
|
|
1808
2046
|
const ElCollapseTransition = withInstall(CollapseTransition);
|
|
1809
2047
|
|
|
@@ -1828,11 +2066,11 @@ const textProps = buildProps({
|
|
|
1828
2066
|
}
|
|
1829
2067
|
});
|
|
1830
2068
|
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
2069
|
+
const _sfc_main$4 = defineComponent({
|
|
2070
|
+
...{
|
|
2071
|
+
name: "ElText"
|
|
2072
|
+
},
|
|
2073
|
+
__name: "text",
|
|
1836
2074
|
props: textProps,
|
|
1837
2075
|
setup(__props) {
|
|
1838
2076
|
const props = __props;
|
|
@@ -1878,7 +2116,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1878
2116
|
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
1879
2117
|
ref_key: "textRef",
|
|
1880
2118
|
ref: textRef,
|
|
1881
|
-
class: normalizeClass(
|
|
2119
|
+
class: normalizeClass(textKls.value),
|
|
1882
2120
|
style: normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
|
|
1883
2121
|
}, {
|
|
1884
2122
|
default: withCtx(() => [
|
|
@@ -1889,7 +2127,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1889
2127
|
};
|
|
1890
2128
|
}
|
|
1891
2129
|
});
|
|
1892
|
-
var Text = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "text.vue"]]);
|
|
2130
|
+
var Text = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/text/src/text.vue"]]);
|
|
1893
2131
|
|
|
1894
2132
|
const ElText = withInstall(Text);
|
|
1895
2133
|
|
|
@@ -1947,7 +2185,9 @@ const reInitChecked = function(node) {
|
|
|
1947
2185
|
node.isEffectivelyChecked = node.disabled || node.checked;
|
|
1948
2186
|
return;
|
|
1949
2187
|
}
|
|
1950
|
-
const { all, none, half, isEffectivelyChecked } = getChildState(
|
|
2188
|
+
const { all, none, half, isEffectivelyChecked } = getChildState(
|
|
2189
|
+
node.childNodes
|
|
2190
|
+
);
|
|
1951
2191
|
node.isEffectivelyChecked = isEffectivelyChecked;
|
|
1952
2192
|
if (all) {
|
|
1953
2193
|
node.checked = true;
|
|
@@ -2108,7 +2348,9 @@ class Node {
|
|
|
2108
2348
|
return null;
|
|
2109
2349
|
}
|
|
2110
2350
|
contains(target, deep = true) {
|
|
2111
|
-
return (this.childNodes || []).some(
|
|
2351
|
+
return (this.childNodes || []).some(
|
|
2352
|
+
(child) => child === target || deep && child.contains(target)
|
|
2353
|
+
);
|
|
2112
2354
|
}
|
|
2113
2355
|
remove() {
|
|
2114
2356
|
const parent = this.parent;
|
|
@@ -2214,7 +2456,11 @@ class Node {
|
|
|
2214
2456
|
}
|
|
2215
2457
|
doCreateChildren(array, defaultProps = {}) {
|
|
2216
2458
|
array.forEach((item) => {
|
|
2217
|
-
this.insertChild(
|
|
2459
|
+
this.insertChild(
|
|
2460
|
+
Object.assign({ data: item }, defaultProps),
|
|
2461
|
+
void 0,
|
|
2462
|
+
true
|
|
2463
|
+
);
|
|
2218
2464
|
});
|
|
2219
2465
|
}
|
|
2220
2466
|
collapse() {
|
|
@@ -2263,12 +2509,15 @@ class Node {
|
|
|
2263
2509
|
}
|
|
2264
2510
|
};
|
|
2265
2511
|
if (this.shouldLoadData()) {
|
|
2266
|
-
this.loadData(
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2512
|
+
this.loadData(
|
|
2513
|
+
() => {
|
|
2514
|
+
handleDescendants();
|
|
2515
|
+
reInitChecked(this);
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
checked: value !== false
|
|
2519
|
+
}
|
|
2520
|
+
);
|
|
2272
2521
|
return;
|
|
2273
2522
|
} else {
|
|
2274
2523
|
handleDescendants();
|
|
@@ -2387,10 +2636,14 @@ class TreeStore {
|
|
|
2387
2636
|
this.root.initialize();
|
|
2388
2637
|
if (this.lazy && this.load) {
|
|
2389
2638
|
const loadFn = this.load;
|
|
2390
|
-
loadFn(
|
|
2391
|
-
this.root
|
|
2392
|
-
|
|
2393
|
-
|
|
2639
|
+
loadFn(
|
|
2640
|
+
this.root,
|
|
2641
|
+
(data) => {
|
|
2642
|
+
this.root.doCreateChildren(data);
|
|
2643
|
+
this._initDefaultCheckedNodes();
|
|
2644
|
+
},
|
|
2645
|
+
NOOP
|
|
2646
|
+
);
|
|
2394
2647
|
} else {
|
|
2395
2648
|
this._initDefaultCheckedNodes();
|
|
2396
2649
|
}
|
|
@@ -2401,7 +2654,12 @@ class TreeStore {
|
|
|
2401
2654
|
const traverse = async function(node) {
|
|
2402
2655
|
const childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
2403
2656
|
for (const [index, child] of childNodes.entries()) {
|
|
2404
|
-
child.visible = !!(filterNodeMethod == null ? void 0 : filterNodeMethod.call(
|
|
2657
|
+
child.visible = !!(filterNodeMethod == null ? void 0 : filterNodeMethod.call(
|
|
2658
|
+
child,
|
|
2659
|
+
value,
|
|
2660
|
+
child.data,
|
|
2661
|
+
child
|
|
2662
|
+
));
|
|
2405
2663
|
if (index % 80 === 0 && index > 0) {
|
|
2406
2664
|
await nextTick();
|
|
2407
2665
|
}
|
|
@@ -2701,33 +2959,48 @@ const _sfc_main$3 = defineComponent({
|
|
|
2701
2959
|
},
|
|
2702
2960
|
setup(props) {
|
|
2703
2961
|
const ns = useNamespace("tree");
|
|
2704
|
-
const nodeInstance = inject(
|
|
2962
|
+
const nodeInstance = inject(
|
|
2963
|
+
NODE_INSTANCE_INJECTION_KEY
|
|
2964
|
+
);
|
|
2705
2965
|
const tree = inject(ROOT_TREE_INJECTION_KEY);
|
|
2706
2966
|
return () => {
|
|
2707
2967
|
const node = props.node;
|
|
2708
2968
|
const { data, store } = node;
|
|
2709
2969
|
return props.renderContent ? props.renderContent(h, { _self: nodeInstance, node, data, store }) : renderSlot(tree.ctx.slots, "default", { node, data }, () => [
|
|
2710
|
-
h(
|
|
2970
|
+
h(
|
|
2971
|
+
ElText,
|
|
2972
|
+
{ tag: "span", truncated: true, class: ns.be("node", "label") },
|
|
2973
|
+
() => [node.label]
|
|
2974
|
+
)
|
|
2711
2975
|
]);
|
|
2712
2976
|
};
|
|
2713
2977
|
}
|
|
2714
2978
|
});
|
|
2715
|
-
var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "tree-node-content.vue"]]);
|
|
2979
|
+
var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node-content.vue"]]);
|
|
2716
2980
|
|
|
2717
2981
|
function useNodeExpandEventBroadcast(props) {
|
|
2718
|
-
const parentNodeMap = inject(
|
|
2719
|
-
|
|
2982
|
+
const parentNodeMap = inject(
|
|
2983
|
+
TREE_NODE_MAP_INJECTION_KEY,
|
|
2984
|
+
null
|
|
2985
|
+
);
|
|
2986
|
+
let currentNodeMap = {
|
|
2720
2987
|
treeNodeExpand: (node) => {
|
|
2721
2988
|
var _a;
|
|
2722
2989
|
if (props.node !== node) {
|
|
2723
2990
|
(_a = props.node) == null ? void 0 : _a.collapse();
|
|
2724
2991
|
}
|
|
2725
2992
|
},
|
|
2726
|
-
children:
|
|
2993
|
+
children: /* @__PURE__ */ new Set()
|
|
2727
2994
|
};
|
|
2728
2995
|
if (parentNodeMap) {
|
|
2729
|
-
parentNodeMap.children.
|
|
2996
|
+
parentNodeMap.children.add(currentNodeMap);
|
|
2730
2997
|
}
|
|
2998
|
+
onBeforeUnmount(() => {
|
|
2999
|
+
if (parentNodeMap) {
|
|
3000
|
+
parentNodeMap.children.delete(currentNodeMap);
|
|
3001
|
+
}
|
|
3002
|
+
currentNodeMap = null;
|
|
3003
|
+
});
|
|
2731
3004
|
provide(TREE_NODE_MAP_INJECTION_KEY, currentNodeMap);
|
|
2732
3005
|
return {
|
|
2733
3006
|
broadcastExpanded: (node) => {
|
|
@@ -2788,7 +3061,11 @@ function useDragNodeHandler({
|
|
|
2788
3061
|
let userAllowDropInner = true;
|
|
2789
3062
|
if (isFunction(props.allowDrop)) {
|
|
2790
3063
|
dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
|
|
2791
|
-
userAllowDropInner = dropInner = props.allowDrop(
|
|
3064
|
+
userAllowDropInner = dropInner = props.allowDrop(
|
|
3065
|
+
draggingNode.node,
|
|
3066
|
+
dropNode.node,
|
|
3067
|
+
"inner"
|
|
3068
|
+
);
|
|
2792
3069
|
dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
|
|
2793
3070
|
}
|
|
2794
3071
|
event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
|
|
@@ -2878,14 +3155,29 @@ function useDragNodeHandler({
|
|
|
2878
3155
|
if (store.value.key) {
|
|
2879
3156
|
draggingNode.node.eachNode((node) => {
|
|
2880
3157
|
var _a2;
|
|
2881
|
-
(_a2 = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a2.setChecked(
|
|
3158
|
+
(_a2 = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a2.setChecked(
|
|
3159
|
+
node.checked,
|
|
3160
|
+
!store.value.checkStrictly
|
|
3161
|
+
);
|
|
2882
3162
|
});
|
|
2883
3163
|
}
|
|
2884
3164
|
}
|
|
2885
3165
|
removeClass(dropNode.$el, ns.is("drop-inner"));
|
|
2886
|
-
ctx.emit(
|
|
3166
|
+
ctx.emit(
|
|
3167
|
+
"node-drag-end",
|
|
3168
|
+
draggingNode.node,
|
|
3169
|
+
dropNode.node,
|
|
3170
|
+
dropType,
|
|
3171
|
+
event
|
|
3172
|
+
);
|
|
2887
3173
|
if (dropType !== "none") {
|
|
2888
|
-
ctx.emit(
|
|
3174
|
+
ctx.emit(
|
|
3175
|
+
"node-drop",
|
|
3176
|
+
draggingNode.node,
|
|
3177
|
+
dropNode.node,
|
|
3178
|
+
dropType,
|
|
3179
|
+
event
|
|
3180
|
+
);
|
|
2889
3181
|
}
|
|
2890
3182
|
}
|
|
2891
3183
|
if (draggingNode && !dropNode) {
|
|
@@ -2950,26 +3242,41 @@ const _sfc_main$2 = defineComponent({
|
|
|
2950
3242
|
childNodeRendered.value = true;
|
|
2951
3243
|
}
|
|
2952
3244
|
const childrenKey = tree.props.props["children"] || "children";
|
|
2953
|
-
watch(
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
handleSelectChange(props.node.checked, val);
|
|
2962
|
-
});
|
|
2963
|
-
watch(() => props.node.checked, (val) => {
|
|
2964
|
-
handleSelectChange(val, props.node.indeterminate);
|
|
2965
|
-
});
|
|
2966
|
-
watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
|
|
2967
|
-
watch(() => props.node.expanded, (val) => {
|
|
2968
|
-
nextTick(() => expanded.value = val);
|
|
2969
|
-
if (val) {
|
|
2970
|
-
childNodeRendered.value = true;
|
|
3245
|
+
watch(
|
|
3246
|
+
() => {
|
|
3247
|
+
var _a;
|
|
3248
|
+
const children = (_a = props.node.data) == null ? void 0 : _a[childrenKey];
|
|
3249
|
+
return children && [...children];
|
|
3250
|
+
},
|
|
3251
|
+
() => {
|
|
3252
|
+
props.node.updateChildren();
|
|
2971
3253
|
}
|
|
2972
|
-
|
|
3254
|
+
);
|
|
3255
|
+
watch(
|
|
3256
|
+
() => props.node.indeterminate,
|
|
3257
|
+
(val) => {
|
|
3258
|
+
handleSelectChange(props.node.checked, val);
|
|
3259
|
+
}
|
|
3260
|
+
);
|
|
3261
|
+
watch(
|
|
3262
|
+
() => props.node.checked,
|
|
3263
|
+
(val) => {
|
|
3264
|
+
handleSelectChange(val, props.node.indeterminate);
|
|
3265
|
+
}
|
|
3266
|
+
);
|
|
3267
|
+
watch(
|
|
3268
|
+
() => props.node.childNodes.length,
|
|
3269
|
+
() => props.node.reInitChecked()
|
|
3270
|
+
);
|
|
3271
|
+
watch(
|
|
3272
|
+
() => props.node.expanded,
|
|
3273
|
+
(val) => {
|
|
3274
|
+
nextTick(() => expanded.value = val);
|
|
3275
|
+
if (val) {
|
|
3276
|
+
childNodeRendered.value = true;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
);
|
|
2973
3280
|
const getNodeKey$1 = (node) => {
|
|
2974
3281
|
return getNodeKey(tree.props.nodeKey, node.data);
|
|
2975
3282
|
};
|
|
@@ -3024,7 +3331,13 @@ const _sfc_main$2 = defineComponent({
|
|
|
3024
3331
|
event.stopPropagation();
|
|
3025
3332
|
event.preventDefault();
|
|
3026
3333
|
}
|
|
3027
|
-
tree.ctx.emit(
|
|
3334
|
+
tree.ctx.emit(
|
|
3335
|
+
"node-contextmenu",
|
|
3336
|
+
event,
|
|
3337
|
+
props.node.data,
|
|
3338
|
+
props.node,
|
|
3339
|
+
instance
|
|
3340
|
+
);
|
|
3028
3341
|
};
|
|
3029
3342
|
const handleExpandIconClick = () => {
|
|
3030
3343
|
if (props.node.isLeaf)
|
|
@@ -3105,6 +3418,8 @@ const _sfc_main$2 = defineComponent({
|
|
|
3105
3418
|
};
|
|
3106
3419
|
}
|
|
3107
3420
|
});
|
|
3421
|
+
const _hoisted_1 = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"];
|
|
3422
|
+
const _hoisted_2 = ["aria-expanded"];
|
|
3108
3423
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3109
3424
|
const _component_el_icon = resolveComponent("el-icon");
|
|
3110
3425
|
const _component_el_checkbox = resolveComponent("el-checkbox");
|
|
@@ -3130,56 +3445,61 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3130
3445
|
"aria-checked": _ctx.node.checked,
|
|
3131
3446
|
draggable: _ctx.tree.props.draggable,
|
|
3132
3447
|
"data-key": _ctx.getNodeKey(_ctx.node),
|
|
3133
|
-
onClick: withModifiers(_ctx.handleClick, ["stop"]),
|
|
3134
|
-
onContextmenu: _ctx.handleContextMenu,
|
|
3135
|
-
onDragstart: withModifiers(_ctx.handleDragStart, ["stop"]),
|
|
3136
|
-
onDragover: withModifiers(_ctx.handleDragOver, ["stop"]),
|
|
3137
|
-
onDragend: withModifiers(_ctx.handleDragEnd, ["stop"]),
|
|
3138
|
-
onDrop: withModifiers(_ctx.handleDrop, ["stop"])
|
|
3448
|
+
onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
|
|
3449
|
+
onContextmenu: _cache[3] || (_cache[3] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
|
|
3450
|
+
onDragstart: _cache[4] || (_cache[4] = withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
|
|
3451
|
+
onDragover: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
|
|
3452
|
+
onDragend: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
|
|
3453
|
+
onDrop: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
|
|
3139
3454
|
}, [
|
|
3140
|
-
createElementVNode(
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
"
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
"
|
|
3181
|
-
|
|
3182
|
-
|
|
3455
|
+
createElementVNode(
|
|
3456
|
+
"div",
|
|
3457
|
+
{
|
|
3458
|
+
class: normalizeClass(_ctx.ns.be("node", "content")),
|
|
3459
|
+
style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
|
|
3460
|
+
},
|
|
3461
|
+
[
|
|
3462
|
+
_ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
|
|
3463
|
+
key: 0,
|
|
3464
|
+
class: normalizeClass([
|
|
3465
|
+
_ctx.ns.be("node", "expand-icon"),
|
|
3466
|
+
_ctx.ns.is("leaf", _ctx.node.isLeaf),
|
|
3467
|
+
{
|
|
3468
|
+
expanded: !_ctx.node.isLeaf && _ctx.expanded
|
|
3469
|
+
}
|
|
3470
|
+
]),
|
|
3471
|
+
onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
|
|
3472
|
+
}, {
|
|
3473
|
+
default: withCtx(() => [
|
|
3474
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
|
|
3475
|
+
]),
|
|
3476
|
+
_: 1
|
|
3477
|
+
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
|
|
3478
|
+
_ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
|
|
3479
|
+
key: 1,
|
|
3480
|
+
"model-value": _ctx.node.checked,
|
|
3481
|
+
indeterminate: _ctx.node.indeterminate,
|
|
3482
|
+
disabled: !!_ctx.node.disabled,
|
|
3483
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
3484
|
+
}, ["stop"])),
|
|
3485
|
+
onChange: _ctx.handleCheckChange
|
|
3486
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : createCommentVNode("v-if", true),
|
|
3487
|
+
_ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
|
|
3488
|
+
key: 2,
|
|
3489
|
+
class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
|
|
3490
|
+
}, {
|
|
3491
|
+
default: withCtx(() => [
|
|
3492
|
+
createVNode(_component_loading)
|
|
3493
|
+
]),
|
|
3494
|
+
_: 1
|
|
3495
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
3496
|
+
createVNode(_component_node_content, {
|
|
3497
|
+
node: _ctx.node,
|
|
3498
|
+
"render-content": _ctx.renderContent
|
|
3499
|
+
}, null, 8, ["node", "render-content"])
|
|
3500
|
+
],
|
|
3501
|
+
6
|
|
3502
|
+
),
|
|
3183
3503
|
createVNode(_component_el_collapse_transition, null, {
|
|
3184
3504
|
default: withCtx(() => [
|
|
3185
3505
|
!_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
|
|
@@ -3187,32 +3507,37 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3187
3507
|
class: normalizeClass(_ctx.ns.be("node", "children")),
|
|
3188
3508
|
role: "group",
|
|
3189
3509
|
"aria-expanded": _ctx.expanded,
|
|
3190
|
-
onClick: withModifiers(() => {
|
|
3191
|
-
}, ["stop"])
|
|
3510
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
3511
|
+
}, ["stop"]))
|
|
3192
3512
|
}, [
|
|
3193
|
-
(openBlock(true), createElementBlock(
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3513
|
+
(openBlock(true), createElementBlock(
|
|
3514
|
+
Fragment,
|
|
3515
|
+
null,
|
|
3516
|
+
renderList(_ctx.node.childNodes, (child) => {
|
|
3517
|
+
return openBlock(), createBlock(_component_el_tree_node, {
|
|
3518
|
+
key: _ctx.getNodeKey(child),
|
|
3519
|
+
"render-content": _ctx.renderContent,
|
|
3520
|
+
"render-after-expand": _ctx.renderAfterExpand,
|
|
3521
|
+
"show-checkbox": _ctx.showCheckbox,
|
|
3522
|
+
node: child,
|
|
3523
|
+
accordion: _ctx.accordion,
|
|
3524
|
+
props: _ctx.props,
|
|
3525
|
+
onNodeExpand: _ctx.handleChildNodeExpand
|
|
3526
|
+
}, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
|
|
3527
|
+
}),
|
|
3528
|
+
128
|
|
3529
|
+
))
|
|
3530
|
+
], 10, _hoisted_2)), [
|
|
3206
3531
|
[vShow, _ctx.expanded]
|
|
3207
3532
|
]) : createCommentVNode("v-if", true)
|
|
3208
3533
|
]),
|
|
3209
3534
|
_: 1
|
|
3210
3535
|
})
|
|
3211
|
-
], 42,
|
|
3536
|
+
], 42, _hoisted_1)), [
|
|
3212
3537
|
[vShow, _ctx.node.visible]
|
|
3213
3538
|
]);
|
|
3214
3539
|
}
|
|
3215
|
-
var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "tree-node.vue"]]);
|
|
3540
|
+
var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node.vue"]]);
|
|
3216
3541
|
|
|
3217
3542
|
function useKeydown({ el$ }, store) {
|
|
3218
3543
|
const ns = useNamespace("tree");
|
|
@@ -3220,8 +3545,8 @@ function useKeydown({ el$ }, store) {
|
|
|
3220
3545
|
initTabIndex();
|
|
3221
3546
|
});
|
|
3222
3547
|
onUpdated(() => {
|
|
3223
|
-
|
|
3224
|
-
|
|
3548
|
+
var _a;
|
|
3549
|
+
(_a = el$.value) == null ? void 0 : _a.querySelectorAll("input[type=checkbox]").forEach((checkbox) => {
|
|
3225
3550
|
checkbox.setAttribute("tabindex", "-1");
|
|
3226
3551
|
});
|
|
3227
3552
|
});
|
|
@@ -3235,7 +3560,9 @@ function useKeydown({ el$ }, store) {
|
|
|
3235
3560
|
if (!currentItem.className.includes(ns.b("node")))
|
|
3236
3561
|
return;
|
|
3237
3562
|
const code = getEventCode(ev);
|
|
3238
|
-
const treeItems = Array.from(
|
|
3563
|
+
const treeItems = Array.from(
|
|
3564
|
+
el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`)
|
|
3565
|
+
);
|
|
3239
3566
|
const currentIndex = treeItems.indexOf(currentItem);
|
|
3240
3567
|
let nextIndex;
|
|
3241
3568
|
if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
|
|
@@ -3279,8 +3606,12 @@ function useKeydown({ el$ }, store) {
|
|
|
3279
3606
|
ev.preventDefault();
|
|
3280
3607
|
currentItem.click();
|
|
3281
3608
|
}
|
|
3282
|
-
const hasInput = currentItem.querySelector(
|
|
3283
|
-
|
|
3609
|
+
const hasInput = currentItem.querySelector(
|
|
3610
|
+
'[type="checkbox"]'
|
|
3611
|
+
);
|
|
3612
|
+
if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(
|
|
3613
|
+
code
|
|
3614
|
+
) && hasInput) {
|
|
3284
3615
|
ev.preventDefault();
|
|
3285
3616
|
hasInput.click();
|
|
3286
3617
|
}
|
|
@@ -3290,12 +3621,18 @@ function useKeydown({ el$ }, store) {
|
|
|
3290
3621
|
var _a;
|
|
3291
3622
|
if (!el$.value)
|
|
3292
3623
|
return;
|
|
3293
|
-
const treeItems = Array.from(
|
|
3294
|
-
|
|
3624
|
+
const treeItems = Array.from(
|
|
3625
|
+
el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`)
|
|
3626
|
+
);
|
|
3627
|
+
const checkboxItems = Array.from(
|
|
3628
|
+
el$.value.querySelectorAll("input[type=checkbox]")
|
|
3629
|
+
);
|
|
3295
3630
|
checkboxItems.forEach((checkbox) => {
|
|
3296
3631
|
checkbox.setAttribute("tabindex", "-1");
|
|
3297
3632
|
});
|
|
3298
|
-
const checkedItem = el$.value.querySelectorAll(
|
|
3633
|
+
const checkedItem = el$.value.querySelectorAll(
|
|
3634
|
+
`.${ns.is("checked")}[role=treeitem]`
|
|
3635
|
+
);
|
|
3299
3636
|
if (checkedItem.length) {
|
|
3300
3637
|
checkedItem[0].setAttribute("tabindex", "0");
|
|
3301
3638
|
return;
|
|
@@ -3304,6 +3641,80 @@ function useKeydown({ el$ }, store) {
|
|
|
3304
3641
|
};
|
|
3305
3642
|
}
|
|
3306
3643
|
|
|
3644
|
+
const treeProps = buildProps({
|
|
3645
|
+
data: {
|
|
3646
|
+
type: definePropType(Array),
|
|
3647
|
+
default: () => []
|
|
3648
|
+
},
|
|
3649
|
+
emptyText: {
|
|
3650
|
+
type: String
|
|
3651
|
+
},
|
|
3652
|
+
renderAfterExpand: {
|
|
3653
|
+
type: Boolean,
|
|
3654
|
+
default: true
|
|
3655
|
+
},
|
|
3656
|
+
nodeKey: String,
|
|
3657
|
+
checkStrictly: Boolean,
|
|
3658
|
+
defaultExpandAll: Boolean,
|
|
3659
|
+
expandOnClickNode: {
|
|
3660
|
+
type: Boolean,
|
|
3661
|
+
default: true
|
|
3662
|
+
},
|
|
3663
|
+
checkOnClickNode: Boolean,
|
|
3664
|
+
checkOnClickLeaf: {
|
|
3665
|
+
type: Boolean,
|
|
3666
|
+
default: true
|
|
3667
|
+
},
|
|
3668
|
+
checkDescendants: Boolean,
|
|
3669
|
+
autoExpandParent: {
|
|
3670
|
+
type: Boolean,
|
|
3671
|
+
default: true
|
|
3672
|
+
},
|
|
3673
|
+
defaultCheckedKeys: {
|
|
3674
|
+
type: Array
|
|
3675
|
+
},
|
|
3676
|
+
defaultExpandedKeys: {
|
|
3677
|
+
type: Array
|
|
3678
|
+
},
|
|
3679
|
+
currentNodeKey: {
|
|
3680
|
+
type: [String, Number]
|
|
3681
|
+
},
|
|
3682
|
+
renderContent: {
|
|
3683
|
+
type: definePropType(Function)
|
|
3684
|
+
},
|
|
3685
|
+
showCheckbox: Boolean,
|
|
3686
|
+
draggable: Boolean,
|
|
3687
|
+
allowDrag: {
|
|
3688
|
+
type: definePropType(Function)
|
|
3689
|
+
},
|
|
3690
|
+
allowDrop: {
|
|
3691
|
+
type: definePropType(Function)
|
|
3692
|
+
},
|
|
3693
|
+
props: {
|
|
3694
|
+
type: Object,
|
|
3695
|
+
default: () => ({
|
|
3696
|
+
children: "children",
|
|
3697
|
+
label: "label",
|
|
3698
|
+
disabled: "disabled"
|
|
3699
|
+
})
|
|
3700
|
+
},
|
|
3701
|
+
lazy: Boolean,
|
|
3702
|
+
highlightCurrent: Boolean,
|
|
3703
|
+
load: {
|
|
3704
|
+
type: Function
|
|
3705
|
+
},
|
|
3706
|
+
filterNodeMethod: {
|
|
3707
|
+
type: Function
|
|
3708
|
+
},
|
|
3709
|
+
accordion: Boolean,
|
|
3710
|
+
indent: {
|
|
3711
|
+
type: Number,
|
|
3712
|
+
default: 18
|
|
3713
|
+
},
|
|
3714
|
+
icon: {
|
|
3715
|
+
type: iconPropType
|
|
3716
|
+
}
|
|
3717
|
+
});
|
|
3307
3718
|
const treeEmits = {
|
|
3308
3719
|
"check-change": (data, checked, indeterminate) => data && isBoolean(checked) && isBoolean(indeterminate),
|
|
3309
3720
|
"current-change": (data, node) => true,
|
|
@@ -3323,89 +3734,28 @@ const treeEmits = {
|
|
|
3323
3734
|
const _sfc_main$1 = defineComponent({
|
|
3324
3735
|
name: "ElTree",
|
|
3325
3736
|
components: { ElTreeNode },
|
|
3326
|
-
props:
|
|
3327
|
-
data: {
|
|
3328
|
-
type: definePropType(Array),
|
|
3329
|
-
default: () => []
|
|
3330
|
-
},
|
|
3331
|
-
emptyText: {
|
|
3332
|
-
type: String
|
|
3333
|
-
},
|
|
3334
|
-
renderAfterExpand: {
|
|
3335
|
-
type: Boolean,
|
|
3336
|
-
default: true
|
|
3337
|
-
},
|
|
3338
|
-
nodeKey: String,
|
|
3339
|
-
checkStrictly: Boolean,
|
|
3340
|
-
defaultExpandAll: Boolean,
|
|
3341
|
-
expandOnClickNode: {
|
|
3342
|
-
type: Boolean,
|
|
3343
|
-
default: true
|
|
3344
|
-
},
|
|
3345
|
-
checkOnClickNode: Boolean,
|
|
3346
|
-
checkOnClickLeaf: {
|
|
3347
|
-
type: Boolean,
|
|
3348
|
-
default: true
|
|
3349
|
-
},
|
|
3350
|
-
checkDescendants: Boolean,
|
|
3351
|
-
autoExpandParent: {
|
|
3352
|
-
type: Boolean,
|
|
3353
|
-
default: true
|
|
3354
|
-
},
|
|
3355
|
-
defaultCheckedKeys: Array,
|
|
3356
|
-
defaultExpandedKeys: Array,
|
|
3357
|
-
currentNodeKey: [String, Number],
|
|
3358
|
-
renderContent: {
|
|
3359
|
-
type: definePropType(Function)
|
|
3360
|
-
},
|
|
3361
|
-
showCheckbox: Boolean,
|
|
3362
|
-
draggable: Boolean,
|
|
3363
|
-
allowDrag: {
|
|
3364
|
-
type: definePropType(Function)
|
|
3365
|
-
},
|
|
3366
|
-
allowDrop: {
|
|
3367
|
-
type: definePropType(Function)
|
|
3368
|
-
},
|
|
3369
|
-
props: {
|
|
3370
|
-
type: Object,
|
|
3371
|
-
default: () => ({
|
|
3372
|
-
children: "children",
|
|
3373
|
-
label: "label",
|
|
3374
|
-
disabled: "disabled"
|
|
3375
|
-
})
|
|
3376
|
-
},
|
|
3377
|
-
lazy: Boolean,
|
|
3378
|
-
highlightCurrent: Boolean,
|
|
3379
|
-
load: Function,
|
|
3380
|
-
filterNodeMethod: Function,
|
|
3381
|
-
accordion: Boolean,
|
|
3382
|
-
indent: {
|
|
3383
|
-
type: Number,
|
|
3384
|
-
default: 18
|
|
3385
|
-
},
|
|
3386
|
-
icon: {
|
|
3387
|
-
type: iconPropType
|
|
3388
|
-
}
|
|
3389
|
-
},
|
|
3737
|
+
props: treeProps,
|
|
3390
3738
|
emits: treeEmits,
|
|
3391
3739
|
setup(props, ctx) {
|
|
3392
3740
|
const { t } = useLocale();
|
|
3393
3741
|
const ns = useNamespace("tree");
|
|
3394
|
-
const store = ref(
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3742
|
+
const store = ref(
|
|
3743
|
+
new TreeStore({
|
|
3744
|
+
key: props.nodeKey,
|
|
3745
|
+
data: props.data,
|
|
3746
|
+
lazy: props.lazy,
|
|
3747
|
+
props: props.props,
|
|
3748
|
+
load: props.load,
|
|
3749
|
+
currentNodeKey: props.currentNodeKey,
|
|
3750
|
+
checkStrictly: props.checkStrictly,
|
|
3751
|
+
checkDescendants: props.checkDescendants,
|
|
3752
|
+
defaultCheckedKeys: props.defaultCheckedKeys,
|
|
3753
|
+
defaultExpandedKeys: props.defaultExpandedKeys,
|
|
3754
|
+
autoExpandParent: props.autoExpandParent,
|
|
3755
|
+
defaultExpandAll: props.defaultExpandAll,
|
|
3756
|
+
filterNodeMethod: props.filterNodeMethod
|
|
3757
|
+
})
|
|
3758
|
+
);
|
|
3409
3759
|
store.value.initialize();
|
|
3410
3760
|
const root = ref(store.value.root);
|
|
3411
3761
|
const currentNode = ref(null);
|
|
@@ -3435,23 +3785,39 @@ const _sfc_main$1 = defineComponent({
|
|
|
3435
3785
|
const { childNodes } = root.value;
|
|
3436
3786
|
return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !isSelectTree.value;
|
|
3437
3787
|
});
|
|
3438
|
-
watch(
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
watch(
|
|
3453
|
-
|
|
3454
|
-
|
|
3788
|
+
watch(
|
|
3789
|
+
() => props.currentNodeKey,
|
|
3790
|
+
(newVal) => {
|
|
3791
|
+
store.value.setCurrentNodeKey(newVal != null ? newVal : null);
|
|
3792
|
+
}
|
|
3793
|
+
);
|
|
3794
|
+
watch(
|
|
3795
|
+
() => props.defaultCheckedKeys,
|
|
3796
|
+
(newVal, oldVal) => {
|
|
3797
|
+
if (isEqual(newVal, oldVal))
|
|
3798
|
+
return;
|
|
3799
|
+
store.value.setDefaultCheckedKey(newVal != null ? newVal : []);
|
|
3800
|
+
}
|
|
3801
|
+
);
|
|
3802
|
+
watch(
|
|
3803
|
+
() => props.defaultExpandedKeys,
|
|
3804
|
+
(newVal) => {
|
|
3805
|
+
store.value.setDefaultExpandedKeys(newVal != null ? newVal : []);
|
|
3806
|
+
}
|
|
3807
|
+
);
|
|
3808
|
+
watch(
|
|
3809
|
+
() => props.data,
|
|
3810
|
+
(newVal) => {
|
|
3811
|
+
store.value.setData(newVal);
|
|
3812
|
+
},
|
|
3813
|
+
{ deep: true }
|
|
3814
|
+
);
|
|
3815
|
+
watch(
|
|
3816
|
+
() => props.checkStrictly,
|
|
3817
|
+
(newVal) => {
|
|
3818
|
+
store.value.checkStrictly = newVal;
|
|
3819
|
+
}
|
|
3820
|
+
);
|
|
3455
3821
|
const filter = (value) => {
|
|
3456
3822
|
if (!props.filterNodeMethod)
|
|
3457
3823
|
throw new Error("[Tree] filterNodeMethod is required when filter");
|
|
@@ -3592,51 +3958,76 @@ const _sfc_main$1 = defineComponent({
|
|
|
3592
3958
|
});
|
|
3593
3959
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3594
3960
|
const _component_el_tree_node = resolveComponent("el-tree-node");
|
|
3595
|
-
return openBlock(), createElementBlock(
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3961
|
+
return openBlock(), createElementBlock(
|
|
3962
|
+
"div",
|
|
3963
|
+
{
|
|
3964
|
+
ref: "el$",
|
|
3965
|
+
class: normalizeClass([
|
|
3966
|
+
_ctx.ns.b(),
|
|
3967
|
+
_ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
|
|
3968
|
+
_ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
|
|
3969
|
+
_ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
|
|
3970
|
+
{ [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
|
|
3971
|
+
]),
|
|
3972
|
+
role: "tree"
|
|
3973
|
+
},
|
|
3974
|
+
[
|
|
3975
|
+
(openBlock(true), createElementBlock(
|
|
3976
|
+
Fragment,
|
|
3977
|
+
null,
|
|
3978
|
+
renderList(_ctx.root.childNodes, (child) => {
|
|
3979
|
+
return openBlock(), createBlock(_component_el_tree_node, {
|
|
3980
|
+
key: _ctx.getNodeKey(child),
|
|
3981
|
+
node: child,
|
|
3982
|
+
props: _ctx.props,
|
|
3983
|
+
accordion: _ctx.accordion,
|
|
3984
|
+
"render-after-expand": _ctx.renderAfterExpand,
|
|
3985
|
+
"show-checkbox": _ctx.showCheckbox,
|
|
3986
|
+
"render-content": _ctx.renderContent,
|
|
3987
|
+
onNodeExpand: _ctx.handleNodeExpand
|
|
3988
|
+
}, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
|
|
3989
|
+
}),
|
|
3990
|
+
128
|
|
3991
|
+
)),
|
|
3992
|
+
_ctx.isEmpty ? (openBlock(), createElementBlock(
|
|
3993
|
+
"div",
|
|
3994
|
+
{
|
|
3995
|
+
key: 0,
|
|
3996
|
+
class: normalizeClass(_ctx.ns.e("empty-block"))
|
|
3997
|
+
},
|
|
3998
|
+
[
|
|
3999
|
+
renderSlot(_ctx.$slots, "empty", {}, () => {
|
|
4000
|
+
var _a;
|
|
4001
|
+
return [
|
|
4002
|
+
createElementVNode(
|
|
4003
|
+
"span",
|
|
4004
|
+
{
|
|
4005
|
+
class: normalizeClass(_ctx.ns.e("empty-text"))
|
|
4006
|
+
},
|
|
4007
|
+
toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")),
|
|
4008
|
+
3
|
|
4009
|
+
)
|
|
4010
|
+
];
|
|
4011
|
+
})
|
|
4012
|
+
],
|
|
4013
|
+
2
|
|
4014
|
+
)) : createCommentVNode("v-if", true),
|
|
4015
|
+
withDirectives(createElementVNode(
|
|
4016
|
+
"div",
|
|
4017
|
+
{
|
|
4018
|
+
ref: "dropIndicator$",
|
|
4019
|
+
class: normalizeClass(_ctx.ns.e("drop-indicator"))
|
|
4020
|
+
},
|
|
4021
|
+
null,
|
|
4022
|
+
2
|
|
4023
|
+
), [
|
|
4024
|
+
[vShow, _ctx.dragState.showDropIndicator]
|
|
4025
|
+
])
|
|
4026
|
+
],
|
|
4027
|
+
2
|
|
4028
|
+
);
|
|
3638
4029
|
}
|
|
3639
|
-
var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "tree.vue"]]);
|
|
4030
|
+
var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree.vue"]]);
|
|
3640
4031
|
|
|
3641
4032
|
const ElTree = withInstall(Tree);
|
|
3642
4033
|
|