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,237 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import type { ComponentInternalInstance, PropType, Ref, VNode } from 'vue'
|
|
3
|
-
import type { DefaultRow, Table } from '../table/defaults'
|
|
4
|
-
import type { TableOverflowTooltipOptions } from '../util'
|
|
5
|
-
|
|
6
|
-
type CI<T> = { column: TableColumnCtx<T>; $index: number }
|
|
7
|
-
|
|
8
|
-
type Filters = {
|
|
9
|
-
text: string
|
|
10
|
-
value: string
|
|
11
|
-
}[]
|
|
12
|
-
|
|
13
|
-
type FilterMethods<T> = (value, row: T, column: TableColumnCtx<T>) => void
|
|
14
|
-
|
|
15
|
-
type ValueOf<T> = T[keyof T]
|
|
16
|
-
|
|
17
|
-
interface TableColumnCtx<T> {
|
|
18
|
-
id: string
|
|
19
|
-
realWidth: number
|
|
20
|
-
type: string
|
|
21
|
-
label: string
|
|
22
|
-
className: string
|
|
23
|
-
labelClassName: string
|
|
24
|
-
property: string
|
|
25
|
-
prop: string
|
|
26
|
-
width: string | number
|
|
27
|
-
minWidth: string | number
|
|
28
|
-
renderHeader: (data: CI<T>) => VNode
|
|
29
|
-
sortable: boolean | string
|
|
30
|
-
sortMethod: (a: T, b: T) => number
|
|
31
|
-
sortBy: string | ((row: T, index: number) => string) | string[]
|
|
32
|
-
resizable: boolean
|
|
33
|
-
columnKey: string
|
|
34
|
-
rawColumnKey: string
|
|
35
|
-
align: string
|
|
36
|
-
headerAlign: string
|
|
37
|
-
showOverflowTooltip?: boolean | TableOverflowTooltipOptions | ((data: any) => boolean)
|
|
38
|
-
fixed: boolean | string
|
|
39
|
-
formatter: (
|
|
40
|
-
row: T,
|
|
41
|
-
column: TableColumnCtx<T>,
|
|
42
|
-
cellValue,
|
|
43
|
-
index: number
|
|
44
|
-
) => VNode | string
|
|
45
|
-
selectable: (row: T, index: number) => boolean
|
|
46
|
-
reserveSelection: boolean
|
|
47
|
-
filterMethod: FilterMethods<T>
|
|
48
|
-
filteredValue: string[]
|
|
49
|
-
filters: Filters
|
|
50
|
-
filterPlacement: string
|
|
51
|
-
filterMultiple: boolean
|
|
52
|
-
filterClassName: string
|
|
53
|
-
index: number | ((index: number) => number)
|
|
54
|
-
sortOrders: ('ascending' | 'descending' | null)[]
|
|
55
|
-
renderCell: (data: any) => void
|
|
56
|
-
colSpan: number
|
|
57
|
-
rowSpan: number
|
|
58
|
-
children: TableColumnCtx<T>[]
|
|
59
|
-
level: number
|
|
60
|
-
filterable: boolean | FilterMethods<T> | Filters
|
|
61
|
-
order: string
|
|
62
|
-
isColumnGroup: boolean
|
|
63
|
-
isSubColumn: boolean
|
|
64
|
-
columns: TableColumnCtx<T>[]
|
|
65
|
-
getColumnIndex: () => number
|
|
66
|
-
no: number
|
|
67
|
-
filterOpened?: boolean
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
interface TableColumn<T> extends ComponentInternalInstance {
|
|
71
|
-
vnode: {
|
|
72
|
-
vParent: TableColumn<T> | Table<T>
|
|
73
|
-
} & VNode
|
|
74
|
-
vParent: TableColumn<T> | Table<T>
|
|
75
|
-
columnId: string
|
|
76
|
-
columnConfig: Ref<Partial<TableColumnCtx<T>>>
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type { Filters, FilterMethods, TableColumnCtx, TableColumn, ValueOf }
|
|
80
|
-
|
|
81
|
-
export default {
|
|
82
|
-
/**
|
|
83
|
-
* @description type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon
|
|
84
|
-
*/
|
|
85
|
-
type: {
|
|
86
|
-
type: String,
|
|
87
|
-
default: 'default',
|
|
88
|
-
},
|
|
89
|
-
/**
|
|
90
|
-
* @description column label
|
|
91
|
-
*/
|
|
92
|
-
label: String,
|
|
93
|
-
/**
|
|
94
|
-
* @description class name of cells in the column
|
|
95
|
-
*/
|
|
96
|
-
className: String,
|
|
97
|
-
/**
|
|
98
|
-
* @description class name of the label of this column
|
|
99
|
-
*/
|
|
100
|
-
labelClassName: String,
|
|
101
|
-
/**
|
|
102
|
-
* @description
|
|
103
|
-
*/
|
|
104
|
-
property: String,
|
|
105
|
-
/**
|
|
106
|
-
* @description field name. You can also use its alias: `property`
|
|
107
|
-
*/
|
|
108
|
-
prop: String,
|
|
109
|
-
/**
|
|
110
|
-
* @description column width
|
|
111
|
-
*/
|
|
112
|
-
width: {
|
|
113
|
-
type: [String, Number],
|
|
114
|
-
default: '',
|
|
115
|
-
},
|
|
116
|
-
/**
|
|
117
|
-
* @description column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion
|
|
118
|
-
*/
|
|
119
|
-
minWidth: {
|
|
120
|
-
type: [String, Number],
|
|
121
|
-
default: '',
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* @description render function for table header of this column
|
|
125
|
-
*/
|
|
126
|
-
renderHeader: Function as PropType<
|
|
127
|
-
TableColumnCtx<DefaultRow>['renderHeader']
|
|
128
|
-
>,
|
|
129
|
-
/**
|
|
130
|
-
* @description whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table
|
|
131
|
-
*/
|
|
132
|
-
sortable: {
|
|
133
|
-
type: [Boolean, String],
|
|
134
|
-
default: false,
|
|
135
|
-
},
|
|
136
|
-
/**
|
|
137
|
-
* @description sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort
|
|
138
|
-
*/
|
|
139
|
-
sortMethod: Function as PropType<TableColumnCtx<DefaultRow>['sortMethod']>,
|
|
140
|
-
/**
|
|
141
|
-
* @description specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal
|
|
142
|
-
*/
|
|
143
|
-
sortBy: [String, Function, Array] as PropType<
|
|
144
|
-
TableColumnCtx<DefaultRow>['sortBy']
|
|
145
|
-
>,
|
|
146
|
-
/**
|
|
147
|
-
* @description whether column width can be resized, works when `border` of `el-table` is `true`
|
|
148
|
-
*/
|
|
149
|
-
resizable: {
|
|
150
|
-
type: Boolean,
|
|
151
|
-
default: true,
|
|
152
|
-
},
|
|
153
|
-
/**
|
|
154
|
-
* @description column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered
|
|
155
|
-
*/
|
|
156
|
-
columnKey: String,
|
|
157
|
-
/**
|
|
158
|
-
* @description alignment, the value should be 'left' \/ 'center' \/ 'right'
|
|
159
|
-
*/
|
|
160
|
-
align: String,
|
|
161
|
-
/**
|
|
162
|
-
* @description alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \/ 'center' \/ 'right'
|
|
163
|
-
*/
|
|
164
|
-
headerAlign: String,
|
|
165
|
-
/**
|
|
166
|
-
* @description whether to hide extra content and show them in a tooltip when hovering on the cell
|
|
167
|
-
*/
|
|
168
|
-
showOverflowTooltip: {
|
|
169
|
-
type: [Boolean, Object, Function] as PropType<
|
|
170
|
-
TableColumnCtx<DefaultRow>['showOverflowTooltip']
|
|
171
|
-
>,
|
|
172
|
-
default: undefined,
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* @description whether column is fixed at left / right. Will be fixed at left if `true`
|
|
176
|
-
*/
|
|
177
|
-
fixed: [Boolean, String],
|
|
178
|
-
/**
|
|
179
|
-
* @description function that formats cell content
|
|
180
|
-
*/
|
|
181
|
-
formatter: Function as PropType<TableColumnCtx<DefaultRow>['formatter']>,
|
|
182
|
-
/**
|
|
183
|
-
* @description function that determines if a certain row can be selected, works when `type` is 'selection'
|
|
184
|
-
*/
|
|
185
|
-
selectable: Function as PropType<TableColumnCtx<DefaultRow>['selectable']>,
|
|
186
|
-
/**
|
|
187
|
-
* @description whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work
|
|
188
|
-
*/
|
|
189
|
-
reserveSelection: Boolean,
|
|
190
|
-
/**
|
|
191
|
-
* @description data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`
|
|
192
|
-
*/
|
|
193
|
-
filterMethod: Function as PropType<
|
|
194
|
-
TableColumnCtx<DefaultRow>['filterMethod']
|
|
195
|
-
>,
|
|
196
|
-
/**
|
|
197
|
-
* @description filter value for selected data, might be useful when table header is rendered with `render-header`
|
|
198
|
-
*/
|
|
199
|
-
filteredValue: Array as PropType<TableColumnCtx<DefaultRow>['filteredValue']>,
|
|
200
|
-
/**
|
|
201
|
-
* @description an array of data filtering options. For each element in this array, `text` and `value` are required
|
|
202
|
-
*/
|
|
203
|
-
filters: Array as PropType<TableColumnCtx<DefaultRow>['filters']>,
|
|
204
|
-
/**
|
|
205
|
-
* @description placement for the filter dropdown
|
|
206
|
-
*/
|
|
207
|
-
filterPlacement: String,
|
|
208
|
-
/**
|
|
209
|
-
* @description whether data filtering supports multiple options
|
|
210
|
-
*/
|
|
211
|
-
filterMultiple: {
|
|
212
|
-
type: Boolean,
|
|
213
|
-
default: true,
|
|
214
|
-
},
|
|
215
|
-
/**
|
|
216
|
-
* @description className for the filter dropdown
|
|
217
|
-
*/
|
|
218
|
-
filterClassName: String,
|
|
219
|
-
/**
|
|
220
|
-
* @description customize indices for each row, works on columns with `type=index`
|
|
221
|
-
*/
|
|
222
|
-
index: [Number, Function] as PropType<TableColumnCtx<DefaultRow>['index']>,
|
|
223
|
-
/**
|
|
224
|
-
* @description the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array
|
|
225
|
-
*/
|
|
226
|
-
sortOrders: {
|
|
227
|
-
type: Array as PropType<TableColumnCtx<DefaultRow>['sortOrders']>,
|
|
228
|
-
default: () => {
|
|
229
|
-
return ['ascending', 'descending', null]
|
|
230
|
-
},
|
|
231
|
-
validator: (val: TableColumnCtx<unknown>['sortOrders']) => {
|
|
232
|
-
return val.every((order: string) =>
|
|
233
|
-
['ascending', 'descending', null].includes(order)
|
|
234
|
-
)
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import {
|
|
3
|
-
Fragment,
|
|
4
|
-
computed,
|
|
5
|
-
defineComponent,
|
|
6
|
-
getCurrentInstance,
|
|
7
|
-
h,
|
|
8
|
-
onBeforeMount,
|
|
9
|
-
onBeforeUnmount,
|
|
10
|
-
onMounted,
|
|
11
|
-
ref,
|
|
12
|
-
} from 'vue'
|
|
13
|
-
import ElCheckbox from 'element-plus/es/components/checkbox/index.mjs'
|
|
14
|
-
import { isString, isUndefined } from 'element-plus/es/utils/index.mjs'
|
|
15
|
-
import { cellStarts } from '../config'
|
|
16
|
-
import { compose, mergeOptions } from '../util'
|
|
17
|
-
import useWatcher from './watcher-helper'
|
|
18
|
-
import useRender from './render-helper'
|
|
19
|
-
import defaultProps from './defaults'
|
|
20
|
-
import type { TableColumn, TableColumnCtx } from './defaults'
|
|
21
|
-
|
|
22
|
-
import type { DefaultRow } from '../table/defaults'
|
|
23
|
-
|
|
24
|
-
let columnIdSeed = 1
|
|
25
|
-
|
|
26
|
-
export default defineComponent({
|
|
27
|
-
name: 'ElTableColumn',
|
|
28
|
-
components: {
|
|
29
|
-
ElCheckbox,
|
|
30
|
-
},
|
|
31
|
-
props: defaultProps,
|
|
32
|
-
setup(props, { slots }) {
|
|
33
|
-
const instance = getCurrentInstance() as TableColumn<DefaultRow>
|
|
34
|
-
const columnConfig = ref<Partial<TableColumnCtx<DefaultRow>>>({})
|
|
35
|
-
const owner = computed(() => {
|
|
36
|
-
let parent = instance.parent as any
|
|
37
|
-
while (parent && !parent.tableId) {
|
|
38
|
-
parent = parent.parent
|
|
39
|
-
}
|
|
40
|
-
return parent
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const { registerNormalWatchers, registerComplexWatchers } = useWatcher(
|
|
44
|
-
owner,
|
|
45
|
-
props
|
|
46
|
-
)
|
|
47
|
-
const {
|
|
48
|
-
columnId,
|
|
49
|
-
isSubColumn,
|
|
50
|
-
realHeaderAlign,
|
|
51
|
-
columnOrTableParent,
|
|
52
|
-
setColumnWidth,
|
|
53
|
-
setColumnForcedProps,
|
|
54
|
-
setColumnRenders,
|
|
55
|
-
getPropsData,
|
|
56
|
-
getColumnElIndex,
|
|
57
|
-
realAlign,
|
|
58
|
-
updateColumnOrder,
|
|
59
|
-
} = useRender(props as unknown as TableColumnCtx<unknown>, slots, owner)
|
|
60
|
-
|
|
61
|
-
const parent = columnOrTableParent.value
|
|
62
|
-
columnId.value = `${
|
|
63
|
-
parent.tableId || parent.columnId
|
|
64
|
-
}_column_${columnIdSeed++}`
|
|
65
|
-
onBeforeMount(() => {
|
|
66
|
-
isSubColumn.value = owner.value !== parent
|
|
67
|
-
|
|
68
|
-
const type = props.type || 'default'
|
|
69
|
-
const sortable = props.sortable === '' ? true : props.sortable
|
|
70
|
-
const showOverflowTooltip = isUndefined(props.showOverflowTooltip)
|
|
71
|
-
? parent.props.showOverflowTooltip
|
|
72
|
-
: props.showOverflowTooltip
|
|
73
|
-
const defaults = {
|
|
74
|
-
...cellStarts[type],
|
|
75
|
-
id: columnId.value,
|
|
76
|
-
type,
|
|
77
|
-
property: props.prop || props.property,
|
|
78
|
-
align: realAlign,
|
|
79
|
-
headerAlign: realHeaderAlign,
|
|
80
|
-
showOverflowTooltip,
|
|
81
|
-
// filter 相关属性
|
|
82
|
-
filterable: props.filters || props.filterMethod,
|
|
83
|
-
filteredValue: [],
|
|
84
|
-
filterPlacement: '',
|
|
85
|
-
filterClassName: '',
|
|
86
|
-
isColumnGroup: false,
|
|
87
|
-
isSubColumn: false,
|
|
88
|
-
filterOpened: false,
|
|
89
|
-
// sort 相关属性
|
|
90
|
-
sortable,
|
|
91
|
-
// index 列
|
|
92
|
-
index: props.index,
|
|
93
|
-
// <el-table-column key="xxx" />
|
|
94
|
-
rawColumnKey: instance.vnode.key,
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const basicProps = [
|
|
98
|
-
'columnKey',
|
|
99
|
-
'label',
|
|
100
|
-
'className',
|
|
101
|
-
'labelClassName',
|
|
102
|
-
'type',
|
|
103
|
-
'renderHeader',
|
|
104
|
-
'formatter',
|
|
105
|
-
'fixed',
|
|
106
|
-
'resizable',
|
|
107
|
-
]
|
|
108
|
-
const sortProps = ['sortMethod', 'sortBy', 'sortOrders']
|
|
109
|
-
const selectProps = ['selectable', 'reserveSelection']
|
|
110
|
-
const filterProps = [
|
|
111
|
-
'filterMethod',
|
|
112
|
-
'filters',
|
|
113
|
-
'filterMultiple',
|
|
114
|
-
'filterOpened',
|
|
115
|
-
'filteredValue',
|
|
116
|
-
'filterPlacement',
|
|
117
|
-
'filterClassName',
|
|
118
|
-
]
|
|
119
|
-
|
|
120
|
-
let column = getPropsData(basicProps, sortProps, selectProps, filterProps)
|
|
121
|
-
|
|
122
|
-
column = mergeOptions(defaults, column)
|
|
123
|
-
// 注意 compose 中函数执行的顺序是从右到左
|
|
124
|
-
const chains = compose(
|
|
125
|
-
setColumnRenders,
|
|
126
|
-
setColumnWidth,
|
|
127
|
-
setColumnForcedProps
|
|
128
|
-
)
|
|
129
|
-
column = chains(column)
|
|
130
|
-
columnConfig.value = column
|
|
131
|
-
|
|
132
|
-
// 注册 watcher
|
|
133
|
-
registerNormalWatchers()
|
|
134
|
-
registerComplexWatchers()
|
|
135
|
-
})
|
|
136
|
-
onMounted(() => {
|
|
137
|
-
const parent = columnOrTableParent.value
|
|
138
|
-
const children = isSubColumn.value
|
|
139
|
-
? parent.vnode.el.children
|
|
140
|
-
: parent.refs.hiddenColumns?.children
|
|
141
|
-
const getColumnIndex = () =>
|
|
142
|
-
getColumnElIndex(children || [], instance.vnode.el)
|
|
143
|
-
columnConfig.value.getColumnIndex = getColumnIndex
|
|
144
|
-
const columnIndex = getColumnIndex()
|
|
145
|
-
columnIndex > -1 &&
|
|
146
|
-
owner.value.store.commit(
|
|
147
|
-
'insertColumn',
|
|
148
|
-
columnConfig.value,
|
|
149
|
-
isSubColumn.value ? parent.columnConfig.value : null,
|
|
150
|
-
updateColumnOrder
|
|
151
|
-
)
|
|
152
|
-
})
|
|
153
|
-
onBeforeUnmount(() => {
|
|
154
|
-
const columnIndex = columnConfig.value.getColumnIndex()
|
|
155
|
-
columnIndex > -1 &&
|
|
156
|
-
owner.value.store.commit(
|
|
157
|
-
'removeColumn',
|
|
158
|
-
columnConfig.value,
|
|
159
|
-
isSubColumn.value ? parent.columnConfig.value : null,
|
|
160
|
-
updateColumnOrder
|
|
161
|
-
)
|
|
162
|
-
})
|
|
163
|
-
instance.columnId = columnId.value
|
|
164
|
-
|
|
165
|
-
instance.columnConfig = columnConfig
|
|
166
|
-
return
|
|
167
|
-
},
|
|
168
|
-
render() {
|
|
169
|
-
try {
|
|
170
|
-
const renderDefault = this.$slots.default?.({
|
|
171
|
-
row: {},
|
|
172
|
-
column: {},
|
|
173
|
-
$index: -1,
|
|
174
|
-
})
|
|
175
|
-
const children = []
|
|
176
|
-
if (Array.isArray(renderDefault)) {
|
|
177
|
-
for (const childNode of renderDefault) {
|
|
178
|
-
if (
|
|
179
|
-
childNode.type?.name === 'ElTableColumn' ||
|
|
180
|
-
childNode.shapeFlag & 2
|
|
181
|
-
) {
|
|
182
|
-
children.push(childNode)
|
|
183
|
-
} else if (
|
|
184
|
-
childNode.type === Fragment &&
|
|
185
|
-
Array.isArray(childNode.children)
|
|
186
|
-
) {
|
|
187
|
-
childNode.children.forEach((vnode) => {
|
|
188
|
-
// No rendering when vnode is dynamic slot or text
|
|
189
|
-
if (vnode?.patchFlag !== 1024 && !isString(vnode?.children)) {
|
|
190
|
-
children.push(vnode)
|
|
191
|
-
}
|
|
192
|
-
})
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
const vnode = h('div', children)
|
|
197
|
-
return vnode
|
|
198
|
-
} catch {
|
|
199
|
-
return h('div', [])
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
})
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import {
|
|
3
|
-
Comment,
|
|
4
|
-
computed,
|
|
5
|
-
getCurrentInstance,
|
|
6
|
-
h,
|
|
7
|
-
ref,
|
|
8
|
-
renderSlot,
|
|
9
|
-
unref,
|
|
10
|
-
watchEffect,
|
|
11
|
-
} from 'vue'
|
|
12
|
-
import { debugWarn } from 'element-plus/es/utils/index.mjs'
|
|
13
|
-
import { useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
14
|
-
import {
|
|
15
|
-
cellForced,
|
|
16
|
-
defaultRenderCell,
|
|
17
|
-
getDefaultClassName,
|
|
18
|
-
treeCellPrefix,
|
|
19
|
-
} from '../config'
|
|
20
|
-
import { parseMinWidth, parseWidth } from '../util'
|
|
21
|
-
import type { ComputedRef } from 'vue'
|
|
22
|
-
import type { TableColumn, TableColumnCtx } from './defaults'
|
|
23
|
-
|
|
24
|
-
function useRender<T>(
|
|
25
|
-
props: TableColumnCtx<T>,
|
|
26
|
-
slots,
|
|
27
|
-
owner: ComputedRef<any>
|
|
28
|
-
) {
|
|
29
|
-
const instance = getCurrentInstance() as TableColumn<T>
|
|
30
|
-
const columnId = ref('')
|
|
31
|
-
const isSubColumn = ref(false)
|
|
32
|
-
const realAlign = ref<string>()
|
|
33
|
-
const realHeaderAlign = ref<string>()
|
|
34
|
-
const ns = useNamespace('table')
|
|
35
|
-
watchEffect(() => {
|
|
36
|
-
realAlign.value = props.align ? `is-${props.align}` : null
|
|
37
|
-
// nextline help render
|
|
38
|
-
realAlign.value
|
|
39
|
-
})
|
|
40
|
-
watchEffect(() => {
|
|
41
|
-
realHeaderAlign.value = props.headerAlign
|
|
42
|
-
? `is-${props.headerAlign}`
|
|
43
|
-
: realAlign.value
|
|
44
|
-
// nextline help render
|
|
45
|
-
realHeaderAlign.value
|
|
46
|
-
})
|
|
47
|
-
const columnOrTableParent = computed(() => {
|
|
48
|
-
let parent: any = instance.vnode.vParent || instance.parent
|
|
49
|
-
while (parent && !parent.tableId && !parent.columnId) {
|
|
50
|
-
parent = parent.vnode.vParent || parent.parent
|
|
51
|
-
}
|
|
52
|
-
return parent
|
|
53
|
-
})
|
|
54
|
-
const hasTreeColumn = computed<boolean>(() => {
|
|
55
|
-
const { store } = instance.parent
|
|
56
|
-
if (!store) return false
|
|
57
|
-
const { treeData } = store.states
|
|
58
|
-
const treeDataValue = treeData.value
|
|
59
|
-
return treeDataValue && Object.keys(treeDataValue).length > 0
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
const realWidth = ref(parseWidth(props.width))
|
|
63
|
-
const realMinWidth = ref(parseMinWidth(props.minWidth))
|
|
64
|
-
const setColumnWidth = (column: TableColumnCtx<T>) => {
|
|
65
|
-
if (realWidth.value) column.width = realWidth.value
|
|
66
|
-
if (realMinWidth.value) {
|
|
67
|
-
column.minWidth = realMinWidth.value
|
|
68
|
-
}
|
|
69
|
-
if (!realWidth.value && realMinWidth.value) {
|
|
70
|
-
column.width = undefined
|
|
71
|
-
}
|
|
72
|
-
if (!column.minWidth) {
|
|
73
|
-
column.minWidth = 80
|
|
74
|
-
}
|
|
75
|
-
column.realWidth = Number(
|
|
76
|
-
column.width === undefined ? column.minWidth : column.width
|
|
77
|
-
)
|
|
78
|
-
return column
|
|
79
|
-
}
|
|
80
|
-
const setColumnForcedProps = (column: TableColumnCtx<T>) => {
|
|
81
|
-
// 对于特定类型的 column,某些属性不允许设置
|
|
82
|
-
const type = column.type
|
|
83
|
-
const source = cellForced[type] || {}
|
|
84
|
-
Object.keys(source).forEach((prop) => {
|
|
85
|
-
const value = source[prop]
|
|
86
|
-
if (prop !== 'className' && value !== undefined) {
|
|
87
|
-
column[prop] = value
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
const className = getDefaultClassName(type)
|
|
91
|
-
if (className) {
|
|
92
|
-
const forceClass = `${unref(ns.namespace)}-${className}`
|
|
93
|
-
column.className = column.className
|
|
94
|
-
? `${column.className} ${forceClass}`
|
|
95
|
-
: forceClass
|
|
96
|
-
}
|
|
97
|
-
return column
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const checkSubColumn = (children: TableColumn<T> | TableColumn<T>[]) => {
|
|
101
|
-
if (Array.isArray(children)) {
|
|
102
|
-
children.forEach((child) => check(child))
|
|
103
|
-
} else {
|
|
104
|
-
check(children)
|
|
105
|
-
}
|
|
106
|
-
function check(item: TableColumn<T>) {
|
|
107
|
-
if (item?.type?.name === 'ElTableColumn') {
|
|
108
|
-
item.vParent = instance
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const setColumnRenders = (column: TableColumnCtx<T>) => {
|
|
113
|
-
// renderHeader 属性不推荐使用。
|
|
114
|
-
if (props.renderHeader) {
|
|
115
|
-
debugWarn(
|
|
116
|
-
'TableColumn',
|
|
117
|
-
'Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.'
|
|
118
|
-
)
|
|
119
|
-
} else if (column.type !== 'selection') {
|
|
120
|
-
column.renderHeader = (scope) => {
|
|
121
|
-
// help render
|
|
122
|
-
instance.columnConfig.value['label']
|
|
123
|
-
return renderSlot(slots, 'header', scope, () => [column.label])
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
let originRenderCell = column.renderCell
|
|
128
|
-
// TODO: 这里的实现调整
|
|
129
|
-
if (column.type === 'expand') {
|
|
130
|
-
// 对于展开行,renderCell 不允许配置的。在上一步中已经设置过,这里需要简单封装一下。
|
|
131
|
-
column.renderCell = (data) =>
|
|
132
|
-
h(
|
|
133
|
-
'div',
|
|
134
|
-
{
|
|
135
|
-
class: 'cell',
|
|
136
|
-
},
|
|
137
|
-
[originRenderCell(data)]
|
|
138
|
-
)
|
|
139
|
-
owner.value.renderExpanded = (data) => {
|
|
140
|
-
return slots.default ? slots.default(data) : slots.default
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
originRenderCell = originRenderCell || defaultRenderCell
|
|
144
|
-
// 对 renderCell 进行包装
|
|
145
|
-
column.renderCell = (data) => {
|
|
146
|
-
let children = null
|
|
147
|
-
if (slots.default) {
|
|
148
|
-
const vnodes = slots.default(data)
|
|
149
|
-
children = vnodes.some((v) => v.type !== Comment)
|
|
150
|
-
? vnodes
|
|
151
|
-
: originRenderCell(data)
|
|
152
|
-
} else {
|
|
153
|
-
children = originRenderCell(data)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const { columns } = owner.value.store.states
|
|
157
|
-
const firstUserColumnIndex = columns.value.findIndex(
|
|
158
|
-
(item) => item.type === 'default'
|
|
159
|
-
)
|
|
160
|
-
const shouldCreatePlaceholder =
|
|
161
|
-
hasTreeColumn.value && data.cellIndex === firstUserColumnIndex
|
|
162
|
-
const prefix = treeCellPrefix(data, shouldCreatePlaceholder)
|
|
163
|
-
const props = {
|
|
164
|
-
class: 'cell',
|
|
165
|
-
style: {},
|
|
166
|
-
}
|
|
167
|
-
if (column.showOverflowTooltip) {
|
|
168
|
-
props.class = `${props.class} ${unref(ns.namespace)}-tooltip`
|
|
169
|
-
props.style = {
|
|
170
|
-
width: `${
|
|
171
|
-
(data.column.realWidth || Number(data.column.width)) - 1
|
|
172
|
-
}px`,
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
checkSubColumn(children)
|
|
176
|
-
return h('div', props, [prefix, children])
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return column
|
|
180
|
-
}
|
|
181
|
-
const getPropsData = (...propsKey: unknown[]) => {
|
|
182
|
-
return propsKey.reduce((prev, cur) => {
|
|
183
|
-
if (Array.isArray(cur)) {
|
|
184
|
-
cur.forEach((key) => {
|
|
185
|
-
prev[key] = props[key]
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
return prev
|
|
189
|
-
}, {})
|
|
190
|
-
}
|
|
191
|
-
const getColumnElIndex = (children, child) => {
|
|
192
|
-
return Array.prototype.indexOf.call(children, child)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const updateColumnOrder = () => {
|
|
196
|
-
owner.value.store.commit('updateColumnOrder', instance.columnConfig.value)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
columnId,
|
|
201
|
-
realAlign,
|
|
202
|
-
isSubColumn,
|
|
203
|
-
realHeaderAlign,
|
|
204
|
-
columnOrTableParent,
|
|
205
|
-
setColumnWidth,
|
|
206
|
-
setColumnForcedProps,
|
|
207
|
-
setColumnRenders,
|
|
208
|
-
getPropsData,
|
|
209
|
-
getColumnElIndex,
|
|
210
|
-
updateColumnOrder,
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export default useRender
|