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,119 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import {
|
|
3
|
-
defineComponent,
|
|
4
|
-
getCurrentInstance,
|
|
5
|
-
h,
|
|
6
|
-
inject,
|
|
7
|
-
onUnmounted,
|
|
8
|
-
watch,
|
|
9
|
-
} from 'vue'
|
|
10
|
-
import { addClass, isClient, rAF, removeClass } from 'element-plus/es/utils/index.mjs'
|
|
11
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
12
|
-
import useLayoutObserver from '../layout-observer'
|
|
13
|
-
import { removePopper } from '../util'
|
|
14
|
-
import { TABLE_INJECTION_KEY } from '../tokens'
|
|
15
|
-
import useRender from './render-helper'
|
|
16
|
-
import defaultProps from './defaults'
|
|
17
|
-
|
|
18
|
-
import type { VNode } from 'vue'
|
|
19
|
-
|
|
20
|
-
export default defineComponent({
|
|
21
|
-
name: 'ElTableBody',
|
|
22
|
-
props: defaultProps,
|
|
23
|
-
setup(props) {
|
|
24
|
-
const instance = getCurrentInstance()
|
|
25
|
-
const parent = inject(TABLE_INJECTION_KEY)
|
|
26
|
-
const ns = useNamespace('table')
|
|
27
|
-
const { wrappedRowRender, tooltipContent, tooltipTrigger } =
|
|
28
|
-
useRender(props)
|
|
29
|
-
const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent!)
|
|
30
|
-
|
|
31
|
-
const hoveredCellList = []
|
|
32
|
-
watch(props.store.states.hoverRow, (newVal: any, oldVal: any) => {
|
|
33
|
-
const el = instance?.vnode.el as HTMLElement
|
|
34
|
-
const rows = Array.from(el?.children || []).filter((e) =>
|
|
35
|
-
e?.classList.contains(`${ns.e('row')}`)
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
// hover rowSpan > 1 choose the whole row
|
|
39
|
-
let rowNum = newVal
|
|
40
|
-
const childNodes = rows[rowNum]?.childNodes
|
|
41
|
-
if (childNodes?.length) {
|
|
42
|
-
let control = 0
|
|
43
|
-
const indexes = Array.from(childNodes).reduce((acc, item, index) => {
|
|
44
|
-
// drop colsSpan
|
|
45
|
-
if (childNodes[index]?.colSpan > 1) {
|
|
46
|
-
control = childNodes[index]?.colSpan
|
|
47
|
-
}
|
|
48
|
-
if (item.nodeName !== 'TD' && control === 0) {
|
|
49
|
-
acc.push(index)
|
|
50
|
-
}
|
|
51
|
-
control > 0 && control--
|
|
52
|
-
return acc
|
|
53
|
-
}, [])
|
|
54
|
-
|
|
55
|
-
indexes.forEach((rowIndex) => {
|
|
56
|
-
rowNum = newVal
|
|
57
|
-
while (rowNum > 0) {
|
|
58
|
-
// find from previous
|
|
59
|
-
const preChildNodes = rows[rowNum - 1]?.childNodes
|
|
60
|
-
if (
|
|
61
|
-
preChildNodes[rowIndex] &&
|
|
62
|
-
preChildNodes[rowIndex].nodeName === 'TD' &&
|
|
63
|
-
preChildNodes[rowIndex].rowSpan > 1
|
|
64
|
-
) {
|
|
65
|
-
addClass(preChildNodes[rowIndex], 'hover-cell')
|
|
66
|
-
hoveredCellList.push(preChildNodes[rowIndex])
|
|
67
|
-
break
|
|
68
|
-
}
|
|
69
|
-
rowNum--
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
} else {
|
|
73
|
-
hoveredCellList.forEach((item) => removeClass(item, 'hover-cell'))
|
|
74
|
-
hoveredCellList.length = 0
|
|
75
|
-
}
|
|
76
|
-
if (!props.store.states.isComplex.value || !isClient) return
|
|
77
|
-
|
|
78
|
-
rAF(() => {
|
|
79
|
-
// just get first level children; fix #9723
|
|
80
|
-
const oldRow = rows[oldVal]
|
|
81
|
-
const newRow = rows[newVal]
|
|
82
|
-
// when there is fixed row, hover on rowSpan > 1 should not clear the class
|
|
83
|
-
if (oldRow && !oldRow.classList.contains('hover-fixed-row')) {
|
|
84
|
-
removeClass(oldRow, 'hover-row')
|
|
85
|
-
}
|
|
86
|
-
if (newRow) {
|
|
87
|
-
addClass(newRow, 'hover-row')
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
onUnmounted(() => {
|
|
93
|
-
removePopper?.()
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
ns,
|
|
98
|
-
onColumnsChange,
|
|
99
|
-
onScrollableChange,
|
|
100
|
-
wrappedRowRender,
|
|
101
|
-
tooltipContent,
|
|
102
|
-
tooltipTrigger,
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
render() {
|
|
106
|
-
const { wrappedRowRender, store } = this
|
|
107
|
-
const data = store.states.data.value || []
|
|
108
|
-
// Why do we need tabIndex: -1 ?
|
|
109
|
-
// If you set the tabindex attribute on an element ,
|
|
110
|
-
// then its child content cannot be scrolled with the arrow keys,
|
|
111
|
-
// unless you set tabindex on the content too
|
|
112
|
-
// See https://github.com/facebook/react/issues/25462#issuecomment-1274775248 or https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/tabindex
|
|
113
|
-
return h('tbody', { tabIndex: -1 }, [
|
|
114
|
-
data.reduce((acc: VNode[], row) => {
|
|
115
|
-
return acc.concat(wrappedRowRender(row, acc.length))
|
|
116
|
-
}, []),
|
|
117
|
-
])
|
|
118
|
-
},
|
|
119
|
-
})
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { computed, h, inject } from 'vue'
|
|
3
|
-
import { merge } from 'lodash-unified'
|
|
4
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
5
|
-
import { getRowIdentity } from '../util'
|
|
6
|
-
import { TABLE_INJECTION_KEY } from '../tokens'
|
|
7
|
-
import useEvents from './events-helper'
|
|
8
|
-
import useStyles from './styles-helper'
|
|
9
|
-
import type { TableBodyProps } from './defaults'
|
|
10
|
-
import type { RenderRowData, TableProps, TreeNode } from '../table/defaults'
|
|
11
|
-
|
|
12
|
-
function useRender<T>(props: Partial<TableBodyProps<T>>) {
|
|
13
|
-
const parent = inject(TABLE_INJECTION_KEY)
|
|
14
|
-
const ns = useNamespace('table')
|
|
15
|
-
const {
|
|
16
|
-
handleDoubleClick,
|
|
17
|
-
handleClick,
|
|
18
|
-
handleContextMenu,
|
|
19
|
-
handleMouseEnter,
|
|
20
|
-
handleMouseLeave,
|
|
21
|
-
handleCellMouseEnter,
|
|
22
|
-
handleCellMouseLeave,
|
|
23
|
-
tooltipContent,
|
|
24
|
-
tooltipTrigger,
|
|
25
|
-
} = useEvents(props)
|
|
26
|
-
const {
|
|
27
|
-
getRowStyle,
|
|
28
|
-
getRowClass,
|
|
29
|
-
getCellStyle,
|
|
30
|
-
getCellClass,
|
|
31
|
-
getSpan,
|
|
32
|
-
getColspanRealWidth,
|
|
33
|
-
} = useStyles(props)
|
|
34
|
-
const firstDefaultColumnIndex = computed(() => {
|
|
35
|
-
return props.store.states.columns.value.findIndex(
|
|
36
|
-
({ type }) => type === 'default'
|
|
37
|
-
)
|
|
38
|
-
})
|
|
39
|
-
const getKeyOfRow = (row: T, index: number) => {
|
|
40
|
-
const rowKey = (parent.props as Partial<TableProps<T>>).rowKey
|
|
41
|
-
if (rowKey) {
|
|
42
|
-
return getRowIdentity(row, rowKey)
|
|
43
|
-
}
|
|
44
|
-
return index
|
|
45
|
-
}
|
|
46
|
-
const rowRender = (
|
|
47
|
-
row: T,
|
|
48
|
-
$index: number,
|
|
49
|
-
treeRowData?: TreeNode,
|
|
50
|
-
expanded = false
|
|
51
|
-
) => {
|
|
52
|
-
const { tooltipEffect, tooltipOptions, store } = props
|
|
53
|
-
const { indent, columns } = store.states
|
|
54
|
-
const rowClasses = getRowClass(row, $index)
|
|
55
|
-
let display = true
|
|
56
|
-
if (treeRowData) {
|
|
57
|
-
rowClasses.push(ns.em('row', `level-${treeRowData.level}`))
|
|
58
|
-
display = treeRowData.display
|
|
59
|
-
}
|
|
60
|
-
const displayStyle = display
|
|
61
|
-
? null
|
|
62
|
-
: {
|
|
63
|
-
display: 'none',
|
|
64
|
-
}
|
|
65
|
-
return h(
|
|
66
|
-
'tr',
|
|
67
|
-
{
|
|
68
|
-
style: [displayStyle, getRowStyle(row, $index)],
|
|
69
|
-
class: rowClasses,
|
|
70
|
-
key: getKeyOfRow(row, $index),
|
|
71
|
-
onDblclick: ($event) => handleDoubleClick($event, row),
|
|
72
|
-
onClick: ($event) => handleClick($event, row),
|
|
73
|
-
onContextmenu: ($event) => handleContextMenu($event, row),
|
|
74
|
-
onMouseenter: () => handleMouseEnter($index),
|
|
75
|
-
onMouseleave: handleMouseLeave,
|
|
76
|
-
},
|
|
77
|
-
columns.value.map((column, cellIndex) => {
|
|
78
|
-
const { rowspan, colspan } = getSpan(row, column, $index, cellIndex)
|
|
79
|
-
if (!rowspan || !colspan) {
|
|
80
|
-
return null
|
|
81
|
-
}
|
|
82
|
-
const columnData = Object.assign({}, column)
|
|
83
|
-
columnData.realWidth = getColspanRealWidth(
|
|
84
|
-
columns.value,
|
|
85
|
-
colspan,
|
|
86
|
-
cellIndex
|
|
87
|
-
)
|
|
88
|
-
const data: RenderRowData<T> = {
|
|
89
|
-
store: props.store,
|
|
90
|
-
_self: props.context || parent,
|
|
91
|
-
column: columnData,
|
|
92
|
-
row,
|
|
93
|
-
$index,
|
|
94
|
-
cellIndex,
|
|
95
|
-
expanded,
|
|
96
|
-
}
|
|
97
|
-
if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
|
|
98
|
-
data.treeNode = {
|
|
99
|
-
indent: treeRowData.level * indent.value,
|
|
100
|
-
level: treeRowData.level,
|
|
101
|
-
}
|
|
102
|
-
if (typeof treeRowData.expanded === 'boolean') {
|
|
103
|
-
data.treeNode.expanded = treeRowData.expanded
|
|
104
|
-
// 表明是懒加载
|
|
105
|
-
if ('loading' in treeRowData) {
|
|
106
|
-
data.treeNode.loading = treeRowData.loading
|
|
107
|
-
}
|
|
108
|
-
if ('noLazyChildren' in treeRowData) {
|
|
109
|
-
data.treeNode.noLazyChildren = treeRowData.noLazyChildren
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`
|
|
114
|
-
const patchKey = columnData.columnKey || columnData.rawColumnKey || ''
|
|
115
|
-
const tdChildren = cellChildren(cellIndex, column, data)
|
|
116
|
-
|
|
117
|
-
let mergedTooltipOptions =
|
|
118
|
-
column.showOverflowTooltip &&
|
|
119
|
-
merge(
|
|
120
|
-
{
|
|
121
|
-
effect: tooltipEffect,
|
|
122
|
-
},
|
|
123
|
-
tooltipOptions,
|
|
124
|
-
column.showOverflowTooltip
|
|
125
|
-
)
|
|
126
|
-
if (typeof column.showOverflowTooltip === 'function') {
|
|
127
|
-
mergedTooltipOptions.showOverflowTooltip = () => {
|
|
128
|
-
return column.showOverflowTooltip(data)
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return h(
|
|
132
|
-
'td',
|
|
133
|
-
{
|
|
134
|
-
style: getCellStyle($index, cellIndex, row, column),
|
|
135
|
-
class: getCellClass($index, cellIndex, row, column, colspan - 1),
|
|
136
|
-
key: `${patchKey}${baseKey}`,
|
|
137
|
-
rowspan,
|
|
138
|
-
colspan,
|
|
139
|
-
onMouseenter: ($event) =>
|
|
140
|
-
handleCellMouseEnter($event, row, mergedTooltipOptions),
|
|
141
|
-
onMouseleave: handleCellMouseLeave,
|
|
142
|
-
},
|
|
143
|
-
[tdChildren]
|
|
144
|
-
)
|
|
145
|
-
})
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
const cellChildren = (cellIndex, column, data) => {
|
|
149
|
-
return column.renderCell(data)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const wrappedRowRender = (row: T, $index: number) => {
|
|
153
|
-
const store = props.store
|
|
154
|
-
const { isRowExpanded, assertRowKey } = store
|
|
155
|
-
const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } =
|
|
156
|
-
store.states
|
|
157
|
-
const columns = store.states.columns.value
|
|
158
|
-
const hasExpandColumn = columns.some(({ type }) => type === 'expand')
|
|
159
|
-
if (hasExpandColumn) {
|
|
160
|
-
const expanded = isRowExpanded(row)
|
|
161
|
-
const tr = rowRender(row, $index, undefined, expanded)
|
|
162
|
-
const renderExpanded = parent.renderExpanded
|
|
163
|
-
if (expanded) {
|
|
164
|
-
if (!renderExpanded) {
|
|
165
|
-
console.error('[Element Error]renderExpanded is required.')
|
|
166
|
-
return tr
|
|
167
|
-
}
|
|
168
|
-
// 使用二维数组,避免修改 $index
|
|
169
|
-
// Use a matrix to avoid modifying $index
|
|
170
|
-
return [
|
|
171
|
-
[
|
|
172
|
-
tr,
|
|
173
|
-
h(
|
|
174
|
-
'tr',
|
|
175
|
-
{
|
|
176
|
-
key: `expanded-row__${tr.key as string}`,
|
|
177
|
-
},
|
|
178
|
-
[
|
|
179
|
-
h(
|
|
180
|
-
'td',
|
|
181
|
-
{
|
|
182
|
-
colspan: columns.length,
|
|
183
|
-
class: `${ns.e('cell')} ${ns.e('expanded-cell')}`,
|
|
184
|
-
},
|
|
185
|
-
[renderExpanded({ row, $index, store, expanded })]
|
|
186
|
-
),
|
|
187
|
-
]
|
|
188
|
-
),
|
|
189
|
-
],
|
|
190
|
-
]
|
|
191
|
-
} else {
|
|
192
|
-
// 使用二维数组,避免修改 $index
|
|
193
|
-
// Use a two dimensional array avoid modifying $index
|
|
194
|
-
return [[tr]]
|
|
195
|
-
}
|
|
196
|
-
} else if (Object.keys(treeData.value).length) {
|
|
197
|
-
assertRowKey()
|
|
198
|
-
// TreeTable 时,rowKey 必须由用户设定,不使用 getKeyOfRow 计算
|
|
199
|
-
// 在调用 rowRender 函数时,仍然会计算 rowKey,不太好的操作
|
|
200
|
-
const key = getRowIdentity(row, rowKey.value)
|
|
201
|
-
let cur = treeData.value[key]
|
|
202
|
-
let treeRowData = null
|
|
203
|
-
if (cur) {
|
|
204
|
-
treeRowData = {
|
|
205
|
-
expanded: cur.expanded,
|
|
206
|
-
level: cur.level,
|
|
207
|
-
display: true,
|
|
208
|
-
}
|
|
209
|
-
if (typeof cur.lazy === 'boolean') {
|
|
210
|
-
if (typeof cur.loaded === 'boolean' && cur.loaded) {
|
|
211
|
-
treeRowData.noLazyChildren = !(cur.children && cur.children.length)
|
|
212
|
-
}
|
|
213
|
-
treeRowData.loading = cur.loading
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
const tmp = [rowRender(row, $index, treeRowData)]
|
|
217
|
-
// 渲染嵌套数据
|
|
218
|
-
if (cur) {
|
|
219
|
-
// currentRow 记录的是 index,所以还需主动增加 TreeTable 的 index
|
|
220
|
-
let i = 0
|
|
221
|
-
const traverse = (children, parent) => {
|
|
222
|
-
if (!(children && children.length && parent)) return
|
|
223
|
-
children.forEach((node) => {
|
|
224
|
-
// 父节点的 display 状态影响子节点的显示状态
|
|
225
|
-
const innerTreeRowData = {
|
|
226
|
-
display: parent.display && parent.expanded,
|
|
227
|
-
level: parent.level + 1,
|
|
228
|
-
expanded: false,
|
|
229
|
-
noLazyChildren: false,
|
|
230
|
-
loading: false,
|
|
231
|
-
}
|
|
232
|
-
const childKey = getRowIdentity(node, rowKey.value)
|
|
233
|
-
if (childKey === undefined || childKey === null) {
|
|
234
|
-
throw new Error('For nested data item, row-key is required.')
|
|
235
|
-
}
|
|
236
|
-
cur = { ...treeData.value[childKey] }
|
|
237
|
-
// 对于当前节点,分成有无子节点两种情况。
|
|
238
|
-
// 如果包含子节点的,设置 expanded 属性。
|
|
239
|
-
// 对于它子节点的 display 属性由它本身的 expanded 与 display 共同决定。
|
|
240
|
-
if (cur) {
|
|
241
|
-
innerTreeRowData.expanded = cur.expanded
|
|
242
|
-
// 懒加载的某些节点,level 未知
|
|
243
|
-
cur.level = cur.level || innerTreeRowData.level
|
|
244
|
-
cur.display = !!(cur.expanded && innerTreeRowData.display)
|
|
245
|
-
if (typeof cur.lazy === 'boolean') {
|
|
246
|
-
if (typeof cur.loaded === 'boolean' && cur.loaded) {
|
|
247
|
-
innerTreeRowData.noLazyChildren = !(
|
|
248
|
-
cur.children && cur.children.length
|
|
249
|
-
)
|
|
250
|
-
}
|
|
251
|
-
innerTreeRowData.loading = cur.loading
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
i++
|
|
255
|
-
tmp.push(rowRender(node, $index + i, innerTreeRowData))
|
|
256
|
-
if (cur) {
|
|
257
|
-
const nodes =
|
|
258
|
-
lazyTreeNodeMap.value[childKey] ||
|
|
259
|
-
node[childrenColumnName.value]
|
|
260
|
-
traverse(nodes, cur)
|
|
261
|
-
}
|
|
262
|
-
})
|
|
263
|
-
}
|
|
264
|
-
// 对于 root 节点,display 一定为 true
|
|
265
|
-
cur.display = true
|
|
266
|
-
const nodes =
|
|
267
|
-
lazyTreeNodeMap.value[key] || row[childrenColumnName.value]
|
|
268
|
-
traverse(nodes, cur)
|
|
269
|
-
}
|
|
270
|
-
return tmp
|
|
271
|
-
} else {
|
|
272
|
-
return rowRender(row, $index, undefined)
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return {
|
|
277
|
-
wrappedRowRender,
|
|
278
|
-
tooltipContent,
|
|
279
|
-
tooltipTrigger,
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export default useRender
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { inject } from 'vue'
|
|
3
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
4
|
-
import {
|
|
5
|
-
ensurePosition,
|
|
6
|
-
getFixedColumnOffset,
|
|
7
|
-
getFixedColumnsClass,
|
|
8
|
-
} from '../util'
|
|
9
|
-
import { TABLE_INJECTION_KEY } from '../tokens'
|
|
10
|
-
import type { TableColumnCtx } from '../table-column/defaults'
|
|
11
|
-
import type { TableBodyProps } from './defaults'
|
|
12
|
-
|
|
13
|
-
function useStyles<T>(props: Partial<TableBodyProps<T>>) {
|
|
14
|
-
const parent = inject(TABLE_INJECTION_KEY)
|
|
15
|
-
const ns = useNamespace('table')
|
|
16
|
-
|
|
17
|
-
const getRowStyle = (row: T, rowIndex: number) => {
|
|
18
|
-
const rowStyle = parent?.props.rowStyle
|
|
19
|
-
if (typeof rowStyle === 'function') {
|
|
20
|
-
return rowStyle.call(null, {
|
|
21
|
-
row,
|
|
22
|
-
rowIndex,
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
return rowStyle || null
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const getRowClass = (row: T, rowIndex: number) => {
|
|
29
|
-
const classes = [ns.e('row')]
|
|
30
|
-
if (
|
|
31
|
-
parent?.props.highlightCurrentRow &&
|
|
32
|
-
row === props.store.states.currentRow.value
|
|
33
|
-
) {
|
|
34
|
-
classes.push('current-row')
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (props.stripe && rowIndex % 2 === 1) {
|
|
38
|
-
classes.push(ns.em('row', 'striped'))
|
|
39
|
-
}
|
|
40
|
-
const rowClassName = parent?.props.rowClassName
|
|
41
|
-
if (typeof rowClassName === 'string') {
|
|
42
|
-
classes.push(rowClassName)
|
|
43
|
-
} else if (typeof rowClassName === 'function') {
|
|
44
|
-
classes.push(
|
|
45
|
-
rowClassName.call(null, {
|
|
46
|
-
row,
|
|
47
|
-
rowIndex,
|
|
48
|
-
})
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
return classes
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const getCellStyle = (
|
|
55
|
-
rowIndex: number,
|
|
56
|
-
columnIndex: number,
|
|
57
|
-
row: T,
|
|
58
|
-
column: TableColumnCtx<T>
|
|
59
|
-
) => {
|
|
60
|
-
const cellStyle = parent?.props.cellStyle
|
|
61
|
-
let cellStyles = cellStyle ?? {}
|
|
62
|
-
if (typeof cellStyle === 'function') {
|
|
63
|
-
cellStyles = cellStyle.call(null, {
|
|
64
|
-
rowIndex,
|
|
65
|
-
columnIndex,
|
|
66
|
-
row,
|
|
67
|
-
column,
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
const fixedStyle = getFixedColumnOffset(
|
|
71
|
-
columnIndex,
|
|
72
|
-
props?.fixed,
|
|
73
|
-
props.store
|
|
74
|
-
)
|
|
75
|
-
ensurePosition(fixedStyle, 'left')
|
|
76
|
-
ensurePosition(fixedStyle, 'right')
|
|
77
|
-
return Object.assign({}, cellStyles, fixedStyle)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const getCellClass = (
|
|
81
|
-
rowIndex: number,
|
|
82
|
-
columnIndex: number,
|
|
83
|
-
row: T,
|
|
84
|
-
column: TableColumnCtx<T>,
|
|
85
|
-
offset: number
|
|
86
|
-
) => {
|
|
87
|
-
const fixedClasses = getFixedColumnsClass(
|
|
88
|
-
ns.b(),
|
|
89
|
-
columnIndex,
|
|
90
|
-
props?.fixed,
|
|
91
|
-
props.store,
|
|
92
|
-
undefined,
|
|
93
|
-
offset
|
|
94
|
-
)
|
|
95
|
-
const classes = [column.id, column.align, column.className, ...fixedClasses]
|
|
96
|
-
const cellClassName = parent?.props.cellClassName
|
|
97
|
-
if (typeof cellClassName === 'string') {
|
|
98
|
-
classes.push(cellClassName)
|
|
99
|
-
} else if (typeof cellClassName === 'function') {
|
|
100
|
-
classes.push(
|
|
101
|
-
cellClassName.call(null, {
|
|
102
|
-
rowIndex,
|
|
103
|
-
columnIndex,
|
|
104
|
-
row,
|
|
105
|
-
column,
|
|
106
|
-
})
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
classes.push(ns.e('cell'))
|
|
110
|
-
return classes.filter((className) => Boolean(className)).join(' ')
|
|
111
|
-
}
|
|
112
|
-
const getSpan = (
|
|
113
|
-
row: T,
|
|
114
|
-
column: TableColumnCtx<T>,
|
|
115
|
-
rowIndex: number,
|
|
116
|
-
columnIndex: number
|
|
117
|
-
) => {
|
|
118
|
-
let rowspan = 1
|
|
119
|
-
let colspan = 1
|
|
120
|
-
const fn = parent?.props.spanMethod
|
|
121
|
-
if (typeof fn === 'function') {
|
|
122
|
-
const result = fn({
|
|
123
|
-
row,
|
|
124
|
-
column,
|
|
125
|
-
rowIndex,
|
|
126
|
-
columnIndex,
|
|
127
|
-
})
|
|
128
|
-
if (Array.isArray(result)) {
|
|
129
|
-
rowspan = result[0]
|
|
130
|
-
colspan = result[1]
|
|
131
|
-
} else if (typeof result === 'object') {
|
|
132
|
-
rowspan = result.rowspan
|
|
133
|
-
colspan = result.colspan
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return { rowspan, colspan }
|
|
137
|
-
}
|
|
138
|
-
const getColspanRealWidth = (
|
|
139
|
-
columns: TableColumnCtx<T>[],
|
|
140
|
-
colspan: number,
|
|
141
|
-
index: number
|
|
142
|
-
): number => {
|
|
143
|
-
if (colspan < 1) {
|
|
144
|
-
return columns[index].realWidth
|
|
145
|
-
}
|
|
146
|
-
const widthArr = columns
|
|
147
|
-
.map(({ realWidth, width }) => realWidth || width)
|
|
148
|
-
.slice(index, index + colspan)
|
|
149
|
-
return Number(
|
|
150
|
-
widthArr.reduce((acc, width) => Number(acc) + Number(width), -1)
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
getRowStyle,
|
|
156
|
-
getRowClass,
|
|
157
|
-
getCellStyle,
|
|
158
|
-
getCellClass,
|
|
159
|
-
getSpan,
|
|
160
|
-
getColspanRealWidth,
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export default useStyles
|