vxe-pc-ui 4.5.4 → 4.5.5
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/collapse/src/collapse.js +5 -1
- package/es/form/src/form.js +12 -16
- package/es/icon/style.css +1 -1
- package/es/split/src/split.js +113 -30
- 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/lib/collapse/src/collapse.js +8 -1
- package/lib/collapse/src/collapse.min.js +1 -1
- package/lib/form/src/form.js +12 -16
- package/lib/form/src/form.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 +147 -47
- package/lib/index.umd.min.js +1 -1
- package/lib/split/src/split.js +128 -30
- package/lib/split/src/split.min.js +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/package.json +1 -1
- package/packages/collapse/src/collapse.ts +5 -1
- package/packages/form/src/form.ts +12 -16
- package/packages/split/src/split.ts +120 -33
- package/types/components/carousel.d.ts +13 -3
- package/types/components/collapse.d.ts +23 -4
- package/types/components/split-item.d.ts +3 -0
- package/types/components/split.d.ts +62 -1
- /package/es/icon/{iconfont.1743125694154.ttf → iconfont.1743138565378.ttf} +0 -0
- /package/es/icon/{iconfont.1743125694154.woff → iconfont.1743138565378.woff} +0 -0
- /package/es/icon/{iconfont.1743125694154.woff2 → iconfont.1743138565378.woff2} +0 -0
- /package/es/{iconfont.1743125694154.ttf → iconfont.1743138565378.ttf} +0 -0
- /package/es/{iconfont.1743125694154.woff → iconfont.1743138565378.woff} +0 -0
- /package/es/{iconfont.1743125694154.woff2 → iconfont.1743138565378.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1743125694154.ttf → iconfont.1743138565378.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1743125694154.woff → iconfont.1743138565378.woff} +0 -0
- /package/lib/icon/style/{iconfont.1743125694154.woff2 → iconfont.1743138565378.woff2} +0 -0
- /package/lib/{iconfont.1743125694154.ttf → iconfont.1743138565378.ttf} +0 -0
- /package/lib/{iconfont.1743125694154.woff → iconfont.1743138565378.woff} +0 -0
- /package/lib/{iconfont.1743125694154.woff2 → iconfont.1743138565378.woff2} +0 -0
package/lib/split/src/split.js
CHANGED
|
@@ -9,6 +9,7 @@ var _ui = require("../../ui");
|
|
|
9
9
|
var _vn = require("../../ui/src/vn");
|
|
10
10
|
var _dom = require("../../ui/src/dom");
|
|
11
11
|
var _utils = require("../../ui/src/utils");
|
|
12
|
+
var _log = require("../../ui/src/log");
|
|
12
13
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
var _default = exports.default = (0, _vue.defineComponent)({
|
|
@@ -28,11 +29,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
28
29
|
type: Boolean,
|
|
29
30
|
default: () => (0, _ui.getConfig)().split.padding
|
|
30
31
|
},
|
|
32
|
+
items: Array,
|
|
31
33
|
itemConfig: Object,
|
|
32
34
|
barConfig: Object,
|
|
33
35
|
actionConfig: Object
|
|
34
36
|
},
|
|
35
|
-
emits: ['action-dblclick', 'action-click', 'resize-start', 'resize-drag', 'resize-end'],
|
|
37
|
+
emits: ['action-dblclick', 'action-click', 'toggle-expand', 'resize-start', 'resize-drag', 'resize-end'],
|
|
36
38
|
setup(props, context) {
|
|
37
39
|
const {
|
|
38
40
|
emit,
|
|
@@ -41,7 +43,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
41
43
|
const xID = _xeUtils.default.uniqueId();
|
|
42
44
|
const refElem = (0, _vue.ref)();
|
|
43
45
|
const reactData = (0, _vue.reactive)({
|
|
44
|
-
staticItems: []
|
|
46
|
+
staticItems: [],
|
|
47
|
+
itemList: []
|
|
45
48
|
});
|
|
46
49
|
const internalData = {};
|
|
47
50
|
const computeItemOpts = (0, _vue.computed)(() => {
|
|
@@ -142,9 +145,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
142
145
|
};
|
|
143
146
|
const reset = () => {
|
|
144
147
|
const {
|
|
145
|
-
|
|
148
|
+
itemList
|
|
146
149
|
} = reactData;
|
|
147
|
-
|
|
150
|
+
itemList.forEach(item => {
|
|
148
151
|
item.isExpand = true;
|
|
149
152
|
item.isVisible = true;
|
|
150
153
|
item.foldHeight = 0;
|
|
@@ -154,13 +157,52 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
154
157
|
});
|
|
155
158
|
return (0, _vue.nextTick)();
|
|
156
159
|
};
|
|
160
|
+
const handleLoadItem = (list, isReset) => {
|
|
161
|
+
const {
|
|
162
|
+
staticItems
|
|
163
|
+
} = reactData;
|
|
164
|
+
const itemDef = {
|
|
165
|
+
isVisible: true,
|
|
166
|
+
isExpand: true,
|
|
167
|
+
renderWidth: 0,
|
|
168
|
+
resizeWidth: 0,
|
|
169
|
+
foldWidth: 0,
|
|
170
|
+
renderHeight: 0,
|
|
171
|
+
resizeHeight: 0,
|
|
172
|
+
foldHeight: 0
|
|
173
|
+
};
|
|
174
|
+
reactData.itemList = list.map(item => {
|
|
175
|
+
if (item.slots) {
|
|
176
|
+
_xeUtils.default.each(item.slots, func => {
|
|
177
|
+
if (!_xeUtils.default.isFunction(func)) {
|
|
178
|
+
if (!slots[func]) {
|
|
179
|
+
(0, _log.errLog)('vxe.error.notSlot', [func]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return Object.assign({}, isReset ? null : itemDef, item, isReset ? itemDef : null, {
|
|
185
|
+
id: _xeUtils.default.uniqueId()
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
if (staticItems.length) {
|
|
189
|
+
(0, _log.errLog)('vxe.error.errConflicts', ['<vxe-split-item ...>', 'items']);
|
|
190
|
+
}
|
|
191
|
+
return recalculate();
|
|
192
|
+
};
|
|
193
|
+
const loadItem = list => {
|
|
194
|
+
return handleLoadItem(list || [], false);
|
|
195
|
+
};
|
|
196
|
+
const reloadItem = list => {
|
|
197
|
+
return handleLoadItem(list || [], true);
|
|
198
|
+
};
|
|
157
199
|
const recalculate = () => {
|
|
158
200
|
return (0, _vue.nextTick)().then(() => {
|
|
159
201
|
const {
|
|
160
202
|
vertical
|
|
161
203
|
} = props;
|
|
162
204
|
const {
|
|
163
|
-
|
|
205
|
+
itemList
|
|
164
206
|
} = reactData;
|
|
165
207
|
const el = refElem.value;
|
|
166
208
|
if (!el) {
|
|
@@ -177,7 +219,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
177
219
|
const residueItems = [];
|
|
178
220
|
if (vertical) {
|
|
179
221
|
let countHeight = 0;
|
|
180
|
-
|
|
222
|
+
itemList.forEach(item => {
|
|
181
223
|
const {
|
|
182
224
|
height
|
|
183
225
|
} = item;
|
|
@@ -202,7 +244,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
202
244
|
}
|
|
203
245
|
} else {
|
|
204
246
|
let countWidth = 0;
|
|
205
|
-
|
|
247
|
+
itemList.forEach(item => {
|
|
206
248
|
const {
|
|
207
249
|
width
|
|
208
250
|
} = item;
|
|
@@ -234,7 +276,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
234
276
|
vertical
|
|
235
277
|
} = props;
|
|
236
278
|
const {
|
|
237
|
-
|
|
279
|
+
itemList
|
|
238
280
|
} = reactData;
|
|
239
281
|
const barEl = evnt.currentTarget;
|
|
240
282
|
const handleEl = barEl.parentElement;
|
|
@@ -243,8 +285,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
243
285
|
return;
|
|
244
286
|
}
|
|
245
287
|
const itemId = handleEl.getAttribute('itemid');
|
|
246
|
-
const itemIndex = _xeUtils.default.findIndexOf(
|
|
247
|
-
const item =
|
|
288
|
+
const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
|
|
289
|
+
const item = itemList[itemIndex];
|
|
248
290
|
if (!item) {
|
|
249
291
|
return;
|
|
250
292
|
}
|
|
@@ -255,7 +297,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
255
297
|
const itemOpts = computeItemOpts.value;
|
|
256
298
|
const allMinWidth = _xeUtils.default.toNumber(itemOpts.minWidth);
|
|
257
299
|
const allMinHeight = _xeUtils.default.toNumber(itemOpts.minHeight);
|
|
258
|
-
const targetItem =
|
|
300
|
+
const targetItem = itemList[itemIndex + (isFoldNext ? 1 : -1)];
|
|
259
301
|
const targetItemEl = targetItem ? el.querySelector(`.vxe-split-item[itemid="${targetItem.id}"]`) : null;
|
|
260
302
|
const currItemEl = item ? el.querySelector(`.vxe-split-item[itemid="${item.id}"]`) : null;
|
|
261
303
|
const targetWidth = targetItemEl ? targetItemEl.clientWidth : 0;
|
|
@@ -369,15 +411,15 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
369
411
|
vertical
|
|
370
412
|
} = props;
|
|
371
413
|
const {
|
|
372
|
-
|
|
414
|
+
itemList
|
|
373
415
|
} = reactData;
|
|
374
416
|
const isFoldNext = computeIsFoldNext.value;
|
|
375
417
|
const btnEl = evnt.currentTarget;
|
|
376
418
|
const handleEl = btnEl.parentElement;
|
|
377
419
|
const itemId = handleEl.getAttribute('itemid');
|
|
378
|
-
const itemIndex = _xeUtils.default.findIndexOf(
|
|
379
|
-
const item =
|
|
380
|
-
const targetItem =
|
|
420
|
+
const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
|
|
421
|
+
const item = itemList[itemIndex];
|
|
422
|
+
const targetItem = itemList[itemIndex + (isFoldNext ? 1 : -1)];
|
|
381
423
|
if (item) {
|
|
382
424
|
const {
|
|
383
425
|
showAction,
|
|
@@ -401,7 +443,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
401
443
|
item.foldWidth = isExpand ? (targetItem.resizeWidth || targetItem.renderWidth) + (item.resizeWidth || item.renderWidth) : 0;
|
|
402
444
|
}
|
|
403
445
|
}
|
|
404
|
-
dispatchEvent(
|
|
446
|
+
dispatchEvent('toggle-expand', {
|
|
405
447
|
item,
|
|
406
448
|
name: item.name,
|
|
407
449
|
targetItem,
|
|
@@ -412,13 +454,51 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
412
454
|
}
|
|
413
455
|
}
|
|
414
456
|
};
|
|
457
|
+
const handleActionDblclickEvent = evnt => {
|
|
458
|
+
const {
|
|
459
|
+
itemList
|
|
460
|
+
} = reactData;
|
|
461
|
+
const actionOpts = computeActionOpts.value;
|
|
462
|
+
const btnEl = evnt.currentTarget;
|
|
463
|
+
const handleEl = btnEl.parentElement;
|
|
464
|
+
const itemId = handleEl.getAttribute('itemid');
|
|
465
|
+
const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
|
|
466
|
+
const item = itemList[itemIndex];
|
|
467
|
+
if (actionOpts.trigger === 'dblclick') {
|
|
468
|
+
handleItemActionEvent(evnt);
|
|
469
|
+
}
|
|
470
|
+
dispatchEvent('action-dblclick', {
|
|
471
|
+
item,
|
|
472
|
+
name: item ? item.name : ''
|
|
473
|
+
}, evnt);
|
|
474
|
+
};
|
|
475
|
+
const handleActionClickEvent = evnt => {
|
|
476
|
+
const {
|
|
477
|
+
itemList
|
|
478
|
+
} = reactData;
|
|
479
|
+
const actionOpts = computeActionOpts.value;
|
|
480
|
+
const btnEl = evnt.currentTarget;
|
|
481
|
+
const handleEl = btnEl.parentElement;
|
|
482
|
+
const itemId = handleEl.getAttribute('itemid');
|
|
483
|
+
const itemIndex = _xeUtils.default.findIndexOf(itemList, item => item.id === itemId);
|
|
484
|
+
const item = itemList[itemIndex];
|
|
485
|
+
if (actionOpts.trigger !== 'dblclick') {
|
|
486
|
+
handleItemActionEvent(evnt);
|
|
487
|
+
}
|
|
488
|
+
dispatchEvent('action-click', {
|
|
489
|
+
item,
|
|
490
|
+
name: item ? item.name : ''
|
|
491
|
+
}, evnt);
|
|
492
|
+
};
|
|
415
493
|
const handleGlobalResizeEvent = () => {
|
|
416
494
|
recalculate();
|
|
417
495
|
};
|
|
418
496
|
const splitMethods = {
|
|
419
497
|
dispatchEvent,
|
|
420
498
|
recalculate,
|
|
421
|
-
reset
|
|
499
|
+
reset,
|
|
500
|
+
loadItem,
|
|
501
|
+
reloadItem
|
|
422
502
|
};
|
|
423
503
|
const splitPrivateMethods = {};
|
|
424
504
|
Object.assign($xeSplit, splitMethods, splitPrivateMethods);
|
|
@@ -431,12 +511,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
431
511
|
isExpand,
|
|
432
512
|
showAction
|
|
433
513
|
} = item;
|
|
434
|
-
const btnOns = {};
|
|
435
|
-
if (actionOpts.trigger === 'dblclick') {
|
|
436
|
-
btnOns.onDblclick = handleItemActionEvent;
|
|
437
|
-
} else {
|
|
438
|
-
btnOns.onClick = handleItemActionEvent;
|
|
439
|
-
}
|
|
440
514
|
return (0, _vue.h)('div', {
|
|
441
515
|
itemid: id,
|
|
442
516
|
class: ['vxe-split-item-handle', isFoldNext ? 'to--next' : 'to--prev']
|
|
@@ -444,9 +518,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
444
518
|
class: 'vxe-split-item-handle-bar',
|
|
445
519
|
style: barStyle,
|
|
446
520
|
onMousedown: dragEvent
|
|
447
|
-
}), showAction ? (0, _vue.h)('span',
|
|
448
|
-
class: 'vxe-split-item-action-btn'
|
|
449
|
-
|
|
521
|
+
}), showAction ? (0, _vue.h)('span', {
|
|
522
|
+
class: 'vxe-split-item-action-btn',
|
|
523
|
+
onDblclick: handleActionDblclickEvent,
|
|
524
|
+
onClick: handleActionClickEvent
|
|
525
|
+
}, [(0, _vue.h)('i', {
|
|
450
526
|
class: (isExpand ? actionOpts.openIcon : actionOpts.closeIcon) || getDefaultActionIcon(item)
|
|
451
527
|
})]) : (0, _ui.renderEmptyElement)($xeSplit)]);
|
|
452
528
|
};
|
|
@@ -457,13 +533,14 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
457
533
|
vertical
|
|
458
534
|
} = props;
|
|
459
535
|
const {
|
|
460
|
-
|
|
536
|
+
itemList
|
|
461
537
|
} = reactData;
|
|
462
538
|
const isFoldNext = computeIsFoldNext.value;
|
|
463
539
|
const itemVNs = [];
|
|
464
|
-
|
|
540
|
+
itemList.forEach((item, index) => {
|
|
465
541
|
const {
|
|
466
542
|
id,
|
|
543
|
+
name,
|
|
467
544
|
slots,
|
|
468
545
|
renderHeight,
|
|
469
546
|
resizeHeight,
|
|
@@ -505,7 +582,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
505
582
|
class: 'vxe-split-item--wrapper'
|
|
506
583
|
}, [(0, _vue.h)('div', {
|
|
507
584
|
class: 'vxe-split-item--inner'
|
|
508
|
-
}, defaultSlot ? callSlot(defaultSlot, {
|
|
585
|
+
}, defaultSlot ? callSlot(defaultSlot, {
|
|
586
|
+
name,
|
|
587
|
+
isVisible,
|
|
588
|
+
isExpand
|
|
589
|
+
}) : [])]), isFoldNext && index < itemList.length - 1 ? renderHandleBar(item) : (0, _ui.renderEmptyElement)($xeSplit)]));
|
|
509
590
|
});
|
|
510
591
|
return (0, _vue.h)('div', {
|
|
511
592
|
class: 'vxe-split-wrapper'
|
|
@@ -533,7 +614,21 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
533
614
|
class: 'vxe-split-slots'
|
|
534
615
|
}, defaultSlot ? defaultSlot({}) : []), renderItems()]);
|
|
535
616
|
};
|
|
536
|
-
(0, _vue.
|
|
617
|
+
const itemFlag = (0, _vue.ref)(0);
|
|
618
|
+
(0, _vue.watch)(() => props.items ? props.items.length : -1, () => {
|
|
619
|
+
itemFlag.value++;
|
|
620
|
+
});
|
|
621
|
+
(0, _vue.watch)(() => props.items, () => {
|
|
622
|
+
itemFlag.value++;
|
|
623
|
+
});
|
|
624
|
+
(0, _vue.watch)(itemFlag, () => {
|
|
625
|
+
loadItem(props.items || []);
|
|
626
|
+
});
|
|
627
|
+
(0, _vue.watch)(() => reactData.staticItems, val => {
|
|
628
|
+
if (props.items && props.items.length) {
|
|
629
|
+
(0, _log.errLog)('vxe.error.errConflicts', ['<vxe-split-item ...>', 'items']);
|
|
630
|
+
}
|
|
631
|
+
reactData.itemList = val;
|
|
537
632
|
recalculate();
|
|
538
633
|
});
|
|
539
634
|
(0, _vue.onMounted)(() => {
|
|
@@ -548,6 +643,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
548
643
|
(0, _vue.onActivated)(() => {
|
|
549
644
|
recalculate();
|
|
550
645
|
});
|
|
646
|
+
if (props.items) {
|
|
647
|
+
loadItem(props.items);
|
|
648
|
+
}
|
|
551
649
|
(0, _vue.provide)('$xeSplit', $xeSplit);
|
|
552
650
|
$xeSplit.renderVN = renderVN;
|
|
553
651
|
return $xeSplit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_ui=require("../../ui"),_vn=require("../../ui/src/vn"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeSplit",props:{width:[Number,String],height:[Number,String],vertical:{type:Boolean,default:()=>(0,_ui.getConfig)().split.vertical},border:{type:Boolean,default:()=>(0,_ui.getConfig)().split.border},padding:{type:Boolean,default:()=>(0,_ui.getConfig)().split.padding},itemConfig:Object,barConfig:Object,actionConfig:Object},emits:["action-dblclick","action-click","resize-start","resize-drag","resize-end"],setup(z,e){const{emit:s,slots:l}=e;var t=_xeUtils.default.uniqueId();const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_ui=require("../../ui"),_vn=require("../../ui/src/vn"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_log=require("../../ui/src/log"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeSplit",props:{width:[Number,String],height:[Number,String],vertical:{type:Boolean,default:()=>(0,_ui.getConfig)().split.vertical},border:{type:Boolean,default:()=>(0,_ui.getConfig)().split.border},padding:{type:Boolean,default:()=>(0,_ui.getConfig)().split.padding},items:Array,itemConfig:Object,barConfig:Object,actionConfig:Object},emits:["action-dblclick","action-click","toggle-expand","resize-start","resize-drag","resize-end"],setup(z,e){const{emit:s,slots:l}=e;var t=_xeUtils.default.uniqueId();const H=(0,_vue.ref)(),C=(0,_vue.reactive)({staticItems:[],itemList:[]});const W=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().split.itemConfig,z.itemConfig)),r=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().split.barConfig,z.barConfig)),a=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().split.actionConfig,z.actionConfig)),E=(0,_vue.computed)(()=>{return"next"===a.value.direction}),o=(0,_vue.computed)(()=>{var{width:e,height:t}=r.value,i={};return t&&(i.height=(0,_dom.toCssUnit)(t)),e&&(i.width=(0,_dom.toCssUnit)(e)),i}),i={computeItemOpts:W,computeBarOpts:r,computeActionOpts:a,computeIsFoldNext:E},n={refElem:H},b={xID:t,props:z,context:e,reactData:C,internalData:{},getRefMaps:()=>n,getComputeMaps:()=>i},U=(e,t,i)=>{s(e,(0,_ui.createEvent)(i,{$split:b},t))},I=(e,t)=>e&&(_xeUtils.default.isString(e)&&(e=l[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e(t)):[];const d=(e,t)=>{var i=C["staticItems"];const s={isVisible:!0,isExpand:!0,renderWidth:0,resizeWidth:0,foldWidth:0,renderHeight:0,resizeHeight:0,foldHeight:0};return C.itemList=e.map(e=>(e.slots&&_xeUtils.default.each(e.slots,e=>{_xeUtils.default.isFunction(e)||l[e]||(0,_log.errLog)("vxe.error.notSlot",[e])}),Object.assign({},t?null:s,e,t?s:null,{id:_xeUtils.default.uniqueId()}))),i.length&&(0,_log.errLog)("vxe.error.errConflicts",["<vxe-split-item ...>","items"]),N()},u=e=>d(e||[],!1);const N=()=>(0,_vue.nextTick)().then(()=>{var e=z["vertical"],t=C["itemList"],i=H.value;if(i){const r=i.clientWidth,l=i.clientHeight;if(r&&l){i=W.value;const n=_xeUtils.default.toNumber(i.minWidth),a=_xeUtils.default.toNumber(i.minHeight),o=[];if(e){let s=0;if(t.forEach(e=>{var t=e["height"];let i=0;t?(i=(0,_dom.isScale)(t)?l*_xeUtils.default.toNumber(t):_xeUtils.default.toNumber(t),e.renderHeight=i):o.push(e),s+=i}),o.length){const d=(l-s)/o.length;o.forEach(e=>{e.renderHeight=Math.max(_xeUtils.default.toNumber((0,_utils.getGlobalDefaultConfig)(e.minHeight,a)),d)})}}else{let s=0;if(t.forEach(e=>{var t=e["width"];let i=0;t?(i=(0,_dom.isScale)(t)?r*_xeUtils.default.toNumber(t):_xeUtils.default.toNumber(t),e.renderWidth=i):o.push(e),s+=i}),o.length){const u=(r-s)/o.length;o.forEach(e=>{e.renderWidth=Math.max(_xeUtils.default.toNumber((0,_utils.getGlobalDefaultConfig)(e.minWidth,n)),u)})}}}}}),m=e=>{e.preventDefault();const s=z["vertical"];var t=C["itemList"],i=e.currentTarget.parentElement;const r=H.value;if(r){const a=i.getAttribute("itemid");i=_xeUtils.default.findIndexOf(t,e=>e.id===a);const o=t[i];if(o&&o.isExpand){const d=E.value;var l=W.value,n=_xeUtils.default.toNumber(l.minWidth),l=_xeUtils.default.toNumber(l.minHeight);const u=t[i+(d?1:-1)];t=u?r.querySelector(`.vxe-split-item[itemid="${u.id}"]`):null,i=o?r.querySelector(`.vxe-split-item[itemid="${o.id}"]`):null;const m=t?t.clientWidth:0,c=i?i.clientWidth:0,h=t?t.clientHeight:0,g=i?i.clientHeight:0,f=_xeUtils.default.toNumber(u?(0,_utils.getGlobalDefaultConfig)(u.minWidth,n):n),v=_xeUtils.default.toNumber((0,_utils.getGlobalDefaultConfig)(o.minWidth,n)),_=_xeUtils.default.toNumber(u?(0,_utils.getGlobalDefaultConfig)(u.minHeight,l):l),p=_xeUtils.default.toNumber((0,_utils.getGlobalDefaultConfig)(o.minHeight,l)),x=e.clientX,b=e.clientY;(0,_dom.addClass)(r,"is--drag"),document.onmousemove=e=>{var t,i;e.preventDefault(),s?0<(t=d?b-e.clientY:e.clientY-b)?u&&g-t>=p&&(i=g-t,u.resizeHeight=h+t,o.resizeHeight=i,U("resize-drag",{item:o,name:o.name,offsetHeight:t,resizeHeight:i,offsetWidth:0,resizeWidth:0},e)):u&&h+t>=_&&(i=g-t,u.resizeHeight=h+t,o.resizeHeight=i,U("resize-drag",{item:o,name:o.name,offsetHeight:t,resizeHeight:i,offsetWidth:0,resizeWidth:0},e)):0<(t=d?x-e.clientX:e.clientX-x)?u&&c-t>=v&&(i=c-t,u.resizeWidth=m+t,o.resizeWidth=i,U("resize-drag",{item:o,name:o.name,offsetHeight:0,resizeHeight:0,offsetWidth:t,resizeWidth:i},e)):u&&m+t>=f&&(i=c-t,u.resizeWidth=m+t,o.resizeWidth=i,U("resize-drag",{item:o,name:o.name,offsetHeight:0,resizeHeight:0,offsetWidth:t,resizeWidth:i},e))},document.onmouseup=e=>{document.onmousemove=null,(document.onmouseup=null,_dom.removeClass)(r,"is--drag"),U("resize-end",{item:o,name:o.name,resizeHeight:o.resizeHeight,resizeWidth:o.resizeWidth},e),N()},U("resize-start",{item:o,name:o.name},e)}}},c=e=>{if(H.value){var t=z["vertical"],i=C["itemList"],s=E.value;const n=e.currentTarget.parentElement.getAttribute("itemid");var r=_xeUtils.default.findIndexOf(i,e=>e.id===n),l=i[r],i=i[r+(s?1:-1)];l&&({showAction:r,isExpand:s}=l,r)&&(t?i&&(i.isVisible=!s,i.foldHeight=0,l.isExpand=!s,l.isVisible=!0,l.foldHeight=s?(i.resizeHeight||i.renderHeight)+(l.resizeHeight||l.renderHeight):0):i&&(i.isVisible=!s,i.foldWidth=0,l.isExpand=!s,l.isVisible=!0,l.foldWidth=s?(i.resizeWidth||i.renderWidth)+(l.resizeWidth||l.renderWidth):0),U("toggle-expand",{item:l,name:l.name,targetItem:i,targetName:i?i.name:"",expanded:l.isExpand},e),N())}},h=e=>{var t=C["itemList"],i=a.value;const s=e.currentTarget.parentElement.getAttribute("itemid");t=t[_xeUtils.default.findIndexOf(t,e=>e.id===s)];"dblclick"===i.trigger&&c(e),U("action-dblclick",{item:t,name:t?t.name:""},e)},g=e=>{var t=C["itemList"],i=a.value;const s=e.currentTarget.parentElement.getAttribute("itemid");t=t[_xeUtils.default.findIndexOf(t,e=>e.id===s)];"dblclick"!==i.trigger&&c(e),U("action-click",{item:t,name:t?t.name:""},e)},f=()=>{N()};t={dispatchEvent:U,recalculate:N,reset:()=>{var e=C["itemList"];return e.forEach(e=>{e.isExpand=!0,e.isVisible=!0,e.foldHeight=0,e.foldWidth=0,e.resizeHeight=0,e.resizeWidth=0}),(0,_vue.nextTick)()},loadItem:u,reloadItem:e=>d(e||[],!0)};Object.assign(b,t,{});const O=e=>{var t=o.value,i=a.value,s=E.value,{id:r,isExpand:l,showAction:n}=e;return(0,_vue.h)("div",{itemid:r,class:["vxe-split-item-handle",s?"to--next":"to--prev"]},[(0,_vue.h)("div",{class:"vxe-split-item-handle-bar",style:t,onMousedown:m}),n?(0,_vue.h)("span",{class:"vxe-split-item-action-btn",onDblclick:h,onClick:g},[(0,_vue.h)("i",{class:(l?i.openIcon:i.closeIcon)||(e=>{var t=z["vertical"],{showAction:e,isExpand:i}=e,s=E.value,r="SPLIT_TOP_ACTION",l="SPLIT_BOTTOM_ACTION",n="SPLIT_LEFT_ACTION",a="SPLIT_RIGHT_ACTION";if(e){let e="";if(e=s?t?i?l:r:i?a:n:t?i?r:l:i?n:a)return(0,_ui.getIcon)()[e]}return""})(e)})]):(0,_ui.renderEmptyElement)(b)])};const v=(0,_vue.ref)(0);return(0,_vue.watch)(()=>z.items?z.items.length:-1,()=>{v.value++}),(0,_vue.watch)(()=>z.items,()=>{v.value++}),(0,_vue.watch)(v,()=>{u(z.items||[])}),(0,_vue.watch)(()=>C.staticItems,e=>{z.items&&z.items.length&&(0,_log.errLog)("vxe.error.errConflicts",["<vxe-split-item ...>","items"]),C.itemList=e,N()}),(0,_vue.onMounted)(()=>{(0,_vue.nextTick)(()=>{N()}),_ui.globalEvents.on(b,"resize",f)}),(0,_vue.onUnmounted)(()=>{_ui.globalEvents.off(b,"resize")}),(0,_vue.onActivated)(()=>{N()}),z.items&&u(z.items),(0,_vue.provide)("$xeSplit",b),b.renderVN=()=>{var{vertical:e,width:t,height:i}=z,s=l.default,r={};return i&&(r.height=(0,_dom.toCssUnit)(i)),t&&(r.width=(0,_dom.toCssUnit)(t)),(0,_vue.h)("div",{ref:H,class:["vxe-split",e?"is--vertical":"is--horizontal"],style:r},[(0,_vue.h)("div",{class:"vxe-split-slots"},s?s({}):[]),(()=>{const{border:g,padding:f,vertical:v}=z,_=C["itemList"],p=E.value,x=[];return _.forEach((e,t)=>{var{id:i,name:s,slots:r,renderHeight:l,resizeHeight:n,foldHeight:a,renderWidth:o,resizeWidth:d,foldWidth:u,isVisible:m,isExpand:c}=e,r=r?r.default:null,h={},u=m?u||d||o:0,d=m?a||n||l:0;v?d&&(h.height=(0,_dom.toCssUnit)(d)):u&&(h.width=(0,_dom.toCssUnit)(u)),x.push((0,_vue.h)("div",{itemid:i,class:["vxe-split-item",v?"is--vertical":"is--horizontal",{"is--padding":f,"is--border":g,"is--height":d,"is--width":u,"is--fill":m&&!d&&!u,"is--handle":0<t,"is--expand":c,"is--hidden":!m}],style:h},[t&&!p?O(e):(0,_ui.renderEmptyElement)(b),(0,_vue.h)("div",{itemid:i,class:"vxe-split-item--wrapper"},[(0,_vue.h)("div",{class:"vxe-split-item--inner"},r?I(r,{name:s,isVisible:m,isExpand:c}):[])]),p&&t<_.length-1?O(e):(0,_ui.renderEmptyElement)(b)]))}),(0,_vue.h)("div",{class:"vxe-split-wrapper"},x)})()])},b},render(){return this.renderVN()}});
|