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
|
@@ -5,7 +5,7 @@ import { getConfig, getIcon, createEvent, globalEvents, globalMixins, globalResi
|
|
|
5
5
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
6
6
|
import { toCssUnit, isScale, addClass, removeClass } from '../../ui/src/dom'
|
|
7
7
|
import { getGlobalDefaultConfig } from '../../ui/src/utils'
|
|
8
|
-
import { errLog } from '../../ui/src/log'
|
|
8
|
+
import { warnLog, errLog } from '../../ui/src/log'
|
|
9
9
|
|
|
10
10
|
import type { SplitReactData, VxeSplitPropTypes, VxeComponentSizeType, SplitInternalData, VxeSplitEmits, ValueOf, VxeSplitPaneProps, VxeSplitDefines } from '../../../types'
|
|
11
11
|
|
|
@@ -43,7 +43,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
43
43
|
const xID = XEUtils.uniqueId()
|
|
44
44
|
const reactData: SplitReactData = {
|
|
45
45
|
staticItems: [],
|
|
46
|
-
itemList: []
|
|
46
|
+
itemList: [],
|
|
47
|
+
barWidth: 0,
|
|
48
|
+
barHeight: 0
|
|
47
49
|
}
|
|
48
50
|
const internalData: SplitInternalData = {
|
|
49
51
|
wrapperWidth: 0,
|
|
@@ -100,7 +102,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
100
102
|
const $xeSplit = this
|
|
101
103
|
const reactData = $xeSplit.reactData as SplitReactData
|
|
102
104
|
|
|
103
|
-
return reactData.itemList.filter(item => item.
|
|
105
|
+
return reactData.itemList.filter(item => item.isExpand)
|
|
104
106
|
},
|
|
105
107
|
computeAutoItems () {
|
|
106
108
|
const $xeSplit = this
|
|
@@ -156,10 +158,20 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
156
158
|
const props = $xeSplit
|
|
157
159
|
const reactData = $xeSplit.reactData
|
|
158
160
|
|
|
161
|
+
const actionOpts = $xeSplit.computeActionOpts
|
|
162
|
+
const { showPrevButton, showNextButton } = actionOpts
|
|
159
163
|
if (props.items && props.items.length) {
|
|
160
164
|
errLog('vxe.error.errConflicts', ['<vxe-split-pane ...>', 'items'])
|
|
161
165
|
}
|
|
162
|
-
reactData.itemList = reactData.staticItems
|
|
166
|
+
reactData.itemList = reactData.staticItems || []
|
|
167
|
+
if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
|
|
168
|
+
errLog('vxe.error.modelConflicts', ['action-config.showPrevButton | action-config.showNextButton', '<vxe-split-pane ...> Only supports 2 panel'])
|
|
169
|
+
}
|
|
170
|
+
reactData.itemList.forEach(item => {
|
|
171
|
+
if (item.showAction) {
|
|
172
|
+
warnLog('vxe.error.removeProp', ['showAction'])
|
|
173
|
+
}
|
|
174
|
+
})
|
|
163
175
|
$xeSplit.recalculate()
|
|
164
176
|
}
|
|
165
177
|
},
|
|
@@ -192,7 +204,6 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
192
204
|
const { itemList } = reactData
|
|
193
205
|
itemList.forEach(item => {
|
|
194
206
|
item.isExpand = true
|
|
195
|
-
item.isVisible = true
|
|
196
207
|
item.foldHeight = 0
|
|
197
208
|
item.foldWidth = 0
|
|
198
209
|
item.resizeHeight = 0
|
|
@@ -207,7 +218,6 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
207
218
|
|
|
208
219
|
const { staticItems } = reactData
|
|
209
220
|
const itemDef = {
|
|
210
|
-
isVisible: true,
|
|
211
221
|
isExpand: true,
|
|
212
222
|
renderWidth: 0,
|
|
213
223
|
resizeWidth: 0,
|
|
@@ -255,6 +265,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
255
265
|
const { vertical } = props
|
|
256
266
|
const { itemList } = reactData
|
|
257
267
|
const el = $xeSplit.$refs.refElem as HTMLDivElement
|
|
268
|
+
const barInfoElem = $xeSplit.$refs.refBarInfoElem as HTMLDivElement
|
|
258
269
|
if (!el) {
|
|
259
270
|
return
|
|
260
271
|
}
|
|
@@ -263,6 +274,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
263
274
|
if (!wWidth || !wHeight) {
|
|
264
275
|
return
|
|
265
276
|
}
|
|
277
|
+
if (barInfoElem) {
|
|
278
|
+
reactData.barWidth = barInfoElem.offsetWidth
|
|
279
|
+
reactData.barHeight = barInfoElem.offsetHeight
|
|
280
|
+
}
|
|
281
|
+
const contentWidth = wWidth - (vertical ? 0 : reactData.barWidth * (itemList.length - 1))
|
|
282
|
+
const contentHeight = wHeight - (vertical ? reactData.barHeight * (itemList.length - 1) : 0)
|
|
266
283
|
const itemOpts = $xeSplit.computeItemOpts
|
|
267
284
|
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth)
|
|
268
285
|
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight)
|
|
@@ -274,7 +291,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
274
291
|
let itemHeight = 0
|
|
275
292
|
if (height) {
|
|
276
293
|
if (isScale(height)) {
|
|
277
|
-
itemHeight =
|
|
294
|
+
itemHeight = contentHeight * XEUtils.toNumber(height) / 100
|
|
278
295
|
} else {
|
|
279
296
|
itemHeight = XEUtils.toNumber(height)
|
|
280
297
|
}
|
|
@@ -285,7 +302,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
285
302
|
countHeight += itemHeight
|
|
286
303
|
})
|
|
287
304
|
if (residueItems.length) {
|
|
288
|
-
const reMeanHeight = (
|
|
305
|
+
const reMeanHeight = (contentHeight - countHeight) / residueItems.length
|
|
289
306
|
residueItems.forEach(item => {
|
|
290
307
|
item.renderHeight = Math.max(XEUtils.toNumber(getGlobalDefaultConfig(item.minHeight, allMinHeight)), reMeanHeight)
|
|
291
308
|
})
|
|
@@ -297,7 +314,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
297
314
|
let itemWidth = 0
|
|
298
315
|
if (width) {
|
|
299
316
|
if (isScale(width)) {
|
|
300
|
-
itemWidth =
|
|
317
|
+
itemWidth = contentWidth * XEUtils.toNumber(width) / 100
|
|
301
318
|
} else {
|
|
302
319
|
itemWidth = XEUtils.toNumber(width)
|
|
303
320
|
}
|
|
@@ -308,14 +325,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
308
325
|
countWidth += itemWidth
|
|
309
326
|
})
|
|
310
327
|
if (residueItems.length) {
|
|
311
|
-
const reMeanWidth = (
|
|
328
|
+
const reMeanWidth = (contentWidth - countWidth) / residueItems.length
|
|
312
329
|
residueItems.forEach(item => {
|
|
313
330
|
item.renderWidth = Math.max(XEUtils.toNumber(getGlobalDefaultConfig(item.minWidth, allMinWidth)), reMeanWidth)
|
|
314
331
|
})
|
|
315
332
|
}
|
|
316
333
|
}
|
|
317
|
-
internalData.wrapperWidth =
|
|
318
|
-
internalData.wrapperHeight =
|
|
334
|
+
internalData.wrapperWidth = contentWidth
|
|
335
|
+
internalData.wrapperHeight = contentHeight
|
|
319
336
|
})
|
|
320
337
|
},
|
|
321
338
|
dragEvent (evnt: MouseEvent) {
|
|
@@ -335,36 +352,28 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
335
352
|
if (!el) {
|
|
336
353
|
return
|
|
337
354
|
}
|
|
338
|
-
const
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
if (!item) {
|
|
355
|
+
const prevEl = handleEl.previousElementSibling as HTMLDivElement
|
|
356
|
+
const nextEl = handleEl.nextElementSibling as HTMLDivElement
|
|
357
|
+
if (!prevEl || !nextEl) {
|
|
342
358
|
return
|
|
343
359
|
}
|
|
344
|
-
|
|
360
|
+
const prevId = prevEl.getAttribute('itemid')
|
|
361
|
+
const nextId = nextEl.getAttribute('itemid')
|
|
362
|
+
const prevItem = itemList.find(item => item.id === prevId)
|
|
363
|
+
const nextItem = itemList.find(item => item.id === nextId)
|
|
364
|
+
if (!prevItem || !nextItem) {
|
|
345
365
|
return
|
|
346
366
|
}
|
|
347
367
|
const containerRect = el.getBoundingClientRect()
|
|
348
368
|
const barRect = barEl.getBoundingClientRect()
|
|
349
369
|
const rsSplitLineEl = $xeSplit.$refs.refResizableSplitTip as HTMLDivElement
|
|
350
370
|
const rsSplitTipEl = rsSplitLineEl ? rsSplitLineEl.children[0] as HTMLDivElement : null
|
|
351
|
-
const isFoldNext = $xeSplit.computeIsFoldNext
|
|
352
371
|
const itemOpts = $xeSplit.computeItemOpts
|
|
353
372
|
const resizeOpts = $xeSplit.computeResizeOpts
|
|
354
373
|
const { immediate } = resizeOpts
|
|
355
374
|
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth)
|
|
356
375
|
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight)
|
|
357
376
|
|
|
358
|
-
const targetItem = itemList[itemIndex + (isFoldNext ? 1 : -1)]
|
|
359
|
-
|
|
360
|
-
const prevItem = itemList[itemIndex + (isFoldNext ? 0 : -1)]
|
|
361
|
-
const nextItem = itemList[itemIndex + (isFoldNext ? 1 : 0)]
|
|
362
|
-
const prevEl = targetItem ? el.querySelector<HTMLDivElement>(`.vxe-split-pane[itemid="${prevItem.id}"]`) : null
|
|
363
|
-
const nextEl = item ? el.querySelector<HTMLDivElement>(`.vxe-split-pane[itemid="${nextItem.id}"]`) : null
|
|
364
|
-
if (!prevEl || !nextEl) {
|
|
365
|
-
return
|
|
366
|
-
}
|
|
367
|
-
|
|
368
377
|
const barOffsetX = Math.ceil(barRect.width - (evnt.clientX - barRect.left))
|
|
369
378
|
const barOffsetY = Math.ceil(evnt.clientY - barRect.top)
|
|
370
379
|
|
|
@@ -505,7 +514,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
505
514
|
if (rsSplitLineEl) {
|
|
506
515
|
handleReStyle(evnt)
|
|
507
516
|
}
|
|
508
|
-
$xeSplit.dispatchEvent('resize-drag', {
|
|
517
|
+
$xeSplit.dispatchEvent('resize-drag', { prevItem, nextItem, offsetHeight: targetOffsetHeight, offsetWidth: targetOffsetWidth }, evnt)
|
|
509
518
|
}
|
|
510
519
|
|
|
511
520
|
document.onmousemove = (evnt) => {
|
|
@@ -520,7 +529,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
520
529
|
}
|
|
521
530
|
handleUpdate()
|
|
522
531
|
removeClass(el, 'is--drag')
|
|
523
|
-
$xeSplit.dispatchEvent('resize-end', {
|
|
532
|
+
$xeSplit.dispatchEvent('resize-end', { prevItem, nextItem, offsetHeight: targetOffsetHeight, offsetWidth: targetOffsetWidth }, evnt)
|
|
524
533
|
$xeSplit.recalculate()
|
|
525
534
|
}
|
|
526
535
|
|
|
@@ -530,148 +539,197 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
530
539
|
}
|
|
531
540
|
handleDrag(evnt)
|
|
532
541
|
addClass(el, 'is--drag')
|
|
533
|
-
$xeSplit.dispatchEvent('resize-start', {
|
|
542
|
+
$xeSplit.dispatchEvent('resize-start', { prevItem, nextItem }, evnt)
|
|
534
543
|
},
|
|
535
|
-
handleItemActionEvent (evnt: MouseEvent) {
|
|
544
|
+
handleItemActionEvent (evnt: MouseEvent, prevItem: VxeSplitDefines.PaneConfig, nextItem: VxeSplitDefines.PaneConfig, isNext: boolean) {
|
|
536
545
|
const $xeSplit = this
|
|
537
546
|
const props = $xeSplit
|
|
547
|
+
|
|
548
|
+
const { vertical } = props
|
|
549
|
+
let expanded = false
|
|
550
|
+
let item = prevItem
|
|
551
|
+
if (isNext) {
|
|
552
|
+
item = nextItem
|
|
553
|
+
expanded = !nextItem.isExpand
|
|
554
|
+
nextItem.isExpand = expanded
|
|
555
|
+
} else {
|
|
556
|
+
expanded = !prevItem.isExpand
|
|
557
|
+
prevItem.isExpand = expanded
|
|
558
|
+
}
|
|
559
|
+
if (vertical) {
|
|
560
|
+
if (prevItem.isExpand && nextItem.isExpand) {
|
|
561
|
+
prevItem.foldHeight = 0
|
|
562
|
+
nextItem.foldHeight = 0
|
|
563
|
+
} else if (prevItem.isExpand) {
|
|
564
|
+
nextItem.foldHeight = 0
|
|
565
|
+
prevItem.foldHeight = (prevItem.resizeHeight || prevItem.renderHeight) + (nextItem.resizeHeight || nextItem.renderHeight)
|
|
566
|
+
} else {
|
|
567
|
+
prevItem.foldHeight = 0
|
|
568
|
+
nextItem.foldHeight = (prevItem.resizeHeight || prevItem.renderHeight) + (nextItem.resizeHeight || nextItem.renderHeight)
|
|
569
|
+
}
|
|
570
|
+
} else {
|
|
571
|
+
if (prevItem.isExpand && nextItem.isExpand) {
|
|
572
|
+
prevItem.foldWidth = 0
|
|
573
|
+
nextItem.foldWidth = 0
|
|
574
|
+
} else if (prevItem.isExpand) {
|
|
575
|
+
nextItem.foldWidth = 0
|
|
576
|
+
prevItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth)
|
|
577
|
+
} else {
|
|
578
|
+
prevItem.foldWidth = 0
|
|
579
|
+
nextItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth)
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
$xeSplit.dispatchEvent('toggle-expand', { prevItem, nextItem, expanded, item }, evnt)
|
|
583
|
+
$xeSplit.recalculate()
|
|
584
|
+
},
|
|
585
|
+
handlePrevActionDblclickEvent (evnt: MouseEvent) {
|
|
586
|
+
const $xeSplit = this
|
|
538
587
|
const reactData = $xeSplit.reactData
|
|
539
588
|
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
589
|
+
const { itemList } = reactData
|
|
590
|
+
const actionOpts = $xeSplit.computeActionOpts
|
|
591
|
+
const btnEl = evnt.currentTarget as HTMLDivElement
|
|
592
|
+
const btnWrapperEl = btnEl.parentElement as HTMLDivElement
|
|
593
|
+
const handleEl = btnWrapperEl.parentElement as HTMLDivElement
|
|
594
|
+
const prevEl = handleEl.previousElementSibling as HTMLDivElement
|
|
595
|
+
const prevId = prevEl.getAttribute('itemid')
|
|
596
|
+
const prevItem = itemList.find(item => item.id === prevId)
|
|
597
|
+
const nextEl = handleEl.nextElementSibling as HTMLDivElement
|
|
598
|
+
const nextId = nextEl.getAttribute('itemid')
|
|
599
|
+
const nextItem = itemList.find(item => item.id === nextId)
|
|
600
|
+
|
|
601
|
+
if (actionOpts.trigger === 'dblclick') {
|
|
602
|
+
if (prevItem && nextItem && nextItem.isExpand) {
|
|
603
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, false)
|
|
604
|
+
}
|
|
543
605
|
}
|
|
544
|
-
|
|
606
|
+
$xeSplit.dispatchEvent('action-dblclick', { prevItem, nextItem }, evnt)
|
|
607
|
+
},
|
|
608
|
+
handlePrevActionClickEvent (evnt: MouseEvent) {
|
|
609
|
+
const $xeSplit = this
|
|
610
|
+
const reactData = $xeSplit.reactData
|
|
611
|
+
|
|
545
612
|
const { itemList } = reactData
|
|
546
|
-
const
|
|
613
|
+
const actionOpts = $xeSplit.computeActionOpts
|
|
547
614
|
const btnEl = evnt.currentTarget as HTMLDivElement
|
|
548
|
-
const
|
|
549
|
-
const
|
|
550
|
-
const
|
|
551
|
-
const
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
item.isExpand = !isExpand
|
|
561
|
-
item.isVisible = true
|
|
562
|
-
item.foldHeight = isExpand ? (targetItem.resizeHeight || targetItem.renderHeight) + (item.resizeHeight || item.renderHeight) : 0
|
|
563
|
-
}
|
|
564
|
-
} else {
|
|
565
|
-
if (targetItem) {
|
|
566
|
-
targetItem.isVisible = !isExpand
|
|
567
|
-
targetItem.foldWidth = 0
|
|
568
|
-
item.isExpand = !isExpand
|
|
569
|
-
item.isVisible = true
|
|
570
|
-
item.foldWidth = isExpand ? (targetItem.resizeWidth || targetItem.renderWidth) + (item.resizeWidth || item.renderWidth) : 0
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
$xeSplit.dispatchEvent('toggle-expand', { item, name: item.name, targetItem, targetName: targetItem ? targetItem.name : '', expanded: item.isExpand }, evnt)
|
|
574
|
-
$xeSplit.recalculate()
|
|
615
|
+
const btnWrapperEl = btnEl.parentElement as HTMLDivElement
|
|
616
|
+
const handleEl = btnWrapperEl.parentElement as HTMLDivElement
|
|
617
|
+
const prevEl = handleEl.previousElementSibling as HTMLDivElement
|
|
618
|
+
const prevId = prevEl.getAttribute('itemid')
|
|
619
|
+
const prevItem = itemList.find(item => item.id === prevId)
|
|
620
|
+
const nextEl = handleEl.nextElementSibling as HTMLDivElement
|
|
621
|
+
const nextId = nextEl.getAttribute('itemid')
|
|
622
|
+
const nextItem = itemList.find(item => item.id === nextId)
|
|
623
|
+
|
|
624
|
+
if (actionOpts.trigger !== 'dblclick') {
|
|
625
|
+
if (prevItem && nextItem && nextItem.isExpand) {
|
|
626
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, false)
|
|
575
627
|
}
|
|
576
628
|
}
|
|
629
|
+
$xeSplit.dispatchEvent('action-click', { prevItem, nextItem }, evnt)
|
|
577
630
|
},
|
|
578
|
-
|
|
631
|
+
handleNextActionDblclickEvent (evnt: MouseEvent) {
|
|
579
632
|
const $xeSplit = this
|
|
580
633
|
const reactData = $xeSplit.reactData
|
|
581
634
|
|
|
582
635
|
const { itemList } = reactData
|
|
583
636
|
const actionOpts = $xeSplit.computeActionOpts
|
|
584
637
|
const btnEl = evnt.currentTarget as HTMLDivElement
|
|
585
|
-
const
|
|
586
|
-
const
|
|
587
|
-
const
|
|
588
|
-
const
|
|
638
|
+
const btnWrapperEl = btnEl.parentElement as HTMLDivElement
|
|
639
|
+
const handleEl = btnWrapperEl.parentElement as HTMLDivElement
|
|
640
|
+
const prevEl = handleEl.previousElementSibling as HTMLDivElement
|
|
641
|
+
const prevId = prevEl.getAttribute('itemid')
|
|
642
|
+
const prevItem = itemList.find(item => item.id === prevId)
|
|
643
|
+
const nextEl = handleEl.nextElementSibling as HTMLDivElement
|
|
644
|
+
const nextId = nextEl.getAttribute('itemid')
|
|
645
|
+
const nextItem = itemList.find(item => item.id === nextId)
|
|
589
646
|
|
|
590
647
|
if (actionOpts.trigger === 'dblclick') {
|
|
591
|
-
|
|
648
|
+
if (prevItem && nextItem && prevItem.isExpand) {
|
|
649
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, true)
|
|
650
|
+
}
|
|
592
651
|
}
|
|
593
|
-
$xeSplit.dispatchEvent('action-dblclick', {
|
|
652
|
+
$xeSplit.dispatchEvent('action-dblclick', { prevItem, nextItem }, evnt)
|
|
594
653
|
},
|
|
595
|
-
|
|
654
|
+
handleNextActionClickEvent (evnt: MouseEvent) {
|
|
596
655
|
const $xeSplit = this
|
|
597
656
|
const reactData = $xeSplit.reactData
|
|
598
657
|
|
|
599
658
|
const { itemList } = reactData
|
|
600
659
|
const actionOpts = $xeSplit.computeActionOpts
|
|
601
660
|
const btnEl = evnt.currentTarget as HTMLDivElement
|
|
602
|
-
const
|
|
603
|
-
const
|
|
604
|
-
const
|
|
605
|
-
const
|
|
661
|
+
const btnWrapperEl = btnEl.parentElement as HTMLDivElement
|
|
662
|
+
const handleEl = btnWrapperEl.parentElement as HTMLDivElement
|
|
663
|
+
const prevEl = handleEl.previousElementSibling as HTMLDivElement
|
|
664
|
+
const prevId = prevEl.getAttribute('itemid')
|
|
665
|
+
const prevItem = itemList.find(item => item.id === prevId)
|
|
666
|
+
const nextEl = handleEl.nextElementSibling as HTMLDivElement
|
|
667
|
+
const nextId = nextEl.getAttribute('itemid')
|
|
668
|
+
const nextItem = itemList.find(item => item.id === nextId)
|
|
606
669
|
|
|
607
670
|
if (actionOpts.trigger !== 'dblclick') {
|
|
608
|
-
|
|
671
|
+
if (prevItem && nextItem && prevItem.isExpand) {
|
|
672
|
+
$xeSplit.handleItemActionEvent(evnt, prevItem, nextItem, true)
|
|
673
|
+
}
|
|
609
674
|
}
|
|
610
|
-
$xeSplit.dispatchEvent('action-click', {
|
|
675
|
+
$xeSplit.dispatchEvent('action-click', { prevItem, nextItem }, evnt)
|
|
611
676
|
},
|
|
612
677
|
handleGlobalResizeEvent () {
|
|
613
678
|
const $xeSplit = this
|
|
614
679
|
|
|
615
680
|
$xeSplit.recalculate()
|
|
616
681
|
},
|
|
617
|
-
|
|
682
|
+
getActionIcon (prevItem: VxeSplitDefines.PaneConfig, nextItem: VxeSplitDefines.PaneConfig, isNext: boolean) {
|
|
618
683
|
const $xeSplit = this
|
|
619
684
|
const props = $xeSplit
|
|
620
685
|
|
|
621
686
|
const { vertical } = props
|
|
622
|
-
const { showAction, isExpand } = item
|
|
623
|
-
const isFoldNext = $xeSplit.computeIsFoldNext
|
|
624
687
|
const topIcon = 'SPLIT_TOP_ACTION'
|
|
625
688
|
const bottomIcon = 'SPLIT_BOTTOM_ACTION'
|
|
626
689
|
const leftIcon = 'SPLIT_LEFT_ACTION'
|
|
627
690
|
const rightIcon = 'SPLIT_RIGHT_ACTION'
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
if (
|
|
631
|
-
|
|
632
|
-
iconName = isExpand ? bottomIcon : topIcon
|
|
633
|
-
} else {
|
|
634
|
-
iconName = isExpand ? rightIcon : leftIcon
|
|
635
|
-
}
|
|
691
|
+
let iconName: 'SPLIT_TOP_ACTION' | 'SPLIT_BOTTOM_ACTION' | 'SPLIT_LEFT_ACTION' | 'SPLIT_RIGHT_ACTION' | '' = ''
|
|
692
|
+
if (vertical) {
|
|
693
|
+
if (isNext) {
|
|
694
|
+
iconName = nextItem.isExpand ? bottomIcon : topIcon
|
|
636
695
|
} else {
|
|
637
|
-
|
|
638
|
-
iconName = isExpand ? topIcon : bottomIcon
|
|
639
|
-
} else {
|
|
640
|
-
iconName = isExpand ? leftIcon : rightIcon
|
|
641
|
-
}
|
|
696
|
+
iconName = prevItem.isExpand ? topIcon : bottomIcon
|
|
642
697
|
}
|
|
643
|
-
|
|
644
|
-
|
|
698
|
+
} else {
|
|
699
|
+
if (isNext) {
|
|
700
|
+
iconName = nextItem.isExpand ? rightIcon : leftIcon
|
|
701
|
+
} else {
|
|
702
|
+
iconName = prevItem.isExpand ? leftIcon : rightIcon
|
|
645
703
|
}
|
|
646
704
|
}
|
|
705
|
+
if (iconName) {
|
|
706
|
+
return getIcon()[iconName]
|
|
707
|
+
}
|
|
647
708
|
return ''
|
|
648
709
|
},
|
|
649
710
|
|
|
650
711
|
//
|
|
651
712
|
// Render
|
|
652
713
|
//
|
|
653
|
-
renderHandleBar (h: CreateElement,
|
|
714
|
+
renderHandleBar (h: CreateElement, prevItem: VxeSplitDefines.PaneConfig, nextItem: VxeSplitDefines.PaneConfig) {
|
|
654
715
|
const $xeSplit = this
|
|
716
|
+
const props = $xeSplit
|
|
717
|
+
const reactData = $xeSplit.reactData
|
|
655
718
|
|
|
719
|
+
const { border, resize, vertical } = props
|
|
720
|
+
const { itemList } = reactData
|
|
656
721
|
const barStyle = $xeSplit.computeBarStyle
|
|
657
722
|
const actionOpts = $xeSplit.computeActionOpts
|
|
658
|
-
const
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
dblclick?: (evnt: MouseEvent) => void
|
|
664
|
-
} = {}
|
|
665
|
-
if (actionOpts.trigger === 'dblclick') {
|
|
666
|
-
btnOns.dblclick = $xeSplit.handleItemActionEvent
|
|
667
|
-
} else {
|
|
668
|
-
btnOns.click = $xeSplit.handleItemActionEvent
|
|
669
|
-
}
|
|
723
|
+
const { direction } = actionOpts
|
|
724
|
+
const showPrevButton = XEUtils.isBoolean(actionOpts.showPrevButton) ? actionOpts.showPrevButton : (itemList.some(item => item.showAction))
|
|
725
|
+
const showNextButton = XEUtils.isBoolean(actionOpts.showNextButton) ? actionOpts.showNextButton : (direction === 'next' && itemList.some(item => item.showAction))
|
|
726
|
+
const resizeOpts = $xeSplit.computeResizeOpts
|
|
727
|
+
const { immediate } = resizeOpts
|
|
670
728
|
return h('div', {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
729
|
+
class: ['vxe-split-pane-handle', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
730
|
+
'is--resize': resize,
|
|
731
|
+
'is--border': border
|
|
732
|
+
}]
|
|
675
733
|
}, [
|
|
676
734
|
h('div', {
|
|
677
735
|
class: 'vxe-split-pane-handle-bar',
|
|
@@ -680,14 +738,36 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
680
738
|
mousedown: $xeSplit.dragEvent
|
|
681
739
|
}
|
|
682
740
|
}),
|
|
683
|
-
|
|
684
|
-
? h('
|
|
685
|
-
class: 'vxe-split-pane-action-btn'
|
|
686
|
-
on: btnOns
|
|
741
|
+
itemList.length === 2
|
|
742
|
+
? h('div', {
|
|
743
|
+
class: 'vxe-split-pane-action-btn-wrapper'
|
|
687
744
|
}, [
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
745
|
+
showPrevButton && nextItem.isExpand
|
|
746
|
+
? h('div', {
|
|
747
|
+
class: 'vxe-split-pane-action-btn',
|
|
748
|
+
on: {
|
|
749
|
+
dblclick: $xeSplit.handlePrevActionDblclickEvent,
|
|
750
|
+
click: $xeSplit.handlePrevActionClickEvent
|
|
751
|
+
}
|
|
752
|
+
}, [
|
|
753
|
+
h('i', {
|
|
754
|
+
class: $xeSplit.getActionIcon(prevItem, nextItem, false)
|
|
755
|
+
})
|
|
756
|
+
])
|
|
757
|
+
: renderEmptyElement($xeSplit),
|
|
758
|
+
showNextButton && prevItem.isExpand
|
|
759
|
+
? h('div', {
|
|
760
|
+
class: 'vxe-split-pane-action-btn',
|
|
761
|
+
on: {
|
|
762
|
+
dblclick: $xeSplit.handleNextActionDblclickEvent,
|
|
763
|
+
click: $xeSplit.handleNextActionClickEvent
|
|
764
|
+
}
|
|
765
|
+
}, [
|
|
766
|
+
h('i', {
|
|
767
|
+
class: $xeSplit.getActionIcon(prevItem, nextItem, true)
|
|
768
|
+
})
|
|
769
|
+
])
|
|
770
|
+
: renderEmptyElement($xeSplit)
|
|
691
771
|
])
|
|
692
772
|
: renderEmptyElement($xeSplit)
|
|
693
773
|
])
|
|
@@ -703,34 +783,36 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
703
783
|
const { immediate } = resizeOpts
|
|
704
784
|
const visibleItems = $xeSplit.computeVisibleItems
|
|
705
785
|
const { autoItems } = $xeSplit.computeAutoItems
|
|
706
|
-
const isFoldNext = $xeSplit.computeIsFoldNext
|
|
707
786
|
const itemVNs: VNode[] = []
|
|
708
|
-
itemList.forEach((
|
|
709
|
-
const { id, name, slots, renderHeight, resizeHeight, foldHeight, renderWidth, resizeWidth, foldWidth,
|
|
787
|
+
itemList.forEach((prevItem, index) => {
|
|
788
|
+
const { id, name, slots, renderHeight, resizeHeight, foldHeight, renderWidth, resizeWidth, foldWidth, isExpand } = prevItem
|
|
789
|
+
const nextItem = itemList[index + 1]
|
|
710
790
|
const defaultSlot = slots ? slots.default : null
|
|
711
791
|
const stys: Record<string, string | number> = {}
|
|
712
|
-
let itemWidth =
|
|
713
|
-
let itemHeight =
|
|
792
|
+
let itemWidth = isExpand ? (foldWidth || resizeWidth || renderWidth) : 0
|
|
793
|
+
let itemHeight = isExpand ? (foldHeight || resizeHeight || renderHeight) : 0
|
|
714
794
|
// 至少存在一个自适应
|
|
715
795
|
if (autoItems.length === 1) {
|
|
716
796
|
if (vertical) {
|
|
717
|
-
if (!
|
|
797
|
+
if (!prevItem.height) {
|
|
718
798
|
itemHeight = 0
|
|
719
799
|
}
|
|
720
800
|
} else {
|
|
721
|
-
if (!
|
|
801
|
+
if (!prevItem.width) {
|
|
722
802
|
itemWidth = 0
|
|
723
803
|
}
|
|
724
804
|
}
|
|
725
805
|
}
|
|
726
|
-
|
|
806
|
+
let isFill = true
|
|
727
807
|
if (vertical) {
|
|
728
|
-
if (itemHeight) {
|
|
729
|
-
|
|
808
|
+
if (itemHeight && visibleItems.length > 1) {
|
|
809
|
+
isFill = false
|
|
810
|
+
stys.height = toCssUnit(itemHeight)
|
|
730
811
|
}
|
|
731
812
|
} else {
|
|
732
|
-
if (itemWidth) {
|
|
733
|
-
|
|
813
|
+
if (itemWidth && visibleItems.length > 1) {
|
|
814
|
+
isFill = false
|
|
815
|
+
stys.width = toCssUnit(itemWidth)
|
|
734
816
|
}
|
|
735
817
|
}
|
|
736
818
|
|
|
@@ -745,14 +827,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
745
827
|
'is--border': border,
|
|
746
828
|
'is--height': itemHeight,
|
|
747
829
|
'is--width': itemWidth,
|
|
748
|
-
'is--
|
|
749
|
-
'is--
|
|
750
|
-
'is--
|
|
751
|
-
'is--hidden': !isVisible
|
|
830
|
+
'is--visible': isExpand,
|
|
831
|
+
'is--hidden': !isExpand,
|
|
832
|
+
'is--fill': isExpand && isFill
|
|
752
833
|
}],
|
|
753
834
|
style: stys
|
|
754
835
|
}, [
|
|
755
|
-
index && !isFoldNext ? $xeSplit.renderHandleBar(h, item) : renderEmptyElement($xeSplit),
|
|
756
836
|
h('div', {
|
|
757
837
|
attrs: {
|
|
758
838
|
itemid: id
|
|
@@ -761,11 +841,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
761
841
|
}, [
|
|
762
842
|
h('div', {
|
|
763
843
|
class: 'vxe-split-pane--inner'
|
|
764
|
-
}, defaultSlot ? $xeSplit.callSlot(defaultSlot, { name,
|
|
765
|
-
])
|
|
766
|
-
isFoldNext && index < itemList.length - 1 ? $xeSplit.renderHandleBar(h, item) : renderEmptyElement($xeSplit)
|
|
844
|
+
}, defaultSlot ? $xeSplit.callSlot(defaultSlot, { name, isExpand }) : [])
|
|
845
|
+
])
|
|
767
846
|
])
|
|
768
847
|
)
|
|
848
|
+
|
|
849
|
+
if (nextItem) {
|
|
850
|
+
itemVNs.push($xeSplit.renderHandleBar(h, prevItem, nextItem))
|
|
851
|
+
}
|
|
769
852
|
})
|
|
770
853
|
return h('div', {
|
|
771
854
|
class: 'vxe-split-wrapper'
|
|
@@ -812,7 +895,15 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
812
895
|
})
|
|
813
896
|
])
|
|
814
897
|
]
|
|
815
|
-
: [])
|
|
898
|
+
: []),
|
|
899
|
+
h('div', {
|
|
900
|
+
class: 'vxe-split--render-vars'
|
|
901
|
+
}, [
|
|
902
|
+
h('div', {
|
|
903
|
+
ref: 'refBarInfoElem',
|
|
904
|
+
class: 'vxe-split--handle-bar-info'
|
|
905
|
+
})
|
|
906
|
+
])
|
|
816
907
|
])
|
|
817
908
|
}
|
|
818
909
|
},
|
|
@@ -836,6 +927,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
836
927
|
if (props.items) {
|
|
837
928
|
$xeSplit.loadItem(props.items)
|
|
838
929
|
}
|
|
930
|
+
const actionOpts = $xeSplit.computeActionOpts
|
|
931
|
+
if (actionOpts.direction) {
|
|
932
|
+
errLog('vxe.error.delProp', ['action-config.direction', 'action-config.showPrevButton | action-config.showNextButton'])
|
|
933
|
+
}
|
|
839
934
|
$xeSplit.$nextTick(() => {
|
|
840
935
|
$xeSplit.recalculate()
|
|
841
936
|
})
|
|
@@ -603,7 +603,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
603
603
|
if (url) {
|
|
604
604
|
const urlObj = XEUtils.parseUrl(url)
|
|
605
605
|
if (!urlObj.searchQuery[nameProp]) {
|
|
606
|
-
|
|
606
|
+
if (url.indexOf('blob:') === -1) {
|
|
607
|
+
return `${url}${url.indexOf('?') === -1 ? '?' : '&'}${encodeURIComponent(item[nameProp] || '')}`
|
|
608
|
+
}
|
|
607
609
|
}
|
|
608
610
|
}
|
|
609
611
|
return url
|