resolver-egretimp-plus 0.1.119 → 0.1.121
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/dist/h5/index.js +18 -18
- package/dist/web/index.js +11 -11
- package/package.json +1 -1
- package/src/components/options/OptionsDefault.vue +0 -1
- package/src/components/packages-web/CustomComponentCycle.vue +38 -33
- package/src/components/packages-web/CustomComponentCycleTabPane.vue +40 -33
- package/src/components/packages-web/CustomComponentPlain.vue +6 -5
- package/src/components/packages-web/CustomComponentTable.jsx +48 -40
- package/src/components/packages-web/ElInput copy.jsx +0 -1
- package/src/components/packages-web/ElInput.jsx +0 -1
- package/src/config.js +2 -0
- package/src/hooks/pageConfig.js +10 -4
- package/src/index.jsx +15 -10
- package/src/renderer.jsx +4 -1
- package/src/resolver-common.vue +22 -2
- package/src/rules/rulesDriver.js +4 -0
- package/src/utils/common.js +13 -0
- package/src/utils/render.jsx +196 -96
- package/src-bak/analysisComponent.jsx +0 -343
- package/src-bak/api/builtIn.js +0 -10
- package/src-bak/bpm/bpmInstance.js +0 -388
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/application.js +0 -8
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/component.js +0 -97
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/datasource.js +0 -88
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/index.js +0 -3
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/UdcComponent.js +0 -76
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/index.js +0 -201
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/index.js +0 -69
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/page.js +0 -56
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/utils.js +0 -76
- package/src-bak/bpm/udc-sdk-esm/cjs/index.js +0 -46
- package/src-bak/bpm/udc-sdk-esm/cjs/utils.js +0 -21
- package/src-bak/components/childDialog/index.js +0 -39
- package/src-bak/components/childDialog/src/index.vue +0 -185
- package/src-bak/components/cmiFormItem/index.js +0 -1
- package/src-bak/components/cmiFormItem/src/index.vue +0 -112
- package/src-bak/components/confirmInstance-H5/index.js +0 -53
- package/src-bak/components/confirmInstance-H5/src/index.vue +0 -54
- package/src-bak/components/helper/FormPolyfill.jsx +0 -25
- package/src-bak/components/helper/calcTooltip.jsx +0 -134
- package/src-bak/components/helper/dock.js +0 -141
- package/src-bak/components/helper/eventOrchestration.js +0 -763
- package/src-bak/components/helper/resolver.js +0 -163
- package/src-bak/components/helper/table.jsx +0 -103
- package/src-bak/components/icons/date.vue +0 -33
- package/src-bak/components/icons/info.vue +0 -62
- package/src-bak/components/icons/loading.vue +0 -19
- package/src-bak/components/icons/question-filled.vue +0 -8
- package/src-bak/components/loading/index.js +0 -6
- package/src-bak/components/loading/loading.js +0 -98
- package/src-bak/components/loading/loading.scss +0 -74
- package/src-bak/components/loading/loading.vue +0 -89
- package/src-bak/components/loadingComponent/LoadingComponent.vue +0 -33
- package/src-bak/components/modal/index.js +0 -9
- package/src-bak/components/modal/modal.scss +0 -195
- package/src-bak/components/modal/modal.vue +0 -201
- package/src-bak/components/options/OptionsDefault.vue +0 -47
- package/src-bak/components/packages-H5/CmiButton.vue +0 -120
- package/src-bak/components/packages-H5/CmiCalendar.vue +0 -152
- package/src-bak/components/packages-H5/CmiCell.vue +0 -87
- package/src-bak/components/packages-H5/CmiCheckbox.vue +0 -82
- package/src-bak/components/packages-H5/CmiDatetimePicker.vue +0 -98
- package/src-bak/components/packages-H5/CmiDivider.vue +0 -30
- package/src-bak/components/packages-H5/CmiDropdownMenu.vue +0 -58
- package/src-bak/components/packages-H5/CmiInput.vue +0 -69
- package/src-bak/components/packages-H5/CmiLink.vue +0 -28
- package/src-bak/components/packages-H5/CmiPicker.vue +0 -229
- package/src-bak/components/packages-H5/CmiRadio.vue +0 -29
- package/src-bak/components/packages-H5/CmiSearch.vue +0 -39
- package/src-bak/components/packages-H5/CmiSelect.vue +0 -84
- package/src-bak/components/packages-H5/CustomComponentCardH5.vue +0 -129
- package/src-bak/components/packages-H5/CustomComponentColH5.vue +0 -8
- package/src-bak/components/packages-H5/CustomComponentCollapseH5.vue +0 -141
- package/src-bak/components/packages-H5/CustomComponentFormLayoutH5.vue +0 -54
- package/src-bak/components/packages-H5/CustomComponentTabPaneH5.vue +0 -38
- package/src-bak/components/packages-H5/CustomComponentTableH5.vue +0 -352
- package/src-bak/components/packages-H5/CustomComponentTabsH5.vue +0 -170
- package/src-bak/components/packages-web/CustomComponentCard.vue +0 -40
- package/src-bak/components/packages-web/CustomComponentCol.vue +0 -66
- package/src-bak/components/packages-web/CustomComponentCollapse.vue +0 -164
- package/src-bak/components/packages-web/CustomComponentCycle.vue +0 -95
- package/src-bak/components/packages-web/CustomComponentCycleTabPane.vue +0 -155
- package/src-bak/components/packages-web/CustomComponentDialog.vue +0 -192
- package/src-bak/components/packages-web/CustomComponentEditor.vue +0 -50
- package/src-bak/components/packages-web/CustomComponentFileExport.vue +0 -60
- package/src-bak/components/packages-web/CustomComponentFileImport.vue +0 -60
- package/src-bak/components/packages-web/CustomComponentFormLayout.vue +0 -65
- package/src-bak/components/packages-web/CustomComponentGrid.vue +0 -29
- package/src-bak/components/packages-web/CustomComponentGridCol.vue +0 -29
- package/src-bak/components/packages-web/CustomComponentInputDialog.vue +0 -144
- package/src-bak/components/packages-web/CustomComponentNativeTabPane.vue +0 -84
- package/src-bak/components/packages-web/CustomComponentPlain.vue +0 -247
- package/src-bak/components/packages-web/CustomComponentRow.vue +0 -83
- package/src-bak/components/packages-web/CustomComponentSelectEmployees.vue +0 -203
- package/src-bak/components/packages-web/CustomComponentSendMail.vue +0 -62
- package/src-bak/components/packages-web/CustomComponentSteps.vue +0 -41
- package/src-bak/components/packages-web/CustomComponentTabPane.vue +0 -20
- package/src-bak/components/packages-web/CustomComponentTable.jsx +0 -814
- package/src-bak/components/packages-web/CustomComponentTabs.vue +0 -126
- package/src-bak/components/packages-web/CustomComponentTree.vue +0 -28
- package/src-bak/components/packages-web/ElButton.vue +0 -146
- package/src-bak/components/packages-web/ElCheckbox.vue +0 -97
- package/src-bak/components/packages-web/ElDatePicker.vue +0 -93
- package/src-bak/components/packages-web/ElInput copy.jsx +0 -393
- package/src-bak/components/packages-web/ElInput.jsx +0 -312
- package/src-bak/components/packages-web/ElInputNumber.vue +0 -81
- package/src-bak/components/packages-web/ElPagination.vue +0 -61
- package/src-bak/components/packages-web/ElRadio.vue +0 -47
- package/src-bak/components/packages-web/ElSelect.jsx +0 -249
- package/src-bak/components/packages-web/ElSelect_bak.vue +0 -155
- package/src-bak/components/packages-web/ElText.jsx +0 -187
- package/src-bak/components/packages-web/ElTextaa.vue +0 -169
- package/src-bak/components/packages-web/ElTimePicker.vue +0 -39
- package/src-bak/components/patchComponents-H5.js +0 -46
- package/src-bak/components/patchComponents-web.js +0 -46
- package/src-bak/components/simpleFormItemPc/index.js +0 -1
- package/src-bak/components/simpleFormItemPc/src/index.vue +0 -94
- package/src-bak/components/table/index.ts +0 -29
- package/src-bak/components/table/src/composables/use-scrollbar.ts +0 -30
- package/src-bak/components/table/src/config.ts +0 -256
- package/src-bak/components/table/src/filter-panel.vue +0 -260
- package/src-bak/components/table/src/h-helper.ts +0 -34
- package/src-bak/components/table/src/layout-observer.ts +0 -78
- package/src-bak/components/table/src/store/current.ts +0 -85
- package/src-bak/components/table/src/store/expand.ts +0 -76
- package/src-bak/components/table/src/store/helper.ts +0 -74
- package/src-bak/components/table/src/store/index.ts +0 -246
- package/src-bak/components/table/src/store/tree.ts +0 -230
- package/src-bak/components/table/src/store/watcher.ts +0 -543
- package/src-bak/components/table/src/table/defaults.ts +0 -402
- package/src-bak/components/table/src/table/key-render-helper.ts +0 -27
- package/src-bak/components/table/src/table/style-helper.ts +0 -378
- package/src-bak/components/table/src/table/utils-helper.ts +0 -47
- package/src-bak/components/table/src/table-body/defaults.ts +0 -52
- package/src-bak/components/table/src/table-body/events-helper.ts +0 -203
- package/src-bak/components/table/src/table-body/index.ts +0 -119
- package/src-bak/components/table/src/table-body/render-helper.ts +0 -283
- package/src-bak/components/table/src/table-body/styles-helper.ts +0 -164
- package/src-bak/components/table/src/table-column/defaults.ts +0 -237
- package/src-bak/components/table/src/table-column/index.ts +0 -202
- package/src-bak/components/table/src/table-column/render-helper.ts +0 -214
- package/src-bak/components/table/src/table-column/watcher-helper.ts +0 -88
- package/src-bak/components/table/src/table-footer/index.ts +0 -128
- package/src-bak/components/table/src/table-footer/mapState-helper.ts +0 -33
- package/src-bak/components/table/src/table-footer/style-helper.ts +0 -51
- package/src-bak/components/table/src/table-header/event-helper.ts +0 -213
- package/src-bak/components/table/src/table-header/index.ts +0 -244
- package/src-bak/components/table/src/table-header/style.helper.ts +0 -119
- package/src-bak/components/table/src/table-header/utils-helper.ts +0 -94
- package/src-bak/components/table/src/table-layout.ts +0 -259
- package/src-bak/components/table/src/table.vue +0 -389
- package/src-bak/components/table/src/tableColumn.ts +0 -3
- package/src-bak/components/table/src/tokens.ts +0 -5
- package/src-bak/components/table/src/util.ts +0 -521
- package/src-bak/components/table/style/css.ts +0 -5
- package/src-bak/components/table/style/index.ts +0 -5
- package/src-bak/components/tabs/index.js +0 -8
- package/src-bak/components/tabs/src/constants.js +0 -23
- package/src-bak/components/tabs/src/tab-bar.js +0 -8
- package/src-bak/components/tabs/src/tab-bar.vue +0 -92
- package/src-bak/components/tabs/src/tab-nav.jsx +0 -424
- package/src-bak/components/tabs/src/tab-pane.js +0 -16
- package/src-bak/components/tabs/src/tab-pane.vue +0 -80
- package/src-bak/components/tabs/src/tabs.jsx +0 -223
- package/src-bak/components/tabs/style/css.js +0 -2
- package/src-bak/components/tabs/style/index.js +0 -2
- package/src-bak/components/thirdPartyFrame/index.js +0 -32
- package/src-bak/components/thirdPartyFrame/src/ThirdPartyFrame.vue +0 -125
- package/src-bak/enums/index.js +0 -16
- package/src-bak/hooks/configLoad.js +0 -45
- package/src-bak/hooks/index.js +0 -189
- package/src-bak/hooks/mock.js +0 -6960
- package/src-bak/hooks/pageConfig.js +0 -127
- package/src-bak/index.jsx +0 -443
- package/src-bak/renderer.jsx +0 -77
- package/src-bak/resolver-H5.vue +0 -88
- package/src-bak/resolver-common.vue +0 -129
- package/src-bak/resolver-web.vue +0 -91
- package/src-bak/rules/eventsSupplement.js +0 -573
- package/src-bak/rules/parseCondition.js +0 -378
- package/src-bak/rules/ruleUtils.js +0 -273
- package/src-bak/rules/rulesDriver.js +0 -139
- package/src-bak/rulesImp/events.js +0 -588
- package/src-bak/rulesImp/index.js +0 -33
- package/src-bak/rulesImp/ruleInstance.js +0 -231
- package/src-bak/rulesImp/ruleUtils.js +0 -124
- package/src-bak/theme/element/components/button.scss +0 -122
- package/src-bak/theme/element/components/card.scss +0 -8
- package/src-bak/theme/element/components/checkbox.scss +0 -19
- package/src-bak/theme/element/components/collapse.scss +0 -174
- package/src-bak/theme/element/components/common.scss +0 -30
- package/src-bak/theme/element/components/cycle.scss +0 -0
- package/src-bak/theme/element/components/date.scss +0 -13
- package/src-bak/theme/element/components/dialog.scss +0 -44
- package/src-bak/theme/element/components/form.scss +0 -104
- package/src-bak/theme/element/components/index.scss +0 -55
- package/src-bak/theme/element/components/input.scss +0 -36
- package/src-bak/theme/element/components/message.scss +0 -48
- package/src-bak/theme/element/components/pagination.scss +0 -47
- package/src-bak/theme/element/components/popper.scss +0 -3
- package/src-bak/theme/element/components/radio.scss +0 -40
- package/src-bak/theme/element/components/scrollbar.scss +0 -14
- package/src-bak/theme/element/components/select.scss +0 -82
- package/src-bak/theme/element/components/steps.scss +0 -6
- package/src-bak/theme/element/components/table.scss +0 -218
- package/src-bak/theme/element/components/tabs.scss +0 -128
- package/src-bak/theme/element/components/tag.scss +0 -6
- package/src-bak/theme/element/components/text.scss +0 -20
- package/src-bak/theme/element/components/textarea.scss +0 -3
- package/src-bak/theme/element/components/tree.scss +0 -0
- package/src-bak/theme/element/index.scss +0 -55
- package/src-bak/utils/cipher.js +0 -141
- package/src-bak/utils/common.js +0 -664
- package/src-bak/utils/const.js +0 -259
- package/src-bak/utils/defaultVal.js +0 -92
- package/src-bak/utils/dom.js +0 -36
- package/src-bak/utils/format.js +0 -19
- package/src-bak/utils/index.js +0 -4
- package/src-bak/utils/is.js +0 -74
- package/src-bak/utils/loadModule.js +0 -75
- package/src-bak/utils/preserveFunc.js +0 -33
- package/src-bak/utils/render.jsx +0 -1138
- package/src-bak/utils/request.js +0 -136
- package/src-bak/utils/respone.js +0 -70
- package/src-bak/utils/valid.js +0 -89
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
defineComponent,
|
|
4
|
-
getCurrentInstance,
|
|
5
|
-
inject,
|
|
6
|
-
nextTick,
|
|
7
|
-
onMounted,
|
|
8
|
-
onUpdated,
|
|
9
|
-
ref,
|
|
10
|
-
watch,
|
|
11
|
-
} from 'vue'
|
|
12
|
-
import {
|
|
13
|
-
useDocumentVisibility,
|
|
14
|
-
useResizeObserver,
|
|
15
|
-
useWindowFocus,
|
|
16
|
-
} from '@vueuse/core'
|
|
17
|
-
import {
|
|
18
|
-
buildProps,
|
|
19
|
-
capitalize,
|
|
20
|
-
definePropType,
|
|
21
|
-
mutable,
|
|
22
|
-
throwError,
|
|
23
|
-
} from 'element-plus/es/utils/index.mjs'
|
|
24
|
-
import { EVENT_CODE } from 'element-plus/es/constants/index.mjs'
|
|
25
|
-
import { ElIcon } from 'element-plus/es/components/icon/index.mjs'
|
|
26
|
-
import { ArrowLeft, ArrowRight, Close } from '@element-plus/icons-vue'
|
|
27
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
28
|
-
import TabBar from './tab-bar.vue'
|
|
29
|
-
import { tabsRootContextKey } from './constants.js'
|
|
30
|
-
|
|
31
|
-
// import type { CSSProperties, ExtractPropTypes } from 'vue'
|
|
32
|
-
// import type { TabsPaneContext } from './constants'
|
|
33
|
-
// import type { TabPaneName } from './tabs'
|
|
34
|
-
|
|
35
|
-
// interface Scrollable {
|
|
36
|
-
// next?: boolean
|
|
37
|
-
// prev?: number
|
|
38
|
-
// }
|
|
39
|
-
|
|
40
|
-
export const tabNavProps = buildProps({
|
|
41
|
-
panes: {
|
|
42
|
-
type: definePropType(Array),
|
|
43
|
-
default: () => mutable([]),
|
|
44
|
-
},
|
|
45
|
-
currentName: {
|
|
46
|
-
type: [String, Number],
|
|
47
|
-
default: '',
|
|
48
|
-
},
|
|
49
|
-
editable: Boolean,
|
|
50
|
-
type: {
|
|
51
|
-
type: String,
|
|
52
|
-
values: ['card', 'border-card', ''],
|
|
53
|
-
default: '',
|
|
54
|
-
},
|
|
55
|
-
showBar: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: true
|
|
58
|
-
},
|
|
59
|
-
stretch: Boolean,
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
export const tabNavEmits = {
|
|
63
|
-
tabClick: (tab, tabName, ev) =>
|
|
64
|
-
ev instanceof Event,
|
|
65
|
-
tabRemove: (tab, ev) => ev instanceof Event,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// export type TabNavProps = ExtractPropTypes<typeof tabNavProps>
|
|
69
|
-
// export type TabNavEmits = typeof tabNavEmits
|
|
70
|
-
|
|
71
|
-
const COMPONENT_NAME = 'ElTabNav'
|
|
72
|
-
const TabNav = defineComponent({
|
|
73
|
-
name: COMPONENT_NAME,
|
|
74
|
-
props: tabNavProps,
|
|
75
|
-
emits: tabNavEmits,
|
|
76
|
-
setup(props, { expose, emit }) {
|
|
77
|
-
const vm = getCurrentInstance()
|
|
78
|
-
|
|
79
|
-
const rootTabs = inject(tabsRootContextKey)
|
|
80
|
-
if (!rootTabs) throwError(COMPONENT_NAME, `<el-tabs><tab-nav /></el-tabs>`)
|
|
81
|
-
|
|
82
|
-
const ns = useNamespace('tabs')
|
|
83
|
-
const visibility = useDocumentVisibility()
|
|
84
|
-
const focused = useWindowFocus()
|
|
85
|
-
|
|
86
|
-
const navScroll$ = ref()
|
|
87
|
-
const nav$ = ref()
|
|
88
|
-
const el$ = ref()
|
|
89
|
-
|
|
90
|
-
const tabBarRef = ref()
|
|
91
|
-
|
|
92
|
-
const scrollable = ref(false)
|
|
93
|
-
const navOffset = ref(0)
|
|
94
|
-
const isFocus = ref(false)
|
|
95
|
-
const focusable = ref(true)
|
|
96
|
-
|
|
97
|
-
const sizeName = computed(() =>
|
|
98
|
-
['top', 'bottom'].includes(rootTabs.props.tabPosition)
|
|
99
|
-
? 'width'
|
|
100
|
-
: 'height'
|
|
101
|
-
)
|
|
102
|
-
const navStyle = computed(() => {
|
|
103
|
-
const dir = sizeName.value === 'width' ? 'X' : 'Y'
|
|
104
|
-
return {
|
|
105
|
-
transform: `translate${dir}(-${navOffset.value}px)`,
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
const scrollPrev = () => {
|
|
110
|
-
if (!navScroll$.value) return
|
|
111
|
-
|
|
112
|
-
const containerSize =
|
|
113
|
-
navScroll$.value[`offset${capitalize(sizeName.value)}`]
|
|
114
|
-
const currentOffset = navOffset.value
|
|
115
|
-
|
|
116
|
-
if (!currentOffset) return
|
|
117
|
-
|
|
118
|
-
const newOffset =
|
|
119
|
-
currentOffset > containerSize ? currentOffset - containerSize : 0
|
|
120
|
-
|
|
121
|
-
navOffset.value = newOffset
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const scrollNext = () => {
|
|
125
|
-
if (!navScroll$.value || !nav$.value) return
|
|
126
|
-
|
|
127
|
-
const navSize = nav$.value[`offset${capitalize(sizeName.value)}`]
|
|
128
|
-
const containerSize =
|
|
129
|
-
navScroll$.value[`offset${capitalize(sizeName.value)}`]
|
|
130
|
-
const currentOffset = navOffset.value
|
|
131
|
-
|
|
132
|
-
if (navSize - currentOffset <= containerSize) return
|
|
133
|
-
|
|
134
|
-
const newOffset =
|
|
135
|
-
navSize - currentOffset > containerSize * 2
|
|
136
|
-
? currentOffset + containerSize
|
|
137
|
-
: navSize - containerSize
|
|
138
|
-
|
|
139
|
-
navOffset.value = newOffset
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const scrollToActiveTab = async () => {
|
|
143
|
-
const nav = nav$.value
|
|
144
|
-
if (!scrollable.value || !el$.value || !navScroll$.value || !nav) return
|
|
145
|
-
|
|
146
|
-
await nextTick()
|
|
147
|
-
|
|
148
|
-
const activeTab = el$.value.querySelector('.is-active')
|
|
149
|
-
if (!activeTab) return
|
|
150
|
-
|
|
151
|
-
const navScroll = navScroll$.value
|
|
152
|
-
const isHorizontal = ['top', 'bottom'].includes(
|
|
153
|
-
rootTabs.props.tabPosition
|
|
154
|
-
)
|
|
155
|
-
const activeTabBounding = activeTab.getBoundingClientRect()
|
|
156
|
-
const navScrollBounding = navScroll.getBoundingClientRect()
|
|
157
|
-
const maxOffset = isHorizontal
|
|
158
|
-
? nav.offsetWidth - navScrollBounding.width
|
|
159
|
-
: nav.offsetHeight - navScrollBounding.height
|
|
160
|
-
const currentOffset = navOffset.value
|
|
161
|
-
let newOffset = currentOffset
|
|
162
|
-
|
|
163
|
-
if (isHorizontal) {
|
|
164
|
-
if (activeTabBounding.left < navScrollBounding.left) {
|
|
165
|
-
newOffset =
|
|
166
|
-
currentOffset - (navScrollBounding.left - activeTabBounding.left)
|
|
167
|
-
}
|
|
168
|
-
if (activeTabBounding.right > navScrollBounding.right) {
|
|
169
|
-
newOffset =
|
|
170
|
-
currentOffset + activeTabBounding.right - navScrollBounding.right
|
|
171
|
-
}
|
|
172
|
-
} else {
|
|
173
|
-
if (activeTabBounding.top < navScrollBounding.top) {
|
|
174
|
-
newOffset =
|
|
175
|
-
currentOffset - (navScrollBounding.top - activeTabBounding.top)
|
|
176
|
-
}
|
|
177
|
-
if (activeTabBounding.bottom > navScrollBounding.bottom) {
|
|
178
|
-
newOffset =
|
|
179
|
-
currentOffset +
|
|
180
|
-
(activeTabBounding.bottom - navScrollBounding.bottom)
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
newOffset = Math.max(newOffset, 0)
|
|
184
|
-
navOffset.value = Math.min(newOffset, maxOffset)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const update = () => {
|
|
188
|
-
if (!nav$.value || !navScroll$.value) return
|
|
189
|
-
|
|
190
|
-
props.stretch && tabBarRef.value?.update()
|
|
191
|
-
|
|
192
|
-
const navSize = nav$.value[`offset${capitalize(sizeName.value)}`]
|
|
193
|
-
const containerSize =
|
|
194
|
-
navScroll$.value[`offset${capitalize(sizeName.value)}`]
|
|
195
|
-
const currentOffset = navOffset.value
|
|
196
|
-
|
|
197
|
-
if (containerSize < navSize) {
|
|
198
|
-
scrollable.value = scrollable.value || {}
|
|
199
|
-
scrollable.value.prev = currentOffset
|
|
200
|
-
scrollable.value.next = currentOffset + containerSize < navSize
|
|
201
|
-
if (navSize - currentOffset < containerSize) {
|
|
202
|
-
navOffset.value = navSize - containerSize
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
scrollable.value = false
|
|
206
|
-
if (currentOffset > 0) {
|
|
207
|
-
navOffset.value = 0
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const changeTab = (e) => {
|
|
213
|
-
const code = e.code
|
|
214
|
-
|
|
215
|
-
const { up, down, left, right } = EVENT_CODE
|
|
216
|
-
if (![up, down, left, right].includes(code)) return
|
|
217
|
-
|
|
218
|
-
// 左右上下键更换tab
|
|
219
|
-
const tabList = Array.from(
|
|
220
|
-
(e.currentTarget).querySelectorAll<HTMLDivElement>(
|
|
221
|
-
'[role=tab]:not(.is-disabled)'
|
|
222
|
-
)
|
|
223
|
-
)
|
|
224
|
-
const currentIndex = tabList.indexOf(e.target)
|
|
225
|
-
|
|
226
|
-
let nextIndex
|
|
227
|
-
if (code === left || code === up) {
|
|
228
|
-
// left
|
|
229
|
-
if (currentIndex === 0) {
|
|
230
|
-
// first
|
|
231
|
-
nextIndex = tabList.length - 1
|
|
232
|
-
} else {
|
|
233
|
-
nextIndex = currentIndex - 1
|
|
234
|
-
}
|
|
235
|
-
} else {
|
|
236
|
-
// right
|
|
237
|
-
if (currentIndex < tabList.length - 1) {
|
|
238
|
-
// not last
|
|
239
|
-
nextIndex = currentIndex + 1
|
|
240
|
-
} else {
|
|
241
|
-
nextIndex = 0
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
tabList[nextIndex].focus({ preventScroll: true }) // 改变焦点元素
|
|
245
|
-
tabList[nextIndex].click() // 选中下一个tab
|
|
246
|
-
setFocus()
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const setFocus = () => {
|
|
250
|
-
if (focusable.value) isFocus.value = true
|
|
251
|
-
}
|
|
252
|
-
const removeFocus = () => (isFocus.value = false)
|
|
253
|
-
|
|
254
|
-
watch(visibility, (visibility) => {
|
|
255
|
-
if (visibility === 'hidden') {
|
|
256
|
-
focusable.value = false
|
|
257
|
-
} else if (visibility === 'visible') {
|
|
258
|
-
setTimeout(() => (focusable.value = true), 50)
|
|
259
|
-
}
|
|
260
|
-
})
|
|
261
|
-
watch(focused, (focused) => {
|
|
262
|
-
if (focused) {
|
|
263
|
-
setTimeout(() => (focusable.value = true), 50)
|
|
264
|
-
} else {
|
|
265
|
-
focusable.value = false
|
|
266
|
-
}
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
useResizeObserver(el$, update)
|
|
270
|
-
|
|
271
|
-
onMounted(() => setTimeout(() => scrollToActiveTab(), 0))
|
|
272
|
-
onUpdated(() => update())
|
|
273
|
-
|
|
274
|
-
expose({
|
|
275
|
-
scrollToActiveTab,
|
|
276
|
-
removeFocus,
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
watch(
|
|
280
|
-
() => props.panes,
|
|
281
|
-
() => vm.update(),
|
|
282
|
-
{ flush: 'post', deep: true }
|
|
283
|
-
)
|
|
284
|
-
|
|
285
|
-
return () => {
|
|
286
|
-
const scrollBtn = scrollable.value
|
|
287
|
-
? [
|
|
288
|
-
<span
|
|
289
|
-
class={[
|
|
290
|
-
ns.e('nav-prev'),
|
|
291
|
-
ns.is('disabled', !scrollable.value.prev),
|
|
292
|
-
]}
|
|
293
|
-
onClick={scrollPrev}
|
|
294
|
-
>
|
|
295
|
-
<ElIcon>
|
|
296
|
-
<ArrowLeft />
|
|
297
|
-
</ElIcon>
|
|
298
|
-
</span>,
|
|
299
|
-
<span
|
|
300
|
-
class={[
|
|
301
|
-
ns.e('nav-next'),
|
|
302
|
-
ns.is('disabled', !scrollable.value.next),
|
|
303
|
-
]}
|
|
304
|
-
onClick={scrollNext}
|
|
305
|
-
>
|
|
306
|
-
<ElIcon>
|
|
307
|
-
<ArrowRight />
|
|
308
|
-
</ElIcon>
|
|
309
|
-
</span>,
|
|
310
|
-
]
|
|
311
|
-
: null
|
|
312
|
-
|
|
313
|
-
const tabs = props.panes.map((pane, index) => {
|
|
314
|
-
const uid = pane.uid
|
|
315
|
-
const disabled = pane.props.disabled
|
|
316
|
-
const tabName = pane.props.name ?? pane.index ?? `${index}`
|
|
317
|
-
const closable = !disabled && (pane.isClosable || props.editable)
|
|
318
|
-
const hidden = pane.props.hidden
|
|
319
|
-
pane.index = `${index}`
|
|
320
|
-
|
|
321
|
-
const btnClose = closable ? (
|
|
322
|
-
<ElIcon
|
|
323
|
-
class="is-icon-close"
|
|
324
|
-
// `onClick` not exist when generate dts
|
|
325
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
326
|
-
// @ts-ignore
|
|
327
|
-
onClick={(ev) => emit('tabRemove', pane, ev)}
|
|
328
|
-
>
|
|
329
|
-
<Close />
|
|
330
|
-
</ElIcon>
|
|
331
|
-
) : null
|
|
332
|
-
|
|
333
|
-
const tabLabelContent = pane.slots.label?.() || pane.props.label
|
|
334
|
-
const tabindex = !disabled && pane.active ? 0 : -1
|
|
335
|
-
if (hidden) {
|
|
336
|
-
return null
|
|
337
|
-
}
|
|
338
|
-
return (
|
|
339
|
-
<div
|
|
340
|
-
ref={`tab-${uid}`}
|
|
341
|
-
class={[
|
|
342
|
-
ns.e('item'),
|
|
343
|
-
ns.is(rootTabs.props.tabPosition),
|
|
344
|
-
ns.is('active', pane.active),
|
|
345
|
-
ns.is('disabled', disabled),
|
|
346
|
-
ns.is('closable', closable),
|
|
347
|
-
ns.is('focus', isFocus.value),
|
|
348
|
-
]}
|
|
349
|
-
style={ hidden ? {display: 'none'}: {}}
|
|
350
|
-
id={`tab-${tabName}`}
|
|
351
|
-
key={`tab-${uid}`}
|
|
352
|
-
aria-controls={`pane-${tabName}`}
|
|
353
|
-
role="tab"
|
|
354
|
-
aria-selected={pane.active}
|
|
355
|
-
tabindex={tabindex}
|
|
356
|
-
onFocus={() => setFocus()}
|
|
357
|
-
onBlur={() => removeFocus()}
|
|
358
|
-
onClick={(ev) => {
|
|
359
|
-
removeFocus()
|
|
360
|
-
emit('tabClick', pane, tabName, ev)
|
|
361
|
-
}}
|
|
362
|
-
onKeydown={(ev) => {
|
|
363
|
-
if (
|
|
364
|
-
closable &&
|
|
365
|
-
(ev.code === EVENT_CODE.delete ||
|
|
366
|
-
ev.code === EVENT_CODE.backspace)
|
|
367
|
-
) {
|
|
368
|
-
emit('tabRemove', pane, ev)
|
|
369
|
-
}
|
|
370
|
-
}}
|
|
371
|
-
>
|
|
372
|
-
<div title={tabLabelContent} class='tabs__item-wrap'>
|
|
373
|
-
{...[tabLabelContent, btnClose]}
|
|
374
|
-
</div>
|
|
375
|
-
</div>
|
|
376
|
-
)
|
|
377
|
-
})
|
|
378
|
-
|
|
379
|
-
return (
|
|
380
|
-
<div
|
|
381
|
-
ref={el$}
|
|
382
|
-
class={[
|
|
383
|
-
ns.e('nav-wrap'),
|
|
384
|
-
ns.is('scrollable', !!scrollable.value),
|
|
385
|
-
ns.is(rootTabs.props.tabPosition),
|
|
386
|
-
!props.showBar ? 'hidden-bar' : ''
|
|
387
|
-
]}
|
|
388
|
-
>
|
|
389
|
-
{scrollBtn}
|
|
390
|
-
<div class={[ns.e('nav-scroll')]} ref={navScroll$}>
|
|
391
|
-
<div
|
|
392
|
-
class={[
|
|
393
|
-
ns.e('nav'),
|
|
394
|
-
ns.is(rootTabs.props.tabPosition),
|
|
395
|
-
ns.is(
|
|
396
|
-
'stretch',
|
|
397
|
-
props.stretch &&
|
|
398
|
-
['top', 'bottom'].includes(rootTabs.props.tabPosition)
|
|
399
|
-
),
|
|
400
|
-
]}
|
|
401
|
-
ref={nav$}
|
|
402
|
-
style={navStyle.value}
|
|
403
|
-
role="tablist"
|
|
404
|
-
onKeydown={changeTab}
|
|
405
|
-
>
|
|
406
|
-
{...[
|
|
407
|
-
!props.type && props.showBar ? (
|
|
408
|
-
<TabBar ref={tabBarRef} tabs={[...props.panes]} />
|
|
409
|
-
) : null,
|
|
410
|
-
tabs,
|
|
411
|
-
]}
|
|
412
|
-
</div>
|
|
413
|
-
</div>
|
|
414
|
-
</div>
|
|
415
|
-
)
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
})
|
|
419
|
-
|
|
420
|
-
// export type TabNavInstance = InstanceType<typeof TabNav> & {
|
|
421
|
-
// scrollToActiveTab: () => Promise<void>
|
|
422
|
-
// removeFocus: () => void
|
|
423
|
-
// }
|
|
424
|
-
export default TabNav
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { buildProps } from 'element-plus/es/utils/index.mjs'
|
|
2
|
-
|
|
3
|
-
export const tabPaneProps = buildProps({
|
|
4
|
-
label: {
|
|
5
|
-
type: String,
|
|
6
|
-
default: '',
|
|
7
|
-
},
|
|
8
|
-
name: {
|
|
9
|
-
type: [String, Number],
|
|
10
|
-
},
|
|
11
|
-
closable: Boolean,
|
|
12
|
-
disabled: Boolean,
|
|
13
|
-
lazy: Boolean,
|
|
14
|
-
hidden: Boolean,
|
|
15
|
-
})
|
|
16
|
-
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="shouldBeRender"
|
|
4
|
-
v-show="active"
|
|
5
|
-
:id="`pane-${paneName}`"
|
|
6
|
-
:class="ns.b()"
|
|
7
|
-
role="tabpanel"
|
|
8
|
-
:aria-hidden="!active"
|
|
9
|
-
:aria-labelledby="`tab-${paneName}`"
|
|
10
|
-
>
|
|
11
|
-
<slot />
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup>
|
|
16
|
-
import {
|
|
17
|
-
computed,
|
|
18
|
-
getCurrentInstance,
|
|
19
|
-
inject,
|
|
20
|
-
onMounted,
|
|
21
|
-
onUnmounted,
|
|
22
|
-
reactive,
|
|
23
|
-
ref,
|
|
24
|
-
useSlots,
|
|
25
|
-
watch,
|
|
26
|
-
} from 'vue'
|
|
27
|
-
import { eagerComputed } from '@vueuse/core'
|
|
28
|
-
import { throwError } from 'element-plus/es/utils/index.mjs'
|
|
29
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
30
|
-
import { tabsRootContextKey } from './constants.js'
|
|
31
|
-
import { tabPaneProps } from './tab-pane'
|
|
32
|
-
|
|
33
|
-
const COMPONENT_NAME = 'ElTabPane'
|
|
34
|
-
defineOptions({
|
|
35
|
-
name: COMPONENT_NAME,
|
|
36
|
-
})
|
|
37
|
-
const props = defineProps(tabPaneProps)
|
|
38
|
-
|
|
39
|
-
const instance = getCurrentInstance()
|
|
40
|
-
const slots = useSlots()
|
|
41
|
-
|
|
42
|
-
const tabsRoot = inject(tabsRootContextKey)
|
|
43
|
-
if (!tabsRoot)
|
|
44
|
-
throwError(COMPONENT_NAME, 'usage: <el-tabs><el-tab-pane /></el-tabs/>')
|
|
45
|
-
|
|
46
|
-
const ns = useNamespace('tab-pane')
|
|
47
|
-
|
|
48
|
-
const index = ref()
|
|
49
|
-
const isClosable = computed(() => props.closable || tabsRoot.props.closable)
|
|
50
|
-
const active = eagerComputed(
|
|
51
|
-
() => tabsRoot.currentName.value === (props.name ?? index.value)
|
|
52
|
-
)
|
|
53
|
-
const loaded = ref(active.value)
|
|
54
|
-
const paneName = computed(() => props.name ?? index.value)
|
|
55
|
-
const shouldBeRender = eagerComputed(
|
|
56
|
-
() => !props.lazy || loaded.value || active.value
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
watch(active, (val) => {
|
|
60
|
-
if (val) loaded.value = true
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
const pane = reactive({
|
|
64
|
-
uid: instance.uid,
|
|
65
|
-
slots,
|
|
66
|
-
props,
|
|
67
|
-
paneName,
|
|
68
|
-
active,
|
|
69
|
-
index,
|
|
70
|
-
isClosable,
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
onMounted(() => {
|
|
74
|
-
tabsRoot.registerPane(pane)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
onUnmounted(() => {
|
|
78
|
-
tabsRoot.unregisterPane(pane.uid)
|
|
79
|
-
})
|
|
80
|
-
</script>
|