vxe-pc-ui 4.9.0 → 4.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.
Files changed (59) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/modal/src/modal.js +5 -2
  3. package/es/split/src/split-pane.js +3 -3
  4. package/es/split/src/split.js +244 -141
  5. package/es/split/style.css +82 -45
  6. package/es/split/style.min.css +1 -1
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/tabs/src/tabs.js +6 -3
  10. package/es/ui/index.js +1 -1
  11. package/es/ui/src/log.js +1 -1
  12. package/es/upload/src/upload.js +7 -2
  13. package/es/vxe-split/style.css +82 -45
  14. package/es/vxe-split/style.min.css +1 -1
  15. package/lib/icon/style/style.css +1 -1
  16. package/lib/icon/style/style.min.css +1 -1
  17. package/lib/index.umd.js +270 -166
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/modal/src/modal.js +5 -2
  20. package/lib/modal/src/modal.min.js +1 -1
  21. package/lib/split/src/split-pane.js +3 -3
  22. package/lib/split/src/split-pane.min.js +1 -1
  23. package/lib/split/src/split.js +247 -154
  24. package/lib/split/src/split.min.js +1 -1
  25. package/lib/split/style/style.css +82 -45
  26. package/lib/split/style/style.min.css +1 -1
  27. package/lib/style.css +1 -1
  28. package/lib/style.min.css +1 -1
  29. package/lib/tabs/src/tabs.js +6 -3
  30. package/lib/tabs/src/tabs.min.js +1 -1
  31. package/lib/ui/index.js +1 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/upload/src/upload.js +7 -2
  36. package/lib/upload/src/upload.min.js +1 -1
  37. package/lib/vxe-split/style/style.css +82 -45
  38. package/lib/vxe-split/style/style.min.css +1 -1
  39. package/package.json +1 -1
  40. package/packages/modal/src/modal.ts +6 -2
  41. package/packages/split/src/split-pane.ts +4 -3
  42. package/packages/split/src/split.ts +243 -142
  43. package/packages/tabs/src/tabs.ts +7 -3
  44. package/packages/upload/src/upload.ts +8 -2
  45. package/styles/components/split.scss +109 -88
  46. package/types/components/split-pane.d.ts +11 -2
  47. package/types/components/split.d.ts +26 -22
  48. /package/es/icon/{iconfont.1756083805751.ttf → iconfont.1756133787659.ttf} +0 -0
  49. /package/es/icon/{iconfont.1756083805751.woff → iconfont.1756133787659.woff} +0 -0
  50. /package/es/icon/{iconfont.1756083805751.woff2 → iconfont.1756133787659.woff2} +0 -0
  51. /package/es/{iconfont.1756083805751.ttf → iconfont.1756133787659.ttf} +0 -0
  52. /package/es/{iconfont.1756083805751.woff → iconfont.1756133787659.woff} +0 -0
  53. /package/es/{iconfont.1756083805751.woff2 → iconfont.1756133787659.woff2} +0 -0
  54. /package/lib/icon/style/{iconfont.1756083805751.ttf → iconfont.1756133787659.ttf} +0 -0
  55. /package/lib/icon/style/{iconfont.1756083805751.woff → iconfont.1756133787659.woff} +0 -0
  56. /package/lib/icon/style/{iconfont.1756083805751.woff2 → iconfont.1756133787659.woff2} +0 -0
  57. /package/lib/{iconfont.1756083805751.ttf → iconfont.1756133787659.ttf} +0 -0
  58. /package/lib/{iconfont.1756083805751.woff → iconfont.1756133787659.woff} +0 -0
  59. /package/lib/{iconfont.1756083805751.woff2 → iconfont.1756133787659.woff2} +0 -0
@@ -48,10 +48,13 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
48
48
  } = context;
49
49
  const xID = _xeUtils.default.uniqueId();
50
50
  const refElem = (0, _vue.ref)();
51
+ const refBarInfoElem = (0, _vue.ref)();
51
52
  const refResizableSplitTip = (0, _vue.ref)();
52
53
  const reactData = (0, _vue.reactive)({
53
54
  staticItems: [],
54
- itemList: []
55
+ itemList: [],
56
+ barWidth: 0,
57
+ barHeight: 0
55
58
  });
