vxe-pc-ui 4.5.2 → 4.5.4
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/list/src/list.js +3 -2
- package/es/print/src/util.js +2 -1
- package/es/split/src/split-item.js +16 -0
- package/es/split/src/split.js +226 -53
- package/es/split/style.css +75 -15
- 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 +7 -2
- package/es/ui/src/dom.js +0 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-split/style.css +75 -15
- 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 +304 -54
- package/lib/index.umd.min.js +1 -1
- package/lib/list/src/list.js +2 -1
- package/lib/list/src/list.min.js +1 -1
- package/lib/print/src/util.js +2 -1
- package/lib/print/src/util.min.js +1 -1
- package/lib/split/src/split-item.js +16 -0
- package/lib/split/src/split-item.min.js +1 -1
- package/lib/split/src/split.js +275 -48
- package/lib/split/src/split.min.js +1 -1
- package/lib/split/style/style.css +75 -15
- 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 +7 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +0 -2
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-split/style/style.css +75 -15
- package/lib/vxe-split/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/list/src/list.ts +4 -2
- package/packages/print/src/util.ts +3 -1
- package/packages/split/src/split-item.ts +18 -0
- package/packages/split/src/split.ts +237 -52
- package/packages/ui/index.ts +7 -1
- package/packages/ui/src/dom.ts +0 -2
- package/styles/components/split.scss +98 -15
- package/types/components/split-item.d.ts +5 -1
- package/types/components/split.d.ts +87 -1
- package/types/ui/global-icon.d.ts +6 -0
- /package/es/icon/{iconfont.1743056531953.ttf → iconfont.1743125694154.ttf} +0 -0
- /package/es/icon/{iconfont.1743056531953.woff → iconfont.1743125694154.woff} +0 -0
- /package/es/icon/{iconfont.1743056531953.woff2 → iconfont.1743125694154.woff2} +0 -0
- /package/es/{iconfont.1743056531953.ttf → iconfont.1743125694154.ttf} +0 -0
- /package/es/{iconfont.1743056531953.woff → iconfont.1743125694154.woff} +0 -0
- /package/es/{iconfont.1743056531953.woff2 → iconfont.1743125694154.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1743056531953.ttf → iconfont.1743125694154.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1743056531953.woff → iconfont.1743125694154.woff} +0 -0
- /package/lib/icon/style/{iconfont.1743056531953.woff2 → iconfont.1743125694154.woff2} +0 -0
- /package/lib/{iconfont.1743056531953.ttf → iconfont.1743125694154.ttf} +0 -0
- /package/lib/{iconfont.1743056531953.woff → iconfont.1743125694154.woff} +0 -0
- /package/lib/{iconfont.1743056531953.woff2 → iconfont.1743125694154.woff2} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, PropType, ref, h, reactive, provide, VNode, computed, watch, nextTick, onMounted, onActivated } from 'vue'
|
|
2
|
-
import { getConfig, createEvent, renderEmptyElement } from '../../ui'
|
|
1
|
+
import { defineComponent, PropType, ref, h, reactive, provide, VNode, computed, watch, nextTick, onMounted, onUnmounted, onActivated } from 'vue'
|
|
2
|
+
import { getConfig, getIcon, createEvent, globalEvents, renderEmptyElement } from '../../ui'
|
|
3
3
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
4
4
|
import { toCssUnit, isScale, addClass, removeClass } from '../../ui/src/dom'
|
|
5
5
|
import { getGlobalDefaultConfig } from '../../ui/src/utils'
|
|
@@ -24,9 +24,16 @@ export default defineComponent({
|
|
|
24
24
|
type: Boolean as PropType<VxeSplitPropTypes.Padding>,
|
|
25
25
|
default: () => getConfig().split.padding
|
|
26
26
|
},
|
|
27
|
-
itemConfig: Object as PropType<VxeSplitPropTypes.ItemConfig
|
|
27
|
+
itemConfig: Object as PropType<VxeSplitPropTypes.ItemConfig>,
|
|
28
|
+
barConfig: Object as PropType<VxeSplitPropTypes.BarConfig>,
|
|
29
|
+
actionConfig: Object as PropType<VxeSplitPropTypes.ActionConfig>
|
|
28
30
|
},
|
|
29
31
|
emits: [
|
|
32
|
+
'action-dblclick',
|
|
33
|
+
'action-click',
|
|
34
|
+
'resize-start',
|
|
35
|
+
'resize-drag',
|
|
36
|
+
'resize-end'
|
|
30
37
|
] as VxeSplitEmits,
|
|
31
38
|
setup (props, context) {
|
|
32
39
|
const { emit, slots } = context
|
|
@@ -46,8 +53,37 @@ export default defineComponent({
|
|
|
46
53
|
return Object.assign({}, getConfig().split.itemConfig, props.itemConfig)
|
|
47
54
|
})
|
|
48
55
|
|
|
56
|
+
const computeBarOpts = computed(() => {
|
|
57
|
+
return Object.assign({}, getConfig().split.barConfig, props.barConfig)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const computeActionOpts = computed(() => {
|
|
61
|
+
return Object.assign({}, getConfig().split.actionConfig, props.actionConfig)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const computeIsFoldNext = computed(() => {
|
|
65
|
+
const actionOpts = computeActionOpts.value
|
|
66
|
+
return actionOpts.direction === 'next'
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const computeBarStyle = computed(() => {
|
|
70
|
+
const barOpts = computeBarOpts.value
|
|
71
|
+
const { width, height } = barOpts
|
|
72
|
+
const stys: Record<string, string | number> = {}
|
|
73
|
+
if (height) {
|
|
74
|
+
stys.height = toCssUnit(height)
|
|
75
|
+
}
|
|
76
|
+
if (width) {
|
|
77
|
+
stys.width = toCssUnit(width)
|
|
78
|
+
}
|
|
79
|
+
return stys
|
|
80
|
+
})
|
|
81
|
+
|
|
49
82
|
const computeMaps: VxeSplitPrivateComputed = {
|
|
50
|
-
computeItemOpts
|
|
83
|
+
computeItemOpts,
|
|
84
|
+
computeBarOpts,
|
|
85
|
+
computeActionOpts,
|
|
86
|
+
computeIsFoldNext
|
|
51
87
|
}
|
|
52
88
|
|
|
53
89
|
const refMaps: SplitPrivateRef = {
|
|
@@ -81,6 +117,49 @@ export default defineComponent({
|
|
|
81
117
|
return []
|
|
82
118
|
}
|
|
83
119
|
|
|
120
|
+
const getDefaultActionIcon = (item: VxeSplitDefines.ChunkConfig) => {
|
|
121
|
+
const { vertical } = props
|
|
122
|
+
const { showAction, isExpand } = item
|
|
123
|
+
const isFoldNext = computeIsFoldNext.value
|
|
124
|
+
const topIcon = 'SPLIT_TOP_ACTION'
|
|
125
|
+
const bottomIcon = 'SPLIT_BOTTOM_ACTION'
|
|
126
|
+
const leftIcon = 'SPLIT_LEFT_ACTION'
|
|
127
|
+
const rightIcon = 'SPLIT_RIGHT_ACTION'
|
|
128
|
+
if (showAction) {
|
|
129
|
+
let iconName: 'SPLIT_TOP_ACTION' | 'SPLIT_BOTTOM_ACTION' | 'SPLIT_LEFT_ACTION' | 'SPLIT_RIGHT_ACTION' | '' = ''
|
|
130
|
+
if (isFoldNext) {
|
|
131
|
+
if (vertical) {
|
|
132
|
+
iconName = isExpand ? bottomIcon : topIcon
|
|
133
|
+
} else {
|
|
134
|
+
iconName = isExpand ? rightIcon : leftIcon
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
if (vertical) {
|
|
138
|
+
iconName = isExpand ? topIcon : bottomIcon
|
|
139
|
+
} else {
|
|
140
|
+
iconName = isExpand ? leftIcon : rightIcon
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (iconName) {
|
|
144
|
+
return getIcon()[iconName]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return ''
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const reset = () => {
|
|
151
|
+
const { staticItems } = reactData
|
|
152
|
+
staticItems.forEach(item => {
|
|
153
|
+
item.isExpand = true
|
|
154
|
+
item.isVisible = true
|
|
155
|
+
item.foldHeight = 0
|
|
156
|
+
item.foldWidth = 0
|
|
157
|
+
item.resizeHeight = 0
|
|
158
|
+
item.resizeWidth = 0
|
|
159
|
+
})
|
|
160
|
+
return nextTick()
|
|
161
|
+
}
|
|
162
|
+
|
|
84
163
|
const recalculate = () => {
|
|
85
164
|
return nextTick().then(() => {
|
|
86
165
|
const { vertical } = props
|
|
@@ -152,82 +231,143 @@ export default defineComponent({
|
|
|
152
231
|
evnt.preventDefault()
|
|
153
232
|
const { vertical } = props
|
|
154
233
|
const { staticItems } = reactData
|
|
155
|
-
const
|
|
234
|
+
const barEl = evnt.currentTarget as HTMLDivElement
|
|
235
|
+
const handleEl = barEl.parentElement as HTMLDivElement
|
|
156
236
|
const el = refElem.value
|
|
157
237
|
if (!el) {
|
|
158
238
|
return
|
|
159
239
|
}
|
|
160
|
-
const itemId = handleEl.getAttribute('
|
|
240
|
+
const itemId = handleEl.getAttribute('itemid')
|
|
161
241
|
const itemIndex = XEUtils.findIndexOf(staticItems, item => item.id === itemId)
|
|
162
242
|
const item = staticItems[itemIndex]
|
|
163
243
|
if (!item) {
|
|
164
244
|
return
|
|
165
245
|
}
|
|
246
|
+
if (!item.isExpand) {
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
const isFoldNext = computeIsFoldNext.value
|
|
166
250
|
const itemOpts = computeItemOpts.value
|
|
167
251
|
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth)
|
|
168
252
|
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight)
|
|
169
|
-
const
|
|
170
|
-
const
|
|
171
|
-
const currItemEl = item ? el.querySelector<HTMLDivElement>(`.vxe-split-item[
|
|
172
|
-
const
|
|
253
|
+
const targetItem = staticItems[itemIndex + (isFoldNext ? 1 : -1)]
|
|
254
|
+
const targetItemEl = targetItem ? el.querySelector<HTMLDivElement>(`.vxe-split-item[itemid="${targetItem.id}"]`) : null
|
|
255
|
+
const currItemEl = item ? el.querySelector<HTMLDivElement>(`.vxe-split-item[itemid="${item.id}"]`) : null
|
|
256
|
+
const targetWidth = targetItemEl ? targetItemEl.clientWidth : 0
|
|
173
257
|
const currWidth = currItemEl ? currItemEl.clientWidth : 0
|
|
174
|
-
const
|
|
258
|
+
const targetHeight = targetItemEl ? targetItemEl.clientHeight : 0
|
|
175
259
|
const currHeight = currItemEl ? currItemEl.clientHeight : 0
|
|
176
|
-
const
|
|
260
|
+
const targetMinWidth = XEUtils.toNumber(targetItem ? getGlobalDefaultConfig(targetItem.minWidth, allMinWidth) : allMinWidth)
|
|
177
261
|
const currMinWidth = XEUtils.toNumber(getGlobalDefaultConfig(item.minWidth, allMinWidth))
|
|
178
|
-
const
|
|
262
|
+
const targetMinHeight = XEUtils.toNumber(targetItem ? getGlobalDefaultConfig(targetItem.minHeight, allMinHeight) : allMinHeight)
|
|
179
263
|
const currMinHeight = XEUtils.toNumber(getGlobalDefaultConfig(item.minHeight, allMinHeight))
|
|
180
264
|
const disX = evnt.clientX
|
|
181
265
|
const disY = evnt.clientY
|
|
182
266
|
addClass(el, 'is--drag')
|
|
183
|
-
document.onmousemove = evnt => {
|
|
267
|
+
document.onmousemove = (evnt) => {
|
|
184
268
|
evnt.preventDefault()
|
|
185
269
|
if (vertical) {
|
|
186
|
-
const offsetTop = evnt.clientY - disY
|
|
270
|
+
const offsetTop = isFoldNext ? (disY - evnt.clientY) : (evnt.clientY - disY)
|
|
187
271
|
if (offsetTop > 0) {
|
|
188
|
-
if (
|
|
272
|
+
if (targetItem) {
|
|
189
273
|
if (currHeight - offsetTop >= currMinHeight) {
|
|
190
|
-
|
|
191
|
-
|
|
274
|
+
const reHeight = currHeight - offsetTop
|
|
275
|
+
targetItem.resizeHeight = targetHeight + offsetTop
|
|
276
|
+
item.resizeHeight = reHeight
|
|
277
|
+
dispatchEvent('resize-drag', { item, name: item.name, offsetHeight: offsetTop, resizeHeight: reHeight, offsetWidth: 0, resizeWidth: 0 }, evnt)
|
|
192
278
|
}
|
|
193
279
|
}
|
|
194
280
|
} else {
|
|
195
|
-
if (
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
281
|
+
if (targetItem) {
|
|
282
|
+
if (targetHeight + offsetTop >= targetMinHeight) {
|
|
283
|
+
const reHeight = currHeight - offsetTop
|
|
284
|
+
targetItem.resizeHeight = targetHeight + offsetTop
|
|
285
|
+
item.resizeHeight = reHeight
|
|
286
|
+
dispatchEvent('resize-drag', { item, name: item.name, offsetHeight: offsetTop, resizeHeight: reHeight, offsetWidth: 0, resizeWidth: 0 }, evnt)
|
|
199
287
|
}
|
|
200
288
|
}
|
|
201
289
|
}
|
|
202
290
|
} else {
|
|
203
|
-
const offsetLeft = evnt.clientX - disX
|
|
291
|
+
const offsetLeft = isFoldNext ? (disX - evnt.clientX) : (evnt.clientX - disX)
|
|
204
292
|
if (offsetLeft > 0) {
|
|
205
|
-
if (
|
|
293
|
+
if (targetItem) {
|
|
206
294
|
if (currWidth - offsetLeft >= currMinWidth) {
|
|
207
|
-
|
|
208
|
-
|
|
295
|
+
const reWidth = currWidth - offsetLeft
|
|
296
|
+
targetItem.resizeWidth = targetWidth + offsetLeft
|
|
297
|
+
item.resizeWidth = reWidth
|
|
298
|
+
dispatchEvent('resize-drag', { item, name: item.name, offsetHeight: 0, resizeHeight: 0, offsetWidth: offsetLeft, resizeWidth: reWidth }, evnt)
|
|
209
299
|
}
|
|
210
300
|
}
|
|
211
301
|
} else {
|
|
212
|
-
if (
|
|
213
|
-
if (
|
|
214
|
-
|
|
215
|
-
|
|
302
|
+
if (targetItem) {
|
|
303
|
+
if (targetWidth + offsetLeft >= targetMinWidth) {
|
|
304
|
+
const reWidth = currWidth - offsetLeft
|
|
305
|
+
targetItem.resizeWidth = targetWidth + offsetLeft
|
|
306
|
+
item.resizeWidth = reWidth
|
|
307
|
+
dispatchEvent('resize-drag', { item, name: item.name, offsetHeight: 0, resizeHeight: 0, offsetWidth: offsetLeft, resizeWidth: reWidth }, evnt)
|
|
216
308
|
}
|
|
217
309
|
}
|
|
218
310
|
}
|
|
219
311
|
}
|
|
220
312
|
}
|
|
221
|
-
document.onmouseup = () => {
|
|
313
|
+
document.onmouseup = (evnt: MouseEvent) => {
|
|
222
314
|
document.onmousemove = null
|
|
223
315
|
document.onmouseup = null
|
|
224
316
|
removeClass(el, 'is--drag')
|
|
317
|
+
dispatchEvent('resize-end', { item, name: item.name, resizeHeight: item.resizeHeight, resizeWidth: item.resizeWidth }, evnt)
|
|
318
|
+
recalculate()
|
|
225
319
|
}
|
|
320
|
+
dispatchEvent('resize-start', { item, name: item.name }, evnt)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const handleItemActionEvent = (evnt: MouseEvent) => {
|
|
324
|
+
const el = refElem.value
|
|
325
|
+
if (!el) {
|
|
326
|
+
return
|
|
327
|
+
}
|
|
328
|
+
const { vertical } = props
|
|
329
|
+
const { staticItems } = reactData
|
|
330
|
+
const isFoldNext = computeIsFoldNext.value
|
|
331
|
+
const btnEl = evnt.currentTarget as HTMLDivElement
|
|
332
|
+
const handleEl = btnEl.parentElement as HTMLDivElement
|
|
333
|
+
const itemId = handleEl.getAttribute('itemid')
|
|
334
|
+
const itemIndex = XEUtils.findIndexOf(staticItems, item => item.id === itemId)
|
|
335
|
+
const item = staticItems[itemIndex]
|
|
336
|
+
const targetItem = staticItems[itemIndex + (isFoldNext ? 1 : -1)]
|
|
337
|
+
if (item) {
|
|
338
|
+
const { showAction, isExpand } = item
|
|
339
|
+
if (showAction) {
|
|
340
|
+
if (vertical) {
|
|
341
|
+
if (targetItem) {
|
|
342
|
+
targetItem.isVisible = !isExpand
|
|
343
|
+
targetItem.foldHeight = 0
|
|
344
|
+
item.isExpand = !isExpand
|
|
345
|
+
item.isVisible = true
|
|
346
|
+
item.foldHeight = isExpand ? (targetItem.resizeHeight || targetItem.renderHeight) + (item.resizeHeight || item.renderHeight) : 0
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
if (targetItem) {
|
|
350
|
+
targetItem.isVisible = !isExpand
|
|
351
|
+
targetItem.foldWidth = 0
|
|
352
|
+
item.isExpand = !isExpand
|
|
353
|
+
item.isVisible = true
|
|
354
|
+
item.foldWidth = isExpand ? (targetItem.resizeWidth || targetItem.renderWidth) + (item.resizeWidth || item.renderWidth) : 0
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
dispatchEvent(evnt.type === 'dblclick' ? 'action-dblclick' : 'action-click', { item, name: item.name, targetItem, targetName: targetItem ? targetItem.name : '', expanded: item.isExpand }, evnt)
|
|
358
|
+
recalculate()
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const handleGlobalResizeEvent = () => {
|
|
364
|
+
recalculate()
|
|
226
365
|
}
|
|
227
366
|
|
|
228
367
|
const splitMethods: SplitMethods = {
|
|
229
368
|
dispatchEvent,
|
|
230
|
-
recalculate
|
|
369
|
+
recalculate,
|
|
370
|
+
reset
|
|
231
371
|
}
|
|
232
372
|
|
|
233
373
|
const splitPrivateMethods: SplitPrivateMethods = {
|
|
@@ -235,51 +375,88 @@ export default defineComponent({
|
|
|
235
375
|
|
|
236
376
|
Object.assign($xeSplit, splitMethods, splitPrivateMethods)
|
|
237
377
|
|
|
378
|
+
const renderHandleBar = (item: VxeSplitDefines.ChunkConfig) => {
|
|
379
|
+
const barStyle = computeBarStyle.value
|
|
380
|
+
const actionOpts = computeActionOpts.value
|
|
381
|
+
const isFoldNext = computeIsFoldNext.value
|
|
382
|
+
const { id, isExpand, showAction } = item
|
|
383
|
+
|
|
384
|
+
const btnOns: {
|
|
385
|
+
onClick?: (evnt: MouseEvent) => void
|
|
386
|
+
onDblclick?: (evnt: MouseEvent) => void
|
|
387
|
+
} = {}
|
|
388
|
+
if (actionOpts.trigger === 'dblclick') {
|
|
389
|
+
btnOns.onDblclick = handleItemActionEvent
|
|
390
|
+
} else {
|
|
391
|
+
btnOns.onClick = handleItemActionEvent
|
|
392
|
+
}
|
|
393
|
+
return h('div', {
|
|
394
|
+
itemid: id,
|
|
395
|
+
class: ['vxe-split-item-handle', isFoldNext ? 'to--next' : 'to--prev']
|
|
396
|
+
}, [
|
|
397
|
+
h('div', {
|
|
398
|
+
class: 'vxe-split-item-handle-bar',
|
|
399
|
+
style: barStyle,
|
|
400
|
+
onMousedown: dragEvent
|
|
401
|
+
}),
|
|
402
|
+
showAction
|
|
403
|
+
? h('span', {
|
|
404
|
+
class: 'vxe-split-item-action-btn',
|
|
405
|
+
...btnOns
|
|
406
|
+
}, [
|
|
407
|
+
h('i', {
|
|
408
|
+
class: (isExpand ? actionOpts.openIcon : actionOpts.closeIcon) || getDefaultActionIcon(item)
|
|
409
|
+
})
|
|
410
|
+
])
|
|
411
|
+
: renderEmptyElement($xeSplit)
|
|
412
|
+
])
|
|
413
|
+
}
|
|
414
|
+
|
|
238
415
|
const renderItems = () => {
|
|
239
416
|
const { border, padding, vertical } = props
|
|
240
417
|
const { staticItems } = reactData
|
|
418
|
+
const isFoldNext = computeIsFoldNext.value
|
|
241
419
|
const itemVNs: VNode[] = []
|
|
242
420
|
staticItems.forEach((item, index) => {
|
|
243
|
-
const { id, slots, renderHeight, renderWidth } = item
|
|
421
|
+
const { id, slots, renderHeight, resizeHeight, foldHeight, renderWidth, resizeWidth, foldWidth, isVisible, isExpand } = item
|
|
244
422
|
const defaultSlot = slots ? slots.default : null
|
|
245
423
|
const stys: Record<string, string | number> = {}
|
|
424
|
+
const itemWidth = isVisible ? (foldWidth || resizeWidth || renderWidth) : 0
|
|
425
|
+
const itemHeight = isVisible ? (foldHeight || resizeHeight || renderHeight) : 0
|
|
246
426
|
if (vertical) {
|
|
247
|
-
if (
|
|
248
|
-
stys.height = toCssUnit(
|
|
427
|
+
if (itemHeight) {
|
|
428
|
+
stys.height = toCssUnit(itemHeight)
|
|
249
429
|
}
|
|
250
430
|
} else {
|
|
251
|
-
if (
|
|
252
|
-
stys.width = toCssUnit(
|
|
431
|
+
if (itemWidth) {
|
|
432
|
+
stys.width = toCssUnit(itemWidth)
|
|
253
433
|
}
|
|
254
434
|
}
|
|
255
435
|
itemVNs.push(
|
|
256
436
|
h('div', {
|
|
257
|
-
|
|
437
|
+
itemid: id,
|
|
258
438
|
class: ['vxe-split-item', vertical ? 'is--vertical' : 'is--horizontal', {
|
|
259
439
|
'is--padding': padding,
|
|
260
440
|
'is--border': border,
|
|
261
|
-
'is--height':
|
|
262
|
-
'is--width':
|
|
263
|
-
'is--fill': !
|
|
264
|
-
'is--handle': index > 0
|
|
441
|
+
'is--height': itemHeight,
|
|
442
|
+
'is--width': itemWidth,
|
|
443
|
+
'is--fill': isVisible && !itemHeight && !itemWidth,
|
|
444
|
+
'is--handle': index > 0,
|
|
445
|
+
'is--expand': isExpand,
|
|
446
|
+
'is--hidden': !isVisible
|
|
265
447
|
}],
|
|
266
448
|
style: stys
|
|
267
449
|
}, [
|
|
268
|
-
index
|
|
269
|
-
? h('div', {
|
|
270
|
-
xid: id,
|
|
271
|
-
class: 'vxe-split-item-handle',
|
|
272
|
-
onMousedown: dragEvent
|
|
273
|
-
})
|
|
274
|
-
: renderEmptyElement($xeSplit),
|
|
450
|
+
index && !isFoldNext ? renderHandleBar(item) : renderEmptyElement($xeSplit),
|
|
275
451
|
h('div', {
|
|
276
|
-
|
|
452
|
+
itemid: id,
|
|
277
453
|
class: 'vxe-split-item--wrapper'
|
|
278
454
|
}, [
|
|
279
455
|
h('div', {
|
|
280
456
|
class: 'vxe-split-item--inner'
|
|
281
457
|
}, defaultSlot ? callSlot(defaultSlot, { }) : [])
|
|
282
|
-
])
|
|
458
|
+
]),
|
|
459
|
+
isFoldNext && index < staticItems.length - 1 ? renderHandleBar(item) : renderEmptyElement($xeSplit)
|
|
283
460
|
])
|
|
284
461
|
)
|
|
285
462
|
})
|
|
@@ -315,7 +492,15 @@ export default defineComponent({
|
|
|
315
492
|
})
|
|
316
493
|
|
|
317
494
|
onMounted(() => {
|
|
318
|
-
|
|
495
|
+
nextTick(() => {
|
|
496
|
+
recalculate()
|
|
497
|
+
})
|
|
498
|
+
|
|
499
|
+
globalEvents.on($xeSplit, 'resize', handleGlobalResizeEvent)
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
onUnmounted(() => {
|
|
503
|
+
globalEvents.off($xeSplit, 'resize')
|
|
319
504
|
})
|
|
320
505
|
|
|
321
506
|
onActivated(() => {
|
package/packages/ui/index.ts
CHANGED
|
@@ -562,7 +562,13 @@ setIcon({
|
|
|
562
562
|
|
|
563
563
|
// color-picker
|
|
564
564
|
COLOR_COPY: iconPrefix + 'copy',
|
|
565
|
-
EYE_DROPPER: iconPrefix + 'dropper'
|
|
565
|
+
EYE_DROPPER: iconPrefix + 'dropper',
|
|
566
|
+
|
|
567
|
+
// split
|
|
568
|
+
SPLIT_TOP_ACTION: iconPrefix + 'arrow-up',
|
|
569
|
+
SPLIT_BOTTOM_ACTION: iconPrefix + 'arrow-down',
|
|
570
|
+
SPLIT_LEFT_ACTION: iconPrefix + 'arrow-left',
|
|
571
|
+
SPLIT_RIGHT_ACTION: iconPrefix + 'arrow-right'
|
|
566
572
|
})
|
|
567
573
|
|
|
568
574
|
export * from '@vxe-ui/core'
|
package/packages/ui/src/dom.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use "sass:list";
|
|
2
|
+
@use '../helpers/baseMixin.scss';
|
|
2
3
|
|
|
3
4
|
.vxe-split {
|
|
4
5
|
&.is--vertical {
|
|
@@ -41,15 +42,9 @@
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
.vxe-split-item-handle {
|
|
45
|
+
position: relative;
|
|
44
46
|
flex-shrink: 0;
|
|
45
|
-
background-color: var(--vxe-split-handle-bar-background-color);
|
|
46
47
|
user-select: none;
|
|
47
|
-
&:hover {
|
|
48
|
-
background-color: var(--vxe-ui-font-primary-lighten-color);
|
|
49
|
-
}
|
|
50
|
-
&:active {
|
|
51
|
-
background-color: var(--vxe-ui-font-primary-darken-color);
|
|
52
|
-
}
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
.vxe-split-item--wrapper {
|
|
@@ -57,20 +52,35 @@
|
|
|
57
52
|
word-break: break-word;
|
|
58
53
|
overflow: hidden;
|
|
59
54
|
flex-grow: 1;
|
|
60
|
-
& > .vxe-split {
|
|
61
|
-
height: 100%;
|
|
62
|
-
}
|
|
63
55
|
}
|
|
64
56
|
.vxe-split-item--inner {
|
|
65
57
|
height: 100%;
|
|
66
58
|
width: 100%;
|
|
67
59
|
overflow: auto;
|
|
60
|
+
& > .vxe-split {
|
|
61
|
+
height: 100%;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.vxe-split-item-handle-bar {
|
|
65
|
+
background-color: var(--vxe-split-handle-bar-background-color);
|
|
66
|
+
}
|
|
67
|
+
.vxe-split-item-action-btn {
|
|
68
|
+
display: block;
|
|
69
|
+
position: absolute;
|
|
70
|
+
z-index: 2;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
background-color: var(--vxe-ui-layout-background-color);
|
|
73
|
+
border: 1px solid var(--vxe-ui-input-border-color);
|
|
74
|
+
@include baseMixin.createAnimationTransition(transform, 0.1s);
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
.vxe-split-item {
|
|
71
78
|
display: flex;
|
|
72
79
|
position: relative;
|
|
73
|
-
overflow:
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
&.is--hidden {
|
|
82
|
+
width: 0;
|
|
83
|
+
}
|
|
74
84
|
&.is--padding {
|
|
75
85
|
& > .vxe-split-item--wrapper {
|
|
76
86
|
padding: var(--vxe-ui-layout-padding-default);
|
|
@@ -89,11 +99,61 @@
|
|
|
89
99
|
border: 1px solid var(--vxe-ui-base-popup-border-color);
|
|
90
100
|
}
|
|
91
101
|
}
|
|
102
|
+
&.is--expand {
|
|
103
|
+
&.is--horizontal {
|
|
104
|
+
& > .vxe-split-item-handle {
|
|
105
|
+
.vxe-split-item-handle-bar {
|
|
106
|
+
cursor: w-resize;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
&.is--vertical {
|
|
111
|
+
& > .vxe-split-item-handle {
|
|
112
|
+
.vxe-split-item-handle-bar {
|
|
113
|
+
cursor: n-resize;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
& > .vxe-split-item-handle {
|
|
118
|
+
& > .vxe-split-item-handle-bar {
|
|
119
|
+
background-color: var(--vxe-split-handle-bar-background-color);
|
|
120
|
+
&:hover {
|
|
121
|
+
background-color: var(--vxe-ui-font-primary-lighten-color);
|
|
122
|
+
}
|
|
123
|
+
&:active {
|
|
124
|
+
background-color: var(--vxe-ui-font-primary-darken-color);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
92
129
|
&.is--horizontal {
|
|
93
130
|
flex-direction: row;
|
|
94
131
|
& > .vxe-split-item-handle {
|
|
95
|
-
|
|
96
|
-
|
|
132
|
+
&.to--prev {
|
|
133
|
+
.vxe-split-item-action-btn {
|
|
134
|
+
left: 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
&.to--next {
|
|
138
|
+
.vxe-split-item-action-btn {
|
|
139
|
+
right: 0;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
.vxe-split-item-handle-bar {
|
|
143
|
+
width: var(--vxe-split-handle-bar-width);
|
|
144
|
+
height: 100%;
|
|
145
|
+
}
|
|
146
|
+
.vxe-split-item-action-btn {
|
|
147
|
+
top: 50%;
|
|
148
|
+
transform: translateY(-50%);
|
|
149
|
+
padding: 1em 0;
|
|
150
|
+
&:hover {
|
|
151
|
+
color: var(--vxe-ui-font-primary-color);
|
|
152
|
+
}
|
|
153
|
+
&:active {
|
|
154
|
+
transform: translateY(-50%) scale(0.9);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
97
157
|
}
|
|
98
158
|
&.is--border {
|
|
99
159
|
& > .vxe-split-item-handle {
|
|
@@ -104,8 +164,31 @@
|
|
|
104
164
|
&.is--vertical {
|
|
105
165
|
flex-direction: column;
|
|
106
166
|
& > .vxe-split-item-handle {
|
|
107
|
-
|
|
108
|
-
|
|
167
|
+
&.to--prev {
|
|
168
|
+
.vxe-split-item-action-btn {
|
|
169
|
+
top: 0;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
&.to--next {
|
|
173
|
+
.vxe-split-item-action-btn {
|
|
174
|
+
bottom: 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
.vxe-split-item-handle-bar {
|
|
178
|
+
height: var(--vxe-split-handle-bar-height);
|
|
179
|
+
width: 100%;
|
|
180
|
+
}
|
|
181
|
+
.vxe-split-item-action-btn {
|
|
182
|
+
left: 50%;
|
|
183
|
+
transform: translateX(-50%);
|
|
184
|
+
padding: 0 1em;
|
|
185
|
+
&:hover {
|
|
186
|
+
color: var(--vxe-ui-font-primary-color);
|
|
187
|
+
}
|
|
188
|
+
&:active {
|
|
189
|
+
transform: translateX(-50%) scale(0.9);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
109
192
|
}
|
|
110
193
|
&.is--border {
|
|
111
194
|
& > .vxe-split-item-handle {
|
|
@@ -23,17 +23,21 @@ export interface SplitItemPrivateRef {
|
|
|
23
23
|
export interface VxeSplitItemPrivateRef extends SplitItemPrivateRef { }
|
|
24
24
|
|
|
25
25
|
export namespace VxeSplitItemPropTypes {
|
|
26
|
+
export type Name = string | number
|
|
26
27
|
export type Width = string | number
|
|
27
28
|
export type Height = string | number
|
|
28
29
|
export type MinWidth = string | number
|
|
29
30
|
export type MinHeight = string | number
|
|
31
|
+
export type ShowAction = boolean
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
export
|
|
34
|
+
export interface VxeSplitItemProps {
|
|
35
|
+
name?: VxeSplitItemPropTypes.Name
|
|
33
36
|
width?: VxeSplitItemPropTypes.Width
|
|
34
37
|
height?: VxeSplitItemPropTypes.Height
|
|
35
38
|
minWidth?: VxeSplitItemPropTypes.MinWidth
|
|
36
39
|
minHeight?: VxeSplitItemPropTypes.MinHeight
|
|
40
|
+
showAction?: VxeSplitItemPropTypes.ShowAction
|
|
37
41
|
|
|
38
42
|
slots?: {
|
|
39
43
|
default?: string | ((params: VxeSplitItemSlotTypes.DefaultSlotParams) => VxeComponentSlotType | VxeComponentSlotType[])
|