vxe-pc-ui 4.4.26 → 4.5.1
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/col/style.css +0 -105
- package/es/col/style.min.css +0 -1
- package/es/components.js +6 -0
- package/es/icon/style.css +1 -1
- package/es/modal/src/modal.js +2 -4
- package/es/row/style.css +106 -0
- package/es/row/style.min.css +1 -1
- package/es/split/index.js +12 -0
- package/es/split/src/split-item.js +93 -0
- package/es/split/src/split.js +302 -0
- package/es/split/src/util.js +17 -0
- package/es/split/style.css +91 -0
- package/es/split/style.min.css +1 -0
- package/es/split-item/index.js +12 -0
- package/es/split-item/style.css +0 -0
- package/es/split-item/style.min.css +0 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +8 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +6 -0
- package/es/vxe-col/style.css +0 -105
- package/es/vxe-col/style.min.css +0 -1
- package/es/vxe-row/style.css +106 -0
- package/es/vxe-row/style.min.css +1 -1
- package/es/vxe-split/index.js +3 -0
- package/es/vxe-split/style.css +91 -0
- package/es/vxe-split/style.min.css +1 -0
- package/es/vxe-split-item/index.js +3 -0
- package/es/vxe-split-item/style.css +0 -0
- package/es/vxe-split-item/style.min.css +0 -0
- package/lib/col/style/style.css +0 -105
- package/lib/col/style/style.min.css +0 -1
- 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 +491 -7
- package/lib/index.umd.min.js +1 -1
- package/lib/modal/src/modal.js +2 -4
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/row/style/style.css +106 -0
- package/lib/row/style/style.min.css +1 -1
- package/lib/split/index.js +19 -0
- package/lib/split/index.min.js +1 -0
- package/lib/split/src/split-item.js +105 -0
- package/lib/split/src/split-item.min.js +1 -0
- package/lib/split/src/split.js +323 -0
- package/lib/split/src/split.min.js +1 -0
- package/lib/split/src/util.js +25 -0
- package/lib/split/src/util.min.js +1 -0
- package/lib/split/style/index.js +1 -0
- package/lib/split/style/style.css +91 -0
- package/lib/split/style/style.min.css +1 -0
- package/lib/split-item/index.js +19 -0
- package/lib/split-item/index.min.js +1 -0
- package/lib/split-item/style/index.js +1 -0
- package/lib/split-item/style/style.css +0 -0
- package/lib/split-item/style/style.min.css +0 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +8 -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/ui/src/utils.js +7 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/vxe-col/style/style.css +0 -105
- package/lib/vxe-col/style/style.min.css +0 -1
- package/lib/vxe-row/style/style.css +106 -0
- package/lib/vxe-row/style/style.min.css +1 -1
- package/lib/vxe-split/index.js +22 -0
- package/lib/vxe-split/index.min.js +1 -0
- package/lib/vxe-split/style/index.js +1 -0
- package/lib/vxe-split/style/style.css +91 -0
- package/lib/vxe-split/style/style.min.css +1 -0
- package/lib/vxe-split-item/index.js +22 -0
- package/lib/vxe-split-item/index.min.js +1 -0
- package/lib/vxe-split-item/style/index.js +1 -0
- package/lib/vxe-split-item/style/style.css +0 -0
- package/lib/vxe-split-item/style/style.min.css +0 -0
- package/package.json +2 -2
- package/packages/components.ts +6 -0
- package/packages/modal/src/modal.ts +2 -4
- package/packages/row/src/col.ts +5 -5
- package/packages/split/index.ts +16 -0
- package/packages/split/src/split-item.ts +125 -0
- package/packages/split/src/split.ts +325 -0
- package/packages/split/src/util.ts +21 -0
- package/packages/split-item/index.ts +16 -0
- package/packages/ui/index.ts +7 -0
- package/packages/ui/src/utils.ts +7 -0
- package/styles/all.scss +2 -0
- package/styles/components/col.scss +0 -61
- package/styles/components/row.scss +59 -0
- package/styles/components/split-item.scss +0 -0
- package/styles/components/split.scss +106 -0
- package/styles/helpers/baseVar.scss +4 -0
- package/styles/theme/base.scss +5 -1
- package/styles/theme/dark.scss +3 -0
- package/styles/theme/light.scss +3 -0
- package/styles/variable.scss +4 -0
- package/types/all.d.ts +6 -0
- package/types/components/col.d.ts +11 -1
- package/types/components/split-item.d.ts +89 -0
- package/types/components/split.d.ts +100 -0
- package/types/components/table-plugins/extend-cell-area.d.ts +54 -0
- package/types/components/table.d.ts +131 -11
- package/types/ui/global-config.d.ts +4 -0
- /package/es/icon/{iconfont.1742955913094.ttf → iconfont.1743051559265.ttf} +0 -0
- /package/es/icon/{iconfont.1742955913094.woff → iconfont.1743051559265.woff} +0 -0
- /package/es/icon/{iconfont.1742955913094.woff2 → iconfont.1743051559265.woff2} +0 -0
- /package/es/{iconfont.1742955913094.ttf → iconfont.1743051559265.ttf} +0 -0
- /package/es/{iconfont.1742955913094.woff → iconfont.1743051559265.woff} +0 -0
- /package/es/{iconfont.1742955913094.woff2 → iconfont.1743051559265.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1742955913094.ttf → iconfont.1743051559265.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1742955913094.woff → iconfont.1743051559265.woff} +0 -0
- /package/lib/icon/style/{iconfont.1742955913094.woff2 → iconfont.1743051559265.woff2} +0 -0
- /package/lib/{iconfont.1742955913094.ttf → iconfont.1743051559265.ttf} +0 -0
- /package/lib/{iconfont.1742955913094.woff → iconfont.1743051559265.woff} +0 -0
- /package/lib/{iconfont.1742955913094.woff2 → iconfont.1743051559265.woff2} +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { defineComponent, PropType, ref, h, reactive, watch, provide, inject, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import { createEvent } from '../../ui'
|
|
3
|
+
import { assembleSplitItem, destroySplitItem } from './util'
|
|
4
|
+
import XEUtils from 'xe-utils'
|
|
5
|
+
|
|
6
|
+
import type { SplitItemReactData, VxeSplitItemPropTypes, SplitItemPrivateRef, SplitItemInternalData, SplitItemMethods, VxeSplitItemPrivateComputed, SplitItemPrivateMethods, VxeSplitItemEmits, VxeSplitItemConstructor, ValueOf, VxeSplitDefines, VxeSplitItemPrivateMethods, VxeSplitConstructor, VxeSplitPrivateMethods } from '../../../types'
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'VxeSplitItem',
|
|
10
|
+
props: {
|
|
11
|
+
width: [Number, String] as PropType<VxeSplitItemPropTypes.Width>,
|
|
12
|
+
height: [Number, String] as PropType<VxeSplitItemPropTypes.Height>,
|
|
13
|
+
minWidth: {
|
|
14
|
+
type: [Number, String] as PropType<VxeSplitItemPropTypes.MinWidth>,
|
|
15
|
+
default: () => null
|
|
16
|
+
},
|
|
17
|
+
minHeight: {
|
|
18
|
+
type: [Number, String] as PropType<VxeSplitItemPropTypes.MinHeight>,
|
|
19
|
+
default: () => null
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
emits: [
|
|
23
|
+
] as VxeSplitItemEmits,
|
|
24
|
+
setup (props, context) {
|
|
25
|
+
const { emit, slots } = context
|
|
26
|
+
|
|
27
|
+
const xID = XEUtils.uniqueId()
|
|
28
|
+
|
|
29
|
+
const $xeSplit = inject<(VxeSplitConstructor & VxeSplitPrivateMethods) | null>('$xeSplit', null)
|
|
30
|
+
|
|
31
|
+
const refElem = ref<HTMLDivElement>()
|
|
32
|
+
|
|
33
|
+
const chunkConfig = reactive<VxeSplitDefines.ChunkConfig>({
|
|
34
|
+
id: xID,
|
|
35
|
+
width: props.width,
|
|
36
|
+
height: props.height,
|
|
37
|
+
minWidth: props.minWidth,
|
|
38
|
+
minHeight: props.minHeight,
|
|
39
|
+
renderWidth: 0,
|
|
40
|
+
renderHeight: 0,
|
|
41
|
+
slots: slots
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const reactData = reactive<SplitItemReactData>({
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const internalData: SplitItemInternalData = {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const computeMaps: VxeSplitItemPrivateComputed = {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const refMaps: SplitItemPrivateRef = {
|
|
54
|
+
refElem
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const $xeSplitItem = {
|
|
58
|
+
xID,
|
|
59
|
+
props,
|
|
60
|
+
context,
|
|
61
|
+
reactData,
|
|
62
|
+
internalData,
|
|
63
|
+
|
|
64
|
+
getRefMaps: () => refMaps,
|
|
65
|
+
getComputeMaps: () => computeMaps
|
|
66
|
+
} as unknown as VxeSplitItemConstructor & VxeSplitItemPrivateMethods
|
|
67
|
+
|
|
68
|
+
const dispatchEvent = (type: ValueOf<VxeSplitItemEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
69
|
+
emit(type, createEvent(evnt, { $splitItem: $xeSplitItem }, params))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const splitItemMethods: SplitItemMethods = {
|
|
73
|
+
dispatchEvent
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const splitItemPrivateMethods: SplitItemPrivateMethods = {
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Object.assign($xeSplitItem, splitItemMethods, splitItemPrivateMethods)
|
|
80
|
+
|
|
81
|
+
const renderVN = () => {
|
|
82
|
+
return h('div', {
|
|
83
|
+
ref: refElem
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
watch(() => props.width, (val) => {
|
|
88
|
+
chunkConfig.width = val
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
watch(() => props.height, (val) => {
|
|
92
|
+
chunkConfig.height = val
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
watch(() => props.minWidth, (val) => {
|
|
96
|
+
chunkConfig.minWidth = val
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
watch(() => props.minHeight, (val) => {
|
|
100
|
+
chunkConfig.minHeight = val
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
onMounted(() => {
|
|
104
|
+
const elem = refElem.value
|
|
105
|
+
if ($xeSplit && elem) {
|
|
106
|
+
assembleSplitItem($xeSplit, elem, chunkConfig)
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
onUnmounted(() => {
|
|
111
|
+
if ($xeSplit) {
|
|
112
|
+
destroySplitItem($xeSplit, chunkConfig)
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
provide('$xeSplitItem', $xeSplitItem)
|
|
117
|
+
|
|
118
|
+
$xeSplitItem.renderVN = renderVN
|
|
119
|
+
|
|
120
|
+
return $xeSplitItem
|
|
121
|
+
},
|
|
122
|
+
render () {
|
|
123
|
+
return this.renderVN()
|
|
124
|
+
}
|
|
125
|
+
})
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { defineComponent, PropType, ref, h, reactive, provide, VNode, computed, watch, nextTick, onMounted, onActivated } from 'vue'
|
|
2
|
+
import { getConfig, createEvent, renderEmptyElement } from '../../ui'
|
|
3
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
4
|
+
import { toCssUnit, isScale, addClass, removeClass } from '../../ui/src/dom'
|
|
5
|
+
import { getGlobalDefaultConfig } from '../../ui/src/utils'
|
|
6
|
+
import XEUtils from 'xe-utils'
|
|
7
|
+
|
|
8
|
+
import type { SplitReactData, SplitPrivateRef, VxeSplitPropTypes, SplitInternalData, SplitMethods, VxeSplitDefines, VxeSplitPrivateComputed, SplitPrivateMethods, VxeSplitEmits, VxeSplitConstructor, ValueOf, VxeSplitPrivateMethods } from '../../../types'
|
|
9
|
+
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: 'VxeSplit',
|
|
12
|
+
props: {
|
|
13
|
+
width: [Number, String] as PropType<VxeSplitPropTypes.Width>,
|
|
14
|
+
height: [Number, String] as PropType<VxeSplitPropTypes.Height>,
|
|
15
|
+
vertical: {
|
|
16
|
+
type: Boolean as PropType<VxeSplitPropTypes.Vertical>,
|
|
17
|
+
default: () => getConfig().split.vertical
|
|
18
|
+
},
|
|
19
|
+
border: {
|
|
20
|
+
type: Boolean as PropType<VxeSplitPropTypes.Border>,
|
|
21
|
+
default: () => getConfig().split.border
|
|
22
|
+
},
|
|
23
|
+
itemConfig: Object as PropType<VxeSplitPropTypes.ItemConfig>
|
|
24
|
+
},
|
|
25
|
+
emits: [
|
|
26
|
+
] as VxeSplitEmits,
|
|
27
|
+
setup (props, context) {
|
|
28
|
+
const { emit, slots } = context
|
|
29
|
+
|
|
30
|
+
const xID = XEUtils.uniqueId()
|
|
31
|
+
|
|
32
|
+
const refElem = ref<HTMLDivElement>()
|
|
33
|
+
|
|
34
|
+
const reactData = reactive<SplitReactData>({
|
|
35
|
+
staticItems: []
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const internalData: SplitInternalData = {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const computeItemOpts = computed(() => {
|
|
42
|
+
return Object.assign({}, getConfig().split.itemConfig, props.itemConfig)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const computeMaps: VxeSplitPrivateComputed = {
|
|
46
|
+
computeItemOpts
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const refMaps: SplitPrivateRef = {
|
|
50
|
+
refElem
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const $xeSplit = {
|
|
54
|
+
xID,
|
|
55
|
+
props,
|
|
56
|
+
context,
|
|
57
|
+
reactData,
|
|
58
|
+
internalData,
|
|
59
|
+
|
|
60
|
+
getRefMaps: () => refMaps,
|
|
61
|
+
getComputeMaps: () => computeMaps
|
|
62
|
+
} as unknown as VxeSplitConstructor & VxeSplitPrivateMethods
|
|
63
|
+
|
|
64
|
+
const dispatchEvent = (type: ValueOf<VxeSplitEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
65
|
+
emit(type, createEvent(evnt, { $split: $xeSplit }, params))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const callSlot = (slotFunc: any, params: any) => {
|
|
69
|
+
if (slotFunc) {
|
|
70
|
+
if (XEUtils.isString(slotFunc)) {
|
|
71
|
+
slotFunc = slots[slotFunc] || null
|
|
72
|
+
}
|
|
73
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
74
|
+
return getSlotVNs(slotFunc(params))
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return []
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const recalculate = () => {
|
|
81
|
+
return nextTick().then(() => {
|
|
82
|
+
const { vertical } = props
|
|
83
|
+
const { staticItems } = reactData
|
|
84
|
+
const el = refElem.value
|
|
85
|
+
if (!el) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
const wrapperWidth = el.clientWidth
|
|
89
|
+
const wrapperHeight = el.clientHeight
|
|
90
|
+
if (!wrapperWidth || !wrapperHeight) {
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
const itemOpts = computeItemOpts.value
|
|
94
|
+
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth)
|
|
95
|
+
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight)
|
|
96
|
+
const residueItems: VxeSplitDefines.ChunkConfig[] = []
|
|
97
|
+
if (vertical) {
|
|
98
|
+
let countHeight = 0
|
|
99
|
+
staticItems.forEach(item => {
|
|
100
|
+
const { height } = item
|
|
101
|
+
let itemHeight = 0
|
|
102
|
+
if (height) {
|
|
103
|
+
if (isScale(height)) {
|
|
104
|
+
itemHeight = wrapperHeight * XEUtils.toNumber(height)
|
|
105
|
+
} else {
|
|
106
|
+
itemHeight = XEUtils.toNumber(height)
|
|
107
|
+
}
|
|
108
|
+
item.renderHeight = itemHeight
|
|
109
|
+
} else {
|
|
110
|
+
residueItems.push(item)
|
|
111
|
+
}
|
|
112
|
+
countHeight += itemHeight
|
|
113
|
+
})
|
|
114
|
+
if (residueItems.length) {
|
|
115
|
+
const reMeanHeight = (wrapperHeight - countHeight) / residueItems.length
|
|
116
|
+
residueItems.forEach(item => {
|
|
117
|
+
item.renderHeight = Math.max(XEUtils.toNumber(getGlobalDefaultConfig(item.minHeight, allMinHeight)), reMeanHeight)
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
let countWidth = 0
|
|
122
|
+
staticItems.forEach(item => {
|
|
123
|
+
const { width } = item
|
|
124
|
+
let itemWidth = 0
|
|
125
|
+
if (width) {
|
|
126
|
+
if (isScale(width)) {
|
|
127
|
+
itemWidth = wrapperWidth * XEUtils.toNumber(width)
|
|
128
|
+
} else {
|
|
129
|
+
itemWidth = XEUtils.toNumber(width)
|
|
130
|
+
}
|
|
131
|
+
item.renderWidth = itemWidth
|
|
132
|
+
} else {
|
|
133
|
+
residueItems.push(item)
|
|
134
|
+
}
|
|
135
|
+
countWidth += itemWidth
|
|
136
|
+
})
|
|
137
|
+
if (residueItems.length) {
|
|
138
|
+
const reMeanWidth = (wrapperWidth - countWidth) / residueItems.length
|
|
139
|
+
residueItems.forEach(item => {
|
|
140
|
+
item.renderWidth = Math.max(XEUtils.toNumber(getGlobalDefaultConfig(item.minWidth, allMinWidth)), reMeanWidth)
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const dragEvent = (evnt: MouseEvent) => {
|
|
148
|
+
evnt.preventDefault()
|
|
149
|
+
const { vertical } = props
|
|
150
|
+
const { staticItems } = reactData
|
|
151
|
+
const handleEl = evnt.currentTarget as HTMLDivElement
|
|
152
|
+
const el = refElem.value
|
|
153
|
+
if (!el) {
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
const itemId = handleEl.getAttribute('xid')
|
|
157
|
+
const itemIndex = XEUtils.findIndexOf(staticItems, item => item.id === itemId)
|
|
158
|
+
const item = staticItems[itemIndex]
|
|
159
|
+
if (!item) {
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
const itemOpts = computeItemOpts.value
|
|
163
|
+
const allMinWidth = XEUtils.toNumber(itemOpts.minWidth)
|
|
164
|
+
const allMinHeight = XEUtils.toNumber(itemOpts.minHeight)
|
|
165
|
+
const prevItem = staticItems[itemIndex - 1]
|
|
166
|
+
const prevItemEl = prevItem ? el.querySelector<HTMLDivElement>(`.vxe-split-item[xid="${prevItem.id}"]`) : null
|
|
167
|
+
const currItemEl = item ? el.querySelector<HTMLDivElement>(`.vxe-split-item[xid="${item.id}"]`) : null
|
|
168
|
+
const prevWidth = prevItemEl ? prevItemEl.clientWidth : 0
|
|
169
|
+
const currWidth = currItemEl ? currItemEl.clientWidth : 0
|
|
170
|
+
const prevHeight = prevItemEl ? prevItemEl.clientHeight : 0
|
|
171
|
+
const currHeight = currItemEl ? currItemEl.clientHeight : 0
|
|
172
|
+
const prevMinWidth = XEUtils.toNumber(prevItem ? getGlobalDefaultConfig(prevItem.minWidth, allMinWidth) : allMinWidth)
|
|
173
|
+
const currMinWidth = XEUtils.toNumber(getGlobalDefaultConfig(item.minWidth, allMinWidth))
|
|
174
|
+
const prevMinHeight = XEUtils.toNumber(prevItem ? getGlobalDefaultConfig(prevItem.minHeight, allMinHeight) : allMinHeight)
|
|
175
|
+
const currMinHeight = XEUtils.toNumber(getGlobalDefaultConfig(item.minHeight, allMinHeight))
|
|
176
|
+
const disX = evnt.clientX
|
|
177
|
+
const disY = evnt.clientY
|
|
178
|
+
addClass(el, 'is--drag')
|
|
179
|
+
document.onmousemove = evnt => {
|
|
180
|
+
evnt.preventDefault()
|
|
181
|
+
if (vertical) {
|
|
182
|
+
const offsetTop = evnt.clientY - disY
|
|
183
|
+
if (offsetTop > 0) {
|
|
184
|
+
if (prevItem) {
|
|
185
|
+
if (currHeight - offsetTop >= currMinHeight) {
|
|
186
|
+
prevItem.renderHeight = prevHeight + offsetTop
|
|
187
|
+
item.renderHeight = currHeight - offsetTop
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
if (prevItem) {
|
|
192
|
+
if (prevHeight + offsetTop >= prevMinHeight) {
|
|
193
|
+
prevItem.renderHeight = prevHeight + offsetTop
|
|
194
|
+
item.renderHeight = currHeight - offsetTop
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
const offsetLeft = evnt.clientX - disX
|
|
200
|
+
if (offsetLeft > 0) {
|
|
201
|
+
if (prevItem) {
|
|
202
|
+
if (currWidth - offsetLeft >= currMinWidth) {
|
|
203
|
+
prevItem.renderWidth = prevWidth + offsetLeft
|
|
204
|
+
item.renderWidth = currWidth - offsetLeft
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
if (prevItem) {
|
|
209
|
+
if (prevWidth + offsetLeft >= prevMinWidth) {
|
|
210
|
+
prevItem.renderWidth = prevWidth + offsetLeft
|
|
211
|
+
item.renderWidth = currWidth - offsetLeft
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
document.onmouseup = () => {
|
|
218
|
+
document.onmousemove = null
|
|
219
|
+
document.onmouseup = null
|
|
220
|
+
removeClass(el, 'is--drag')
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const splitMethods: SplitMethods = {
|
|
225
|
+
dispatchEvent,
|
|
226
|
+
recalculate
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const splitPrivateMethods: SplitPrivateMethods = {
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
Object.assign($xeSplit, splitMethods, splitPrivateMethods)
|
|
233
|
+
|
|
234
|
+
const renderItems = () => {
|
|
235
|
+
const { border, vertical } = props
|
|
236
|
+
const { staticItems } = reactData
|
|
237
|
+
const itemVNs: VNode[] = []
|
|
238
|
+
staticItems.forEach((item, index) => {
|
|
239
|
+
const { id, slots, renderHeight, renderWidth } = item
|
|
240
|
+
const defaultSlot = slots ? slots.default : null
|
|
241
|
+
const stys: Record<string, string | number> = {}
|
|
242
|
+
if (vertical) {
|
|
243
|
+
if (renderHeight) {
|
|
244
|
+
stys.height = toCssUnit(renderHeight)
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
if (renderWidth) {
|
|
248
|
+
stys.width = toCssUnit(renderWidth)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
itemVNs.push(
|
|
252
|
+
h('div', {
|
|
253
|
+
xid: id,
|
|
254
|
+
class: ['vxe-split-item', vertical ? 'is--vertical' : 'is--horizontal', {
|
|
255
|
+
'is--border': border,
|
|
256
|
+
'is--height': renderHeight,
|
|
257
|
+
'is--width': renderWidth,
|
|
258
|
+
'is--fill': !renderHeight && !renderWidth,
|
|
259
|
+
'is--handle': index > 0
|
|
260
|
+
}],
|
|
261
|
+
style: stys
|
|
262
|
+
}, [
|
|
263
|
+
index
|
|
264
|
+
? h('div', {
|
|
265
|
+
xid: id,
|
|
266
|
+
class: 'vxe-split-item-handle',
|
|
267
|
+
onMousedown: dragEvent
|
|
268
|
+
})
|
|
269
|
+
: renderEmptyElement($xeSplit),
|
|
270
|
+
h('div', {
|
|
271
|
+
xid: id,
|
|
272
|
+
class: 'vxe-split-item--wrapper'
|
|
273
|
+
}, defaultSlot ? callSlot(defaultSlot, { }) : [])
|
|
274
|
+
])
|
|
275
|
+
)
|
|
276
|
+
})
|
|
277
|
+
return h('div', {
|
|
278
|
+
class: 'vxe-split-wrapper'
|
|
279
|
+
}, itemVNs)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const renderVN = () => {
|
|
283
|
+
const { vertical, width, height } = props
|
|
284
|
+
const defaultSlot = slots.default
|
|
285
|
+
const stys: Record<string, string | number> = {}
|
|
286
|
+
if (height) {
|
|
287
|
+
stys.height = toCssUnit(height)
|
|
288
|
+
}
|
|
289
|
+
if (width) {
|
|
290
|
+
stys.width = toCssUnit(width)
|
|
291
|
+
}
|
|
292
|
+
return h('div', {
|
|
293
|
+
ref: refElem,
|
|
294
|
+
class: ['vxe-split', vertical ? 'is--vertical' : 'is--horizontal'],
|
|
295
|
+
style: stys
|
|
296
|
+
}, [
|
|
297
|
+
h('div', {
|
|
298
|
+
class: 'vxe-split-slots'
|
|
299
|
+
}, defaultSlot ? defaultSlot({}) : []),
|
|
300
|
+
renderItems()
|
|
301
|
+
])
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
watch(() => reactData.staticItems, () => {
|
|
305
|
+
recalculate()
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
onMounted(() => {
|
|
309
|
+
recalculate()
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
onActivated(() => {
|
|
313
|
+
recalculate()
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
provide('$xeSplit', $xeSplit)
|
|
317
|
+
|
|
318
|
+
$xeSplit.renderVN = renderVN
|
|
319
|
+
|
|
320
|
+
return $xeSplit
|
|
321
|
+
},
|
|
322
|
+
render () {
|
|
323
|
+
return this.renderVN()
|
|
324
|
+
}
|
|
325
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
import type { VxeSplitConstructor, VxeSplitPrivateMethods, VxeSplitDefines } from '../../../types'
|
|
4
|
+
|
|
5
|
+
export function assembleSplitItem ($xeSplit: VxeSplitConstructor & VxeSplitPrivateMethods, elem: HTMLElement, chunkConfig: VxeSplitDefines.ChunkConfig) {
|
|
6
|
+
const staticItems = $xeSplit.reactData.staticItems
|
|
7
|
+
const parentElem = elem.parentNode
|
|
8
|
+
if (parentElem) {
|
|
9
|
+
staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, chunkConfig)
|
|
10
|
+
$xeSplit.reactData.staticItems = staticItems.slice(0)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function destroySplitItem ($xeSplit: VxeSplitConstructor & VxeSplitPrivateMethods, chunkConfig: VxeSplitDefines.ChunkConfig) {
|
|
15
|
+
const staticItems = $xeSplit.reactData.staticItems
|
|
16
|
+
const index = XEUtils.findIndexOf(staticItems, item => item.id === chunkConfig.id)
|
|
17
|
+
if (index > -1) {
|
|
18
|
+
staticItems.splice(index, 1)
|
|
19
|
+
}
|
|
20
|
+
$xeSplit.reactData.staticItems = staticItems.slice(0)
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
+
import VxeSplitItemComponent from '../split/src/split-item'
|
|
4
|
+
import { dynamicApp } from '../dynamics'
|
|
5
|
+
|
|
6
|
+
export const VxeSplitItem = Object.assign({}, VxeSplitItemComponent, {
|
|
7
|
+
install (app: App) {
|
|
8
|
+
app.component(VxeSplitItemComponent.name as string, VxeSplitItemComponent)
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
dynamicApp.use(VxeSplitItem)
|
|
13
|
+
VxeUI.component(VxeSplitItemComponent)
|
|
14
|
+
|
|
15
|
+
export const SplitItem = VxeSplitItem
|
|
16
|
+
export default VxeSplitItem
|
package/packages/ui/index.ts
CHANGED
package/packages/ui/src/utils.ts
CHANGED
|
@@ -14,6 +14,13 @@ export function getLastZIndex () {
|
|
|
14
14
|
return DomZIndex.getCurrent()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export function getGlobalDefaultConfig (value: any, globalValue: any) {
|
|
18
|
+
if (XEUtils.eqNull(value)) {
|
|
19
|
+
return globalValue
|
|
20
|
+
}
|
|
21
|
+
return value
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
export function getFuncText (content: string | number | boolean | null | undefined, args?: any) {
|
|
18
25
|
if (content) {
|
|
19
26
|
const translate = getConfig().translate
|
package/styles/all.scss
CHANGED
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
@use './components/result.scss';
|
|
66
66
|
@use './components/row.scss';
|
|
67
67
|
@use './components/select.scss';
|
|
68
|
+
@use './components/split.scss';
|
|
69
|
+
@use './components/split-item.scss';
|
|
68
70
|
@use './components/slider.scss';
|
|
69
71
|
@use './components/steps.scss';
|
|
70
72
|
@use './components/switch.scss';
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
@use "sass:list";
|
|
2
|
-
|
|
3
|
-
// 24 栅格布局
|
|
4
|
-
$colSpanList: 4.16667%, 8.33333%, 12.5%, 16.66667%, 20.83333%, 25%, 29.16667%, 33.33333%,
|
|
5
|
-
37.5%, 41.66667%, 45.83333%, 50%, 54.16667%, 58.33333%, 62.5%, 66.66667%,
|
|
6
|
-
70.83333%, 75%, 79.16667%, 83.33333%, 87.5%, 91.66667%, 95.83333%, 100%;
|
|
7
|
-
.vxe-col {
|
|
8
|
-
display: block;
|
|
9
|
-
&.is--ellipsis {
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
text-overflow: ellipsis;
|
|
12
|
-
white-space: nowrap;
|
|
13
|
-
}
|
|
14
|
-
&.is--fill {
|
|
15
|
-
flex-grow: 1;
|
|
16
|
-
}
|
|
17
|
-
&:not(.is--fill) {
|
|
18
|
-
flex-shrink: 0;
|
|
19
|
-
}
|
|
20
|
-
&.align--left {
|
|
21
|
-
text-align: left;
|
|
22
|
-
}
|
|
23
|
-
&.align--center {
|
|
24
|
-
text-align: center;
|
|
25
|
-
}
|
|
26
|
-
&.align--right {
|
|
27
|
-
text-align: right;
|
|
28
|
-
}
|
|
29
|
-
@for $i from 0 to list.length($colSpanList) {
|
|
30
|
-
&.span#{$i + 1} {
|
|
31
|
-
width: list.nth($colSpanList, $i + 1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.vxe-col--inner {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
width: 100%;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.vxe-col {
|
|
43
|
-
&.is--span,
|
|
44
|
-
&.is--width {
|
|
45
|
-
& > .vxe-col--inner {
|
|
46
|
-
& > .vxe-default-textarea,
|
|
47
|
-
& > .vxe-default-select,
|
|
48
|
-
& > .vxe-input,
|
|
49
|
-
& > .vxe-number-input,
|
|
50
|
-
& > .vxe-password-input,
|
|
51
|
-
& > .vxe-date-picker,
|
|
52
|
-
& > .vxe-textarea,
|
|
53
|
-
& > .vxe-select,
|
|
54
|
-
& > .vxe-tree-select,
|
|
55
|
-
& > .vxe-table-select,
|
|
56
|
-
& > .vxe-ico-picker {
|
|
57
|
-
width: 100%;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
@use "sass:list";
|
|
2
|
+
@use '../helpers/baseVar.scss' as base_var;
|
|
3
|
+
|
|
1
4
|
.vxe-row {
|
|
2
5
|
position: relative;
|
|
3
6
|
display: flex;
|
|
@@ -10,3 +13,59 @@
|
|
|
10
13
|
flex-wrap: wrap;
|
|
11
14
|
}
|
|
12
15
|
}
|
|
16
|
+
|
|
17
|
+
.vxe-col {
|
|
18
|
+
display: block;
|
|
19
|
+
&.is--ellipsis {
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
text-overflow: ellipsis;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
&.is--fill {
|
|
25
|
+
flex-grow: 1;
|
|
26
|
+
}
|
|
27
|
+
&:not(.is--fill) {
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
}
|
|
30
|
+
&.align--left {
|
|
31
|
+
text-align: left;
|
|
32
|
+
}
|
|
33
|
+
&.align--center {
|
|
34
|
+
text-align: center;
|
|
35
|
+
}
|
|
36
|
+
&.align--right {
|
|
37
|
+
text-align: right;
|
|
38
|
+
}
|
|
39
|
+
@for $i from 0 to list.length(base_var.$colSpanList) {
|
|
40
|
+
&.span#{$i + 1} {
|
|
41
|
+
width: list.nth(base_var.$colSpanList, $i + 1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.vxe-col--inner {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vxe-col {
|
|
53
|
+
&.is--span,
|
|
54
|
+
&.is--width {
|
|
55
|
+
& > .vxe-col--inner {
|
|
56
|
+
& > .vxe-default-textarea,
|
|
57
|
+
& > .vxe-default-select,
|
|
58
|
+
& > .vxe-input,
|
|
59
|
+
& > .vxe-number-input,
|
|
60
|
+
& > .vxe-password-input,
|
|
61
|
+
& > .vxe-date-picker,
|
|
62
|
+
& > .vxe-textarea,
|
|
63
|
+
& > .vxe-select,
|
|
64
|
+
& > .vxe-tree-select,
|
|
65
|
+
& > .vxe-table-select,
|
|
66
|
+
& > .vxe-ico-picker {
|
|
67
|
+
width: 100%;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
File without changes
|