@wfrog/vc-ui 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/es/chunk/{OEa4tYPF.mjs → -ga82G_B.mjs} +1 -1
- package/dist/es/chunk/B1BnPYNG.mjs +163 -0
- package/dist/es/chunk/{DFOLES4O.mjs → BA2yoAwy.mjs} +403 -502
- package/dist/es/chunk/{BpqBBo4z.mjs → BDyXj_90.mjs} +2 -2
- package/dist/es/chunk/{BI0vrXwX.mjs → BI-fNJhk.mjs} +6 -3
- package/dist/es/chunk/{BsGCX4td.mjs → BK4T_2ha.mjs} +1 -1
- package/dist/es/chunk/{73YgKz3H.mjs → BLLKi_0v.mjs} +1 -1
- package/dist/es/chunk/{DTLPXrjb.mjs → BTsEMnf_.mjs} +1 -1
- package/dist/es/chunk/{B5UQmWXg.mjs → BUf50Y7Y.mjs} +41 -21
- package/dist/es/chunk/{BzedaLtg.mjs → BYVaz5Or.mjs} +2 -2
- package/dist/es/chunk/BaJ7k5Lg.mjs +209 -0
- package/dist/es/chunk/{Bp9jXKX0.mjs → BambM7zX.mjs} +2 -2
- package/dist/es/chunk/{CizMbf5K.mjs → Bl0WQiki.mjs} +1 -1
- package/dist/es/chunk/{CLbj8G-F.mjs → Bnot0Gwc.mjs} +12 -4
- package/dist/es/chunk/{4eyJqDa9.mjs → BoGGHTrJ.mjs} +4 -2
- package/dist/es/chunk/C7Dgjpd1.mjs +242 -0
- package/dist/es/chunk/{D0LB3gF-.mjs → CKbkzlkO.mjs} +104 -72
- package/dist/es/chunk/{DrgvuOYH.mjs → CL5WTCB3.mjs} +4 -2
- package/dist/es/chunk/{XwSiBVsA.mjs → CM_I1FoA.mjs} +2 -2
- package/dist/es/chunk/{DouIsSPi.mjs → CNILa-hz.mjs} +1 -1
- package/dist/es/chunk/{DRoyW749.mjs → CcKUdl3e.mjs} +12 -6
- package/dist/es/chunk/CidLkmft.mjs +188 -0
- package/dist/es/chunk/{HAog8AWU.mjs → CitH0taR.mjs} +816 -539
- package/dist/es/chunk/{Cu6erWl4.mjs → CzqeSQn4.mjs} +73 -38
- package/dist/es/chunk/{CLCfXfvv.mjs → D7JQbDFE.mjs} +154 -118
- package/dist/es/chunk/{DaCDeO95.mjs → D9iEroQw.mjs} +1 -207
- package/dist/es/chunk/{cPBw23yt.mjs → DEPZhJ0Z.mjs} +21 -16
- package/dist/es/chunk/{CPERtDRX.mjs → DHpbQMGk.mjs} +32 -22
- package/dist/es/chunk/{BHsNc7jl.mjs → DKpRXDRE.mjs} +82 -55
- package/dist/es/chunk/{CLMc8GzD.mjs → DMYHOxhk.mjs} +462 -311
- package/dist/es/chunk/{CBSopeeE.mjs → DQHGjqG5.mjs} +9 -4
- package/dist/es/chunk/DTEM_vYZ.mjs +23 -0
- package/dist/es/chunk/{NQBKROII.mjs → DWcIzeMM.mjs} +1 -1
- package/dist/es/chunk/{FHvLvzEB.mjs → DX38FfmL.mjs} +1088 -697
- package/dist/es/chunk/{DZD-YnCt.mjs → Dcm-lOj8.mjs} +4 -4
- package/dist/es/chunk/{09Ec85_u.mjs → DdmNdV7I.mjs} +398 -278
- package/dist/es/chunk/{f0-vIQGp.mjs → DfHTA5LW.mjs} +3 -3
- package/dist/es/chunk/DgFT6snA.mjs +835 -0
- package/dist/es/chunk/{DwKWIlzw.mjs → DgSzI6Fw.mjs} +106 -71
- package/dist/es/chunk/{BcTuAX8r.mjs → Dsye5ZEp.mjs} +5 -3
- package/dist/es/chunk/{BsLJxiSC.mjs → Dw-yyl2m.mjs} +1 -1
- package/dist/es/chunk/{DXPWe_a5.mjs → U13Qpiki.mjs} +19 -13
- package/dist/es/chunk/{axpwSky6.mjs → _8u_XVHh.mjs} +168 -120
- package/dist/es/chunk/egk9EEzo.mjs +66 -0
- package/dist/es/chunk/{BUEEWLrd.mjs → ezK_XQQd.mjs} +15 -6
- package/dist/es/chunk/{Bl2KlMdP.mjs → oW98L-44.mjs} +8 -3
- package/dist/es/chunk/{Dk6Bx0KT.mjs → plK2vnjp.mjs} +8 -5
- package/dist/es/components/awesome-icon/awesome-icon.mjs +2 -1
- package/dist/es/components/backbottom/backbottom.mjs +2 -2
- package/dist/es/components/button/button.mjs +105 -76
- package/dist/es/components/choice/choice.mjs +2 -2
- package/dist/es/components/config-provider/config-provider.d.ts +1 -0
- package/dist/es/components/config-provider/config-provider.mjs +13 -5
- package/dist/es/components/cropper/cropper.mjs +44 -33
- package/dist/es/components/currency/currency.mjs +5 -5
- package/dist/es/components/daterange-picker/daterange-picker.mjs +2267 -1522
- package/dist/es/components/dialog/dialog.mjs +213 -172
- package/dist/es/components/dialog/index.css +1 -1
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +11 -11
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +5 -4
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +495 -314
- package/dist/es/components/dialog-upload-images/index.css +1 -1
- package/dist/es/components/drag-verify/drag-verify.mjs +3 -3
- package/dist/es/components/drawer/drawer.mjs +136 -94
- package/dist/es/components/drawer/index.css +1 -1
- package/dist/es/components/easy-pagination/easy-pagination.mjs +2 -2
- package/dist/es/components/el-icon/el-icon.mjs +1 -1
- package/dist/es/components/el-icon/index.css +3 -2
- package/dist/es/components/flag/flag.mjs +2 -1
- package/dist/es/components/icon/icon.mjs +10 -31
- package/dist/es/components/icon/icon.vue.d.ts +1 -1
- package/dist/es/components/icon/icon2.mjs +1 -1
- package/dist/es/components/icon/index.mjs +2 -2
- package/dist/es/components/icon-picker/components/collections.vue.d.ts +625 -0
- package/dist/es/components/icon-picker/components/panel.vue.d.ts +9 -0
- package/dist/es/components/icon-picker/icon-picker.d.ts +40 -0
- package/dist/es/components/icon-picker/icon-picker.mjs +1375 -0
- package/dist/es/components/icon-picker/icon-picker.vue.d.ts +9 -0
- package/dist/es/components/icon-picker/index.css +121 -0
- package/dist/es/components/icon-picker/index.d.ts +4 -0
- package/dist/es/components/icon-picker/index.mjs +6 -0
- package/dist/es/components/iconify-icon/iconify-icon.d.ts +5 -0
- package/dist/es/components/iconify-icon/iconify-icon.mjs +1860 -0
- package/dist/es/components/iconify-icon/iconify-icon.vue.d.ts +6 -0
- package/dist/es/components/iconify-icon/index.css +11 -0
- package/dist/es/components/iconify-icon/index.d.ts +4 -0
- package/dist/es/components/iconify-icon/index.mjs +6 -0
- package/dist/es/components/image/image.mjs +5 -5
- package/dist/es/components/input/input.mjs +4 -4
- package/dist/es/components/input/input.vue.d.ts +63 -54
- package/dist/es/components/input-number/input-number.mjs +5 -5
- package/dist/es/components/pca-picker/components/c.vue.d.ts +4 -4
- package/dist/es/components/pca-picker/index.css +1 -1
- package/dist/es/components/pca-picker/pca-picker.mjs +154 -160
- package/dist/es/components/pca-picker/pca-picker.vue.d.ts +12 -11
- package/dist/es/components/qr-code/qr-code.mjs +2 -1
- package/dist/es/components/screenfull/screenfull.mjs +6 -5
- package/dist/es/components/scrollbar/index.css +18 -0
- package/dist/es/components/scrollbar/index.d.ts +4 -0
- package/dist/es/components/scrollbar/index.mjs +6 -0
- package/dist/es/components/scrollbar/scrollbar.d.ts +4 -0
- package/dist/es/components/scrollbar/scrollbar.mjs +65 -0
- package/dist/es/components/scrollbar/scrollbar.vue.d.ts +588 -0
- package/dist/es/components/select/select.mjs +7 -7
- package/dist/es/components/single-player/index.css +1 -1
- package/dist/es/components/single-player/single-player.mjs +265 -166
- package/dist/es/components/svg-icon/index.css +3 -2
- package/dist/es/components/svg-icon/svg-icon.mjs +3 -3
- package/dist/es/components/switch/switch.mjs +2 -2
- package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +2 -2
- package/dist/es/components/tags/tags.mjs +9 -9
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +4 -4
- package/dist/es/components/thousand-input/thousand-input.mjs +5 -4
- package/dist/es/components/thousand-input/thousand-input.vue.d.ts +126 -108
- package/dist/es/components/tinymce/index.css +1 -1
- package/dist/es/components/tinymce/tinymce.mjs +9 -8
- package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +179 -141
- package/dist/es/components/tree-picker/popover-cascader.css +1 -1
- package/dist/es/components/tree-picker/tree-picker.mjs +10 -10
- package/dist/es/components/tree-picker/tree-picker.vue.d.ts +12 -11
- package/dist/es/components/upload-file/upload-file.mjs +3 -3
- package/dist/es/index.d.ts +3 -0
- package/dist/es/index.mjs +41 -31
- package/dist/global.d.ts +3 -0
- package/dist/index.css +166 -22
- package/package.json +8 -2
- package/dist/es/chunk/BtTIs3tG.mjs +0 -138
- package/dist/es/chunk/C7wQNvSS.mjs +0 -728
- package/dist/es/chunk/Cbhe4I9Z.mjs +0 -16
- package/dist/es/chunk/DihosKp1.mjs +0 -140
- package/dist/es/components/icon/index.css +0 -9
|
@@ -0,0 +1,1375 @@
|
|
|
1
|
+
import './index.css'
|
|
2
|
+
import { c as buildProps, d as definePropType, u as useNamespace, i as isArray, f as isNumber, e as debugWarn } from '../../chunk/CcKUdl3e.mjs';
|
|
3
|
+
import '../../chunk/DMYHOxhk.mjs';
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { defineComponent, computed, createElementBlock, openBlock, unref, createBlock, toDisplayString, withCtx, resolveDynamicComponent, inject, ref, watch, normalizeClass, createVNode, Fragment, renderList, createElementVNode, withKeys, createCommentVNode, getCurrentInstance, provide, h, useTemplateRef, onMounted, isRef, createTextVNode, useCssModule, onUnmounted, createSlots, mergeProps } from 'vue';
|
|
6
|
+
import { promiseTimeout, useVModel } from '@vueuse/core';
|
|
7
|
+
import { C as Component$2 } from '../iconify-icon/iconify-icon.mjs';
|
|
8
|
+
import { C as Component$4 } from '../input/input.mjs';
|
|
9
|
+
import '../../chunk/B1BnPYNG.mjs';
|
|
10
|
+
import { E as ElSelect, a as ElOption } from '../../chunk/CitH0taR.mjs';
|
|
11
|
+
import '../../chunk/_8u_XVHh.mjs';
|
|
12
|
+
import { E as ElInput } from '../../chunk/DgFT6snA.mjs';
|
|
13
|
+
import { E as ElDivider } from '../../chunk/egk9EEzo.mjs';
|
|
14
|
+
import { E as ElButton } from '../../chunk/CKbkzlkO.mjs';
|
|
15
|
+
import { C as Component$3 } from '../select/select.mjs';
|
|
16
|
+
import { C as Component$1 } from '../scrollbar/scrollbar.mjs';
|
|
17
|
+
import { d as debounce } from '../../chunk/BambM7zX.mjs';
|
|
18
|
+
import { _ as _export_sfc$1 } from '../../chunk/pcqpp-6-.mjs';
|
|
19
|
+
import { DArrowLeft, MoreFilled, DArrowRight, ArrowRight, ArrowLeft } from '@element-plus/icons-vue';
|
|
20
|
+
import { E as ElIcon } from '../../chunk/DEPZhJ0Z.mjs';
|
|
21
|
+
import { i as iconPropType } from '../icon/icon2.mjs';
|
|
22
|
+
import { _ as _export_sfc, w as withInstall } from '../../chunk/BTsEMnf_.mjs';
|
|
23
|
+
import { u as useLocale } from '../../chunk/plK2vnjp.mjs';
|
|
24
|
+
import { m as mutable } from '../../chunk/B-rxnVJv.mjs';
|
|
25
|
+
import { c as componentSizes, a as useGlobalSize, u as useSizeProp } from '../../chunk/BK4T_2ha.mjs';
|
|
26
|
+
import { i as isEqual } from '../../chunk/Dw-yyl2m.mjs';
|
|
27
|
+
import { C as CHANGE_EVENT } from '../../chunk/Ct6q2FXg.mjs';
|
|
28
|
+
import { u as useDeprecated } from '../../chunk/DTEM_vYZ.mjs';
|
|
29
|
+
import { E as ElPopover } from '../../chunk/DHpbQMGk.mjs';
|
|
30
|
+
|
|
31
|
+
const elPaginationKey = Symbol("elPaginationKey");
|
|
32
|
+
|
|
33
|
+
const paginationPrevProps = buildProps({
|
|
34
|
+
disabled: Boolean,
|
|
35
|
+
currentPage: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 1
|
|
38
|
+
},
|
|
39
|
+
prevText: {
|
|
40
|
+
type: String
|
|
41
|
+
},
|
|
42
|
+
prevIcon: {
|
|
43
|
+
type: iconPropType
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const paginationPrevEmits = {
|
|
47
|
+
click: (evt) => evt instanceof MouseEvent
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const _hoisted_1$6 = ["disabled", "aria-label", "aria-disabled"];
|
|
51
|
+
const _hoisted_2$2 = { key: 0 };
|
|
52
|
+
const _sfc_main$8 = defineComponent({
|
|
53
|
+
...{
|
|
54
|
+
name: "ElPaginationPrev"
|
|
55
|
+
},
|
|
56
|
+
__name: "prev",
|
|
57
|
+
props: paginationPrevProps,
|
|
58
|
+
emits: paginationPrevEmits,
|
|
59
|
+
setup(__props) {
|
|
60
|
+
const props = __props;
|
|
61
|
+
const { t } = useLocale();
|
|
62
|
+
const internalDisabled = computed(
|
|
63
|
+
() => props.disabled || props.currentPage <= 1
|
|
64
|
+
);
|
|
65
|
+
return (_ctx, _cache) => {
|
|
66
|
+
return openBlock(), createElementBlock("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
class: "btn-prev",
|
|
69
|
+
disabled: internalDisabled.value,
|
|
70
|
+
"aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
|
|
71
|
+
"aria-disabled": internalDisabled.value,
|
|
72
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
|
|
73
|
+
}, [
|
|
74
|
+
_ctx.prevText ? (openBlock(), createElementBlock(
|
|
75
|
+
"span",
|
|
76
|
+
_hoisted_2$2,
|
|
77
|
+
toDisplayString(_ctx.prevText),
|
|
78
|
+
1
|
|
79
|
+
)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
80
|
+
default: withCtx(() => [
|
|
81
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}))
|
|
85
|
+
], 8, _hoisted_1$6);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/prev.vue"]]);
|
|
90
|
+
|
|
91
|
+
const paginationNextProps = buildProps({
|
|
92
|
+
disabled: Boolean,
|
|
93
|
+
currentPage: {
|
|
94
|
+
type: Number,
|
|
95
|
+
default: 1
|
|
96
|
+
},
|
|
97
|
+
pageCount: {
|
|
98
|
+
type: Number,
|
|
99
|
+
default: 50
|
|
100
|
+
},
|
|
101
|
+
nextText: {
|
|
102
|
+
type: String
|
|
103
|
+
},
|
|
104
|
+
nextIcon: {
|
|
105
|
+
type: iconPropType
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const _hoisted_1$5 = ["disabled", "aria-label", "aria-disabled"];
|
|
110
|
+
const _hoisted_2$1 = { key: 0 };
|
|
111
|
+
const _sfc_main$7 = defineComponent({
|
|
112
|
+
...{
|
|
113
|
+
name: "ElPaginationNext"
|
|
114
|
+
},
|
|
115
|
+
__name: "next",
|
|
116
|
+
props: paginationNextProps,
|
|
117
|
+
emits: ["click"],
|
|
118
|
+
setup(__props) {
|
|
119
|
+
const props = __props;
|
|
120
|
+
const { t } = useLocale();
|
|
121
|
+
const internalDisabled = computed(
|
|
122
|
+
() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0
|
|
123
|
+
);
|
|
124
|
+
return (_ctx, _cache) => {
|
|
125
|
+
return openBlock(), createElementBlock("button", {
|
|
126
|
+
type: "button",
|
|
127
|
+
class: "btn-next",
|
|
128
|
+
disabled: internalDisabled.value,
|
|
129
|
+
"aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
|
|
130
|
+
"aria-disabled": internalDisabled.value,
|
|
131
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
|
|
132
|
+
}, [
|
|
133
|
+
_ctx.nextText ? (openBlock(), createElementBlock(
|
|
134
|
+
"span",
|
|
135
|
+
_hoisted_2$1,
|
|
136
|
+
toDisplayString(_ctx.nextText),
|
|
137
|
+
1
|
|
138
|
+
)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
139
|
+
default: withCtx(() => [
|
|
140
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))
|
|
141
|
+
]),
|
|
142
|
+
_: 1
|
|
143
|
+
}))
|
|
144
|
+
], 8, _hoisted_1$5);
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
var Next = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/next.vue"]]);
|
|
149
|
+
|
|
150
|
+
const usePagination = () => inject(elPaginationKey, {});
|
|
151
|
+
|
|
152
|
+
const paginationSizesProps = buildProps({
|
|
153
|
+
pageSize: {
|
|
154
|
+
type: Number,
|
|
155
|
+
required: true
|
|
156
|
+
},
|
|
157
|
+
pageSizes: {
|
|
158
|
+
type: definePropType(Array),
|
|
159
|
+
default: () => mutable([10, 20, 30, 40, 50, 100])
|
|
160
|
+
},
|
|
161
|
+
popperClass: {
|
|
162
|
+
type: String
|
|
163
|
+
},
|
|
164
|
+
popperStyle: {
|
|
165
|
+
type: definePropType([String, Object])
|
|
166
|
+
},
|
|
167
|
+
disabled: Boolean,
|
|
168
|
+
teleported: Boolean,
|
|
169
|
+
size: {
|
|
170
|
+
type: String,
|
|
171
|
+
values: componentSizes
|
|
172
|
+
},
|
|
173
|
+
appendSizeTo: String
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const _sfc_main$6 = defineComponent({
|
|
177
|
+
...{
|
|
178
|
+
name: "ElPaginationSizes"
|
|
179
|
+
},
|
|
180
|
+
__name: "sizes",
|
|
181
|
+
props: paginationSizesProps,
|
|
182
|
+
emits: ["page-size-change"],
|
|
183
|
+
setup(__props, { emit: __emit }) {
|
|
184
|
+
const props = __props;
|
|
185
|
+
const emit = __emit;
|
|
186
|
+
const { t } = useLocale();
|
|
187
|
+
const ns = useNamespace("pagination");
|
|
188
|
+
const pagination = usePagination();
|
|
189
|
+
const innerPageSize = ref(props.pageSize);
|
|
190
|
+
watch(
|
|
191
|
+
() => props.pageSizes,
|
|
192
|
+
(newVal, oldVal) => {
|
|
193
|
+
if (isEqual(newVal, oldVal))
|
|
194
|
+
return;
|
|
195
|
+
if (isArray(newVal)) {
|
|
196
|
+
const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
|
|
197
|
+
emit("page-size-change", pageSize);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
watch(
|
|
202
|
+
() => props.pageSize,
|
|
203
|
+
(newVal) => {
|
|
204
|
+
innerPageSize.value = newVal;
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
const innerPageSizes = computed(() => props.pageSizes);
|
|
208
|
+
function handleChange(val) {
|
|
209
|
+
var _a;
|
|
210
|
+
if (val !== innerPageSize.value) {
|
|
211
|
+
innerPageSize.value = val;
|
|
212
|
+
(_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return (_ctx, _cache) => {
|
|
216
|
+
return openBlock(), createElementBlock(
|
|
217
|
+
"span",
|
|
218
|
+
{
|
|
219
|
+
class: normalizeClass(unref(ns).e("sizes"))
|
|
220
|
+
},
|
|
221
|
+
[
|
|
222
|
+
createVNode(unref(ElSelect), {
|
|
223
|
+
"model-value": innerPageSize.value,
|
|
224
|
+
disabled: _ctx.disabled,
|
|
225
|
+
"popper-class": _ctx.popperClass,
|
|
226
|
+
"popper-style": _ctx.popperStyle,
|
|
227
|
+
size: _ctx.size,
|
|
228
|
+
teleported: _ctx.teleported,
|
|
229
|
+
"validate-event": false,
|
|
230
|
+
"append-to": _ctx.appendSizeTo,
|
|
231
|
+
onChange: handleChange
|
|
232
|
+
}, {
|
|
233
|
+
default: withCtx(() => [
|
|
234
|
+
(openBlock(true), createElementBlock(
|
|
235
|
+
Fragment,
|
|
236
|
+
null,
|
|
237
|
+
renderList(innerPageSizes.value, (item) => {
|
|
238
|
+
return openBlock(), createBlock(unref(ElOption), {
|
|
239
|
+
key: item,
|
|
240
|
+
value: item,
|
|
241
|
+
label: item + unref(t)("el.pagination.pagesize")
|
|
242
|
+
}, null, 8, ["value", "label"]);
|
|
243
|
+
}),
|
|
244
|
+
128
|
|
245
|
+
))
|
|
246
|
+
]),
|
|
247
|
+
_: 1
|
|
248
|
+
}, 8, ["model-value", "disabled", "popper-class", "popper-style", "size", "teleported", "append-to"])
|
|
249
|
+
],
|
|
250
|
+
2
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/sizes.vue"]]);
|
|
256
|
+
|
|
257
|
+
const paginationJumperProps = buildProps({
|
|
258
|
+
size: {
|
|
259
|
+
type: String,
|
|
260
|
+
values: componentSizes
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
const _hoisted_1$4 = ["disabled"];
|
|
265
|
+
const _sfc_main$5 = defineComponent({
|
|
266
|
+
...{
|
|
267
|
+
name: "ElPaginationJumper"
|
|
268
|
+
},
|
|
269
|
+
__name: "jumper",
|
|
270
|
+
props: paginationJumperProps,
|
|
271
|
+
setup(__props) {
|
|
272
|
+
const { t } = useLocale();
|
|
273
|
+
const ns = useNamespace("pagination");
|
|
274
|
+
const { pageCount, disabled, currentPage, changeEvent } = usePagination();
|
|
275
|
+
const userInput = ref();
|
|
276
|
+
const innerValue = computed(() => {
|
|
277
|
+
var _a;
|
|
278
|
+
return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
|
|
279
|
+
});
|
|
280
|
+
function handleInput(val) {
|
|
281
|
+
userInput.value = val ? +val : "";
|
|
282
|
+
}
|
|
283
|
+
function handleChange(val) {
|
|
284
|
+
val = Math.trunc(+val);
|
|
285
|
+
changeEvent == null ? void 0 : changeEvent(val);
|
|
286
|
+
userInput.value = void 0;
|
|
287
|
+
}
|
|
288
|
+
return (_ctx, _cache) => {
|
|
289
|
+
return openBlock(), createElementBlock("span", {
|
|
290
|
+
class: normalizeClass(unref(ns).e("jump")),
|
|
291
|
+
disabled: unref(disabled)
|
|
292
|
+
}, [
|
|
293
|
+
createElementVNode(
|
|
294
|
+
"span",
|
|
295
|
+
{
|
|
296
|
+
class: normalizeClass([unref(ns).e("goto")])
|
|
297
|
+
},
|
|
298
|
+
toDisplayString(unref(t)("el.pagination.goto")),
|
|
299
|
+
3
|
|
300
|
+
),
|
|
301
|
+
createVNode(unref(ElInput), {
|
|
302
|
+
size: _ctx.size,
|
|
303
|
+
class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
|
|
304
|
+
min: 1,
|
|
305
|
+
max: unref(pageCount),
|
|
306
|
+
disabled: unref(disabled),
|
|
307
|
+
"model-value": innerValue.value,
|
|
308
|
+
"validate-event": false,
|
|
309
|
+
"aria-label": unref(t)("el.pagination.page"),
|
|
310
|
+
type: "number",
|
|
311
|
+
"onUpdate:modelValue": handleInput,
|
|
312
|
+
onChange: handleChange
|
|
313
|
+
}, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
|
|
314
|
+
createElementVNode(
|
|
315
|
+
"span",
|
|
316
|
+
{
|
|
317
|
+
class: normalizeClass([unref(ns).e("classifier")])
|
|
318
|
+
},
|
|
319
|
+
toDisplayString(unref(t)("el.pagination.pageClassifier")),
|
|
320
|
+
3
|
|
321
|
+
)
|
|
322
|
+
], 10, _hoisted_1$4);
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/jumper.vue"]]);
|
|
327
|
+
|
|
328
|
+
const paginationTotalProps = buildProps({
|
|
329
|
+
total: {
|
|
330
|
+
type: Number,
|
|
331
|
+
default: 1e3
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
const _hoisted_1$3 = ["disabled"];
|
|
336
|
+
const _sfc_main$4 = defineComponent({
|
|
337
|
+
...{
|
|
338
|
+
name: "ElPaginationTotal"
|
|
339
|
+
},
|
|
340
|
+
__name: "total",
|
|
341
|
+
props: paginationTotalProps,
|
|
342
|
+
setup(__props) {
|
|
343
|
+
const { t } = useLocale();
|
|
344
|
+
const ns = useNamespace("pagination");
|
|
345
|
+
const { disabled } = usePagination();
|
|
346
|
+
return (_ctx, _cache) => {
|
|
347
|
+
return openBlock(), createElementBlock("span", {
|
|
348
|
+
class: normalizeClass(unref(ns).e("total")),
|
|
349
|
+
disabled: unref(disabled)
|
|
350
|
+
}, toDisplayString(unref(t)("el.pagination.total", {
|
|
351
|
+
total: _ctx.total
|
|
352
|
+
})), 11, _hoisted_1$3);
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
var Total = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/total.vue"]]);
|
|
357
|
+
|
|
358
|
+
const paginationPagerProps = buildProps({
|
|
359
|
+
currentPage: {
|
|
360
|
+
type: Number,
|
|
361
|
+
default: 1
|
|
362
|
+
},
|
|
363
|
+
pageCount: {
|
|
364
|
+
type: Number,
|
|
365
|
+
required: true
|
|
366
|
+
},
|
|
367
|
+
pagerCount: {
|
|
368
|
+
type: Number,
|
|
369
|
+
default: 7
|
|
370
|
+
},
|
|
371
|
+
disabled: Boolean
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
const _hoisted_1$2 = ["aria-current", "aria-label", "tabindex"];
|
|
375
|
+
const _hoisted_2 = ["tabindex", "aria-label"];
|
|
376
|
+
const _hoisted_3 = ["aria-current", "aria-label", "tabindex"];
|
|
377
|
+
const _hoisted_4 = ["tabindex", "aria-label"];
|
|
378
|
+
const _hoisted_5 = ["aria-current", "aria-label", "tabindex"];
|
|
379
|
+
const _sfc_main$3 = defineComponent({
|
|
380
|
+
...{
|
|
381
|
+
name: "ElPaginationPager"
|
|
382
|
+
},
|
|
383
|
+
__name: "pager",
|
|
384
|
+
props: paginationPagerProps,
|
|
385
|
+
emits: [CHANGE_EVENT],
|
|
386
|
+
setup(__props, { emit: __emit }) {
|
|
387
|
+
const props = __props;
|
|
388
|
+
const emit = __emit;
|
|
389
|
+
const nsPager = useNamespace("pager");
|
|
390
|
+
const nsIcon = useNamespace("icon");
|
|
391
|
+
const { t } = useLocale();
|
|
392
|
+
const showPrevMore = ref(false);
|
|
393
|
+
const showNextMore = ref(false);
|
|
394
|
+
const quickPrevHover = ref(false);
|
|
395
|
+
const quickNextHover = ref(false);
|
|
396
|
+
const quickPrevFocus = ref(false);
|
|
397
|
+
const quickNextFocus = ref(false);
|
|
398
|
+
const pagers = computed(() => {
|
|
399
|
+
const pagerCount = props.pagerCount;
|
|
400
|
+
const halfPagerCount = (pagerCount - 1) / 2;
|
|
401
|
+
const currentPage = Number(props.currentPage);
|
|
402
|
+
const pageCount = Number(props.pageCount);
|
|
403
|
+
let showPrevMore2 = false;
|
|
404
|
+
let showNextMore2 = false;
|
|
405
|
+
if (pageCount > pagerCount) {
|
|
406
|
+
if (currentPage > pagerCount - halfPagerCount) {
|
|
407
|
+
showPrevMore2 = true;
|
|
408
|
+
}
|
|
409
|
+
if (currentPage < pageCount - halfPagerCount) {
|
|
410
|
+
showNextMore2 = true;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const array = [];
|
|
414
|
+
if (showPrevMore2 && !showNextMore2) {
|
|
415
|
+
const startPage = pageCount - (pagerCount - 2);
|
|
416
|
+
for (let i = startPage; i < pageCount; i++) {
|
|
417
|
+
array.push(i);
|
|
418
|
+
}
|
|
419
|
+
} else if (!showPrevMore2 && showNextMore2) {
|
|
420
|
+
for (let i = 2; i < pagerCount; i++) {
|
|
421
|
+
array.push(i);
|
|
422
|
+
}
|
|
423
|
+
} else if (showPrevMore2 && showNextMore2) {
|
|
424
|
+
const offset = Math.floor(pagerCount / 2) - 1;
|
|
425
|
+
for (let i = currentPage - offset; i <= currentPage + offset; i++) {
|
|
426
|
+
array.push(i);
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
for (let i = 2; i < pageCount; i++) {
|
|
430
|
+
array.push(i);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return array;
|
|
434
|
+
});
|
|
435
|
+
const prevMoreKls = computed(() => [
|
|
436
|
+
"more",
|
|
437
|
+
"btn-quickprev",
|
|
438
|
+
nsIcon.b(),
|
|
439
|
+
nsPager.is("disabled", props.disabled)
|
|
440
|
+
]);
|
|
441
|
+
const nextMoreKls = computed(() => [
|
|
442
|
+
"more",
|
|
443
|
+
"btn-quicknext",
|
|
444
|
+
nsIcon.b(),
|
|
445
|
+
nsPager.is("disabled", props.disabled)
|
|
446
|
+
]);
|
|
447
|
+
const tabindex = computed(() => props.disabled ? -1 : 0);
|
|
448
|
+
watch(
|
|
449
|
+
() => [props.pageCount, props.pagerCount, props.currentPage],
|
|
450
|
+
([pageCount, pagerCount, currentPage]) => {
|
|
451
|
+
const halfPagerCount = (pagerCount - 1) / 2;
|
|
452
|
+
let showPrev = false;
|
|
453
|
+
let showNext = false;
|
|
454
|
+
if (pageCount > pagerCount) {
|
|
455
|
+
showPrev = currentPage > pagerCount - halfPagerCount;
|
|
456
|
+
showNext = currentPage < pageCount - halfPagerCount;
|
|
457
|
+
}
|
|
458
|
+
quickPrevHover.value && (quickPrevHover.value = showPrev);
|
|
459
|
+
quickNextHover.value && (quickNextHover.value = showNext);
|
|
460
|
+
showPrevMore.value = showPrev;
|
|
461
|
+
showNextMore.value = showNext;
|
|
462
|
+
},
|
|
463
|
+
{ immediate: true }
|
|
464
|
+
);
|
|
465
|
+
function onMouseEnter(forward = false) {
|
|
466
|
+
if (props.disabled)
|
|
467
|
+
return;
|
|
468
|
+
if (forward) {
|
|
469
|
+
quickPrevHover.value = true;
|
|
470
|
+
} else {
|
|
471
|
+
quickNextHover.value = true;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
function onFocus(forward = false) {
|
|
475
|
+
if (forward) {
|
|
476
|
+
quickPrevFocus.value = true;
|
|
477
|
+
} else {
|
|
478
|
+
quickNextFocus.value = true;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function onEnter(e) {
|
|
482
|
+
const target = e.target;
|
|
483
|
+
if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
|
|
484
|
+
const newPage = Number(target.textContent);
|
|
485
|
+
if (newPage !== props.currentPage) {
|
|
486
|
+
emit(CHANGE_EVENT, newPage);
|
|
487
|
+
}
|
|
488
|
+
} else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
|
|
489
|
+
onPagerClick(e);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function onPagerClick(event) {
|
|
493
|
+
const target = event.target;
|
|
494
|
+
if (target.tagName.toLowerCase() === "ul" || props.disabled) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
let newPage = Number(target.textContent);
|
|
498
|
+
const pageCount = props.pageCount;
|
|
499
|
+
const currentPage = props.currentPage;
|
|
500
|
+
const pagerCountOffset = props.pagerCount - 2;
|
|
501
|
+
if (target.className.includes("more")) {
|
|
502
|
+
if (target.className.includes("quickprev")) {
|
|
503
|
+
newPage = currentPage - pagerCountOffset;
|
|
504
|
+
} else if (target.className.includes("quicknext")) {
|
|
505
|
+
newPage = currentPage + pagerCountOffset;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (!Number.isNaN(+newPage)) {
|
|
509
|
+
if (newPage < 1) {
|
|
510
|
+
newPage = 1;
|
|
511
|
+
}
|
|
512
|
+
if (newPage > pageCount) {
|
|
513
|
+
newPage = pageCount;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (newPage !== currentPage) {
|
|
517
|
+
emit(CHANGE_EVENT, newPage);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return (_ctx, _cache) => {
|
|
521
|
+
return openBlock(), createElementBlock(
|
|
522
|
+
"ul",
|
|
523
|
+
{
|
|
524
|
+
class: normalizeClass(unref(nsPager).b()),
|
|
525
|
+
onClick: onPagerClick,
|
|
526
|
+
onKeyup: withKeys(onEnter, ["enter"])
|
|
527
|
+
},
|
|
528
|
+
[
|
|
529
|
+
_ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
|
|
530
|
+
key: 0,
|
|
531
|
+
class: normalizeClass([[
|
|
532
|
+
unref(nsPager).is("active", _ctx.currentPage === 1),
|
|
533
|
+
unref(nsPager).is("disabled", _ctx.disabled)
|
|
534
|
+
], "number"]),
|
|
535
|
+
"aria-current": _ctx.currentPage === 1,
|
|
536
|
+
"aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
|
|
537
|
+
tabindex: tabindex.value
|
|
538
|
+
}, " 1 ", 10, _hoisted_1$2)) : createCommentVNode("v-if", true),
|
|
539
|
+
showPrevMore.value ? (openBlock(), createElementBlock("li", {
|
|
540
|
+
key: 1,
|
|
541
|
+
class: normalizeClass(prevMoreKls.value),
|
|
542
|
+
tabindex: tabindex.value,
|
|
543
|
+
"aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
|
|
544
|
+
onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
|
|
545
|
+
onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
|
|
546
|
+
onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
|
|
547
|
+
onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
|
|
548
|
+
}, [
|
|
549
|
+
(quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(DArrowLeft), { key: 0 })) : (openBlock(), createBlock(unref(MoreFilled), { key: 1 }))
|
|
550
|
+
], 42, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
551
|
+
(openBlock(true), createElementBlock(
|
|
552
|
+
Fragment,
|
|
553
|
+
null,
|
|
554
|
+
renderList(pagers.value, (pager) => {
|
|
555
|
+
return openBlock(), createElementBlock("li", {
|
|
556
|
+
key: pager,
|
|
557
|
+
class: normalizeClass([[
|
|
558
|
+
unref(nsPager).is("active", _ctx.currentPage === pager),
|
|
559
|
+
unref(nsPager).is("disabled", _ctx.disabled)
|
|
560
|
+
], "number"]),
|
|
561
|
+
"aria-current": _ctx.currentPage === pager,
|
|
562
|
+
"aria-label": unref(t)("el.pagination.currentPage", { pager }),
|
|
563
|
+
tabindex: tabindex.value
|
|
564
|
+
}, toDisplayString(pager), 11, _hoisted_3);
|
|
565
|
+
}),
|
|
566
|
+
128
|
|
567
|
+
)),
|
|
568
|
+
showNextMore.value ? (openBlock(), createElementBlock("li", {
|
|
569
|
+
key: 2,
|
|
570
|
+
class: normalizeClass(nextMoreKls.value),
|
|
571
|
+
tabindex: tabindex.value,
|
|
572
|
+
"aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
|
|
573
|
+
onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
|
|
574
|
+
onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
|
|
575
|
+
onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
|
|
576
|
+
onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
|
|
577
|
+
}, [
|
|
578
|
+
(quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(DArrowRight), { key: 0 })) : (openBlock(), createBlock(unref(MoreFilled), { key: 1 }))
|
|
579
|
+
], 42, _hoisted_4)) : createCommentVNode("v-if", true),
|
|
580
|
+
_ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
|
|
581
|
+
key: 3,
|
|
582
|
+
class: normalizeClass([[
|
|
583
|
+
unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
|
|
584
|
+
unref(nsPager).is("disabled", _ctx.disabled)
|
|
585
|
+
], "number"]),
|
|
586
|
+
"aria-current": _ctx.currentPage === _ctx.pageCount,
|
|
587
|
+
"aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
|
|
588
|
+
tabindex: tabindex.value
|
|
589
|
+
}, toDisplayString(_ctx.pageCount), 11, _hoisted_5)) : createCommentVNode("v-if", true)
|
|
590
|
+
],
|
|
591
|
+
34
|
|
592
|
+
);
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/pager.vue"]]);
|
|
597
|
+
|
|
598
|
+
const isAbsent = (v) => typeof v !== "number";
|
|
599
|
+
const paginationProps = buildProps({
|
|
600
|
+
pageSize: Number,
|
|
601
|
+
defaultPageSize: Number,
|
|
602
|
+
total: Number,
|
|
603
|
+
pageCount: Number,
|
|
604
|
+
pagerCount: {
|
|
605
|
+
type: Number,
|
|
606
|
+
validator: (value) => {
|
|
607
|
+
return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
|
|
608
|
+
},
|
|
609
|
+
default: 7
|
|
610
|
+
},
|
|
611
|
+
currentPage: Number,
|
|
612
|
+
defaultCurrentPage: Number,
|
|
613
|
+
layout: {
|
|
614
|
+
type: String,
|
|
615
|
+
default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
|
|
616
|
+
},
|
|
617
|
+
pageSizes: {
|
|
618
|
+
type: definePropType(Array),
|
|
619
|
+
default: () => mutable([10, 20, 30, 40, 50, 100])
|
|
620
|
+
},
|
|
621
|
+
popperClass: {
|
|
622
|
+
type: String,
|
|
623
|
+
default: ""
|
|
624
|
+
},
|
|
625
|
+
popperStyle: {
|
|
626
|
+
type: definePropType([String, Object])
|
|
627
|
+
},
|
|
628
|
+
prevText: {
|
|
629
|
+
type: String,
|
|
630
|
+
default: ""
|
|
631
|
+
},
|
|
632
|
+
prevIcon: {
|
|
633
|
+
type: iconPropType,
|
|
634
|
+
default: () => ArrowLeft
|
|
635
|
+
},
|
|
636
|
+
nextText: {
|
|
637
|
+
type: String,
|
|
638
|
+
default: ""
|
|
639
|
+
},
|
|
640
|
+
nextIcon: {
|
|
641
|
+
type: iconPropType,
|
|
642
|
+
default: () => ArrowRight
|
|
643
|
+
},
|
|
644
|
+
teleported: {
|
|
645
|
+
type: Boolean,
|
|
646
|
+
default: true
|
|
647
|
+
},
|
|
648
|
+
small: Boolean,
|
|
649
|
+
size: useSizeProp,
|
|
650
|
+
background: Boolean,
|
|
651
|
+
disabled: Boolean,
|
|
652
|
+
hideOnSinglePage: Boolean,
|
|
653
|
+
appendSizeTo: String
|
|
654
|
+
});
|
|
655
|
+
const paginationEmits = {
|
|
656
|
+
"update:current-page": (val) => isNumber(val),
|
|
657
|
+
"update:page-size": (val) => isNumber(val),
|
|
658
|
+
"size-change": (val) => isNumber(val),
|
|
659
|
+
change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
|
|
660
|
+
"current-change": (val) => isNumber(val),
|
|
661
|
+
"prev-click": (val) => isNumber(val),
|
|
662
|
+
"next-click": (val) => isNumber(val)
|
|
663
|
+
};
|
|
664
|
+
const componentName = "ElPagination";
|
|
665
|
+
var Pagination = defineComponent({
|
|
666
|
+
name: componentName,
|
|
667
|
+
props: paginationProps,
|
|
668
|
+
emits: paginationEmits,
|
|
669
|
+
setup(props, { emit, slots }) {
|
|
670
|
+
const { t } = useLocale();
|
|
671
|
+
const ns = useNamespace("pagination");
|
|
672
|
+
const vnodeProps = getCurrentInstance().vnode.props || {};
|
|
673
|
+
const _globalSize = useGlobalSize();
|
|
674
|
+
const _size = computed(
|
|
675
|
+
() => {
|
|
676
|
+
var _a;
|
|
677
|
+
return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
useDeprecated(
|
|
681
|
+
{
|
|
682
|
+
from: "small",
|
|
683
|
+
replacement: "size",
|
|
684
|
+
version: "3.0.0",
|
|
685
|
+
scope: "el-pagination",
|
|
686
|
+
ref: "https://element-plus.org/zh-CN/component/pagination.html"
|
|
687
|
+
},
|
|
688
|
+
computed(() => !!props.small)
|
|
689
|
+
);
|
|
690
|
+
const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
|
|
691
|
+
const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
|
|
692
|
+
const assertValidUsage = computed(() => {
|
|
693
|
+
if (isAbsent(props.total) && isAbsent(props.pageCount))
|
|
694
|
+
return false;
|
|
695
|
+
if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
|
|
696
|
+
return false;
|
|
697
|
+
if (props.layout.includes("sizes")) {
|
|
698
|
+
if (!isAbsent(props.pageCount)) {
|
|
699
|
+
if (!hasPageSizeListener)
|
|
700
|
+
return false;
|
|
701
|
+
} else if (!isAbsent(props.total)) {
|
|
702
|
+
if (!isAbsent(props.pageSize)) {
|
|
703
|
+
if (!hasPageSizeListener) {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
return true;
|
|
710
|
+
});
|
|
711
|
+
const innerPageSize = ref(
|
|
712
|
+
isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize
|
|
713
|
+
);
|
|
714
|
+
const innerCurrentPage = ref(
|
|
715
|
+
isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage
|
|
716
|
+
);
|
|
717
|
+
const pageSizeBridge = computed({
|
|
718
|
+
get() {
|
|
719
|
+
return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
|
|
720
|
+
},
|
|
721
|
+
set(v) {
|
|
722
|
+
if (isAbsent(props.pageSize)) {
|
|
723
|
+
innerPageSize.value = v;
|
|
724
|
+
}
|
|
725
|
+
if (hasPageSizeListener) {
|
|
726
|
+
emit("update:page-size", v);
|
|
727
|
+
emit("size-change", v);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
const pageCountBridge = computed(() => {
|
|
732
|
+
let pageCount = 0;
|
|
733
|
+
if (!isAbsent(props.pageCount)) {
|
|
734
|
+
pageCount = props.pageCount;
|
|
735
|
+
} else if (!isAbsent(props.total)) {
|
|
736
|
+
pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
|
|
737
|
+
}
|
|
738
|
+
return pageCount;
|
|
739
|
+
});
|
|
740
|
+
const currentPageBridge = computed({
|
|
741
|
+
get() {
|
|
742
|
+
return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
|
|
743
|
+
},
|
|
744
|
+
set(v) {
|
|
745
|
+
let newCurrentPage = v;
|
|
746
|
+
if (v < 1) {
|
|
747
|
+
newCurrentPage = 1;
|
|
748
|
+
} else if (v > pageCountBridge.value) {
|
|
749
|
+
newCurrentPage = pageCountBridge.value;
|
|
750
|
+
}
|
|
751
|
+
if (isAbsent(props.currentPage)) {
|
|
752
|
+
innerCurrentPage.value = newCurrentPage;
|
|
753
|
+
}
|
|
754
|
+
if (hasCurrentPageListener) {
|
|
755
|
+
emit("update:current-page", newCurrentPage);
|
|
756
|
+
emit("current-change", newCurrentPage);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
watch(pageCountBridge, (val) => {
|
|
761
|
+
if (currentPageBridge.value > val)
|
|
762
|
+
currentPageBridge.value = val;
|
|
763
|
+
});
|
|
764
|
+
watch(
|
|
765
|
+
[currentPageBridge, pageSizeBridge],
|
|
766
|
+
(value) => {
|
|
767
|
+
emit(CHANGE_EVENT, ...value);
|
|
768
|
+
},
|
|
769
|
+
{ flush: "post" }
|
|
770
|
+
);
|
|
771
|
+
function handleCurrentChange(val) {
|
|
772
|
+
currentPageBridge.value = val;
|
|
773
|
+
}
|
|
774
|
+
function handleSizeChange(val) {
|
|
775
|
+
pageSizeBridge.value = val;
|
|
776
|
+
const newPageCount = pageCountBridge.value;
|
|
777
|
+
if (currentPageBridge.value > newPageCount) {
|
|
778
|
+
currentPageBridge.value = newPageCount;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
function prev() {
|
|
782
|
+
if (props.disabled)
|
|
783
|
+
return;
|
|
784
|
+
currentPageBridge.value -= 1;
|
|
785
|
+
emit("prev-click", currentPageBridge.value);
|
|
786
|
+
}
|
|
787
|
+
function next() {
|
|
788
|
+
if (props.disabled)
|
|
789
|
+
return;
|
|
790
|
+
currentPageBridge.value += 1;
|
|
791
|
+
emit("next-click", currentPageBridge.value);
|
|
792
|
+
}
|
|
793
|
+
function addClass(element, cls) {
|
|
794
|
+
if (element) {
|
|
795
|
+
if (!element.props) {
|
|
796
|
+
element.props = {};
|
|
797
|
+
}
|
|
798
|
+
element.props.class = [element.props.class, cls].join(" ");
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
provide(elPaginationKey, {
|
|
802
|
+
pageCount: pageCountBridge,
|
|
803
|
+
disabled: computed(() => props.disabled),
|
|
804
|
+
currentPage: currentPageBridge,
|
|
805
|
+
changeEvent: handleCurrentChange,
|
|
806
|
+
handleSizeChange
|
|
807
|
+
});
|
|
808
|
+
return () => {
|
|
809
|
+
var _a, _b;
|
|
810
|
+
if (!assertValidUsage.value) {
|
|
811
|
+
debugWarn(componentName, t("el.pagination.deprecationWarning"));
|
|
812
|
+
return null;
|
|
813
|
+
}
|
|
814
|
+
if (!props.layout)
|
|
815
|
+
return null;
|
|
816
|
+
if (props.hideOnSinglePage && pageCountBridge.value <= 1)
|
|
817
|
+
return null;
|
|
818
|
+
const rootChildren = [];
|
|
819
|
+
const rightWrapperChildren = [];
|
|
820
|
+
const rightWrapperRoot = h(
|
|
821
|
+
"div",
|
|
822
|
+
{ class: ns.e("rightwrapper") },
|
|
823
|
+
rightWrapperChildren
|
|
824
|
+
);
|
|
825
|
+
const TEMPLATE_MAP = {
|
|
826
|
+
prev: h(Prev, {
|
|
827
|
+
disabled: props.disabled,
|
|
828
|
+
currentPage: currentPageBridge.value,
|
|
829
|
+
prevText: props.prevText,
|
|
830
|
+
prevIcon: props.prevIcon,
|
|
831
|
+
onClick: prev
|
|
832
|
+
}),
|
|
833
|
+
jumper: h(Jumper, {
|
|
834
|
+
size: _size.value
|
|
835
|
+
}),
|
|
836
|
+
pager: h(Pager, {
|
|
837
|
+
currentPage: currentPageBridge.value,
|
|
838
|
+
pageCount: pageCountBridge.value,
|
|
839
|
+
pagerCount: props.pagerCount,
|
|
840
|
+
onChange: handleCurrentChange,
|
|
841
|
+
disabled: props.disabled
|
|
842
|
+
}),
|
|
843
|
+
next: h(Next, {
|
|
844
|
+
disabled: props.disabled,
|
|
845
|
+
currentPage: currentPageBridge.value,
|
|
846
|
+
pageCount: pageCountBridge.value,
|
|
847
|
+
nextText: props.nextText,
|
|
848
|
+
nextIcon: props.nextIcon,
|
|
849
|
+
onClick: next
|
|
850
|
+
}),
|
|
851
|
+
sizes: h(Sizes, {
|
|
852
|
+
pageSize: pageSizeBridge.value,
|
|
853
|
+
pageSizes: props.pageSizes,
|
|
854
|
+
popperClass: props.popperClass,
|
|
855
|
+
popperStyle: props.popperStyle,
|
|
856
|
+
disabled: props.disabled,
|
|
857
|
+
teleported: props.teleported,
|
|
858
|
+
size: _size.value,
|
|
859
|
+
appendSizeTo: props.appendSizeTo
|
|
860
|
+
}),
|
|
861
|
+
slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
|
|
862
|
+
total: h(Total, { total: isAbsent(props.total) ? 0 : props.total })
|
|
863
|
+
};
|
|
864
|
+
const components = props.layout.split(",").map((item) => item.trim());
|
|
865
|
+
let haveRightWrapper = false;
|
|
866
|
+
components.forEach((c) => {
|
|
867
|
+
if (c === "->") {
|
|
868
|
+
haveRightWrapper = true;
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
if (!haveRightWrapper) {
|
|
872
|
+
rootChildren.push(TEMPLATE_MAP[c]);
|
|
873
|
+
} else {
|
|
874
|
+
rightWrapperChildren.push(TEMPLATE_MAP[c]);
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
addClass(rootChildren[0], ns.is("first"));
|
|
878
|
+
addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
|
|
879
|
+
if (haveRightWrapper && rightWrapperChildren.length > 0) {
|
|
880
|
+
addClass(rightWrapperChildren[0], ns.is("first"));
|
|
881
|
+
addClass(
|
|
882
|
+
rightWrapperChildren[rightWrapperChildren.length - 1],
|
|
883
|
+
ns.is("last")
|
|
884
|
+
);
|
|
885
|
+
rootChildren.push(rightWrapperRoot);
|
|
886
|
+
}
|
|
887
|
+
return h(
|
|
888
|
+
"div",
|
|
889
|
+
{
|
|
890
|
+
class: [
|
|
891
|
+
ns.b(),
|
|
892
|
+
ns.is("background", props.background),
|
|
893
|
+
ns.m(_size.value)
|
|
894
|
+
]
|
|
895
|
+
},
|
|
896
|
+
rootChildren
|
|
897
|
+
);
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
const ElPagination = withInstall(Pagination);
|
|
903
|
+
|
|
904
|
+
const baseUrl = "https://api.iconify.design";
|
|
905
|
+
function paginateArray(array, ps, p) {
|
|
906
|
+
return array.slice((p - 1) * ps, p * ps);
|
|
907
|
+
}
|
|
908
|
+
function useIcon() {
|
|
909
|
+
const categories = ref([]);
|
|
910
|
+
const currentCategory = ref("");
|
|
911
|
+
const categoriesData = ref();
|
|
912
|
+
const uncategorizedData = ref();
|
|
913
|
+
const ps = ref(50);
|
|
914
|
+
const p = ref(1);
|
|
915
|
+
const keyword = ref("");
|
|
916
|
+
const collection = ref("carbon");
|
|
917
|
+
const allIcons = computed(() => {
|
|
918
|
+
let icons = [];
|
|
919
|
+
if (uncategorizedData.value) {
|
|
920
|
+
icons = icons.concat(uncategorizedData.value);
|
|
921
|
+
}
|
|
922
|
+
if (categoriesData.value) {
|
|
923
|
+
Object.values(categoriesData.value).forEach((categoryIcons2) => {
|
|
924
|
+
icons = icons.concat(categoryIcons2);
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
return Array.from(new Set(icons));
|
|
928
|
+
});
|
|
929
|
+
const categoryIcons = computed(() => {
|
|
930
|
+
if (keyword.value) {
|
|
931
|
+
return allIcons.value.filter((icon) => icon.includes(keyword.value));
|
|
932
|
+
}
|
|
933
|
+
if (!currentCategory.value || !categoriesData.value) {
|
|
934
|
+
return allIcons.value;
|
|
935
|
+
}
|
|
936
|
+
return categoriesData.value[currentCategory.value];
|
|
937
|
+
});
|
|
938
|
+
const pageIcons = computed(() => paginateArray(categoryIcons.value, ps.value, p.value));
|
|
939
|
+
const total = computed(() => categoryIcons.value.length);
|
|
940
|
+
const fetchData = async (prefix = "carbon") => {
|
|
941
|
+
const url = `${baseUrl}/collection?prefix=${prefix}`;
|
|
942
|
+
const res = await fetch(url);
|
|
943
|
+
const data = await res.json();
|
|
944
|
+
categoriesData.value = data.categories;
|
|
945
|
+
uncategorizedData.value = data.uncategorized;
|
|
946
|
+
categories.value = Object.keys(data.categories || {});
|
|
947
|
+
};
|
|
948
|
+
watch(collection, () => {
|
|
949
|
+
p.value = 1;
|
|
950
|
+
fetchData(collection.value);
|
|
951
|
+
});
|
|
952
|
+
return {
|
|
953
|
+
fetchData,
|
|
954
|
+
categoryIcons,
|
|
955
|
+
allIcons,
|
|
956
|
+
pageIcons,
|
|
957
|
+
categories,
|
|
958
|
+
currentCategory,
|
|
959
|
+
collection,
|
|
960
|
+
total,
|
|
961
|
+
ps,
|
|
962
|
+
p,
|
|
963
|
+
keyword
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
function useCollection() {
|
|
967
|
+
const collections = ref([]);
|
|
968
|
+
const collectionsData = ref();
|
|
969
|
+
const ps = ref(10);
|
|
970
|
+
const p = ref(1);
|
|
971
|
+
const keyword = ref("");
|
|
972
|
+
const listCollections = computed(() => {
|
|
973
|
+
const myCollections = keyword.value ? collections.value.filter((collection) => collection.includes(keyword.value)) : collections.value;
|
|
974
|
+
return paginateArray(myCollections, ps.value * p.value, 1);
|
|
975
|
+
});
|
|
976
|
+
const fetchData = async () => {
|
|
977
|
+
const url = `${baseUrl}/collections`;
|
|
978
|
+
const res = await fetch(url);
|
|
979
|
+
const data = await res.json();
|
|
980
|
+
collections.value = Object.keys(data);
|
|
981
|
+
collectionsData.value = data;
|
|
982
|
+
};
|
|
983
|
+
const loadMore = () => {
|
|
984
|
+
p.value++;
|
|
985
|
+
};
|
|
986
|
+
const search = (val) => {
|
|
987
|
+
keyword.value = val;
|
|
988
|
+
p.value = 1;
|
|
989
|
+
};
|
|
990
|
+
return {
|
|
991
|
+
fetchData,
|
|
992
|
+
collections,
|
|
993
|
+
collectionsData,
|
|
994
|
+
listCollections,
|
|
995
|
+
loadMore,
|
|
996
|
+
keyword,
|
|
997
|
+
search,
|
|
998
|
+
ps,
|
|
999
|
+
p
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
const _hoisted_1$1 = ["data-collection-name"];
|
|
1004
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1005
|
+
__name: "collections",
|
|
1006
|
+
props: {
|
|
1007
|
+
collection: {},
|
|
1008
|
+
collections: {}
|
|
1009
|
+
},
|
|
1010
|
+
emits: ["choiced"],
|
|
1011
|
+
setup(__props, { emit: __emit }) {
|
|
1012
|
+
const props = __props;
|
|
1013
|
+
const emits = __emit;
|
|
1014
|
+
const { fetchData, listCollections, loadMore, collectionsData, collections, search } = useCollection();
|
|
1015
|
+
const scrollbarRef = useTemplateRef("scrollbarRef");
|
|
1016
|
+
const keyword = ref("");
|
|
1017
|
+
const handleSearch = debounce(() => {
|
|
1018
|
+
search(keyword.value);
|
|
1019
|
+
scrollbarRef.value?.setScrollTop(0);
|
|
1020
|
+
}, 500);
|
|
1021
|
+
function handleChoice(e) {
|
|
1022
|
+
let target = e.target;
|
|
1023
|
+
while (target.getAttribute("data-collection-name") === null) {
|
|
1024
|
+
target = target.parentElement;
|
|
1025
|
+
}
|
|
1026
|
+
const name = target.getAttribute("data-collection-name");
|
|
1027
|
+
if (name) {
|
|
1028
|
+
emits("choiced", name);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
onMounted(async () => {
|
|
1032
|
+
await fetchData();
|
|
1033
|
+
if (Array.isArray(props.collections) && props.collections.length > 0) {
|
|
1034
|
+
collections.value = props.collections;
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
return (_ctx, _cache) => {
|
|
1038
|
+
const _component_ElInput = ElInput;
|
|
1039
|
+
return openBlock(), createElementBlock("div", {
|
|
1040
|
+
class: normalizeClass(_ctx.$style.wrapper)
|
|
1041
|
+
}, [
|
|
1042
|
+
createVNode(Component$1, {
|
|
1043
|
+
ref_key: "scrollbarRef",
|
|
1044
|
+
ref: scrollbarRef,
|
|
1045
|
+
flex: "",
|
|
1046
|
+
onEndReached: unref(loadMore)
|
|
1047
|
+
}, {
|
|
1048
|
+
default: withCtx(() => [
|
|
1049
|
+
createElementVNode("div", {
|
|
1050
|
+
class: normalizeClass(_ctx.$style["search-wrapper"])
|
|
1051
|
+
}, [
|
|
1052
|
+
createVNode(_component_ElInput, {
|
|
1053
|
+
modelValue: unref(keyword),
|
|
1054
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(keyword) ? keyword.value = $event : null),
|
|
1055
|
+
placeholder: "搜索合集...",
|
|
1056
|
+
class: normalizeClass(_ctx.$style["search-input"]),
|
|
1057
|
+
clearable: "",
|
|
1058
|
+
onKeyup: unref(handleSearch),
|
|
1059
|
+
onClear: unref(handleSearch)
|
|
1060
|
+
}, null, 8, ["modelValue", "class", "onKeyup", "onClear"])
|
|
1061
|
+
], 2),
|
|
1062
|
+
createElementVNode("div", {
|
|
1063
|
+
class: normalizeClass(_ctx.$style.container),
|
|
1064
|
+
onClick: handleChoice
|
|
1065
|
+
}, [
|
|
1066
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(listCollections), (item) => {
|
|
1067
|
+
return openBlock(), createElementBlock("div", {
|
|
1068
|
+
key: item,
|
|
1069
|
+
class: normalizeClass([_ctx.$style.collection, { [_ctx.$style.active]: item === __props.collection }]),
|
|
1070
|
+
"data-collection-name": item
|
|
1071
|
+
}, [
|
|
1072
|
+
createElementVNode("h5", null, [
|
|
1073
|
+
createElementVNode("span", null, "[" + toDisplayString(unref(collectionsData)[item].total) + "]", 1),
|
|
1074
|
+
createTextVNode(toDisplayString(item), 1)
|
|
1075
|
+
]),
|
|
1076
|
+
createElementVNode("div", {
|
|
1077
|
+
class: normalizeClass(_ctx.$style.icons)
|
|
1078
|
+
}, [
|
|
1079
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(collectionsData)[item].samples, (icon) => {
|
|
1080
|
+
return openBlock(), createBlock(Component$2, {
|
|
1081
|
+
key: `${item}:${icon}`,
|
|
1082
|
+
name: `${item}:${icon}`
|
|
1083
|
+
}, null, 8, ["name"]);
|
|
1084
|
+
}), 128))
|
|
1085
|
+
], 2)
|
|
1086
|
+
], 10, _hoisted_1$1);
|
|
1087
|
+
}), 128))
|
|
1088
|
+
], 2)
|
|
1089
|
+
]),
|
|
1090
|
+
_: 1
|
|
1091
|
+
}, 8, ["onEndReached"])
|
|
1092
|
+
], 2);
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
/* unplugin-vue-components disabled */const wrapper$1 = "_wrapper_58yrj_1";
|
|
1098
|
+
const container$1 = "_container_58yrj_14";
|
|
1099
|
+
const collection = "_collection_58yrj_20";
|
|
1100
|
+
const active = "_active_58yrj_27";
|
|
1101
|
+
const icons = "_icons_58yrj_46";
|
|
1102
|
+
const style0$2 = {
|
|
1103
|
+
wrapper: wrapper$1,
|
|
1104
|
+
"search-wrapper": "_search-wrapper_58yrj_7",
|
|
1105
|
+
container: container$1,
|
|
1106
|
+
collection: collection,
|
|
1107
|
+
active: active,
|
|
1108
|
+
icons: icons
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
const cssModules$2 = {
|
|
1112
|
+
"$style": style0$2
|
|
1113
|
+
};
|
|
1114
|
+
const Collections = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__cssModules", cssModules$2]]);
|
|
1115
|
+
|
|
1116
|
+
const _hoisted_1 = ["data-icon-name"];
|
|
1117
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1118
|
+
__name: "panel",
|
|
1119
|
+
props: {
|
|
1120
|
+
modelValue: {},
|
|
1121
|
+
collection: {},
|
|
1122
|
+
collections: {}
|
|
1123
|
+
},
|
|
1124
|
+
emits: ["choiced"],
|
|
1125
|
+
setup(__props, { emit: __emit }) {
|
|
1126
|
+
const props = __props;
|
|
1127
|
+
const emits = __emit;
|
|
1128
|
+
const $style = useCssModule();
|
|
1129
|
+
const { fetchData, pageIcons, categories, currentCategory, total, ps, p, keyword, collection } = useIcon();
|
|
1130
|
+
const collectionsWrapperRef = useTemplateRef("collectionsWrapperRef");
|
|
1131
|
+
const collectionsVisible = ref(false);
|
|
1132
|
+
const icon = h(Component$2, { name: "mage:caret-left", size: 40 });
|
|
1133
|
+
const showCollections = computed(() => !(Array.isArray(props.collections) && props.collections.length === 1));
|
|
1134
|
+
async function toggleCollections() {
|
|
1135
|
+
if (!collectionsVisible.value || collectionsWrapperRef.value?.classList.contains($style.hidden)) {
|
|
1136
|
+
collectionsVisible.value = true;
|
|
1137
|
+
await promiseTimeout(0);
|
|
1138
|
+
const element = collectionsWrapperRef.value;
|
|
1139
|
+
element.classList.add($style.visible);
|
|
1140
|
+
element.classList.remove($style.hidden);
|
|
1141
|
+
setTimeout(() => {
|
|
1142
|
+
element.classList.add($style.shadow);
|
|
1143
|
+
}, 200);
|
|
1144
|
+
} else {
|
|
1145
|
+
const element = collectionsWrapperRef.value;
|
|
1146
|
+
element.classList.remove($style.shadow);
|
|
1147
|
+
element.classList.remove($style.visible);
|
|
1148
|
+
setTimeout(() => {
|
|
1149
|
+
element.classList.add($style.hidden);
|
|
1150
|
+
}, 300);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
function handleChoice(e) {
|
|
1154
|
+
let target = e.target;
|
|
1155
|
+
while (target.tagName !== "LI") {
|
|
1156
|
+
target = target.parentElement;
|
|
1157
|
+
}
|
|
1158
|
+
const name = target.getAttribute("data-icon-name");
|
|
1159
|
+
if (name) {
|
|
1160
|
+
emits("choiced", `${collection.value}:${name}`);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
function handleCollectionChoiced(name) {
|
|
1164
|
+
collection.value = name;
|
|
1165
|
+
}
|
|
1166
|
+
const collectionWatch = watch(() => props.modelValue, () => {
|
|
1167
|
+
if (props.collections?.length === 1) {
|
|
1168
|
+
collection.value = props.collections[0];
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
if (props.collection) {
|
|
1172
|
+
collection.value = props.collection;
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
if (props.modelValue && props.modelValue.includes(":")) {
|
|
1176
|
+
collection.value = props.modelValue.split(":")[0];
|
|
1177
|
+
}
|
|
1178
|
+
}, { immediate: true });
|
|
1179
|
+
onMounted(() => fetchData(collection.value));
|
|
1180
|
+
onUnmounted(() => collectionWatch.stop());
|
|
1181
|
+
return (_ctx, _cache) => {
|
|
1182
|
+
const _component_ElButton = ElButton;
|
|
1183
|
+
const _component_ElInput = ElInput;
|
|
1184
|
+
const _component_ElDivider = ElDivider;
|
|
1185
|
+
const _component_ElPagination = ElPagination;
|
|
1186
|
+
return openBlock(), createElementBlock("div", {
|
|
1187
|
+
class: normalizeClass(unref($style).panel)
|
|
1188
|
+
}, [
|
|
1189
|
+
createElementVNode("div", {
|
|
1190
|
+
class: normalizeClass(unref($style).wrapper)
|
|
1191
|
+
}, [
|
|
1192
|
+
createVNode(_component_ElInput, {
|
|
1193
|
+
modelValue: unref(keyword),
|
|
1194
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(keyword) ? keyword.value = $event : null),
|
|
1195
|
+
placeholder: "搜索图标...",
|
|
1196
|
+
class: normalizeClass(unref($style)["search-input"]),
|
|
1197
|
+
clearable: ""
|
|
1198
|
+
}, createSlots({ _: 2 }, [
|
|
1199
|
+
unref(showCollections) ? {
|
|
1200
|
+
name: "prepend",
|
|
1201
|
+
fn: withCtx(() => [
|
|
1202
|
+
createVNode(_component_ElButton, {
|
|
1203
|
+
icon: unref(icon),
|
|
1204
|
+
type: "primary",
|
|
1205
|
+
class: normalizeClass(unref($style)["collections-button"]),
|
|
1206
|
+
onClick: toggleCollections
|
|
1207
|
+
}, null, 8, ["icon", "class"])
|
|
1208
|
+
]),
|
|
1209
|
+
key: "0"
|
|
1210
|
+
} : void 0,
|
|
1211
|
+
unref(categories).length ? {
|
|
1212
|
+
name: "append",
|
|
1213
|
+
fn: withCtx(() => [
|
|
1214
|
+
createVNode(Component$3, {
|
|
1215
|
+
modelValue: unref(currentCategory),
|
|
1216
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(currentCategory) ? currentCategory.value = $event : null),
|
|
1217
|
+
placeholder: "分类",
|
|
1218
|
+
options: unref(categories),
|
|
1219
|
+
width: "120px",
|
|
1220
|
+
teleported: false,
|
|
1221
|
+
clearable: "",
|
|
1222
|
+
onChange: _cache[1] || (_cache[1] = ($event) => p.value = 1)
|
|
1223
|
+
}, null, 8, ["modelValue", "options"])
|
|
1224
|
+
]),
|
|
1225
|
+
key: "1"
|
|
1226
|
+
} : void 0
|
|
1227
|
+
]), 1032, ["modelValue", "class"]),
|
|
1228
|
+
createElementVNode("ul", {
|
|
1229
|
+
class: normalizeClass(unref($style).container),
|
|
1230
|
+
onClick: handleChoice
|
|
1231
|
+
}, [
|
|
1232
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pageIcons), (item) => {
|
|
1233
|
+
return openBlock(), createElementBlock("li", {
|
|
1234
|
+
key: item,
|
|
1235
|
+
"data-icon-name": item
|
|
1236
|
+
}, [
|
|
1237
|
+
createVNode(Component$2, {
|
|
1238
|
+
name: `${unref(collection)}:${item}`
|
|
1239
|
+
}, null, 8, ["name"])
|
|
1240
|
+
], 8, _hoisted_1);
|
|
1241
|
+
}), 128))
|
|
1242
|
+
], 2),
|
|
1243
|
+
createVNode(_component_ElDivider, {
|
|
1244
|
+
class: normalizeClass(unref($style).divider)
|
|
1245
|
+
}, null, 8, ["class"]),
|
|
1246
|
+
createVNode(_component_ElPagination, {
|
|
1247
|
+
"current-page": unref(p),
|
|
1248
|
+
"onUpdate:currentPage": _cache[3] || (_cache[3] = ($event) => isRef(p) ? p.value = $event : null),
|
|
1249
|
+
size: "small",
|
|
1250
|
+
layout: "prev, pager, next",
|
|
1251
|
+
total: unref(total),
|
|
1252
|
+
"page-size": unref(ps),
|
|
1253
|
+
class: normalizeClass(unref($style).pagination)
|
|
1254
|
+
}, null, 8, ["current-page", "total", "page-size", "class"])
|
|
1255
|
+
], 2),
|
|
1256
|
+
unref(showCollections) && unref(collectionsVisible) ? (openBlock(), createElementBlock("div", {
|
|
1257
|
+
key: 0,
|
|
1258
|
+
ref_key: "collectionsWrapperRef",
|
|
1259
|
+
ref: collectionsWrapperRef,
|
|
1260
|
+
class: normalizeClass(unref($style)["collections-wrapper"])
|
|
1261
|
+
}, [
|
|
1262
|
+
createVNode(Collections, {
|
|
1263
|
+
collection: unref(collection),
|
|
1264
|
+
collections: __props.collections,
|
|
1265
|
+
onChoiced: handleCollectionChoiced
|
|
1266
|
+
}, null, 8, ["collection", "collections"])
|
|
1267
|
+
], 2)) : createCommentVNode("", true)
|
|
1268
|
+
], 2);
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
/* unplugin-vue-components disabled */const panel = "_panel_16t7i_1";
|
|
1274
|
+
const wrapper = "_wrapper_16t7i_5";
|
|
1275
|
+
const shadow = "_shadow_16t7i_42";
|
|
1276
|
+
const visible = "_visible_16t7i_45";
|
|
1277
|
+
const hidden = "_hidden_16t7i_48";
|
|
1278
|
+
const container = "_container_16t7i_52";
|
|
1279
|
+
const divider = "_divider_16t7i_73";
|
|
1280
|
+
const pagination = "_pagination_16t7i_77";
|
|
1281
|
+
const style0$1 = {
|
|
1282
|
+
panel: panel,
|
|
1283
|
+
wrapper: wrapper,
|
|
1284
|
+
"search-input": "_search-input_16t7i_11",
|
|
1285
|
+
"collections-button": "_collections-button_16t7i_15",
|
|
1286
|
+
"collections-wrapper": "_collections-wrapper_16t7i_30",
|
|
1287
|
+
shadow: shadow,
|
|
1288
|
+
visible: visible,
|
|
1289
|
+
hidden: hidden,
|
|
1290
|
+
container: container,
|
|
1291
|
+
divider: divider,
|
|
1292
|
+
pagination: pagination
|
|
1293
|
+
};
|
|
1294
|
+
|
|
1295
|
+
const cssModules$1 = {
|
|
1296
|
+
"$style": style0$1
|
|
1297
|
+
};
|
|
1298
|
+
const Panel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__cssModules", cssModules$1]]);
|
|
1299
|
+
|
|
1300
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1301
|
+
__name: "icon-picker",
|
|
1302
|
+
props: {
|
|
1303
|
+
modelValue: {},
|
|
1304
|
+
collection: {},
|
|
1305
|
+
collections: {}
|
|
1306
|
+
},
|
|
1307
|
+
emits: ["update:modelValue", "change"],
|
|
1308
|
+
setup(__props, { emit: __emit }) {
|
|
1309
|
+
const props = __props;
|
|
1310
|
+
const emits = __emit;
|
|
1311
|
+
const visible = ref(false);
|
|
1312
|
+
const panelVisible = ref(false);
|
|
1313
|
+
const myValue = useVModel(props, "modelValue", emits);
|
|
1314
|
+
const iconName = computed(() => myValue.value || "lucide:grip");
|
|
1315
|
+
function handleChoiced(icon) {
|
|
1316
|
+
myValue.value = icon;
|
|
1317
|
+
visible.value = false;
|
|
1318
|
+
emits("change", icon);
|
|
1319
|
+
}
|
|
1320
|
+
const pickerVisibleWatch = watch(visible, (val) => {
|
|
1321
|
+
if (!val) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
panelVisible.value = true;
|
|
1325
|
+
pickerVisibleWatch.stop();
|
|
1326
|
+
});
|
|
1327
|
+
return (_ctx, _cache) => {
|
|
1328
|
+
const _component_ElPopover = ElPopover;
|
|
1329
|
+
return openBlock(), createBlock(_component_ElPopover, {
|
|
1330
|
+
visible: unref(visible),
|
|
1331
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => isRef(visible) ? visible.value = $event : null),
|
|
1332
|
+
placement: "bottom-start",
|
|
1333
|
+
trigger: "click",
|
|
1334
|
+
width: "350px"
|
|
1335
|
+
}, {
|
|
1336
|
+
reference: withCtx(() => [
|
|
1337
|
+
createVNode(Component$4, mergeProps({
|
|
1338
|
+
modelValue: unref(myValue),
|
|
1339
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(myValue) ? myValue.value = $event : null),
|
|
1340
|
+
class: _ctx.$style.input
|
|
1341
|
+
}, _ctx.$attrs), {
|
|
1342
|
+
prepend: withCtx(() => [
|
|
1343
|
+
createVNode(Component$2, {
|
|
1344
|
+
name: unref(iconName),
|
|
1345
|
+
size: "24"
|
|
1346
|
+
}, null, 8, ["name"])
|
|
1347
|
+
]),
|
|
1348
|
+
_: 1
|
|
1349
|
+
}, 16, ["modelValue", "class"])
|
|
1350
|
+
]),
|
|
1351
|
+
default: withCtx(() => [
|
|
1352
|
+
unref(panelVisible) ? (openBlock(), createBlock(Panel, mergeProps({ key: 0 }, props, { onChoiced: handleChoiced }), null, 16)) : createCommentVNode("", true)
|
|
1353
|
+
]),
|
|
1354
|
+
_: 1
|
|
1355
|
+
}, 8, ["visible"]);
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
/* unplugin-vue-components disabled */const input = "_input_1gamt_1";
|
|
1361
|
+
const style0 = {
|
|
1362
|
+
input: input
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
const cssModules = {
|
|
1366
|
+
"$style": style0
|
|
1367
|
+
};
|
|
1368
|
+
const Component = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__cssModules", cssModules]]);
|
|
1369
|
+
|
|
1370
|
+
const __vite_glob_0_19 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1371
|
+
__proto__: null,
|
|
1372
|
+
default: Component
|
|
1373
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1374
|
+
|
|
1375
|
+
export { Component as C, __vite_glob_0_19 as _ };
|