@wfrog/vc-ui 1.11.10 → 1.11.11

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 (134) hide show
  1. package/dist/es/chunk/Bw0Rhd-r.mjs +110 -0
  2. package/dist/es/chunk/CqTdDZkE.mjs +31 -0
  3. package/dist/es/chunk/{DAnWZLYj.mjs → CzWfBa_8.mjs} +96 -2
  4. package/dist/es/chunk/D229kQ56.mjs +28 -0
  5. package/dist/es/chunk/{Cxx_YWUC.mjs → DcouM6gM.mjs} +6 -548
  6. package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
  7. package/dist/es/chunk/KanuIcmc.mjs +412 -0
  8. package/dist/es/chunk/{B71xEPfK.mjs → uuUHUjSk.mjs} +4 -35
  9. package/dist/es/components/backbottom/backbottom.mjs +3 -2
  10. package/dist/es/components/button/button.mjs +4 -5
  11. package/dist/es/components/choice/choice.mjs +4 -4
  12. package/dist/es/components/choice/index.css +1 -1
  13. package/dist/es/components/color-switch/color-switch.mjs +73 -1046
  14. package/dist/es/components/color-switch/index.css +1 -1
  15. package/dist/es/components/cropper/cropper.mjs +11 -117
  16. package/dist/es/components/cropper/index.css +1 -1
  17. package/dist/es/components/currency/currency.mjs +4 -5
  18. package/dist/es/components/daterange-picker/daterange-picker.mjs +8 -6253
  19. package/dist/es/components/dialog/dialog.mjs +7 -400
  20. package/dist/es/components/dialog/index.css +1 -1
  21. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +10 -11
  22. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +4 -3
  23. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +9 -1374
  24. package/dist/es/components/dialog-upload-images/index.css +1 -1
  25. package/dist/es/components/drag-verify/drag-verify.mjs +3 -2
  26. package/dist/es/components/drawer/drawer.mjs +10 -352
  27. package/dist/es/components/drawer/index.css +1 -1
  28. package/dist/es/components/easy-pagination/easy-pagination.mjs +3 -2
  29. package/dist/es/components/explorer/explorer.mjs +3 -3
  30. package/dist/es/components/explorer-column-table/explorer-column-table.mjs +5 -7
  31. package/dist/es/components/explorer-column-table/index.css +1 -1
  32. package/dist/es/components/explorer-container/explorer-container.d.ts +1 -1
  33. package/dist/es/components/explorer-container/explorer-container.mjs +4 -3
  34. package/dist/es/components/explorer-filter/explorer-filter.mjs +5 -4
  35. package/dist/es/components/explorer-footer/explorer-footer.mjs +4 -8
  36. package/dist/es/components/explorer-form/explorer-form.mjs +4 -3
  37. package/dist/es/components/explorer-list/explorer-list.mjs +5 -4
  38. package/dist/es/components/explorer-modal-form/explorer-modal-form.mjs +4 -3
  39. package/dist/es/components/explorer-panel/explorer-panel.mjs +3 -3
  40. package/dist/es/components/explorer-query/explorer-query.mjs +9 -2201
  41. package/dist/es/components/explorer-query/index.css +1 -1
  42. package/dist/es/components/explorer-table/explorer-table.mjs +5 -8
  43. package/dist/es/components/explorer-tools/explorer-tools.mjs +13 -264
  44. package/dist/es/components/explorer-tools/index.css +1 -1
  45. package/dist/es/components/explorer-tree/explorer-tree.mjs +4 -5
  46. package/dist/es/components/icon-picker/icon-picker.mjs +8 -12
  47. package/dist/es/components/image/image.mjs +4 -4
  48. package/dist/es/components/info-tooltip/info-tooltip.mjs +336 -4
  49. package/dist/es/components/input/input.mjs +3 -2
  50. package/dist/es/components/input-number/input-number.mjs +3 -3
  51. package/dist/es/components/pca-picker/index.css +1 -1
  52. package/dist/es/components/pca-picker/pca-picker.mjs +443 -601
  53. package/dist/es/components/screenfull/screenfull.mjs +4 -3
  54. package/dist/es/components/scrollbar/scrollbar.mjs +3 -2
  55. package/dist/es/components/select/select.mjs +3 -5
  56. package/dist/es/components/single-player/index.css +1 -1
  57. package/dist/es/components/single-player/single-player.mjs +10 -1087
  58. package/dist/es/components/splitter/splitter.mjs +3 -3
  59. package/dist/es/components/splitter-panel/splitter-panel.mjs +3 -3
  60. package/dist/es/components/switch/index.css +1 -1
  61. package/dist/es/components/switch/switch.mjs +9 -395
  62. package/dist/es/components/tags/tags.mjs +7 -9
  63. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +3 -3
  64. package/dist/es/components/thousand-input/thousand-input.mjs +33 -1
  65. package/dist/es/components/tinymce/tinymce.mjs +4 -3
  66. package/dist/es/components/transfer/transfer.mjs +3 -4
  67. package/dist/es/components/transfer-panel/transfer-panel.mjs +5 -4
  68. package/dist/es/components/tree-picker/popover-cascader.css +1 -1
  69. package/dist/es/components/tree-picker/tree-picker.mjs +5 -10
  70. package/dist/es/index.mjs +1 -1
  71. package/dist/index.css +13 -40
  72. package/package.json +1 -1
  73. package/dist/es/chunk/B-rxnVJv.mjs +0 -3
  74. package/dist/es/chunk/B5HpgPRt.mjs +0 -69
  75. package/dist/es/chunk/BBhZKpIc.mjs +0 -2179
  76. package/dist/es/chunk/BDcsaNYa.mjs +0 -59
  77. package/dist/es/chunk/BTSSEFfD.mjs +0 -319
  78. package/dist/es/chunk/BTpNRPQW.mjs +0 -55
  79. package/dist/es/chunk/BVBK1U57.mjs +0 -96
  80. package/dist/es/chunk/Bc6yUGLs.mjs +0 -45
  81. package/dist/es/chunk/BjVI1XMz.mjs +0 -40
  82. package/dist/es/chunk/BlzQCBDu.mjs +0 -5741
  83. package/dist/es/chunk/BpJKnxlF.mjs +0 -476
  84. package/dist/es/chunk/Brp-qSBw.mjs +0 -2003
  85. package/dist/es/chunk/BunQI8Jb.mjs +0 -390
  86. package/dist/es/chunk/C0XgBrDz.mjs +0 -775
  87. package/dist/es/chunk/C0pTANRX.mjs +0 -109
  88. package/dist/es/chunk/CBMjhoFP.mjs +0 -101
  89. package/dist/es/chunk/CBiNtNvQ.mjs +0 -242
  90. package/dist/es/chunk/CBlJeNBO.mjs +0 -890
  91. package/dist/es/chunk/CCVL_Zj-.mjs +0 -427
  92. package/dist/es/chunk/CEl4MyfJ.mjs +0 -252
  93. package/dist/es/chunk/CJK5_jsA.mjs +0 -53
  94. package/dist/es/chunk/CKOcwq5V.mjs +0 -44
  95. package/dist/es/chunk/COs9dJZa.mjs +0 -66
  96. package/dist/es/chunk/CPt6MxJW.mjs +0 -375
  97. package/dist/es/chunk/CVqW0jzp.mjs +0 -107
  98. package/dist/es/chunk/CccIsEqA.mjs +0 -128
  99. package/dist/es/chunk/CjLR27-a.mjs +0 -582
  100. package/dist/es/chunk/CoGexPPD.mjs +0 -2192
  101. package/dist/es/chunk/CsLIbnzG.mjs +0 -64
  102. package/dist/es/chunk/Ct6q2FXg.mjs +0 -5
  103. package/dist/es/chunk/Cuq5meQh.mjs +0 -184
  104. package/dist/es/chunk/CvYIOfT1.mjs +0 -23
  105. package/dist/es/chunk/CxHJBf4l.mjs +0 -31
  106. package/dist/es/chunk/CzdaOBtA.mjs +0 -66
  107. package/dist/es/chunk/D0QTifnI.mjs +0 -54
  108. package/dist/es/chunk/D1QnA2iT.mjs +0 -229
  109. package/dist/es/chunk/D3AvJlVX.mjs +0 -188
  110. package/dist/es/chunk/D9Lr0Bzb.mjs +0 -1136
  111. package/dist/es/chunk/DCkPv0hy.mjs +0 -29
  112. package/dist/es/chunk/DRwwUUhy.mjs +0 -49
  113. package/dist/es/chunk/DX-2VRY2.mjs +0 -836
  114. package/dist/es/chunk/DZ2oTFad.mjs +0 -687
  115. package/dist/es/chunk/D_bou1py.mjs +0 -55
  116. package/dist/es/chunk/Da199A5L.mjs +0 -314
  117. package/dist/es/chunk/DbhQlaOz.mjs +0 -94
  118. package/dist/es/chunk/Dgu95mOy.mjs +0 -237
  119. package/dist/es/chunk/DhGOsWxx.mjs +0 -6
  120. package/dist/es/chunk/Dm_Sj5aH.mjs +0 -487
  121. package/dist/es/chunk/Dmi-1GRO.mjs +0 -163
  122. package/dist/es/chunk/DodoD9a9.mjs +0 -52
  123. package/dist/es/chunk/DrrVDcwm.mjs +0 -955
  124. package/dist/es/chunk/Du_zJ1Fz.mjs +0 -49
  125. package/dist/es/chunk/DxxbB5jY.mjs +0 -34
  126. package/dist/es/chunk/Gk1J52Yw.mjs +0 -207
  127. package/dist/es/chunk/NsldgdCh.mjs +0 -704
  128. package/dist/es/chunk/V6KjsUQN.mjs +0 -35
  129. package/dist/es/chunk/eEsLFV3s.mjs +0 -76
  130. package/dist/es/chunk/fqiLhk0V.mjs +0 -2065
  131. package/dist/es/chunk/nxVM7re4.mjs +0 -35
  132. package/dist/es/chunk/s7HLrANj.mjs +0 -215
  133. package/dist/es/chunk/vPhxogl3.mjs +0 -19
  134. package/dist/es/components/icon/icon2.mjs +0 -27
