vxe-pc-ui 3.9.0 → 3.9.2
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/icon/style.css +1 -1
- package/es/split/src/split-pane.js +3 -3
- package/es/split/src/split.js +239 -139
- package/es/split/style.css +82 -45
- package/es/split/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/upload/src/upload.js +3 -1
- package/es/vxe-split/style.css +82 -45
- package/es/vxe-split/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +267 -166
- package/lib/index.umd.min.js +1 -1
- package/lib/split/src/split-pane.js +3 -3
- package/lib/split/src/split-pane.min.js +1 -1
- package/lib/split/src/split.js +258 -160
- package/lib/split/src/split.min.js +1 -1
- package/lib/split/style/style.css +82 -45
- package/lib/split/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- 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/upload/src/upload.js +3 -1
- package/lib/upload/src/upload.min.js +1 -1
- package/lib/vxe-split/style/style.css +82 -45
- package/lib/vxe-split/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/split/src/split-pane.ts +4 -3
- package/packages/split/src/split.ts +236 -141
- package/packages/upload/src/upload.ts +3 -1
- package/styles/components/split.scss +109 -88
- package/types/components/split-pane.d.ts +11 -2
- package/types/components/split.d.ts +26 -20
- /package/es/icon/{iconfont.1756083812307.ttf → iconfont.1756133785685.ttf} +0 -0
- /package/es/icon/{iconfont.1756083812307.woff → iconfont.1756133785685.woff} +0 -0
- /package/es/icon/{iconfont.1756083812307.woff2 → iconfont.1756133785685.woff2} +0 -0
- /package/es/{iconfont.1756083812307.ttf → iconfont.1756133785685.ttf} +0 -0
- /package/es/{iconfont.1756083812307.woff → iconfont.1756133785685.woff} +0 -0
- /package/es/{iconfont.1756083812307.woff2 → iconfont.1756133785685.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1756083812307.ttf → iconfont.1756133785685.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1756083812307.woff → iconfont.1756133785685.woff} +0 -0
- /package/lib/icon/style/{iconfont.1756083812307.woff2 → iconfont.1756133785685.woff2} +0 -0
- /package/lib/{iconfont.1756083812307.ttf → iconfont.1756133785685.ttf} +0 -0
- /package/lib/{iconfont.1756083812307.woff → iconfont.1756133785685.woff} +0 -0
- /package/lib/{iconfont.1756083812307.woff2 → iconfont.1756133785685.woff2} +0 -0
package/es/split/src/split.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getConfig, getIcon, createEvent, globalEvents, globalMixins, globalResi
|
|
|
4
4
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
5
5
|
import { toCssUnit, isScale, addClass, removeClass } from '../../ui/src/dom';
|
|
6
6
|
import { getGlobalDefaultConfig } from '../../ui/src/utils';
|
|
7
|
-
import { errLog } from '../../ui/src/log';
|
|
7
|
+
import { warnLog, errLog } from '../../ui/src/log';
|
|
8
8
|
export default {
|
|
9
9
|
name: 'VxeSplit',
|
|
10
10
|
mixins: [
|
|
@@ -39,7 +39,9 @@ export default {
|
|
|
39
39
|
const xID = XEUtils.uniqueId();
|
|
40
40
|
const reactData = {
|
|
41
41
|
staticItems: [],
|
|
42
|
-
itemList: []
|
|
42
|
+
itemList: [],
|
|
43
|
+
barWidth: 0,
|
|
44
|
+
barHeight: 0
|
|
43
45
|
};
|
|
44
46
|
const internalData = {
|
|
45
47
|
wrapperWidth: 0,
|
|
@@ -86,7 +88,7 @@ export default {
|
|
|
86
88
|
computeVisibleItems() {
|
|
87
89
|
const $xeSplit = this;
|
|
88
90
|
const reactData = $xeSplit.reactData;
|
|
89
|
-
return reactData.itemList.filter(item => item.
|
|
91
|
+
return reactData.itemList.filter(item => item.isExpand);
|
|
90
92
|
},
|
|
91
93
|
computeAutoItems() {
|
|
92
94
|
const $xeSplit = this;
|
|
@@ -136,10 +138,20 @@ export default {
|
|
|
136
138
|
const $xeSplit = this;
|
|
137
139
|
const props = $xeSplit;
|
|
138
140
|
const reactData = $xeSplit.reactData;
|
|
141
|
+
const actionOpts = $xeSplit.computeActionOpts;
|
|
142
|
+
const { showPrevButton, showNextButton } = actionOpts;
|
|
139
143
|
if (props.items && props.items.length) {
|
|
140
144
|
errLog('vxe.error.errConflicts', ['<vxe-split-pane ...>', 'items']);
|
|
141
145
|
}
|
|
142
|
-
reactData.itemList = reactData.staticItems;
|
|
146
|
+
reactData.itemList = reactData.staticItems || [];
|
|
147
|
+
if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
|
|
148
|
+
errLog('vxe.error.modelConflicts', ['action-config.showPrevButton | action-config.showNextButton', '<vxe-split-pane ...> Only supports 2 panel']);
|
|
149
|
+
}
|
|
150
|
+
reactData.itemList.forEach(item => {
|
|
151
|
+
if (item.showAction) {
|
|
152
|
+
warnLog('vxe.error.removeProp', ['showAction']);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
143
155
|
$xeSplit.recalculate();
|
|
144
156
|
}
|
|
145
157
|
},
|
|
@@ -170,7 +182,6 @@ export default {
|
|
|
170
182
|
const { itemList } = reactData;
|
|
171
183
|
itemList.forEach(item => {
|
|
172
184
|
item.isExpand = true;
|
|
173
|
-
item.isVisible = true;
|
|
174
185
|
item.foldHeight = 0;
|
|
175
186
|
item.foldWidth = 0;
|
|
176
187
|
item.resizeHeight = 0;
|
|
@@ -184,7 +195,6 @@ export default {
|
|
|
184
195
|
const reactData = $xeSplit.reactData;
|
|
185
196
|
const { staticItems } = reactData;
|
|
186
197
|
const itemDef = {
|
|
187
|
-
isVisible: true,
|
|
188
198
|
isExpand: true,
|
|
189
199
|
renderWidth: 0,
|
|
190
200
|
resizeWidth: 0,
|
|
@@ -229,6 +239,7 @@ export default {
|
|
|
229
239
|
const { vertical } = props;
|
|
230
240
|
const { itemList } = reactData;
|
|
231
241
|
const el = $xeSplit.$refs.refElem;
|
|
242
|
+
const barInfoElem = $xeSplit.$refs.refBarInfoElem;
|
|
232
243
|
if (!el) {
|
|
233
244
|
return;
|
|
234
245
|
}
|
|
@@ -237,6 +248,12 @@ export default {
|
|
|
237
248
|
if (!wWidth || !wHeight) {
|
|
238
249
|
return;
|
|
239
250
|
}
|
|
251
|
+
if (barInfoElem) {
|
|
252
|
+
reactData.barWidth = barInfoElem.offsetWidth;
|
|
253
|
+
reactData.barHeight = barInfoElem.offsetHeight;
|
|
254
|
+
}
|
|
255
|
+
const contentWidth = wWidth - (vertical ? 0 : reactData.barWidth * (itemList.length - 1));
|
|
256
|
+
const contentHeight = wHeight - (vertical ? reactData.barHeight * (itemList.length - 1) : 0);
|
|
240
257
|
const itemOpts = $xeSplit.computeItemOpts;
|
|
241
258
|
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth);
|
|
242
259
|
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight);
|
|
@@ -248,7 +265,7 @@ export default {
|
|
|
248
265
|
let itemHeight = 0;
|
|
249
266
|
if (height) {
|
|
250
267
|
if (isScale(height)) {
|
|
251
|
-
itemHeight =
|
|
268
|
+
itemHeight = contentHeight * XEUtils.toNumber(height) / 100;
|
|
252
269
|
}
|
|
253
270
|
else {
|
|
254
271
|
itemHeight = XEUtils.toNumber(height);
|
|
@@ -261,7 +278,7 @@ export default {
|
|
|
261
278
|
countHeight += itemHeight;
|
|
262
279
|
});
|
|
263
280
|
if (residueItems.length) {
|
|
264
|
-
const reMeanHeight = (
|
|
281
|
+
const reMeanHeight = (contentHeight - countHeight) / residueItems.length;
|
|
265
282
|
residueItems.forEach(item => {
|
|
266
283
|
item.renderHeight = Math.max(XEUtils.toNumber(getGlobalDefaultConfig(item.minHeight, allMinHeight)), reMeanHeight);
|
|
267
284
|
});
|
|
@@ -274,7 +291,7 @@ export default {
|
|
|
274
291
|
let itemWidth = 0;
|
|
275
292
|
if (width) {
|
|
276
293
|
if (isScale(width)) {
|
|
277
|
-
itemWidth =
|
|
294
|
+
itemWidth = contentWidth * XEUtils.toNumber(width) / 100;
|
|
278
295
|
}
|
|
279
296
|
else {
|
|
280
297
|
itemWidth = XEUtils.toNumber(width);
|
|
@@ -287,14 +304,14 @@ export default {
|
|
|
287
304
|
countWidth += itemWidth;
|
|
288
305
|
});
|
|
289
306
|
if (residueItems.length) {
|
|
290
|
-
const reMeanWidth = (
|
|
307
|
+
const reMeanWidth = (contentWidth - countWidth) / residueItems.length;
|
|
291
308
|
residueItems.forEach(item => {
|
|
292
309
|
item.renderWidth = Math.max(XEUtils.toNumber(getGlobalDefaultConfig(item.minWidth, allMinWidth)), reMeanWidth);
|
|
293
310
|
});
|
|
294
311
|
}
|
|
295
312
|
}
|
|
296
|
-
internalData.wrapperWidth =
|
|
297
|
-
internalData.wrapperHeight =
|
|
313
|
+
internalData.wrapperWidth = contentWidth;
|
|
314
|
+
internalData.wrapperHeight = contentHeight;
|
|
298
315
|
});
|
|
299
316
|
},
|
|
300
317
|
dragEvent(evnt) {
|
|
@@ -313,33 +330,27 @@ export default {
|
|
|
313
330
|
if (!el) {
|
|
314
331
|
return;
|
|
315
332
|
}
|
|
316
|
-
const
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
if (!item) {
|
|
333
|
+
const prevEl = handleEl.previousElementSibling;
|
|
334
|
+
const nextEl = handleEl.nextElementSibling;
|
|
335
|
+
if (!prevEl || !nextEl) {
|
|
320
336
|
return;
|
|
321
337
|
}
|
|
322
|
-
|
|
338
|
+
const prevId = prevEl.getAttribute('itemid');
|
|
339
|
+
const nextId = nextEl.getAttribute('itemid');
|
|
340
|
+
const prevItem = itemList.find(item => item.id === prevId);
|
|
341
|
+
const nextItem = itemList.find(item => item.id === nextId);
|
|
342
|
+
if (!prevItem || !nextItem) {
|
|
323
343
|
return;
|
|
324
344
|
}
|
|
325
345
|
const containerRect = el.getBoundingClientRect();
|
|
326
346
|
const barRect = barEl.getBoundingClientRect();
|
|
327
347
|
const rsSplitLineEl = $xeSplit.$refs.refResizableSplitTip;
|
|
328
348
|
const rsSplitTipEl = rsSplitLineEl ? rsSplitLineEl.children[0] : null;
|
|
329
|
-
const isFoldNext = $xeSplit.computeIsFoldNext;
|
|
330
349
|
const itemOpts = $xeSplit.computeItemOpts;
|
|
331
350
|
const resizeOpts = $xeSplit.computeResizeOpts;
|
|
332
351
|
const { immediate } = resizeOpts;
|
|
333
352
|
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth);
|
|
334
353
|
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight);
|
|
335
|
-
const targetItem = itemList[itemIndex + (isFoldNext ? 1 : -1)];
|
|
336
|
-
const prevItem = itemList[itemIndex + (isFoldNext ? 0 : -1)];
|
|
337
|
-
const nextItem = itemList[itemIndex + (isFoldNext ? 1 : 0)];
|
|
338
|
-
const prevEl = targetItem ? el.querySelector(`.vxe-split-pane[itemid="${prevItem.id}"]`) : null;
|
|
339
|
-
const nextEl = item ? el.querySelector(`.vxe-split-pane[itemid="${nextItem.id}"]`) : null;
|
|
340
|
-
if (!prevEl || !nextEl) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
354
|
const barOffsetX = Math.ceil(barRect.width - (evnt.clientX - barRect.left));
|
|
344
355
|
const barOffsetY = Math.ceil(evnt.clientY - barRect.top);
|
|
345
356
|
const prevWidth = prevEl.offsetWidth;
|
|
@@ -483,7 +494,7 @@ export default {
|
|
|
483
494
|
if (rsSplitLineEl) {
|
|
484
495
|
handleReStyle(evnt);
|
|
485
496
|
}
|
|
486
|
-
$xeSplit.dispatchEvent('resize-drag', {
|
|
497
|
+
$xeSplit.dispatchEvent('resize-drag', { prevItem, nextItem, offsetHeight: targetOffsetHeight, offsetWidth: targetOffsetWidth }, evnt);
|
|
487
498
|
};
|
|
488
499
|
document.onmousemove = (evnt) => {
|
|
489
500
|
evnt.preventDefault();
|
|
@@ -497,7 +508,7 @@ export default {
|
|
|
497
508
|
}
|
|
498
509
|
handleUpdate();
|
|
499
510
|
removeClass(el, 'is--drag');
|
|
500
|
-
$xeSplit.dispatchEvent('resize-end', {
|
|
511
|
+
$xeSplit.dispatchEvent('resize-end', { prevItem, nextItem, offsetHeight: targetOffsetHeight, offsetWidth: targetOffsetWidth }, evnt);
|
|
501
512
|
$xeSplit.recalculate();
|
|
502
513
|
};
|
|
503
514
|
if (rsSplitLineEl) {
|
|
@@ -506,140 +517,193 @@ export default {
|
|
|
506
517
|
}
|
|
507
518
|
handleDrag(evnt);
|
|
508
519
|
addClass(el, 'is--drag');
|
|
509
|
-
$xeSplit.dispatchEvent('resize-start', {
|
|
520
|
+
$xeSplit.dispatchEvent('resize-start', { prevItem, nextItem }, evnt);
|
|
510
521
|
},
|
|
511
|
-
handleItemActionEvent(evnt) {
|
|
522
|
+
handleItemActionEvent(evnt, prevItem, nextItem, isNext) {
|
|
512
523
|
const $xeSplit = this;
|
|
513
524
|
const props = $xeSplit;
|
|
525
|
+
const { vertical } = props;
|
|
526
|
+
let expanded = false;
|
|
527
|
+
let item = prevItem;
|
|
528
|
+
if (isNext) {
|
|
529
|
+
item = nextItem;
|
|
530
|
+
expanded = !nextItem.isExpand;
|
|
531
|
+
nextItem.isExpand = expanded;
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
expanded = !prevItem.isExpand;
|
|
535
|
+
prevItem.isExpand = expanded;
|
|
536
|
+
}
|
|
537
|
+
if (vertical) {
|
|
538
|
+
if (prevItem.isExpand && nextItem.isExpand) {
|
|
539
|
+
prevItem.foldHeight = 0;
|
|
540
|
+
nextItem.foldHeight = 0;
|
|
541
|
+
}
|
|
542
|
+
else if (prevItem.isExpand) {
|
|
543
|
+
nextItem.foldHeight = 0;
|
|
544
|
+
prevItem.foldHeight = (prevItem.resizeHeight || prevItem.renderHeight) + (nextItem.resizeHeight || nextItem.renderHeight);
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
prevItem.foldHeight = 0;
|
|
548
|
+
nextItem.foldHeight = (prevItem.resizeHeight || prevItem.renderHeight) + (nextItem.resizeHeight || nextItem.renderHeight);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
if (prevItem.isExpand && nextItem.isExpand) {
|
|
553
|
+
prevItem.foldWidth = 0;
|
|
554
|
+
nextItem.foldWidth = 0;
|
|
555
|
+
}
|
|
556
|
+
else if (prevItem.isExpand) {
|
|
557
|
+
nextItem.foldWidth = 0;
|
|
558
|
+
prevItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth);
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
prevItem.foldWidth = 0;
|
|
562
|
+
nextItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
$xeSplit.dispatchEvent('toggle-expand', { prevItem, nextItem, expanded, item }, evnt);
|
|
566
|
+
$xeSplit.recalculate();
|
|
567
|
+
},
|
|
568
|
+
handlePrevActionDblclickEvent(evnt) {
|
|
569
|
+
const $xeSplit = this;
|
|
514
570
|
const reactData = $xeSplit.reactData;
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
571
|
+
const { itemList } = reactData;
|
|
572
|
+
const actionOpts = $xeSplit.computeActionOpts;
|
|
573
|
+
const btnEl = evnt.currentTarget;
|
|
574
|
+
const btnWrapperEl = btnEl.parentElement;
|
|
575
|
+
const handleEl = btnWrapperEl.parentElement;
|
|
576
|
+
const prevEl = handleEl.previousElementSibling;
|
|
577
|
+
const prevId = prevEl.getAttribute('itemid');
|
|
578
|
+
const prevItem = itemList.find(item => item.id === prevId);
|
|
579
|
+
const nextEl = handleEl.nextElementSibling;
|
|
580
|
+
const nextId = nextEl.getAttribute('itemid');
|
|
581
|
+
const nextItem = itemList.find(item => item.id === nextId);
|
|
582
|
+
if (actionOpts.trigger === 'dblclick') {
|
|
583
|
+
if (prevItem && nextItem && nextItem.isExpand) {
|
|
584
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, false);
|
|
585
|
+
}
|
|
518
586
|
}
|
|
519
|
-
|
|
587
|
+
$xeSplit.dispatchEvent('action-dblclick', { prevItem, nextItem }, evnt);
|
|
588
|
+
},
|
|
589
|
+
handlePrevActionClickEvent(evnt) {
|
|
590
|
+
const $xeSplit = this;
|
|
591
|
+
const reactData = $xeSplit.reactData;
|
|
520
592
|
const { itemList } = reactData;
|
|
521
|
-
const
|
|
593
|
+
const actionOpts = $xeSplit.computeActionOpts;
|
|
522
594
|
const btnEl = evnt.currentTarget;
|
|
523
|
-
const
|
|
524
|
-
const
|
|
525
|
-
const
|
|
526
|
-
const
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
targetItem.foldHeight = 0;
|
|
535
|
-
item.isExpand = !isExpand;
|
|
536
|
-
item.isVisible = true;
|
|
537
|
-
item.foldHeight = isExpand ? (targetItem.resizeHeight || targetItem.renderHeight) + (item.resizeHeight || item.renderHeight) : 0;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
if (targetItem) {
|
|
542
|
-
targetItem.isVisible = !isExpand;
|
|
543
|
-
targetItem.foldWidth = 0;
|
|
544
|
-
item.isExpand = !isExpand;
|
|
545
|
-
item.isVisible = true;
|
|
546
|
-
item.foldWidth = isExpand ? (targetItem.resizeWidth || targetItem.renderWidth) + (item.resizeWidth || item.renderWidth) : 0;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
$xeSplit.dispatchEvent('toggle-expand', { item, name: item.name, targetItem, targetName: targetItem ? targetItem.name : '', expanded: item.isExpand }, evnt);
|
|
550
|
-
$xeSplit.recalculate();
|
|
595
|
+
const btnWrapperEl = btnEl.parentElement;
|
|
596
|
+
const handleEl = btnWrapperEl.parentElement;
|
|
597
|
+
const prevEl = handleEl.previousElementSibling;
|
|
598
|
+
const prevId = prevEl.getAttribute('itemid');
|
|
599
|
+
const prevItem = itemList.find(item => item.id === prevId);
|
|
600
|
+
const nextEl = handleEl.nextElementSibling;
|
|
601
|
+
const nextId = nextEl.getAttribute('itemid');
|
|
602
|
+
const nextItem = itemList.find(item => item.id === nextId);
|
|
603
|
+
if (actionOpts.trigger !== 'dblclick') {
|
|
604
|
+
if (prevItem && nextItem && nextItem.isExpand) {
|
|
605
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, false);
|
|
551
606
|
}
|
|
552
607
|
}
|
|
608
|
+
$xeSplit.dispatchEvent('action-click', { prevItem, nextItem }, evnt);
|
|
553
609
|
},
|
|
554
|
-
|
|
610
|
+
handleNextActionDblclickEvent(evnt) {
|
|
555
611
|
const $xeSplit = this;
|
|
556
612
|
const reactData = $xeSplit.reactData;
|
|
557
613
|
const { itemList } = reactData;
|
|
558
614
|
const actionOpts = $xeSplit.computeActionOpts;
|
|
559
615
|
const btnEl = evnt.currentTarget;
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
const
|
|
563
|
-
const
|
|
616
|
+
const btnWrapperEl = btnEl.parentElement;
|
|
617
|
+
const handleEl = btnWrapperEl.parentElement;
|
|
618
|
+
const prevEl = handleEl.previousElementSibling;
|
|
619
|
+
const prevId = prevEl.getAttribute('itemid');
|
|
620
|
+
const prevItem = itemList.find(item => item.id === prevId);
|
|
621
|
+
const nextEl = handleEl.nextElementSibling;
|
|
622
|
+
const nextId = nextEl.getAttribute('itemid');
|
|
623
|
+
const nextItem = itemList.find(item => item.id === nextId);
|
|
564
624
|
if (actionOpts.trigger === 'dblclick') {
|
|
565
|
-
|
|
625
|
+
if (prevItem && nextItem && prevItem.isExpand) {
|
|
626
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, true);
|
|
627
|
+
}
|
|
566
628
|
}
|
|
567
|
-
$xeSplit.dispatchEvent('action-dblclick', {
|
|
629
|
+
$xeSplit.dispatchEvent('action-dblclick', { prevItem, nextItem }, evnt);
|
|
568
630
|
},
|
|
569
|
-
|
|
631
|
+
handleNextActionClickEvent(evnt) {
|
|
570
632
|
const $xeSplit = this;
|
|
571
633
|
const reactData = $xeSplit.reactData;
|
|
572
634
|
const { itemList } = reactData;
|
|
573
635
|
const actionOpts = $xeSplit.computeActionOpts;
|
|
574
636
|
const btnEl = evnt.currentTarget;
|
|
575
|
-
const
|
|
576
|
-
const
|
|
577
|
-
const
|
|
578
|
-
const
|
|
637
|
+
const btnWrapperEl = btnEl.parentElement;
|
|
638
|
+
const handleEl = btnWrapperEl.parentElement;
|
|
639
|
+
const prevEl = handleEl.previousElementSibling;
|
|
640
|
+
const prevId = prevEl.getAttribute('itemid');
|
|
641
|
+
const prevItem = itemList.find(item => item.id === prevId);
|
|
642
|
+
const nextEl = handleEl.nextElementSibling;
|
|
643
|
+
const nextId = nextEl.getAttribute('itemid');
|
|
644
|
+
const nextItem = itemList.find(item => item.id === nextId);
|
|
579
645
|
if (actionOpts.trigger !== 'dblclick') {
|
|
580
|
-
|
|
646
|
+
if (prevItem && nextItem && prevItem.isExpand) {
|
|
647
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, true);
|
|
648
|
+
}
|
|
581
649
|
}
|
|
582
|
-
$xeSplit.dispatchEvent('action-click', {
|
|
650
|
+
$xeSplit.dispatchEvent('action-click', { prevItem, nextItem }, evnt);
|
|
583
651
|
},
|
|
584
652
|
handleGlobalResizeEvent() {
|
|
585
653
|
const $xeSplit = this;
|
|
586
654
|
$xeSplit.recalculate();
|
|
587
655
|
},
|
|
588
|
-
|
|
656
|
+
getActionIcon(prevItem, nextItem, isNext) {
|
|
589
657
|
const $xeSplit = this;
|
|
590
658
|
const props = $xeSplit;
|
|
591
659
|
const { vertical } = props;
|
|
592
|
-
const { showAction, isExpand } = item;
|
|
593
|
-
const isFoldNext = $xeSplit.computeIsFoldNext;
|
|
594
660
|
const topIcon = 'SPLIT_TOP_ACTION';
|
|
595
661
|
const bottomIcon = 'SPLIT_BOTTOM_ACTION';
|
|
596
662
|
const leftIcon = 'SPLIT_LEFT_ACTION';
|
|
597
663
|
const rightIcon = 'SPLIT_RIGHT_ACTION';
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (
|
|
601
|
-
|
|
602
|
-
iconName = isExpand ? bottomIcon : topIcon;
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
iconName = isExpand ? rightIcon : leftIcon;
|
|
606
|
-
}
|
|
664
|
+
let iconName = '';
|
|
665
|
+
if (vertical) {
|
|
666
|
+
if (isNext) {
|
|
667
|
+
iconName = nextItem.isExpand ? bottomIcon : topIcon;
|
|
607
668
|
}
|
|
608
669
|
else {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
670
|
+
iconName = prevItem.isExpand ? topIcon : bottomIcon;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
if (isNext) {
|
|
675
|
+
iconName = nextItem.isExpand ? rightIcon : leftIcon;
|
|
615
676
|
}
|
|
616
|
-
|
|
617
|
-
|
|
677
|
+
else {
|
|
678
|
+
iconName = prevItem.isExpand ? leftIcon : rightIcon;
|
|
618
679
|
}
|
|
619
680
|
}
|
|
681
|
+
if (iconName) {
|
|
682
|
+
return getIcon()[iconName];
|
|
683
|
+
}
|
|
620
684
|
return '';
|
|
621
685
|
},
|
|
622
686
|
//
|
|
623
687
|
// Render
|
|
624
688
|
//
|
|
625
|
-
renderHandleBar(h,
|
|
689
|
+
renderHandleBar(h, prevItem, nextItem) {
|
|
626
690
|
const $xeSplit = this;
|
|
691
|
+
const props = $xeSplit;
|
|
692
|
+
const reactData = $xeSplit.reactData;
|
|
693
|
+
const { border, resize, vertical } = props;
|
|
694
|
+
const { itemList } = reactData;
|
|
627
695
|
const barStyle = $xeSplit.computeBarStyle;
|
|
628
696
|
const actionOpts = $xeSplit.computeActionOpts;
|
|
629
|
-
const
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
btnOns.click = $xeSplit.handleItemActionEvent;
|
|
637
|
-
}
|
|
697
|
+
const { direction } = actionOpts;
|
|
698
|
+
const showPrevButton = XEUtils.isBoolean(actionOpts.showPrevButton) ? actionOpts.showPrevButton : (itemList.some(item => item.showAction));
|
|
699
|
+
const showNextButton = XEUtils.isBoolean(actionOpts.showNextButton) ? actionOpts.showNextButton : (direction === 'next' && itemList.some(item => item.showAction));
|
|
700
|
+
const resizeOpts = $xeSplit.computeResizeOpts;
|
|
701
|
+
const { immediate } = resizeOpts;
|
|
638
702
|
return h('div', {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
703
|
+
class: ['vxe-split-pane-handle', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
704
|
+
'is--resize': resize,
|
|
705
|
+
'is--border': border
|
|
706
|
+
}]
|
|
643
707
|
}, [
|
|
644
708
|
h('div', {
|
|
645
709
|
class: 'vxe-split-pane-handle-bar',
|
|
@@ -648,14 +712,36 @@ export default {
|
|
|
648
712
|
mousedown: $xeSplit.dragEvent
|
|
649
713
|
}
|
|
650
714
|
}),
|
|
651
|
-
|
|
652
|
-
? h('
|
|
653
|
-
class: 'vxe-split-pane-action-btn'
|
|
654
|
-
on: btnOns
|
|
715
|
+
itemList.length === 2
|
|
716
|
+
? h('div', {
|
|
717
|
+
class: 'vxe-split-pane-action-btn-wrapper'
|
|
655
718
|
}, [
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
719
|
+
showPrevButton && nextItem.isExpand
|
|
720
|
+
? h('div', {
|
|
721
|
+
class: 'vxe-split-pane-action-btn',
|
|
722
|
+
on: {
|
|
723
|
+
dblclick: $xeSplit.handlePrevActionDblclickEvent,
|
|
724
|
+
click: $xeSplit.handlePrevActionClickEvent
|
|
725
|
+
}
|
|
726
|
+
}, [
|
|
727
|
+
h('i', {
|
|
728
|
+
class: $xeSplit.getActionIcon(prevItem, nextItem, false)
|
|
729
|
+
})
|
|
730
|
+
])
|
|
731
|
+
: renderEmptyElement($xeSplit),
|
|
732
|
+
showNextButton && prevItem.isExpand
|
|
733
|
+
? h('div', {
|
|
734
|
+
class: 'vxe-split-pane-action-btn',
|
|
735
|
+
on: {
|
|
736
|
+
dblclick: $xeSplit.handleNextActionDblclickEvent,
|
|
737
|
+
click: $xeSplit.handleNextActionClickEvent
|
|
738
|
+
}
|
|
739
|
+
}, [
|
|
740
|
+
h('i', {
|
|
741
|
+
class: $xeSplit.getActionIcon(prevItem, nextItem, true)
|
|
742
|
+
})
|
|
743
|
+
])
|
|
744
|
+
: renderEmptyElement($xeSplit)
|
|
659
745
|
])
|
|
660
746
|
: renderEmptyElement($xeSplit)
|
|
661
747
|
]);
|
|
@@ -670,36 +756,38 @@ export default {
|
|
|
670
756
|
const { immediate } = resizeOpts;
|
|
671
757
|
const visibleItems = $xeSplit.computeVisibleItems;
|
|
672
758
|
const { autoItems } = $xeSplit.computeAutoItems;
|
|
673
|
-
const isFoldNext = $xeSplit.computeIsFoldNext;
|
|
674
759
|
const itemVNs = [];
|
|
675
|
-
itemList.forEach((
|
|
676
|
-
const { id, name, slots, renderHeight, resizeHeight, foldHeight, renderWidth, resizeWidth, foldWidth,
|
|
760
|
+
itemList.forEach((prevItem, index) => {
|
|
761
|
+
const { id, name, slots, renderHeight, resizeHeight, foldHeight, renderWidth, resizeWidth, foldWidth, isExpand } = prevItem;
|
|
762
|
+
const nextItem = itemList[index + 1];
|
|
677
763
|
const defaultSlot = slots ? slots.default : null;
|
|
678
764
|
const stys = {};
|
|
679
|
-
let itemWidth =
|
|
680
|
-
let itemHeight =
|
|
765
|
+
let itemWidth = isExpand ? (foldWidth || resizeWidth || renderWidth) : 0;
|
|
766
|
+
let itemHeight = isExpand ? (foldHeight || resizeHeight || renderHeight) : 0;
|
|
681
767
|
// 至少存在一个自适应
|
|
682
768
|
if (autoItems.length === 1) {
|
|
683
769
|
if (vertical) {
|
|
684
|
-
if (!
|
|
770
|
+
if (!prevItem.height) {
|
|
685
771
|
itemHeight = 0;
|
|
686
772
|
}
|
|
687
773
|
}
|
|
688
774
|
else {
|
|
689
|
-
if (!
|
|
775
|
+
if (!prevItem.width) {
|
|
690
776
|
itemWidth = 0;
|
|
691
777
|
}
|
|
692
778
|
}
|
|
693
779
|
}
|
|
694
|
-
|
|
780
|
+
let isFill = true;
|
|
695
781
|
if (vertical) {
|
|
696
|
-
if (itemHeight) {
|
|
697
|
-
|
|
782
|
+
if (itemHeight && visibleItems.length > 1) {
|
|
783
|
+
isFill = false;
|
|
784
|
+
stys.height = toCssUnit(itemHeight);
|
|
698
785
|
}
|
|
699
786
|
}
|
|
700
787
|
else {
|
|
701
|
-
if (itemWidth) {
|
|
702
|
-
|
|
788
|
+
if (itemWidth && visibleItems.length > 1) {
|
|
789
|
+
isFill = false;
|
|
790
|
+
stys.width = toCssUnit(itemWidth);
|
|
703
791
|
}
|
|
704
792
|
}
|
|
705
793
|
itemVNs.push(h('div', {
|
|
@@ -712,14 +800,12 @@ export default {
|
|
|
712
800
|
'is--border': border,
|
|
713
801
|
'is--height': itemHeight,
|
|
714
802
|
'is--width': itemWidth,
|
|
715
|
-
'is--
|
|
716
|
-
'is--
|
|
717
|
-
'is--
|
|
718
|
-
'is--hidden': !isVisible
|
|
803
|
+
'is--visible': isExpand,
|
|
804
|
+
'is--hidden': !isExpand,
|
|
805
|
+
'is--fill': isExpand && isFill
|
|
719
806
|
}],
|
|
720
807
|
style: stys
|
|
721
808
|
}, [
|
|
722
|
-
index && !isFoldNext ? $xeSplit.renderHandleBar(h, item) : renderEmptyElement($xeSplit),
|
|
723
809
|
h('div', {
|
|
724
810
|
attrs: {
|
|
725
811
|
itemid: id
|
|
@@ -728,10 +814,12 @@ export default {
|
|
|
728
814
|
}, [
|
|
729
815
|
h('div', {
|
|
730
816
|
class: 'vxe-split-pane--inner'
|
|
731
|
-
}, defaultSlot ? $xeSplit.callSlot(defaultSlot, { name,
|
|
732
|
-
])
|
|
733
|
-
isFoldNext && index < itemList.length - 1 ? $xeSplit.renderHandleBar(h, item) : renderEmptyElement($xeSplit)
|
|
817
|
+
}, defaultSlot ? $xeSplit.callSlot(defaultSlot, { name, isExpand }) : [])
|
|
818
|
+
])
|
|
734
819
|
]));
|
|
820
|
+
if (nextItem) {
|
|
821
|
+
itemVNs.push($xeSplit.renderHandleBar(h, prevItem, nextItem));
|
|
822
|
+
}
|
|
735
823
|
});
|
|
736
824
|
return h('div', {
|
|
737
825
|
class: 'vxe-split-wrapper'
|
|
@@ -777,7 +865,15 @@ export default {
|
|
|
777
865
|
})
|
|
778
866
|
])
|
|
779
867
|
]
|
|
780
|
-
: [])
|
|
868
|
+
: []),
|
|
869
|
+
h('div', {
|
|
870
|
+
class: 'vxe-split--render-vars'
|
|
871
|
+
}, [
|
|
872
|
+
h('div', {
|
|
873
|
+
ref: 'refBarInfoElem',
|
|
874
|
+
class: 'vxe-split--handle-bar-info'
|
|
875
|
+
})
|
|
876
|
+
])
|
|
781
877
|
]);
|
|
782
878
|
}
|
|
783
879
|
},
|
|
@@ -799,6 +895,10 @@ export default {
|
|
|
799
895
|
if (props.items) {
|
|
800
896
|
$xeSplit.loadItem(props.items);
|
|
801
897
|
}
|
|
898
|
+
const actionOpts = $xeSplit.computeActionOpts;
|
|
899
|
+
if (actionOpts.direction) {
|
|
900
|
+
errLog('vxe.error.delProp', ['action-config.direction', 'action-config.showPrevButton | action-config.showNextButton']);
|
|
901
|
+
}
|
|
802
902
|
$xeSplit.$nextTick(() => {
|
|
803
903
|
$xeSplit.recalculate();
|
|
804
904
|
});
|