vxe-pc-ui 4.10.10 → 4.10.11
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/components.js +6 -0
- package/es/icon/style.css +1 -1
- package/es/split/index.js +2 -2
- package/es/split/style.css +79 -79
- package/es/split/style.min.css +1 -1
- package/es/split-pane/index.js +2 -2
- package/es/splitter/index.js +12 -0
- package/es/{split/src/split-pane.js → splitter/src/splitter-panel.js} +15 -15
- package/es/{split/src/split.js → splitter/src/splitter.js} +137 -68
- package/es/splitter/src/util.js +17 -0
- package/es/splitter/style.css +288 -0
- package/es/splitter/style.min.css +1 -0
- package/es/splitter-panel/index.js +12 -0
- package/es/splitter-panel/style.css +0 -0
- package/es/splitter-panel/style.min.css +0 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +3 -3
- package/es/ui/src/log.js +1 -1
- package/es/vxe-split/style.css +79 -79
- package/es/vxe-split/style.min.css +1 -1
- package/es/vxe-splitter/index.js +3 -0
- package/es/vxe-splitter/style.css +288 -0
- package/es/vxe-splitter/style.min.css +1 -0
- package/es/vxe-splitter-panel/index.js +3 -0
- package/es/vxe-splitter-panel/style.css +0 -0
- package/es/vxe-splitter-panel/style.min.css +0 -0
- package/lib/components.js +25 -1
- package/lib/components.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 +231 -115
- package/lib/index.umd.min.js +1 -1
- package/lib/split/index.js +4 -4
- package/lib/split/index.min.js +1 -1
- package/lib/split/style/style.css +79 -79
- package/lib/split/style/style.min.css +1 -1
- package/lib/split-pane/index.js +5 -5
- package/lib/split-pane/index.min.js +1 -1
- package/lib/splitter/index.js +19 -0
- package/lib/splitter/index.min.js +1 -0
- package/lib/{split/src/split-pane.js → splitter/src/splitter-panel.js} +14 -14
- package/lib/splitter/src/splitter-panel.min.js +1 -0
- package/lib/{split/src/split.js → splitter/src/splitter.js} +150 -72
- package/lib/splitter/src/splitter.min.js +1 -0
- package/lib/{split → splitter}/src/util.js +8 -8
- package/lib/splitter/src/util.min.js +1 -0
- package/lib/splitter/style/index.js +1 -0
- package/lib/splitter/style/style.css +288 -0
- package/lib/splitter/style/style.min.css +1 -0
- package/lib/splitter-panel/index.js +19 -0
- package/lib/splitter-panel/index.min.js +1 -0
- package/lib/splitter-panel/style/index.js +1 -0
- package/lib/splitter-panel/style/style.css +0 -0
- package/lib/splitter-panel/style/style.min.css +0 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +3 -3
- 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/vxe-split/style/style.css +79 -79
- package/lib/vxe-split/style/style.min.css +1 -1
- package/lib/vxe-splitter/index.js +22 -0
- package/lib/vxe-splitter/index.min.js +1 -0
- package/lib/vxe-splitter/style/index.js +1 -0
- package/lib/vxe-splitter/style/style.css +288 -0
- package/lib/vxe-splitter/style/style.min.css +1 -0
- package/lib/vxe-splitter-panel/index.js +22 -0
- package/lib/vxe-splitter-panel/index.min.js +1 -0
- package/lib/vxe-splitter-panel/style/index.js +1 -0
- package/lib/vxe-splitter-panel/style/style.css +0 -0
- package/lib/vxe-splitter-panel/style/style.min.css +0 -0
- package/package.json +1 -1
- package/packages/components.ts +6 -0
- package/packages/split/index.ts +2 -2
- package/packages/split-pane/index.ts +2 -2
- package/packages/splitter/index.ts +16 -0
- package/packages/splitter/src/splitter-panel.ts +145 -0
- package/packages/{split/src/split.ts → splitter/src/splitter.ts} +168 -96
- package/packages/splitter/src/util.ts +21 -0
- package/packages/splitter-panel/index.ts +16 -0
- package/packages/ui/index.ts +2 -2
- package/styles/components/split.scss +1 -317
- package/styles/components/splitter-panel.scss +0 -0
- package/styles/components/splitter.scss +317 -0
- package/styles/theme/base.scss +6 -6
- package/styles/theme/dark.scss +3 -3
- package/styles/theme/light.scss +3 -3
- package/styles/variable.scss +3 -3
- package/types/all.d.ts +6 -0
- package/types/components/split-pane.d.ts +42 -14
- package/types/components/split.d.ts +54 -18
- package/types/components/splitter-panel.d.ts +105 -0
- package/types/components/splitter.d.ts +288 -0
- package/types/ui/global-config.d.ts +4 -0
- package/types/ui/global-icon.d.ts +1 -1
- package/es/split/src/util.js +0 -17
- package/lib/split/src/split-pane.min.js +0 -1
- package/lib/split/src/split.min.js +0 -1
- package/lib/split/src/util.min.js +0 -1
- package/packages/split/src/split-pane.ts +0 -145
- package/packages/split/src/util.ts +0 -21
- /package/es/icon/{iconfont.1761298747069.ttf → iconfont.1761614052122.ttf} +0 -0
- /package/es/icon/{iconfont.1761298747069.woff → iconfont.1761614052122.woff} +0 -0
- /package/es/icon/{iconfont.1761298747069.woff2 → iconfont.1761614052122.woff2} +0 -0
- /package/es/{iconfont.1761298747069.ttf → iconfont.1761614052122.ttf} +0 -0
- /package/es/{iconfont.1761298747069.woff → iconfont.1761614052122.woff} +0 -0
- /package/es/{iconfont.1761298747069.woff2 → iconfont.1761614052122.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1761298747069.ttf → iconfont.1761614052122.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1761298747069.woff → iconfont.1761614052122.woff} +0 -0
- /package/lib/icon/style/{iconfont.1761298747069.woff2 → iconfont.1761614052122.woff2} +0 -0
- /package/lib/{iconfont.1761298747069.ttf → iconfont.1761614052122.ttf} +0 -0
- /package/lib/{iconfont.1761298747069.woff → iconfont.1761614052122.woff} +0 -0
- /package/lib/{iconfont.1761298747069.woff2 → iconfont.1761614052122.woff2} +0 -0
|
@@ -7,37 +7,37 @@ import { getGlobalDefaultConfig } from '../../ui/src/utils'
|
|
|
7
7
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
8
8
|
import XEUtils from 'xe-utils'
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { SplitterReactData, SplitterPrivateRef, VxeSplitterPropTypes, SplitterInternalData, SplitterMethods, VxeSplitterPanelPropTypes, VxeSplitterDefines, VxeSplitterPanelProps, VxeSplitterPrivateComputed, SplitterPrivateMethods, VxeSplitterEmits, VxeSplitterConstructor, ValueOf, VxeSplitterPrivateMethods } from '../../../types'
|
|
11
11
|
|
|
12
12
|
export default defineVxeComponent({
|
|
13
|
-
name: '
|
|
13
|
+
name: 'VxeSplitter',
|
|
14
14
|
props: {
|
|
15
|
-
width: [Number, String] as PropType<
|
|
16
|
-
height: [Number, String] as PropType<
|
|
15
|
+
width: [Number, String] as PropType<VxeSplitterPropTypes.Width>,
|
|
16
|
+
height: [Number, String] as PropType<VxeSplitterPropTypes.Height>,
|
|
17
17
|
vertical: {
|
|
18
|
-
type: Boolean as PropType<
|
|
19
|
-
default: () => getConfig().
|
|
18
|
+
type: Boolean as PropType<VxeSplitterPropTypes.Vertical>,
|
|
19
|
+
default: () => getConfig().splitter.vertical
|
|
20
20
|
},
|
|
21
21
|
border: {
|
|
22
|
-
type: Boolean as PropType<
|
|
23
|
-
default: () => getConfig().
|
|
22
|
+
type: Boolean as PropType<VxeSplitterPropTypes.Border>,
|
|
23
|
+
default: () => getConfig().splitter.border
|
|
24
24
|
},
|
|
25
25
|
padding: {
|
|
26
|
-
type: Boolean as PropType<
|
|
27
|
-
default: () => getConfig().
|
|
26
|
+
type: Boolean as PropType<VxeSplitterPropTypes.Padding>,
|
|
27
|
+
default: () => getConfig().splitter.padding
|
|
28
28
|
},
|
|
29
29
|
resize: {
|
|
30
|
-
type: Boolean as PropType<
|
|
31
|
-
default: () => getConfig().
|
|
30
|
+
type: Boolean as PropType<VxeSplitterPropTypes.Resize>,
|
|
31
|
+
default: () => getConfig().splitter.resize
|
|
32
32
|
},
|
|
33
|
-
items: Array as PropType<
|
|
34
|
-
itemConfig: Object as PropType<
|
|
35
|
-
barConfig: Object as PropType<
|
|
36
|
-
resizeConfig: Object as PropType<
|
|
37
|
-
actionConfig: Object as PropType<
|
|
33
|
+
items: Array as PropType<VxeSplitterPropTypes.Items>,
|
|
34
|
+
itemConfig: Object as PropType<VxeSplitterPropTypes.ItemConfig>,
|
|
35
|
+
barConfig: Object as PropType<VxeSplitterPropTypes.BarConfig>,
|
|
36
|
+
resizeConfig: Object as PropType<VxeSplitterPropTypes.ResizeConfig>,
|
|
37
|
+
actionConfig: Object as PropType<VxeSplitterPropTypes.ActionConfig>,
|
|
38
38
|
size: {
|
|
39
|
-
type: String as PropType<
|
|
40
|
-
default: () => getConfig().
|
|
39
|
+
type: String as PropType<VxeSplitterPropTypes.Size>,
|
|
40
|
+
default: () => getConfig().splitter.size || getConfig().size
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
emits: [
|
|
@@ -47,7 +47,7 @@ export default defineVxeComponent({
|
|
|
47
47
|
'resize-start',
|
|
48
48
|
'resize-drag',
|
|
49
49
|
'resize-end'
|
|
50
|
-
] as
|
|
50
|
+
] as VxeSplitterEmits,
|
|
51
51
|
setup (props, context) {
|
|
52
52
|
const { emit, slots } = context
|
|
53
53
|
|
|
@@ -55,36 +55,36 @@ export default defineVxeComponent({
|
|
|
55
55
|
|
|
56
56
|
const refElem = ref<HTMLDivElement>()
|
|
57
57
|
const refBarInfoElem = ref<HTMLDivElement>()
|
|
58
|
-
const
|
|
58
|
+
const refResizableSplitterTip = ref<HTMLDivElement>()
|
|
59
59
|
|
|
60
60
|
const { computeSize } = useSize(props)
|
|
61
61
|
|
|
62
|
-
const reactData = reactive<
|
|
62
|
+
const reactData = reactive<SplitterReactData>({
|
|
63
63
|
staticItems: [],
|
|
64
64
|
itemList: [],
|
|
65
65
|
barWidth: 0,
|
|
66
66
|
barHeight: 0
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
const internalData:
|
|
69
|
+
const internalData: SplitterInternalData = {
|
|
70
70
|
wrapperWidth: 0,
|
|
71
71
|
wrapperHeight: 0
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const computeItemOpts = computed(() => {
|
|
75
|
-
return Object.assign({}, getConfig().
|
|
75
|
+
return Object.assign({}, getConfig().splitter.itemConfig, props.itemConfig)
|
|
76
76
|
})
|
|
77
77
|
|
|
78
78
|
const computeBarOpts = computed(() => {
|
|
79
|
-
return Object.assign({}, getConfig().
|
|
79
|
+
return Object.assign({}, getConfig().splitter.barConfig, props.barConfig)
|
|
80
80
|
})
|
|
81
81
|
|
|
82
82
|
const computeResizeOpts = computed(() => {
|
|
83
|
-
return Object.assign({}, getConfig().
|
|
83
|
+
return Object.assign({}, getConfig().splitter.resizeConfig, props.resizeConfig)
|
|
84
84
|
})
|
|
85
85
|
|
|
86
86
|
const computeActionOpts = computed(() => {
|
|
87
|
-
return Object.assign({}, getConfig().
|
|
87
|
+
return Object.assign({}, getConfig().splitter.actionConfig, props.actionConfig)
|
|
88
88
|
})
|
|
89
89
|
|
|
90
90
|
const computeVisibleItems = computed(() => {
|
|
@@ -93,7 +93,7 @@ export default defineVxeComponent({
|
|
|
93
93
|
|
|
94
94
|
const computeAutoItems = computed(() => {
|
|
95
95
|
const { vertical } = props
|
|
96
|
-
const autoItems:
|
|
96
|
+
const autoItems: VxeSplitterDefines.PaneConfig[] = []
|
|
97
97
|
let heightCount = 0
|
|
98
98
|
let widthCount = 0
|
|
99
99
|
reactData.itemList.forEach(vertical
|
|
@@ -135,17 +135,17 @@ export default defineVxeComponent({
|
|
|
135
135
|
return stys
|
|
136
136
|
})
|
|
137
137
|
|
|
138
|
-
const computeMaps:
|
|
138
|
+
const computeMaps: VxeSplitterPrivateComputed = {
|
|
139
139
|
computeItemOpts,
|
|
140
140
|
computeBarOpts,
|
|
141
141
|
computeActionOpts
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
const refMaps:
|
|
144
|
+
const refMaps: SplitterPrivateRef = {
|
|
145
145
|
refElem
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
const $
|
|
148
|
+
const $xeSplitter = {
|
|
149
149
|
xID,
|
|
150
150
|
props,
|
|
151
151
|
context,
|
|
@@ -154,10 +154,10 @@ export default defineVxeComponent({
|
|
|
154
154
|
|
|
155
155
|
getRefMaps: () => refMaps,
|
|
156
156
|
getComputeMaps: () => computeMaps
|
|
157
|
-
} as unknown as
|
|
157
|
+
} as unknown as VxeSplitterConstructor & VxeSplitterPrivateMethods
|
|
158
158
|
|
|
159
|
-
const dispatchEvent = (type: ValueOf<
|
|
160
|
-
emit(type, createEvent(evnt, { $
|
|
159
|
+
const dispatchEvent = (type: ValueOf<VxeSplitterEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
160
|
+
emit(type, createEvent(evnt, { $splitter: $xeSplitter }, params))
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
const callSlot = (slotFunc: any, params: any) => {
|
|
@@ -172,7 +172,7 @@ export default defineVxeComponent({
|
|
|
172
172
|
return []
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
const getActionIcon = (prevItem:
|
|
175
|
+
const getActionIcon = (prevItem: VxeSplitterDefines.PaneConfig, nextItem: VxeSplitterDefines.PaneConfig, isNext: boolean) => {
|
|
176
176
|
const { vertical } = props
|
|
177
177
|
const topIcon = 'SPLIT_TOP_ACTION'
|
|
178
178
|
const bottomIcon = 'SPLIT_BOTTOM_ACTION'
|
|
@@ -210,7 +210,7 @@ export default defineVxeComponent({
|
|
|
210
210
|
return nextTick()
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
const handleLoadItem = (list:
|
|
213
|
+
const handleLoadItem = (list: VxeSplitterPanelProps[], isReset: boolean) => {
|
|
214
214
|
const { staticItems } = reactData
|
|
215
215
|
const actionOpts = computeActionOpts.value
|
|
216
216
|
const { showPrevButton, showNextButton } = actionOpts
|
|
@@ -225,13 +225,13 @@ export default defineVxeComponent({
|
|
|
225
225
|
}
|
|
226
226
|
reactData.itemList = list.map(item => {
|
|
227
227
|
if (item.showAction) {
|
|
228
|
-
warnLog('vxe.error.removeProp', ['[
|
|
228
|
+
warnLog('vxe.error.removeProp', ['[splitter] show-action'])
|
|
229
229
|
}
|
|
230
230
|
if (item.slots) {
|
|
231
231
|
XEUtils.each(item.slots, (func) => {
|
|
232
232
|
if (!XEUtils.isFunction(func)) {
|
|
233
233
|
if (!slots[func]) {
|
|
234
|
-
errLog('vxe.error.notSlot', [`[
|
|
234
|
+
errLog('vxe.error.notSlot', [`[splitter] ${func}`])
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
})
|
|
@@ -241,7 +241,7 @@ export default defineVxeComponent({
|
|
|
241
241
|
})
|
|
242
242
|
})
|
|
243
243
|
if (staticItems.length) {
|
|
244
|
-
errLog('vxe.error.errConflicts', ['<vxe-
|
|
244
|
+
errLog('vxe.error.errConflicts', ['<vxe-splitter-panel ...>', 'items'])
|
|
245
245
|
}
|
|
246
246
|
if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
|
|
247
247
|
errLog('vxe.error.errConflicts', ['action-config.showPrevButton | action-config.showNextButton', 'Only supports 2 item'])
|
|
@@ -249,14 +249,81 @@ export default defineVxeComponent({
|
|
|
249
249
|
return recalculate()
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
const loadItem = (list:
|
|
252
|
+
const loadItem = (list: VxeSplitterPanelProps[]) => {
|
|
253
253
|
return handleLoadItem(list || [], false)
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
const reloadItem = (list:
|
|
256
|
+
const reloadItem = (list: VxeSplitterPanelProps[]) => {
|
|
257
257
|
return handleLoadItem(list || [], true)
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
const handleItemByName = (name: VxeSplitterPanelPropTypes.Name) => {
|
|
261
|
+
const { itemList } = reactData
|
|
262
|
+
let index = -1
|
|
263
|
+
let currItem: VxeSplitterDefines.PaneConfig | null = null
|
|
264
|
+
let prevItem: VxeSplitterDefines.PaneConfig | null = null
|
|
265
|
+
let nextItem: VxeSplitterDefines.PaneConfig | null = null
|
|
266
|
+
for (let i = 0; i < itemList.length; i++) {
|
|
267
|
+
const item = itemList[i]
|
|
268
|
+
if (item.name === name) {
|
|
269
|
+
index = i
|
|
270
|
+
currItem = item
|
|
271
|
+
prevItem = itemList[i - 1] || null
|
|
272
|
+
nextItem = itemList[i + 1] || null
|
|
273
|
+
break
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
index,
|
|
278
|
+
currItem,
|
|
279
|
+
prevItem,
|
|
280
|
+
nextItem
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const setItemExpand = (name: VxeSplitterPanelPropTypes.Name, expanded: boolean) => {
|
|
285
|
+
const restItem = handleItemByName(name)
|
|
286
|
+
if (restItem) {
|
|
287
|
+
const { currItem, prevItem, nextItem } = restItem
|
|
288
|
+
if (currItem) {
|
|
289
|
+
if (expanded ? !currItem.isExpand : currItem.isExpand) {
|
|
290
|
+
if (nextItem) {
|
|
291
|
+
if (nextItem.isExpand) {
|
|
292
|
+
handleItemActionEvent(null, currItem, nextItem, false)
|
|
293
|
+
}
|
|
294
|
+
} else if (prevItem) {
|
|
295
|
+
if (prevItem.isExpand) {
|
|
296
|
+
handleItemActionEvent(null, prevItem, currItem, true)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return nextTick()
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const toggleItemExpand = (name: VxeSplitterPanelPropTypes.Name) => {
|
|
306
|
+
const restItem = handleItemByName(name)
|
|
307
|
+
if (restItem) {
|
|
308
|
+
const { currItem } = restItem
|
|
309
|
+
if (currItem) {
|
|
310
|
+
return setItemExpand(name, !currItem.isExpand)
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return nextTick()
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const getItemExpand = (name: VxeSplitterPanelPropTypes.Name) => {
|
|
317
|
+
const restItem = handleItemByName(name)
|
|
318
|
+
if (restItem) {
|
|
319
|
+
const { currItem } = restItem
|
|
320
|
+
if (currItem) {
|
|
321
|
+
return currItem.isExpand
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return false
|
|
325
|
+
}
|
|
326
|
+
|
|
260
327
|
const recalculate = () => {
|
|
261
328
|
return nextTick().then(() => {
|
|
262
329
|
const { vertical } = props
|
|
@@ -280,7 +347,7 @@ export default defineVxeComponent({
|
|
|
280
347
|
const itemOpts = computeItemOpts.value
|
|
281
348
|
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth)
|
|
282
349
|
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight)
|
|
283
|
-
const residueItems:
|
|
350
|
+
const residueItems: VxeSplitterDefines.PaneConfig[] = []
|
|
284
351
|
if (vertical) {
|
|
285
352
|
let countHeight = 0
|
|
286
353
|
itemList.forEach(item => {
|
|
@@ -360,8 +427,8 @@ export default defineVxeComponent({
|
|
|
360
427
|
}
|
|
361
428
|
const containerRect = el.getBoundingClientRect()
|
|
362
429
|
const barRect = barEl.getBoundingClientRect()
|
|
363
|
-
const
|
|
364
|
-
const
|
|
430
|
+
const rsSplitterLineEl = refResizableSplitterTip.value
|
|
431
|
+
const rsSplitterTipEl = rsSplitterLineEl ? rsSplitterLineEl.children[0] as HTMLDivElement : null
|
|
365
432
|
const itemOpts = computeItemOpts.value
|
|
366
433
|
const resizeOpts = computeResizeOpts.value
|
|
367
434
|
const { immediate } = resizeOpts
|
|
@@ -396,11 +463,11 @@ export default defineVxeComponent({
|
|
|
396
463
|
let offsetTop = startOffsetTop
|
|
397
464
|
|
|
398
465
|
const handleReStyle = (evnt: MouseEvent) => {
|
|
399
|
-
if (!
|
|
466
|
+
if (!rsSplitterLineEl) {
|
|
400
467
|
return
|
|
401
468
|
}
|
|
402
|
-
const rsNumPrevEl =
|
|
403
|
-
const rsNumNextEl =
|
|
469
|
+
const rsNumPrevEl = rsSplitterTipEl ? rsSplitterTipEl.children[0] as HTMLDivElement : null
|
|
470
|
+
const rsNumNextEl = rsSplitterTipEl ? rsSplitterTipEl.children[1] as HTMLDivElement : null
|
|
404
471
|
if (vertical) {
|
|
405
472
|
let tipWidth = 0
|
|
406
473
|
if (rsNumPrevEl) {
|
|
@@ -425,10 +492,10 @@ export default defineVxeComponent({
|
|
|
425
492
|
if (rsLeft > containerRect.width - tipWidth - 1) {
|
|
426
493
|
rsLeft = containerRect.width - tipWidth - 1
|
|
427
494
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
if (
|
|
431
|
-
|
|
495
|
+
rsSplitterLineEl.style.left = '0'
|
|
496
|
+
rsSplitterLineEl.style.top = `${offsetTop}px`
|
|
497
|
+
if (rsSplitterTipEl) {
|
|
498
|
+
rsSplitterTipEl.style.left = `${rsLeft}px`
|
|
432
499
|
}
|
|
433
500
|
} else {
|
|
434
501
|
let tipHeight = 0
|
|
@@ -454,10 +521,10 @@ export default defineVxeComponent({
|
|
|
454
521
|
if (rsTop > containerRect.height - tipHeight - 1) {
|
|
455
522
|
rsTop = containerRect.height - tipHeight - 1
|
|
456
523
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
if (
|
|
460
|
-
|
|
524
|
+
rsSplitterLineEl.style.top = '0'
|
|
525
|
+
rsSplitterLineEl.style.left = `${offsetLeft}px`
|
|
526
|
+
if (rsSplitterTipEl) {
|
|
527
|
+
rsSplitterTipEl.style.top = `${rsTop}px`
|
|
461
528
|
}
|
|
462
529
|
}
|
|
463
530
|
}
|
|
@@ -505,7 +572,7 @@ export default defineVxeComponent({
|
|
|
505
572
|
nextEl.style.width = toCssUnit(nextResizeWidth)
|
|
506
573
|
}
|
|
507
574
|
}
|
|
508
|
-
if (
|
|
575
|
+
if (rsSplitterLineEl) {
|
|
509
576
|
handleReStyle(evnt)
|
|
510
577
|
}
|
|
511
578
|
dispatchEvent('resize-drag', { prevItem, nextItem, offsetHeight: targetOffsetHeight, offsetWidth: targetOffsetWidth }, evnt)
|
|
@@ -518,8 +585,8 @@ export default defineVxeComponent({
|
|
|
518
585
|
document.onmouseup = (evnt) => {
|
|
519
586
|
document.onmousemove = null
|
|
520
587
|
document.onmouseup = null
|
|
521
|
-
if (
|
|
522
|
-
|
|
588
|
+
if (rsSplitterLineEl) {
|
|
589
|
+
rsSplitterLineEl.style.display = ''
|
|
523
590
|
}
|
|
524
591
|
handleUpdate()
|
|
525
592
|
removeClass(el, 'is--drag')
|
|
@@ -527,8 +594,8 @@ export default defineVxeComponent({
|
|
|
527
594
|
recalculate()
|
|
528
595
|
}
|
|
529
596
|
|
|
530
|
-
if (
|
|
531
|
-
|
|
597
|
+
if (rsSplitterLineEl) {
|
|
598
|
+
rsSplitterLineEl.style.display = 'block'
|
|
532
599
|
handleReStyle(evnt)
|
|
533
600
|
}
|
|
534
601
|
handleDrag(evnt)
|
|
@@ -536,7 +603,7 @@ export default defineVxeComponent({
|
|
|
536
603
|
dispatchEvent('resize-start', { prevItem, nextItem }, evnt)
|
|
537
604
|
}
|
|
538
605
|
|
|
539
|
-
const handleItemActionEvent = (evnt: MouseEvent, prevItem:
|
|
606
|
+
const handleItemActionEvent = (evnt: MouseEvent | null, prevItem: VxeSplitterDefines.PaneConfig, nextItem: VxeSplitterDefines.PaneConfig, isNext: boolean) => {
|
|
540
607
|
const { vertical } = props
|
|
541
608
|
let expanded = false
|
|
542
609
|
let item = prevItem
|
|
@@ -571,7 +638,9 @@ export default defineVxeComponent({
|
|
|
571
638
|
nextItem.foldWidth = (prevItem.resizeWidth || prevItem.renderWidth) + (nextItem.resizeWidth || nextItem.renderWidth)
|
|
572
639
|
}
|
|
573
640
|
}
|
|
574
|
-
|
|
641
|
+
if (evnt) {
|
|
642
|
+
dispatchEvent('toggle-expand', { prevItem, nextItem, expanded, item }, evnt)
|
|
643
|
+
}
|
|
575
644
|
recalculate()
|
|
576
645
|
}
|
|
577
646
|
|
|
@@ -663,20 +732,23 @@ export default defineVxeComponent({
|
|
|
663
732
|
recalculate()
|
|
664
733
|
}
|
|
665
734
|
|
|
666
|
-
const
|
|
735
|
+
const splitterMethods: SplitterMethods = {
|
|
667
736
|
dispatchEvent,
|
|
737
|
+
setItemExpand,
|
|
738
|
+
toggleItemExpand,
|
|
739
|
+
getItemExpand,
|
|
668
740
|
recalculate,
|
|
669
741
|
reset,
|
|
670
742
|
loadItem,
|
|
671
743
|
reloadItem
|
|
672
744
|
}
|
|
673
745
|
|
|
674
|
-
const
|
|
746
|
+
const splitterPrivateMethods: SplitterPrivateMethods = {
|
|
675
747
|
}
|
|
676
748
|
|
|
677
|
-
Object.assign($
|
|
749
|
+
Object.assign($xeSplitter, splitterMethods, splitterPrivateMethods)
|
|
678
750
|
|
|
679
|
-
const renderHandleBar = (prevItem:
|
|
751
|
+
const renderHandleBar = (prevItem: VxeSplitterDefines.PaneConfig, nextItem: VxeSplitterDefines.PaneConfig) => {
|
|
680
752
|
const { border, resize, vertical } = props
|
|
681
753
|
const { itemList } = reactData
|
|
682
754
|
const barStyle = computeBarStyle.value
|
|
@@ -687,23 +759,23 @@ export default defineVxeComponent({
|
|
|
687
759
|
const resizeOpts = computeResizeOpts.value
|
|
688
760
|
const { immediate } = resizeOpts
|
|
689
761
|
return h('div', {
|
|
690
|
-
class: ['vxe-
|
|
762
|
+
class: ['vxe-splitter-panel-handle', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
691
763
|
'is--resize': resize,
|
|
692
764
|
'is--border': border
|
|
693
765
|
}]
|
|
694
766
|
}, [
|
|
695
767
|
h('div', {
|
|
696
|
-
class: 'vxe-
|
|
768
|
+
class: 'vxe-splitter-panel-handle-bar',
|
|
697
769
|
style: barStyle,
|
|
698
770
|
onMousedown: dragEvent
|
|
699
771
|
}),
|
|
700
772
|
itemList.length === 2
|
|
701
773
|
? h('div', {
|
|
702
|
-
class: 'vxe-
|
|
774
|
+
class: 'vxe-splitter-panel-action-btn-wrapper'
|
|
703
775
|
}, [
|
|
704
776
|
showPrevButton && nextItem.isExpand
|
|
705
777
|
? h('div', {
|
|
706
|
-
class: 'vxe-
|
|
778
|
+
class: 'vxe-splitter-panel-action-btn',
|
|
707
779
|
onDblclick: handlePrevActionDblclickEvent,
|
|
708
780
|
onClick: handlePrevActionClickEvent
|
|
709
781
|
}, [
|
|
@@ -711,10 +783,10 @@ export default defineVxeComponent({
|
|
|
711
783
|
class: getActionIcon(prevItem, nextItem, false)
|
|
712
784
|
})
|
|
713
785
|
])
|
|
714
|
-
: renderEmptyElement($
|
|
786
|
+
: renderEmptyElement($xeSplitter),
|
|
715
787
|
showNextButton && prevItem.isExpand
|
|
716
788
|
? h('div', {
|
|
717
|
-
class: 'vxe-
|
|
789
|
+
class: 'vxe-splitter-panel-action-btn',
|
|
718
790
|
onDblclick: handleNextActionDblclickEvent,
|
|
719
791
|
onClick: handleNextActionClickEvent
|
|
720
792
|
}, [
|
|
@@ -722,9 +794,9 @@ export default defineVxeComponent({
|
|
|
722
794
|
class: getActionIcon(prevItem, nextItem, true)
|
|
723
795
|
})
|
|
724
796
|
])
|
|
725
|
-
: renderEmptyElement($
|
|
797
|
+
: renderEmptyElement($xeSplitter)
|
|
726
798
|
])
|
|
727
|
-
: renderEmptyElement($
|
|
799
|
+
: renderEmptyElement($xeSplitter)
|
|
728
800
|
])
|
|
729
801
|
}
|
|
730
802
|
|
|
@@ -772,7 +844,7 @@ export default defineVxeComponent({
|
|
|
772
844
|
itemVNs.push(
|
|
773
845
|
h('div', {
|
|
774
846
|
itemid: id,
|
|
775
|
-
class: ['vxe-
|
|
847
|
+
class: ['vxe-splitter-panel', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
776
848
|
[`size--${vSize}`]: vSize,
|
|
777
849
|
'is--resize': resize,
|
|
778
850
|
'is--padding': padding,
|
|
@@ -787,10 +859,10 @@ export default defineVxeComponent({
|
|
|
787
859
|
}, [
|
|
788
860
|
h('div', {
|
|
789
861
|
itemid: id,
|
|
790
|
-
class: 'vxe-
|
|
862
|
+
class: 'vxe-splitter-panel--wrapper'
|
|
791
863
|
}, [
|
|
792
864
|
h('div', {
|
|
793
|
-
class: 'vxe-
|
|
865
|
+
class: 'vxe-splitter-panel--inner'
|
|
794
866
|
}, defaultSlot ? callSlot(defaultSlot, { name, isExpand }) : [])
|
|
795
867
|
])
|
|
796
868
|
])
|
|
@@ -801,7 +873,7 @@ export default defineVxeComponent({
|
|
|
801
873
|
}
|
|
802
874
|
})
|
|
803
875
|
return h('div', {
|
|
804
|
-
class: 'vxe-
|
|
876
|
+
class: 'vxe-splitter-wrapper'
|
|
805
877
|
}, itemVNs)
|
|
806
878
|
}
|
|
807
879
|
|
|
@@ -820,38 +892,38 @@ export default defineVxeComponent({
|
|
|
820
892
|
}
|
|
821
893
|
return h('div', {
|
|
822
894
|
ref: refElem,
|
|
823
|
-
class: ['vxe-
|
|
895
|
+
class: ['vxe-splitter', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy', {
|
|
824
896
|
[`size--${vSize}`]: vSize
|
|
825
897
|
}],
|
|
826
898
|
style: stys
|
|
827
899
|
}, [
|
|
828
900
|
h('div', {
|
|
829
|
-
class: 'vxe-
|
|
901
|
+
class: 'vxe-splitter-slots'
|
|
830
902
|
}, defaultSlot ? defaultSlot({}) : []),
|
|
831
903
|
renderItems(),
|
|
832
904
|
h('div', {
|
|
833
|
-
ref:
|
|
834
|
-
class: ['vxe-
|
|
905
|
+
ref: refResizableSplitterTip,
|
|
906
|
+
class: ['vxe-splitter--resizable-splitter-tip', vertical ? 'is--vertical' : 'is--horizontal', immediate ? 'is-resize--immediate' : 'is-resize--lazy']
|
|
835
907
|
}, showTip
|
|
836
908
|
? [
|
|
837
909
|
h('div', {
|
|
838
|
-
class: 'vxe-
|
|
910
|
+
class: 'vxe-splitter--resizable-splitter-tip-number'
|
|
839
911
|
}, [
|
|
840
912
|
h('div', {
|
|
841
|
-
class: 'vxe-
|
|
913
|
+
class: 'vxe-splitter--resizable-splitter-number-prev'
|
|
842
914
|
}),
|
|
843
915
|
h('div', {
|
|
844
|
-
class: 'vxe-
|
|
916
|
+
class: 'vxe-splitter--resizable-splitter-number-next'
|
|
845
917
|
})
|
|
846
918
|
])
|
|
847
919
|
]
|
|
848
920
|
: []),
|
|
849
921
|
h('div', {
|
|
850
|
-
class: 'vxe-
|
|
922
|
+
class: 'vxe-splitter--render-vars'
|
|
851
923
|
}, [
|
|
852
924
|
h('div', {
|
|
853
925
|
ref: refBarInfoElem,
|
|
854
|
-
class: 'vxe-
|
|
926
|
+
class: 'vxe-splitter--handle-bar-info'
|
|
855
927
|
})
|
|
856
928
|
])
|
|
857
929
|
])
|
|
@@ -872,16 +944,16 @@ export default defineVxeComponent({
|
|
|
872
944
|
const actionOpts = computeActionOpts.value
|
|
873
945
|
const { showPrevButton, showNextButton } = actionOpts
|
|
874
946
|
if (props.items && props.items.length) {
|
|
875
|
-
errLog('vxe.error.errConflicts', ['<vxe-
|
|
947
|
+
errLog('vxe.error.errConflicts', ['<vxe-splitter-panel ...>', 'items'])
|
|
876
948
|
}
|
|
877
949
|
reactData.itemList = val || []
|
|
878
950
|
|
|
879
951
|
if ((showPrevButton || showNextButton) && reactData.itemList.length > 2) {
|
|
880
|
-
errLog('vxe.error.modelConflicts', ['[
|
|
952
|
+
errLog('vxe.error.modelConflicts', ['[splitter] action-config.showPrevButton | action-config.showNextButton', '<vxe-splitter-panel ...> Only supports 2 panel'])
|
|
881
953
|
}
|
|
882
954
|
reactData.itemList.forEach(item => {
|
|
883
955
|
if (item.showAction) {
|
|
884
|
-
warnLog('vxe.error.removeProp', ['[
|
|
956
|
+
warnLog('vxe.error.removeProp', ['[splitter] showAction'])
|
|
885
957
|
}
|
|
886
958
|
})
|
|
887
959
|
recalculate()
|
|
@@ -904,17 +976,17 @@ export default defineVxeComponent({
|
|
|
904
976
|
|
|
905
977
|
const actionOpts = computeActionOpts.value
|
|
906
978
|
if (actionOpts.direction) {
|
|
907
|
-
errLog('vxe.error.delProp', ['[
|
|
979
|
+
errLog('vxe.error.delProp', ['[splitter] action-config.direction', 'action-config.showPrevButton | action-config.showNextButton'])
|
|
908
980
|
}
|
|
909
981
|
|
|
910
|
-
globalEvents.on($
|
|
982
|
+
globalEvents.on($xeSplitter, 'resize', handleGlobalResizeEvent)
|
|
911
983
|
})
|
|
912
984
|
|
|
913
985
|
onUnmounted(() => {
|
|
914
986
|
if (resizeObserver) {
|
|
915
987
|
resizeObserver.disconnect()
|
|
916
988
|
}
|
|
917
|
-
globalEvents.off($
|
|
989
|
+
globalEvents.off($xeSplitter, 'resize')
|
|
918
990
|
})
|
|
919
991
|
|
|
920
992
|
onActivated(() => {
|
|
@@ -925,11 +997,11 @@ export default defineVxeComponent({
|
|
|
925
997
|
loadItem(props.items)
|
|
926
998
|
}
|
|
927
999
|
|
|
928
|
-
provide('$
|
|
1000
|
+
provide('$xeSplitter', $xeSplitter)
|
|
929
1001
|
|
|
930
|
-
$
|
|
1002
|
+
$xeSplitter.renderVN = renderVN
|
|
931
1003
|
|
|
932
|
-
return $
|
|
1004
|
+
return $xeSplitter
|
|
933
1005
|
},
|
|
934
1006
|
render () {
|
|
935
1007
|
return this.renderVN()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
import type { VxeSplitterConstructor, VxeSplitterPrivateMethods, VxeSplitterDefines } from '../../../types'
|
|
4
|
+
|
|
5
|
+
export function assembleSplitterItem ($xeSplitter: VxeSplitterConstructor & VxeSplitterPrivateMethods, elem: HTMLElement, paneConfig: VxeSplitterDefines.PaneConfig) {
|
|
6
|
+
const staticItems = $xeSplitter.reactData.staticItems
|
|
7
|
+
const parentElem = elem.parentNode
|
|
8
|
+
if (parentElem) {
|
|
9
|
+
staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, paneConfig)
|
|
10
|
+
$xeSplitter.reactData.staticItems = staticItems.slice(0)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function destroySplitterItem ($xeSplitter: VxeSplitterConstructor & VxeSplitterPrivateMethods, paneConfig: VxeSplitterDefines.PaneConfig) {
|
|
15
|
+
const staticItems = $xeSplitter.reactData.staticItems
|
|
16
|
+
const index = XEUtils.findIndexOf(staticItems, item => item.id === paneConfig.id)
|
|
17
|
+
if (index > -1) {
|
|
18
|
+
staticItems.splice(index, 1)
|
|
19
|
+
}
|
|
20
|
+
$xeSplitter.reactData.staticItems = staticItems.slice(0)
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
+
import VxeSplitterPanelComponent from '../splitter/src/splitter-panel'
|
|
4
|
+
import { dynamicApp } from '../dynamics'
|
|
5
|
+
|
|
6
|
+
export const VxeSplitterPanel = Object.assign({}, VxeSplitterPanelComponent, {
|
|
7
|
+
install (app: App) {
|
|
8
|
+
app.component(VxeSplitterPanelComponent.name as string, VxeSplitterPanelComponent)
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
dynamicApp.use(VxeSplitterPanel)
|
|
13
|
+
VxeUI.component(VxeSplitterPanelComponent)
|
|
14
|
+
|
|
15
|
+
export const SplitterPanel = VxeSplitterPanel
|
|
16
|
+
export default VxeSplitterPanel
|
package/packages/ui/index.ts
CHANGED
|
@@ -309,7 +309,7 @@ setConfig({
|
|
|
309
309
|
oSize: 2
|
|
310
310
|
}
|
|
311
311
|
},
|
|
312
|
-
|
|
312
|
+
splitter: {
|
|
313
313
|
resize: true,
|
|
314
314
|
itemConfig: {
|
|
315
315
|
minWidth: 40,
|
|
@@ -320,7 +320,7 @@ setConfig({
|
|
|
320
320
|
showTip: true
|
|
321
321
|
}
|
|
322
322
|
},
|
|
323
|
-
|
|
323
|
+
splitterPanel: {},
|
|
324
324
|
slider: {
|
|
325
325
|
max: 100,
|
|
326
326
|
min: 0
|