@@ -1,775 +0,0 @@
1
- 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 } from 'vue';
2
- import { b as buildProps, i as isString, N as NOOP, u as useNamespace, j as isObject, t as throwError } from './Gk1J52Yw.mjs';
3
- import { _ as _export_sfc, w as withInstall, a as withNoopInstall } from './V6KjsUQN.mjs';
4
- import { useElementSize } from '@vueuse/core';
5
- import { f as flattedChildren } from './DRwwUUhy.mjs';
6
- import { ArrowLeft, ArrowUp, ArrowRight, ArrowDown } from '@element-plus/icons-vue';
7
-
8
- const getOrderedChildren = (vm, childComponentName, children) => {
9
- const nodes = flattedChildren(vm.subTree).filter(
10
- (n) => {
11
- var _a;
12
- return isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
13
- }
14
- );
15
- const uids = nodes.map((n) => n.component.uid);
16
- return uids.map((uid) => children[uid]).filter((p) => !!p);
17
- };
18
- const useOrderedChildren = (vm, childComponentName) => {
19
- const children = shallowRef({});
20
- const orderedChildren = shallowRef([]);
21
- const nodesMap = /* @__PURE__ */ new WeakMap();
22
- const addChild = (child) => {
23
- children.value[child.uid] = child;
24
- triggerRef(children);
25
- onMounted(() => {
26
- const childNode = child.getVnode().el;
27
- const parentNode = childNode.parentNode;
28
- if (!nodesMap.has(parentNode)) {
29
- nodesMap.set(parentNode, []);
30
- const originalFn = parentNode.insertBefore.bind(parentNode);
31
- parentNode.insertBefore = (node, anchor) => {
32
- const shouldSortChildren = nodesMap.get(parentNode).some((el) => node === el || anchor === el);
33
- if (shouldSortChildren)
34
- triggerRef(children);
35
- return originalFn(node, anchor);
36
- };
37
- }
38
- nodesMap.get(parentNode).push(childNode);
39
- });
40
- };
41
- const removeChild = (child) => {
42
- delete children.value[child.uid];
43
- triggerRef(children);
44
- const childNode = child.getVnode().el;
45
- const parentNode = childNode.parentNode;
46
- const childNodes = nodesMap.get(parentNode);
47
- const index = childNodes.indexOf(childNode);
48
- childNodes.splice(index, 1);
49
- };
50
- const sortChildren = () => {
51
- orderedChildren.value = getOrderedChildren(
52
- vm,
53
- childComponentName,
54
- children.value
55
- );
56
- };
57
- const IsolatedRenderer = (props) => {
58
- return props.render();
59
- };
60
- const ChildrenSorter = defineComponent({
61
- setup(_, { slots }) {
62
- return () => {
63
- sortChildren();
64
- return slots.default ? h(IsolatedRenderer, {
65
- render: slots.default
66
- }) : null;
67
- };
68
- }
69
- });
70
- return {
71
- children: orderedChildren,
72
- addChild,
73
- removeChild,
74
- ChildrenSorter
75
- };
76
- };
77
-
78
- const splitterProps = buildProps({
79
- layout: {
80
- type: String,
81
- default: "horizontal",
82
- values: ["horizontal", "vertical"]
83
- },
84
- lazy: Boolean
85
- });
86
- const splitterEmits = {
87
- resizeStart: (index, sizes) => true,
88
- resize: (index, sizes) => true,
89
- resizeEnd: (index, sizes) => true,
90
- collapse: (index, type, sizes) => true
91
- };
92
-
93
- const splitterRootContextKey = Symbol(
94
- "splitterRootContextKey"
95
- );
96
-
97
- function useContainer(layout) {
98
- const containerEl = ref();
99
- const { width, height } = useElementSize(containerEl);
100
- const containerSize = computed(() => {
101
- return layout.value === "horizontal" ? width.value : height.value;
102
- });
103
- return { containerEl, containerSize };
104
- }
105
-
106
- function getPct(str) {
107
- return Number(str.slice(0, -1)) / 100;
108
- }
109
- function getPx(str) {
110
- return Number(str.slice(0, -2));
111
- }
112
- function isPct(itemSize) {
113
- return isString(itemSize) && itemSize.endsWith("%");
114
- }
115
- function isPx(itemSize) {
116
- return isString(itemSize) && itemSize.endsWith("px");
117
- }
118
- function useSize(panels, containerSize) {
119
- const propSizes = computed(() => panels.value.map((i) => i.size));
120
- const panelCounts = computed(() => panels.value.length);
121
- const percentSizes = ref([]);
122
- watch([propSizes, panelCounts, containerSize], () => {
123
- var _a;
124
- let ptgList = [];
125
- let emptyCount = 0;
126
- for (let i = 0; i < panelCounts.value; i += 1) {
127
- const itemSize = (_a = panels.value[i]) == null ? void 0 : _a.size;
128
- if (isPct(itemSize)) {
129
- ptgList[i] = getPct(itemSize);
130
- } else if (isPx(itemSize)) {
131
- ptgList[i] = getPx(itemSize) / containerSize.value;
132
- } else if (itemSize || itemSize === 0) {
133
- const num = Number(itemSize);
134
- if (!Number.isNaN(num)) {
135
- ptgList[i] = num / containerSize.value;
136
- }
137
- } else {
138
- emptyCount += 1;
139
- ptgList[i] = void 0;
140
- }
141
- }
142
- const totalPtg = ptgList.reduce((acc, ptg) => acc + (ptg || 0), 0);
143
- if (totalPtg > 1 || !emptyCount) {
144
- const scale = 1 / totalPtg;
145
- ptgList = ptgList.map((ptg) => ptg === void 0 ? 0 : ptg * scale);
146
- } else {
147
- const avgRest = (1 - totalPtg) / emptyCount;
148
- ptgList = ptgList.map((ptg) => ptg === void 0 ? avgRest : ptg);
149
- }
150
- percentSizes.value = ptgList;
151
- });
152
- const ptg2px = (ptg) => ptg * containerSize.value;
153
- const pxSizes = computed(() => percentSizes.value.map(ptg2px));
154
- return { percentSizes, pxSizes };
155
- }
156
-
157
- function useResize(panels, containerSize, pxSizes, lazy) {
158
- const ptg2px = (ptg) => ptg * containerSize.value || 0;
159
- function getLimitSize(str, defaultLimit) {
160
- if (isPct(str)) {
161
- return ptg2px(getPct(str));
162
- } else if (isPx(str)) {
163
- return getPx(str);
164
- }
165
- return str != null ? str : defaultLimit;
166
- }
167
- const lazyOffset = ref(0);
168
- const movingIndex = ref(null);
169
- let cachePxSizes = [];
170
- let updatePanelSizes = NOOP;
171
- const limitSizes = computed(
172
- () => panels.value.map((item) => [item.min, item.max])
173
- );
174
- watch(lazy, () => {
175
- if (lazyOffset.value) {
176
- const mouseup = new MouseEvent("mouseup", { bubbles: true });
177
- window.dispatchEvent(mouseup);
178
- }
179
- });
180
- const onMoveStart = (index) => {
181
- lazyOffset.value = 0;
182
- movingIndex.value = { index, confirmed: false };
183
- cachePxSizes = pxSizes.value;
184
- };
185
- const onMoving = (index, offset) => {
186
- var _a, _b;
187
- let confirmedIndex = null;
188
- if ((!movingIndex.value || !movingIndex.value.confirmed) && offset !== 0) {
189
- if (offset > 0) {
190
- confirmedIndex = index;
191
- movingIndex.value = { index, confirmed: true };
192
- } else {
193
- for (let i = index; i >= 0; i -= 1) {
194
- if (cachePxSizes[i] > 0) {
195
- confirmedIndex = i;
196
- movingIndex.value = { index: i, confirmed: true };
197
- break;
198
- }
199
- }
200
- }
201
- }
202
- const mergedIndex = (_b = confirmedIndex != null ? confirmedIndex : (_a = movingIndex.value) == null ? void 0 : _a.index) != null ? _b : index;
203
- const numSizes = [...cachePxSizes];
204
- const nextIndex = mergedIndex + 1;
205
- const startMinSize = getLimitSize(limitSizes.value[mergedIndex][0], 0);
206
- const endMinSize = getLimitSize(limitSizes.value[nextIndex][0], 0);
207
- const startMaxSize = getLimitSize(
208
- limitSizes.value[mergedIndex][1],
209
- containerSize.value || 0
210
- );
211
- const endMaxSize = getLimitSize(
212
- limitSizes.value[nextIndex][1],
213
- containerSize.value || 0
214
- );
215
- let mergedOffset = offset;
216
- if (numSizes[mergedIndex] + mergedOffset < startMinSize) {
217
- mergedOffset = startMinSize - numSizes[mergedIndex];
218
- }
219
- if (numSizes[nextIndex] - mergedOffset < endMinSize) {
220
- mergedOffset = numSizes[nextIndex] - endMinSize;
221
- }
222
- if (numSizes[mergedIndex] + mergedOffset > startMaxSize) {
223
- mergedOffset = startMaxSize - numSizes[mergedIndex];
224
- }
225
- if (numSizes[nextIndex] - mergedOffset > endMaxSize) {
226
- mergedOffset = numSizes[nextIndex] - endMaxSize;
227
- }
228
- numSizes[mergedIndex] += mergedOffset;
229
- numSizes[nextIndex] -= mergedOffset;
230
- lazyOffset.value = mergedOffset;
231
- updatePanelSizes = () => {
232
- panels.value.forEach((panel, index2) => {
233
- panel.size = numSizes[index2];
234
- });
235
- updatePanelSizes = NOOP;
236
- };
237
- if (!lazy.value) {
238
- updatePanelSizes();
239
- }
240
- };
241
- const onMoveEnd = () => {
242
- if (lazy.value) {
243
- updatePanelSizes();
244
- }
245
- lazyOffset.value = 0;
246
- movingIndex.value = null;
247
- cachePxSizes = [];
248
- };
249
- const cacheCollapsedSize = [];
250
- const onCollapse = (index, type) => {
251
- if (!cacheCollapsedSize.length) {
252
- cacheCollapsedSize.push(...pxSizes.value);
253
- }
254
- const currentSizes = pxSizes.value;
255
- const currentIndex = type === "start" ? index : index + 1;
256
- const targetIndex = type === "start" ? index + 1 : index;
257
- const currentSize = currentSizes[currentIndex];
258
- const targetSize = currentSizes[targetIndex];
259
- if (currentSize !== 0 && targetSize !== 0) {
260
- currentSizes[currentIndex] = 0;
261
- currentSizes[targetIndex] += currentSize;
262
- cacheCollapsedSize[index] = currentSize;
263
- } else {
264
- const totalSize = currentSize + targetSize;
265
- const targetCacheCollapsedSize = cacheCollapsedSize[index];
266
- const currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
267
- currentSizes[targetIndex] = targetCacheCollapsedSize;
268
- currentSizes[currentIndex] = currentCacheCollapsedSize;
269
- }
270
- panels.value.forEach((panel, index2) => {
271
- panel.size = currentSizes[index2];
272
- });
273
- };
274
- return {
275
- lazyOffset,
276
- onMoveStart,
277
- onMoving,
278
- onMoveEnd,
279
- movingIndex,
280
- onCollapse
281
- };
282
- }
283
-
284
- const _sfc_main$2 = defineComponent({
285
- ...{
286
- name: "ElSplitter"
287
- },
288
- __name: "splitter",
289
- props: splitterProps,
290
- emits: splitterEmits,
291
- setup(__props, { emit: __emit }) {
292
- const ns = useNamespace("splitter");
293
- const emits = __emit;
294
- const props = __props;
295
- const layout = toRef(props, "layout");
296
- const lazy = toRef(props, "lazy");
297
- const { containerEl, containerSize } = useContainer(layout);
298
- const {
299
- removeChild: unregisterPanel,
300
- children: panels,
301
- addChild: registerPanel,
302
- ChildrenSorter: PanelsSorter
303
- } = useOrderedChildren(getCurrentInstance(), "ElSplitterPanel");
304
- watch(panels, () => {
305
- movingIndex.value = null;
306
- panels.value.forEach((instance, index) => {
307
- instance.setIndex(index);
308
- });
309
- });
310
- const { percentSizes, pxSizes } = useSize(panels, containerSize);
311
- const {
312
- lazyOffset,
313
- movingIndex,
314
- onMoveStart,
315
- onMoving,
316
- onMoveEnd,
317
- onCollapse
318
- } = useResize(panels, containerSize, pxSizes, lazy);
319
- const splitterStyles = computed(() => {
320
- return {
321
- [ns.cssVarBlockName("bar-offset")]: lazy.value ? `${lazyOffset.value}px` : void 0
322
- };
323
- });
324
- const onResizeStart = (index) => {
325
- onMoveStart(index);
326
- emits("resizeStart", index, pxSizes.value);
327
- };
328
- const onResize = (index, offset) => {
329
- onMoving(index, offset);
330
- if (!lazy.value) {
331
- emits("resize", index, pxSizes.value);
332
- }
333
- };
334
- const onResizeEnd = async (index) => {
335
- onMoveEnd();
336
- await nextTick();
337
- emits("resizeEnd", index, pxSizes.value);
338
- };
339
- const onCollapsible = (index, type) => {
340
- onCollapse(index, type);
341
- emits("collapse", index, type, pxSizes.value);
342
- };
343
- provide(
344
- splitterRootContextKey,
345
- reactive({
346
- panels,
347
- percentSizes,
348
- pxSizes,
349
- layout,
350
- lazy,
351
- movingIndex,
352
- containerSize,
353
- onMoveStart: onResizeStart,
354
- onMoving: onResize,
355
- onMoveEnd: onResizeEnd,
356
- onCollapse: onCollapsible,
357
- registerPanel,
358
- unregisterPanel
359
- })
360
- );
361
- return (_ctx, _cache) => {
362
- return openBlock(), createElementBlock(
363
- "div",
364
- {
365
- ref_key: "containerEl",
366
- ref: containerEl,
367
- class: normalizeClass([unref(ns).b(), unref(ns).e(layout.value)]),
368
- style: normalizeStyle(splitterStyles.value)
369
- },
370
- [
371
- renderSlot(_ctx.$slots, "default"),
372
- createVNode(unref(PanelsSorter)),
373
- createCommentVNode(" Prevent iframe touch events from breaking "),
374
- unref(movingIndex) ? (openBlock(), createElementBlock(
375
- "div",
376
- {
377
- key: 0,
378
- class: normalizeClass([unref(ns).e("mask"), unref(ns).e(`mask-${layout.value}`)])
379
- },
380
- null,
381
- 2
382
- )) : createCommentVNode("v-if", true)
383
- ],
384
- 6
385
- );
386
- };
387
- }
388
- });
389
- var Splitter = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/splitter/src/splitter.vue"]]);
390
-
391
- function getCollapsible(collapsible) {
392
- if (collapsible && isObject(collapsible)) {
393
- return collapsible;
394
- }
395
- return {
396
- start: !!collapsible,
397
- end: !!collapsible
398
- };
399
- }
400
- function isCollapsible(panel, size, nextPanel, nextSize) {
401
- if ((panel == null ? void 0 : panel.collapsible.end) && size > 0) {
402
- return true;
403
- }
404
- if ((nextPanel == null ? void 0 : nextPanel.collapsible.start) && nextSize === 0 && size > 0) {
405
- return true;
406
- }
407
- return false;
408
- }
409
-
410
- const _sfc_main$1 = defineComponent({
411
- ...{
412
- name: "ElSplitterBar"
413
- },
414
- __name: "split-bar",
415
- props: {
416
- index: {
417
- type: Number,
418
- required: true
419
- },
420
- layout: {
421
- type: String,
422
- values: ["horizontal", "vertical"],
423
- default: "horizontal"
424
- },
425
- resizable: {
426
- type: Boolean,
427
- default: true
428
- },
429
- lazy: Boolean,
430
- startCollapsible: Boolean,
431
- endCollapsible: Boolean
432
- },
433
- emits: ["moveStart", "moving", "moveEnd", "collapse"],
434
- setup(__props, { emit: __emit }) {
435
- const ns = useNamespace("splitter-bar");
436
- const props = __props;
437
- const emit = __emit;
438
- const isHorizontal = computed(() => props.layout === "horizontal");
439
- const barWrapStyles = computed(() => {
440
- if (isHorizontal.value) {
441
- return { width: 0 };
442
- }
443
- return { height: 0 };
444
- });
445
- const draggerStyles = computed(() => {
446
- return {
447
- width: isHorizontal.value ? "16px" : "100%",
448
- height: isHorizontal.value ? "100%" : "16px",
449
- cursor: !props.resizable ? "auto" : isHorizontal.value ? "ew-resize" : "ns-resize",
450
- touchAction: "none"
451
- };
452
- });
453
- const draggerPseudoClass = computed(() => {
454
- const prefix = ns.e("dragger");
455
- return {
456
- [`${prefix}-horizontal`]: isHorizontal.value,
457
- [`${prefix}-vertical`]: !isHorizontal.value,
458
- [`${prefix}-active`]: !!startPos.value
459
- };
460
- });
461
- const startPos = ref(null);
462
- const onMousedown = (e) => {
463
- if (!props.resizable)
464
- return;
465
- startPos.value = [e.pageX, e.pageY];
466
- emit("moveStart", props.index);
467
- window.addEventListener("mouseup", onMouseUp);
468
- window.addEventListener("mousemove", onMouseMove);
469
- };
470
- const onTouchStart = (e) => {
471
- if (props.resizable && e.touches.length === 1) {
472
- e.preventDefault();
473
- const touch = e.touches[0];
474
- startPos.value = [touch.pageX, touch.pageY];
475
- emit("moveStart", props.index);
476
- window.addEventListener("touchend", onTouchEnd);
477
- window.addEventListener("touchmove", onTouchMove);
478
- }
479
- };
480
- const onMouseMove = (e) => {
481
- const { pageX, pageY } = e;
482
- const offsetX = pageX - startPos.value[0];
483
- const offsetY = pageY - startPos.value[1];
484
- const offset = isHorizontal.value ? offsetX : offsetY;
485
- emit("moving", props.index, offset);
486
- };
487
- const onTouchMove = (e) => {
488
- if (e.touches.length === 1) {
489
- e.preventDefault();
490
- const touch = e.touches[0];
491
- const offsetX = touch.pageX - startPos.value[0];
492
- const offsetY = touch.pageY - startPos.value[1];
493
- const offset = isHorizontal.value ? offsetX : offsetY;
494
- emit("moving", props.index, offset);
495
- }
496
- };
497
- const onMouseUp = () => {
498
- startPos.value = null;
499
- window.removeEventListener("mouseup", onMouseUp);
500
- window.removeEventListener("mousemove", onMouseMove);
501
- emit("moveEnd", props.index);
502
- };
503
- const onTouchEnd = () => {
504
- startPos.value = null;
505
- window.removeEventListener("touchend", onTouchEnd);
506
- window.removeEventListener("touchmove", onTouchMove);
507
- emit("moveEnd", props.index);
508
- };
509
- const StartIcon = computed(() => isHorizontal.value ? ArrowLeft : ArrowUp);
510
- const EndIcon = computed(() => isHorizontal.value ? ArrowRight : ArrowDown);
511
- return (_ctx, _cache) => {
512
- return openBlock(), createElementBlock(
513
- "div",
514
- {
515
- class: normalizeClass([unref(ns).b()]),
516
- style: normalizeStyle(barWrapStyles.value)
517
- },
518
- [
519
- __props.startCollapsible ? (openBlock(), createElementBlock(
520
- "div",
521
- {
522
- key: 0,
523
- class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-start`)]),
524
- onClick: _cache[0] || (_cache[0] = ($event) => emit("collapse", __props.index, "start"))
525
- },
526
- [
527
- renderSlot(_ctx.$slots, "start-collapsible", {}, () => [
528
- (openBlock(), createBlock(resolveDynamicComponent(StartIcon.value), { style: { "width": "12px", "height": "12px" } }))
529
- ])
530
- ],
531
- 2
532
- )) : createCommentVNode("v-if", true),
533
- createElementVNode(
534
- "div",
535
- {
536
- class: normalizeClass([
537
- unref(ns).e("dragger"),
538
- draggerPseudoClass.value,
539
- unref(ns).is("disabled", !__props.resizable),
540
- unref(ns).is("lazy", __props.resizable && __props.lazy)
541
- ]),
542
- style: normalizeStyle(draggerStyles.value),
543
- onMousedown,
544
- onTouchstart: onTouchStart
545
- },
546
- null,
547
- 38
548
- ),
549
- __props.endCollapsible ? (openBlock(), createElementBlock(
550
- "div",
551
- {
552
- key: 1,
553
- class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-end`)]),
554
- onClick: _cache[1] || (_cache[1] = ($event) => emit("collapse", __props.index, "end"))
555
- },
556
- [
557
- renderSlot(_ctx.$slots, "end-collapsible", {}, () => [
558
- (openBlock(), createBlock(resolveDynamicComponent(EndIcon.value), { style: { "width": "12px", "height": "12px" } }))
559
- ])
560
- ],
561
- 2
562
- )) : createCommentVNode("v-if", true)
563
- ],
564
- 6
565
- );
566
- };
567
- }
568
- });
569
- var SplitBar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/splitter/src/split-bar.vue"]]);
570
-
571
- const splitterPanelProps = buildProps({
572
- min: {
573
- type: [String, Number]
574
- },
575
- max: {
576
- type: [String, Number]
577
- },
578
- size: {
579
- type: [String, Number]
580
- },
581
- resizable: {
582
- type: Boolean,
583
- default: true
584
- },
585
- collapsible: Boolean
586
- });
587
- const splitterPanelEmits = {
588
- "update:size": (value) => typeof value === "number" || typeof value === "string"
589
- };
590
-
591
- const COMPONENT_NAME = "ElSplitterPanel";
592
- const _sfc_main = defineComponent({
593
- ...{
594
- name: COMPONENT_NAME
595
- },
596
- __name: "split-panel",
597
- props: splitterPanelProps,
598
- emits: splitterPanelEmits,
599
- setup(__props, { expose: __expose, emit: __emit }) {
600
- const ns = useNamespace("splitter-panel");
601
- const props = __props;
602
- const emits = __emit;
603
- const splitterContext = inject(splitterRootContextKey);
604
- if (!splitterContext)
605
- throwError(
606
- COMPONENT_NAME,
607
- "usage: <el-splitter><el-splitter-panel /></el-splitter/>"
608
- );
609
- const { panels, layout, lazy, containerSize, pxSizes } = toRefs(splitterContext);
610
- const {
611
- registerPanel,
612
- unregisterPanel,
613
- onCollapse,
614
- onMoveEnd,
615
- onMoveStart,
616
- onMoving
617
- } = splitterContext;
618
- const panelEl = ref();
619
- const instance = getCurrentInstance();
620
- const uid = instance.uid;
621
- const index = ref(0);
622
- const panel = computed(() => panels.value[index.value]);
623
- const setIndex = (val) => {
624
- index.value = val;
625
- };
626
- const panelSize = computed(() => {
627
- var _a;
628
- if (!panel.value)
629
- return 0;
630
- return (_a = pxSizes.value[index.value]) != null ? _a : 0;
631
- });
632
- const nextSize = computed(() => {
633
- var _a;
634
- if (!panel.value)
635
- return 0;
636
- return (_a = pxSizes.value[index.value + 1]) != null ? _a : 0;
637
- });
638
- const nextPanel = computed(() => {
639
- if (panel.value) {
640
- return panels.value[index.value + 1];
641
- }
642
- return null;
643
- });
644
- const isResizable = computed(() => {
645
- var _a;
646
- if (!nextPanel.value)
647
- return false;
648
- return props.resizable && ((_a = nextPanel.value) == null ? void 0 : _a.resizable) && (panelSize.value !== 0 || !props.min) && (nextSize.value !== 0 || !nextPanel.value.min);
649
- });
650
- const isShowBar = computed(() => {
651
- if (!panel.value)
652
- return false;
653
- return index.value !== panels.value.length - 1;
654
- });
655
- const startCollapsible = computed(
656
- () => isCollapsible(panel.value, panelSize.value, nextPanel.value, nextSize.value)
657
- );
658
- const endCollapsible = computed(
659
- () => isCollapsible(nextPanel.value, nextSize.value, panel.value, panelSize.value)
660
- );
661
- function sizeToPx(str) {
662
- if (isPct(str)) {
663
- return getPct(str) * containerSize.value || 0;
664
- } else if (isPx(str)) {
665
- return getPx(str);
666
- }
667
- return str != null ? str : 0;
668
- }
669
- let isSizeUpdating = false;
670
- watch(
671
- () => props.size,
672
- () => {
673
- if (!isSizeUpdating && panel.value) {
674
- if (!containerSize.value) {
675
- panel.value.size = props.size;
676
- return;
677
- }
678
- const size = sizeToPx(props.size);
679
- const maxSize = sizeToPx(props.max);
680
- const minSize = sizeToPx(props.min);
681
- const finalSize = Math.min(Math.max(size, minSize || 0), maxSize || size);
682
- if (finalSize !== size) {
683
- emits("update:size", finalSize);
684
- }
685
- panel.value.size = finalSize;
686
- }
687
- }
688
- );
689
- watch(
690
- () => {
691
- var _a;
692
- return (_a = panel.value) == null ? void 0 : _a.size;
693
- },
694
- (val) => {
695
- if (val !== props.size) {
696
- isSizeUpdating = true;
697
- emits("update:size", val);
698
- nextTick(() => isSizeUpdating = false);
699
- }
700
- }
701
- );
702
- watch(
703
- () => props.resizable,
704
- (val) => {
705
- if (panel.value) {
706
- panel.value.resizable = val;
707
- }
708
- }
709
- );
710
- const _panel = reactive({
711
- el: panelEl.value,
712
- uid,
713
- getVnode: () => instance.vnode,
714
- setIndex,
715
- ...props,
716
- collapsible: computed(() => getCollapsible(props.collapsible))
717
- });
718
- registerPanel(_panel);
719
- onBeforeUnmount(() => unregisterPanel(_panel));
720
- __expose({
721
- splitterPanelRef: panelEl
722
- });
723
- return (_ctx, _cache) => {
724
- return openBlock(), createElementBlock(
725
- Fragment,
726
- null,
727
- [
728
- createElementVNode(
729
- "div",
730
- mergeProps({
731
- ref_key: "panelEl",
732
- ref: panelEl,
733
- class: [unref(ns).b()],
734
- style: { flexBasis: `${panelSize.value}px` }
735
- }, _ctx.$attrs),
736
- [
737
- renderSlot(_ctx.$slots, "default")
738
- ],
739
- 16
740
- ),
741
- isShowBar.value ? (openBlock(), createBlock(SplitBar, {
742
- key: 0,
743
- index: index.value,
744
- layout: unref(layout),
745
- lazy: unref(lazy),
746
- resizable: isResizable.value,
747
- "start-collapsible": startCollapsible.value,
748
- "end-collapsible": endCollapsible.value,
749
- onMoveStart: unref(onMoveStart),
750
- onMoving: unref(onMoving),
751
- onMoveEnd: unref(onMoveEnd),
752
- onCollapse: unref(onCollapse)
753
- }, {
754
- "start-collapsible": withCtx(() => [
755
- renderSlot(_ctx.$slots, "start-collapsible")
756
- ]),
757
- "end-collapsible": withCtx(() => [
758
- renderSlot(_ctx.$slots, "end-collapsible")
759
- ]),
760
- _: 3
761
- }, 8, ["index", "layout", "lazy", "resizable", "start-collapsible", "end-collapsible", "onMoveStart", "onMoving", "onMoveEnd", "onCollapse"])) : createCommentVNode("v-if", true)
762
- ],
763
- 64
764
- );
765
- };
766
- }
767
- });
768
- var SplitPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/splitter/src/split-panel.vue"]]);
769
-
770
- const ElSplitter = withInstall(Splitter, {
771
- SplitPanel
772
- });
773
- const ElSplitterPanel = withNoopInstall(SplitPanel);
774
-
775
- export { ElSplitter as E, ElSplitterPanel as a };