@element-plus/nightly 0.0.20240815 → 0.0.20240817
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.full.js +6 -2
- package/dist/index.full.min.js +3 -3
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +3 -3
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +6 -2
- 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-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.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/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.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/my.js +1 -1
- package/dist/locale/my.min.js +1 -1
- package/dist/locale/my.min.mjs +1 -1
- package/dist/locale/my.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/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.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/button/src/use-button.mjs +4 -0
- package/es/components/button/src/use-button.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown.mjs +1 -1
- package/es/components/index.mjs +4 -4
- package/es/components/input/src/input.d.ts +0 -2
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/pagination/src/components/pager.mjs +210 -17
- package/es/components/pagination/src/components/pager.mjs.map +1 -1
- package/es/components/pagination/src/components/pager2.mjs +17 -210
- package/es/components/pagination/src/components/pager2.mjs.map +1 -1
- package/es/components/pagination/src/components/total.mjs +7 -27
- package/es/components/pagination/src/components/total.mjs.map +1 -1
- package/es/components/pagination/src/components/total2.mjs +27 -7
- package/es/components/pagination/src/components/total2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +2 -2
- package/es/components/popover/src/popover.mjs +1 -1
- package/es/components/steps/index.mjs +2 -2
- package/es/components/steps/src/item.mjs +19 -191
- package/es/components/steps/src/item.mjs.map +1 -1
- package/es/components/steps/src/item2.mjs +191 -19
- package/es/components/steps/src/item2.mjs.map +1 -1
- package/es/components/tabs/index.mjs +1 -1
- package/es/components/tabs/src/tab-bar.mjs +7 -73
- package/es/components/tabs/src/tab-bar.mjs.map +1 -1
- package/es/components/tabs/src/tab-bar2.mjs +73 -7
- package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
- package/es/components/tabs/src/tab-nav.mjs +1 -1
- package/es/components/time-select/index.mjs +2 -2
- package/es/components/time-select/src/time-select.mjs +51 -124
- package/es/components/time-select/src/time-select.mjs.map +1 -1
- package/es/components/time-select/src/time-select2.mjs +124 -51
- package/es/components/time-select/src/time-select2.mjs.map +1 -1
- package/es/components/tooltip/index.mjs +1 -1
- package/es/components/tooltip/src/tooltip.mjs +1 -1
- package/es/components/tooltip/src/tooltip2.mjs +1 -1
- package/es/components/tooltip/src/trigger.mjs +73 -16
- package/es/components/tooltip/src/trigger.mjs.map +1 -1
- package/es/components/tooltip/src/trigger2.mjs +16 -73
- package/es/components/tooltip/src/trigger2.mjs.map +1 -1
- package/es/index.mjs +4 -4
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/button/src/use-button.js +4 -0
- package/lib/components/button/src/use-button.js.map +1 -1
- package/lib/components/dropdown/src/dropdown.js +1 -1
- package/lib/components/index.js +4 -4
- package/lib/components/input/src/input.d.ts +0 -2
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/pagination/src/components/pager.js +210 -17
- package/lib/components/pagination/src/components/pager.js.map +1 -1
- package/lib/components/pagination/src/components/pager2.js +17 -210
- package/lib/components/pagination/src/components/pager2.js.map +1 -1
- package/lib/components/pagination/src/components/total.js +7 -27
- package/lib/components/pagination/src/components/total.js.map +1 -1
- package/lib/components/pagination/src/components/total2.js +27 -7
- package/lib/components/pagination/src/components/total2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +2 -2
- package/lib/components/popover/src/popover.js +1 -1
- package/lib/components/steps/index.js +2 -2
- package/lib/components/steps/src/item.js +19 -191
- package/lib/components/steps/src/item.js.map +1 -1
- package/lib/components/steps/src/item2.js +191 -19
- package/lib/components/steps/src/item2.js.map +1 -1
- package/lib/components/tabs/index.js +1 -1
- package/lib/components/tabs/src/tab-bar.js +7 -73
- package/lib/components/tabs/src/tab-bar.js.map +1 -1
- package/lib/components/tabs/src/tab-bar2.js +73 -7
- package/lib/components/tabs/src/tab-bar2.js.map +1 -1
- package/lib/components/tabs/src/tab-nav.js +1 -1
- package/lib/components/time-select/index.js +2 -2
- package/lib/components/time-select/src/time-select.js +51 -129
- package/lib/components/time-select/src/time-select.js.map +1 -1
- package/lib/components/time-select/src/time-select2.js +129 -51
- package/lib/components/time-select/src/time-select2.js.map +1 -1
- package/lib/components/tooltip/index.js +1 -1
- package/lib/components/tooltip/src/tooltip.js +1 -1
- package/lib/components/tooltip/src/tooltip2.js +1 -1
- package/lib/components/tooltip/src/trigger.js +73 -16
- package/lib/components/tooltip/src/trigger.js.map +1 -1
- package/lib/components/tooltip/src/trigger2.js +16 -73
- package/lib/components/tooltip/src/trigger2.js.map +1 -1
- package/lib/index.js +4 -4
- 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/web-types.json +1 -1
|
@@ -1,214 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import '../../../../hooks/index.mjs';
|
|
4
|
-
import { paginationPagerProps } from './pager.mjs';
|
|
5
|
-
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
|
|
6
|
-
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
|
|
7
|
-
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
|
|
1
|
+
import '../../../../utils/index.mjs';
|
|
2
|
+
import { buildProps } from '../../../../utils/vue/props/runtime.mjs';
|
|
8
3
|
|
|
9
|
-
const
|
|
10
|
-
|
|
4
|
+
const paginationPagerProps = buildProps({
|
|
5
|
+
currentPage: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 1
|
|
8
|
+
},
|
|
9
|
+
pageCount: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
pagerCount: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 7
|
|
16
|
+
},
|
|
17
|
+
disabled: Boolean
|
|
11
18
|
});
|
|
12
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
-
...__default__,
|
|
14
|
-
props: paginationPagerProps,
|
|
15
|
-
emits: ["change"],
|
|
16
|
-
setup(__props, { emit }) {
|
|
17
|
-
const props = __props;
|
|
18
|
-
const nsPager = useNamespace("pager");
|
|
19
|
-
const nsIcon = useNamespace("icon");
|
|
20
|
-
const { t } = useLocale();
|
|
21
|
-
const showPrevMore = ref(false);
|
|
22
|
-
const showNextMore = ref(false);
|
|
23
|
-
const quickPrevHover = ref(false);
|
|
24
|
-
const quickNextHover = ref(false);
|
|
25
|
-
const quickPrevFocus = ref(false);
|
|
26
|
-
const quickNextFocus = ref(false);
|
|
27
|
-
const pagers = computed(() => {
|
|
28
|
-
const pagerCount = props.pagerCount;
|
|
29
|
-
const halfPagerCount = (pagerCount - 1) / 2;
|
|
30
|
-
const currentPage = Number(props.currentPage);
|
|
31
|
-
const pageCount = Number(props.pageCount);
|
|
32
|
-
let showPrevMore2 = false;
|
|
33
|
-
let showNextMore2 = false;
|
|
34
|
-
if (pageCount > pagerCount) {
|
|
35
|
-
if (currentPage > pagerCount - halfPagerCount) {
|
|
36
|
-
showPrevMore2 = true;
|
|
37
|
-
}
|
|
38
|
-
if (currentPage < pageCount - halfPagerCount) {
|
|
39
|
-
showNextMore2 = true;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const array = [];
|
|
43
|
-
if (showPrevMore2 && !showNextMore2) {
|
|
44
|
-
const startPage = pageCount - (pagerCount - 2);
|
|
45
|
-
for (let i = startPage; i < pageCount; i++) {
|
|
46
|
-
array.push(i);
|
|
47
|
-
}
|
|
48
|
-
} else if (!showPrevMore2 && showNextMore2) {
|
|
49
|
-
for (let i = 2; i < pagerCount; i++) {
|
|
50
|
-
array.push(i);
|
|
51
|
-
}
|
|
52
|
-
} else if (showPrevMore2 && showNextMore2) {
|
|
53
|
-
const offset = Math.floor(pagerCount / 2) - 1;
|
|
54
|
-
for (let i = currentPage - offset; i <= currentPage + offset; i++) {
|
|
55
|
-
array.push(i);
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
for (let i = 2; i < pageCount; i++) {
|
|
59
|
-
array.push(i);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return array;
|
|
63
|
-
});
|
|
64
|
-
const prevMoreKls = computed(() => [
|
|
65
|
-
"more",
|
|
66
|
-
"btn-quickprev",
|
|
67
|
-
nsIcon.b(),
|
|
68
|
-
nsPager.is("disabled", props.disabled)
|
|
69
|
-
]);
|
|
70
|
-
const nextMoreKls = computed(() => [
|
|
71
|
-
"more",
|
|
72
|
-
"btn-quicknext",
|
|
73
|
-
nsIcon.b(),
|
|
74
|
-
nsPager.is("disabled", props.disabled)
|
|
75
|
-
]);
|
|
76
|
-
const tabindex = computed(() => props.disabled ? -1 : 0);
|
|
77
|
-
watchEffect(() => {
|
|
78
|
-
const halfPagerCount = (props.pagerCount - 1) / 2;
|
|
79
|
-
showPrevMore.value = false;
|
|
80
|
-
showNextMore.value = false;
|
|
81
|
-
if (props.pageCount > props.pagerCount) {
|
|
82
|
-
if (props.currentPage > props.pagerCount - halfPagerCount) {
|
|
83
|
-
showPrevMore.value = true;
|
|
84
|
-
}
|
|
85
|
-
if (props.currentPage < props.pageCount - halfPagerCount) {
|
|
86
|
-
showNextMore.value = true;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
function onMouseEnter(forward = false) {
|
|
91
|
-
if (props.disabled)
|
|
92
|
-
return;
|
|
93
|
-
if (forward) {
|
|
94
|
-
quickPrevHover.value = true;
|
|
95
|
-
} else {
|
|
96
|
-
quickNextHover.value = true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function onFocus(forward = false) {
|
|
100
|
-
if (forward) {
|
|
101
|
-
quickPrevFocus.value = true;
|
|
102
|
-
} else {
|
|
103
|
-
quickNextFocus.value = true;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function onEnter(e) {
|
|
107
|
-
const target = e.target;
|
|
108
|
-
if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
|
|
109
|
-
const newPage = Number(target.textContent);
|
|
110
|
-
if (newPage !== props.currentPage) {
|
|
111
|
-
emit("change", newPage);
|
|
112
|
-
}
|
|
113
|
-
} else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
|
|
114
|
-
onPagerClick(e);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function onPagerClick(event) {
|
|
118
|
-
const target = event.target;
|
|
119
|
-
if (target.tagName.toLowerCase() === "ul" || props.disabled) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
let newPage = Number(target.textContent);
|
|
123
|
-
const pageCount = props.pageCount;
|
|
124
|
-
const currentPage = props.currentPage;
|
|
125
|
-
const pagerCountOffset = props.pagerCount - 2;
|
|
126
|
-
if (target.className.includes("more")) {
|
|
127
|
-
if (target.className.includes("quickprev")) {
|
|
128
|
-
newPage = currentPage - pagerCountOffset;
|
|
129
|
-
} else if (target.className.includes("quicknext")) {
|
|
130
|
-
newPage = currentPage + pagerCountOffset;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (!Number.isNaN(+newPage)) {
|
|
134
|
-
if (newPage < 1) {
|
|
135
|
-
newPage = 1;
|
|
136
|
-
}
|
|
137
|
-
if (newPage > pageCount) {
|
|
138
|
-
newPage = pageCount;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (newPage !== currentPage) {
|
|
142
|
-
emit("change", newPage);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return (_ctx, _cache) => {
|
|
146
|
-
return openBlock(), createElementBlock("ul", {
|
|
147
|
-
class: normalizeClass(unref(nsPager).b()),
|
|
148
|
-
onClick: onPagerClick,
|
|
149
|
-
onKeyup: withKeys(onEnter, ["enter"])
|
|
150
|
-
}, [
|
|
151
|
-
_ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
|
|
152
|
-
key: 0,
|
|
153
|
-
class: normalizeClass([[
|
|
154
|
-
unref(nsPager).is("active", _ctx.currentPage === 1),
|
|
155
|
-
unref(nsPager).is("disabled", _ctx.disabled)
|
|
156
|
-
], "number"]),
|
|
157
|
-
"aria-current": _ctx.currentPage === 1,
|
|
158
|
-
"aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
|
|
159
|
-
tabindex: unref(tabindex)
|
|
160
|
-
}, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true),
|
|
161
|
-
showPrevMore.value ? (openBlock(), createElementBlock("li", {
|
|
162
|
-
key: 1,
|
|
163
|
-
class: normalizeClass(unref(prevMoreKls)),
|
|
164
|
-
tabindex: unref(tabindex),
|
|
165
|
-
"aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
|
|
166
|
-
onMouseenter: ($event) => onMouseEnter(true),
|
|
167
|
-
onMouseleave: ($event) => quickPrevHover.value = false,
|
|
168
|
-
onFocus: ($event) => onFocus(true),
|
|
169
|
-
onBlur: ($event) => quickPrevFocus.value = false
|
|
170
|
-
}, [
|
|
171
|
-
(quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(DArrowLeft), { key: 0 })) : (openBlock(), createBlock(unref(MoreFilled), { key: 1 }))
|
|
172
|
-
], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
|
|
173
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pagers), (pager) => {
|
|
174
|
-
return openBlock(), createElementBlock("li", {
|
|
175
|
-
key: pager,
|
|
176
|
-
class: normalizeClass([[
|
|
177
|
-
unref(nsPager).is("active", _ctx.currentPage === pager),
|
|
178
|
-
unref(nsPager).is("disabled", _ctx.disabled)
|
|
179
|
-
], "number"]),
|
|
180
|
-
"aria-current": _ctx.currentPage === pager,
|
|
181
|
-
"aria-label": unref(t)("el.pagination.currentPage", { pager }),
|
|
182
|
-
tabindex: unref(tabindex)
|
|
183
|
-
}, toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
|
|
184
|
-
}), 128)),
|
|
185
|
-
showNextMore.value ? (openBlock(), createElementBlock("li", {
|
|
186
|
-
key: 2,
|
|
187
|
-
class: normalizeClass(unref(nextMoreKls)),
|
|
188
|
-
tabindex: unref(tabindex),
|
|
189
|
-
"aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
|
|
190
|
-
onMouseenter: ($event) => onMouseEnter(),
|
|
191
|
-
onMouseleave: ($event) => quickNextHover.value = false,
|
|
192
|
-
onFocus: ($event) => onFocus(),
|
|
193
|
-
onBlur: ($event) => quickNextFocus.value = false
|
|
194
|
-
}, [
|
|
195
|
-
(quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(DArrowRight), { key: 0 })) : (openBlock(), createBlock(unref(MoreFilled), { key: 1 }))
|
|
196
|
-
], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
|
|
197
|
-
_ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
|
|
198
|
-
key: 3,
|
|
199
|
-
class: normalizeClass([[
|
|
200
|
-
unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
|
|
201
|
-
unref(nsPager).is("disabled", _ctx.disabled)
|
|
202
|
-
], "number"]),
|
|
203
|
-
"aria-current": _ctx.currentPage === _ctx.pageCount,
|
|
204
|
-
"aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
|
|
205
|
-
tabindex: unref(tabindex)
|
|
206
|
-
}, toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true)
|
|
207
|
-
], 42, ["onKeyup"]);
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
var Pager = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "pager.vue"]]);
|
|
212
19
|
|
|
213
|
-
export {
|
|
20
|
+
export { paginationPagerProps };
|
|
214
21
|
//# sourceMappingURL=pager2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pager2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/pager.vue"],"sourcesContent":["<template>\n <ul :class=\"nsPager.b()\" @click=\"onPagerClick\" @keyup.enter=\"onEnter\">\n <li\n v-if=\"pageCount > 0\"\n :class=\"[\n nsPager.is('active', currentPage === 1),\n nsPager.is('disabled', disabled),\n ]\"\n class=\"number\"\n :aria-current=\"currentPage === 1\"\n :aria-label=\"t('el.pagination.currentPage', { pager: 1 })\"\n :tabindex=\"tabindex\"\n >\n 1\n </li>\n <li\n v-if=\"showPrevMore\"\n :class=\"prevMoreKls\"\n :tabindex=\"tabindex\"\n :aria-label=\"t('el.pagination.prevPages', { pager: pagerCount - 2 })\"\n @mouseenter=\"onMouseEnter(true)\"\n @mouseleave=\"quickPrevHover = false\"\n @focus=\"onFocus(true)\"\n @blur=\"quickPrevFocus = false\"\n >\n <d-arrow-left v-if=\"(quickPrevHover || quickPrevFocus) && !disabled\" />\n <more-filled v-else />\n </li>\n <li\n v-for=\"pager in pagers\"\n :key=\"pager\"\n :class=\"[\n nsPager.is('active', currentPage === pager),\n nsPager.is('disabled', disabled),\n ]\"\n class=\"number\"\n :aria-current=\"currentPage === pager\"\n :aria-label=\"t('el.pagination.currentPage', { pager })\"\n :tabindex=\"tabindex\"\n >\n {{ pager }}\n </li>\n <li\n v-if=\"showNextMore\"\n :class=\"nextMoreKls\"\n :tabindex=\"tabindex\"\n :aria-label=\"t('el.pagination.nextPages', { pager: pagerCount - 2 })\"\n @mouseenter=\"onMouseEnter()\"\n @mouseleave=\"quickNextHover = false\"\n @focus=\"onFocus()\"\n @blur=\"quickNextFocus = false\"\n >\n <d-arrow-right v-if=\"(quickNextHover || quickNextFocus) && !disabled\" />\n <more-filled v-else />\n </li>\n <li\n v-if=\"pageCount > 1\"\n :class=\"[\n nsPager.is('active', currentPage === pageCount),\n nsPager.is('disabled', disabled),\n ]\"\n class=\"number\"\n :aria-current=\"currentPage === pageCount\"\n :aria-label=\"t('el.pagination.currentPage', { pager: pageCount })\"\n :tabindex=\"tabindex\"\n >\n {{ pageCount }}\n </li>\n </ul>\n</template>\n<script lang=\"ts\" setup>\nimport { computed, ref, watchEffect } from 'vue'\nimport { DArrowLeft, DArrowRight, MoreFilled } from '@element-plus/icons-vue'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { paginationPagerProps } from './pager'\ndefineOptions({\n name: 'ElPaginationPager',\n})\nconst props = defineProps(paginationPagerProps)\nconst emit = defineEmits(['change'])\nconst nsPager = useNamespace('pager')\nconst nsIcon = useNamespace('icon')\nconst { t } = useLocale()\n\nconst showPrevMore = ref(false)\nconst showNextMore = ref(false)\nconst quickPrevHover = ref(false)\nconst quickNextHover = ref(false)\nconst quickPrevFocus = ref(false)\nconst quickNextFocus = ref(false)\nconst pagers = computed(() => {\n const pagerCount = props.pagerCount\n const halfPagerCount = (pagerCount - 1) / 2\n const currentPage = Number(props.currentPage)\n const pageCount = Number(props.pageCount)\n let showPrevMore = false\n let showNextMore = false\n if (pageCount > pagerCount) {\n if (currentPage > pagerCount - halfPagerCount) {\n showPrevMore = true\n }\n if (currentPage < pageCount - halfPagerCount) {\n showNextMore = true\n }\n }\n const array: number[] = []\n if (showPrevMore && !showNextMore) {\n const startPage = pageCount - (pagerCount - 2)\n for (let i = startPage; i < pageCount; i++) {\n array.push(i)\n }\n } else if (!showPrevMore && showNextMore) {\n for (let i = 2; i < pagerCount; i++) {\n array.push(i)\n }\n } else if (showPrevMore && showNextMore) {\n const offset = Math.floor(pagerCount / 2) - 1\n for (let i = currentPage - offset; i <= currentPage + offset; i++) {\n array.push(i)\n }\n } else {\n for (let i = 2; i < pageCount; i++) {\n array.push(i)\n }\n }\n return array\n})\n\nconst prevMoreKls = computed(() => [\n 'more',\n 'btn-quickprev',\n nsIcon.b(),\n nsPager.is('disabled', props.disabled),\n])\nconst nextMoreKls = computed(() => [\n 'more',\n 'btn-quicknext',\n nsIcon.b(),\n nsPager.is('disabled', props.disabled),\n])\n\nconst tabindex = computed(() => (props.disabled ? -1 : 0))\nwatchEffect(() => {\n const halfPagerCount = (props.pagerCount - 1) / 2\n showPrevMore.value = false\n showNextMore.value = false\n if (props.pageCount! > props.pagerCount) {\n if (props.currentPage > props.pagerCount - halfPagerCount) {\n showPrevMore.value = true\n }\n if (props.currentPage < props.pageCount! - halfPagerCount) {\n showNextMore.value = true\n }\n }\n})\nfunction onMouseEnter(forward = false) {\n if (props.disabled) return\n if (forward) {\n quickPrevHover.value = true\n } else {\n quickNextHover.value = true\n }\n}\nfunction onFocus(forward = false) {\n if (forward) {\n quickPrevFocus.value = true\n } else {\n quickNextFocus.value = true\n }\n}\nfunction onEnter(e: UIEvent) {\n const target = e.target as HTMLElement\n if (\n target.tagName.toLowerCase() === 'li' &&\n Array.from(target.classList).includes('number')\n ) {\n const newPage = Number(target.textContent)\n if (newPage !== props.currentPage) {\n emit('change', newPage)\n }\n } else if (\n target.tagName.toLowerCase() === 'li' &&\n Array.from(target.classList).includes('more')\n ) {\n onPagerClick(e)\n }\n}\nfunction onPagerClick(event: UIEvent) {\n const target = event.target as HTMLElement\n if (target.tagName.toLowerCase() === 'ul' || props.disabled) {\n return\n }\n let newPage = Number(target.textContent)\n const pageCount = props.pageCount!\n const currentPage = props.currentPage\n const pagerCountOffset = props.pagerCount - 2\n if (target.className.includes('more')) {\n if (target.className.includes('quickprev')) {\n newPage = currentPage - pagerCountOffset\n } else if (target.className.includes('quicknext')) {\n newPage = currentPage + pagerCountOffset\n }\n }\n if (!Number.isNaN(+newPage)) {\n if (newPage < 1) {\n newPage = 1\n }\n if (newPage > pageCount) {\n newPage = pageCount\n }\n }\n if (newPage !== currentPage) {\n emit('change', newPage)\n }\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;mCA2Ec,CAAA;AAAA,EACZ,IAAM,EAAA,mBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAGA,IAAM,MAAA,OAAA,GAAU,aAAa,OAAO,CAAA,CAAA;AACpC,IAAM,MAAA,MAAA,GAAS,aAAa,MAAM,CAAA,CAAA;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AAA,IAAA,MAAA,CAAO,SAAU,CAAA,QAAA,CAAS,WAAW,CAAG,EAAA;AACjD,UAAA,OAAA,GAAU,WAAc,GAAA,gBAAA,CAAA;AAAA,SAC1B;AAAA,OACF;AACA,MAAA,IAAI,CAAC,MAAA,CAAO,KAAM,CAAA,CAAC,OAAO,CAAG,EAAA;AAC3B,QAAA,IAAI,UAAU,CAAG,EAAA;AACf,UAAU,OAAA,GAAA,CAAA,CAAA;AAAA,SACZ;AACA,QAAA,IAAI,UAAU,SAAW,EAAA;AACvB,UAAU,OAAA,GAAA,SAAA,CAAA;AAAA,SACZ;AAAA,OACF;AACA,MAAA,IAAI,YAAY,WAAa,EAAA;AAC3B,QAAA,IAAA,CAAK,UAAU,OAAO,CAAA,CAAA;AAAA,OACxB;AAAA,KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"pager2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/pager.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Pager from './pager.vue'\n\nexport const paginationPagerProps = buildProps({\n currentPage: {\n type: Number,\n default: 1,\n },\n pageCount: {\n type: Number,\n required: true,\n },\n pagerCount: {\n type: Number,\n default: 7,\n },\n disabled: Boolean,\n} as const)\n\nexport type PaginationPagerProps = ExtractPropTypes<typeof paginationPagerProps>\n\nexport type PagerInstance = InstanceType<typeof Pager>\n"],"names":[],"mappings":";;;AACY,MAAC,oBAAoB,GAAG,UAAU,CAAC;AAC/C,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,CAAC;;;;"}
|
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '../../../../
|
|
3
|
-
import { usePagination } from '../usePagination.mjs';
|
|
4
|
-
import { paginationTotalProps } from './total2.mjs';
|
|
5
|
-
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
|
|
6
|
-
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
|
|
7
|
-
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
|
|
1
|
+
import '../../../../utils/index.mjs';
|
|
2
|
+
import { buildProps } from '../../../../utils/vue/props/runtime.mjs';
|
|
8
3
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...__default__,
|
|
14
|
-
props: paginationTotalProps,
|
|
15
|
-
setup(__props) {
|
|
16
|
-
const { t } = useLocale();
|
|
17
|
-
const ns = useNamespace("pagination");
|
|
18
|
-
const { disabled } = usePagination();
|
|
19
|
-
return (_ctx, _cache) => {
|
|
20
|
-
return openBlock(), createElementBlock("span", {
|
|
21
|
-
class: normalizeClass(unref(ns).e("total")),
|
|
22
|
-
disabled: unref(disabled)
|
|
23
|
-
}, toDisplayString(unref(t)("el.pagination.total", {
|
|
24
|
-
total: _ctx.total
|
|
25
|
-
})), 11, ["disabled"]);
|
|
26
|
-
};
|
|
4
|
+
const paginationTotalProps = buildProps({
|
|
5
|
+
total: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 1e3
|
|
27
8
|
}
|
|
28
9
|
});
|
|
29
|
-
var Total = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "total.vue"]]);
|
|
30
10
|
|
|
31
|
-
export {
|
|
11
|
+
export { paginationTotalProps };
|
|
32
12
|
//# sourceMappingURL=total.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"total.mjs","sources":["../../../../../../../packages/components/pagination/src/components/total.
|
|
1
|
+
{"version":3,"file":"total.mjs","sources":["../../../../../../../packages/components/pagination/src/components/total.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type Total from './total.vue'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const paginationTotalProps = buildProps({\n total: {\n type: Number,\n default: 1000,\n },\n} as const)\n\nexport type PaginationTotalProps = ExtractPropTypes<typeof paginationTotalProps>\n\nexport type TotalInstance = InstanceType<typeof Total>\n"],"names":[],"mappings":";;;AACY,MAAC,oBAAoB,GAAG,UAAU,CAAC;AAC/C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,CAAC;;;;"}
|
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, toDisplayString } from 'vue';
|
|
2
|
+
import '../../../../hooks/index.mjs';
|
|
3
|
+
import { usePagination } from '../usePagination.mjs';
|
|
4
|
+
import { paginationTotalProps } from './total.mjs';
|
|
5
|
+
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
|
|
6
|
+
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
|
|
7
|
+
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
|
|
3
8
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const __default__ = defineComponent({
|
|
10
|
+
name: "ElPaginationTotal"
|
|
11
|
+
});
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
...__default__,
|
|
14
|
+
props: paginationTotalProps,
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const { t } = useLocale();
|
|
17
|
+
const ns = useNamespace("pagination");
|
|
18
|
+
const { disabled } = usePagination();
|
|
19
|
+
return (_ctx, _cache) => {
|
|
20
|
+
return openBlock(), createElementBlock("span", {
|
|
21
|
+
class: normalizeClass(unref(ns).e("total")),
|
|
22
|
+
disabled: unref(disabled)
|
|
23
|
+
}, toDisplayString(unref(t)("el.pagination.total", {
|
|
24
|
+
total: _ctx.total
|
|
25
|
+
})), 11, ["disabled"]);
|
|
26
|
+
};
|
|
8
27
|
}
|
|
9
28
|
});
|
|
29
|
+
var Total = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "total.vue"]]);
|
|
10
30
|
|
|
11
|
-
export {
|
|
31
|
+
export { Total as default };
|
|
12
32
|
//# sourceMappingURL=total2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"total2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/total.
|
|
1
|
+
{"version":3,"file":"total2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/total.vue"],"sourcesContent":["<template>\n <span :class=\"ns.e('total')\" :disabled=\"disabled\">\n {{\n t('el.pagination.total', {\n total,\n })\n }}\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { usePagination } from '../usePagination'\nimport { paginationTotalProps } from './total'\n\nconst { t } = useLocale()\nconst ns = useNamespace('pagination')\nconst { disabled } = usePagination()\n\ndefineOptions({\n name: 'ElPaginationTotal',\n})\n\ndefineProps(paginationTotalProps)\n</script>\n"],"names":[],"mappings":";;;;;;;;mCAmBc,CAAA;AAAA,EACZ,IAAM,EAAA,mBAAA;AACR,CAAA,CAAA,CAAA;;;;;AANA,IAAM,MAAA,EAAE,MAAM,SAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAK,aAAa,YAAY,CAAA,CAAA;AACpC,IAAM,MAAA,EAAE,aAAa,aAAc,EAAA,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -7,8 +7,8 @@ import Prev from './components/prev2.mjs';
|
|
|
7
7
|
import Next from './components/next2.mjs';
|
|
8
8
|
import Sizes from './components/sizes2.mjs';
|
|
9
9
|
import Jumper from './components/jumper2.mjs';
|
|
10
|
-
import Total from './components/
|
|
11
|
-
import Pager from './components/
|
|
10
|
+
import Total from './components/total2.mjs';
|
|
11
|
+
import Pager from './components/pager.mjs';
|
|
12
12
|
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
13
13
|
import { isNumber } from '../../../utils/types.mjs';
|
|
14
14
|
import { mutable } from '../../../utils/typescript.mjs';
|
|
@@ -2,7 +2,7 @@ import '../../../utils/index.mjs';
|
|
|
2
2
|
import '../../tooltip/index.mjs';
|
|
3
3
|
import '../../dropdown/index.mjs';
|
|
4
4
|
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
5
|
-
import { useTooltipTriggerProps } from '../../tooltip/src/
|
|
5
|
+
import { useTooltipTriggerProps } from '../../tooltip/src/trigger2.mjs';
|
|
6
6
|
import { dropdownProps } from '../../dropdown/src/dropdown.mjs';
|
|
7
7
|
import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
|
|
8
8
|
import { isBoolean } from '../../../utils/types.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
2
|
import Steps from './src/steps2.mjs';
|
|
3
|
-
import Step from './src/
|
|
4
|
-
export { stepProps } from './src/
|
|
3
|
+
import Step from './src/item2.mjs';
|
|
4
|
+
export { stepProps } from './src/item.mjs';
|
|
5
5
|
export { stepsEmits, stepsProps } from './src/steps.mjs';
|
|
6
6
|
import { withInstall, withNoopInstall } from '../../utils/vue/install.mjs';
|
|
7
7
|
|
|
@@ -1,197 +1,25 @@
|
|
|
1
|
-
import { defineComponent, ref, inject, getCurrentInstance, onMounted, watch, onBeforeUnmount, computed, reactive, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createCommentVNode, createElementVNode, renderSlot, createBlock, withCtx, resolveDynamicComponent, createVNode, toDisplayString, createTextVNode } from 'vue';
|
|
2
|
-
import '../../../hooks/index.mjs';
|
|
3
|
-
import { ElIcon } from '../../icon/index.mjs';
|
|
4
|
-
import { Check, Close } from '@element-plus/icons-vue';
|
|
5
1
|
import '../../../utils/index.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
9
|
-
import { isNumber } from '../../../utils/types.mjs';
|
|
2
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
3
|
+
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
|
10
4
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
() => parent.props.active,
|
|
28
|
-
() => parent.props.processStatus,
|
|
29
|
-
() => parent.props.finishStatus
|
|
30
|
-
], ([active]) => {
|
|
31
|
-
updateStatus(active);
|
|
32
|
-
}, { immediate: true });
|
|
33
|
-
});
|
|
34
|
-
onBeforeUnmount(() => {
|
|
35
|
-
parent.removeStep(stepItemState.uid);
|
|
36
|
-
});
|
|
37
|
-
const currentStatus = computed(() => {
|
|
38
|
-
return props.status || internalStatus.value;
|
|
39
|
-
});
|
|
40
|
-
const prevStatus = computed(() => {
|
|
41
|
-
const prevStep = parent.steps.value[index.value - 1];
|
|
42
|
-
return prevStep ? prevStep.currentStatus : "wait";
|
|
43
|
-
});
|
|
44
|
-
const isCenter = computed(() => {
|
|
45
|
-
return parent.props.alignCenter;
|
|
46
|
-
});
|
|
47
|
-
const isVertical = computed(() => {
|
|
48
|
-
return parent.props.direction === "vertical";
|
|
49
|
-
});
|
|
50
|
-
const isSimple = computed(() => {
|
|
51
|
-
return parent.props.simple;
|
|
52
|
-
});
|
|
53
|
-
const stepsCount = computed(() => {
|
|
54
|
-
return parent.steps.value.length;
|
|
55
|
-
});
|
|
56
|
-
const isLast = computed(() => {
|
|
57
|
-
var _a;
|
|
58
|
-
return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
|
|
59
|
-
});
|
|
60
|
-
const space = computed(() => {
|
|
61
|
-
return isSimple.value ? "" : parent.props.space;
|
|
62
|
-
});
|
|
63
|
-
const containerKls = computed(() => {
|
|
64
|
-
return [
|
|
65
|
-
ns.b(),
|
|
66
|
-
ns.is(isSimple.value ? "simple" : parent.props.direction),
|
|
67
|
-
ns.is("flex", isLast.value && !space.value && !isCenter.value),
|
|
68
|
-
ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
|
|
69
|
-
];
|
|
70
|
-
});
|
|
71
|
-
const style = computed(() => {
|
|
72
|
-
const style2 = {
|
|
73
|
-
flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
|
|
74
|
-
};
|
|
75
|
-
if (isVertical.value)
|
|
76
|
-
return style2;
|
|
77
|
-
if (isLast.value) {
|
|
78
|
-
style2.maxWidth = `${100 / stepsCount.value}%`;
|
|
79
|
-
}
|
|
80
|
-
return style2;
|
|
81
|
-
});
|
|
82
|
-
const setIndex = (val) => {
|
|
83
|
-
index.value = val;
|
|
84
|
-
};
|
|
85
|
-
const calcProgress = (status) => {
|
|
86
|
-
const isWait = status === "wait";
|
|
87
|
-
const style2 = {
|
|
88
|
-
transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
|
|
89
|
-
};
|
|
90
|
-
const step = status === parent.props.processStatus || isWait ? 0 : 100;
|
|
91
|
-
style2.borderWidth = step && !isSimple.value ? "1px" : 0;
|
|
92
|
-
style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
|
|
93
|
-
lineStyle.value = style2;
|
|
94
|
-
};
|
|
95
|
-
const updateStatus = (activeIndex) => {
|
|
96
|
-
if (activeIndex > index.value) {
|
|
97
|
-
internalStatus.value = parent.props.finishStatus;
|
|
98
|
-
} else if (activeIndex === index.value && prevStatus.value !== "error") {
|
|
99
|
-
internalStatus.value = parent.props.processStatus;
|
|
100
|
-
} else {
|
|
101
|
-
internalStatus.value = "wait";
|
|
102
|
-
}
|
|
103
|
-
const prevChild = parent.steps.value[index.value - 1];
|
|
104
|
-
if (prevChild)
|
|
105
|
-
prevChild.calcProgress(internalStatus.value);
|
|
106
|
-
};
|
|
107
|
-
const stepItemState = reactive({
|
|
108
|
-
uid: currentInstance.uid,
|
|
109
|
-
currentStatus,
|
|
110
|
-
setIndex,
|
|
111
|
-
calcProgress
|
|
112
|
-
});
|
|
113
|
-
parent.addStep(stepItemState);
|
|
114
|
-
return (_ctx, _cache) => {
|
|
115
|
-
return openBlock(), createElementBlock("div", {
|
|
116
|
-
style: normalizeStyle(unref(style)),
|
|
117
|
-
class: normalizeClass(unref(containerKls))
|
|
118
|
-
}, [
|
|
119
|
-
createCommentVNode(" icon & line "),
|
|
120
|
-
createElementVNode("div", {
|
|
121
|
-
class: normalizeClass([unref(ns).e("head"), unref(ns).is(unref(currentStatus))])
|
|
122
|
-
}, [
|
|
123
|
-
!unref(isSimple) ? (openBlock(), createElementBlock("div", {
|
|
124
|
-
key: 0,
|
|
125
|
-
class: normalizeClass(unref(ns).e("line"))
|
|
126
|
-
}, [
|
|
127
|
-
createElementVNode("i", {
|
|
128
|
-
class: normalizeClass(unref(ns).e("line-inner")),
|
|
129
|
-
style: normalizeStyle(lineStyle.value)
|
|
130
|
-
}, null, 6)
|
|
131
|
-
], 2)) : createCommentVNode("v-if", true),
|
|
132
|
-
createElementVNode("div", {
|
|
133
|
-
class: normalizeClass([unref(ns).e("icon"), unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
|
|
134
|
-
}, [
|
|
135
|
-
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
136
|
-
_ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
137
|
-
key: 0,
|
|
138
|
-
class: normalizeClass(unref(ns).e("icon-inner"))
|
|
139
|
-
}, {
|
|
140
|
-
default: withCtx(() => [
|
|
141
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
142
|
-
]),
|
|
143
|
-
_: 1
|
|
144
|
-
}, 8, ["class"])) : unref(currentStatus) === "success" ? (openBlock(), createBlock(unref(ElIcon), {
|
|
145
|
-
key: 1,
|
|
146
|
-
class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
|
|
147
|
-
}, {
|
|
148
|
-
default: withCtx(() => [
|
|
149
|
-
createVNode(unref(Check))
|
|
150
|
-
]),
|
|
151
|
-
_: 1
|
|
152
|
-
}, 8, ["class"])) : unref(currentStatus) === "error" ? (openBlock(), createBlock(unref(ElIcon), {
|
|
153
|
-
key: 2,
|
|
154
|
-
class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
|
|
155
|
-
}, {
|
|
156
|
-
default: withCtx(() => [
|
|
157
|
-
createVNode(unref(Close))
|
|
158
|
-
]),
|
|
159
|
-
_: 1
|
|
160
|
-
}, 8, ["class"])) : !unref(isSimple) ? (openBlock(), createElementBlock("div", {
|
|
161
|
-
key: 3,
|
|
162
|
-
class: normalizeClass(unref(ns).e("icon-inner"))
|
|
163
|
-
}, toDisplayString(index.value + 1), 3)) : createCommentVNode("v-if", true)
|
|
164
|
-
])
|
|
165
|
-
], 2)
|
|
166
|
-
], 2),
|
|
167
|
-
createCommentVNode(" title & description "),
|
|
168
|
-
createElementVNode("div", {
|
|
169
|
-
class: normalizeClass(unref(ns).e("main"))
|
|
170
|
-
}, [
|
|
171
|
-
createElementVNode("div", {
|
|
172
|
-
class: normalizeClass([unref(ns).e("title"), unref(ns).is(unref(currentStatus))])
|
|
173
|
-
}, [
|
|
174
|
-
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
175
|
-
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
176
|
-
])
|
|
177
|
-
], 2),
|
|
178
|
-
unref(isSimple) ? (openBlock(), createElementBlock("div", {
|
|
179
|
-
key: 0,
|
|
180
|
-
class: normalizeClass(unref(ns).e("arrow"))
|
|
181
|
-
}, null, 2)) : (openBlock(), createElementBlock("div", {
|
|
182
|
-
key: 1,
|
|
183
|
-
class: normalizeClass([unref(ns).e("description"), unref(ns).is(unref(currentStatus))])
|
|
184
|
-
}, [
|
|
185
|
-
renderSlot(_ctx.$slots, "description", {}, () => [
|
|
186
|
-
createTextVNode(toDisplayString(_ctx.description), 1)
|
|
187
|
-
])
|
|
188
|
-
], 2))
|
|
189
|
-
], 2)
|
|
190
|
-
], 6);
|
|
191
|
-
};
|
|
5
|
+
const stepProps = buildProps({
|
|
6
|
+
title: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: ""
|
|
9
|
+
},
|
|
10
|
+
icon: {
|
|
11
|
+
type: iconPropType
|
|
12
|
+
},
|
|
13
|
+
description: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
status: {
|
|
18
|
+
type: String,
|
|
19
|
+
values: ["", "wait", "process", "finish", "error", "success"],
|
|
20
|
+
default: ""
|
|
192
21
|
}
|
|
193
22
|
});
|
|
194
|
-
var Step = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "item.vue"]]);
|
|
195
23
|
|
|
196
|
-
export {
|
|
24
|
+
export { stepProps };
|
|
197
25
|
//# sourceMappingURL=item.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.mjs","sources":["../../../../../../packages/components/steps/src/item.vue"],"sourcesContent":["<template>\n <div :style=\"style\" :class=\"containerKls\">\n <!-- icon & line -->\n <div :class=\"[ns.e('head'), ns.is(currentStatus)]\">\n <div v-if=\"!isSimple\" :class=\"ns.e('line')\">\n <i :class=\"ns.e('line-inner')\" :style=\"lineStyle\" />\n </div>\n\n <div\n :class=\"[ns.e('icon'), ns.is(icon || $slots.icon ? 'icon' : 'text')]\"\n >\n <slot name=\"icon\">\n <el-icon v-if=\"icon\" :class=\"ns.e('icon-inner')\">\n <component :is=\"icon\" />\n </el-icon>\n <el-icon\n v-else-if=\"currentStatus === 'success'\"\n :class=\"[ns.e('icon-inner'), ns.is('status')]\"\n >\n <Check />\n </el-icon>\n <el-icon\n v-else-if=\"currentStatus === 'error'\"\n :class=\"[ns.e('icon-inner'), ns.is('status')]\"\n >\n <Close />\n </el-icon>\n <div v-else-if=\"!isSimple\" :class=\"ns.e('icon-inner')\">\n {{ index + 1 }}\n </div>\n </slot>\n </div>\n </div>\n <!-- title & description -->\n <div :class=\"ns.e('main')\">\n <div :class=\"[ns.e('title'), ns.is(currentStatus)]\">\n <slot name=\"title\">{{ title }}</slot>\n </div>\n <div v-if=\"isSimple\" :class=\"ns.e('arrow')\" />\n <div v-else :class=\"[ns.e('description'), ns.is(currentStatus)]\">\n <slot name=\"description\">{{ description }}</slot>\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n getCurrentInstance,\n inject,\n onBeforeUnmount,\n onMounted,\n reactive,\n ref,\n watch,\n} from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Check, Close } from '@element-plus/icons-vue'\nimport { isNumber } from '@element-plus/utils'\nimport { stepProps } from './item'\n\nimport type { CSSProperties, Ref } from 'vue'\n\nexport interface IStepsProps {\n space: number | string\n active: number\n direction: string\n alignCenter: boolean\n simple: boolean\n finishStatus: string\n processStatus: string\n}\n\nexport interface StepItemState {\n uid: number\n currentStatus: string\n setIndex: (val: number) => void\n calcProgress: (status: string) => void\n}\n\nexport interface IStepsInject {\n props: IStepsProps\n steps: Ref<StepItemState[]>\n addStep: (item: StepItemState) => void\n removeStep: (uid: number) => void\n}\n\ndefineOptions({\n name: 'ElStep',\n})\n\nconst props = defineProps(stepProps)\nconst ns = useNamespace('step')\nconst index = ref(-1)\nconst lineStyle = ref({})\nconst internalStatus = ref('')\nconst parent = inject('ElSteps') as IStepsInject\nconst currentInstance = getCurrentInstance()\n\nonMounted(() => {\n watch(\n [\n () => parent.props.active,\n () => parent.props.processStatus,\n () => parent.props.finishStatus,\n ],\n ([active]) => {\n updateStatus(active)\n },\n { immediate: true }\n )\n})\n\nonBeforeUnmount(() => {\n parent.removeStep(stepItemState.uid)\n})\n\nconst currentStatus = computed(() => {\n return props.status || internalStatus.value\n})\n\nconst prevStatus = computed(() => {\n const prevStep = parent.steps.value[index.value - 1]\n return prevStep ? prevStep.currentStatus : 'wait'\n})\n\nconst isCenter = computed(() => {\n return parent.props.alignCenter\n})\n\nconst isVertical = computed(() => {\n return parent.props.direction === 'vertical'\n})\n\nconst isSimple = computed(() => {\n return parent.props.simple\n})\n\nconst stepsCount = computed(() => {\n return parent.steps.value.length\n})\n\nconst isLast = computed(() => {\n return parent.steps.value[stepsCount.value - 1]?.uid === currentInstance?.uid\n})\n\nconst space = computed(() => {\n return isSimple.value ? '' : parent.props.space\n})\n\nconst containerKls = computed(() => {\n return [\n ns.b(),\n ns.is(isSimple.value ? 'simple' : parent.props.direction),\n ns.is('flex', isLast.value && !space.value && !isCenter.value),\n ns.is('center', isCenter.value && !isVertical.value && !isSimple.value),\n ]\n})\n\nconst style = computed(() => {\n const style: CSSProperties = {\n flexBasis: isNumber(space.value)\n ? `${space.value}px`\n : space.value\n ? space.value\n : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`,\n }\n if (isVertical.value) return style\n if (isLast.value) {\n style.maxWidth = `${100 / stepsCount.value}%`\n }\n return style\n})\n\nconst setIndex = (val: number) => {\n index.value = val\n}\n\nconst calcProgress = (status: string) => {\n const isWait = status === 'wait'\n const style: CSSProperties = {\n transitionDelay: `${isWait ? '-' : ''}${150 * index.value}ms`,\n }\n const step = status === parent.props.processStatus || isWait ? 0 : 100\n\n style.borderWidth = step && !isSimple.value ? '1px' : 0\n style[parent.props.direction === 'vertical' ? 'height' : 'width'] = `${step}%`\n lineStyle.value = style\n}\n\nconst updateStatus = (activeIndex: number) => {\n if (activeIndex > index.value) {\n internalStatus.value = parent.props.finishStatus\n } else if (activeIndex === index.value && prevStatus.value !== 'error') {\n internalStatus.value = parent.props.processStatus\n } else {\n internalStatus.value = 'wait'\n }\n const prevChild = parent.steps.value[index.value - 1]\n if (prevChild) prevChild.calcProgress(internalStatus.value)\n}\n\nconst stepItemState = reactive({\n uid: currentInstance!.uid,\n currentStatus,\n setIndex,\n calcProgress,\n})\n\nparent.addStep(stepItemState)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;mCAyFc,CAAA;AAAA,EACZ,IAAM,EAAA,QAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAGA,IAAM,MAAA,EAAA,GAAK,aAAa,MAAM,CAAA,CAAA;AAC9B,IAAM,MAAA,KAAA,GAAQ,IAAI,CAAE,CAAA,CAAA,CAAA;AACpB,IAAM,MAAA,SAAA,GAAY,GAAI,CAAA,EAAE,CAAA,CAAA;AACxB,IAAM,MAAA,cAAA,GAAiB,IAAI,EAAE,CAAA,CAAA;AAC7B,IAAM,MAAA,MAAA,GAAS,OAAO,SAAS,CAAA,CAAA;AAC/B,IAAA,MAAM,kBAAkB,kBAAmB,EAAA,CAAA;AAE3C,IAAA,SAAA,CAAU,MAAM;AACd,MACE,KAAA,CAAA;AAAA,QACE,MAAM,OAAO,KAAM,CAAA,MAAA;AAAA,QACnB,MAAM,OAAO,KAAM,CAAA,aAAA;AAAA,QACnB,MAAM,OAAO,KAAM,CAAA,YAAA;AAAA,OACrB,EACA,CAAC,CAAC,MAAY,CAAA,KAAA;AACZ,QAAA,YAAA,CAAa,MAAM,CAAA,CAAA;AAAA,OAErB,EAAA,EAAE,SAAW,EAAA,IAAA,EACf,CAAA,CAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,eAAA,CAAgB,MAAM;AACpB,MAAO,MAAA,CAAA,UAAA,CAAW,cAAc,GAAG,CAAA,CAAA;AAAA,KACpC,CAAA,CAAA;AAED,IAAM,MAAA,aAAA,GAAgB,SAAS,MAAM;AACnC,MA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AAA,KAAA,CAAA,KAAA,CAAA,KAAA,GAAA,CAAA,CAAA,CAAA;AAAW,MAAU,IAAA,SAAA;AAAiC,QAC5D,SAAA,CAAA,YAAA,CAAA,cAAA,CAAA,KAAA,CAAA,CAAA;AAEA,KAAA,CAAA;AAA+B,IAAA,mBACP,GAAA,QAAA,CAAA;AAAA,MACtB,GAAA,EAAA,eAAA,CAAA,GAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACD,YAAA;AAED,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"item.mjs","sources":["../../../../../../packages/components/steps/src/item.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\nimport type Step from './item.vue'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const stepProps = buildProps({\n /**\n * @description step title\n */\n title: {\n type: String,\n default: '',\n },\n /**\n * @description step custom icon. Icons can be passed via named slot as well\n */\n icon: {\n type: iconPropType,\n },\n /**\n * @description step description\n */\n description: {\n type: String,\n default: '',\n },\n /**\n * @description current status. It will be automatically set by Steps if not configured.\n */\n status: {\n type: String,\n values: ['', 'wait', 'process', 'finish', 'error', 'success'],\n default: '',\n },\n} as const)\n\nexport type StepProps = ExtractPropTypes<typeof stepProps>\n\nexport type StepInstance = InstanceType<typeof Step>\n"],"names":[],"mappings":";;;;AACY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;AACjE,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC;;;;"}
|