vxe-pc-ui 3.4.26 → 3.5.0
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/carousel/src/carousel-item.js +2 -0
- 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/select/src/select.js +6 -4
- package/es/split/index.js +12 -0
- package/es/split/src/split-item.js +134 -0
- package/es/split/src/split.js +304 -0
- package/es/split/src/util.js +17 -0
- package/es/split/style.css +90 -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 +6 -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 +90 -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/carousel/src/carousel-item.js +2 -0
- package/lib/carousel/src/carousel-item.min.js +1 -1
- 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 +665 -11
- 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/select/src/select.js +7 -4
- package/lib/select/src/select.min.js +1 -1
- package/lib/split/index.js +19 -0
- package/lib/split/index.min.js +1 -0
- package/lib/split/src/split-item.js +146 -0
- package/lib/split/src/split-item.min.js +1 -0
- package/lib/split/src/split.js +313 -0
- package/lib/split/src/split.min.js +1 -0
- package/lib/split/src/util.js +27 -0
- package/lib/split/src/util.min.js +1 -0
- package/lib/split/style/index.js +1 -0
- package/lib/split/style/style.css +90 -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 +6 -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 +23 -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 +90 -0
- package/lib/vxe-split/style/style.min.css +1 -0
- package/lib/vxe-split-item/index.js +23 -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/carousel/src/carousel-item.ts +3 -0
- package/packages/components.ts +6 -0
- package/packages/modal/src/modal.ts +2 -4
- package/packages/row/src/col.ts +5 -5
- package/packages/select/src/select.ts +6 -4
- package/packages/split/index.ts +16 -0
- package/packages/split/src/split-item.ts +154 -0
- package/packages/split/src/split.ts +312 -0
- package/packages/split/src/util.ts +21 -0
- package/packages/split-item/index.ts +16 -0
- package/packages/ui/index.ts +5 -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 +103 -0
- package/styles/helpers/baseVar.scss +4 -0
- package/styles/theme/base.scss +6 -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 +84 -0
- package/types/components/split.d.ts +89 -0
- package/types/components/table-plugins/extend-cell-area.d.ts +54 -0
- package/types/components/table.d.ts +133 -11
- package/types/ui/global-config.d.ts +4 -0
- /package/es/icon/{iconfont.1742881754362.ttf → iconfont.1743044787719.ttf} +0 -0
- /package/es/icon/{iconfont.1742881754362.woff → iconfont.1743044787719.woff} +0 -0
- /package/es/icon/{iconfont.1742881754362.woff2 → iconfont.1743044787719.woff2} +0 -0
- /package/es/{iconfont.1742881754362.ttf → iconfont.1743044787719.ttf} +0 -0
- /package/es/{iconfont.1742881754362.woff → iconfont.1743044787719.woff} +0 -0
- /package/es/{iconfont.1742881754362.woff2 → iconfont.1743044787719.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1742881754362.ttf → iconfont.1743044787719.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1742881754362.woff → iconfont.1743044787719.woff} +0 -0
- /package/lib/icon/style/{iconfont.1742881754362.woff2 → iconfont.1743044787719.woff2} +0 -0
- /package/lib/{iconfont.1742881754362.ttf → iconfont.1743044787719.ttf} +0 -0
- /package/lib/{iconfont.1742881754362.woff → iconfont.1743044787719.woff} +0 -0
- /package/lib/{iconfont.1742881754362.woff2 → iconfont.1743044787719.woff2} +0 -0
|
@@ -123,7 +123,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
123
123
|
optList: [],
|
|
124
124
|
afterVisibleList: [],
|
|
125
125
|
staticOptions: [],
|
|
126
|
-
reactFlag:
|
|
126
|
+
reactFlag: 1,
|
|
127
127
|
|
|
128
128
|
currentOption: null,
|
|
129
129
|
searchValue: '',
|
|
@@ -320,14 +320,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
320
320
|
computeSelectLabel (this: any) {
|
|
321
321
|
const $xeSelect = this
|
|
322
322
|
const props = $xeSelect
|
|
323
|
+
const reactData = $xeSelect.reactData
|
|
323
324
|
|
|
324
325
|
const { value, remote, multiple } = props
|
|
326
|
+
const { reactFlag } = reactData
|
|
325
327
|
const multiMaxCharNum = $xeSelect.computeMultiMaxCharNum
|
|
326
328
|
if (XEUtils.eqNull(value)) {
|
|
327
329
|
return ''
|
|
328
330
|
}
|
|
329
331
|
const vals = XEUtils.isArray(value) ? value : [value]
|
|
330
|
-
if (remote) {
|
|
332
|
+
if (remote && reactFlag) {
|
|
331
333
|
return vals.map(val => $xeSelect.getRemoteSelectLabel(val)).join(', ')
|
|
332
334
|
}
|
|
333
335
|
return vals.map((val) => {
|
|
@@ -441,9 +443,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
441
443
|
const $xeSelect = this
|
|
442
444
|
const internalData = $xeSelect.internalData
|
|
443
445
|
|
|
444
|
-
const { remoteValMaps } = internalData
|
|
446
|
+
const { remoteValMaps, optFullValMaps } = internalData
|
|
445
447
|
const labelField = $xeSelect.computeLabelField
|
|
446
|
-
const remoteItem = remoteValMaps[value]
|
|
448
|
+
const remoteItem = remoteValMaps[value] || optFullValMaps[value]
|
|
447
449
|
const item = remoteItem ? remoteItem.item : null
|
|
448
450
|
return XEUtils.toValueString(item ? item[labelField] : value)
|
|
449
451
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VueConstructor } from 'vue'
|
|
2
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
+
import VxeSplitComponent from './src/split'
|
|
4
|
+
import { dynamicApp } from '../dynamics'
|
|
5
|
+
|
|
6
|
+
export const VxeSplit = Object.assign({}, VxeSplitComponent, {
|
|
7
|
+
install (app: VueConstructor) {
|
|
8
|
+
app.component(VxeSplitComponent.name as string, VxeSplitComponent)
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
dynamicApp.use(VxeSplit)
|
|
13
|
+
VxeUI.component(VxeSplitComponent)
|
|
14
|
+
|
|
15
|
+
export const Split = VxeSplit
|
|
16
|
+
export default VxeSplit
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { CreateElement, PropType, VNode } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { globalMixins, createEvent } from '../../ui'
|
|
4
|
+
import { assembleSplitItem, destroySplitItem } from './util'
|
|
5
|
+
import XEUtils from 'xe-utils'
|
|
6
|
+
|
|
7
|
+
import type { SplitItemReactData, VxeSplitItemPropTypes, VxeSplitItemEmits, VxeComponentSizeType, ValueOf, VxeSplitConstructor, VxeSplitPrivateMethods, VxeSplitDefines } from '../../../types'
|
|
8
|
+
|
|
9
|
+
export default /* define-vxe-component start */ defineVxeComponent({
|
|
10
|
+
name: 'VxeSplitItem',
|
|
11
|
+
mixins: [
|
|
12
|
+
globalMixins.sizeMixin
|
|
13
|
+
],
|
|
14
|
+
props: {
|
|
15
|
+
width: [Number, String] as PropType<VxeSplitItemPropTypes.Width>,
|
|
16
|
+
height: [Number, String] as PropType<VxeSplitItemPropTypes.Height>,
|
|
17
|
+
minWidth: {
|
|
18
|
+
type: [Number, String] as PropType<VxeSplitItemPropTypes.MinWidth>,
|
|
19
|
+
default: () => null
|
|
20
|
+
},
|
|
21
|
+
minHeight: {
|
|
22
|
+
type: [Number, String] as PropType<VxeSplitItemPropTypes.MinHeight>,
|
|
23
|
+
default: () => null
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
inject: {
|
|
27
|
+
$xeSplit: {
|
|
28
|
+
default: null
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
provide () {
|
|
32
|
+
const $xeSplitItem = this
|
|
33
|
+
return {
|
|
34
|
+
$xeSplitItem
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
data () {
|
|
38
|
+
const xID = XEUtils.uniqueId()
|
|
39
|
+
const reactData: SplitItemReactData = {
|
|
40
|
+
}
|
|
41
|
+
const itemConfig: VxeSplitDefines.ItemConfig = {
|
|
42
|
+
id: xID,
|
|
43
|
+
width: 0,
|
|
44
|
+
height: 0,
|
|
45
|
+
minWidth: 0,
|
|
46
|
+
minHeight: 0,
|
|
47
|
+
renderWidth: 0,
|
|
48
|
+
renderHeight: 0,
|
|
49
|
+
slots: {}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
xID,
|
|
54
|
+
reactData,
|
|
55
|
+
itemConfig
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
computed: {
|
|
59
|
+
...({} as {
|
|
60
|
+
computeSize(): VxeComponentSizeType
|
|
61
|
+
$xeSplit(): (VxeSplitConstructor & VxeSplitPrivateMethods) | null
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
watch: {
|
|
65
|
+
span (val) {
|
|
66
|
+
const $xeSplitItem = this
|
|
67
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
68
|
+
|
|
69
|
+
itemConfig.span = val
|
|
70
|
+
},
|
|
71
|
+
width (val) {
|
|
72
|
+
const $xeSplitItem = this
|
|
73
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
74
|
+
|
|
75
|
+
itemConfig.width = val
|
|
76
|
+
},
|
|
77
|
+
height (val) {
|
|
78
|
+
const $xeSplitItem = this
|
|
79
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
80
|
+
|
|
81
|
+
itemConfig.height = val
|
|
82
|
+
},
|
|
83
|
+
minWidth (val) {
|
|
84
|
+
const $xeSplitItem = this
|
|
85
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
86
|
+
|
|
87
|
+
itemConfig.minWidth = val
|
|
88
|
+
},
|
|
89
|
+
minHeight (val) {
|
|
90
|
+
const $xeSplitItem = this
|
|
91
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
92
|
+
|
|
93
|
+
itemConfig.minHeight = val
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
//
|
|
98
|
+
// Method
|
|
99
|
+
//
|
|
100
|
+
dispatchEvent (type: ValueOf<VxeSplitItemEmits>, params: Record<string, any>, evnt: Event | null) {
|
|
101
|
+
const $xeSplitItem = this
|
|
102
|
+
$xeSplitItem.$emit(type, createEvent(evnt, { $splitItem: $xeSplitItem }, params))
|
|
103
|
+
},
|
|
104
|
+
//
|
|
105
|
+
// Render
|
|
106
|
+
//
|
|
107
|
+
renderVN (h: CreateElement): VNode {
|
|
108
|
+
return h('div', {
|
|
109
|
+
ref: 'refElem'
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
created () {
|
|
114
|
+
const $xeSplitItem = this
|
|
115
|
+
const props = $xeSplitItem
|
|
116
|
+
const slots = $xeSplitItem.$scopedSlots
|
|
117
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
118
|
+
|
|
119
|
+
Object.assign(itemConfig, {
|
|
120
|
+
width: props.width,
|
|
121
|
+
height: props.height,
|
|
122
|
+
minWidth: props.minWidth,
|
|
123
|
+
minHeight: props.minHeight,
|
|
124
|
+
renderWidth: 0,
|
|
125
|
+
renderHeight: 0,
|
|
126
|
+
slots
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
mounted () {
|
|
130
|
+
const $xeSplitItem = this
|
|
131
|
+
const slots = $xeSplitItem.$scopedSlots
|
|
132
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
133
|
+
const $xeSplit = $xeSplitItem.$xeSplit
|
|
134
|
+
|
|
135
|
+
itemConfig.slots = slots
|
|
136
|
+
|
|
137
|
+
const elem = $xeSplitItem.$refs.refElem as HTMLElement
|
|
138
|
+
if ($xeSplit && elem) {
|
|
139
|
+
assembleSplitItem($xeSplit, elem, itemConfig)
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
beforeDestroy () {
|
|
143
|
+
const $xeSplitItem = this
|
|
144
|
+
const itemConfig = $xeSplitItem.itemConfig
|
|
145
|
+
const $xeSplit = $xeSplitItem.$xeSplit
|
|
146
|
+
|
|
147
|
+
if ($xeSplit) {
|
|
148
|
+
destroySplitItem($xeSplit, itemConfig)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
render (this: any, h) {
|
|
152
|
+
return this.renderVN(h)
|
|
153
|
+
}
|
|
154
|
+
}) /* define-vxe-component end */
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { CreateElement, PropType, VNode } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import XEUtils from 'xe-utils'
|
|
4
|
+
import { getConfig, createEvent, globalMixins, renderEmptyElement } from '../../ui'
|
|
5
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
6
|
+
import { toCssUnit, isScale, addClass, removeClass } from '../../ui/src/dom'
|
|
7
|
+
import { getGlobalDefaultConfig } from '../../ui/src/utils'
|
|
8
|
+
|
|
9
|
+
import type { SplitReactData, VxeSplitPropTypes, VxeComponentSizeType, SplitInternalData, VxeSplitEmits, ValueOf, VxeSplitDefines } from '../../../types'
|
|
10
|
+
|
|
11
|
+
export default /* define-vxe-component start */ defineVxeComponent({
|
|
12
|
+
name: 'VxeSplit',
|
|
13
|
+
mixins: [
|
|
14
|
+
globalMixins.sizeMixin
|
|
15
|
+
],
|
|
16
|
+
props: {
|
|
17
|
+
resize: {
|
|
18
|
+
type: Boolean as PropType<VxeSplitPropTypes.Resize>,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
vertical: {
|
|
22
|
+
type: Boolean as PropType<VxeSplitPropTypes.Vertical>,
|
|
23
|
+
default: () => getConfig().split.vertical
|
|
24
|
+
},
|
|
25
|
+
border: {
|
|
26
|
+
type: Boolean as PropType<VxeSplitPropTypes.Border>,
|
|
27
|
+
default: () => getConfig().split.border
|
|
28
|
+
},
|
|
29
|
+
minWidth: {
|
|
30
|
+
type: [Number, String] as PropType<VxeSplitPropTypes.MinWidth>,
|
|
31
|
+
default: () => getConfig().split.minWidth
|
|
32
|
+
},
|
|
33
|
+
minHeight: {
|
|
34
|
+
type: [Number, String] as PropType<VxeSplitPropTypes.MinHeight>,
|
|
35
|
+
default: () => getConfig().split.minHeight
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
data () {
|
|
39
|
+
const xID = XEUtils.uniqueId()
|
|
40
|
+
const reactData: SplitReactData = {
|
|
41
|
+
staticItems: []
|
|
42
|
+
}
|
|
43
|
+
const internalData: SplitInternalData = {
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
xID,
|
|
47
|
+
reactData,
|
|
48
|
+
internalData
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
provide () {
|
|
52
|
+
const $xeSplit = this
|
|
53
|
+
return {
|
|
54
|
+
$xeSplit
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
computed: {
|
|
58
|
+
...({} as {
|
|
59
|
+
computeSize(): VxeComponentSizeType
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
//
|
|
64
|
+
// Method
|
|
65
|
+
//
|
|
66
|
+
dispatchEvent (type: ValueOf<VxeSplitEmits>, params: Record<string, any>, evnt: Event | null) {
|
|
67
|
+
const $xeSplit = this
|
|
68
|
+
$xeSplit.$emit(type, createEvent(evnt, { $split: $xeSplit }, params))
|
|
69
|
+
},
|
|
70
|
+
callSlot (slotFunc: any, params: any) {
|
|
71
|
+
const $xeSplit = this
|
|
72
|
+
const slots = $xeSplit.$scopedSlots
|
|
73
|
+
|
|
74
|
+
if (slotFunc) {
|
|
75
|
+
if (XEUtils.isString(slotFunc)) {
|
|
76
|
+
slotFunc = slots[slotFunc] || null
|
|
77
|
+
}
|
|
78
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
79
|
+
return getSlotVNs(slotFunc(params))
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return []
|
|
83
|
+
},
|
|
84
|
+
recalculate () {
|
|
85
|
+
const $xeSplit = this
|
|
86
|
+
const props = $xeSplit
|
|
87
|
+
const reactData = $xeSplit.reactData
|
|
88
|
+
|
|
89
|
+
return $xeSplit.$nextTick().then(() => {
|
|
90
|
+
const { vertical, minWidth, minHeight } = props
|
|
91
|
+
const { staticItems } = reactData
|
|
92
|
+
const el = $xeSplit.$refs.refElem as HTMLDivElement
|
|
93
|
+
if (!el) {
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
const wrapperWidth = el.clientWidth
|
|
97
|
+
const wrapperHeight = el.clientHeight
|
|
98
|
+
if (!wrapperWidth || !wrapperHeight) {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
const residueItems: VxeSplitDefines.ItemConfig[] = []
|
|
102
|
+
if (vertical) {
|
|
103
|
+
let countHeight = 0
|
|
104
|
+
staticItems.forEach(item => {
|
|
105
|
+
const { height } = item
|
|
106
|
+
let itemHeight = 0
|
|
107
|
+
if (height) {
|
|
108
|
+
if (isScale(height)) {
|
|
109
|
+
itemHeight = wrapperHeight * XEUtils.toNumber(height)
|
|
110
|
+
} else {
|
|
111
|
+
itemHeight = XEUtils.toNumber(height)
|
|
112
|
+
}
|
|
113
|
+
item.renderHeight = itemHeight
|
|
114
|
+
} else {
|
|
115
|
+
residueItems.push(item)
|
|
116
|
+
}
|
|
117
|
+
countHeight += itemHeight
|
|
118
|
+
})
|
|
119
|
+
if (residueItems.length) {
|
|
120
|
+
const reMeanHeight = (wrapperHeight - countHeight) / residueItems.length
|
|
121
|
+
residueItems.forEach(item => {
|
|
122
|
+
item.renderHeight = Math.max(getGlobalDefaultConfig(item.minHeight, minHeight), reMeanHeight)
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
let countWidth = 0
|
|
127
|
+
staticItems.forEach(item => {
|
|
128
|
+
const { width } = item
|
|
129
|
+
let itemWidth = 0
|
|
130
|
+
if (width) {
|
|
131
|
+
if (isScale(width)) {
|
|
132
|
+
itemWidth = wrapperWidth * XEUtils.toNumber(width)
|
|
133
|
+
} else {
|
|
134
|
+
itemWidth = XEUtils.toNumber(width)
|
|
135
|
+
}
|
|
136
|
+
item.renderWidth = itemWidth
|
|
137
|
+
} else {
|
|
138
|
+
residueItems.push(item)
|
|
139
|
+
}
|
|
140
|
+
countWidth += itemWidth
|
|
141
|
+
})
|
|
142
|
+
if (residueItems.length) {
|
|
143
|
+
const reMeanWidth = (wrapperWidth - countWidth) / residueItems.length
|
|
144
|
+
residueItems.forEach(item => {
|
|
145
|
+
item.renderWidth = Math.max(getGlobalDefaultConfig(item.minWidth, minWidth), reMeanWidth)
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
},
|
|
151
|
+
dragEvent (evnt: MouseEvent) {
|
|
152
|
+
const $xeSplit = this
|
|
153
|
+
const props = $xeSplit
|
|
154
|
+
const reactData = $xeSplit.reactData
|
|
155
|
+
|
|
156
|
+
evnt.preventDefault()
|
|
157
|
+
const { vertical, minWidth, minHeight } = props
|
|
158
|
+
const { staticItems } = reactData
|
|
159
|
+
const handleEl = evnt.currentTarget as HTMLDivElement
|
|
160
|
+
const el = $xeSplit.$refs.refElem as HTMLDivElement
|
|
161
|
+
if (!el) {
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
const itemId = handleEl.getAttribute('xid')
|
|
165
|
+
const itemIndex = XEUtils.findIndexOf(staticItems, item => item.id === itemId)
|
|
166
|
+
const item = staticItems[itemIndex]
|
|
167
|
+
if (!item) {
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
const prevItem = staticItems[itemIndex - 1]
|
|
171
|
+
const prevItemEl = prevItem ? el.querySelector<HTMLDivElement>(`.vxe-split-item[xid="${prevItem.id}"]`) : null
|
|
172
|
+
const currItemEl = item ? el.querySelector<HTMLDivElement>(`.vxe-split-item[xid="${item.id}"]`) : null
|
|
173
|
+
const prevWidth = prevItemEl ? prevItemEl.clientWidth : 0
|
|
174
|
+
const currWidth = currItemEl ? currItemEl.clientWidth : 0
|
|
175
|
+
const prevHeight = prevItemEl ? prevItemEl.clientHeight : 0
|
|
176
|
+
const currHeight = currItemEl ? currItemEl.clientHeight : 0
|
|
177
|
+
const prevMinWidth = prevItem ? getGlobalDefaultConfig(prevItem.minWidth, minWidth) : minWidth
|
|
178
|
+
const currMinWidth = getGlobalDefaultConfig(item.minWidth, minWidth)
|
|
179
|
+
const prevMinHeight = prevItem ? getGlobalDefaultConfig(prevItem.minHeight, minHeight) : minHeight
|
|
180
|
+
const currMinHeight = getGlobalDefaultConfig(item.minHeight, minHeight)
|
|
181
|
+
const disX = evnt.clientX
|
|
182
|
+
const disY = evnt.clientY
|
|
183
|
+
addClass(el, 'is--drag')
|
|
184
|
+
document.onmousemove = evnt => {
|
|
185
|
+
evnt.preventDefault()
|
|
186
|
+
if (vertical) {
|
|
187
|
+
const offsetTop = evnt.clientY - disY
|
|
188
|
+
if (offsetTop > 0) {
|
|
189
|
+
if (prevItem) {
|
|
190
|
+
if (currHeight - offsetTop >= currMinHeight) {
|
|
191
|
+
prevItem.renderHeight = prevHeight + offsetTop
|
|
192
|
+
item.renderHeight = currHeight - offsetTop
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
if (prevItem) {
|
|
197
|
+
if (prevHeight + offsetTop >= prevMinHeight) {
|
|
198
|
+
prevItem.renderHeight = prevHeight + offsetTop
|
|
199
|
+
item.renderHeight = currHeight - offsetTop
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
const offsetLeft = evnt.clientX - disX
|
|
205
|
+
if (offsetLeft > 0) {
|
|
206
|
+
if (prevItem) {
|
|
207
|
+
if (currWidth - offsetLeft >= currMinWidth) {
|
|
208
|
+
prevItem.renderWidth = prevWidth + offsetLeft
|
|
209
|
+
item.renderWidth = currWidth - offsetLeft
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
if (prevItem) {
|
|
214
|
+
if (prevWidth + offsetLeft >= prevMinWidth) {
|
|
215
|
+
prevItem.renderWidth = prevWidth + offsetLeft
|
|
216
|
+
item.renderWidth = currWidth - offsetLeft
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
document.onmouseup = () => {
|
|
223
|
+
document.onmousemove = null
|
|
224
|
+
document.onmouseup = null
|
|
225
|
+
removeClass(el, 'is--drag')
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
//
|
|
230
|
+
// Render
|
|
231
|
+
//
|
|
232
|
+
renderItems (h: CreateElement) {
|
|
233
|
+
const $xeSplit = this
|
|
234
|
+
const props = $xeSplit
|
|
235
|
+
const reactData = $xeSplit.reactData
|
|
236
|
+
|
|
237
|
+
const { border, vertical } = props
|
|
238
|
+
const { staticItems } = reactData
|
|
239
|
+
const itemVNs: VNode[] = []
|
|
240
|
+
staticItems.forEach((item, index) => {
|
|
241
|
+
const { id, slots, renderHeight, renderWidth } = item
|
|
242
|
+
const defaultSlot = slots ? slots.default : null
|
|
243
|
+
const stys: Record<string, string | number> = {}
|
|
244
|
+
if (vertical) {
|
|
245
|
+
if (renderHeight) {
|
|
246
|
+
stys.height = toCssUnit(renderHeight)
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
if (renderWidth) {
|
|
250
|
+
stys.width = toCssUnit(renderWidth)
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
itemVNs.push(
|
|
254
|
+
h('div', {
|
|
255
|
+
attrs: {
|
|
256
|
+
xid: id
|
|
257
|
+
},
|
|
258
|
+
class: ['vxe-split-item', vertical ? 'is--vertical' : 'is--horizontal', {
|
|
259
|
+
'is--border': border,
|
|
260
|
+
'is--height': renderHeight,
|
|
261
|
+
'is--width': renderWidth,
|
|
262
|
+
'is--fill': !renderHeight && !renderWidth,
|
|
263
|
+
'is--handle': index > 0
|
|
264
|
+
}],
|
|
265
|
+
style: stys
|
|
266
|
+
}, [
|
|
267
|
+
index
|
|
268
|
+
? h('div', {
|
|
269
|
+
attrs: {
|
|
270
|
+
xid: id
|
|
271
|
+
},
|
|
272
|
+
class: 'vxe-split-item-handle',
|
|
273
|
+
on: {
|
|
274
|
+
mousedown: $xeSplit.dragEvent
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
: renderEmptyElement($xeSplit),
|
|
278
|
+
h('div', {
|
|
279
|
+
attrs: {
|
|
280
|
+
xid: id
|
|
281
|
+
},
|
|
282
|
+
class: 'vxe-split-item--wrapper'
|
|
283
|
+
}, defaultSlot ? $xeSplit.callSlot(defaultSlot, { }) : [])
|
|
284
|
+
])
|
|
285
|
+
)
|
|
286
|
+
})
|
|
287
|
+
return h('div', {
|
|
288
|
+
class: 'vxe-split-wrapper'
|
|
289
|
+
}, itemVNs)
|
|
290
|
+
},
|
|
291
|
+
renderVN (h: CreateElement): VNode {
|
|
292
|
+
const $xeSplit = this
|
|
293
|
+
const props = $xeSplit
|
|
294
|
+
const slots = $xeSplit.$scopedSlots
|
|
295
|
+
|
|
296
|
+
const { vertical } = props
|
|
297
|
+
const defaultSlot = slots.default
|
|
298
|
+
return h('div', {
|
|
299
|
+
ref: 'refElem',
|
|
300
|
+
class: ['vxe-split', vertical ? 'is--vertical' : 'is--horizontal']
|
|
301
|
+
}, [
|
|
302
|
+
h('div', {
|
|
303
|
+
class: 'vxe-split-slots'
|
|
304
|
+
}, defaultSlot ? defaultSlot({}) : []),
|
|
305
|
+
$xeSplit.renderItems(h)
|
|
306
|
+
])
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
render (this: any, h) {
|
|
310
|
+
return this.renderVN(h)
|
|
311
|
+
}
|
|
312
|
+
}) /* define-vxe-component end */
|
|
@@ -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, itemConfig: VxeSplitDefines.ItemConfig) {
|
|
6
|
+
const staticItems = $xeSplit.reactData.staticItems
|
|
7
|
+
const parentElem = elem.parentNode
|
|
8
|
+
if (parentElem) {
|
|
9
|
+
staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, itemConfig)
|
|
10
|
+
$xeSplit.reactData.staticItems = staticItems.slice(0)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function destroySplitItem ($xeSplit: VxeSplitConstructor & VxeSplitPrivateMethods, itemConfig: VxeSplitDefines.ItemConfig) {
|
|
15
|
+
const staticItems = $xeSplit.reactData.staticItems
|
|
16
|
+
const index = XEUtils.findIndexOf(staticItems, item => item.id === itemConfig.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 { VueConstructor } 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: VueConstructor) {
|
|
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
|
-
}
|