56
59
  const internalData = {
57
60
  wrapperWidth: 0,
@@ -69,12 +72,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
69
72
  const computeActionOpts = (0, _vue.computed)(() => {
70
73
  return Object.assign({}, (0, _ui.getConfig)().split.actionConfig, props.actionConfig);
71
74
  });
72
- const computeIsFoldNext = (0, _vue.computed)(() => {
73
- const actionOpts = computeActionOpts.value;
74
- return actionOpts.direction === 'next';
75
- });
76
75
  const computeVisibleItems = (0, _vue.computed)(() => {
77
- return reactData.itemList.filter(item => item.isVisible);
76
+ return reactData.itemList.filter(item => item.isExpand);
78
77
  });
79
78
  const computeAutoItems = (0, _vue.computed)(() => {
80
79
  const {
@@ -88,10 +87,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
88
87
  renderHeight,
89
88
  resizeHeight,
90
89
  foldHeight,
91
- isVisible,
90
+ isExpand,
92
91
  height
93
92
  } = item;
94
- const itemHeight = isVisible ? foldHeight || resizeHeight || renderHeight : 0;
93
+ const itemHeight = isExpand ? foldHeight || resizeHeight || renderHeight : 0;
95
94
  if (!height) {
96
95
  autoItems.push(item);
97
96
  }
@@ -101,10 +100,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
101
100
  renderWidth,
102
101
  resizeWidth,
103
102
  foldWidth,
104
- isVisible,
103
+ isExpand,
105
104
  width
106
105
  } = item;
107
- const itemWidth = isVisible ? foldWidth || resizeWidth || renderWidth : 0;
106
+ const itemWidth = isExpand ? foldWidth || resizeWidth || renderWidth : 0;
108
107
  if (!width) {
109
108
  autoItems.push(item);
110
109
  }
@@ -136,8 +135,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
136
135
  const computeMaps = {
137
136
  computeItemOpts,
138
137
  computeBarOpts,
139
- computeActionOpts,
140
- computeIsFoldNext
138
+ computeActionOpts
141
139
  };
142
140
  const refMaps = {
143
141
  refElem
@@ -167,38 +165,31 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
167
165
  }
168
166
  return [];
169
167
  };
170
- const getDefaultActionIcon = item => {
168
+ const getActionIcon = (prevItem, nextItem, isNext) => {
171
169
  const {
172
170
  vertical
173
171
  } = props;
174
- const {
175
- showAction,
176
- isExpand
177
- } = item;
178
- const isFoldNext = computeIsFoldNext.value;
179
172
  const topIcon = 'SPLIT_TOP_ACTION';
180
173
  const bottomIcon = 'SPLIT_BOTTOM_ACTION';
181
174
  const leftIcon = 'SPLIT_LEFT_ACTION';
182
175
  const rightIcon = 'SPLIT_RIGHT_ACTION';
183
- if (showAction) {
184
- let iconName = '';
185
- if (isFoldNext) {
186
- if (vertical) {
187
- iconName = isExpand ? bottomIcon : topIcon;
188
- } else {
189
- iconName = isExpand ? rightIcon : leftIcon;
190
- }
176
+ let iconName = '';
177
+ if (vertical) {
178
+ if (isNext) {
179
+ iconName = nextItem.isExpand ? bottomIcon : topIcon;
191
180
  } else {
192
- if (vertical) {
193
- iconName = isExpand ? topIcon : bottomIcon;
194
- } else {
195
- iconName = isExpand ? leftIcon : rightIcon;
196
- }
181
+ iconName = prevItem.isExpand ? topIcon : bottomIcon;
197
182
  }
198
- if (iconName) {
199
- return (0, _ui.getIcon)()[iconName];
183
+ } else {
184
+ if (isNext) {
185
+ iconName = nextItem.isExpand ? rightIcon : leftIcon;
186
+ } else {
187
+ iconName = prevItem.isExpand ? leftIcon : rightIcon;
200
188
  }
201
189
  }
190
+ if (iconName) {
191
+ return (0, _ui.getIcon)()[iconName];
192
+ }
202
193
  return '';
203
194
  };
204
195
  const reset = () => {
@@ -207,7 +198,6 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
207
198
  } = reactData;
208
199
  itemList.forEach(item => {
209
200
  item.isExpand = true;
210
- item.isVisible = true;
211
201
  item.foldHeight = 0;
212
202
  item.foldWidth = 0;
213
203
  item.resizeHeight = 0;
@@ -219,8 +209,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
219
209
  const {
220
210
  staticItems
221
211
  } = reactData;
212
+ const actionOpts = computeActionOpts.value;
213
+ const {
214
+ showPrevButton,
215
+ showNextButton
216
+ } = actionOpts;
222
217
  const itemDef = {
223
- isVisible: true,
224
218
  isExpand: true,
225
219
  renderWidth: 0,
226
220
  resizeWidth: 0,
@@ -230,6 +224,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
230
224
  foldHeight: 0
231
225
  };
232
226
  reactData.itemList = list.map(item => {
227
+ if (item.showAction) {
228
+ (0, _log.warnLog)('vxe.error.removeProp', ['showAction']);
229
+ }
233
230
  if (item.slots) {
234
231
  _xeUtils.default.each(item.slots, func => {
235
232
  if (!_xeUtils.default.isFunction(func)) {
@@ -246,6 +243,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
246
243
  if (staticItems.length) {
247
244
  (0, _log.errLog)('vxe.error.errConflicts', ['<vxe-split-pane ...>', 'items']);
248
245
  }
246
+ if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
247
+ (0, _log.errLog)('vxe.error.errConflicts', ['action-config.showPrevButton | action-config.showNextButton', 'Only supports 2 item']);
248
+ }
249
249
  return recalculate();
250
250
  };
251
251
  const loadItem = list => {
@@ -263,6 +263,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
263
263
  itemList
264
264
  } = reactData;
265
265
  const el = refElem.value;
266
+ const barInfoElem = refBarInfoElem.value;
266
267
  if (!el) {
267
268
  return;
268
269
  }
@@ -271,6 +272,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
271
272
  if (!wWidth || !wHeight) {
272
273
  return;
273
274
  }
275
+ if (barInfoElem) {
276
+ reactData.barWidth = barInfoElem.offsetWidth;
277
+ reactData.barHeight = barInfoElem.offsetHeight;
278
+ }
279
+ const contentWidth = wWidth - (vertical ? 0 : reactData.barWidth * (itemList.length - 1));
280
+ const contentHeight = wHeight - (vertical ? reactData.barHeight * (itemList.length - 1) : 0);
274
281
  const itemOpts = computeItemOpts.value;
275
282
  const allMinWidth = _xeUtils.default.toNumber(itemOpts.minWidth);
276
283
  const allMinHeight = _xeUtils.default.toNumber(itemOpts.minHeight);
@@ -284,7 +291,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
284
291
  let itemHeight = 0;
285
292
  if (height) {
286
293
  if ((0, _dom.isScale)(height)) {
287
- itemHeight = wHeight * _xeUtils.default.toNumber(height) / 100;
294
+ itemHeight = contentHeight * _xeUtils.default.toNumber(height) / 100;
288
295
  } else {
289
296
  itemHeight = _xeUtils.default.toNumber(height);
290
297
  }
@@ -295,7 +302,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
295
302
  countHeight += itemHeight;
296
303
  });
297
304
  if (residueItems.length) {
298
- const reMeanHeight = (wHeight - countHeight) / residueItems.length;
305
+ const reMeanHeight = (contentHeight - countHeight) / residueItems.length;
299
306
  residueItems.forEach(item => {
300
307
  item.renderHeight = Math.max(_xeUtils.default.toNumber((0, _utils.getGlobalDefaultConfig)(item.minHeight, allMinHeight)), reMeanHeight);
301
308
  });
@@ -309,7 +316,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
309
316
  let itemWidth = 0;
310
317
  if (width) {
311
318
  if ((0, _dom.isScale)(width)) {
312
- itemWidth = wWidth * _xeUtils.default.toNumber(width) / 100;
319
+ itemWidth = contentWidth * _xeUtils.default.toNumber(width) / 100;
313
320
  } else {
314
321
  itemWidth = _xeUtils.default.toNumber(width);
315
322
  }
@@ -320,14 +327,14 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
320
327
  countWidth += itemWidth;
321
328
  });
322
329
  if (residueItems.length) {
323
- const reMeanWidth = (wWidth - countWidth) / residueItems.length;
330
+ const reMeanWidth = (contentWidth - countWidth) / residueItems.length;
324
331
  residueItems.forEach(item => {
325
332
  item.renderWidth = Math.max(_xeUtils.default.toNumber((0, _utils.getGlobalDefaultConfig)(item.minWidth, allMinWidth)), reMeanWidth);
326
333
  });
327
334
  }
328
335
  }
329
- internalData.wrapperWidth = wWidth;
330
- internalData.wrapperHeight = wHeight;
336
+ internalData.wrapperWidth = contentWidth;
337
+ internalData.wrapperHeight = contentHeight;
331
338
  });
332
339
  };
333
340
  const dragEvent = evnt => {
@@ -348,20 +355,22 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
348
355
  if (!el) {
349
356
  return;
350
357
  }
351
- const itemId = handleEl.getAttribute('itemid');
352
- const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
353
- const item = itemList[itemIndex];
354
- if (!item) {
358
+ const prevEl = handleEl.previousElementSibling;
359
+ const nextEl = handleEl.nextElementSibling;
360
+ if (!prevEl || !nextEl) {
355
361
  return;
356
362
  }
357
- if (!item.isExpand) {
363
+ const prevId = prevEl.getAttribute('itemid');
364
+ const nextId = nextEl.getAttribute('itemid');
365
+ const prevItem = itemList.find(item => item.id === prevId);
366
+ const nextItem = itemList.find(item => item.id === nextId);
367
+ if (!prevItem || !nextItem) {
358
368
  return;
359
369
  }
360
370
  const containerRect = el.getBoundingClientRect();
361
371
  const barRect = barEl.getBoundingClientRect();
362
372
  const rsSplitLineEl = refResizableSplitTip.value;
363
373
  const rsSplitTipEl = rsSplitLineEl ? rsSplitLineEl.children[0] : null;
364
- const isFoldNext = computeIsFoldNext.value;
365
374
  const itemOpts = computeItemOpts.value;
366
375
  const resizeOpts = computeResizeOpts.value;
367
376
  const {
@@ -369,14 +378,6 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
369
378
  } = resizeOpts;
370
379
  const allMinWidth = _xeUtils.default.toNumber(itemOpts.minWidth);
371
380
  const allMinHeight = _xeUtils.default.toNumber(itemOpts.minHeight);
372
- const targetItem = itemList[itemIndex + (isFoldNext ? 1 : -1)];
373
- const prevItem = itemList[itemIndex + (isFoldNext ? 0 : -1)];
374
- const nextItem = itemList[itemIndex + (isFoldNext ? 1 : 0)];
375
- const prevEl = targetItem ? el.querySelector(`.vxe-split-pane[itemid="${prevItem.id}"]`) : null;
376
- const nextEl = item ? el.querySelector(`.vxe-split-pane[itemid="${nextItem.id}"]`) : null;
377
- if (!prevEl || !nextEl) {
378
- return;
379
- }
380
381
  const barOffsetX = Math.ceil(barRect.width - (evnt.clientX - barRect.left));
381
382
  const barOffsetY = Math.ceil(evnt.clientY - barRect.top);
382
383
  const prevWidth = prevEl.offsetWidth;
@@ -513,8 +514,6 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
513
514
  handleReStyle(evnt);
514
515
  }
515
516
  dispatchEvent('resize-drag', {
516
- item,
517
- name: item.name,
518
517
  prevItem,
519
518
  nextItem,
520
519
  offsetHeight: targetOffsetHeight,
@@ -534,8 +533,6 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
534
533
  handleUpdate();
535
534
  (0, _dom.removeClass)(el, 'is--drag');
536
535
  dispatchEvent('resize-end', {
537
- item,
538
- name: item.name,
539
536
  prevItem,
540
537
  nextItem,
541
538
  offsetHeight: targetOffsetHeight,
@@ -550,98 +547,149 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
550
547
  handleDrag(evnt);
551
548
  (0, _dom.addClass)(el, 'is--drag');
552
549
  dispatchEvent('resize-start', {
553
- item,
554
- name: item.name,
555
550
  prevItem,
556
551
  nextItem
557
552
  }, evnt);
558
553
  };
559
- const handleItemActionEvent = evnt => {
560
- const el = refElem.value;
561
- if (!el) {
562
- return;
563
- }
554
+ const handleItemActionEvent = (evnt, prevItem, nextItem, isNext) => {
564
555
  const {
565
556
  vertical
566
557
  } = props;
558
+ let expanded = false;
559
+ let item = prevItem;
560
+ if (isNext) {
561
+ item = nextItem;
562
+ expanded = !nextItem.isExpand;
563
+ nextItem.isExpand = expanded;
564
+ } else {
565
+ expanded = !prevItem.isExpand;
566
+ prevItem.isExpand = expanded;
567
+ }
568
+ if (vertical) {
569
+ if (prevItem.isExpand && nextItem.isExpand) {
570
+ prevItem.foldHeight = 0;
571
+ nextItem.foldHeight = 0;
572
+ } else if (prevItem.isExpand) {
573
+ nextItem.foldHeight = 0;
574
+ prevItem.foldHeight = (prevItem.resizeHeight || prevItem.renderHeight) + (nextItem.resizeHeight || nextItem.renderHeight);
575
+ } else {
576
+ prevItem.foldHeight = 0;
577
+ nextItem.foldHeight = (prevItem.resizeHeight || prevItem.renderHeight) + (nextItem.resizeHeight || nextItem.renderHeight);
578
+ }
579
+ } else {
580
+ if (prevItem.isExpand && nextItem.isExpand) {
581
+ prevItem.foldWidth = 0;
582
+ nextItem.foldWidth = 0;
583
+ } else if (prevItem.isExpand) {
584
+ nextItem.foldWidth = 0;
585
+ prevItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth);
586
+ } else {
587
+ prevItem.foldWidth = 0;
588
+ nextItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth);
589
+ }
590
+ }
591
+ dispatchEvent('toggle-expand', {
592
+ prevItem,
593
+ nextItem,
594
+ expanded,
595
+ item
596
+ }, evnt);
597
+ recalculate();
598
+ };
599
+ const handlePrevActionDblclickEvent = evnt => {
567
600
  const {
568
601
  itemList
569
602
  } = reactData;
570
- const isFoldNext = computeIsFoldNext.value;
603
+ const actionOpts = computeActionOpts.value;
571
604
  const btnEl = evnt.currentTarget;
572
- const handleEl = btnEl.parentElement;
573
- const itemId = handleEl.getAttribute('itemid');
574
- const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
575
- const item = itemList[itemIndex];
576
- const targetItem = itemList[itemIndex + (isFoldNext ? 1 : -1)];
577
- if (item) {
578
- const {
579
- showAction,
580
- isExpand
581
- } = item;
582
- if (showAction) {
583
- if (vertical) {
584
- if (targetItem) {
585
- targetItem.isVisible = !isExpand;
586
- targetItem.foldHeight = 0;
587
- item.isExpand = !isExpand;
588
- item.isVisible = true;
589
- item.foldHeight = isExpand ? (targetItem.resizeHeight || targetItem.renderHeight) + (item.resizeHeight || item.renderHeight) : 0;
590
- }
591
- } else {
592
- if (targetItem) {
593
- targetItem.isVisible = !isExpand;
594
- targetItem.foldWidth = 0;
595
- item.isExpand = !isExpand;
596
- item.isVisible = true;
597
- item.foldWidth = isExpand ? (targetItem.resizeWidth || targetItem.renderWidth) + (item.resizeWidth || item.renderWidth) : 0;
598
- }
599
- }
600
- dispatchEvent('toggle-expand', {
601
- item,
602
- name: item.name,
603
- targetItem,
604
- targetName: targetItem ? targetItem.name : '',
605
- expanded: item.isExpand
606
- }, evnt);
607
- recalculate();
605
+ const btnWrapperEl = btnEl.parentElement;
606
+ const handleEl = btnWrapperEl.parentElement;
607
+ const prevEl = handleEl.previousElementSibling;
608
+ const prevId = prevEl.getAttribute('itemid');
609
+ const prevItem = itemList.find(item => item.id === prevId);
610
+ const nextEl = handleEl.nextElementSibling;
611
+ const nextId = nextEl.getAttribute('itemid');
612
+ const nextItem = itemList.find(item => item.id === nextId);
613
+ if (actionOpts.trigger === 'dblclick') {
614
+ if (prevItem && nextItem && nextItem.isExpand) {
615
+ handleItemActionEvent(evnt, prevItem, nextItem, false);
608
616
  }
609
617
  }
618
+ dispatchEvent('action-dblclick', {
619
+ prevItem,
620
+ nextItem
621
+ }, evnt);
610
622
  };
611
- const handleActionDblclickEvent = evnt => {
623
+ const handlePrevActionClickEvent = evnt => {
612
624
  const {
613
625
  itemList
614
626
  } = reactData;
615
627
  const actionOpts = computeActionOpts.value;
616
628
  const btnEl = evnt.currentTarget;
617
- const handleEl = btnEl.parentElement;
618
- const itemId = handleEl.getAttribute('itemid');
619
- const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
620
- const item = itemList[itemIndex];
629
+ const btnWrapperEl = btnEl.parentElement;
630
+ const handleEl = btnWrapperEl.parentElement;
631
+ const prevEl = handleEl.previousElementSibling;
632
+ const prevId = prevEl.getAttribute('itemid');
633
+ const prevItem = itemList.find(item => item.id === prevId);
634
+ const nextEl = handleEl.nextElementSibling;
635
+ const nextId = nextEl.getAttribute('itemid');
636
+ const nextItem = itemList.find(item => item.id === nextId);
637
+ if (actionOpts.trigger !== 'dblclick') {
638
+ if (prevItem && nextItem && nextItem.isExpand) {
639
+ handleItemActionEvent(evnt, prevItem, nextItem, false);
640
+ }
641
+ }
642
+ dispatchEvent('action-click', {
643
+ prevItem,
644
+ nextItem
645
+ }, evnt);
646
+ };
647
+ const handleNextActionDblclickEvent = evnt => {
648
+ const {
649
+ itemList
650
+ } = reactData;
651
+ const actionOpts = computeActionOpts.value;
652
+ const btnEl = evnt.currentTarget;
653
+ const btnWrapperEl = btnEl.parentElement;
654
+ const handleEl = btnWrapperEl.parentElement;
655
+ const prevEl = handleEl.previousElementSibling;
656
+ const prevId = prevEl.getAttribute('itemid');
657
+ const prevItem = itemList.find(item => item.id === prevId);
658
+ const nextEl = handleEl.nextElementSibling;
659
+ const nextId = nextEl.getAttribute('itemid');
660
+ const nextItem = itemList.find(item => item.id === nextId);
621
661
  if (actionOpts.trigger === 'dblclick') {
622
- handleItemActionEvent(evnt);
662
+ if (prevItem && nextItem && prevItem.isExpand) {
663
+ handleItemActionEvent(evnt, prevItem, nextItem, true);
664
+ }
623
665
  }
624
666
  dispatchEvent('action-dblclick', {
625
- item,
626
- name: item ? item.name : ''
667
+ prevItem,
668
+ nextItem
627
669
  }, evnt);
628
670
  };
629
- const handleActionClickEvent = evnt => {
671
+ const handleNextActionClickEvent = evnt => {
630
672
  const {
631
673
  itemList
632
674
  } = reactData;
633
675
  const actionOpts = computeActionOpts.value;
634
676
  const btnEl = evnt.currentTarget;
635
- const handleEl = btnEl.parentElement;
636
- const itemId = handleEl.getAttribute('itemid');
637
- const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
638
- const item = itemList[itemIndex];
677
+ const btnWrapperEl = btnEl.parentElement;
678
+ const handleEl = btnWrapperEl.parentElement;
679
+ const prevEl = handleEl.previousElementSibling;
680
+ const prevId = prevEl.getAttribute('itemid');
681
+ const prevItem = itemList.find(item => item.id === prevId);
682
+ const nextEl = handleEl.nextElementSibling;
683
+ const nextId = nextEl.getAttribute('itemid');
684
+ const nextItem = itemList.find(item => item.id === nextId);
639
685
  if (actionOpts.trigger !== 'dblclick') {
640
- handleItemActionEvent(evnt);
686
+ if (prevItem && nextItem && prevItem.isExpand) {
687
+ handleItemActionEvent(evnt, prevItem, nextItem, true);
688
+ }
641
689
  }
642
690
  dispatchEvent('action-click', {
643
- item,
644
- name: item ? item.name : ''
691
+ prevItem,
692
+ nextItem
645
693
  }, evnt);
646
694
  };
647
695
  const handleGlobalResizeEvent = () => {
@@ -656,29 +704,50 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
656
704
  };
657
705
  const splitPrivateMethods = {};
658
706
  Object.assign($xeSplit, splitMethods, splitPrivateMethods);
659
- const renderHandleBar = item => {
707
+ const renderHandleBar = (prevItem, nextItem) => {
708
+ const {
709
+ border,
710
+ resize,
711
+ vertical
712
+ } = props;
713
+ const {
714
+ itemList
715
+ } = reactData;
660
716
  const barStyle = computeBarStyle.value;
661
717
  const actionOpts = computeActionOpts.value;
662
- const isFoldNext = computeIsFoldNext.value;
663
718
  const {
664
- id,
665
- isExpand,
666
- showAction
667
- } = item;
719
+ direction
720
+ } = actionOpts;
721
+ const showPrevButton = _xeUtils.default.isBoolean(actionOpts.showPrevButton) ? actionOpts.showPrevButton : itemList.some(item => item.showAction);
722
+ const showNextButton = _xeUtils.default.isBoolean(actionOpts.showNextButton) ? actionOpts.showNextButton : direction === 'next' && itemList.some(item => item.showAction);
723
+ const resizeOpts = computeResizeOpts.value;
724
+ const {
725
+ immediate
726
+ } = resizeOpts;
668
727
  return (0, _vue.h)('div', {
669
- itemid: id,
670
- class: ['vxe-split-pane-handle', isFoldNext ? 'to--next' : 'to--prev']
728
+ class: ['vxe-split-pane-handle', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
729
+ 'is--resize': resize,
730
+ 'is--border': border
731
+ }]
671
732
  }, [(0, _vue.h)('div', {
672
733
  class: 'vxe-split-pane-handle-bar',
673
734
  style: barStyle,
674
735
  onMousedown: dragEvent
675
- }), showAction ? (0, _vue.h)('span', {
736
+ }), itemList.length === 2 ? (0, _vue.h)('div', {
737
+ class: 'vxe-split-pane-action-btn-wrapper'
738
+ }, [showPrevButton && nextItem.isExpand ? (0, _vue.h)('div', {
739
+ class: 'vxe-split-pane-action-btn',
740
+ onDblclick: handlePrevActionDblclickEvent,
741
+ onClick: handlePrevActionClickEvent
742
+ }, [(0, _vue.h)('i', {
743
+ class: getActionIcon(prevItem, nextItem, false)
744
+ })]) : (0, _ui.renderEmptyElement)($xeSplit), showNextButton && prevItem.isExpand ? (0, _vue.h)('div', {
676
745
  class: 'vxe-split-pane-action-btn',
677
- onDblclick: handleActionDblclickEvent,
678
- onClick: handleActionClickEvent
746
+ onDblclick: handleNextActionDblclickEvent,
747
+ onClick: handleNextActionClickEvent
679
748
  }, [(0, _vue.h)('i', {
680
- class: (isExpand ? actionOpts.openIcon : actionOpts.closeIcon) || getDefaultActionIcon(item)
681
- })]) : (0, _ui.renderEmptyElement)($xeSplit)]);
749
+ class: getActionIcon(prevItem, nextItem, true)
750
+ })]) : (0, _ui.renderEmptyElement)($xeSplit)]) : (0, _ui.renderEmptyElement)($xeSplit)]);
682
751
  };
683
752
  const renderItems = () => {
684
753
  const {
@@ -698,9 +767,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
698
767
  const {
699
768
  autoItems
700
769
  } = computeAutoItems.value;
701
- const isFoldNext = computeIsFoldNext.value;
702
770
  const itemVNs = [];
703
- itemList.forEach((item, index) => {
771
+ itemList.forEach((prevItem, index) => {
704
772
  const {
705
773
  id,
706
774
  name,
@@ -711,33 +779,35 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
711
779
  renderWidth,
712
780
  resizeWidth,
713
781
  foldWidth,
714
- isVisible,
715
782
  isExpand
716
- } = item;
783
+ } = prevItem;
784
+ const nextItem = itemList[index + 1];
717
785
  const defaultSlot = slots ? slots.default : null;
718
786
  const stys = {};
719
- let itemWidth = isVisible ? foldWidth || resizeWidth || renderWidth : 0;
720
- let itemHeight = isVisible ? foldHeight || resizeHeight || renderHeight : 0;
787
+ let itemWidth = isExpand ? foldWidth || resizeWidth || renderWidth : 0;
788
+ let itemHeight = isExpand ? foldHeight || resizeHeight || renderHeight : 0;
721
789
  // 至少存在一个自适应
722
790
  if (autoItems.length === 1) {
723
791
  if (vertical) {
724
- if (!item.height) {
792
+ if (!prevItem.height) {
725
793
  itemHeight = 0;
726
794
  }
727
795
  } else {
728
- if (!item.width) {
796
+ if (!prevItem.width) {
729
797
  itemWidth = 0;
730
798
  }
731
799
  }
732
800
  }
733
- // 当只剩下一个可视区自动占用 100%
801
+ let isFill = true;
734
802
  if (vertical) {
735
- if (itemHeight) {
736
- stys.height = visibleItems.length === 1 ? '100%' : (0, _dom.toCssUnit)(itemHeight);
803
+ if (itemHeight && visibleItems.length > 1) {
804
+ isFill = false;
805
+ stys.height = (0, _dom.toCssUnit)(itemHeight);
737
806
  }
738
807
  } else {
739
- if (itemWidth) {
740
- stys.width = visibleItems.length === 1 ? '100%' : (0, _dom.toCssUnit)(itemWidth);
808
+ if (itemWidth && visibleItems.length > 1) {
809
+ isFill = false;
810
+ stys.width = (0, _dom.toCssUnit)(itemWidth);
741
811
  }
742
812
  }
743
813
  itemVNs.push((0, _vue.h)('div', {
@@ -748,22 +818,23 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
748
818
  'is--border': border,
749
819
  'is--height': itemHeight,
750
820
  'is--width': itemWidth,
751
- 'is--fill': isVisible && !itemHeight && !itemWidth,
752
- 'is--handle': index > 0,
753
- 'is--expand': isExpand,
754
- 'is--hidden': !isVisible
821
+ 'is--visible': isExpand,
822
+ 'is--hidden': !isExpand,
823
+ 'is--fill': isExpand && isFill
755
824
  }],
756
825
  style: stys
757
- }, [index && !isFoldNext ? renderHandleBar(item) : (0, _ui.renderEmptyElement)($xeSplit), (0, _vue.h)('div', {
826
+ }, [(0, _vue.h)('div', {
758
827
  itemid: id,
759
828
  class: 'vxe-split-pane--wrapper'
760
829
  }, [(0, _vue.h)('div', {
761
830
  class: 'vxe-split-pane--inner'
762
831
  }, defaultSlot ? callSlot(defaultSlot, {
763
832
  name,
764
- isVisible,
765
833
  isExpand
766
- }) : [])]), isFoldNext && index < itemList.length - 1 ? renderHandleBar(item) : (0, _ui.renderEmptyElement)($xeSplit)]));
834
+ }) : [])])]));
835
+ if (nextItem) {
836
+ itemVNs.push(renderHandleBar(prevItem, nextItem));
837
+ }
767
838
  });
768
839
  return (0, _vue.h)('div', {
769
840
  class: 'vxe-split-wrapper'
@@ -803,7 +874,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
803
874
  class: 'vxe-split--resizable-split-number-prev'
804
875
  }), (0, _vue.h)('div', {
805
876
  class: 'vxe-split--resizable-split-number-next'
806
- })])] : [])]);
877
+ })])] : []), (0, _vue.h)('div', {
878
+ class: 'vxe-split--render-vars'
879
+ }, [(0, _vue.h)('div', {
880
+ ref: refBarInfoElem,
881
+ class: 'vxe-split--handle-bar-info'
882
+ })])]);
807
883
  };
