resolver-egretimp-plus 0.1.30 → 0.1.31

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.
Files changed (47) hide show
  1. package/dist/h5/index.js +18 -18
  2. package/dist/web/index.js +128 -128
  3. package/dist/web/index.js.LICENSE.txt +15 -0
  4. package/package.json +5 -1
  5. package/scripts/webpack.config.js +18 -2
  6. package/src/components/packages-web/CustomComponentTable.jsx +8 -5
  7. package/src/components/table/index.ts +29 -0
  8. package/src/components/table/src/composables/use-scrollbar.ts +30 -0
  9. package/src/components/table/src/config.ts +256 -0
  10. package/src/components/table/src/filter-panel.vue +260 -0
  11. package/src/components/table/src/h-helper.ts +34 -0
  12. package/src/components/table/src/layout-observer.ts +78 -0
  13. package/src/components/table/src/store/current.ts +85 -0
  14. package/src/components/table/src/store/expand.ts +76 -0
  15. package/src/components/table/src/store/helper.ts +74 -0
  16. package/src/components/table/src/store/index.ts +246 -0
  17. package/src/components/table/src/store/tree.ts +230 -0
  18. package/src/components/table/src/store/watcher.ts +543 -0
  19. package/src/components/table/src/table/defaults.ts +402 -0
  20. package/src/components/table/src/table/key-render-helper.ts +27 -0
  21. package/src/components/table/src/table/style-helper.ts +378 -0
  22. package/src/components/table/src/table/utils-helper.ts +47 -0
  23. package/src/components/table/src/table-body/defaults.ts +52 -0
  24. package/src/components/table/src/table-body/events-helper.ts +203 -0
  25. package/src/components/table/src/table-body/index.ts +119 -0
  26. package/src/components/table/src/table-body/render-helper.ts +283 -0
  27. package/src/components/table/src/table-body/styles-helper.ts +164 -0
  28. package/src/components/table/src/table-column/defaults.ts +237 -0
  29. package/src/components/table/src/table-column/index.ts +202 -0
  30. package/src/components/table/src/table-column/render-helper.ts +214 -0
  31. package/src/components/table/src/table-column/watcher-helper.ts +88 -0
  32. package/src/components/table/src/table-footer/index.ts +128 -0
  33. package/src/components/table/src/table-footer/mapState-helper.ts +33 -0
  34. package/src/components/table/src/table-footer/style-helper.ts +51 -0
  35. package/src/components/table/src/table-header/event-helper.ts +213 -0
  36. package/src/components/table/src/table-header/index.ts +244 -0
  37. package/src/components/table/src/table-header/style.helper.ts +119 -0
  38. package/src/components/table/src/table-header/utils-helper.ts +94 -0
  39. package/src/components/table/src/table-layout.ts +259 -0
  40. package/src/components/table/src/table.vue +389 -0
  41. package/src/components/table/src/tableColumn.ts +3 -0
  42. package/src/components/table/src/tokens.ts +5 -0
  43. package/src/components/table/src/util.ts +521 -0
  44. package/src/components/table/style/css.ts +5 -0
  45. package/src/components/table/style/index.ts +5 -0
  46. package/tsconfig.json +19 -0
  47. package/vue-shims.d.ts +4 -0
@@ -25,6 +25,21 @@
25
25
 
26
26
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
27
27
 
