@wfrog/vc-ui 1.2.0 → 1.3.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.
Files changed (85) hide show
  1. package/dist/es/chunk/{DHpbQMGk.mjs → -_x5oKYF.mjs} +4 -4
  2. package/dist/es/chunk/{DX38FfmL.mjs → 4F1xxyju.mjs} +18 -18
  3. package/dist/es/chunk/{BoGGHTrJ.mjs → 9qQNa4bM.mjs} +1 -1
  4. package/dist/es/chunk/{DQHGjqG5.mjs → BIK5Djc_.mjs} +1 -1
  5. package/dist/es/chunk/{ezK_XQQd.mjs → BJTCqgn1.mjs} +1 -1
  6. package/dist/es/chunk/{egk9EEzo.mjs → BKmk2ptO.mjs} +2 -2
  7. package/dist/es/chunk/{CitH0taR.mjs → BQHHM_Gw.mjs} +16 -16
  8. package/dist/es/chunk/{DKpRXDRE.mjs → BQyZW57B.mjs} +3 -3
  9. package/dist/es/chunk/{BA2yoAwy.mjs → BaqDgAvL.mjs} +8 -8
  10. package/dist/es/chunk/{Dcm-lOj8.mjs → BiHWk71g.mjs} +1 -1
  11. package/dist/es/chunk/{Bl0WQiki.mjs → C50_dziC.mjs} +1 -1
  12. package/dist/es/chunk/{D7JQbDFE.mjs → C540ZOUa.mjs} +8 -8
  13. package/dist/es/chunk/{Bnot0Gwc.mjs → C6bIuBQg.mjs} +3 -3
  14. package/dist/es/chunk/{CzqeSQn4.mjs → C72pWnuz.mjs} +4 -4
  15. package/dist/es/chunk/{BK4T_2ha.mjs → C9ldJ8Hh.mjs} +1 -1
  16. package/dist/es/chunk/{BUf50Y7Y.mjs → CCmEeM7D.mjs} +4 -4
  17. package/dist/es/chunk/{oW98L-44.mjs → CQbpo0im.mjs} +2 -2
  18. package/dist/es/chunk/{CNILa-hz.mjs → CV2NA_2e.mjs} +1 -1
  19. package/dist/es/chunk/{BYVaz5Or.mjs → C_7t9blX.mjs} +1 -1
  20. package/dist/es/chunk/{DdmNdV7I.mjs → Cekqdlxf.mjs} +8 -8
  21. package/dist/es/chunk/{Dsye5ZEp.mjs → CtYp4FB7.mjs} +1 -1
  22. package/dist/es/chunk/{DfHTA5LW.mjs → D1PKXAql.mjs} +1 -1
  23. package/dist/es/chunk/{CidLkmft.mjs → DATKTbFj.mjs} +4 -4
  24. package/dist/es/chunk/{U13Qpiki.mjs → DEiqPcuO.mjs} +2 -2
  25. package/dist/es/chunk/{DTEM_vYZ.mjs → DFHjl3eL.mjs} +1 -1
  26. package/dist/es/chunk/{B1BnPYNG.mjs → DFxeI_lP.mjs} +5 -5
  27. package/dist/es/chunk/{DMYHOxhk.mjs → DGGhWn1A.mjs} +5 -5
  28. package/dist/es/chunk/{CcKUdl3e.mjs → DO-mBaf5.mjs} +1 -1
  29. package/dist/es/chunk/{C7Dgjpd1.mjs → DTpr71Gd.mjs} +2 -2
  30. package/dist/es/chunk/{_8u_XVHh.mjs → DcTh6n4x.mjs} +4 -4
  31. package/dist/es/chunk/{BTsEMnf_.mjs → Dn-BFXcJ.mjs} +1 -1
  32. package/dist/es/chunk/{CKbkzlkO.mjs → Dqk3gyUk.mjs} +7 -7
  33. package/dist/es/chunk/{BI-fNJhk.mjs → DskGUrkJ.mjs} +1 -1
  34. package/dist/es/chunk/{BDyXj_90.mjs → OVbHCQoq.mjs} +1 -1
  35. package/dist/es/chunk/{DgFT6snA.mjs → Vv8g5_A1.mjs} +8 -8
  36. package/dist/es/chunk/{CM_I1FoA.mjs → Xk5kfdyT.mjs} +1 -1
  37. package/dist/es/chunk/{CL5WTCB3.mjs → aX4SRHmD.mjs} +1 -1
  38. package/dist/es/chunk/{DEPZhJ0Z.mjs → b9dx0jdT.mjs} +3 -3
  39. package/dist/es/chunk/{DgSzI6Fw.mjs → eN6VJ63C.mjs} +8 -8
  40. package/dist/es/components/backbottom/backbottom.mjs +2 -2
  41. package/dist/es/components/button/button.mjs +6 -6
  42. package/dist/es/components/choice/choice.mjs +2 -2
  43. package/dist/es/components/cropper/cropper.mjs +8 -8
  44. package/dist/es/components/currency/currency.mjs +5 -5
  45. package/dist/es/components/daterange-picker/daterange-picker.mjs +17 -17
  46. package/dist/es/components/dialog/dialog.mjs +9 -9
  47. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +10 -10
  48. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +3 -3
  49. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +8 -8
  50. package/dist/es/components/drag-verify/drag-verify.mjs +4 -4
  51. package/dist/es/components/drawer/drawer.mjs +8 -8
  52. package/dist/es/components/dual-pane/dual-pane.d.ts +8 -0
  53. package/dist/es/components/dual-pane/dual-pane.mjs +855 -0
  54. package/dist/es/components/dual-pane/dual-pane.vue.d.ts +23 -0
  55. package/dist/es/components/dual-pane/index.css +8 -0
  56. package/dist/es/components/dual-pane/index.d.ts +4 -0
  57. package/dist/es/components/dual-pane/index.mjs +6 -0
  58. package/dist/es/components/easy-pagination/easy-pagination.mjs +4 -4
  59. package/dist/es/components/el-icon/el-icon.mjs +2 -2
  60. package/dist/es/components/icon/icon2.mjs +1 -1
  61. package/dist/es/components/icon-picker/icon-picker.mjs +15 -15
  62. package/dist/es/components/iconify-icon/iconify-icon.mjs +2 -2
  63. package/dist/es/components/image/image.mjs +5 -5
  64. package/dist/es/components/input/input.mjs +4 -4
  65. package/dist/es/components/input-number/input-number.mjs +5 -5
  66. package/dist/es/components/pca-picker/pca-picker.mjs +15 -15
  67. package/dist/es/components/screenfull/screenfull.mjs +4 -4
  68. package/dist/es/components/scrollbar/index.css +4 -3
  69. package/dist/es/components/scrollbar/scrollbar.mjs +5 -5
  70. package/dist/es/components/select/select.mjs +7 -7
  71. package/dist/es/components/single-player/single-player.mjs +10 -10
  72. package/dist/es/components/svg-icon/svg-icon.mjs +2 -2
  73. package/dist/es/components/switch/switch.mjs +2 -2
  74. package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +2 -2
  75. package/dist/es/components/tags/tags.mjs +17 -11
  76. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +4 -4
  77. package/dist/es/components/thousand-input/thousand-input.mjs +2 -2
  78. package/dist/es/components/tinymce/tinymce.mjs +4 -4
  79. package/dist/es/components/tree-picker/tree-picker.mjs +10 -10
  80. package/dist/es/components/upload-file/upload-file.mjs +2 -2
  81. package/dist/es/index.d.ts +1 -0
  82. package/dist/es/index.mjs +28 -26
  83. package/dist/global.d.ts +1 -0
  84. package/dist/index.css +12 -3
  85. package/package.json +1 -1