808
884
  const itemFlag = (0, _vue.ref)(0);
809
885
  (0, _vue.watch)(() => props.items ? props.items.length : -1, () => {
@@ -816,10 +892,23 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
816
892
  loadItem(props.items || []);
817
893
  });
818
894
  (0, _vue.watch)(() => reactData.staticItems, val => {
895
+ const actionOpts = computeActionOpts.value;
896
+ const {
897
+ showPrevButton,
898
+ showNextButton
899
+ } = actionOpts;
819
900
  if (props.items && props.items.length) {
820
901
  (0, _log.errLog)('vxe.error.errConflicts', ['<vxe-split-pane ...>', 'items']);
821
902
  }
822
- reactData.itemList = val;
903
+ reactData.itemList = val || [];
904
+ if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
905
+ (0, _log.errLog)('vxe.error.modelConflicts', ['action-config.showPrevButton | action-config.showNextButton', '<vxe-split-pane ...> Only supports 2 panel']);
906
+ }
907
+ reactData.itemList.forEach(item => {
908
+ if (item.showAction) {
909
+ (0, _log.warnLog)('vxe.error.removeProp', ['showAction']);
910
+ }
911
+ });
823
912
  recalculate();
824
913
  });
825
914
  let resizeObserver;
@@ -834,6 +923,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
834
923
  });
835
924
  resizeObserver.observe(el);
836
925
  }
926
+ const actionOpts = computeActionOpts.value;
927
+ if (actionOpts.direction) {
928
+ (0, _log.errLog)('vxe.error.delProp', ['action-config.direction', 'action-config.showPrevButton | action-config.showNextButton']);
929
+ }
837
930
  _ui.globalEvents.on($xeSplit, 'resize', handleGlobalResizeEvent);
838
931
  });
839
932
  (0, _vue.onUnmounted)(() => {