28
+ /**
29
+ * Checks if an event is supported in the current execution environment.
30
+ *
31
+ * NOTE: This will not work correctly for non-generic events such as `change`,
32
+ * `reset`, `load`, `error`, and `select`.
33
+ *
34
+ * Borrows from Modernizr.
35
+ *
36
+ * @param {string} eventNameSuffix Event name, e.g. "click".
37
+ * @param {?boolean} capture Check if the capture phase is supported.
38
+ * @return {boolean} True if the event is supported.
39
+ * @internal
40
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
41
+ */
42
+
28
43
  /**
29
44
  * @vue/compiler-core v3.4.15
30
45
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -46,6 +46,7 @@
46
46
  "qs": "^6.13.0",
47
47
  "sass": "1.77.6",
48
48
  "sass-loader": "^14.2.1",
49
+ "ts-loader": "^9.5.2",
49
50
  "vue": "^3.5.12",
50
51
  "vue-demi": "^0.14.10",
51
52
  "vue-loader": "^17.4.2",
@@ -54,5 +55,8 @@
54
55
  "vue3-sfc-loader": "^0.9.5",
55
56
  "webpack": "^5.90.0",
56
57
  "webpack-cli": "^5.1.4"
58
+ },
59
+ "dependencies": {
60
+ "@popperjs/core": "^2.11.8"
57
61
  }
58
62
  }
@@ -40,6 +40,21 @@ module.exports = {
40
40
  }
41
41
  ],
42
42
  },
43
+ {
44
+ test: /\.tsx?$/,
45
+ use: [
46
+ 'babel-loader',
47
+ {
48
+ loader: 'ts-loader',
49
+ options: {
50
+ appendTsSuffixTo: [/\.vue$/],
51
+ transpileOnly: true,
52
+ happyPackMode: false,
53
+ }
54
+ }
55
+ ],
56
+ exclude: /node_modules/,
57
+ },
43
58
  {
44
59
  test: /\.less$/,
45
60
  use: [
@@ -67,7 +82,7 @@ module.exports = {
67
82
  },
68
83
  // devtool: 'source-map',
69
84
  resolve: {
70
- extensions: ['.js', '.json', '.vue', '.jsx'],
85
+ extensions: ['.js', '.json', '.vue', '.jsx', '.ts'],
71
86
  modules: [path.resolve(__dirname, '../node_modules')]
72
87
  },
73
88
  externals: {
@@ -83,7 +98,8 @@ module.exports = {
83
98
  'element-plus/es/constants/index.mjs': 'element-plus/es/constants/index.mjs',
84
99
  'element-plus/es/utils/index.mjs': 'element-plus/es/utils/index.mjs',
85
100
  'element-plus/es/locale/lang/zh-cn': 'element-plus/es/locale/lang/zh-cn',
86
- 'element-plus/es/locale/lang/en': 'element-plus/es/locale/lang/en'
101
+ 'element-plus/es/locale/lang/en': 'element-plus/es/locale/lang/en',
102
+ // '@popperjs/core': '@popperjs/core'
87
103
  },
88
104
  externalsType: 'module',
89
105
  experiments: {
@@ -1,10 +1,10 @@
1
1
 
2
- import { ElTable, ElTableColumn, ElPagination } from 'element-plus'
2
+ import { ElPagination } from 'element-plus'
3
+ import ElTable, { ElTableColumn } from '../table'
3
4
  import Renderer from '../../renderer.jsx'
4
5
  import { computed, inject, watch, h, ref, reactive } from 'vue'
5
6
  import { commonPropsType, TABLE_COLUMN_NOT_RENDER_META_TYPE, DISPLAY_SHOW, compareComponet, isPlainObject, hasOwn, cloneDeep, isPromise, isPlainColumn, generateUniqueId, calcDisable, camelize, capitalize, DISPLAY_HIDDEN, definePrivatelyProp } from '../../utils/index.js'
6
7
  import '../styles/CustomComponenTable.scss'
7
- import { assginConfig } from '../helper/resolver.js'
8
8
 
9
9
  export default {
10
10
  inheritAttrs: false,
@@ -77,7 +77,6 @@ export default {
77
77
  const rootValue = inject('rootValue')
78
78
  const selects = inject('selects')
79
79
  const tableColumnFirstMetaCode = ref("")
80
- // assginConfig({dynamicMapComp, pmPageMetaList: props.config.pmPageMetaList || [], preKey: props.config?.dynamicHireRelat || '', ruleExecuter })
81
80
  const tableColumnConfigs = computed(() => {
82
81
  let pmPageMetaList = props.config.pmPageMetaList || []
83
82
  return pmPageMetaList.map((config) => {
@@ -197,8 +196,12 @@ export default {
197
196
  config.showOverflowTooltip != '0' &&
198
197
  config['show-overflow-tooltip'] != '0'
199
198
  ) {
200
- retObj['show-overflow-tooltip'] = true
201
- retObj.showOverflowTooltip = true
199
+ const showOverflowTooltipFn = (data) => {
200
+ const currentConfig = multiPmPageMetaList.value?.[data.$index]?.[idx]
201
+ return isPlainColumn({...currentConfig, isColumn: true}, calcDisable(currentConfig, retObj.mode))
202
+ }
203
+ retObj['show-overflow-tooltip'] = showOverflowTooltipFn
204
+ retObj.showOverflowTooltip = showOverflowTooltipFn
202
205
  }
203
206
  if (config.type === 'selection') {
204
207
  const orginSelectable = retObj.selectable
@@ -0,0 +1,29 @@
1
+ import { withInstall, withNoopInstall } from 'element-plus/es/utils/index.mjs'
2
+ import Table from './src/table.vue'
3
+ import TableColumn from './src/tableColumn'
4
+
5
+ export const ElTable = withInstall(Table, {
6
+ TableColumn,
7
+ })
8
+ export default ElTable
9
+ export const ElTableColumn = withNoopInstall(TableColumn)
10
+
11
+ export type TableInstance = InstanceType<typeof Table>
12
+
13
+ export type TableColumnInstance = InstanceType<typeof TableColumn>
14
+
15
+ export type {
16
+ SummaryMethod,
17
+ Table,
18
+ TableProps,
19
+ TableRefs,
20
+ ColumnCls,
21
+ ColumnStyle,
22
+ CellCls,
23
+ CellStyle,
24
+ TreeNode,
25
+ RenderRowData,
26
+ Sort,
27
+ Filter,
28
+ TableColumnCtx,
29
+ } from './src/table/defaults'
@@ -0,0 +1,30 @@
1
+ import { ref } from 'vue'
2
+ import { isNumber } from 'element-plus/es/utils/index.mjs'
3
+
4
+ export const useScrollbar = () => {
5
+ const scrollBarRef = ref()
6
+
7
+ const scrollTo = (options: ScrollToOptions | number, yCoord?: number) => {
8
+ const scrollbar = scrollBarRef.value
9
+ if (scrollbar) {
10
+ scrollbar.scrollTo(options, yCoord)
11
+ }
12
+ }
13
+
14
+ const setScrollPosition = (position: 'Top' | 'Left', offset?: number) => {
15
+ const scrollbar = scrollBarRef.value
16
+ if (scrollbar && isNumber(offset) && ['Top', 'Left'].includes(position)) {
17
+ scrollbar[`setScroll${position}`](offset)
18
+ }
19
+ }
20
+
21
+ const setScrollTop = (top?: number) => setScrollPosition('Top', top)
22
+ const setScrollLeft = (left?: number) => setScrollPosition('Left', left)
23
+
24
+ return {
25
+ scrollBarRef,
26
+ scrollTo,
27
+ setScrollTop,
28
+ setScrollLeft,
29
+ }
30
+ }
@@ -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>