@element-plus/nightly 0.0.20221031 → 0.0.20221102
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +153 -86
- package/dist/index.full.min.js +13 -13
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +16 -16
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +153 -86
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +2 -1
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/collapse/index.d.ts +20 -59
- package/es/components/collapse/index.mjs.map +1 -1
- package/es/components/collapse/src/collapse-item.d.ts +0 -2
- package/es/components/collapse/src/collapse-item.mjs.map +1 -1
- package/es/components/collapse/src/collapse-item.vue.d.ts +21 -32
- package/es/components/collapse/src/collapse-item2.mjs +34 -55
- package/es/components/collapse/src/collapse-item2.mjs.map +1 -1
- package/es/components/collapse/src/collapse.d.ts +0 -2
- package/es/components/collapse/src/collapse.mjs.map +1 -1
- package/es/components/collapse/src/collapse.vue.d.ts +6 -25
- package/es/components/collapse/src/collapse2.mjs +5 -39
- package/es/components/collapse/src/collapse2.mjs.map +1 -1
- package/es/components/collapse/src/instance.d.ts +4 -0
- package/es/components/collapse/src/instance.mjs +2 -0
- package/es/components/collapse/src/instance.mjs.map +1 -0
- package/es/components/collapse/src/use-collapse-item.d.ts +20 -0
- package/es/components/collapse/src/use-collapse-item.mjs +75 -0
- package/es/components/collapse/src/use-collapse-item.mjs.map +1 -0
- package/es/components/collapse/src/use-collapse.d.ts +9 -0
- package/es/components/collapse/src/use-collapse.mjs +52 -0
- package/es/components/collapse/src/use-collapse.mjs.map +1 -0
- package/es/components/input/index.d.ts +2 -0
- package/es/components/input/index.mjs.map +1 -1
- package/es/components/tree-v2/index.d.ts +0 -1
- package/es/components/tree-v2/src/tree-node.mjs +2 -2
- package/es/components/tree-v2/src/tree-node.mjs.map +1 -1
- package/es/components/tree-v2/src/tree-node.vue.d.ts +0 -1
- package/es/components/tree-v2/src/tree.vue.d.ts +0 -1
- package/es/utils/dom/style.mjs +4 -4
- package/es/utils/dom/style.mjs.map +1 -1
- package/es/utils/index.mjs +1 -1
- package/es/utils/types.d.ts +1 -0
- package/es/utils/types.mjs +8 -2
- package/es/utils/types.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +2 -1
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/collapse/index.d.ts +20 -59
- package/lib/components/collapse/index.js.map +1 -1
- package/lib/components/collapse/src/collapse-item.d.ts +0 -2
- package/lib/components/collapse/src/collapse-item.js.map +1 -1
- package/lib/components/collapse/src/collapse-item.vue.d.ts +21 -32
- package/lib/components/collapse/src/collapse-item2.js +37 -58
- package/lib/components/collapse/src/collapse-item2.js.map +1 -1
- package/lib/components/collapse/src/collapse.d.ts +0 -2
- package/lib/components/collapse/src/collapse.js.map +1 -1
- package/lib/components/collapse/src/collapse.vue.d.ts +6 -25
- package/lib/components/collapse/src/collapse2.js +4 -38
- package/lib/components/collapse/src/collapse2.js.map +1 -1
- package/lib/components/collapse/src/instance.d.ts +4 -0
- package/lib/components/collapse/src/instance.js +3 -0
- package/lib/components/collapse/src/instance.js.map +1 -0
- package/lib/components/collapse/src/use-collapse-item.d.ts +20 -0
- package/lib/components/collapse/src/use-collapse-item.js +80 -0
- package/lib/components/collapse/src/use-collapse-item.js.map +1 -0
- package/lib/components/collapse/src/use-collapse.d.ts +9 -0
- package/lib/components/collapse/src/use-collapse.js +57 -0
- package/lib/components/collapse/src/use-collapse.js.map +1 -0
- package/lib/components/input/index.d.ts +2 -0
- package/lib/components/input/index.js.map +1 -1
- package/lib/components/tree-v2/index.d.ts +0 -1
- package/lib/components/tree-v2/src/tree-node.js +2 -2
- package/lib/components/tree-v2/src/tree-node.js.map +1 -1
- package/lib/components/tree-v2/src/tree-node.vue.d.ts +0 -1
- package/lib/components/tree-v2/src/tree.vue.d.ts +0 -1
- package/lib/utils/dom/style.js +4 -4
- package/lib/utils/dom/style.js.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/types.d.ts +1 -0
- package/lib/utils/types.js +7 -0
- package/lib/utils/types.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/el-input-number.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/input-number.scss +1 -1
- package/web-types.json +1 -1
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import '../../../utils/index.mjs';
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, withKeys, withModifiers, renderSlot, createTextVNode, toDisplayString, createVNode, withCtx, withDirectives, vShow } from 'vue';
|
|
3
2
|
import _CollapseTransition from '../../collapse-transition/index.mjs';
|
|
4
3
|
import { ElIcon } from '../../icon/index.mjs';
|
|
5
4
|
import { ArrowRight } from '@element-plus/icons-vue';
|
|
6
|
-
import '../../../hooks/index.mjs';
|
|
7
|
-
import '../../../tokens/index.mjs';
|
|
8
5
|
import { collapseItemProps } from './collapse-item.mjs';
|
|
6
|
+
import { useCollapseItem, useCollapseItemDOM } from './use-collapse-item.mjs';
|
|
9
7
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
10
|
-
import { collapseContextKey } from '../../../tokens/collapse.mjs';
|
|
11
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
12
|
-
import { generateId } from '../../../utils/rand.mjs';
|
|
13
8
|
|
|
14
9
|
const _hoisted_1 = ["aria-expanded", "aria-controls", "aria-describedby"];
|
|
15
|
-
const _hoisted_2 = ["id", "tabindex"
|
|
10
|
+
const _hoisted_2 = ["id", "tabindex"];
|
|
16
11
|
const _hoisted_3 = ["id", "aria-hidden", "aria-labelledby"];
|
|
17
12
|
const __default__ = defineComponent({
|
|
18
13
|
name: "ElCollapseItem"
|
|
@@ -22,67 +17,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22
17
|
props: collapseItemProps,
|
|
23
18
|
setup(__props, { expose }) {
|
|
24
19
|
const props = __props;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return;
|
|
43
|
-
collapse == null ? void 0 : collapse.handleItemClick(props.name);
|
|
44
|
-
focusing.value = false;
|
|
45
|
-
isClick.value = true;
|
|
46
|
-
};
|
|
47
|
-
const handleEnterClick = () => {
|
|
48
|
-
collapse == null ? void 0 : collapse.handleItemClick(props.name);
|
|
49
|
-
};
|
|
20
|
+
const {
|
|
21
|
+
focusing,
|
|
22
|
+
id,
|
|
23
|
+
isActive,
|
|
24
|
+
handleFocus,
|
|
25
|
+
handleHeaderClick,
|
|
26
|
+
handleEnterClick
|
|
27
|
+
} = useCollapseItem(props);
|
|
28
|
+
const {
|
|
29
|
+
arrowKls,
|
|
30
|
+
headKls,
|
|
31
|
+
rootKls,
|
|
32
|
+
itemWrapperKls,
|
|
33
|
+
itemContentKls,
|
|
34
|
+
scopedContentId,
|
|
35
|
+
scopedHeadId
|
|
36
|
+
} = useCollapseItemDOM(props, { focusing, isActive, id });
|
|
50
37
|
expose({
|
|
51
38
|
isActive
|
|
52
39
|
});
|
|
53
40
|
return (_ctx, _cache) => {
|
|
54
41
|
return openBlock(), createElementBlock("div", {
|
|
55
|
-
class: normalizeClass(
|
|
56
|
-
unref(ns).b("item"),
|
|
57
|
-
unref(ns).is("active", unref(isActive)),
|
|
58
|
-
unref(ns).is("disabled", _ctx.disabled)
|
|
59
|
-
])
|
|
42
|
+
class: normalizeClass(unref(rootKls))
|
|
60
43
|
}, [
|
|
61
44
|
createElementVNode("div", {
|
|
62
45
|
role: "tab",
|
|
63
46
|
"aria-expanded": unref(isActive),
|
|
64
|
-
"aria-controls": unref(
|
|
65
|
-
"aria-describedby": unref(
|
|
47
|
+
"aria-controls": unref(scopedContentId),
|
|
48
|
+
"aria-describedby": unref(scopedContentId)
|
|
66
49
|
}, [
|
|
67
50
|
createElementVNode("div", {
|
|
68
|
-
id: unref(
|
|
69
|
-
class: normalizeClass(
|
|
70
|
-
unref(ns).be("item", "header"),
|
|
71
|
-
unref(ns).is("active", unref(isActive)),
|
|
72
|
-
{ focusing: focusing.value && !_ctx.disabled }
|
|
73
|
-
]),
|
|
51
|
+
id: unref(scopedHeadId),
|
|
52
|
+
class: normalizeClass(unref(headKls)),
|
|
74
53
|
role: "button",
|
|
75
54
|
tabindex: _ctx.disabled ? -1 : 0,
|
|
76
|
-
onClick: handleHeaderClick,
|
|
77
|
-
onKeypress: withKeys(withModifiers(handleEnterClick, ["stop", "prevent"]), ["space", "enter"]),
|
|
78
|
-
onFocus: handleFocus,
|
|
79
|
-
onBlur: _cache[
|
|
55
|
+
onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
|
|
56
|
+
onKeypress: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
|
|
57
|
+
onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
|
|
58
|
+
onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
|
|
80
59
|
}, [
|
|
81
60
|
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
82
61
|
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
83
62
|
]),
|
|
84
63
|
createVNode(unref(ElIcon), {
|
|
85
|
-
class: normalizeClass(
|
|
64
|
+
class: normalizeClass(unref(arrowKls))
|
|
86
65
|
}, {
|
|
87
66
|
default: withCtx(() => [
|
|
88
67
|
createVNode(unref(ArrowRight))
|
|
@@ -94,14 +73,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
73
|
createVNode(unref(_CollapseTransition), null, {
|
|
95
74
|
default: withCtx(() => [
|
|
96
75
|
withDirectives(createElementVNode("div", {
|
|
97
|
-
id: unref(
|
|
98
|
-
class: normalizeClass(unref(
|
|
76
|
+
id: unref(scopedContentId),
|
|
77
|
+
class: normalizeClass(unref(itemWrapperKls)),
|
|
99
78
|
role: "tabpanel",
|
|
100
79
|
"aria-hidden": !unref(isActive),
|
|
101
|
-
"aria-labelledby": unref(
|
|
80
|
+
"aria-labelledby": unref(scopedHeadId)
|
|
102
81
|
}, [
|
|
103
82
|
createElementVNode("div", {
|
|
104
|
-
class: normalizeClass(unref(
|
|
83
|
+
class: normalizeClass(unref(itemContentKls))
|
|
105
84
|
}, [
|
|
106
85
|
renderSlot(_ctx.$slots, "default")
|
|
107
86
|
], 2)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapse-item2.mjs","sources":["../../../../../../packages/components/collapse/src/collapse-item.vue"],"sourcesContent":["<template>\n <div
|
|
1
|
+
{"version":3,"file":"collapse-item2.mjs","sources":["../../../../../../packages/components/collapse/src/collapse-item.vue"],"sourcesContent":["<template>\n <div :class=\"rootKls\">\n <div\n role=\"tab\"\n :aria-expanded=\"isActive\"\n :aria-controls=\"scopedContentId\"\n :aria-describedby=\"scopedContentId\"\n >\n <div\n :id=\"scopedHeadId\"\n :class=\"headKls\"\n role=\"button\"\n :tabindex=\"disabled ? -1 : 0\"\n @click=\"handleHeaderClick\"\n @keypress.space.enter.stop.prevent=\"handleEnterClick\"\n @focus=\"handleFocus\"\n @blur=\"focusing = false\"\n >\n <slot name=\"title\">{{ title }}</slot>\n <el-icon :class=\"arrowKls\">\n <arrow-right />\n </el-icon>\n </div>\n </div>\n <el-collapse-transition>\n <div\n v-show=\"isActive\"\n :id=\"scopedContentId\"\n :class=\"itemWrapperKls\"\n role=\"tabpanel\"\n :aria-hidden=\"!isActive\"\n :aria-labelledby=\"scopedHeadId\"\n >\n <div :class=\"itemContentKls\">\n <slot />\n </div>\n </div>\n </el-collapse-transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport ElCollapseTransition from '@element-plus/components/collapse-transition'\nimport ElIcon from '@element-plus/components/icon'\nimport { ArrowRight } from '@element-plus/icons-vue'\nimport { collapseItemProps } from './collapse-item'\nimport { useCollapseItem, useCollapseItemDOM } from './use-collapse-item'\n\ndefineOptions({\n name: 'ElCollapseItem',\n})\n\nconst props = defineProps(collapseItemProps)\nconst {\n focusing,\n id,\n isActive,\n handleFocus,\n handleHeaderClick,\n handleEnterClick,\n} = useCollapseItem(props)\n\nconst {\n arrowKls,\n headKls,\n rootKls,\n itemWrapperKls,\n itemContentKls,\n scopedContentId,\n scopedHeadId,\n} = useCollapseItemDOM(props, { focusing, isActive, id })\n\ndefineExpose({\n /** @description current collapse-item whether active */\n isActive,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;mCAgDc,CAAA;AAAA,EACZ,IAAM,EAAA,gBAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAGA,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,EAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,iBAAA;AAAA,MACA,gBAAA;AAAA,KAAA,GACE,gBAAgB,KAAK,CAAA,CAAA;AAEzB,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,KAAA,GACE,mBAAmB,KAAO,EAAA,EAAE,QAAU,EAAA,QAAA,EAAU,IAAI,CAAA,CAAA;AAExD,IAAa,MAAA,CAAA;AAAA,MAEX,QAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue';
|
|
2
|
-
import type Collapse from './collapse.vue';
|
|
3
2
|
import type { Arrayable } from 'element-plus/es/utils';
|
|
4
3
|
export declare type CollapseActiveName = string | number;
|
|
5
4
|
export declare type CollapseModelValue = Arrayable<CollapseActiveName>;
|
|
@@ -14,4 +13,3 @@ export declare const collapseEmits: {
|
|
|
14
13
|
change: (value: CollapseModelValue) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
15
14
|
};
|
|
16
15
|
export declare type CollapseEmits = typeof collapseEmits;
|
|
17
|
-
export declare type CollapseInstance = InstanceType<typeof Collapse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapse.mjs","sources":["../../../../../../packages/components/collapse/src/collapse.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isNumber,\n isString,\n mutable,\n} from '@element-plus/utils'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type
|
|
1
|
+
{"version":3,"file":"collapse.mjs","sources":["../../../../../../packages/components/collapse/src/collapse.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isNumber,\n isString,\n mutable,\n} from '@element-plus/utils'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type { Arrayable } from '@element-plus/utils'\n\nexport type CollapseActiveName = string | number\nexport type CollapseModelValue = Arrayable<CollapseActiveName>\n\nexport const emitChangeFn = (value: CollapseModelValue) =>\n typeof isNumber(value) || isString(value) || Array.isArray(value)\n\nexport const collapseProps = buildProps({\n accordion: Boolean,\n modelValue: {\n type: definePropType<CollapseModelValue>([Array, String, Number]),\n default: () => mutable([] as const),\n },\n} as const)\nexport type CollapseProps = ExtractPropTypes<typeof collapseProps>\n\nexport const collapseEmits = {\n [UPDATE_MODEL_EVENT]: emitChangeFn,\n [CHANGE_EVENT]: emitChangeFn,\n}\nexport type CollapseEmits = typeof collapseEmits\n"],"names":[],"mappings":";;;;;;;AAOY,MAAC,YAAY,GAAG,CAAC,KAAK,KAAK,OAAO,QAAQ,CAAC,KAAK,EAAE;AAClD,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACjD,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,CAAC,kBAAkB,GAAG,YAAY;AACpC,EAAE,CAAC,YAAY,GAAG,YAAY;AAC9B;;;;"}
|
|
@@ -1,48 +1,29 @@
|
|
|
1
|
-
import type { CollapseActiveName } from './collapse';
|
|
2
1
|
declare const _default: import("vue").DefineComponent<{
|
|
3
2
|
readonly accordion: BooleanConstructor;
|
|
4
|
-
readonly modelValue: import("
|
|
3
|
+
readonly modelValue: import("../../../utils").EpPropFinalized<(new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue) | ((new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue))[], unknown, unknown, () => [], boolean>;
|
|
5
4
|
}, {
|
|
6
5
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
7
6
|
readonly accordion: BooleanConstructor;
|
|
8
|
-
readonly modelValue: import("
|
|
7
|
+
readonly modelValue: import("../../../utils").EpPropFinalized<(new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue) | ((new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue))[], unknown, unknown, () => [], boolean>;
|
|
9
8
|
}>> & {
|
|
10
9
|
onChange?: ((value: import("./collapse").CollapseModelValue) => any) | undefined;
|
|
11
10
|
"onUpdate:modelValue"?: ((value: import("./collapse").CollapseModelValue) => any) | undefined;
|
|
12
11
|
}>>;
|
|
13
12
|
emit: ((event: "update:modelValue", value: import("./collapse").CollapseModelValue) => void) & ((event: "change", value: import("./collapse").CollapseModelValue) => void);
|
|
14
|
-
ns: {
|
|
15
|
-
namespace: import("vue").Ref<string>;
|
|
16
|
-
b: (blockSuffix?: string) => string;
|
|
17
|
-
e: (element?: string | undefined) => string;
|
|
18
|
-
m: (modifier?: string | undefined) => string;
|
|
19
|
-
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
20
|
-
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
21
|
-
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
22
|
-
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
23
|
-
is: {
|
|
24
|
-
(name: string, state: boolean | undefined): string;
|
|
25
|
-
(name: string): string;
|
|
26
|
-
};
|
|
27
|
-
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
28
|
-
cssVarName: (name: string) => string;
|
|
29
|
-
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
30
|
-
cssVarBlockName: (name: string) => string;
|
|
31
|
-
};
|
|
32
13
|
activeNames: import("vue").Ref<(string | number)[]>;
|
|
33
|
-
setActiveNames: (_activeNames: CollapseActiveName[]) => void;
|
|
34
|
-
|
|
14
|
+
setActiveNames: (_activeNames: import("./collapse").CollapseActiveName[]) => void;
|
|
15
|
+
rootKls: import("vue").ComputedRef<string>;
|
|
35
16
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
17
|
"update:modelValue": (value: import("./collapse").CollapseModelValue) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
37
18
|
change: (value: import("./collapse").CollapseModelValue) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
38
19
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
20
|
readonly accordion: BooleanConstructor;
|
|
40
|
-
readonly modelValue: import("
|
|
21
|
+
readonly modelValue: import("../../../utils").EpPropFinalized<(new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue) | ((new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue))[], unknown, unknown, () => [], boolean>;
|
|
41
22
|
}>> & {
|
|
42
23
|
onChange?: ((value: import("./collapse").CollapseModelValue) => any) | undefined;
|
|
43
24
|
"onUpdate:modelValue"?: ((value: import("./collapse").CollapseModelValue) => any) | undefined;
|
|
44
25
|
}, {
|
|
45
|
-
readonly modelValue: import("
|
|
26
|
+
readonly modelValue: import("../../../utils").EpPropMergeType<(new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue) | ((new (...args: any[]) => import("./collapse").CollapseModelValue & {}) | (() => import("./collapse").CollapseModelValue))[], unknown, unknown>;
|
|
46
27
|
readonly accordion: boolean;
|
|
47
28
|
}>;
|
|
48
29
|
export default _default;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import '../../../utils/index.mjs';
|
|
3
|
-
import '../../../constants/index.mjs';
|
|
4
|
-
import '../../../hooks/index.mjs';
|
|
5
|
-
import '../../../tokens/index.mjs';
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from 'vue';
|
|
6
2
|
import { collapseProps, collapseEmits } from './collapse.mjs';
|
|
3
|
+
import { useCollapse, useCollapseDOM } from './use-collapse.mjs';
|
|
7
4
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
9
|
-
import { castArray } from 'lodash-unified';
|
|
10
|
-
import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
|
|
11
|
-
import { collapseContextKey } from '../../../tokens/collapse.mjs';
|
|
12
5
|
|
|
13
6
|
const __default__ = defineComponent({
|
|
14
7
|
name: "ElCollapse"
|
|
@@ -19,42 +12,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
19
12
|
emits: collapseEmits,
|
|
20
13
|
setup(__props, { expose, emit }) {
|
|
21
14
|
const props = __props;
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const setActiveNames = (_activeNames) => {
|
|
25
|
-
activeNames.value = _activeNames;
|
|
26
|
-
const value = props.accordion ? activeNames.value[0] : activeNames.value;
|
|
27
|
-
emit(UPDATE_MODEL_EVENT, value);
|
|
28
|
-
emit(CHANGE_EVENT, value);
|
|
29
|
-
};
|
|
30
|
-
const handleItemClick = (name) => {
|
|
31
|
-
if (props.accordion) {
|
|
32
|
-
setActiveNames([
|
|
33
|
-
(activeNames.value[0] || activeNames.value[0] === 0) && activeNames.value[0] === name ? "" : name
|
|
34
|
-
]);
|
|
35
|
-
} else {
|
|
36
|
-
const _activeNames = [...activeNames.value];
|
|
37
|
-
const index = _activeNames.indexOf(name);
|
|
38
|
-
if (index > -1) {
|
|
39
|
-
_activeNames.splice(index, 1);
|
|
40
|
-
} else {
|
|
41
|
-
_activeNames.push(name);
|
|
42
|
-
}
|
|
43
|
-
setActiveNames(_activeNames);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
watch(() => props.modelValue, () => activeNames.value = castArray(props.modelValue), { deep: true });
|
|
47
|
-
provide(collapseContextKey, {
|
|
48
|
-
activeNames,
|
|
49
|
-
handleItemClick
|
|
50
|
-
});
|
|
15
|
+
const { activeNames, setActiveNames } = useCollapse(props, emit);
|
|
16
|
+
const { rootKls } = useCollapseDOM();
|
|
51
17
|
expose({
|
|
52
18
|
activeNames,
|
|
53
19
|
setActiveNames
|
|
54
20
|
});
|
|
55
21
|
return (_ctx, _cache) => {
|
|
56
22
|
return openBlock(), createElementBlock("div", {
|
|
57
|
-
class: normalizeClass(unref(
|
|
23
|
+
class: normalizeClass(unref(rootKls)),
|
|
58
24
|
role: "tablist",
|
|
59
25
|
"aria-multiselectable": "true"
|
|
60
26
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapse2.mjs","sources":["../../../../../../packages/components/collapse/src/collapse.vue"],"sourcesContent":["<template>\n <div :class=\"
|
|
1
|
+
{"version":3,"file":"collapse2.mjs","sources":["../../../../../../packages/components/collapse/src/collapse.vue"],"sourcesContent":["<template>\n <div :class=\"rootKls\" role=\"tablist\" aria-multiselectable=\"true\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { collapseEmits, collapseProps } from './collapse'\nimport { useCollapse, useCollapseDOM } from './use-collapse'\n\ndefineOptions({\n name: 'ElCollapse',\n})\nconst props = defineProps(collapseProps)\nconst emit = defineEmits(collapseEmits)\n\nconst { activeNames, setActiveNames } = useCollapse(props, emit)\n\nconst { rootKls } = useCollapseDOM()\n\ndefineExpose({\n /** @description active names */\n activeNames,\n /** @description set active names */\n setActiveNames,\n})\n</script>\n"],"names":[],"mappings":";;;;;mCAUc,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAA,MAAM,EAAE,WAAA,EAAa,cAAmB,EAAA,GAAA,WAAA,CAAY,OAAO,IAAI,CAAA,CAAA;AAE/D,IAAM,MAAA,EAAE,YAAY,cAAe,EAAA,CAAA;AAEnC,IAAa,MAAA,CAAA;AAAA,MAEX,WAAA;AAAA,MAEA,cAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CollapseItemProps } from './collapse-item';
|
|
2
|
+
export declare const useCollapseItem: (props: CollapseItemProps) => {
|
|
3
|
+
focusing: import("vue").Ref<boolean>;
|
|
4
|
+
id: import("vue").Ref<number>;
|
|
5
|
+
isActive: import("vue").ComputedRef<boolean | undefined>;
|
|
6
|
+
handleFocus: () => void;
|
|
7
|
+
handleHeaderClick: () => void;
|
|
8
|
+
handleEnterClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const useCollapseItemDOM: (props: CollapseItemProps, { focusing, isActive, id }: Partial<ReturnType<typeof useCollapseItem>>) => {
|
|
11
|
+
arrowKls: import("vue").ComputedRef<string[]>;
|
|
12
|
+
headKls: import("vue").ComputedRef<(string | {
|
|
13
|
+
focusing: boolean | undefined;
|
|
14
|
+
})[]>;
|
|
15
|
+
rootKls: import("vue").ComputedRef<string[]>;
|
|
16
|
+
itemWrapperKls: import("vue").ComputedRef<string>;
|
|
17
|
+
itemContentKls: import("vue").ComputedRef<string>;
|
|
18
|
+
scopedContentId: import("vue").ComputedRef<string>;
|
|
19
|
+
scopedHeadId: import("vue").ComputedRef<string>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { inject, ref, computed, unref } from 'vue';
|
|
2
|
+
import '../../../hooks/index.mjs';
|
|
3
|
+
import '../../../utils/index.mjs';
|
|
4
|
+
import '../../../tokens/index.mjs';
|
|
5
|
+
import { collapseContextKey } from '../../../tokens/collapse.mjs';
|
|
6
|
+
import { generateId } from '../../../utils/rand.mjs';
|
|
7
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
8
|
+
|
|
9
|
+
const useCollapseItem = (props) => {
|
|
10
|
+
const collapse = inject(collapseContextKey);
|
|
11
|
+
const focusing = ref(false);
|
|
12
|
+
const isClick = ref(false);
|
|
13
|
+
const id = ref(generateId());
|
|
14
|
+
const isActive = computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
|
|
15
|
+
const handleFocus = () => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
if (!isClick.value) {
|
|
18
|
+
focusing.value = true;
|
|
19
|
+
} else {
|
|
20
|
+
isClick.value = false;
|
|
21
|
+
}
|
|
22
|
+
}, 50);
|
|
23
|
+
};
|
|
24
|
+
const handleHeaderClick = () => {
|
|
25
|
+
if (props.disabled)
|
|
26
|
+
return;
|
|
27
|
+
collapse == null ? void 0 : collapse.handleItemClick(props.name);
|
|
28
|
+
focusing.value = false;
|
|
29
|
+
isClick.value = true;
|
|
30
|
+
};
|
|
31
|
+
const handleEnterClick = () => {
|
|
32
|
+
collapse == null ? void 0 : collapse.handleItemClick(props.name);
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
focusing,
|
|
36
|
+
id,
|
|
37
|
+
isActive,
|
|
38
|
+
handleFocus,
|
|
39
|
+
handleHeaderClick,
|
|
40
|
+
handleEnterClick
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
|
|
44
|
+
const ns = useNamespace("collapse");
|
|
45
|
+
const rootKls = computed(() => [
|
|
46
|
+
ns.b("item"),
|
|
47
|
+
ns.is("active", unref(isActive)),
|
|
48
|
+
ns.is("disabled", props.disabled)
|
|
49
|
+
]);
|
|
50
|
+
const headKls = computed(() => [
|
|
51
|
+
ns.be("item", "header"),
|
|
52
|
+
ns.is("active", unref(isActive)),
|
|
53
|
+
{ focusing: unref(focusing) && !props.disabled }
|
|
54
|
+
]);
|
|
55
|
+
const arrowKls = computed(() => [
|
|
56
|
+
ns.be("item", "arrow"),
|
|
57
|
+
ns.is("active", unref(isActive))
|
|
58
|
+
]);
|
|
59
|
+
const itemWrapperKls = computed(() => ns.be("item", "wrap"));
|
|
60
|
+
const itemContentKls = computed(() => ns.be("item", "content"));
|
|
61
|
+
const scopedContentId = computed(() => ns.b(`content-${unref(id)}`));
|
|
62
|
+
const scopedHeadId = computed(() => ns.b(`head-${unref(id)}`));
|
|
63
|
+
return {
|
|
64
|
+
arrowKls,
|
|
65
|
+
headKls,
|
|
66
|
+
rootKls,
|
|
67
|
+
itemWrapperKls,
|
|
68
|
+
itemContentKls,
|
|
69
|
+
scopedContentId,
|
|
70
|
+
scopedHeadId
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { useCollapseItem, useCollapseItemDOM };
|
|
75
|
+
//# sourceMappingURL=use-collapse-item.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-collapse-item.mjs","sources":["../../../../../../packages/components/collapse/src/use-collapse-item.ts"],"sourcesContent":["import { computed, inject, ref, unref } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { generateId } from '@element-plus/utils'\nimport { collapseContextKey } from '@element-plus/tokens'\n\nimport type { CollapseItemProps } from './collapse-item'\n\nexport const useCollapseItem = (props: CollapseItemProps) => {\n const collapse = inject(collapseContextKey)\n\n const focusing = ref(false)\n const isClick = ref(false)\n const id = ref(generateId())\n\n const isActive = computed(() =>\n collapse?.activeNames.value.includes(props.name)\n )\n\n const handleFocus = () => {\n setTimeout(() => {\n if (!isClick.value) {\n focusing.value = true\n } else {\n isClick.value = false\n }\n }, 50)\n }\n\n const handleHeaderClick = () => {\n if (props.disabled) return\n collapse?.handleItemClick(props.name)\n focusing.value = false\n isClick.value = true\n }\n\n const handleEnterClick = () => {\n collapse?.handleItemClick(props.name)\n }\n\n return {\n focusing,\n id,\n isActive,\n handleFocus,\n handleHeaderClick,\n handleEnterClick,\n }\n}\n\nexport const useCollapseItemDOM = (\n props: CollapseItemProps,\n { focusing, isActive, id }: Partial<ReturnType<typeof useCollapseItem>>\n) => {\n const ns = useNamespace('collapse')\n\n const rootKls = computed(() => [\n ns.b('item'),\n ns.is('active', unref(isActive)),\n ns.is('disabled', props.disabled),\n ])\n const headKls = computed(() => [\n ns.be('item', 'header'),\n ns.is('active', unref(isActive)),\n { focusing: unref(focusing) && !props.disabled },\n ])\n const arrowKls = computed(() => [\n ns.be('item', 'arrow'),\n ns.is('active', unref(isActive)),\n ])\n const itemWrapperKls = computed(() => ns.be('item', 'wrap'))\n const itemContentKls = computed(() => ns.be('item', 'content'))\n const scopedContentId = computed(() => ns.b(`content-${unref(id)}`))\n const scopedHeadId = computed(() => ns.b(`head-${unref(id)}`))\n\n return {\n arrowKls,\n headKls,\n rootKls,\n itemWrapperKls,\n itemContentKls,\n scopedContentId,\n scopedHeadId,\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SetupContext } from 'vue';
|
|
2
|
+
import type { CollapseActiveName, CollapseEmits, CollapseProps } from './collapse';
|
|
3
|
+
export declare const useCollapse: (props: CollapseProps, emit: SetupContext<CollapseEmits>['emit']) => {
|
|
4
|
+
activeNames: import("vue").Ref<(string | number)[]>;
|
|
5
|
+
setActiveNames: (_activeNames: CollapseActiveName[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const useCollapseDOM: () => {
|
|
8
|
+
rootKls: import("vue").ComputedRef<string>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ref, watch, provide, computed } from 'vue';
|
|
2
|
+
import '../../../utils/index.mjs';
|
|
3
|
+
import '../../../hooks/index.mjs';
|
|
4
|
+
import '../../../constants/index.mjs';
|
|
5
|
+
import '../../../tokens/index.mjs';
|
|
6
|
+
import { castArray } from 'lodash-unified';
|
|
7
|
+
import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
|
|
8
|
+
import { collapseContextKey } from '../../../tokens/collapse.mjs';
|
|
9
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
10
|
+
|
|
11
|
+
const useCollapse = (props, emit) => {
|
|
12
|
+
const activeNames = ref(castArray(props.modelValue));
|
|
13
|
+
const setActiveNames = (_activeNames) => {
|
|
14
|
+
activeNames.value = _activeNames;
|
|
15
|
+
const value = props.accordion ? activeNames.value[0] : activeNames.value;
|
|
16
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
17
|
+
emit(CHANGE_EVENT, value);
|
|
18
|
+
};
|
|
19
|
+
const handleItemClick = (name) => {
|
|
20
|
+
if (props.accordion) {
|
|
21
|
+
setActiveNames([activeNames.value[0] === name ? "" : name]);
|
|
22
|
+
} else {
|
|
23
|
+
const _activeNames = [...activeNames.value];
|
|
24
|
+
const index = _activeNames.indexOf(name);
|
|
25
|
+
if (index > -1) {
|
|
26
|
+
_activeNames.splice(index, 1);
|
|
27
|
+
} else {
|
|
28
|
+
_activeNames.push(name);
|
|
29
|
+
}
|
|
30
|
+
setActiveNames(_activeNames);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
watch(() => props.modelValue, () => activeNames.value = castArray(props.modelValue), { deep: true });
|
|
34
|
+
provide(collapseContextKey, {
|
|
35
|
+
activeNames,
|
|
36
|
+
handleItemClick
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
activeNames,
|
|
40
|
+
setActiveNames
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const useCollapseDOM = () => {
|
|
44
|
+
const ns = useNamespace("collapse");
|
|
45
|
+
const rootKls = computed(() => ns.b());
|
|
46
|
+
return {
|
|
47
|
+
rootKls
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { useCollapse, useCollapseDOM };
|
|
52
|
+
//# sourceMappingURL=use-collapse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-collapse.mjs","sources":["../../../../../../packages/components/collapse/src/use-collapse.ts"],"sourcesContent":["import { computed, provide, ref, watch } from 'vue'\nimport { ensureArray } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { collapseContextKey } from '@element-plus/tokens'\n\nimport type { SetupContext } from 'vue'\nimport type {\n CollapseActiveName,\n CollapseEmits,\n CollapseProps,\n} from './collapse'\n\nexport const useCollapse = (\n props: CollapseProps,\n emit: SetupContext<CollapseEmits>['emit']\n) => {\n const activeNames = ref(ensureArray(props.modelValue))\n\n const setActiveNames = (_activeNames: CollapseActiveName[]) => {\n activeNames.value = _activeNames\n const value = props.accordion ? activeNames.value[0] : activeNames.value\n emit(UPDATE_MODEL_EVENT, value)\n emit(CHANGE_EVENT, value)\n }\n\n const handleItemClick = (name: CollapseActiveName) => {\n if (props.accordion) {\n setActiveNames([activeNames.value[0] === name ? '' : name])\n } else {\n const _activeNames = [...activeNames.value]\n const index = _activeNames.indexOf(name)\n\n if (index > -1) {\n _activeNames.splice(index, 1)\n } else {\n _activeNames.push(name)\n }\n setActiveNames(_activeNames)\n }\n }\n\n watch(\n () => props.modelValue,\n () => (activeNames.value = ensureArray(props.modelValue)),\n { deep: true }\n )\n\n provide(collapseContextKey, {\n activeNames,\n handleItemClick,\n })\n return {\n activeNames,\n setActiveNames,\n }\n}\n\nexport const useCollapseDOM = () => {\n const ns = useNamespace('collapse')\n\n const rootKls = computed(() => ns.b())\n return {\n rootKls,\n }\n}\n"],"names":["ensureArray"],"mappings":";;;;;;;;;;AAKY,MAAC,WAAW,GAAG,CAAC,KAAK,EAAE,IAAI,KAAK;AAC5C,EAAE,MAAM,WAAW,GAAG,GAAG,CAACA,SAAW,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AACzD,EAAE,MAAM,cAAc,GAAG,CAAC,YAAY,KAAK;AAC3C,IAAI,WAAW,CAAC,KAAK,GAAG,YAAY,CAAC;AACrC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;AAC7E,IAAI,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;AACpC,IAAI,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AAC9B,GAAG,CAAC;AACJ,EAAE,MAAM,eAAe,GAAG,CAAC,IAAI,KAAK;AACpC,IAAI,IAAI,KAAK,CAAC,SAAS,EAAE;AACzB,MAAM,cAAc,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;AAClE,KAAK,MAAM;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;AAClD,MAAM,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/C,MAAM,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;AACtB,QAAQ,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACtC,OAAO,MAAM;AACb,QAAQ,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChC,OAAO;AACP,MAAM,cAAc,CAAC,YAAY,CAAC,CAAC;AACnC,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,UAAU,EAAE,MAAM,WAAW,CAAC,KAAK,GAAGA,SAAW,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACzG,EAAE,OAAO,CAAC,kBAAkB,EAAE;AAC9B,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,WAAW;AACf,IAAI,cAAc;AAClB,GAAG,CAAC;AACJ,EAAE;AACU,MAAC,cAAc,GAAG,MAAM;AACpC,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AACtC,EAAE,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACzC,EAAE,OAAO;AACT,IAAI,OAAO;AACX,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Input from './src/input.vue';
|
|
1
2
|
export declare const ElInput: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
2
3
|
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
3
4
|
readonly size: {
|
|
@@ -406,3 +407,4 @@ export declare const ElInput: import("element-plus/es/utils").SFCWithInstall<imp
|
|
|
406
407
|
}>> & Record<string, any>;
|
|
407
408
|
export default ElInput;
|
|
408
409
|
export * from './src/input';
|
|
410
|
+
export declare type InputInstance = InstanceType<typeof Input>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/input/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\n\nimport Input from './src/input.vue'\n\nexport const ElInput = withInstall(Input)\nexport default ElInput\n\nexport * from './src/input'\n"],"names":[],"mappings":";;;;;AAEY,MAAC,OAAO,GAAG,WAAW,CAAC,KAAK;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/input/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\n\nimport Input from './src/input.vue'\n\nexport const ElInput = withInstall(Input)\nexport default ElInput\n\nexport * from './src/input'\n\nexport type InputInstance = InstanceType<typeof Input>\n"],"names":[],"mappings":";;;;;AAEY,MAAC,OAAO,GAAG,WAAW,CAAC,KAAK;;;;"}
|
|
@@ -322,7 +322,6 @@ export declare const ElTreeV2: import("element-plus/es/utils").SFCWithInstall<im
|
|
|
322
322
|
readonly current: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
323
323
|
readonly hiddenExpandIcon: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
324
324
|
}, {
|
|
325
|
-
DEFAULT_ICON: string;
|
|
326
325
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
327
326
|
readonly node: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/types").TreeNode) | (() => import("./src/types").TreeNode) | ((new (...args: any[]) => import("./src/types").TreeNode) | (() => import("./src/types").TreeNode))[], unknown, unknown, () => import("element-plus/es/utils").Mutable<{
|
|
328
327
|
readonly key: -1;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeClass, unref, withModifiers, createElementVNode, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, createVNode } from 'vue';
|
|
2
2
|
import { ElIcon } from '../../icon/index.mjs';
|
|
3
|
+
import { CaretRight } from '@element-plus/icons-vue';
|
|
3
4
|
import { ElCheckbox } from '../../checkbox/index.mjs';
|
|
4
5
|
import '../../../hooks/index.mjs';
|
|
5
6
|
import ElNodeContent from './tree-node-content.mjs';
|
|
@@ -8,7 +9,6 @@ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
|
8
9
|
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
9
10
|
|
|
10
11
|
const _hoisted_1 = ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"];
|
|
11
|
-
const DEFAULT_ICON = "caret-right";
|
|
12
12
|
const __default__ = defineComponent({
|
|
13
13
|
name: "ElTreeNode"
|
|
14
14
|
});
|
|
@@ -26,7 +26,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26
26
|
});
|
|
27
27
|
const icon = computed(() => {
|
|
28
28
|
var _a;
|
|
29
|
-
return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a :
|
|
29
|
+
return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : CaretRight;
|
|
30
30
|
});
|
|
31
31
|
const handleClick = (e) => {
|
|
32
32
|
emit("click", props.node, e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-node.mjs","sources":["../../../../../../packages/components/tree-v2/src/tree-node.vue"],"sourcesContent":["<template>\n <div\n ref=\"node$\"\n :class=\"[\n ns.b('node'),\n ns.is('expanded', expanded),\n ns.is('current', current),\n ns.is('focusable', !disabled),\n ns.is('checked', !disabled && checked),\n ]\"\n role=\"treeitem\"\n tabindex=\"-1\"\n :aria-expanded=\"expanded\"\n :aria-disabled=\"disabled\"\n :aria-checked=\"checked\"\n :data-key=\"node?.key\"\n @click.stop=\"handleClick\"\n @contextmenu=\"handleContextMenu\"\n >\n <div\n :class=\"ns.be('node', 'content')\"\n :style=\"{ paddingLeft: `${(node.level - 1) * indent}px` }\"\n >\n <el-icon\n v-if=\"icon\"\n :class=\"[\n ns.is('leaf', !!node?.isLeaf),\n ns.is('hidden', hiddenExpandIcon),\n {\n expanded: !node?.isLeaf && expanded,\n },\n ns.be('node', 'expand-icon'),\n ]\"\n @click.stop=\"handleExpandIconClick\"\n >\n <component :is=\"icon\" />\n </el-icon>\n <el-checkbox\n v-if=\"showCheckbox\"\n :model-value=\"checked\"\n :indeterminate=\"indeterminate\"\n :disabled=\"disabled\"\n @change=\"handleCheckChange\"\n @click.stop\n />\n <el-node-content :node=\"node\" />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport ElIcon from '@element-plus/components/icon'\nimport ElCheckbox from '@element-plus/components/checkbox'\nimport { useNamespace } from '@element-plus/hooks'\nimport ElNodeContent from './tree-node-content'\nimport {\n NODE_CONTEXTMENU,\n ROOT_TREE_INJECTION_KEY,\n treeNodeEmits,\n treeNodeProps,\n} from './virtual-tree'\nimport type { CheckboxValueType } from '@element-plus/components/checkbox'\n\
|
|
1
|
+
{"version":3,"file":"tree-node.mjs","sources":["../../../../../../packages/components/tree-v2/src/tree-node.vue"],"sourcesContent":["<template>\n <div\n ref=\"node$\"\n :class=\"[\n ns.b('node'),\n ns.is('expanded', expanded),\n ns.is('current', current),\n ns.is('focusable', !disabled),\n ns.is('checked', !disabled && checked),\n ]\"\n role=\"treeitem\"\n tabindex=\"-1\"\n :aria-expanded=\"expanded\"\n :aria-disabled=\"disabled\"\n :aria-checked=\"checked\"\n :data-key=\"node?.key\"\n @click.stop=\"handleClick\"\n @contextmenu=\"handleContextMenu\"\n >\n <div\n :class=\"ns.be('node', 'content')\"\n :style=\"{ paddingLeft: `${(node.level - 1) * indent}px` }\"\n >\n <el-icon\n v-if=\"icon\"\n :class=\"[\n ns.is('leaf', !!node?.isLeaf),\n ns.is('hidden', hiddenExpandIcon),\n {\n expanded: !node?.isLeaf && expanded,\n },\n ns.be('node', 'expand-icon'),\n ]\"\n @click.stop=\"handleExpandIconClick\"\n >\n <component :is=\"icon\" />\n </el-icon>\n <el-checkbox\n v-if=\"showCheckbox\"\n :model-value=\"checked\"\n :indeterminate=\"indeterminate\"\n :disabled=\"disabled\"\n @change=\"handleCheckChange\"\n @click.stop\n />\n <el-node-content :node=\"node\" />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport ElIcon from '@element-plus/components/icon'\nimport { CaretRight } from '@element-plus/icons-vue'\nimport ElCheckbox from '@element-plus/components/checkbox'\nimport { useNamespace } from '@element-plus/hooks'\nimport ElNodeContent from './tree-node-content'\nimport {\n NODE_CONTEXTMENU,\n ROOT_TREE_INJECTION_KEY,\n treeNodeEmits,\n treeNodeProps,\n} from './virtual-tree'\nimport type { CheckboxValueType } from '@element-plus/components/checkbox'\n\ndefineOptions({\n name: 'ElTreeNode',\n})\n\nconst props = defineProps(treeNodeProps)\nconst emit = defineEmits(treeNodeEmits)\n\nconst tree = inject(ROOT_TREE_INJECTION_KEY)\nconst ns = useNamespace('tree')\n\nconst indent = computed(() => {\n return tree?.props.indent ?? 16\n})\n\nconst icon = computed(() => {\n return tree?.props.icon ?? CaretRight\n})\n\nconst handleClick = (e: MouseEvent) => {\n emit('click', props.node, e)\n}\nconst handleExpandIconClick = () => {\n emit('toggle', props.node)\n}\nconst handleCheckChange = (value: CheckboxValueType) => {\n emit('check', props.node, value)\n}\nconst handleContextMenu = (event: Event) => {\n if (tree?.instance?.vnode?.props?.['onNodeContextmenu']) {\n event.stopPropagation()\n event.preventDefault()\n }\n tree?.ctx.emit(NODE_CONTEXTMENU, event, props.node?.data, props.node)\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;mCAiEc,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,IAAA,GAAO,OAAO,uBAAuB,CAAA,CAAA;AAC3C,IAAM,MAAA,EAAA,GAAK,aAAa,MAAM,CAAA,CAAA;AAE9B,IAAM,MAAA,MAAA,GAAS,SAAS,MAAM;AAC5B,MAAO,IAAA,EAAA,CAAA;AAAsB,MAC9B,OAAA,CAAA,EAAA,GAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,KAAA,CAAA,MAAA,KAAA,IAAA,GAAA,EAAA,GAAA,EAAA,CAAA;AAED,KAAM,CAAA,CAAA;AACJ,IAAO,MAAA,IAAA,GAAA,QAAY,CAAQ,MAAA;AAAA,MAC5B,IAAA,EAAA,CAAA;AAED,MAAM,OAAA,CAAA,EAAA,GAAA,IAAA,IAAiC,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,KAAA,CAAA,IAAA,KAAA,IAAA,GAAA,EAAA,GAAA,UAAA,CAAA;AACrC,KAAK,CAAA,CAAA;AAAsB,IAC7B,MAAA,WAAA,GAAA,CAAA,CAAA,KAAA;AACA,MAAA,IAAM,wBAAwB,CAAM;AAClC,KAAK,CAAA;AAAoB,IAC3B,MAAA,qBAAA,GAAA,MAAA;AACA,MAAM,IAAA,CAAA,QAAA,EAAA,KAAA,CAAA,IAAqB,CAA6B,CAAA;AACtD,KAAK,CAAA;AAA0B,IACjC,MAAA,iBAAA,GAAA,CAAA,KAAA,KAAA;AACA,MAAM,IAAA,CAAA,OAAA,EAAA,KAAA,CAAA,IAAoB,EAAkB,KAAA,CAAA,CAAA;AAC1C,KAAA,CAAA;AACE,IAAA,MAAA,iBAAsB,GAAA,CAAA,KAAA,KAAA;AACtB,MAAA,IAAA,EAAA,EAAM,EAAe,EAAA,EAAA,EAAA,EAAA,CAAA;AAAA,MACvB,IAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,QAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA;AACA,QAAM,KAAA,CAAA,eAA2B,EAAA,CAAA;AAAmC,QACtE,KAAA,CAAA,cAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -13,7 +13,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13
13
|
readonly current: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
14
14
|
readonly hiddenExpandIcon: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
15
15
|
}, {
|
|
16
|
-
DEFAULT_ICON: string;
|
|
17
16
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
18
17
|
readonly node: import("../../../utils").EpPropFinalized<(new (...args: any[]) => import("./types").TreeNode) | (() => import("./types").TreeNode) | ((new (...args: any[]) => import("./types").TreeNode) | (() => import("./types").TreeNode))[], unknown, unknown, () => import("../../../utils").Mutable<{
|
|
19
18
|
readonly key: -1;
|
|
@@ -322,7 +322,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
322
322
|
readonly current: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
323
323
|
readonly hiddenExpandIcon: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
324
324
|
}, {
|
|
325
|
-
DEFAULT_ICON: string;
|
|
326
325
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
327
326
|
readonly node: import("../../../utils").EpPropFinalized<(new (...args: any[]) => import("./types").TreeNode) | (() => import("./types").TreeNode) | ((new (...args: any[]) => import("./types").TreeNode) | (() => import("./types").TreeNode))[], unknown, unknown, () => import("../../../utils").Mutable<{
|
|
328
327
|
readonly key: -1;
|