@@ -0,0 +1,855 @@
1
+ import './index.css'
2
+ import { c as buildProps, h as isString, N as NOOP, u as useNamespace, m as isObject, t as throwError } from '../../chunk/DO-mBaf5.mjs';
3
+ import { shallowRef, defineComponent, h, triggerRef, onMounted, isVNode, ref, computed, watch, toRef, getCurrentInstance, provide, reactive, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, renderSlot, createVNode, createCommentVNode, nextTick, createElementVNode, createBlock, resolveDynamicComponent, inject, toRefs, onBeforeUnmount, Fragment, mergeProps, withCtx, useCssVars } from 'vue';
4
+ import { C as Component$1 } from '../scrollbar/scrollbar.mjs';
5
+ import { _ as _export_sfc, w as withInstall, a as withNoopInstall } from '../../chunk/Dn-BFXcJ.mjs';
6
+ import { useElementSize } from '@vueuse/core';
7
+ import { f as flattedChildren } from '../../chunk/C_7t9blX.mjs';
8
+ import { ArrowLeft, ArrowUp, ArrowRight, ArrowDown } from '@element-plus/icons-vue';
9
+ import { _ as _export_sfc$1 } from '../../chunk/pcqpp-6-.mjs';
10
+
11
+ const getOrderedChildren = (vm, childComponentName, children) => {
12
+ const nodes = flattedChildren(vm.subTree).filter(
13
+ (n) => {
14
+ var _a;
15
+ return isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
16
+ }
17
+ );
18
+ const uids = nodes.map((n) => n.component.uid);
19
+ return uids.map((uid) => children[uid]).filter((p) => !!p);
20
+ };
21
+ const useOrderedChildren = (vm, childComponentName) => {
22
+ const children = shallowRef({});
23
+ const orderedChildren = shallowRef([]);
24
+ const nodesMap = /* @__PURE__ */ new WeakMap();
25
+ const addChild = (child) => {
26
+ children.value[child.uid] = child;
27
+ triggerRef(children);
28
+ onMounted(() => {
29
+ const childNode = child.getVnode().el;
30
+ const parentNode = childNode.parentNode;
31
+ if (!nodesMap.has(parentNode)) {
32
+ nodesMap.set(parentNode, []);
33
+ const originalFn = parentNode.insertBefore.bind(parentNode);
34
+ parentNode.insertBefore = (node, anchor) => {
35
+ const shouldSortChildren = nodesMap.get(parentNode).some((el) => node === el || anchor === el);
36
+ if (shouldSortChildren)
37
+ triggerRef(children);
38
+ return originalFn(node, anchor);
39
+ };
40
+ }
41
+ nodesMap.get(parentNode).push(childNode);
42
+ });
43
+ };
44
+ const removeChild = (child) => {
45
+ delete children.value[child.uid];
46
+ triggerRef(children);
47
+ const childNode = child.getVnode().el;
48
+ const parentNode = childNode.parentNode;
49
+ const childNodes = nodesMap.get(parentNode);
50
+ const index = childNodes.indexOf(childNode);
51
+ childNodes.splice(index, 1);
52
+ };
53
+ const sortChildren = () => {
54
+ orderedChildren.value = getOrderedChildren(
55
+ vm,
56
+ childComponentName,
57
+ children.value
58
+ );
59
+ };
60
+ const IsolatedRenderer = (props) => {
61
+ return props.render();
62
+ };
63
+ const ChildrenSorter = defineComponent({
64
+ setup(_, { slots }) {
65
+ return () => {
66
+ sortChildren();
67
+ return slots.default ? h(IsolatedRenderer, {
68
+ render: slots.default
69
+ }) : null;
70
+ };
71
+ }
72
+ });
73
+ return {
74
+ children: orderedChildren,
75
+ addChild,
76
+ removeChild,
77
+ ChildrenSorter
78
+ };
79
+ };
80
+
81
+ const splitterProps = buildProps({
82
+ layout: {
83
+ type: String,
84
+ default: "horizontal",
85
+ values: ["horizontal", "vertical"]
86
+ },
87
+ lazy: Boolean
88
+ });
89
+ const splitterEmits = {
90
+ resizeStart: (index, sizes) => true,
91
+ resize: (index, sizes) => true,
92
+ resizeEnd: (index, sizes) => true,
93
+ collapse: (index, type, sizes) => true
94
+ };
95
+
96
+ const splitterRootContextKey = Symbol(
97
+ "splitterRootContextKey"
98
+ );
99
+
100
+ function useContainer(layout) {
101
+ const containerEl = ref();
102
+ const { width, height } = useElementSize(containerEl);
103
+ const containerSize = computed(() => {
104
+ return layout.value === "horizontal" ? width.value : height.value;
105
+ });
106
+ return { containerEl, containerSize };
107
+ }
108
+
109
+ function getPct(str) {
110
+ return Number(str.slice(0, -1)) / 100;
111
+ }
112
+ function getPx(str) {
113
+ return Number(str.slice(0, -2));
114
+ }
115
+ function isPct(itemSize) {
116
+ return isString(itemSize) && itemSize.endsWith("%");
117
+ }
118
+ function isPx(itemSize) {
119
+ return isString(itemSize) && itemSize.endsWith("px");
120
+ }
121
+ function useSize(panels, containerSize) {
122
+ const propSizes = computed(() => panels.value.map((i) => i.size));
123
+ const panelCounts = computed(() => panels.value.length);
124
+ const percentSizes = ref([]);
125
+ watch([propSizes, panelCounts, containerSize], () => {
126
+ var _a;
127
+ let ptgList = [];
128
+ let emptyCount = 0;
129
+ for (let i = 0; i < panelCounts.value; i += 1) {
130
+ const itemSize = (_a = panels.value[i]) == null ? void 0 : _a.size;
131
+ if (isPct(itemSize)) {
132
+ ptgList[i] = getPct(itemSize);
133
+ } else if (isPx(itemSize)) {
134
+ ptgList[i] = getPx(itemSize) / containerSize.value;
135
+ } else if (itemSize || itemSize === 0) {
136
+ const num = Number(itemSize);
137
+ if (!Number.isNaN(num)) {
138
+ ptgList[i] = num / containerSize.value;
139
+ }
140
+ } else {
141
+ emptyCount += 1;
142
+ ptgList[i] = void 0;
143
+ }
144
+ }
145
+ const totalPtg = ptgList.reduce((acc, ptg) => acc + (ptg || 0), 0);
146
+ if (totalPtg > 1 || !emptyCount) {
147
+ const scale = 1 / totalPtg;
148
+ ptgList = ptgList.map((ptg) => ptg === void 0 ? 0 : ptg * scale);
149
+ } else {
150
+ const avgRest = (1 - totalPtg) / emptyCount;
151
+ ptgList = ptgList.map((ptg) => ptg === void 0 ? avgRest : ptg);
152
+ }
153
+ percentSizes.value = ptgList;
154
+ });
155
+ const ptg2px = (ptg) => ptg * containerSize.value;
156
+ const pxSizes = computed(() => percentSizes.value.map(ptg2px));
157
+ return { percentSizes, pxSizes };
158
+ }
159
+
160
+ function useResize(panels, containerSize, pxSizes, lazy) {
161
+ const ptg2px = (ptg) => ptg * containerSize.value || 0;
162
+ function getLimitSize(str, defaultLimit) {
163
+ if (isPct(str)) {
164
+ return ptg2px(getPct(str));
165
+ } else if (isPx(str)) {
166
+ return getPx(str);
167
+ }
168
+ return str != null ? str : defaultLimit;
169
+ }
170
+ const lazyOffset = ref(0);
171
+ const movingIndex = ref(null);
172
+ let cachePxSizes = [];
173
+ let updatePanelSizes = NOOP;
174
+ const limitSizes = computed(
175
+ () => panels.value.map((item) => [item.min, item.max])
176
+ );
177
+ watch(lazy, () => {
178
+ if (lazyOffset.value) {
179
+ const mouseup = new MouseEvent("mouseup", { bubbles: true });
180
+ window.dispatchEvent(mouseup);
181
+ }
182
+ });
183
+ const onMoveStart = (index) => {
184
+ lazyOffset.value = 0;
185
+ movingIndex.value = { index, confirmed: false };
186
+ cachePxSizes = pxSizes.value;
187
+ };
188
+ const onMoving = (index, offset) => {
189
+ var _a, _b;
190
+ let confirmedIndex = null;
191
+ if ((!movingIndex.value || !movingIndex.value.confirmed) && offset !== 0) {
192
+ if (offset > 0) {
193
+ confirmedIndex = index;
194
+ movingIndex.value = { index, confirmed: true };
195
+ } else {
196
+ for (let i = index; i >= 0; i -= 1) {
197
+ if (cachePxSizes[i] > 0) {
198
+ confirmedIndex = i;
199
+ movingIndex.value = { index: i, confirmed: true };
200
+ break;
201
+ }
202
+ }
203
+ }
204
+ }
205
+ const mergedIndex = (_b = confirmedIndex != null ? confirmedIndex : (_a = movingIndex.value) == null ? void 0 : _a.index) != null ? _b : index;
206
+ const numSizes = [...cachePxSizes];
207
+ const nextIndex = mergedIndex + 1;
208
+ const startMinSize = getLimitSize(limitSizes.value[mergedIndex][0], 0);
209
+ const endMinSize = getLimitSize(limitSizes.value[nextIndex][0], 0);
210
+ const startMaxSize = getLimitSize(
211
+ limitSizes.value[mergedIndex][1],
212
+ containerSize.value || 0
213
+ );
214
+ const endMaxSize = getLimitSize(
215
+ limitSizes.value[nextIndex][1],
216
+ containerSize.value || 0
217
+ );
218
+ let mergedOffset = offset;
219
+ if (numSizes[mergedIndex] + mergedOffset < startMinSize) {
220
+ mergedOffset = startMinSize - numSizes[mergedIndex];
221
+ }
222
+ if (numSizes[nextIndex] - mergedOffset < endMinSize) {
223
+ mergedOffset = numSizes[nextIndex] - endMinSize;
224
+ }
225
+ if (numSizes[mergedIndex] + mergedOffset > startMaxSize) {
226
+ mergedOffset = startMaxSize - numSizes[mergedIndex];
227
+ }
228
+ if (numSizes[nextIndex] - mergedOffset > endMaxSize) {
229
+ mergedOffset = numSizes[nextIndex] - endMaxSize;
230
+ }
231
+ numSizes[mergedIndex] += mergedOffset;
232
+ numSizes[nextIndex] -= mergedOffset;
233
+ lazyOffset.value = mergedOffset;
234
+ updatePanelSizes = () => {
235
+ panels.value.forEach((panel, index2) => {
236
+ panel.size = numSizes[index2];
237
+ });
238
+ updatePanelSizes = NOOP;
239
+ };
240
+ if (!lazy.value) {
241
+ updatePanelSizes();
242
+ }
243
+ };
244
+ const onMoveEnd = () => {
245
+ if (lazy.value) {
246
+ updatePanelSizes();
247
+ }
248
+ lazyOffset.value = 0;
249
+ movingIndex.value = null;
250
+ cachePxSizes = [];
251
+ };
252
+ const cacheCollapsedSize = [];
253
+ const onCollapse = (index, type) => {
254
+ if (!cacheCollapsedSize.length) {
255
+ cacheCollapsedSize.push(...pxSizes.value);
256
+ }
257
+ const currentSizes = pxSizes.value;
258
+ const currentIndex = type === "start" ? index : index + 1;
259
+ const targetIndex = type === "start" ? index + 1 : index;
260
+ const currentSize = currentSizes[currentIndex];
261
+ const targetSize = currentSizes[targetIndex];
262
+ if (currentSize !== 0 && targetSize !== 0) {
263
+ currentSizes[currentIndex] = 0;
264
+ currentSizes[targetIndex] += currentSize;
265
+ cacheCollapsedSize[index] = currentSize;
266
+ } else {
267
+ const totalSize = currentSize + targetSize;
268
+ const targetCacheCollapsedSize = cacheCollapsedSize[index];
269
+ const currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
270
+ currentSizes[targetIndex] = targetCacheCollapsedSize;
271
+ currentSizes[currentIndex] = currentCacheCollapsedSize;
272
+ }
273
+ panels.value.forEach((panel, index2) => {
274
+ panel.size = currentSizes[index2];
275
+ });
276
+ };
277
+ return {
278
+ lazyOffset,
279
+ onMoveStart,
280
+ onMoving,
281
+ onMoveEnd,
282
+ movingIndex,
283
+ onCollapse
284
+ };
285
+ }
286
+
287
+ const _sfc_main$3 = defineComponent({
288
+ ...{
289
+ name: "ElSplitter"
290
+ },
291
+ __name: "splitter",
292
+ props: splitterProps,
293
+ emits: splitterEmits,
294
+ setup(__props, { emit: __emit }) {
295
+ const ns = useNamespace("splitter");
296
+ const emits = __emit;
297
+ const props = __props;
298
+ const layout = toRef(props, "layout");
299
+ const lazy = toRef(props, "lazy");
300
+ const { containerEl, containerSize } = useContainer(layout);
301
+ const {
302
+ removeChild: unregisterPanel,
303
+ children: panels,
304
+ addChild: registerPanel,
305
+ ChildrenSorter: PanelsSorter
306
+ } = useOrderedChildren(getCurrentInstance(), "ElSplitterPanel");
307
+ watch(panels, () => {
308
+ movingIndex.value = null;
309
+ panels.value.forEach((instance, index) => {
310
+ instance.setIndex(index);
311
+ });
312
+ });
313
+ const { percentSizes, pxSizes } = useSize(panels, containerSize);
314
+ const {
315
+ lazyOffset,
316
+ movingIndex,
317
+ onMoveStart,
318
+ onMoving,
319
+ onMoveEnd,
320
+ onCollapse
321
+ } = useResize(panels, containerSize, pxSizes, lazy);
322
+ const splitterStyles = computed(() => {
323
+ return {
324
+ [ns.cssVarBlockName("bar-offset")]: lazy.value ? `${lazyOffset.value}px` : void 0
325
+ };
326
+ });
327
+ const onResizeStart = (index) => {
328
+ onMoveStart(index);
329
+ emits("resizeStart", index, pxSizes.value);
330
+ };
331
+ const onResize = (index, offset) => {
332
+ onMoving(index, offset);
333
+ if (!lazy.value) {
334
+ emits("resize", index, pxSizes.value);
335
+ }
336
+ };
337
+ const onResizeEnd = async (index) => {
338
+ onMoveEnd();
339
+ await nextTick();
340
+ emits("resizeEnd", index, pxSizes.value);
341
+ };
342
+ const onCollapsible = (index, type) => {
343
+ onCollapse(index, type);
344
+ emits("collapse", index, type, pxSizes.value);
345
+ };
346
+ provide(
347
+ splitterRootContextKey,
348
+ reactive({
349
+ panels,
350
+ percentSizes,
351
+ pxSizes,
352
+ layout,
353
+ lazy,
354
+ movingIndex,
355
+ containerSize,
356
+ onMoveStart: onResizeStart,
357
+ onMoving: onResize,
358
+ onMoveEnd: onResizeEnd,
359
+ onCollapse: onCollapsible,
360
+ registerPanel,
361
+ unregisterPanel
362
+ })
363
+ );
364
+ return (_ctx, _cache) => {
365
+ return openBlock(), createElementBlock(
366
+ "div",
367
+ {
368
+ ref_key: "containerEl",
369
+ ref: containerEl,
370
+ class: normalizeClass([unref(ns).b(), unref(ns).e(layout.value)]),
371
+ style: normalizeStyle(splitterStyles.value)
372
+ },
373
+ [
374
+ renderSlot(_ctx.$slots, "default"),
375
+ createVNode(unref(PanelsSorter)),
376
+ createCommentVNode(" Prevent iframe touch events from breaking "),
377
+ unref(movingIndex) ? (openBlock(), createElementBlock(
378
+ "div",
379
+ {
380
+ key: 0,
381
+ class: normalizeClass([unref(ns).e("mask"), unref(ns).e(`mask-${layout.value}`)])
382
+ },
383
+ null,
384
+ 2
385
+ )) : createCommentVNode("v-if", true)
386
+ ],
387
+ 6
388
+ );
389
+ };
390
+ }
391
+ });
392
+ var Splitter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/splitter/src/splitter.vue"]]);
393
+
394
+ function getCollapsible(collapsible) {
395
+ if (collapsible && isObject(collapsible)) {
396
+ return collapsible;
397
+ }
398
+ return {
399
+ start: !!collapsible,
400
+ end: !!collapsible
401
+ };
402
+ }
403
+ function isCollapsible(panel, size, nextPanel, nextSize) {
404
+ if ((panel == null ? void 0 : panel.collapsible.end) && size > 0) {
405
+ return true;
406
+ }
407
+ if ((nextPanel == null ? void 0 : nextPanel.collapsible.start) && nextSize === 0 && size > 0) {
408
+ return true;
409
+ }
410
+ return false;
411
+ }
412
+
413
+ const _sfc_main$2 = defineComponent({
414
+ ...{
415
+ name: "ElSplitterBar"
416
+ },
417
+ __name: "split-bar",
418
+ props: {
419
+ index: {
420
+ type: Number,
421
+ required: true
422
+ },
423
+ layout: {
424
+ type: String,
425
+ values: ["horizontal", "vertical"],
426
+ default: "horizontal"
427
+ },
428
+ resizable: {
429
+ type: Boolean,
430
+ default: true
431
+ },
432
+ lazy: Boolean,
433
+ startCollapsible: Boolean,
434
+ endCollapsible: Boolean
435
+ },
436
+ emits: ["moveStart", "moving", "moveEnd", "collapse"],
437
+ setup(__props, { emit: __emit }) {
438
+ const ns = useNamespace("splitter-bar");
439
+ const props = __props;
440
+ const emit = __emit;
441
+ const isHorizontal = computed(() => props.layout === "horizontal");
442
+ const barWrapStyles = computed(() => {
443
+ if (isHorizontal.value) {
444
+ return { width: 0 };
445
+ }
446
+ return { height: 0 };
447
+ });
448
+ const draggerStyles = computed(() => {
449
+ return {
450
+ width: isHorizontal.value ? "16px" : "100%",
451
+ height: isHorizontal.value ? "100%" : "16px",
452
+ cursor: !props.resizable ? "auto" : isHorizontal.value ? "ew-resize" : "ns-resize",
453
+ touchAction: "none"
454
+ };
455
+ });
456
+ const draggerPseudoClass = computed(() => {
457
+ const prefix = ns.e("dragger");
458
+ return {
459
+ [`${prefix}-horizontal`]: isHorizontal.value,
460
+ [`${prefix}-vertical`]: !isHorizontal.value,
461
+ [`${prefix}-active`]: !!startPos.value
462
+ };
463
+ });
464
+ const startPos = ref(null);
465
+ const onMousedown = (e) => {
466
+ if (!props.resizable)
467
+ return;
468
+ startPos.value = [e.pageX, e.pageY];
469
+ emit("moveStart", props.index);
470
+ window.addEventListener("mouseup", onMouseUp);
471
+ window.addEventListener("mousemove", onMouseMove);
472
+ };
473
+ const onTouchStart = (e) => {
474
+ if (props.resizable && e.touches.length === 1) {
475
+ e.preventDefault();
476
+ const touch = e.touches[0];
477
+ startPos.value = [touch.pageX, touch.pageY];
478
+ emit("moveStart", props.index);
479
+ window.addEventListener("touchend", onTouchEnd);
480
+ window.addEventListener("touchmove", onTouchMove);
481
+ }
482
+ };
483
+ const onMouseMove = (e) => {
484
+ const { pageX, pageY } = e;
485
+ const offsetX = pageX - startPos.value[0];
486
+ const offsetY = pageY - startPos.value[1];
487
+ const offset = isHorizontal.value ? offsetX : offsetY;
488
+ emit("moving", props.index, offset);
489
+ };
490
+ const onTouchMove = (e) => {
491
+ if (e.touches.length === 1) {
492
+ e.preventDefault();
493
+ const touch = e.touches[0];
494
+ const offsetX = touch.pageX - startPos.value[0];
495
+ const offsetY = touch.pageY - startPos.value[1];
496
+ const offset = isHorizontal.value ? offsetX : offsetY;
497
+ emit("moving", props.index, offset);
498
+ }
499
+ };
500
+ const onMouseUp = () => {
501
+ startPos.value = null;
502
+ window.removeEventListener("mouseup", onMouseUp);
503
+ window.removeEventListener("mousemove", onMouseMove);
504
+ emit("moveEnd", props.index);
505
+ };
506
+ const onTouchEnd = () => {
507
+ startPos.value = null;
508
+ window.removeEventListener("touchend", onTouchEnd);
509
+ window.removeEventListener("touchmove", onTouchMove);
510
+ emit("moveEnd", props.index);
511
+ };
512
+ const StartIcon = computed(() => isHorizontal.value ? ArrowLeft : ArrowUp);
513
+ const EndIcon = computed(() => isHorizontal.value ? ArrowRight : ArrowDown);
514
+ return (_ctx, _cache) => {
515
+ return openBlock(), createElementBlock(
516
+ "div",
517
+ {
518
+ class: normalizeClass([unref(ns).b()]),
519
+ style: normalizeStyle(barWrapStyles.value)
520
+ },
521
+ [
522
+ __props.startCollapsible ? (openBlock(), createElementBlock(
523
+ "div",
524
+ {
525
+ key: 0,
526
+ class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-start`)]),
527
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("collapse", __props.index, "start"))
528
+ },
529
+ [
530
+ renderSlot(_ctx.$slots, "start-collapsible", {}, () => [
531
+ (openBlock(), createBlock(resolveDynamicComponent(StartIcon.value), { style: { "width": "12px", "height": "12px" } }))
532
+ ])
533
+ ],
534
+ 2
535
+ )) : createCommentVNode("v-if", true),
536
+ createElementVNode(
537
+ "div",
538
+ {
539
+ class: normalizeClass([
540
+ unref(ns).e("dragger"),
541
+ draggerPseudoClass.value,
542
+ unref(ns).is("disabled", !__props.resizable),
543
+ unref(ns).is("lazy", __props.resizable && __props.lazy)
544
+ ]),
545
+ style: normalizeStyle(draggerStyles.value),
546
+ onMousedown,
547
+ onTouchstart: onTouchStart
548
+ },
549
+ null,
550
+ 38
551
+ ),
552
+ __props.endCollapsible ? (openBlock(), createElementBlock(
553
+ "div",
554
+ {
555
+ key: 1,
556
+ class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-end`)]),
557
+ onClick: _cache[1] || (_cache[1] = ($event) => emit("collapse", __props.index, "end"))
558
+ },
559
+ [
560
+ renderSlot(_ctx.$slots, "end-collapsible", {}, () => [
561
+ (openBlock(), createBlock(resolveDynamicComponent(EndIcon.value), { style: { "width": "12px", "height": "12px" } }))
562
+ ])
563
+ ],
564
+ 2
565
+ )) : createCommentVNode("v-if", true)
566
+ ],
567
+ 6
568
+ );
569
+ };
570
+ }
571
+ });
572
+ var SplitBar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/splitter/src/split-bar.vue"]]);
573
+
574
+ const splitterPanelProps = buildProps({
575
+ min: {
576
+ type: [String, Number]
577
+ },
578
+ max: {
579
+ type: [String, Number]
580
+ },
581
+ size: {
582
+ type: [String, Number]
583
+ },
584
+ resizable: {
585
+ type: Boolean,
586
+ default: true
587
+ },
588
+ collapsible: Boolean
589
+ });
590
+ const splitterPanelEmits = {
591
+ "update:size": (value) => typeof value === "number" || typeof value === "string"
592
+ };
593
+
594
+ const COMPONENT_NAME = "ElSplitterPanel";
595
+ const _sfc_main$1 = defineComponent({
596
+ ...{
597
+ name: COMPONENT_NAME
598
+ },
599
+ __name: "split-panel",
600
+ props: splitterPanelProps,
601
+ emits: splitterPanelEmits,
602
+ setup(__props, { expose: __expose, emit: __emit }) {
603
+ const ns = useNamespace("splitter-panel");
604
+ const props = __props;
605
+ const emits = __emit;
606
+ const splitterContext = inject(splitterRootContextKey);
607
+ if (!splitterContext)
608
+ throwError(
609
+ COMPONENT_NAME,
610
+ "usage: <el-splitter><el-splitter-panel /></el-splitter/>"
611
+ );
612
+ const { panels, layout, lazy, containerSize, pxSizes } = toRefs(splitterContext);
613
+ const {
614
+ registerPanel,
615
+ unregisterPanel,
616
+ onCollapse,
617
+ onMoveEnd,
618
+ onMoveStart,
619
+ onMoving
620
+ } = splitterContext;
621
+ const panelEl = ref();
622
+ const instance = getCurrentInstance();
623
+ const uid = instance.uid;
624
+ const index = ref(0);
625
+ const panel = computed(() => panels.value[index.value]);
626
+ const setIndex = (val) => {
627
+ index.value = val;
628
+ };
629
+ const panelSize = computed(() => {
630
+ var _a;
631
+ if (!panel.value)
632
+ return 0;
633
+ return (_a = pxSizes.value[index.value]) != null ? _a : 0;
634
+ });
635
+ const nextSize = computed(() => {
636
+ var _a;
637
+ if (!panel.value)
638
+ return 0;
639
+ return (_a = pxSizes.value[index.value + 1]) != null ? _a : 0;
640
+ });
641
+ const nextPanel = computed(() => {
642
+ if (panel.value) {
643
+ return panels.value[index.value + 1];
644
+ }
645
+ return null;
646
+ });
647
+ const isResizable = computed(() => {
648
+ var _a;
649
+ if (!nextPanel.value)
650
+ return false;
651
+ return props.resizable && ((_a = nextPanel.value) == null ? void 0 : _a.resizable) && (panelSize.value !== 0 || !props.min) && (nextSize.value !== 0 || !nextPanel.value.min);
652
+ });
653
+ const isShowBar = computed(() => {
654
+ if (!panel.value)
655
+ return false;
656
+ return index.value !== panels.value.length - 1;
657
+ });
658
+ const startCollapsible = computed(
659
+ () => isCollapsible(panel.value, panelSize.value, nextPanel.value, nextSize.value)
660
+ );
661
+ const endCollapsible = computed(
662
+ () => isCollapsible(nextPanel.value, nextSize.value, panel.value, panelSize.value)
663
+ );
664
+ function sizeToPx(str) {
665
+ if (isPct(str)) {
666
+ return getPct(str) * containerSize.value || 0;
667
+ } else if (isPx(str)) {
668
+ return getPx(str);
669
+ }
670
+ return str != null ? str : 0;
671
+ }
672
+ let isSizeUpdating = false;
673
+ watch(
674
+ () => props.size,
675
+ () => {
676
+ if (!isSizeUpdating && panel.value) {
677
+ if (!containerSize.value) {
678
+ panel.value.size = props.size;
679
+ return;
680
+ }
681
+ const size = sizeToPx(props.size);
682
+ const maxSize = sizeToPx(props.max);
683
+ const minSize = sizeToPx(props.min);
684
+ const finalSize = Math.min(Math.max(size, minSize || 0), maxSize || size);
685
+ if (finalSize !== size) {
686
+ emits("update:size", finalSize);
687
+ }
688
+ panel.value.size = finalSize;
689
+ }
690
+ }
691
+ );
692
+ watch(
693
+ () => {
694
+ var _a;
695
+ return (_a = panel.value) == null ? void 0 : _a.size;
696
+ },
697
+ (val) => {
698
+ if (val !== props.size) {
699
+ isSizeUpdating = true;
700
+ emits("update:size", val);
701
+ nextTick(() => isSizeUpdating = false);
702
+ }
703
+ }
704
+ );
705
+ watch(
706
+ () => props.resizable,
707
+ (val) => {
708
+ if (panel.value) {
709
+ panel.value.resizable = val;
710
+ }
711
+ }
712
+ );
713
+ const _panel = reactive({
714
+ el: panelEl.value,
715
+ uid,
716
+ getVnode: () => instance.vnode,
717
+ setIndex,
718
+ ...props,
719
+ collapsible: computed(() => getCollapsible(props.collapsible))
720
+ });
721
+ registerPanel(_panel);
722
+ onBeforeUnmount(() => unregisterPanel(_panel));
723
+ __expose({
724
+ splitterPanelRef: panelEl
725
+ });
726
+ return (_ctx, _cache) => {
727
+ return openBlock(), createElementBlock(
728
+ Fragment,
729
+ null,
730
+ [
731
+ createElementVNode(
732
+ "div",
733
+ mergeProps({
734
+ ref_key: "panelEl",
735
+ ref: panelEl,
736
+ class: [unref(ns).b()],
737
+ style: { flexBasis: `${panelSize.value}px` }
738
+ }, _ctx.$attrs),
739
+ [
740
+ renderSlot(_ctx.$slots, "default")
741
+ ],
742
+ 16
743
+ ),
744
+ isShowBar.value ? (openBlock(), createBlock(SplitBar, {
745
+ key: 0,
746
+ index: index.value,
747
+ layout: unref(layout),
748
+ lazy: unref(lazy),
749
+ resizable: isResizable.value,
750
+ "start-collapsible": startCollapsible.value,
751
+ "end-collapsible": endCollapsible.value,
752
+ onMoveStart: unref(onMoveStart),
753
+ onMoving: unref(onMoving),
754
+ onMoveEnd: unref(onMoveEnd),
755
+ onCollapse: unref(onCollapse)
756
+ }, {
757
+ "start-collapsible": withCtx(() => [
758
+ renderSlot(_ctx.$slots, "start-collapsible")
759
+ ]),
760
+ "end-collapsible": withCtx(() => [
761
+ renderSlot(_ctx.$slots, "end-collapsible")
762
+ ]),
763
+ _: 3
764
+ }, 8, ["index", "layout", "lazy", "resizable", "start-collapsible", "end-collapsible", "onMoveStart", "onMoving", "onMoveEnd", "onCollapse"])) : createCommentVNode("v-if", true)
765
+ ],
766
+ 64
767
+ );
768
+ };
769
+ }
770
+ });
771
+ var SplitPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/splitter/src/split-panel.vue"]]);
772
+
773
+ const ElSplitter = withInstall(Splitter, {
774
+ SplitPanel
775
+ });
776
+ const ElSplitterPanel = withNoopInstall(SplitPanel);
777
+
778
+ const _sfc_main = /* @__PURE__ */ defineComponent({
779
+ __name: "dual-pane",
780
+ props: {
781
+ layout: { default: "horizontal" },
782
+ lazy: { type: Boolean, default: true },
783
+ padding: { default: 8 },
784
+ props1: {},
785
+ props2: {}
786
+ },
787
+ setup(__props) {
788
+ useCssVars((_ctx) => ({
789
+ "v1d983e20": `${_ctx.padding}px`
790
+ }));
791
+ return (_ctx, _cache) => {
792
+ const _component_el_splitter_panel = ElSplitterPanel;
793
+ const _component_el_splitter = ElSplitter;
794
+ return openBlock(), createBlock(_component_el_splitter, {
795
+ layout: __props.layout,
796
+ lazy: __props.lazy
797
+ }, {
798
+ default: withCtx(() => [
799
+ createVNode(_component_el_splitter_panel, mergeProps(__props.props1, {
800
+ class: _ctx.$style.panel
801
+ }), {
802
+ default: withCtx(() => [
803
+ createVNode(Component$1, {
804
+ flex: "",
805
+ "view-class": _ctx.$style.container
806
+ }, {
807
+ default: withCtx(() => [
808
+ renderSlot(_ctx.$slots, "panel1")
809
+ ]),
810
+ _: 3
811
+ }, 8, ["view-class"])
812
+ ]),
813
+ _: 3
814
+ }, 16, ["class"]),
815
+ createVNode(_component_el_splitter_panel, mergeProps(__props.props2, {
816
+ class: _ctx.$style.panel
817
+ }), {
818
+ default: withCtx(() => [
819
+ createVNode(Component$1, {
820
+ flex: "",
821
+ "view-class": _ctx.$style.container
822
+ }, {
823
+ default: withCtx(() => [
824
+ renderSlot(_ctx.$slots, "panel2")
825
+ ]),
826
+ _: 3
827
+ }, 8, ["view-class"])
828
+ ]),
829
+ _: 3
830
+ }, 16, ["class"])
831
+ ]),
832
+ _: 3
833
+ }, 8, ["layout", "lazy"]);
834
+ };
835
+ }
836
+ });
837
+
838
+ /* unplugin-vue-components disabled */const panel = "_panel_ixgp9_1";
839
+ const container = "_container_ixgp9_6";
840
+ const style0 = {
841
+ panel: panel,
842
+ container: container
843
+ };
844
+
845
+ const cssModules = {
846
+ "$style": style0
847
+ };
848
+ const Component = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__cssModules", cssModules]]);
849
+
850
+ const __vite_glob_0_16 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
851
+ __proto__: null,
852
+ default: Component
853
+ }, Symbol.toStringTag, { value: 'Module' }));
854
+
855
+ export { Component as C, __vite_glob_0_16 as _ };