vxe-pc-ui 0.1.0 → 0.2.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/README.md +7 -0
- package/es/anchor/src/anchor-link.js +2 -2
- package/es/anchor/src/util.js +1 -1
- package/es/checkbox/src/checkbox.js +3 -3
- package/es/checkbox/src/group.js +3 -3
- package/es/components.js +6 -0
- package/es/form/src/form-config-item.js +1 -1
- package/es/form/src/form-gather.js +1 -1
- package/es/form/src/form-item.js +4 -4
- package/es/form/src/form.js +3 -3
- package/es/input/src/input.js +3 -3
- package/es/layout-aside/src/layout-aside.js +4 -2
- package/es/layout-aside/style.css +3 -1
- package/es/layout-aside/style.min.css +1 -1
- package/es/layout-body/src/layout-body.js +7 -2
- package/es/layout-body/style.css +2 -0
- package/es/layout-body/style.min.css +1 -1
- package/es/layout-container/src/layout-container.js +2 -1
- package/es/layout-footer/src/layout-footer.js +5 -3
- package/es/layout-footer/style.css +3 -1
- package/es/layout-footer/style.min.css +1 -1
- package/es/layout-header/style.css +0 -1
- package/es/layout-header/style.min.css +1 -1
- package/es/radio/src/button.js +4 -4
- package/es/radio/src/group.js +4 -4
- package/es/radio/src/radio.js +4 -4
- package/es/select/src/optgroup.js +1 -1
- package/es/select/src/option.js +1 -1
- package/es/select/src/select.js +4 -4
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/switch/src/switch.js +3 -3
- package/es/tab-pane/index.js +8 -0
- package/es/tab-pane/style.css +0 -0
- package/es/tab-pane/style.min.css +0 -0
- package/es/tabs/index.js +8 -0
- package/es/tabs/src/tab-pane.js +64 -0
- package/es/tabs/src/tabs.js +195 -0
- package/es/tabs/src/util.js +17 -0
- package/es/tabs/style.css +113 -0
- package/es/tabs/style.min.css +1 -0
- package/es/textarea/src/textarea.js +3 -3
- package/es/ui/src/core.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-layout-aside/style.css +3 -1
- package/es/vxe-layout-aside/style.min.css +1 -1
- package/es/vxe-layout-body/style.css +2 -0
- package/es/vxe-layout-body/style.min.css +1 -1
- package/es/vxe-layout-footer/style.css +3 -1
- package/es/vxe-layout-footer/style.min.css +1 -1
- package/es/vxe-layout-header/style.css +0 -1
- package/es/vxe-layout-header/style.min.css +1 -1
- package/es/vxe-tab-pane/index.js +3 -0
- package/es/vxe-tab-pane/style.css +0 -0
- package/es/vxe-tab-pane/style.min.css +0 -0
- package/es/vxe-tabs/index.js +3 -0
- package/es/vxe-tabs/style.css +113 -0
- package/es/vxe-tabs/style.min.css +1 -0
- package/lib/anchor/src/anchor-link.js +1 -1
- package/lib/anchor/src/anchor-link.min.js +1 -1
- package/lib/anchor/src/util.js +2 -2
- package/lib/anchor/src/util.min.js +1 -1
- package/lib/checkbox/src/checkbox.js +3 -3
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/checkbox/src/group.js +3 -3
- package/lib/checkbox/src/group.min.js +1 -1
- package/lib/components.js +25 -1
- package/lib/components.min.js +1 -1
- package/lib/form/src/form-config-item.js +1 -1
- package/lib/form/src/form-config-item.min.js +1 -1
- package/lib/form/src/form-gather.js +1 -1
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +4 -4
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +3 -3
- package/lib/form/src/form.min.js +1 -1
- package/lib/index.umd.js +421 -55
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +3 -3
- package/lib/input/src/input.min.js +1 -1
- package/lib/layout-aside/src/layout-aside.js +5 -2
- package/lib/layout-aside/src/layout-aside.min.js +1 -1
- package/lib/layout-aside/style/style.css +3 -1
- package/lib/layout-aside/style/style.min.css +1 -1
- package/lib/layout-body/src/layout-body.js +9 -2
- package/lib/layout-body/src/layout-body.min.js +1 -1
- package/lib/layout-body/style/style.css +2 -0
- package/lib/layout-body/style/style.min.css +1 -1
- package/lib/layout-container/src/layout-container.js +4 -1
- package/lib/layout-container/src/layout-container.min.js +1 -1
- package/lib/layout-footer/src/layout-footer.js +8 -3
- package/lib/layout-footer/src/layout-footer.min.js +1 -1
- package/lib/layout-footer/style/style.css +3 -1
- package/lib/layout-footer/style/style.min.css +1 -1
- package/lib/layout-header/style/style.css +0 -1
- package/lib/layout-header/style/style.min.css +1 -1
- package/lib/radio/src/button.js +4 -4
- package/lib/radio/src/button.min.js +1 -1
- package/lib/radio/src/group.js +4 -4
- package/lib/radio/src/group.min.js +1 -1
- package/lib/radio/src/radio.js +4 -4
- package/lib/radio/src/radio.min.js +1 -1
- package/lib/select/src/optgroup.js +1 -1
- package/lib/select/src/optgroup.min.js +1 -1
- package/lib/select/src/option.js +1 -1
- package/lib/select/src/option.min.js +1 -1
- package/lib/select/src/select.js +4 -4
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/src/switch.js +3 -3
- package/lib/switch/src/switch.min.js +1 -1
- package/lib/tab-pane/index.js +15 -0
- package/lib/tab-pane/index.min.js +1 -0
- package/lib/tab-pane/style/index.js +1 -0
- package/lib/tab-pane/style/style.css +0 -0
- package/lib/tab-pane/style/style.min.css +0 -0
- package/lib/tabs/index.js +15 -0
- package/lib/tabs/index.min.js +1 -0
- package/lib/tabs/src/tab-pane.js +73 -0
- package/lib/tabs/src/tab-pane.min.js +1 -0
- package/lib/tabs/src/tabs.js +240 -0
- package/lib/tabs/src/tabs.min.js +1 -0
- package/lib/tabs/src/util.js +27 -0
- package/lib/tabs/src/util.min.js +1 -0
- package/lib/tabs/style/index.js +1 -0
- package/lib/tabs/style/style.css +113 -0
- package/lib/tabs/style/style.min.css +1 -0
- package/lib/textarea/src/textarea.js +3 -3
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/ui/src/core.js +1 -1
- package/lib/ui/src/core.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-layout-aside/style/style.css +3 -1
- package/lib/vxe-layout-aside/style/style.min.css +1 -1
- package/lib/vxe-layout-body/style/style.css +2 -0
- package/lib/vxe-layout-body/style/style.min.css +1 -1
- package/lib/vxe-layout-footer/style/style.css +3 -1
- package/lib/vxe-layout-footer/style/style.min.css +1 -1
- package/lib/vxe-layout-header/style/style.css +0 -1
- package/lib/vxe-layout-header/style/style.min.css +1 -1
- package/lib/vxe-tab-pane/index.js +22 -0
- package/lib/vxe-tab-pane/index.min.js +1 -0
- package/lib/vxe-tab-pane/style/index.js +1 -0
- package/lib/vxe-tab-pane/style/style.css +0 -0
- package/lib/vxe-tab-pane/style/style.min.css +0 -0
- package/lib/vxe-tabs/index.js +22 -0
- package/lib/vxe-tabs/index.min.js +1 -0
- package/lib/vxe-tabs/style/index.js +1 -0
- package/lib/vxe-tabs/style/style.css +113 -0
- package/lib/vxe-tabs/style/style.min.css +1 -0
- package/package.json +1 -1
- package/packages/anchor/src/anchor-link.ts +2 -2
- package/packages/anchor/src/util.ts +1 -1
- package/packages/checkbox/src/checkbox.ts +3 -3
- package/packages/checkbox/src/group.ts +3 -3
- package/packages/components.ts +6 -0
- package/packages/form/src/form-config-item.ts +1 -1
- package/packages/form/src/form-gather.ts +1 -1
- package/packages/form/src/form-item.ts +4 -4
- package/packages/form/src/form.ts +4 -3
- package/packages/input/src/input.ts +3 -3
- package/packages/layout-aside/src/layout-aside.ts +8 -6
- package/packages/layout-body/src/layout-body.ts +9 -4
- package/packages/layout-container/src/layout-container.ts +5 -4
- package/packages/layout-footer/src/layout-footer.ts +7 -5
- package/packages/layout-header/src/layout-header.ts +3 -3
- package/packages/radio/src/button.ts +4 -4
- package/packages/radio/src/group.ts +4 -4
- package/packages/radio/src/radio.ts +4 -4
- package/packages/select/src/optgroup.ts +1 -1
- package/packages/select/src/option.ts +1 -1
- package/packages/select/src/select.ts +4 -4
- package/packages/switch/src/switch.ts +3 -3
- package/packages/tab-pane/index.ts +11 -0
- package/packages/tabs/index.ts +11 -0
- package/packages/tabs/src/tab-pane.ts +85 -0
- package/packages/tabs/src/tabs.ts +223 -0
- package/packages/tabs/src/util.ts +21 -0
- package/packages/textarea/src/textarea.ts +3 -3
- package/styles/all.scss +2 -0
- package/styles/components/layout-aside.scss +3 -1
- package/styles/components/layout-body.scss +3 -1
- package/styles/components/layout-footer.scss +3 -1
- package/styles/components/layout-header.scss +0 -1
- package/styles/components/tab-pane.scss +0 -0
- package/styles/components/tabs.scss +116 -0
- package/types/all.d.ts +2 -0
- package/types/components/layout-aside.d.ts +10 -1
- package/types/components/layout-body.d.ts +4 -1
- package/types/components/layout-container.d.ts +4 -1
- package/types/components/layout-footer.d.ts +7 -2
- package/types/components/layout-header.d.ts +4 -1
- package/types/components/tab-pane.d.ts +84 -0
- package/types/components/tabs.d.ts +80 -0
- package/types/tool/common.d.ts +5 -0
|
@@ -25,7 +25,7 @@ export default defineComponent({
|
|
|
25
25
|
setup (props, context) {
|
|
26
26
|
const { slots, emit } = context
|
|
27
27
|
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
|
|
28
|
-
const
|
|
28
|
+
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
29
29
|
|
|
30
30
|
const xID = XEUtils.uniqueId()
|
|
31
31
|
|
|
@@ -64,8 +64,8 @@ export default defineComponent({
|
|
|
64
64
|
emit('update:modelValue', params.label)
|
|
65
65
|
radioGroupMethods.dispatchEvent('change', params)
|
|
66
66
|
// 自动更新校验状态
|
|
67
|
-
if ($xeform &&
|
|
68
|
-
$xeform.triggerItemEvent(evnt,
|
|
67
|
+
if ($xeform && formItemInfo) {
|
|
68
|
+
$xeform.triggerItemEvent(evnt, formItemInfo.itemConfig.field, params.label)
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -103,7 +103,7 @@ export default defineComponent({
|
|
|
103
103
|
dispatchEvent
|
|
104
104
|
})
|
|
105
105
|
|
|
106
|
-
provide('$
|
|
106
|
+
provide('$xeRadioGroup', $xeradiogroup)
|
|
107
107
|
|
|
108
108
|
return renderVN
|
|
109
109
|
}
|
|
@@ -25,7 +25,7 @@ export default defineComponent({
|
|
|
25
25
|
setup (props, context) {
|
|
26
26
|
const { slots, emit } = context
|
|
27
27
|
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
|
|
28
|
-
const
|
|
28
|
+
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
29
29
|
|
|
30
30
|
const xID = XEUtils.uniqueId()
|
|
31
31
|
|
|
@@ -37,7 +37,7 @@ export default defineComponent({
|
|
|
37
37
|
|
|
38
38
|
const computeSize = useSize(props)
|
|
39
39
|
|
|
40
|
-
const $xeradiogroup = inject('$
|
|
40
|
+
const $xeradiogroup = inject('$xeRadioGroup', null as (VxeRadioGroupConstructor & VxeRadioGroupPrivateMethods) | null)
|
|
41
41
|
|
|
42
42
|
let radioMethods = {} as RadioMethods
|
|
43
43
|
|
|
@@ -65,8 +65,8 @@ export default defineComponent({
|
|
|
65
65
|
emit('update:modelValue', label)
|
|
66
66
|
radioMethods.dispatchEvent('change', { label }, evnt)
|
|
67
67
|
// 自动更新校验状态
|
|
68
|
-
if ($xeform &&
|
|
69
|
-
$xeform.triggerItemEvent(evnt,
|
|
68
|
+
if ($xeform && formItemInfo) {
|
|
69
|
+
$xeform.triggerItemEvent(evnt, formItemInfo.itemConfig.field, label)
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -13,7 +13,7 @@ export default defineComponent({
|
|
|
13
13
|
},
|
|
14
14
|
setup (props, { slots }) {
|
|
15
15
|
const elem = ref() as Ref<HTMLDivElement>
|
|
16
|
-
const $xeselect = inject('$
|
|
16
|
+
const $xeselect = inject('$xeSelect', {} as VxeSelectConstructor)
|
|
17
17
|
const option = createOption($xeselect, props)
|
|
18
18
|
const xeoption: XEOptionProvide = { option }
|
|
19
19
|
option.options = []
|
|
@@ -14,7 +14,7 @@ export default defineComponent({
|
|
|
14
14
|
},
|
|
15
15
|
setup (props, { slots }) {
|
|
16
16
|
const elem = ref() as Ref<HTMLDivElement>
|
|
17
|
-
const $xeselect = inject('$
|
|
17
|
+
const $xeselect = inject('$xeSelect', {} as VxeSelectConstructor)
|
|
18
18
|
const optgroup = inject('xeoptgroup', null as XEOptionProvide | null)
|
|
19
19
|
const option = createOption($xeselect, props)
|
|
20
20
|
option.slots = slots
|
|
@@ -65,7 +65,7 @@ export default defineComponent({
|
|
|
65
65
|
setup (props, context) {
|
|
66
66
|
const { slots, emit } = context
|
|
67
67
|
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
|
|
68
|
-
const
|
|
68
|
+
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
69
69
|
|
|
70
70
|
const xID = XEUtils.uniqueId()
|
|
71
71
|
|
|
@@ -438,8 +438,8 @@ export default defineComponent({
|
|
|
438
438
|
emit('update:modelValue', selectValue)
|
|
439
439
|
selectMethods.dispatchEvent('change', { value: selectValue }, evnt)
|
|
440
440
|
// 自动更新校验状态
|
|
441
|
-
if ($xeform &&
|
|
442
|
-
$xeform.triggerItemEvent(evnt,
|
|
441
|
+
if ($xeform && formItemInfo) {
|
|
442
|
+
$xeform.triggerItemEvent(evnt, formItemInfo.itemConfig.field, selectValue)
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
445
|
}
|
|
@@ -1024,7 +1024,7 @@ export default defineComponent({
|
|
|
1024
1024
|
|
|
1025
1025
|
$xeselect.renderVN = renderVN
|
|
1026
1026
|
|
|
1027
|
-
provide('$
|
|
1027
|
+
provide('$xeSelect', $xeselect)
|
|
1028
1028
|
|
|
1029
1029
|
return $xeselect
|
|
1030
1030
|
},
|
|
@@ -28,7 +28,7 @@ export default defineComponent({
|
|
|
28
28
|
setup (props, context) {
|
|
29
29
|
const { emit } = context
|
|
30
30
|
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
|
|
31
|
-
const
|
|
31
|
+
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
32
32
|
|
|
33
33
|
const xID = XEUtils.uniqueId()
|
|
34
34
|
|
|
@@ -73,8 +73,8 @@ export default defineComponent({
|
|
|
73
73
|
emit('update:modelValue', value)
|
|
74
74
|
switchMethods.dispatchEvent('change', { value }, evnt)
|
|
75
75
|
// 自动更新校验状态
|
|
76
|
-
if ($xeform &&
|
|
77
|
-
$xeform.triggerItemEvent(evnt,
|
|
76
|
+
if ($xeform && formItemInfo) {
|
|
77
|
+
$xeform.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value)
|
|
78
78
|
}
|
|
79
79
|
_atimeout = setTimeout(() => {
|
|
80
80
|
reactData.hasAnimat = false
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import VxeTabPaneComponent from '../tabs/src/tab-pane'
|
|
3
|
+
|
|
4
|
+
const VxeTabPane = Object.assign({}, VxeTabPaneComponent, {
|
|
5
|
+
install (app: App) {
|
|
6
|
+
app.component(VxeTabPaneComponent.name as string, VxeTabPaneComponent)
|
|
7
|
+
}
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const TabPane = VxeTabPane
|
|
11
|
+
export default VxeTabPane
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import VxeTabsComponent from './src/tabs'
|
|
3
|
+
|
|
4
|
+
const VxeTabs = Object.assign({}, VxeTabsComponent, {
|
|
5
|
+
install (app: App) {
|
|
6
|
+
app.component(VxeTabsComponent.name as string, VxeTabsComponent)
|
|
7
|
+
}
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const Tabs = VxeTabs
|
|
11
|
+
export default VxeTabs
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { defineComponent, ref, h, reactive, PropType, watch, inject, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import XEUtils from 'xe-utils'
|
|
3
|
+
import { assembleAnchorTab, destroyAnchorTab } from './util'
|
|
4
|
+
|
|
5
|
+
import { VxeTabPanePropTypes, TabPaneReactData, TabPanePrivateRef, VxeTabPanePrivateComputed, VxeTabPaneConstructor, VxeTabPanePrivateMethods, VxeTabPaneDefines, VxeTabsConstructor, VxeTabsPrivateMethods } from '../../../types'
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'VxeTabPane',
|
|
9
|
+
props: {
|
|
10
|
+
title: [String, Number] as PropType<VxeTabPanePropTypes.Title>,
|
|
11
|
+
name: [String, Number, Boolean] as PropType<VxeTabPanePropTypes.Name>
|
|
12
|
+
},
|
|
13
|
+
emits: [],
|
|
14
|
+
setup (props, context) {
|
|
15
|
+
const { slots } = context
|
|
16
|
+
|
|
17
|
+
const xID = XEUtils.uniqueId()
|
|
18
|
+
|
|
19
|
+
const refElem = ref<HTMLDivElement>()
|
|
20
|
+
|
|
21
|
+
const $xeTabs = inject<(VxeTabsConstructor & VxeTabsPrivateMethods) | null>('$xeTabs', null)
|
|
22
|
+
|
|
23
|
+
const reactData = reactive<TabPaneReactData>({
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const tabConfig = reactive<VxeTabPaneDefines.TabConfig>({
|
|
27
|
+
id: xID,
|
|
28
|
+
title: props.title,
|
|
29
|
+
name: props.name,
|
|
30
|
+
slots: {
|
|
31
|
+
default: slots.default
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const refMaps: TabPanePrivateRef = {
|
|
36
|
+
refElem
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const computeMaps: VxeTabPanePrivateComputed = {
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const $xeTabPane = {
|
|
43
|
+
xID,
|
|
44
|
+
props,
|
|
45
|
+
context,
|
|
46
|
+
reactData,
|
|
47
|
+
|
|
48
|
+
getRefMaps: () => refMaps,
|
|
49
|
+
getComputeMaps: () => computeMaps
|
|
50
|
+
} as unknown as VxeTabPaneConstructor & VxeTabPanePrivateMethods
|
|
51
|
+
|
|
52
|
+
watch(() => props.title, (val) => {
|
|
53
|
+
tabConfig.title = val
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
watch(() => props.name, (val) => {
|
|
57
|
+
tabConfig.name = val
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
if ($xeTabs && refElem.value) {
|
|
62
|
+
assembleAnchorTab($xeTabs, refElem.value, tabConfig)
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
onUnmounted(() => {
|
|
67
|
+
if ($xeTabs) {
|
|
68
|
+
destroyAnchorTab($xeTabs, tabConfig)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const renderVN = () => {
|
|
73
|
+
return h('div', {
|
|
74
|
+
ref: refElem
|
|
75
|
+
}, [])
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
$xeTabPane.renderVN = renderVN
|
|
79
|
+
|
|
80
|
+
return $xeTabPane
|
|
81
|
+
},
|
|
82
|
+
render () {
|
|
83
|
+
return this.renderVN()
|
|
84
|
+
}
|
|
85
|
+
})
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { defineComponent, ref, h, reactive, PropType, provide, computed, createCommentVNode, watch, nextTick, onMounted } from 'vue'
|
|
2
|
+
import XEUtils from 'xe-utils'
|
|
3
|
+
import VxeTabPaneComponent from './tab-pane'
|
|
4
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
5
|
+
|
|
6
|
+
import { VxeTabsPropTypes, VxeTabPaneProps, TabsReactData, TabsPrivateRef, VxeTabsPrivateComputed, VxeTabsConstructor, VxeTabsPrivateMethods, VxeTabPaneDefines } from '../../../types'
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'VxeTabs',
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: [String, Number, Boolean] as PropType<VxeTabsPropTypes.ModelValue>,
|
|
12
|
+
options: Array as PropType<VxeTabsPropTypes.Options>,
|
|
13
|
+
destroyOnClose: Boolean as PropType<VxeTabsPropTypes.DestroyOnClose>,
|
|
14
|
+
type: String as PropType<VxeTabsPropTypes.Type>
|
|
15
|
+
},
|
|
16
|
+
emits: [],
|
|
17
|
+
setup (props, context) {
|
|
18
|
+
const { slots } = context
|
|
19
|
+
|
|
20
|
+
const xID = XEUtils.uniqueId()
|
|
21
|
+
|
|
22
|
+
const refElem = ref<HTMLDivElement>()
|
|
23
|
+
const refHeaderElem = ref<HTMLDivElement>()
|
|
24
|
+
|
|
25
|
+
const reactData = reactive<TabsReactData>({
|
|
26
|
+
staticTabs: [],
|
|
27
|
+
activeName: props.modelValue,
|
|
28
|
+
initNames: props.modelValue ? [props.modelValue] : [],
|
|
29
|
+
lintLeft: 0,
|
|
30
|
+
lintWidth: 0
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const refMaps: TabsPrivateRef = {
|
|
34
|
+
refElem
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const computeActiveOptionTab = computed(() => {
|
|
38
|
+
const { options } = props
|
|
39
|
+
const { activeName } = reactData
|
|
40
|
+
return options ? options.find(item => item.name === activeName) : null
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const computeActiveDefaultTab = computed(() => {
|
|
44
|
+
const { staticTabs, activeName } = reactData
|
|
45
|
+
return staticTabs.find(item => item.name === activeName)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const computeMaps: VxeTabsPrivateComputed = {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const $xeTabs = {
|
|
52
|
+
xID,
|
|
53
|
+
props,
|
|
54
|
+
context,
|
|
55
|
+
reactData,
|
|
56
|
+
|
|
57
|
+
getRefMaps: () => refMaps,
|
|
58
|
+
getComputeMaps: () => computeMaps
|
|
59
|
+
} as unknown as VxeTabsConstructor & VxeTabsPrivateMethods
|
|
60
|
+
|
|
61
|
+
const callSlot = (slotFunc: any, params: any) => {
|
|
62
|
+
if (slotFunc) {
|
|
63
|
+
if (XEUtils.isString(slotFunc)) {
|
|
64
|
+
slotFunc = slots[slotFunc] || null
|
|
65
|
+
}
|
|
66
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
67
|
+
return getSlotVNs(slotFunc(params))
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return []
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const updateLineStyle = () => {
|
|
74
|
+
nextTick(() => {
|
|
75
|
+
const { type, options } = props
|
|
76
|
+
const { staticTabs, activeName } = reactData
|
|
77
|
+
const headerWrapperEl = refHeaderElem.value
|
|
78
|
+
if (headerWrapperEl && !type) {
|
|
79
|
+
const index = XEUtils.findIndexOf(staticTabs.length ? staticTabs : options, item => item.name === activeName)
|
|
80
|
+
if (index > -1) {
|
|
81
|
+
const tabEl = headerWrapperEl.children[index] as HTMLDivElement
|
|
82
|
+
const tabWidth = tabEl.clientWidth
|
|
83
|
+
const lintWidth = Math.max(4, Math.floor(tabWidth * 0.6))
|
|
84
|
+
reactData.lintLeft = tabEl.offsetLeft + Math.floor((tabWidth - lintWidth) / 2)
|
|
85
|
+
reactData.lintWidth = lintWidth
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const clickEvent = (evnt: KeyboardEvent, item: VxeTabPaneProps | VxeTabPaneDefines.TabConfig) => {
|
|
92
|
+
const { initNames } = reactData
|
|
93
|
+
const { name } = item
|
|
94
|
+
if (!initNames.includes(name)) {
|
|
95
|
+
initNames.push(name)
|
|
96
|
+
}
|
|
97
|
+
reactData.activeName = name
|
|
98
|
+
updateLineStyle()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const renderTabHeader = (list: VxeTabsPropTypes.Options | VxeTabPaneDefines.TabConfig[]) => {
|
|
102
|
+
const { type } = props
|
|
103
|
+
const { activeName, lintLeft, lintWidth } = reactData
|
|
104
|
+
return h('div', {
|
|
105
|
+
class: 'vxe-tabs-header'
|
|
106
|
+
}, [
|
|
107
|
+
h('div', {
|
|
108
|
+
ref: refHeaderElem,
|
|
109
|
+
class: 'vxe-tabs-header--wrapper'
|
|
110
|
+
}, list.map(item => {
|
|
111
|
+
const { title, name, slots } = item
|
|
112
|
+
const tabSlot = slots ? slots.tab : null
|
|
113
|
+
return h('div', {
|
|
114
|
+
class: ['vxe-tab-header--item', {
|
|
115
|
+
'is--active': activeName === name
|
|
116
|
+
}],
|
|
117
|
+
onClick (evnt: KeyboardEvent) {
|
|
118
|
+
clickEvent(evnt, item)
|
|
119
|
+
}
|
|
120
|
+
}, [
|
|
121
|
+
h('div', {
|
|
122
|
+
class: 'vxe-tab-header--item-name'
|
|
123
|
+
}, tabSlot ? callSlot(tabSlot, { name, title }) : `${title}`)
|
|
124
|
+
])
|
|
125
|
+
})),
|
|
126
|
+
type
|
|
127
|
+
? null
|
|
128
|
+
: h('span', {
|
|
129
|
+
class: 'vxe-tabs-header--active-line',
|
|
130
|
+
style: {
|
|
131
|
+
left: `${lintLeft}px`,
|
|
132
|
+
width: `${lintWidth}px`
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
])
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const renderOptionPane = (item: VxeTabPaneProps) => {
|
|
139
|
+
const { initNames, activeName } = reactData
|
|
140
|
+
const { name, slots } = item
|
|
141
|
+
const defaultSlot = slots ? slots.default : null
|
|
142
|
+
return h(VxeTabPaneComponent, item, {
|
|
143
|
+
default () {
|
|
144
|
+
return name && initNames.includes(name)
|
|
145
|
+
? h('div', {
|
|
146
|
+
class: ['vxe-tab-pane--item', {
|
|
147
|
+
'is--visible': activeName === name
|
|
148
|
+
}]
|
|
149
|
+
}, callSlot(defaultSlot, {}))
|
|
150
|
+
: createCommentVNode()
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const renderOptionContent = (options: VxeTabsPropTypes.Options) => {
|
|
156
|
+
const { destroyOnClose } = props
|
|
157
|
+
const activeOptionTab = computeActiveOptionTab.value
|
|
158
|
+
if (destroyOnClose) {
|
|
159
|
+
return activeOptionTab ? renderOptionPane(activeOptionTab) : createCommentVNode()
|
|
160
|
+
}
|
|
161
|
+
return options.map(renderOptionPane)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const renderDefaultPane = (item: VxeTabPaneDefines.TabConfig) => {
|
|
165
|
+
const { initNames, activeName } = reactData
|
|
166
|
+
const { name, slots } = item
|
|
167
|
+
const defaultSlot = slots ? slots.default : null
|
|
168
|
+
return name && initNames.includes(name)
|
|
169
|
+
? h('div', {
|
|
170
|
+
class: ['vxe-tab-pane--item', {
|
|
171
|
+
'is--visible': activeName === name
|
|
172
|
+
}]
|
|
173
|
+
}, callSlot(defaultSlot, {}))
|
|
174
|
+
: createCommentVNode()
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const renderDefaultContent = (staticTabs: VxeTabPaneDefines.TabConfig[]) => {
|
|
178
|
+
const { destroyOnClose } = props
|
|
179
|
+
const activeDefaultTab = computeActiveDefaultTab.value
|
|
180
|
+
if (destroyOnClose) {
|
|
181
|
+
return activeDefaultTab ? renderDefaultPane(activeDefaultTab) : createCommentVNode()
|
|
182
|
+
}
|
|
183
|
+
return staticTabs.map(renderDefaultPane)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const renderVN = () => {
|
|
187
|
+
const { type, options } = props
|
|
188
|
+
const { staticTabs } = reactData
|
|
189
|
+
const defaultSlot = slots.default
|
|
190
|
+
|
|
191
|
+
return h('div', {
|
|
192
|
+
ref: refElem,
|
|
193
|
+
class: ['vxe-tabs', `vxe-tabs--${type || 'default'}`]
|
|
194
|
+
}, [
|
|
195
|
+
h('div', {
|
|
196
|
+
class: 'vxe-tabs-slots'
|
|
197
|
+
}, defaultSlot ? defaultSlot({}) : []),
|
|
198
|
+
renderTabHeader(defaultSlot ? staticTabs : (options || [])),
|
|
199
|
+
h('div', {
|
|
200
|
+
class: 'vxe-tabs-pane'
|
|
201
|
+
}, defaultSlot ? renderDefaultContent(staticTabs) : renderOptionContent(options || []))
|
|
202
|
+
])
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
watch(() => props.modelValue, (val) => {
|
|
206
|
+
reactData.activeName = val
|
|
207
|
+
updateLineStyle()
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
onMounted(() => {
|
|
211
|
+
updateLineStyle()
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
$xeTabs.renderVN = renderVN
|
|
215
|
+
|
|
216
|
+
provide('$xeTabs', $xeTabs)
|
|
217
|
+
|
|
218
|
+
return $xeTabs
|
|
219
|
+
},
|
|
220
|
+
render () {
|
|
221
|
+
return this.renderVN()
|
|
222
|
+
}
|
|
223
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
import { VxeTabsConstructor, VxeTabsPrivateMethods, VxeTabPaneDefines } from '../../../types'
|
|
4
|
+
|
|
5
|
+
export function assembleAnchorTab ($xeTabs: VxeTabsConstructor & VxeTabsPrivateMethods, elem: HTMLElement, tabConfig: VxeTabPaneDefines.TabConfig) {
|
|
6
|
+
const staticLinks = $xeTabs.reactData.staticTabs
|
|
7
|
+
const parentElem = elem.parentNode
|
|
8
|
+
if (parentElem) {
|
|
9
|
+
staticLinks.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, tabConfig)
|
|
10
|
+
$xeTabs.reactData.staticTabs = staticLinks.slice(0)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function destroyAnchorTab ($xeTabs: VxeTabsConstructor & VxeTabsPrivateMethods, tabConfig: VxeTabPaneDefines.TabConfig) {
|
|
15
|
+
const staticTabs = $xeTabs.reactData.staticTabs
|
|
16
|
+
const matchObj = XEUtils.findTree(staticTabs, item => item.id === tabConfig.id, { children: 'children' })
|
|
17
|
+
if (matchObj) {
|
|
18
|
+
matchObj.items.splice(matchObj.index, 1)
|
|
19
|
+
}
|
|
20
|
+
$xeTabs.reactData.staticTabs = staticTabs.slice(0)
|
|
21
|
+
}
|
|
@@ -45,7 +45,7 @@ export default defineComponent({
|
|
|
45
45
|
setup (props, context) {
|
|
46
46
|
const { emit } = context
|
|
47
47
|
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
|
|
48
|
-
const
|
|
48
|
+
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
49
49
|
|
|
50
50
|
const xID = XEUtils.uniqueId()
|
|
51
51
|
|
|
@@ -143,8 +143,8 @@ export default defineComponent({
|
|
|
143
143
|
if (XEUtils.toValueString(props.modelValue) !== value) {
|
|
144
144
|
textareaMethods.dispatchEvent('change', { value }, evnt)
|
|
145
145
|
// 自动更新校验状态
|
|
146
|
-
if ($xeform &&
|
|
147
|
-
$xeform.triggerItemEvent(evnt,
|
|
146
|
+
if ($xeform && formItemInfo) {
|
|
147
|
+
$xeform.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value)
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
package/styles/all.scss
CHANGED
|
@@ -33,5 +33,7 @@
|
|
|
33
33
|
@import './components/row.scss';
|
|
34
34
|
@import './components/select.scss';
|
|
35
35
|
@import './components/switch.scss';
|
|
36
|
+
@import './components/tab-pane.scss';
|
|
37
|
+
@import './components/tabs.scss';
|
|
36
38
|
@import './components/textarea.scss';
|
|
37
39
|
@import './components/tooltip.scss';
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
.vxe-layout-aside {
|
|
4
4
|
flex-shrink: 0;
|
|
5
5
|
transition: width .3s;
|
|
6
|
-
padding: var(--vxe-ui-layout-padding-default);
|
|
7
6
|
overflow-y: auto;
|
|
8
7
|
overflow-x: hidden;
|
|
9
8
|
&.is--default-width {
|
|
@@ -12,4 +11,7 @@
|
|
|
12
11
|
&.is--collapse {
|
|
13
12
|
width: var(--vxe-ui-layout-aside-collapse-width);
|
|
14
13
|
}
|
|
14
|
+
&.is--padding {
|
|
15
|
+
padding: var(--vxe-ui-layout-padding-default);
|
|
16
|
+
}
|
|
15
17
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
.vxe-layout-footer {
|
|
4
4
|
flex-shrink: 0;
|
|
5
|
-
padding: var(--vxe-ui-layout-padding-default);
|
|
6
5
|
background-color: var(--vxe-ui-layout-background-color);
|
|
7
6
|
&.is--fixed {
|
|
8
7
|
position: sticky;
|
|
@@ -10,4 +9,7 @@
|
|
|
10
9
|
left: 0;
|
|
11
10
|
z-index: 9;
|
|
12
11
|
}
|
|
12
|
+
&.align--center {
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
13
15
|
}
|
|
File without changes
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
@import '../helpers/mixin.scss';
|
|
2
|
+
|
|
3
|
+
.vxe-tabs {
|
|
4
|
+
background-color: var(--vxe-ui-layout-background-color);
|
|
5
|
+
}
|
|
6
|
+
.vxe-tabs-header {
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
.vxe-tabs-header--wrapper {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
&::after {
|
|
14
|
+
content: "";
|
|
15
|
+
position: absolute;
|
|
16
|
+
left: 0;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 1px;
|
|
20
|
+
background-color: #e4e7ed;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.vxe-tab-header--item {
|
|
24
|
+
position: relative;
|
|
25
|
+
padding: 0 16px;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
&.is--active {
|
|
28
|
+
color: var(--vxe-ui-font-primary-color);;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
.vxe-tab-header--item-name {
|
|
32
|
+
height: 40px;
|
|
33
|
+
line-height: 40px;
|
|
34
|
+
border-bottom: 2px solid transparent;
|
|
35
|
+
@include createAnimationTransition(color, .3s);
|
|
36
|
+
}
|
|
37
|
+
.vxe-tab-pane--item {
|
|
38
|
+
display: none;
|
|
39
|
+
padding: var(--vxe-ui-layout-padding-default);
|
|
40
|
+
&.is--visible {
|
|
41
|
+
display: block;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.vxe-tabs-header--active-line {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vxe-tabs--default {
|
|
49
|
+
.vxe-tabs-header--active-line {
|
|
50
|
+
display: block;
|
|
51
|
+
position: absolute;
|
|
52
|
+
bottom: -1px;
|
|
53
|
+
left: 0;
|
|
54
|
+
height: 2px;
|
|
55
|
+
width: 4px;
|
|
56
|
+
background-color: var(--vxe-ui-font-primary-color);
|
|
57
|
+
z-index: 1;
|
|
58
|
+
@include createAnimationTransition(all, .3s);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.vxe-tabs--card {
|
|
63
|
+
.vxe-tabs-header {
|
|
64
|
+
border-top: 1px solid #e4e7ed;
|
|
65
|
+
border-left: 1px solid #e4e7ed;
|
|
66
|
+
}
|
|
67
|
+
.vxe-tab-header--item {
|
|
68
|
+
border-left: 1px solid #e4e7ed;
|
|
69
|
+
&:first-child {
|
|
70
|
+
border-left: 0;
|
|
71
|
+
}
|
|
72
|
+
&:last-child {
|
|
73
|
+
border-right: 1px solid #e4e7ed;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
.vxe-tabs--border-card {
|
|
78
|
+
.vxe-tab-pane--item {
|
|
79
|
+
border-bottom: 1px solid #e4e7ed;
|
|
80
|
+
border-left: 1px solid #e4e7ed;
|
|
81
|
+
border-right: 1px solid #e4e7ed;
|
|
82
|
+
}
|
|
83
|
+
.vxe-tabs-header {
|
|
84
|
+
border-top: 1px solid #e4e7ed;
|
|
85
|
+
border-left: 1px solid #e4e7ed;
|
|
86
|
+
border-right: 1px solid #e4e7ed;
|
|
87
|
+
background-color: #f5f7fa;
|
|
88
|
+
}
|
|
89
|
+
.vxe-tab-header--item {
|
|
90
|
+
&.is--active {
|
|
91
|
+
background-color: #ffffff;
|
|
92
|
+
&::before {
|
|
93
|
+
content: "";
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 0;
|
|
96
|
+
left: -1px;
|
|
97
|
+
width: calc(100% + 2px);
|
|
98
|
+
height: 100%;
|
|
99
|
+
border-left: 1px solid #e4e7ed;
|
|
100
|
+
border-right: 1px solid #e4e7ed;
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
}
|
|
103
|
+
&::after {
|
|
104
|
+
content: "";
|
|
105
|
+
position: absolute;
|
|
106
|
+
bottom: 0;
|
|
107
|
+
left: 0;
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 1px;
|
|
110
|
+
background-color: var(--vxe-ui-layout-background-color);
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
z-index: 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|