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,88 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { getCurrentInstance, watch } from 'vue'
|
|
3
|
-
import { hasOwn } from 'element-plus/es/utils/index.mjs'
|
|
4
|
-
import { parseMinWidth, parseWidth } from '../util'
|
|
5
|
-
|
|
6
|
-
import type { ComputedRef } from 'vue'
|
|
7
|
-
import type { TableColumn, TableColumnCtx, ValueOf } from './defaults'
|
|
8
|
-
|
|
9
|
-
function getAllAliases(props, aliases) {
|
|
10
|
-
return props.reduce((prev, cur) => {
|
|
11
|
-
prev[cur] = cur
|
|
12
|
-
return prev
|
|
13
|
-
}, aliases)
|
|
14
|
-
}
|
|
15
|
-
function useWatcher<T>(
|
|
16
|
-
owner: ComputedRef<any>,
|
|
17
|
-
props_: Partial<TableColumnCtx<T>>
|
|
18
|
-
) {
|
|
19
|
-
const instance = getCurrentInstance() as TableColumn<T>
|
|
20
|
-
const registerComplexWatchers = () => {
|
|
21
|
-
const props = ['fixed']
|
|
22
|
-
const aliases = {
|
|
23
|
-
realWidth: 'width',
|
|
24
|
-
realMinWidth: 'minWidth',
|
|
25
|
-
}
|
|
26
|
-
const allAliases = getAllAliases(props, aliases)
|
|
27
|
-
Object.keys(allAliases).forEach((key) => {
|
|
28
|
-
const columnKey = aliases[key]
|
|
29
|
-
if (hasOwn(props_, columnKey)) {
|
|
30
|
-
watch(
|
|
31
|
-
() => props_[columnKey],
|
|
32
|
-
(newVal) => {
|
|
33
|
-
let value: ValueOf<TableColumnCtx<T>> = newVal
|
|
34
|
-
if (columnKey === 'width' && key === 'realWidth') {
|
|
35
|
-
value = parseWidth(newVal)
|
|
36
|
-
}
|
|
37
|
-
if (columnKey === 'minWidth' && key === 'realMinWidth') {
|
|
38
|
-
value = parseMinWidth(newVal)
|
|
39
|
-
}
|
|
40
|
-
instance.columnConfig.value[columnKey as any] = value
|
|
41
|
-
instance.columnConfig.value[key] = value
|
|
42
|
-
const updateColumns = columnKey === 'fixed'
|
|
43
|
-
owner.value.store.scheduleLayout(updateColumns)
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
const registerNormalWatchers = () => {
|
|
50
|
-
const props = [
|
|
51
|
-
'label',
|
|
52
|
-
'filters',
|
|
53
|
-
'filterMultiple',
|
|
54
|
-
'filteredValue',
|
|
55
|
-
'sortable',
|
|
56
|
-
'index',
|
|
57
|
-
'formatter',
|
|
58
|
-
'className',
|
|
59
|
-
'labelClassName',
|
|
60
|
-
'filterClassName',
|
|
61
|
-
'showOverflowTooltip',
|
|
62
|
-
]
|
|
63
|
-
const aliases = {
|
|
64
|
-
property: 'prop',
|
|
65
|
-
align: 'realAlign',
|
|
66
|
-
headerAlign: 'realHeaderAlign',
|
|
67
|
-
}
|
|
68
|
-
const allAliases = getAllAliases(props, aliases)
|
|
69
|
-
Object.keys(allAliases).forEach((key) => {
|
|
70
|
-
const columnKey = aliases[key]
|
|
71
|
-
if (hasOwn(props_, columnKey)) {
|
|
72
|
-
watch(
|
|
73
|
-
() => props_[columnKey],
|
|
74
|
-
(newVal) => {
|
|
75
|
-
instance.columnConfig.value[key] = newVal
|
|
76
|
-
}
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
registerComplexWatchers,
|
|
84
|
-
registerNormalWatchers,
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default useWatcher
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { defineComponent, h } from 'vue'
|
|
3
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
4
|
-
import useStyle from './style-helper'
|
|
5
|
-
import type { Store } from '../store'
|
|
6
|
-
|
|
7
|
-
import type { PropType } from 'vue'
|
|
8
|
-
import type { DefaultRow, Sort, SummaryMethod } from '../table/defaults'
|
|
9
|
-
export interface TableFooter<T> {
|
|
10
|
-
fixed: string
|
|
11
|
-
store: Store<T>
|
|
12
|
-
summaryMethod: SummaryMethod<T>
|
|
13
|
-
sumText: string
|
|
14
|
-
border: boolean
|
|
15
|
-
defaultSort: Sort
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default defineComponent({
|
|
19
|
-
name: 'ElTableFooter',
|
|
20
|
-
|
|
21
|
-
props: {
|
|
22
|
-
fixed: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: '',
|
|
25
|
-
},
|
|
26
|
-
store: {
|
|
27
|
-
required: true,
|
|
28
|
-
type: Object as PropType<TableFooter<DefaultRow>['store']>,
|
|
29
|
-
},
|
|
30
|
-
summaryMethod: Function as PropType<
|
|
31
|
-
TableFooter<DefaultRow>['summaryMethod']
|
|
32
|
-
>,
|
|
33
|
-
sumText: String,
|
|
34
|
-
border: Boolean,
|
|
35
|
-
defaultSort: {
|
|
36
|
-
type: Object as PropType<TableFooter<DefaultRow>['defaultSort']>,
|
|
37
|
-
default: () => {
|
|
38
|
-
return {
|
|
39
|
-
prop: '',
|
|
40
|
-
order: '',
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
setup(props) {
|
|
46
|
-
const { getCellClasses, getCellStyles, columns } = useStyle(
|
|
47
|
-
props as TableFooter<DefaultRow>
|
|
48
|
-
)
|
|
49
|
-
const ns = useNamespace('table')
|
|
50
|
-
return {
|
|
51
|
-
ns,
|
|
52
|
-
getCellClasses,
|
|
53
|
-
getCellStyles,
|
|
54
|
-
columns,
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
render() {
|
|
58
|
-
const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } =
|
|
59
|
-
this
|
|
60
|
-
const data = this.store.states.data.value
|
|
61
|
-
let sums = []
|
|
62
|
-
if (summaryMethod) {
|
|
63
|
-
sums = summaryMethod({
|
|
64
|
-
columns,
|
|
65
|
-
data,
|
|
66
|
-
})
|
|
67
|
-
} else {
|
|
68
|
-
columns.forEach((column, index) => {
|
|
69
|
-
if (index === 0) {
|
|
70
|
-
sums[index] = sumText
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
const values = data.map((item) => Number(item[column.property]))
|
|
74
|
-
const precisions = []
|
|
75
|
-
let notNumber = true
|
|
76
|
-
values.forEach((value) => {
|
|
77
|
-
if (!Number.isNaN(+value)) {
|
|
78
|
-
notNumber = false
|
|
79
|
-
const decimal = `${value}`.split('.')[1]
|
|
80
|
-
precisions.push(decimal ? decimal.length : 0)
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
const precision = Math.max.apply(null, precisions)
|
|
84
|
-
if (!notNumber) {
|
|
85
|
-
sums[index] = values.reduce((prev, curr) => {
|
|
86
|
-
const value = Number(curr)
|
|
87
|
-
if (!Number.isNaN(+value)) {
|
|
88
|
-
return Number.parseFloat(
|
|
89
|
-
(prev + curr).toFixed(Math.min(precision, 20))
|
|
90
|
-
)
|
|
91
|
-
} else {
|
|
92
|
-
return prev
|
|
93
|
-
}
|
|
94
|
-
}, 0)
|
|
95
|
-
} else {
|
|
96
|
-
sums[index] = ''
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
return h(
|
|
101
|
-
h('tfoot', [
|
|
102
|
-
h('tr', {}, [
|
|
103
|
-
...columns.map((column, cellIndex) =>
|
|
104
|
-
h(
|
|
105
|
-
'td',
|
|
106
|
-
{
|
|
107
|
-
key: cellIndex,
|
|
108
|
-
colspan: column.colSpan,
|
|
109
|
-
rowspan: column.rowSpan,
|
|
110
|
-
class: getCellClasses(columns, cellIndex),
|
|
111
|
-
style: getCellStyles(column, cellIndex),
|
|
112
|
-
},
|
|
113
|
-
[
|
|
114
|
-
h(
|
|
115
|
-
'div',
|
|
116
|
-
{
|
|
117
|
-
class: ['cell', column.labelClassName],
|
|
118
|
-
},
|
|
119
|
-
[sums[cellIndex]]
|
|
120
|
-
),
|
|
121
|
-
]
|
|
122
|
-
)
|
|
123
|
-
),
|
|
124
|
-
]),
|
|
125
|
-
])
|
|
126
|
-
)
|
|
127
|
-
},
|
|
128
|
-
})
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { computed, inject } from 'vue'
|
|
2
|
-
import { TABLE_INJECTION_KEY } from '../tokens'
|
|
3
|
-
|
|
4
|
-
function useMapState() {
|
|
5
|
-
const table = inject(TABLE_INJECTION_KEY)
|
|
6
|
-
const store = table?.store
|
|
7
|
-
const leftFixedLeafCount = computed(() => {
|
|
8
|
-
return store.states.fixedLeafColumnsLength.value
|
|
9
|
-
})
|
|
10
|
-
const rightFixedLeafCount = computed(() => {
|
|
11
|
-
return store.states.rightFixedColumns.value.length
|
|
12
|
-
})
|
|
13
|
-
const columnsCount = computed(() => {
|
|
14
|
-
return store.states.columns.value.length
|
|
15
|
-
})
|
|
16
|
-
const leftFixedCount = computed(() => {
|
|
17
|
-
return store.states.fixedColumns.value.length
|
|
18
|
-
})
|
|
19
|
-
const rightFixedCount = computed(() => {
|
|
20
|
-
return store.states.rightFixedColumns.value.length
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
leftFixedLeafCount,
|
|
25
|
-
rightFixedLeafCount,
|
|
26
|
-
columnsCount,
|
|
27
|
-
leftFixedCount,
|
|
28
|
-
rightFixedCount,
|
|
29
|
-
columns: store.states.columns,
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default useMapState
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
2
|
-
import {
|
|
3
|
-
ensurePosition,
|
|
4
|
-
getFixedColumnOffset,
|
|
5
|
-
getFixedColumnsClass,
|
|
6
|
-
} from '../util'
|
|
7
|
-
import useMapState from './mapState-helper'
|
|
8
|
-
import type { TableColumnCtx } from '../table-column/defaults'
|
|
9
|
-
import type { TableFooter } from '.'
|
|
10
|
-
|
|
11
|
-
function useStyle<T>(props: TableFooter<T>) {
|
|
12
|
-
const { columns } = useMapState()
|
|
13
|
-
const ns = useNamespace('table')
|
|
14
|
-
|
|
15
|
-
const getCellClasses = (columns: TableColumnCtx<T>[], cellIndex: number) => {
|
|
16
|
-
const column = columns[cellIndex]
|
|
17
|
-
const classes = [
|
|
18
|
-
ns.e('cell'),
|
|
19
|
-
column.id,
|
|
20
|
-
column.align,
|
|
21
|
-
column.labelClassName,
|
|
22
|
-
...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store),
|
|
23
|
-
]
|
|
24
|
-
if (column.className) {
|
|
25
|
-
classes.push(column.className)
|
|
26
|
-
}
|
|
27
|
-
if (!column.children) {
|
|
28
|
-
classes.push(ns.is('leaf'))
|
|
29
|
-
}
|
|
30
|
-
return classes
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const getCellStyles = (column: TableColumnCtx<T>, cellIndex: number) => {
|
|
34
|
-
const fixedStyle = getFixedColumnOffset(
|
|
35
|
-
cellIndex,
|
|
36
|
-
column.fixed,
|
|
37
|
-
props.store
|
|
38
|
-
)
|
|
39
|
-
ensurePosition(fixedStyle, 'left')
|
|
40
|
-
ensurePosition(fixedStyle, 'right')
|
|
41
|
-
return fixedStyle
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
getCellClasses,
|
|
46
|
-
getCellStyles,
|
|
47
|
-
columns,
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default useStyle
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { getCurrentInstance, inject, ref } from 'vue'
|
|
3
|
-
import {
|
|
4
|
-
addClass,
|
|
5
|
-
hasClass,
|
|
6
|
-
isClient,
|
|
7
|
-
isElement,
|
|
8
|
-
removeClass,
|
|
9
|
-
} from 'element-plus/es/utils/index.mjs'
|
|
10
|
-
import { TABLE_INJECTION_KEY } from '../tokens'
|
|
11
|
-
import type { TableHeaderProps } from '.'
|
|
12
|
-
import type { TableColumnCtx } from '../table-column/defaults'
|
|
13
|
-
|
|
14
|
-
function useEvent<T>(props: TableHeaderProps<T>, emit) {
|
|
15
|
-
const instance = getCurrentInstance()
|
|
16
|
-
const parent = inject(TABLE_INJECTION_KEY)
|
|
17
|
-
const handleFilterClick = (event: Event) => {
|
|
18
|
-
event.stopPropagation()
|
|
19
|
-
return
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const handleHeaderClick = (event: Event, column: TableColumnCtx<T>) => {
|
|
23
|
-
if (!column.filters && column.sortable) {
|
|
24
|
-
handleSortClick(event, column, false)
|
|
25
|
-
} else if (column.filterable && !column.sortable) {
|
|
26
|
-
handleFilterClick(event)
|
|
27
|
-
}
|
|
28
|
-
parent?.emit('header-click', column, event)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const handleHeaderContextMenu = (event: Event, column: TableColumnCtx<T>) => {
|
|
32
|
-
parent?.emit('header-contextmenu', column, event)
|
|
33
|
-
}
|
|
34
|
-
const draggingColumn = ref(null)
|
|
35
|
-
const dragging = ref(false)
|
|
36
|
-
const dragState = ref({})
|
|
37
|
-
const handleMouseDown = (event: MouseEvent, column: TableColumnCtx<T>) => {
|
|
38
|
-
if (!isClient) return
|
|
39
|
-
if (column.children && column.children.length > 0) return
|
|
40
|
-
/* istanbul ignore if */
|
|
41
|
-
if (draggingColumn.value && props.border) {
|
|
42
|
-
dragging.value = true
|
|
43
|
-
|
|
44
|
-
const table = parent
|
|
45
|
-
emit('set-drag-visible', true)
|
|
46
|
-
const tableEl = table?.vnode.el
|
|
47
|
-
const tableLeft = tableEl.getBoundingClientRect().left
|
|
48
|
-
const columnEl = instance.vnode.el.querySelector(`th.${column.id}`)
|
|
49
|
-
const columnRect = columnEl.getBoundingClientRect()
|
|
50
|
-
const minLeft = columnRect.left - tableLeft + 30
|
|
51
|
-
|
|
52
|
-
addClass(columnEl, 'noclick')
|
|
53
|
-
|
|
54
|
-
dragState.value = {
|
|
55
|
-
startMouseLeft: event.clientX,
|
|
56
|
-
startLeft: columnRect.right - tableLeft,
|
|
57
|
-
startColumnLeft: columnRect.left - tableLeft,
|
|
58
|
-
tableLeft,
|
|
59
|
-
}
|
|
60
|
-
const resizeProxy = table?.refs.resizeProxy as HTMLElement
|
|
61
|
-
resizeProxy.style.left = `${(dragState.value as any).startLeft}px`
|
|
62
|
-
|
|
63
|
-
document.onselectstart = function () {
|
|
64
|
-
return false
|
|
65
|
-
}
|
|
66
|
-
document.ondragstart = function () {
|
|
67
|
-
return false
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const handleMouseMove = (event: MouseEvent) => {
|
|
71
|
-
const deltaLeft =
|
|
72
|
-
event.clientX - (dragState.value as any).startMouseLeft
|
|
73
|
-
const proxyLeft = (dragState.value as any).startLeft + deltaLeft
|
|
74
|
-
|
|
75
|
-
resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const handleMouseUp = () => {
|
|
79
|
-
if (dragging.value) {
|
|
80
|
-
const { startColumnLeft, startLeft } = dragState.value as any
|
|
81
|
-
const finalLeft = Number.parseInt(resizeProxy.style.left, 10)
|
|
82
|
-
const columnWidth = finalLeft - startColumnLeft
|
|
83
|
-
column.width = column.realWidth = columnWidth
|
|
84
|
-
table?.emit(
|
|
85
|
-
'header-dragend',
|
|
86
|
-
column.width,
|
|
87
|
-
startLeft - startColumnLeft,
|
|
88
|
-
column,
|
|
89
|
-
event
|
|
90
|
-
)
|
|
91
|
-
requestAnimationFrame(() => {
|
|
92
|
-
props.store.scheduleLayout(false, true)
|
|
93
|
-
})
|
|
94
|
-
document.body.style.cursor = ''
|
|
95
|
-
dragging.value = false
|
|
96
|
-
draggingColumn.value = null
|
|
97
|
-
dragState.value = {}
|
|
98
|
-
emit('set-drag-visible', false)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
document.removeEventListener('mousemove', handleMouseMove)
|
|
102
|
-
document.removeEventListener('mouseup', handleMouseUp)
|
|
103
|
-
document.onselectstart = null
|
|
104
|
-
document.ondragstart = null
|
|
105
|
-
|
|
106
|
-
setTimeout(() => {
|
|
107
|
-
removeClass(columnEl, 'noclick')
|
|
108
|
-
}, 0)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
document.addEventListener('mousemove', handleMouseMove)
|
|
112
|
-
document.addEventListener('mouseup', handleMouseUp)
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const handleMouseMove = (event: MouseEvent, column: TableColumnCtx<T>) => {
|
|
117
|
-
if (column.children && column.children.length > 0) return
|
|
118
|
-
const el = event.target as HTMLElement
|
|
119
|
-
if (!isElement(el)) {
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
const target = el?.closest('th')
|
|
123
|
-
|
|
124
|
-
if (!column || !column.resizable) return
|
|
125
|
-
|
|
126
|
-
if (!dragging.value && props.border) {
|
|
127
|
-
const rect = target.getBoundingClientRect()
|
|
128
|
-
|
|
129
|
-
const bodyStyle = document.body.style
|
|
130
|
-
if (rect.width > 12 && rect.right - event.pageX < 8) {
|
|
131
|
-
bodyStyle.cursor = 'col-resize'
|
|
132
|
-
if (hasClass(target, 'is-sortable')) {
|
|
133
|
-
target.style.cursor = 'col-resize'
|
|
134
|
-
}
|
|
135
|
-
draggingColumn.value = column
|
|
136
|
-
} else if (!dragging.value) {
|
|
137
|
-
bodyStyle.cursor = ''
|
|
138
|
-
if (hasClass(target, 'is-sortable')) {
|
|
139
|
-
target.style.cursor = 'pointer'
|
|
140
|
-
}
|
|
141
|
-
draggingColumn.value = null
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const handleMouseOut = () => {
|
|
147
|
-
if (!isClient) return
|
|
148
|
-
document.body.style.cursor = ''
|
|
149
|
-
}
|
|
150
|
-
const toggleOrder = ({ order, sortOrders }) => {
|
|
151
|
-
if (order === '') return sortOrders[0]
|
|
152
|
-
const index = sortOrders.indexOf(order || null)
|
|
153
|
-
return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1]
|
|
154
|
-
}
|
|
155
|
-
const handleSortClick = (
|
|
156
|
-
event: Event,
|
|
157
|
-
column: TableColumnCtx<T>,
|
|
158
|
-
givenOrder: string | boolean
|
|
159
|
-
) => {
|
|
160
|
-
event.stopPropagation()
|
|
161
|
-
const order =
|
|
162
|
-
column.order === givenOrder ? null : givenOrder || toggleOrder(column)
|
|
163
|
-
|
|
164
|
-
const target = (event.target as HTMLElement)?.closest('th')
|
|
165
|
-
|
|
166
|
-
if (target) {
|
|
167
|
-
if (hasClass(target, 'noclick')) {
|
|
168
|
-
removeClass(target, 'noclick')
|
|
169
|
-
return
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (!column.sortable) return
|
|
174
|
-
|
|
175
|
-
const states = props.store.states
|
|
176
|
-
let sortProp = states.sortProp.value
|
|
177
|
-
let sortOrder
|
|
178
|
-
const sortingColumn = states.sortingColumn.value
|
|
179
|
-
|
|
180
|
-
if (
|
|
181
|
-
sortingColumn !== column ||
|
|
182
|
-
(sortingColumn === column && sortingColumn.order === null)
|
|
183
|
-
) {
|
|
184
|
-
if (sortingColumn) {
|
|
185
|
-
sortingColumn.order = null
|
|
186
|
-
}
|
|
187
|
-
states.sortingColumn.value = column
|
|
188
|
-
sortProp = column.property
|
|
189
|
-
}
|
|
190
|
-
if (!order) {
|
|
191
|
-
sortOrder = column.order = null
|
|
192
|
-
} else {
|
|
193
|
-
sortOrder = column.order = order
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
states.sortProp.value = sortProp
|
|
197
|
-
states.sortOrder.value = sortOrder
|
|
198
|
-
|
|
199
|
-
parent?.store.commit('changeSortCondition')
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
handleHeaderClick,
|
|
204
|
-
handleHeaderContextMenu,
|
|
205
|
-
handleMouseDown,
|
|
206
|
-
handleMouseMove,
|
|
207
|
-
handleMouseOut,
|
|
208
|
-
handleSortClick,
|
|
209
|
-
handleFilterClick,
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export default useEvent
|