resolver-egretimp-plus 0.1.113 → 0.1.115
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 +1 -1
- package/dist/theme/element/index.css +1 -1
- package/dist/theme/element/src/components/common.scss +4 -0
- package/dist/theme/element/src/components/text.scss +17 -0
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/analysisComponent.jsx +2 -1
- package/src/components/helper/table.jsx +26 -23
- package/src/components/packages-H5/CustomComponentCollapseH5.vue +6 -2
- package/src/components/packages-web/ElText.jsx +0 -1
- package/src/theme/element/components/common.scss +4 -0
- package/src/theme/element/components/text.scss +17 -0
- package/src-bak/analysisComponent.jsx +343 -0
- package/src-bak/api/builtIn.js +10 -0
- package/src-bak/bpm/bpmInstance.js +388 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/application.js +8 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/component.js +97 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/datasource.js +88 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/index.js +3 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/UdcComponent.js +76 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/index.js +201 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/index.js +69 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/page.js +56 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/utils.js +76 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/index.js +46 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/utils.js +21 -0
- package/src-bak/components/childDialog/index.js +39 -0
- package/src-bak/components/childDialog/src/index.vue +185 -0
- package/src-bak/components/cmiFormItem/index.js +1 -0
- package/src-bak/components/cmiFormItem/src/index.vue +112 -0
- package/src-bak/components/confirmInstance-H5/index.js +53 -0
- package/src-bak/components/confirmInstance-H5/src/index.vue +54 -0
- package/src-bak/components/helper/FormPolyfill.jsx +25 -0
- package/src-bak/components/helper/calcTooltip.jsx +134 -0
- package/src-bak/components/helper/dock.js +141 -0
- package/src-bak/components/helper/eventOrchestration.js +763 -0
- package/src-bak/components/helper/resolver.js +163 -0
- package/src-bak/components/helper/table.jsx +103 -0
- package/src-bak/components/icons/date.vue +33 -0
- package/src-bak/components/icons/info.vue +62 -0
- package/src-bak/components/icons/loading.vue +19 -0
- package/src-bak/components/icons/question-filled.vue +8 -0
- package/src-bak/components/loading/index.js +6 -0
- package/src-bak/components/loading/loading.js +98 -0
- package/src-bak/components/loading/loading.scss +74 -0
- package/src-bak/components/loading/loading.vue +89 -0
- package/src-bak/components/loadingComponent/LoadingComponent.vue +33 -0
- package/src-bak/components/modal/index.js +9 -0
- package/src-bak/components/modal/modal.scss +195 -0
- package/src-bak/components/modal/modal.vue +201 -0
- package/src-bak/components/options/OptionsDefault.vue +47 -0
- package/src-bak/components/packages-H5/CmiButton.vue +120 -0
- package/src-bak/components/packages-H5/CmiCalendar.vue +152 -0
- package/src-bak/components/packages-H5/CmiCell.vue +87 -0
- package/src-bak/components/packages-H5/CmiCheckbox.vue +82 -0
- package/src-bak/components/packages-H5/CmiDatetimePicker.vue +98 -0
- package/src-bak/components/packages-H5/CmiDivider.vue +30 -0
- package/src-bak/components/packages-H5/CmiDropdownMenu.vue +58 -0
- package/src-bak/components/packages-H5/CmiInput.vue +69 -0
- package/src-bak/components/packages-H5/CmiLink.vue +28 -0
- package/src-bak/components/packages-H5/CmiPicker.vue +229 -0
- package/src-bak/components/packages-H5/CmiRadio.vue +29 -0
- package/src-bak/components/packages-H5/CmiSearch.vue +39 -0
- package/src-bak/components/packages-H5/CmiSelect.vue +84 -0
- package/src-bak/components/packages-H5/CustomComponentCardH5.vue +129 -0
- package/src-bak/components/packages-H5/CustomComponentColH5.vue +8 -0
- package/src-bak/components/packages-H5/CustomComponentCollapseH5.vue +137 -0
- package/src-bak/components/packages-H5/CustomComponentFormLayoutH5.vue +54 -0
- package/src-bak/components/packages-H5/CustomComponentTabPaneH5.vue +38 -0
- package/src-bak/components/packages-H5/CustomComponentTableH5.vue +352 -0
- package/src-bak/components/packages-H5/CustomComponentTabsH5.vue +170 -0
- package/src-bak/components/packages-web/CustomComponentCard.vue +40 -0
- package/src-bak/components/packages-web/CustomComponentCol.vue +66 -0
- package/src-bak/components/packages-web/CustomComponentCollapse.vue +164 -0
- package/src-bak/components/packages-web/CustomComponentCycle.vue +95 -0
- package/src-bak/components/packages-web/CustomComponentCycleTabPane.vue +155 -0
- package/src-bak/components/packages-web/CustomComponentDialog.vue +192 -0
- package/src-bak/components/packages-web/CustomComponentEditor.vue +50 -0
- package/src-bak/components/packages-web/CustomComponentFileExport.vue +60 -0
- package/src-bak/components/packages-web/CustomComponentFileImport.vue +60 -0
- package/src-bak/components/packages-web/CustomComponentFormLayout.vue +65 -0
- package/src-bak/components/packages-web/CustomComponentGrid.vue +29 -0
- package/src-bak/components/packages-web/CustomComponentGridCol.vue +29 -0
- package/src-bak/components/packages-web/CustomComponentInputDialog.vue +144 -0
- package/src-bak/components/packages-web/CustomComponentNativeTabPane.vue +84 -0
- package/src-bak/components/packages-web/CustomComponentPlain.vue +243 -0
- package/src-bak/components/packages-web/CustomComponentRow.vue +83 -0
- package/src-bak/components/packages-web/CustomComponentSelectEmployees.vue +203 -0
- package/src-bak/components/packages-web/CustomComponentSendMail.vue +62 -0
- package/src-bak/components/packages-web/CustomComponentSteps.vue +41 -0
- package/src-bak/components/packages-web/CustomComponentTabPane.vue +20 -0
- package/src-bak/components/packages-web/CustomComponentTable.jsx +813 -0
- package/src-bak/components/packages-web/CustomComponentTabs.vue +126 -0
- package/src-bak/components/packages-web/CustomComponentTree.vue +28 -0
- package/src-bak/components/packages-web/ElButton.vue +146 -0
- package/src-bak/components/packages-web/ElCheckbox.vue +97 -0
- package/src-bak/components/packages-web/ElDatePicker.vue +93 -0
- package/src-bak/components/packages-web/ElInput copy.jsx +393 -0
- package/src-bak/components/packages-web/ElInput.jsx +312 -0
- package/src-bak/components/packages-web/ElInputNumber.vue +81 -0
- package/src-bak/components/packages-web/ElPagination.vue +61 -0
- package/src-bak/components/packages-web/ElRadio.vue +47 -0
- package/src-bak/components/packages-web/ElSelect.jsx +249 -0
- package/src-bak/components/packages-web/ElSelect_bak.vue +155 -0
- package/src-bak/components/packages-web/ElText.jsx +187 -0
- package/src-bak/components/packages-web/ElTextaa.vue +169 -0
- package/src-bak/components/packages-web/ElTimePicker.vue +39 -0
- package/src-bak/components/patchComponents-H5.js +46 -0
- package/src-bak/components/patchComponents-web.js +46 -0
- package/src-bak/components/simpleFormItemPc/index.js +1 -0
- package/src-bak/components/simpleFormItemPc/src/index.vue +94 -0
- package/src-bak/components/table/index.ts +29 -0
- package/src-bak/components/table/src/composables/use-scrollbar.ts +30 -0
- package/src-bak/components/table/src/config.ts +256 -0
- package/src-bak/components/table/src/filter-panel.vue +260 -0
- package/src-bak/components/table/src/h-helper.ts +34 -0
- package/src-bak/components/table/src/layout-observer.ts +78 -0
- package/src-bak/components/table/src/store/current.ts +85 -0
- package/src-bak/components/table/src/store/expand.ts +76 -0
- package/src-bak/components/table/src/store/helper.ts +74 -0
- package/src-bak/components/table/src/store/index.ts +246 -0
- package/src-bak/components/table/src/store/tree.ts +230 -0
- package/src-bak/components/table/src/store/watcher.ts +543 -0
- package/src-bak/components/table/src/table/defaults.ts +402 -0
- package/src-bak/components/table/src/table/key-render-helper.ts +27 -0
- package/src-bak/components/table/src/table/style-helper.ts +378 -0
- package/src-bak/components/table/src/table/utils-helper.ts +47 -0
- package/src-bak/components/table/src/table-body/defaults.ts +52 -0
- package/src-bak/components/table/src/table-body/events-helper.ts +203 -0
- package/src-bak/components/table/src/table-body/index.ts +119 -0
- package/src-bak/components/table/src/table-body/render-helper.ts +283 -0
- package/src-bak/components/table/src/table-body/styles-helper.ts +164 -0
- package/src-bak/components/table/src/table-column/defaults.ts +237 -0
- package/src-bak/components/table/src/table-column/index.ts +202 -0
- package/src-bak/components/table/src/table-column/render-helper.ts +214 -0
- package/src-bak/components/table/src/table-column/watcher-helper.ts +88 -0
- package/src-bak/components/table/src/table-footer/index.ts +128 -0
- package/src-bak/components/table/src/table-footer/mapState-helper.ts +33 -0
- package/src-bak/components/table/src/table-footer/style-helper.ts +51 -0
- package/src-bak/components/table/src/table-header/event-helper.ts +213 -0
- package/src-bak/components/table/src/table-header/index.ts +244 -0
- package/src-bak/components/table/src/table-header/style.helper.ts +119 -0
- package/src-bak/components/table/src/table-header/utils-helper.ts +94 -0
- package/src-bak/components/table/src/table-layout.ts +259 -0
- package/src-bak/components/table/src/table.vue +389 -0
- package/src-bak/components/table/src/tableColumn.ts +3 -0
- package/src-bak/components/table/src/tokens.ts +5 -0
- package/src-bak/components/table/src/util.ts +521 -0
- package/src-bak/components/table/style/css.ts +5 -0
- package/src-bak/components/table/style/index.ts +5 -0
- package/src-bak/components/tabs/index.js +8 -0
- package/src-bak/components/tabs/src/constants.js +23 -0
- package/src-bak/components/tabs/src/tab-bar.js +8 -0
- package/src-bak/components/tabs/src/tab-bar.vue +92 -0
- package/src-bak/components/tabs/src/tab-nav.jsx +424 -0
- package/src-bak/components/tabs/src/tab-pane.js +16 -0
- package/src-bak/components/tabs/src/tab-pane.vue +80 -0
- package/src-bak/components/tabs/src/tabs.jsx +223 -0
- package/src-bak/components/tabs/style/css.js +2 -0
- package/src-bak/components/tabs/style/index.js +2 -0
- package/src-bak/components/thirdPartyFrame/index.js +32 -0
- package/src-bak/components/thirdPartyFrame/src/ThirdPartyFrame.vue +125 -0
- package/src-bak/enums/index.js +16 -0
- package/src-bak/hooks/configLoad.js +45 -0
- package/src-bak/hooks/index.js +189 -0
- package/src-bak/hooks/mock.js +6960 -0
- package/src-bak/hooks/pageConfig.js +127 -0
- package/src-bak/index.jsx +440 -0
- package/src-bak/renderer.jsx +77 -0
- package/src-bak/resolver-H5.vue +88 -0
- package/src-bak/resolver-common.vue +129 -0
- package/src-bak/resolver-web.vue +91 -0
- package/src-bak/rules/eventsSupplement.js +573 -0
- package/src-bak/rules/parseCondition.js +378 -0
- package/src-bak/rules/ruleUtils.js +273 -0
- package/src-bak/rules/rulesDriver.js +118 -0
- package/src-bak/rulesImp/events.js +588 -0
- package/src-bak/rulesImp/index.js +33 -0
- package/src-bak/rulesImp/ruleInstance.js +231 -0
- package/src-bak/rulesImp/ruleUtils.js +124 -0
- package/src-bak/theme/element/components/button.scss +122 -0
- package/src-bak/theme/element/components/card.scss +8 -0
- package/src-bak/theme/element/components/checkbox.scss +19 -0
- package/src-bak/theme/element/components/collapse.scss +174 -0
- package/src-bak/theme/element/components/common.scss +30 -0
- package/src-bak/theme/element/components/cycle.scss +0 -0
- package/src-bak/theme/element/components/date.scss +13 -0
- package/src-bak/theme/element/components/dialog.scss +44 -0
- package/src-bak/theme/element/components/form.scss +104 -0
- package/src-bak/theme/element/components/index.scss +55 -0
- package/src-bak/theme/element/components/input.scss +36 -0
- package/src-bak/theme/element/components/message.scss +48 -0
- package/src-bak/theme/element/components/pagination.scss +47 -0
- package/src-bak/theme/element/components/popper.scss +3 -0
- package/src-bak/theme/element/components/radio.scss +40 -0
- package/src-bak/theme/element/components/scrollbar.scss +14 -0
- package/src-bak/theme/element/components/select.scss +82 -0
- package/src-bak/theme/element/components/steps.scss +6 -0
- package/{src/components/styles/CustomComponenTable.scss → src-bak/theme/element/components/table.scss} +90 -13
- package/src-bak/theme/element/components/tabs.scss +128 -0
- package/src-bak/theme/element/components/tag.scss +6 -0
- package/{src/components/styles → src-bak/theme/element/components}/text.scss +3 -3
- package/src-bak/theme/element/components/textarea.scss +3 -0
- package/src-bak/theme/element/components/tree.scss +0 -0
- package/src-bak/theme/element/index.scss +55 -0
- package/src-bak/utils/cipher.js +141 -0
- package/src-bak/utils/common.js +664 -0
- package/src-bak/utils/const.js +259 -0
- package/src-bak/utils/defaultVal.js +92 -0
- package/src-bak/utils/dom.js +36 -0
- package/src-bak/utils/format.js +19 -0
- package/src-bak/utils/index.js +4 -0
- package/src-bak/utils/is.js +74 -0
- package/src-bak/utils/loadModule.js +75 -0
- package/src-bak/utils/preserveFunc.js +33 -0
- package/src-bak/utils/render.jsx +1138 -0
- package/src-bak/utils/request.js +136 -0
- package/src-bak/utils/respone.js +70 -0
- package/src-bak/utils/valid.js +89 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { h } from 'vue'
|
|
3
|
+
import ElCheckbox from 'element-plus/es/components/checkbox/index.mjs'
|
|
4
|
+
import { ElIcon } from 'element-plus/es/components/icon/index.mjs'
|
|
5
|
+
import { ArrowRight, Loading } from '@element-plus/icons-vue'
|
|
6
|
+
import { getProp } from 'element-plus/es/utils/index.mjs'
|
|
7
|
+
|
|
8
|
+
import type { VNode } from 'vue'
|
|
9
|
+
import type { TableColumnCtx } from './table-column/defaults'
|
|
10
|
+
import type { Store } from './store'
|
|
11
|
+
import type { TreeNode } from './table/defaults'
|
|
12
|
+
|
|
13
|
+
const defaultClassNames = {
|
|
14
|
+
selection: 'table-column--selection',
|
|
15
|
+
expand: 'table__expand-column',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const cellStarts = {
|
|
19
|
+
default: {
|
|
20
|
+
order: '',
|
|
21
|
+
},
|
|
22
|
+
selection: {
|
|
23
|
+
width: 48,
|
|
24
|
+
minWidth: 48,
|
|
25
|
+
realWidth: 48,
|
|
26
|
+
order: '',
|
|
27
|
+
},
|
|
28
|
+
expand: {
|
|
29
|
+
width: 48,
|
|
30
|
+
minWidth: 48,
|
|
31
|
+
realWidth: 48,
|
|
32
|
+
order: '',
|
|
33
|
+
},
|
|
34
|
+
index: {
|
|
35
|
+
width: 48,
|
|
36
|
+
minWidth: 48,
|
|
37
|
+
realWidth: 48,
|
|
38
|
+
order: '',
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const getDefaultClassName = (type) => {
|
|
43
|
+
return defaultClassNames[type] || ''
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 这些选项不应该被覆盖
|
|
47
|
+
export const cellForced = {
|
|
48
|
+
selection: {
|
|
49
|
+
renderHeader<T>({ store, column }: { store: Store<T> }) {
|
|
50
|
+
function isDisabled() {
|
|
51
|
+
return store.states.data.value && store.states.data.value.length === 0
|
|
52
|
+
}
|
|
53
|
+
return h(ElCheckbox, {
|
|
54
|
+
disabled: isDisabled(),
|
|
55
|
+
size: store.states.tableSize.value,
|
|
56
|
+
indeterminate:
|
|
57
|
+
store.states.selection.value.length > 0 &&
|
|
58
|
+
!store.states.isAllSelected.value,
|
|
59
|
+
'onUpdate:modelValue': store.toggleAllSelection,
|
|
60
|
+
modelValue: store.states.isAllSelected.value,
|
|
61
|
+
ariaLabel: column.label,
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
renderCell<T>({
|
|
65
|
+
row,
|
|
66
|
+
column,
|
|
67
|
+
store,
|
|
68
|
+
$index,
|
|
69
|
+
}: {
|
|
70
|
+
row: T
|
|
71
|
+
column: TableColumnCtx<T>
|
|
72
|
+
store: Store<T>
|
|
73
|
+
$index: string
|
|
74
|
+
}) {
|
|
75
|
+
return h(ElCheckbox, {
|
|
76
|
+
disabled: column.selectable
|
|
77
|
+
? !column.selectable.call(null, row, $index)
|
|
78
|
+
: false,
|
|
79
|
+
size: store.states.tableSize.value,
|
|
80
|
+
onChange: () => {
|
|
81
|
+
store.commit('rowSelectedChanged', row)
|
|
82
|
+
},
|
|
83
|
+
onClick: (event: Event) => event.stopPropagation(),
|
|
84
|
+
modelValue: store.isSelected(row),
|
|
85
|
+
ariaLabel: column.label,
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
sortable: false,
|
|
89
|
+
resizable: false,
|
|
90
|
+
},
|
|
91
|
+
index: {
|
|
92
|
+
renderHeader<T>({ column }: { column: TableColumnCtx<T> }) {
|
|
93
|
+
return column.label || '#'
|
|
94
|
+
},
|
|
95
|
+
renderCell<T>({
|
|
96
|
+
column,
|
|
97
|
+
$index,
|
|
98
|
+
}: {
|
|
99
|
+
column: TableColumnCtx<T>
|
|
100
|
+
$index: number
|
|
101
|
+
}) {
|
|
102
|
+
let i = $index + 1
|
|
103
|
+
const index = column.index
|
|
104
|
+
|
|
105
|
+
if (typeof index === 'number') {
|
|
106
|
+
i = $index + index
|
|
107
|
+
} else if (typeof index === 'function') {
|
|
108
|
+
i = index($index)
|
|
109
|
+
}
|
|
110
|
+
return h('div', {}, [i])
|
|
111
|
+
},
|
|
112
|
+
sortable: false,
|
|
113
|
+
},
|
|
114
|
+
expand: {
|
|
115
|
+
renderHeader<T>({ column }: { column: TableColumnCtx<T> }) {
|
|
116
|
+
return column.label || ''
|
|
117
|
+
},
|
|
118
|
+
renderCell<T>({
|
|
119
|
+
row,
|
|
120
|
+
store,
|
|
121
|
+
expanded,
|
|
122
|
+
}: {
|
|
123
|
+
row: T
|
|
124
|
+
store: Store<T>
|
|
125
|
+
expanded: boolean
|
|
126
|
+
}) {
|
|
127
|
+
const { ns } = store
|
|
128
|
+
const classes = [ns.e('expand-icon')]
|
|
129
|
+
if (expanded) {
|
|
130
|
+
classes.push(ns.em('expand-icon', 'expanded'))
|
|
131
|
+
}
|
|
132
|
+
const callback = function (e: Event) {
|
|
133
|
+
e.stopPropagation()
|
|
134
|
+
store.toggleRowExpansion(row)
|
|
135
|
+
}
|
|
136
|
+
return h(
|
|
137
|
+
'div',
|
|
138
|
+
{
|
|
139
|
+
class: classes,
|
|
140
|
+
onClick: callback,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
default: () => {
|
|
144
|
+
return [
|
|
145
|
+
h(ElIcon, null, {
|
|
146
|
+
default: () => {
|
|
147
|
+
return [h(ArrowRight)]
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
},
|
|
155
|
+
sortable: false,
|
|
156
|
+
resizable: false,
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function defaultRenderCell<T>({
|
|
161
|
+
row,
|
|
162
|
+
column,
|
|
163
|
+
$index,
|
|
164
|
+
}: {
|
|
165
|
+
row: T
|
|
166
|
+
column: TableColumnCtx<T>
|
|
167
|
+
$index: number
|
|
168
|
+
}) {
|
|
169
|
+
const property = column.property
|
|
170
|
+
const value = property && getProp(row, property).value
|
|
171
|
+
if (column && column.formatter) {
|
|
172
|
+
return column.formatter(row, column, value, $index)
|
|
173
|
+
}
|
|
174
|
+
return value?.toString?.() || ''
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function treeCellPrefix<T>(
|
|
178
|
+
{
|
|
179
|
+
row,
|
|
180
|
+
treeNode,
|
|
181
|
+
store,
|
|
182
|
+
}: {
|
|
183
|
+
row: T
|
|
184
|
+
treeNode: TreeNode
|
|
185
|
+
store: Store<T>
|
|
186
|
+
},
|
|
187
|
+
createPlaceholder = false
|
|
188
|
+
) {
|
|
189
|
+
const { ns } = store
|
|
190
|
+
if (!treeNode) {
|
|
191
|
+
if (createPlaceholder) {
|
|
192
|
+
return [
|
|
193
|
+
h('span', {
|
|
194
|
+
class: ns.e('placeholder'),
|
|
195
|
+
}),
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
return null
|
|
199
|
+
}
|
|
200
|
+
const ele: VNode[] = []
|
|
201
|
+
const callback = function (e) {
|
|
202
|
+
e.stopPropagation()
|
|
203
|
+
if (treeNode.loading) {
|
|
204
|
+
return
|
|
205
|
+
}
|
|
206
|
+
store.loadOrToggle(row)
|
|
207
|
+
}
|
|
208
|
+
if (treeNode.indent) {
|
|
209
|
+
ele.push(
|
|
210
|
+
h('span', {
|
|
211
|
+
class: ns.e('indent'),
|
|
212
|
+
style: { 'padding-left': `${treeNode.indent}px` },
|
|
213
|
+
})
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
|
|
217
|
+
const expandClasses = [
|
|
218
|
+
ns.e('expand-icon'),
|
|
219
|
+
treeNode.expanded ? ns.em('expand-icon', 'expanded') : '',
|
|
220
|
+
]
|
|
221
|
+
let icon = ArrowRight
|
|
222
|
+
if (treeNode.loading) {
|
|
223
|
+
icon = Loading
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
ele.push(
|
|
227
|
+
h(
|
|
228
|
+
'div',
|
|
229
|
+
{
|
|
230
|
+
class: expandClasses,
|
|
231
|
+
onClick: callback,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
default: () => {
|
|
235
|
+
return [
|
|
236
|
+
h(
|
|
237
|
+
ElIcon,
|
|
238
|
+
{ class: { [ns.is('loading')]: treeNode.loading } },
|
|
239
|
+
{
|
|
240
|
+
default: () => [h(icon)],
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
)
|
|
248
|
+
} else {
|
|
249
|
+
ele.push(
|
|
250
|
+
h('span', {
|
|
251
|
+
class: ns.e('placeholder'),
|
|
252
|
+
})
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
return ele
|
|
256
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-tooltip
|
|
3
|
+
ref="tooltip"
|
|
4
|
+
:visible="tooltipVisible"
|
|
5
|
+
:offset="0"
|
|
6
|
+
:placement="placement"
|
|
7
|
+
:show-arrow="false"
|
|
8
|
+
:stop-popper-mouse-event="false"
|
|
9
|
+
teleported
|
|
10
|
+
effect="light"
|
|
11
|
+
pure
|
|
12
|
+
:popper-class="filterClassName"
|
|
13
|
+
persistent
|
|
14
|
+
>
|
|
15
|
+
<template #content>
|
|
16
|
+
<div v-if="multiple">
|
|
17
|
+
<div :class="ns.e('content')">
|
|
18
|
+
<el-scrollbar :wrap-class="ns.e('wrap')">
|
|
19
|
+
<el-checkbox-group
|
|
20
|
+
v-model="filteredValue"
|
|
21
|
+
:class="ns.e('checkbox-group')"
|
|
22
|
+
>
|
|
23
|
+
<el-checkbox
|
|
24
|
+
v-for="filter in filters"
|
|
25
|
+
:key="filter.value"
|
|
26
|
+
:value="filter.value"
|
|
27
|
+
>
|
|
28
|
+
{{ filter.text }}
|
|
29
|
+
</el-checkbox>
|
|
30
|
+
</el-checkbox-group>
|
|
31
|
+
</el-scrollbar>
|
|
32
|
+
</div>
|
|
33
|
+
<div :class="ns.e('bottom')">
|
|
34
|
+
<button
|
|
35
|
+
:class="{ [ns.is('disabled')]: filteredValue.length === 0 }"
|
|
36
|
+
:disabled="filteredValue.length === 0"
|
|
37
|
+
type="button"
|
|
38
|
+
@click="handleConfirm"
|
|
39
|
+
>
|
|
40
|
+
{{ t('el.table.confirmFilter') }}
|
|
41
|
+
</button>
|
|
42
|
+
<button type="button" @click="handleReset">
|
|
43
|
+
{{ t('el.table.resetFilter') }}
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<ul v-else :class="ns.e('list')">
|
|
48
|
+
<li
|
|
49
|
+
:class="[
|
|
50
|
+
ns.e('list-item'),
|
|
51
|
+
{
|
|
52
|
+
[ns.is('active')]:
|
|
53
|
+
filterValue === undefined || filterValue === null,
|
|
54
|
+
},
|
|
55
|
+
]"
|
|
56
|
+
@click="handleSelect(null)"
|
|
57
|
+
>
|
|
58
|
+
{{ t('el.table.clearFilter') }}
|
|
59
|
+
</li>
|
|
60
|
+
<li
|
|
61
|
+
v-for="filter in filters"
|
|
62
|
+
:key="filter.value"
|
|
63
|
+
:class="[ns.e('list-item'), ns.is('active', isActive(filter))]"
|
|
64
|
+
:label="filter.value"
|
|
65
|
+
@click="handleSelect(filter.value)"
|
|
66
|
+
>
|
|
67
|
+
{{ filter.text }}
|
|
68
|
+
</li>
|
|
69
|
+
</ul>
|
|
70
|
+
</template>
|
|
71
|
+
<template #default>
|
|
72
|
+
<span
|
|
73
|
+
v-click-outside:[popperPaneRef]="hideFilterPanel"
|
|
74
|
+
:class="[
|
|
75
|
+
`${ns.namespace.value}-table__column-filter-trigger`,
|
|
76
|
+
`${ns.namespace.value}-none-outline`,
|
|
77
|
+
]"
|
|
78
|
+
@click="showFilterPanel"
|
|
79
|
+
>
|
|
80
|
+
<el-icon>
|
|
81
|
+
<arrow-up v-if="column.filterOpened" />
|
|
82
|
+
<arrow-down v-else />
|
|
83
|
+
</el-icon>
|
|
84
|
+
</span>
|
|
85
|
+
</template>
|
|
86
|
+
</el-tooltip>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<script lang="ts">
|
|
90
|
+
// @ts-nocheck
|
|
91
|
+
import { computed, defineComponent, getCurrentInstance, ref, watch } from 'vue'
|
|
92
|
+
import ElCheckbox from 'element-plus/es/components/checkbox/index.mjs'
|
|
93
|
+
import { ElIcon } from 'element-plus/es/components/icon/index.mjs'
|
|
94
|
+
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
|
95
|
+
import { ClickOutside } from 'element-plus/es/directives/index.mjs'
|
|
96
|
+
import { useLocale, useNamespace } from 'element-plus/es/hooks/index.mjs'
|
|
97
|
+
import ElTooltip from 'element-plus/es/components/tooltip/index.mjs'
|
|
98
|
+
import ElScrollbar from 'element-plus/es/components/scrollbar/index.mjs'
|
|
99
|
+
import type { Placement } from 'element-plus/es/components/popper/index.mjs.mjs'
|
|
100
|
+
|
|
101
|
+
import type { PropType, WritableComputedRef } from 'vue'
|
|
102
|
+
import type { TableColumnCtx } from './table-column/defaults'
|
|
103
|
+
import type { TableHeader } from './table-header'
|
|
104
|
+
import type { Store } from './store'
|
|
105
|
+
|
|
106
|
+
const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox
|
|
107
|
+
|
|
108
|
+
export default defineComponent({
|
|
109
|
+
name: 'ElTableFilterPanel',
|
|
110
|
+
components: {
|
|
111
|
+
ElCheckbox,
|
|
112
|
+
ElCheckboxGroup,
|
|
113
|
+
ElScrollbar,
|
|
114
|
+
ElTooltip,
|
|
115
|
+
ElIcon,
|
|
116
|
+
ArrowDown,
|
|
117
|
+
ArrowUp,
|
|
118
|
+
},
|
|
119
|
+
directives: { ClickOutside },
|
|
120
|
+
props: {
|
|
121
|
+
placement: {
|
|
122
|
+
type: String as PropType<Placement>,
|
|
123
|
+
default: 'bottom-start',
|
|
124
|
+
},
|
|
125
|
+
store: {
|
|
126
|
+
type: Object as PropType<Store<unknown>>,
|
|
127
|
+
},
|
|
128
|
+
column: {
|
|
129
|
+
type: Object as PropType<TableColumnCtx<unknown>>,
|
|
130
|
+
},
|
|
131
|
+
upDataColumn: {
|
|
132
|
+
type: Function,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
setup(props) {
|
|
136
|
+
const instance = getCurrentInstance()
|
|
137
|
+
const { t } = useLocale()
|
|
138
|
+
const ns = useNamespace('table-filter')
|
|
139
|
+
const parent = instance?.parent as TableHeader
|
|
140
|
+
if (!parent.filterPanels.value[props.column.id]) {
|
|
141
|
+
parent.filterPanels.value[props.column.id] = instance
|
|
142
|
+
}
|
|
143
|
+
const tooltipVisible = ref(false)
|
|
144
|
+
const tooltip = ref<InstanceType<typeof ElTooltip> | null>(null)
|
|
145
|
+
const filters = computed(() => {
|
|
146
|
+
return props.column && props.column.filters
|
|
147
|
+
})
|
|
148
|
+
const filterClassName = computed(() => {
|
|
149
|
+
if (props.column.filterClassName) {
|
|
150
|
+
return `${ns.b()} ${props.column.filterClassName}`
|
|
151
|
+
}
|
|
152
|
+
return ns.b()
|
|
153
|
+
})
|
|
154
|
+
const filterValue = computed({
|
|
155
|
+
get: () => (props.column?.filteredValue || [])[0],
|
|
156
|
+
set: (value: string) => {
|
|
157
|
+
if (filteredValue.value) {
|
|
158
|
+
if (typeof value !== 'undefined' && value !== null) {
|
|
159
|
+
filteredValue.value.splice(0, 1, value)
|
|
160
|
+
} else {
|
|
161
|
+
filteredValue.value.splice(0, 1)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
const filteredValue: WritableComputedRef<unknown[]> = computed({
|
|
167
|
+
get() {
|
|
168
|
+
if (props.column) {
|
|
169
|
+
return props.column.filteredValue || []
|
|
170
|
+
}
|
|
171
|
+
return []
|
|
172
|
+
},
|
|
173
|
+
set(value: unknown[]) {
|
|
174
|
+
if (props.column) {
|
|
175
|
+
props.upDataColumn('filteredValue', value)
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
})
|
|
179
|
+
const multiple = computed(() => {
|
|
180
|
+
if (props.column) {
|
|
181
|
+
return props.column.filterMultiple
|
|
182
|
+
}
|
|
183
|
+
return true
|
|
184
|
+
})
|
|
185
|
+
const isActive = (filter) => {
|
|
186
|
+
return filter.value === filterValue.value
|
|
187
|
+
}
|
|
188
|
+
const hidden = () => {
|
|
189
|
+
tooltipVisible.value = false
|
|
190
|
+
}
|
|
191
|
+
const showFilterPanel = (e: MouseEvent) => {
|
|
192
|
+
e.stopPropagation()
|
|
193
|
+
tooltipVisible.value = !tooltipVisible.value
|
|
194
|
+
}
|
|
195
|
+
const hideFilterPanel = () => {
|
|
196
|
+
tooltipVisible.value = false
|
|
197
|
+
}
|
|
198
|
+
const handleConfirm = () => {
|
|
199
|
+
confirmFilter(filteredValue.value)
|
|
200
|
+
hidden()
|
|
201
|
+
}
|
|
202
|
+
const handleReset = () => {
|
|
203
|
+
filteredValue.value = []
|
|
204
|
+
confirmFilter(filteredValue.value)
|
|
205
|
+
hidden()
|
|
206
|
+
}
|
|
207
|
+
const handleSelect = (_filterValue?: string) => {
|
|
208
|
+
filterValue.value = _filterValue
|
|
209
|
+
if (typeof _filterValue !== 'undefined' && _filterValue !== null) {
|
|
210
|
+
confirmFilter(filteredValue.value)
|
|
211
|
+
} else {
|
|
212
|
+
confirmFilter([])
|
|
213
|
+
}
|
|
214
|
+
hidden()
|
|
215
|
+
}
|
|
216
|
+
const confirmFilter = (filteredValue: unknown[]) => {
|
|
217
|
+
props.store.commit('filterChange', {
|
|
218
|
+
column: props.column,
|
|
219
|
+
values: filteredValue,
|
|
220
|
+
})
|
|
221
|
+
props.store.updateAllSelected()
|
|
222
|
+
}
|
|
223
|
+
watch(
|
|
224
|
+
tooltipVisible,
|
|
225
|
+
(value) => {
|
|
226
|
+
// todo
|
|
227
|
+
if (props.column) {
|
|
228
|
+
props.upDataColumn('filterOpened', value)
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
immediate: true,
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
const popperPaneRef = computed(() => {
|
|
237
|
+
return tooltip.value?.popperRef?.contentRef
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
tooltipVisible,
|
|
242
|
+
multiple,
|
|
243
|
+
filterClassName,
|
|
244
|
+
filteredValue,
|
|
245
|
+
filterValue,
|
|
246
|
+
filters,
|
|
247
|
+
handleConfirm,
|
|
248
|
+
handleReset,
|
|
249
|
+
handleSelect,
|
|
250
|
+
isActive,
|
|
251
|
+
t,
|
|
252
|
+
ns,
|
|
253
|
+
showFilterPanel,
|
|
254
|
+
hideFilterPanel,
|
|
255
|
+
popperPaneRef,
|
|
256
|
+
tooltip,
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
})
|
|
260
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { h } from 'vue'
|
|
3
|
+
export function hColgroup(props) {
|
|
4
|
+
const isAuto = props.tableLayout === 'auto'
|
|
5
|
+
let columns = props.columns || []
|
|
6
|
+
if (isAuto) {
|
|
7
|
+
if (columns.every((column) => column.width === undefined)) {
|
|
8
|
+
columns = []
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const getPropsData = (column) => {
|
|
12
|
+
const propsData = {
|
|
13
|
+
key: `${props.tableLayout}_${column.id}`,
|
|
14
|
+
style: {},
|
|
15
|
+
name: undefined,
|
|
16
|
+
}
|
|
17
|
+
if (isAuto) {
|
|
18
|
+
propsData.style = {
|
|
19
|
+
width: `${column.width}px`,
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
propsData.name = column.id
|
|
23
|
+
}
|
|
24
|
+
return propsData
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return h(
|
|
28
|
+
'colgroup',
|
|
29
|
+
{},
|
|
30
|
+
columns.map((column) => h('col', getPropsData(column)))
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
hColgroup.props = ['columns', 'tableLayout']
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
getCurrentInstance,
|
|
5
|
+
onBeforeMount,
|
|
6
|
+
onMounted,
|
|
7
|
+
onUnmounted,
|
|
8
|
+
onUpdated,
|
|
9
|
+
} from 'vue'
|
|
10
|
+
|
|
11
|
+
import type { TableHeader } from './table-header'
|
|
12
|
+
import type TableLayout from './table-layout'
|
|
13
|
+
import type { Table } from './table/defaults'
|
|
14
|
+
|
|
15
|
+
function useLayoutObserver<T>(root: Table<T>) {
|
|
16
|
+
const instance = getCurrentInstance() as TableHeader
|
|
17
|
+
onBeforeMount(() => {
|
|
18
|
+
tableLayout.value.addObserver(instance)
|
|
19
|
+
})
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
onColumnsChange(tableLayout.value)
|
|
22
|
+
onScrollableChange(tableLayout.value)
|
|
23
|
+
})
|
|
24
|
+
onUpdated(() => {
|
|
25
|
+
onColumnsChange(tableLayout.value)
|
|
26
|
+
onScrollableChange(tableLayout.value)
|
|
27
|
+
})
|
|
28
|
+
onUnmounted(() => {
|
|
29
|
+
tableLayout.value.removeObserver(instance)
|
|
30
|
+
})
|
|
31
|
+
const tableLayout = computed(() => {
|
|
32
|
+
const layout = root.layout as TableLayout<T>
|
|
33
|
+
if (!layout) {
|
|
34
|
+
throw new Error('Can not find table layout.')
|
|
35
|
+
}
|
|
36
|
+
return layout
|
|
37
|
+
})
|
|
38
|
+
const onColumnsChange = (layout: TableLayout<T>) => {
|
|
39
|
+
const cols = root.vnode.el?.querySelectorAll('colgroup > col') || []
|
|
40
|
+
if (!cols.length) return
|
|
41
|
+
const flattenColumns = layout.getFlattenColumns()
|
|
42
|
+
const columnsMap = {}
|
|
43
|
+
flattenColumns.forEach((column) => {
|
|
44
|
+
columnsMap[column.id] = column
|
|
45
|
+
})
|
|
46
|
+
for (let i = 0, j = cols.length; i < j; i++) {
|
|
47
|
+
const col = cols[i]
|
|
48
|
+
const name = col.getAttribute('name')
|
|
49
|
+
const column = columnsMap[name]
|
|
50
|
+
if (column) {
|
|
51
|
+
col.setAttribute('width', column.realWidth || column.width)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const onScrollableChange = (layout: TableLayout<T>) => {
|
|
57
|
+
const cols =
|
|
58
|
+
root.vnode.el?.querySelectorAll('colgroup > col[name=gutter]') || []
|
|
59
|
+
for (let i = 0, j = cols.length; i < j; i++) {
|
|
60
|
+
const col = cols[i]
|
|
61
|
+
col.setAttribute('width', layout.scrollY.value ? layout.gutterWidth : '0')
|
|
62
|
+
}
|
|
63
|
+
const ths = root.vnode.el?.querySelectorAll('th.gutter') || []
|
|
64
|
+
for (let i = 0, j = ths.length; i < j; i++) {
|
|
65
|
+
const th = ths[i]
|
|
66
|
+
th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : '0'
|
|
67
|
+
th.style.display = layout.scrollY.value ? '' : 'none'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
tableLayout: tableLayout.value,
|
|
73
|
+
onColumnsChange,
|
|
74
|
+
onScrollableChange,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default useLayoutObserver
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { getCurrentInstance, ref, unref } from 'vue'
|
|
3
|
+
import { getRowIdentity } from '../util'
|
|
4
|
+
|
|
5
|
+
import type { Ref } from 'vue'
|
|
6
|
+
import type { Table } from '../table/defaults'
|
|
7
|
+
import type { WatcherPropsData } from '.'
|
|
8
|
+
|
|
9
|
+
function useCurrent<T>(watcherData: WatcherPropsData<T>) {
|
|
10
|
+
const instance = getCurrentInstance() as Table<T>
|
|
11
|
+
const _currentRowKey = ref<string>(null)
|
|
12
|
+
const currentRow: Ref<T> = ref(null)
|
|
13
|
+
|
|
14
|
+
const setCurrentRowKey = (key: string) => {
|
|
15
|
+
instance.store.assertRowKey()
|
|
16
|
+
_currentRowKey.value = key
|
|
17
|
+
setCurrentRowByKey(key)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const restoreCurrentRowKey = () => {
|
|
21
|
+
_currentRowKey.value = null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const setCurrentRowByKey = (key: string) => {
|
|
25
|
+
const { data, rowKey } = watcherData
|
|
26
|
+
let _currentRow = null
|
|
27
|
+
if (rowKey.value) {
|
|
28
|
+
_currentRow = (unref(data) || []).find(
|
|
29
|
+
(item) => getRowIdentity(item, rowKey.value) === key
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
currentRow.value = _currentRow
|
|
33
|
+
instance.emit('current-change', currentRow.value, null)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const updateCurrentRow = (_currentRow: T) => {
|
|
37
|
+
const oldCurrentRow = currentRow.value
|
|
38
|
+
if (_currentRow && _currentRow !== oldCurrentRow) {
|
|
39
|
+
currentRow.value = _currentRow
|
|
40
|
+
instance.emit('current-change', currentRow.value, oldCurrentRow)
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
if (!_currentRow && oldCurrentRow) {
|
|
44
|
+
currentRow.value = null
|
|
45
|
+
instance.emit('current-change', null, oldCurrentRow)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const updateCurrentRowData = () => {
|
|
50
|
+
const rowKey = watcherData.rowKey.value
|
|
51
|
+
// data 为 null 时,解构时的默认值会被忽略
|
|
52
|
+
const data = watcherData.data.value || []
|
|
53
|
+
const oldCurrentRow = currentRow.value
|
|
54
|
+
// 当 currentRow 不在 data 中时尝试更新数据
|
|
55
|
+
if (!data.includes(oldCurrentRow) && oldCurrentRow) {
|
|
56
|
+
if (rowKey) {
|
|
57
|
+
const currentRowKey = getRowIdentity(oldCurrentRow, rowKey)
|
|
58
|
+
setCurrentRowByKey(currentRowKey)
|
|
59
|
+
} else {
|
|
60
|
+
currentRow.value = null
|
|
61
|
+
}
|
|
62
|
+
if (currentRow.value === null) {
|
|
63
|
+
instance.emit('current-change', null, oldCurrentRow)
|
|
64
|
+
}
|
|
65
|
+
} else if (_currentRowKey.value) {
|
|
66
|
+
// 把初始时下设置的 rowKey 转化成 rowData
|
|
67
|
+
setCurrentRowByKey(_currentRowKey.value)
|
|
68
|
+
restoreCurrentRowKey()
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
setCurrentRowKey,
|
|
74
|
+
restoreCurrentRowKey,
|
|
75
|
+
setCurrentRowByKey,
|
|
76
|
+
updateCurrentRow,
|
|
77
|
+
updateCurrentRowData,
|
|
78
|
+
states: {
|
|
79
|
+
_currentRowKey,
|
|
80
|
+
currentRow,
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default useCurrent
|