vxe-pc-ui 4.10.10 → 4.10.12
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/es/components.js +6 -0
- package/es/icon/style.css +1 -1
- package/es/split/index.js +2 -2
- package/es/split/style.css +81 -79
- package/es/split/style.min.css +1 -1
- package/es/split-pane/index.js +2 -2
- package/es/splitter/index.js +12 -0
- package/es/{split/src/split-pane.js → splitter/src/splitter-panel.js} +15 -15
- package/es/{split/src/split.js → splitter/src/splitter.js} +137 -68
- package/es/splitter/src/util.js +17 -0
- package/es/splitter/style.css +290 -0
- package/es/splitter/style.min.css +1 -0
- package/es/splitter-panel/index.js +12 -0
- package/es/splitter-panel/style.css +0 -0
- package/es/splitter-panel/style.min.css +0 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +3 -3
- package/es/ui/src/log.js +1 -1
- package/es/vxe-split/style.css +81 -79
- package/es/vxe-split/style.min.css +1 -1
- package/es/vxe-splitter/index.js +3 -0
- package/es/vxe-splitter/style.css +290 -0
- package/es/vxe-splitter/style.min.css +1 -0
- package/es/vxe-splitter-panel/index.js +3 -0
- package/es/vxe-splitter-panel/style.css +0 -0
- package/es/vxe-splitter-panel/style.min.css +0 -0
- package/lib/components.js +25 -1
- package/lib/components.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +231 -115
- package/lib/index.umd.min.js +1 -1
- package/lib/split/index.js +4 -4
- package/lib/split/index.min.js +1 -1
- package/lib/split/style/style.css +81 -79
- package/lib/split/style/style.min.css +1 -1
- package/lib/split-pane/index.js +5 -5
- package/lib/split-pane/index.min.js +1 -1
- package/lib/splitter/index.js +19 -0
- package/lib/splitter/index.min.js +1 -0
- package/lib/{split/src/split-pane.js → splitter/src/splitter-panel.js} +14 -14
- package/lib/splitter/src/splitter-panel.min.js +1 -0
- package/lib/{split/src/split.js → splitter/src/splitter.js} +150 -72
- package/lib/splitter/src/splitter.min.js +1 -0
- package/lib/{split → splitter}/src/util.js +8 -8
- package/lib/splitter/src/util.min.js +1 -0
- package/lib/splitter/style/index.js +1 -0
- package/lib/splitter/style/style.css +290 -0
- package/lib/splitter/style/style.min.css +1 -0
- package/lib/splitter-panel/index.js +19 -0
- package/lib/splitter-panel/index.min.js +1 -0
- package/lib/splitter-panel/style/index.js +1 -0
- package/lib/splitter-panel/style/style.css +0 -0
- package/lib/splitter-panel/style/style.min.css +0 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +3 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-split/style/style.css +81 -79
- package/lib/vxe-split/style/style.min.css +1 -1
- package/lib/vxe-splitter/index.js +22 -0
- package/lib/vxe-splitter/index.min.js +1 -0
- package/lib/vxe-splitter/style/index.js +1 -0
- package/lib/vxe-splitter/style/style.css +290 -0
- package/lib/vxe-splitter/style/style.min.css +1 -0
- package/lib/vxe-splitter-panel/index.js +22 -0
- package/lib/vxe-splitter-panel/index.min.js +1 -0
- package/lib/vxe-splitter-panel/style/index.js +1 -0
- package/lib/vxe-splitter-panel/style/style.css +0 -0
- package/lib/vxe-splitter-panel/style/style.min.css +0 -0
- package/package.json +1 -1
- package/packages/components.ts +6 -0
- package/packages/split/index.ts +2 -2
- package/packages/split-pane/index.ts +2 -2
- package/packages/splitter/index.ts +16 -0
- package/packages/splitter/src/splitter-panel.ts +145 -0
- package/packages/{split/src/split.ts → splitter/src/splitter.ts} +168 -96
- package/packages/splitter/src/util.ts +21 -0
- package/packages/splitter-panel/index.ts +16 -0
- package/packages/ui/index.ts +2 -2
- package/styles/components/split.scss +1 -317
- package/styles/components/splitter-panel.scss +0 -0
- package/styles/components/splitter.scss +319 -0
- package/styles/theme/base.scss +6 -6
- package/styles/theme/dark.scss +3 -3
- package/styles/theme/light.scss +3 -3
- package/styles/variable.scss +3 -3
- package/types/all.d.ts +6 -0
- package/types/components/split-pane.d.ts +42 -14
- package/types/components/split.d.ts +54 -18
- package/types/components/splitter-panel.d.ts +105 -0
- package/types/components/splitter.d.ts +288 -0
- package/types/components/table.d.ts +5 -0
- package/types/ui/global-config.d.ts +4 -0
- package/types/ui/global-icon.d.ts +1 -1
- package/es/split/src/util.js +0 -17
- package/lib/split/src/split-pane.min.js +0 -1
- package/lib/split/src/split.min.js +0 -1
- package/lib/split/src/util.min.js +0 -1
- package/packages/split/src/split-pane.ts +0 -145
- package/packages/split/src/util.ts +0 -21
- /package/es/icon/{iconfont.1761298747069.ttf → iconfont.1761641785778.ttf} +0 -0
- /package/es/icon/{iconfont.1761298747069.woff → iconfont.1761641785778.woff} +0 -0
- /package/es/icon/{iconfont.1761298747069.woff2 → iconfont.1761641785778.woff2} +0 -0
- /package/es/{iconfont.1761298747069.ttf → iconfont.1761641785778.ttf} +0 -0
- /package/es/{iconfont.1761298747069.woff → iconfont.1761641785778.woff} +0 -0
- /package/es/{iconfont.1761298747069.woff2 → iconfont.1761641785778.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1761298747069.ttf → iconfont.1761641785778.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1761298747069.woff → iconfont.1761641785778.woff} +0 -0
- /package/lib/icon/style/{iconfont.1761298747069.woff2 → iconfont.1761641785778.woff2} +0 -0
- /package/lib/{iconfont.1761298747069.ttf → iconfont.1761641785778.ttf} +0 -0
- /package/lib/{iconfont.1761298747069.woff → iconfont.1761641785778.woff} +0 -0
- /package/lib/{iconfont.1761298747069.woff2 → iconfont.1761641785778.woff2} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ref, h, reactive, watch, provide, inject, onMounted, onUnmounted } from 'vue';
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
3
|
import { createEvent } from '../../ui';
|
|
4
|
-
import {
|
|
4
|
+
import { assembleSplitterItem, destroySplitterItem } from './util';
|
|
5
5
|
import XEUtils from 'xe-utils';
|
|
6
6
|
export default defineVxeComponent({
|
|
7
|
-
name: '
|
|
7
|
+
name: 'VxeSplitterPanel',
|
|
8
8
|
props: {
|
|
9
9
|
name: [Number, String],
|
|
10
10
|
width: [Number, String],
|
|
@@ -24,7 +24,7 @@ export default defineVxeComponent({
|
|
|
24
24
|
setup(props, context) {
|
|
25
25
|
const { emit, slots } = context;
|
|
26
26
|
const xID = XEUtils.uniqueId();
|
|
27
|
-
const $
|
|
27
|
+
const $xeSplitter = inject('$xeSplitter', null);
|
|
28
28
|
const refElem = ref();
|
|
29
29
|
const paneConfig = reactive({
|
|
30
30
|
id: xID,
|
|
@@ -49,7 +49,7 @@ export default defineVxeComponent({
|
|
|
49
49
|
const refMaps = {
|
|
50
50
|
refElem
|
|
51
51
|
};
|
|
52
|
-
const $
|
|
52
|
+
const $xeSplitterItem = {
|
|
53
53
|
xID,
|
|
54
54
|
props,
|
|
55
55
|
context,
|
|
@@ -59,13 +59,13 @@ export default defineVxeComponent({
|
|
|
59
59
|
getComputeMaps: () => computeMaps
|
|
60
60
|
};
|
|
61
61
|
const dispatchEvent = (type, params, evnt) => {
|
|
62
|
-
emit(type, createEvent(evnt, { $
|
|
62
|
+
emit(type, createEvent(evnt, { $splitterPanel: $xeSplitterItem }, params));
|
|
63
63
|
};
|
|
64
|
-
const
|
|
64
|
+
const splitterPanelMethods = {
|
|
65
65
|
dispatchEvent
|
|
66
66
|
};
|
|
67
|
-
const
|
|
68
|
-
Object.assign($
|
|
67
|
+
const splitterPanelPrivateMethods = {};
|
|
68
|
+
Object.assign($xeSplitterItem, splitterPanelMethods, splitterPanelPrivateMethods);
|
|
69
69
|
const renderVN = () => {
|
|
70
70
|
return h('div', {
|
|
71
71
|
ref: refElem
|
|
@@ -91,18 +91,18 @@ export default defineVxeComponent({
|
|
|
91
91
|
});
|
|
92
92
|
onMounted(() => {
|
|
93
93
|
const elem = refElem.value;
|
|
94
|
-
if ($
|
|
95
|
-
|
|
94
|
+
if ($xeSplitter && elem) {
|
|
95
|
+
assembleSplitterItem($xeSplitter, elem, paneConfig);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
onUnmounted(() => {
|
|
99
|
-
if ($
|
|
100
|
-
|
|
99
|
+
if ($xeSplitter) {
|
|
100
|
+
destroySplitterItem($xeSplitter, paneConfig);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
provide('$
|
|
104
|
-
$
|
|
105
|
-
return $
|
|
103
|
+
provide('$xeSplitterItem', $xeSplitterItem);
|
|
104
|
+
$xeSplitterItem.renderVN = renderVN;
|
|
105
|
+
return $xeSplitterItem;
|
|
106
106
|
},
|
|
107
107
|
render() {
|
|
108
108
|
return this.renderVN();
|
|
@@ -7,25 +7,25 @@ import { getGlobalDefaultConfig } from '../../ui/src/utils';
|
|
|
7
7
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
8
8
|
import XEUtils from 'xe-utils';
|
|
9
9
|
export default defineVxeComponent({
|
|
10
|
-
name: '
|
|
10
|
+
name: 'VxeSplitter',
|
|
11
11
|
props: {
|
|
12
12
|
width: [Number, String],
|
|
13
13
|
height: [Number, String],
|
|
14
14
|
vertical: {
|
|
15
15
|
type: Boolean,
|
|
16
|
-
default: () => getConfig().
|
|
16
|
+
default: () => getConfig().splitter.vertical
|
|
17
17
|
},
|
|
18
18
|
border: {
|
|
19
19
|
type: Boolean,
|
|
20
|
-
default: () => getConfig().
|
|
20
|
+
default: () => getConfig().splitter.border
|
|
21
21
|
},
|
|
22
22
|
padding: {
|
|
23
23
|
type: Boolean,
|
|
24
|
-
default: () => getConfig().
|
|
24
|
+
default: () => getConfig().splitter.padding
|
|
25
25
|
},
|
|
26
26
|
resize: {
|
|
27
27
|
type: Boolean,
|
|
28
|
-
default: () => getConfig().
|
|
28
|
+
default: () => getConfig().splitter.resize
|
|
29
29
|
},
|
|
30
30
|
items: Array,
|
|
31
31
|
itemConfig: Object,
|
|
@@ -34,7 +34,7 @@ export default defineVxeComponent({
|
|
|
34
34
|
actionConfig: Object,
|
|
35
35
|
size: {
|
|
36
36
|
type: String,
|
|
37
|
-
default: () => getConfig().
|
|
37
|
+
default: () => getConfig().splitter.size || getConfig().size
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
emits: [
|
|
@@ -50,7 +50,7 @@ export default defineVxeComponent({
|
|
|
50
50
|
const xID = XEUtils.uniqueId();
|
|
51
51
|
const refElem = ref();
|
|
52
52
|
const refBarInfoElem = ref();
|
|
53
|
-
const
|
|
53
|
+
const refResizableSplitterTip = ref();
|
|
54
54
|
const { computeSize } = useSize(props);
|
|
55
55
|
const reactData = reactive({
|
|
56
56
|
staticItems: [],
|
|
@@ -63,16 +63,16 @@ export default defineVxeComponent({
|
|
|
63
63
|
wrapperHeight: 0
|
|
64
64
|
};
|
|
65
65
|
const computeItemOpts = computed(() => {
|
|
66
|
-
return Object.assign({}, getConfig().
|
|
66
|
+
return Object.assign({}, getConfig().splitter.itemConfig, props.itemConfig);
|
|
67
67
|
});
|
|
68
68
|
const computeBarOpts = computed(() => {
|
|
69
|
-
return Object.assign({}, getConfig().
|
|
69
|
+
return Object.assign({}, getConfig().splitter.barConfig, props.barConfig);
|
|
70
70
|
});
|
|
71
71
|
const computeResizeOpts = computed(() => {
|
|
72
|
-
return Object.assign({}, getConfig().
|
|
72
|
+
return Object.assign({}, getConfig().splitter.resizeConfig, props.resizeConfig);
|
|
73
73
|
});
|
|
74
74
|
const computeActionOpts = computed(() => {
|
|
75
|
-
return Object.assign({}, getConfig().
|
|
75
|
+
return Object.assign({}, getConfig().splitter.actionConfig, props.actionConfig);
|
|
76
76
|
});
|
|
77
77
|
const computeVisibleItems = computed(() => {
|
|
78
78
|
return reactData.itemList.filter(item => item.isExpand);
|
|
@@ -127,7 +127,7 @@ export default defineVxeComponent({
|
|
|
127
127
|
const refMaps = {
|
|
128
128
|
refElem
|
|
129
129
|
};
|
|
130
|
-
const $
|
|
130
|
+
const $xeSplitter = {
|
|
131
131
|
xID,
|
|
132
132
|
props,
|
|
133
133
|
context,
|
|
@@ -137,7 +137,7 @@ export default defineVxeComponent({
|
|
|
137
137
|
getComputeMaps: () => computeMaps
|
|
138
138
|
};
|
|
139
139
|
const dispatchEvent = (type, params, evnt) => {
|
|
140
|
-
emit(type, createEvent(evnt, { $
|
|
140
|
+
emit(type, createEvent(evnt, { $splitter: $xeSplitter }, params));
|
|
141
141
|
};
|
|
142
142
|
const callSlot = (slotFunc, params) => {
|
|
143
143
|
if (slotFunc) {
|
|
@@ -204,13 +204,13 @@ export default defineVxeComponent({
|
|
|
204
204
|
};
|
|
205
205
|
reactData.itemList = list.map(item => {
|
|
206
206
|
if (item.showAction) {
|
|
207
|
-
warnLog('vxe.error.removeProp', ['[
|
|
207
|
+
warnLog('vxe.error.removeProp', ['[splitter] show-action']);
|
|
208
208
|
}
|
|
209
209
|
if (item.slots) {
|
|
210
210
|
XEUtils.each(item.slots, (func) => {
|
|
211
211
|
if (!XEUtils.isFunction(func)) {
|
|
212
212
|
if (!slots[func]) {
|
|
213
|
-
errLog('vxe.error.notSlot', [`[
|
|
213
|
+
errLog('vxe.error.notSlot', [`[splitter] ${func}`]);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
});
|
|
@@ -220,7 +220,7 @@ export default defineVxeComponent({
|
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
if (staticItems.length) {
|
|
223
|
-
errLog('vxe.error.errConflicts', ['<vxe-
|
|
223
|
+
errLog('vxe.error.errConflicts', ['<vxe-splitter-panel ...>', 'items']);
|
|
224
224
|
}
|
|
225
225
|
if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
|
|
226
226
|
errLog('vxe.error.errConflicts', ['action-config.showPrevButton | action-config.showNextButton', 'Only supports 2 item']);
|
|
@@ -233,6 +233,70 @@ export default defineVxeComponent({
|
|
|
233
233
|
const reloadItem = (list) => {
|
|
234
234
|
return handleLoadItem(list || [], true);
|
|
235
235
|
};
|
|
236
|
+
const handleItemByName = (name) => {
|
|
237
|
+
const { itemList } = reactData;
|
|
238
|
+
let index = -1;
|
|
239
|
+
let currItem = null;
|
|
240
|
+
let prevItem = null;
|
|
241
|
+
let nextItem = null;
|
|
242
|
+
for (let i = 0; i < itemList.length; i++) {
|
|
243
|
+
const item = itemList[i];
|
|
244
|
+
if (item.name === name) {
|
|
245
|
+
index = i;
|
|
246
|
+
currItem = item;
|
|
247
|
+
prevItem = itemList[i - 1] || null;
|
|
248
|
+
nextItem = itemList[i + 1] || null;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
index,
|
|
254
|
+
currItem,
|
|
255
|
+
prevItem,
|
|
256
|
+
nextItem
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
const setItemExpand = (name, expanded) => {
|
|
260
|
+
const restItem = handleItemByName(name);
|
|
261
|
+
if (restItem) {
|
|
262
|
+
const { currItem, prevItem, nextItem } = restItem;
|
|
263
|
+
if (currItem) {
|
|
264
|
+
if (expanded ? !currItem.isExpand : currItem.isExpand) {
|
|
265
|
+
if (nextItem) {
|
|
266
|
+
if (nextItem.isExpand) {
|
|
267
|
+
handleItemActionEvent(null, currItem, nextItem, false);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else if (prevItem) {
|
|
271
|
+
if (prevItem.isExpand) {
|
|
272
|
+
handleItemActionEvent(null, prevItem, currItem, true);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return nextTick();
|
|
279
|
+
};
|
|
280
|
+
const toggleItemExpand = (name) => {
|
|
281
|
+
const restItem = handleItemByName(name);
|
|
282
|
+
if (restItem) {
|
|
283
|
+
const { currItem } = restItem;
|
|
284
|
+
if (currItem) {
|
|
285
|
+
return setItemExpand(name, !currItem.isExpand);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return nextTick();
|
|
289
|
+
};
|
|
290
|
+
const getItemExpand = (name) => {
|
|
291
|
+
const restItem = handleItemByName(name);
|
|
292
|
+
if (restItem) {
|
|
293
|
+
const { currItem } = restItem;
|
|
294
|
+
if (currItem) {
|
|
295
|
+
return currItem.isExpand;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
};
|
|
236
300
|
const recalculate = () => {
|
|
237
301
|
return nextTick().then(() => {
|
|
238
302
|
const { vertical } = props;
|
|
@@ -340,8 +404,8 @@ export default defineVxeComponent({
|
|
|
340
404
|
}
|
|
341
405
|
const containerRect = el.getBoundingClientRect();
|
|
342
406
|
const barRect = barEl.getBoundingClientRect();
|
|
343
|
-
const
|
|
344
|
-
const
|
|
407
|
+
const rsSplitterLineEl = refResizableSplitterTip.value;
|
|
408
|
+
const rsSplitterTipEl = rsSplitterLineEl ? rsSplitterLineEl.children[0] : null;
|
|
345
409
|
const itemOpts = computeItemOpts.value;
|
|
346
410
|
const resizeOpts = computeResizeOpts.value;
|
|
347
411
|
const { immediate } = resizeOpts;
|
|
@@ -372,11 +436,11 @@ export default defineVxeComponent({
|
|
|
372
436
|
let nextResizeHeight = 0;
|
|
373
437
|
let offsetTop = startOffsetTop;
|
|
374
438
|
const handleReStyle = (evnt) => {
|
|
375
|
-
if (!
|
|
439
|
+
if (!rsSplitterLineEl) {
|
|
376
440
|
return;
|
|
377
441
|
}
|
|
378
|
-
const rsNumPrevEl =
|
|
379
|
-
const rsNumNextEl =
|
|
442
|
+
const rsNumPrevEl = rsSplitterTipEl ? rsSplitterTipEl.children[0] : null;
|
|
443
|
+
const rsNumNextEl = rsSplitterTipEl ? rsSplitterTipEl.children[1] : null;
|
|
380
444
|
if (vertical) {
|
|
381
445
|
let tipWidth = 0;
|
|
382
446
|
if (rsNumPrevEl) {
|
|
@@ -403,10 +467,10 @@ export default defineVxeComponent({
|
|
|
403
467
|
if (rsLeft > containerRect.width - tipWidth - 1) {
|
|
404
468
|
rsLeft = containerRect.width - tipWidth - 1;
|
|
405
469
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (
|
|
409
|
-
|
|
470
|
+
rsSplitterLineEl.style.left = '0';
|
|
471
|
+
rsSplitterLineEl.style.top = `${offsetTop}px`;
|
|
472
|
+
if (rsSplitterTipEl) {
|
|
473
|
+
rsSplitterTipEl.style.left = `${rsLeft}px`;
|
|
410
474
|
}
|
|
411
475
|
}
|
|
412
476
|
else {
|
|
@@ -435,10 +499,10 @@ export default defineVxeComponent({
|
|
|
435
499
|
if (rsTop > containerRect.height - tipHeight - 1) {
|
|
436
500
|
rsTop = containerRect.height - tipHeight - 1;
|
|
437
501
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if (
|
|
441
|
-
|
|
502
|
+
rsSplitterLineEl.style.top = '0';
|
|
503
|
+
rsSplitterLineEl.style.left = `${offsetLeft}px`;
|
|
504
|
+
if (rsSplitterTipEl) {
|
|
505
|
+
rsSplitterTipEl.style.top = `${rsTop}px`;
|
|
442
506
|
}
|
|
443
507
|
}
|
|
444
508
|
};
|
|
@@ -487,7 +551,7 @@ export default defineVxeComponent({
|
|
|
487
551
|
nextEl.style.width = toCssUnit(nextResizeWidth);
|
|
488
552
|
}
|
|
489
553
|
}
|
|
490
|
-
if (
|
|
554
|
+
if (rsSplitterLineEl) {
|
|
491
555
|
handleReStyle(evnt);
|
|
492
556
|
}
|
|
493
557
|
dispatchEvent('resize-drag', { prevItem, nextItem, offsetHeight: targetOffsetHeight, offsetWidth: targetOffsetWidth }, evnt);
|
|
@@ -499,16 +563,16 @@ export default defineVxeComponent({
|
|
|
499
563
|
document.onmouseup = (evnt) => {
|
|
500
564
|
document.onmousemove = null;
|
|
501
565
|
document.onmouseup = null;
|
|
502
|
-
if (
|
|
503
|
-
|
|
566
|
+
if (rsSplitterLineEl) {
|
|
567
|
+
rsSplitterLineEl.style.display = '';
|
|
504
568
|
}
|
|
505
569
|
handleUpdate();
|
|
506
570
|
removeClass(el, 'is--drag');
|
|
507
571
|
dispatchEvent('resize-end', { prevItem, nextItem, offsetHeight: targetOffsetHeight, offsetWidth: targetOffsetWidth }, evnt);
|
|
508
572
|
recalculate();
|
|
509
573
|
};
|
|
510
|
-
if (
|
|
511
|
-
|
|
574
|
+
if (rsSplitterLineEl) {
|
|
575
|
+
rsSplitterLineEl.style.display = 'block';
|
|
512
576
|
handleReStyle(evnt);
|
|
513
577
|
}
|
|
514
578
|
handleDrag(evnt);
|
|
@@ -556,7 +620,9 @@ export default defineVxeComponent({
|
|
|
556
620
|
nextItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth);
|
|
557
621
|
}
|
|
558
622
|
}
|
|
559
|
-
|
|
623
|
+
if (evnt) {
|
|
624
|
+
dispatchEvent('toggle-expand', { prevItem, nextItem, expanded, item }, evnt);
|
|
625
|
+
}
|
|
560
626
|
recalculate();
|
|
561
627
|
};
|
|
562
628
|
const handlePrevActionDblclickEvent = (evnt) => {
|
|
@@ -638,15 +704,18 @@ export default defineVxeComponent({
|
|
|
638
704
|
const handleGlobalResizeEvent = () => {
|
|
639
705
|
recalculate();
|
|
640
706
|
};
|
|
641
|
-
const
|
|
707
|
+
const splitterMethods = {
|
|
642
708
|
dispatchEvent,
|
|
709
|
+
setItemExpand,
|
|
710
|
+
toggleItemExpand,
|
|
711
|
+
getItemExpand,
|
|
643
712
|
recalculate,
|
|
644
713
|
reset,
|
|
645
714
|
loadItem,
|
|
646
715
|
reloadItem
|
|
647
716
|
};
|
|
648
|
-
const
|
|
649
|
-
Object.assign($
|
|
717
|
+
const splitterPrivateMethods = {};
|
|
718
|
+
Object.assign($xeSplitter, splitterMethods, splitterPrivateMethods);
|
|
650
719
|
const renderHandleBar = (prevItem, nextItem) => {
|
|
651
720
|
const { border, resize, vertical } = props;
|
|
652
721
|
const { itemList } = reactData;
|
|
@@ -658,23 +727,23 @@ export default defineVxeComponent({
|
|
|
658
727
|
const resizeOpts = computeResizeOpts.value;
|
|
659
728
|
const { immediate } = resizeOpts;
|
|
660
729
|
return h('div', {
|
|
661
|
-
class: ['vxe-
|
|
730
|
+
class: ['vxe-splitter-panel-handle', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
662
731
|
'is--resize': resize,
|
|
663
732
|
'is--border': border
|
|
664
733
|
}]
|
|
665
734
|
}, [
|
|
666
735
|
h('div', {
|
|
667
|
-
class: 'vxe-
|
|
736
|
+
class: 'vxe-splitter-panel-handle-bar',
|
|
668
737
|
style: barStyle,
|
|
669
738
|
onMousedown: dragEvent
|
|
670
739
|
}),
|
|
671
740
|
itemList.length === 2
|
|
672
741
|
? h('div', {
|
|
673
|
-
class: 'vxe-
|
|
742
|
+
class: 'vxe-splitter-panel-action-btn-wrapper'
|
|
674
743
|
}, [
|
|
675
744
|
showPrevButton && nextItem.isExpand
|
|
676
745
|
? h('div', {
|
|
677
|
-
class: 'vxe-
|
|
746
|
+
class: 'vxe-splitter-panel-action-btn',
|
|
678
747
|
onDblclick: handlePrevActionDblclickEvent,
|
|
679
748
|
onClick: handlePrevActionClickEvent
|
|
680
749
|
}, [
|
|
@@ -682,10 +751,10 @@ export default defineVxeComponent({
|
|
|
682
751
|
class: getActionIcon(prevItem, nextItem, false)
|
|
683
752
|
})
|
|
684
753
|
])
|
|
685
|
-
: renderEmptyElement($
|
|
754
|
+
: renderEmptyElement($xeSplitter),
|
|
686
755
|
showNextButton && prevItem.isExpand
|
|
687
756
|
? h('div', {
|
|
688
|
-
class: 'vxe-
|
|
757
|
+
class: 'vxe-splitter-panel-action-btn',
|
|
689
758
|
onDblclick: handleNextActionDblclickEvent,
|
|
690
759
|
onClick: handleNextActionClickEvent
|
|
691
760
|
}, [
|
|
@@ -693,9 +762,9 @@ export default defineVxeComponent({
|
|
|
693
762
|
class: getActionIcon(prevItem, nextItem, true)
|
|
694
763
|
})
|
|
695
764
|
])
|
|
696
|
-
: renderEmptyElement($
|
|
765
|
+
: renderEmptyElement($xeSplitter)
|
|
697
766
|
])
|
|
698
|
-
: renderEmptyElement($
|
|
767
|
+
: renderEmptyElement($xeSplitter)
|
|
699
768
|
]);
|
|
700
769
|
};
|
|
701
770
|
const renderItems = () => {
|
|
@@ -742,7 +811,7 @@ export default defineVxeComponent({
|
|
|
742
811
|
}
|
|
743
812
|
itemVNs.push(h('div', {
|
|
744
813
|
itemid: id,
|
|
745
|
-
class: ['vxe-
|
|
814
|
+
class: ['vxe-splitter-panel', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
746
815
|
[`size--${vSize}`]: vSize,
|
|
747
816
|
'is--resize': resize,
|
|
748
817
|
'is--padding': padding,
|
|
@@ -757,10 +826,10 @@ export default defineVxeComponent({
|
|
|
757
826
|
}, [
|
|
758
827
|
h('div', {
|
|
759
828
|
itemid: id,
|
|
760
|
-
class: 'vxe-
|
|
829
|
+
class: 'vxe-splitter-panel--wrapper'
|
|
761
830
|
}, [
|
|
762
831
|
h('div', {
|
|
763
|
-
class: 'vxe-
|
|
832
|
+
class: 'vxe-splitter-panel--inner'
|
|
764
833
|
}, defaultSlot ? callSlot(defaultSlot, { name, isExpand }) : [])
|
|
765
834
|
])
|
|
766
835
|
]));
|
|
@@ -769,7 +838,7 @@ export default defineVxeComponent({
|
|
|
769
838
|
}
|
|
770
839
|
});
|
|
771
840
|
return h('div', {
|
|
772
|
-
class: 'vxe-
|
|
841
|
+
class: 'vxe-splitter-wrapper'
|
|
773
842
|
}, itemVNs);
|
|
774
843
|
};
|
|
775
844
|
const renderVN = () => {
|
|
@@ -787,38 +856,38 @@ export default defineVxeComponent({
|
|
|
787
856
|
}
|
|
788
857
|
return h('div', {
|
|
789
858
|
ref: refElem,
|
|
790
|
-
class: ['vxe-
|
|
859
|
+
class: ['vxe-splitter', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
791
860
|
[`size--${vSize}`]: vSize
|
|
792
861
|
}],
|
|
793
862
|
style: stys
|
|
794
863
|
}, [
|
|
795
864
|
h('div', {
|
|
796
|
-
class: 'vxe-
|
|
865
|
+
class: 'vxe-splitter-slots'
|
|
797
866
|
}, defaultSlot ? defaultSlot({}) : []),
|
|
798
867
|
renderItems(),
|
|
799
868
|
h('div', {
|
|
800
|
-
ref:
|
|
801
|
-
class: ['vxe-
|
|
869
|
+
ref: refResizableSplitterTip,
|
|
870
|
+
class: ['vxe-splitter--resizable-splitter-tip', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy']
|
|
802
871
|
}, showTip
|
|
803
872
|
? [
|
|
804
873
|
h('div', {
|
|
805
|
-
class: 'vxe-
|
|
874
|
+
class: 'vxe-splitter--resizable-splitter-tip-number'
|
|
806
875
|
}, [
|
|
807
876
|
h('div', {
|
|
808
|
-
class: 'vxe-
|
|
877
|
+
class: 'vxe-splitter--resizable-splitter-number-prev'
|
|
809
878
|
}),
|
|
810
879
|
h('div', {
|
|
811
|
-
class: 'vxe-
|
|
880
|
+
class: 'vxe-splitter--resizable-splitter-number-next'
|
|
812
881
|
})
|
|
813
882
|
])
|
|
814
883
|
]
|
|
815
884
|
: []),
|
|
816
885
|
h('div', {
|
|
817
|
-
class: 'vxe-
|
|
886
|
+
class: 'vxe-splitter--render-vars'
|
|
818
887
|
}, [
|
|
819
888
|
h('div', {
|
|
820
889
|
ref: refBarInfoElem,
|
|
821
|
-
class: 'vxe-
|
|
890
|
+
class: 'vxe-splitter--handle-bar-info'
|
|
822
891
|
})
|
|
823
892
|
])
|
|
824
893
|
]);
|
|
@@ -837,15 +906,15 @@ export default defineVxeComponent({
|
|
|
837
906
|
const actionOpts = computeActionOpts.value;
|
|
838
907
|
const { showPrevButton, showNextButton } = actionOpts;
|
|
839
908
|
if (props.items && props.items.length) {
|
|
840
|
-
errLog('vxe.error.errConflicts', ['<vxe-
|
|
909
|
+
errLog('vxe.error.errConflicts', ['<vxe-splitter-panel ...>', 'items']);
|
|
841
910
|
}
|
|
842
911
|
reactData.itemList = val || [];
|
|
843
912
|
if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
|
|
844
|
-
errLog('vxe.error.modelConflicts', ['[
|
|
913
|
+
errLog('vxe.error.modelConflicts', ['[splitter] action-config.showPrevButton | action-config.showNextButton', '<vxe-splitter-panel ...> Only supports 2 panel']);
|
|
845
914
|
}
|
|
846
915
|
reactData.itemList.forEach(item => {
|
|
847
916
|
if (item.showAction) {
|
|
848
|
-
warnLog('vxe.error.removeProp', ['[
|
|
917
|
+
warnLog('vxe.error.removeProp', ['[splitter] showAction']);
|
|
849
918
|
}
|
|
850
919
|
});
|
|
851
920
|
recalculate();
|
|
@@ -864,15 +933,15 @@ export default defineVxeComponent({
|
|
|
864
933
|
}
|
|
865
934
|
const actionOpts = computeActionOpts.value;
|
|
866
935
|
if (actionOpts.direction) {
|
|
867
|
-
errLog('vxe.error.delProp', ['[
|
|
936
|
+
errLog('vxe.error.delProp', ['[splitter] action-config.direction', 'action-config.showPrevButton | action-config.showNextButton']);
|
|
868
937
|
}
|
|
869
|
-
globalEvents.on($
|
|
938
|
+
globalEvents.on($xeSplitter, 'resize', handleGlobalResizeEvent);
|
|
870
939
|
});
|
|
871
940
|
onUnmounted(() => {
|
|
872
941
|
if (resizeObserver) {
|
|
873
942
|
resizeObserver.disconnect();
|
|
874
943
|
}
|
|
875
|
-
globalEvents.off($
|
|
944
|
+
globalEvents.off($xeSplitter, 'resize');
|
|
876
945
|
});
|
|
877
946
|
onActivated(() => {
|
|
878
947
|
recalculate();
|
|
@@ -880,9 +949,9 @@ export default defineVxeComponent({
|
|
|
880
949
|
if (props.items) {
|
|
881
950
|
loadItem(props.items);
|
|
882
951
|
}
|
|
883
|
-
provide('$
|
|
884
|
-
$
|
|
885
|
-
return $
|
|
952
|
+
provide('$xeSplitter', $xeSplitter);
|
|
953
|
+
$xeSplitter.renderVN = renderVN;
|
|
954
|
+
return $xeSplitter;
|
|
886
955
|
},
|
|
887
956
|
render() {
|
|
888
957
|
return this.renderVN();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils';
|
|
2
|
+
export function assembleSplitterItem($xeSplitter, elem, paneConfig) {
|
|
3
|
+
const staticItems = $xeSplitter.reactData.staticItems;
|
|
4
|
+
const parentElem = elem.parentNode;
|
|
5
|
+
if (parentElem) {
|
|
6
|
+
staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, paneConfig);
|
|
7
|
+
$xeSplitter.reactData.staticItems = staticItems.slice(0);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function destroySplitterItem($xeSplitter, paneConfig) {
|
|
11
|
+
const staticItems = $xeSplitter.reactData.staticItems;
|
|
12
|
+
const index = XEUtils.findIndexOf(staticItems, item => item.id === paneConfig.id);
|
|
13
|
+
if (index > -1) {
|
|
14
|
+
staticItems.splice(index, 1);
|
|
15
|
+
}
|
|
16
|
+
$xeSplitter.reactData.staticItems = staticItems.slice(0);
|
|
17
|
+
}
|