vxe-table 3.8.8-beta.2 → 3.8.8-beta.4

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 (91) hide show
  1. package/lib/custom/src/mixin.js +19 -1
  2. package/lib/custom/src/mixin.min.js +1 -1
  3. package/lib/custom/src/panel.js +217 -94
  4. package/lib/custom/src/panel.min.js +1 -1
  5. package/lib/custom/style/style.css +86 -21
  6. package/lib/custom/style/style.min.css +1 -1
  7. package/lib/export/src/mixin.js +18 -0
  8. package/lib/export/src/mixin.min.js +1 -1
  9. package/lib/icon/style/{iconfont.1717485750049.ttf → iconfont.1717666909963.ttf} +0 -0
  10. package/lib/icon/style/iconfont.1717666909963.woff +0 -0
  11. package/lib/icon/style/iconfont.1717666909963.woff2 +0 -0
  12. package/lib/icon/style/style.css +124 -4
  13. package/lib/icon/style/style.min.css +124 -4
  14. package/lib/{iconfont.1717485750049.ttf → iconfont.1717666909963.ttf} +0 -0
  15. package/lib/iconfont.1717666909963.woff +0 -0
  16. package/lib/iconfont.1717666909963.woff2 +0 -0
  17. package/lib/index.css +1 -1
  18. package/lib/index.umd.js +280 -107
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/locale/lang/en-US.js +2 -1
  21. package/lib/locale/lang/en-US.min.js +1 -1
  22. package/lib/locale/lang/en-US.umd.js +2 -1
  23. package/lib/locale/lang/es-ES.js +2 -1
  24. package/lib/locale/lang/es-ES.min.js +1 -1
  25. package/lib/locale/lang/es-ES.umd.js +2 -1
  26. package/lib/locale/lang/ja-JP.js +2 -1
  27. package/lib/locale/lang/ja-JP.min.js +1 -1
  28. package/lib/locale/lang/ja-JP.umd.js +2 -1
  29. package/lib/locale/lang/pt-BR.js +2 -1
  30. package/lib/locale/lang/pt-BR.min.js +1 -1
  31. package/lib/locale/lang/pt-BR.umd.js +2 -1
  32. package/lib/locale/lang/zh-CN.js +2 -1
  33. package/lib/locale/lang/zh-CN.min.js +1 -1
  34. package/lib/locale/lang/zh-CN.umd.js +2 -1
  35. package/lib/locale/lang/zh-HK.min.js +1 -1
  36. package/lib/locale/lang/zh-HK.umd.js +2 -1
  37. package/lib/locale/lang/zh-MO.min.js +1 -1
  38. package/lib/locale/lang/zh-MO.umd.js +2 -1
  39. package/lib/locale/lang/zh-TC.js +2 -1
  40. package/lib/locale/lang/zh-TC.min.js +1 -1
  41. package/lib/locale/lang/zh-TC.umd.js +2 -1
  42. package/lib/locale/lang/zh-TW.min.js +1 -1
  43. package/lib/locale/lang/zh-TW.umd.js +2 -1
  44. package/lib/pager/src/pager.js +1 -1
  45. package/lib/pager/src/pager.min.js +1 -1
  46. package/lib/style.css +1 -1
  47. package/lib/style.min.css +1 -1
  48. package/lib/table/src/columnInfo.js +2 -0
  49. package/lib/table/src/columnInfo.min.js +1 -1
  50. package/lib/table/src/methods.js +8 -2
  51. package/lib/table/src/methods.min.js +1 -1
  52. package/lib/table/src/table.js +4 -1
  53. package/lib/table/src/table.min.js +1 -1
  54. package/lib/tools/log.js +1 -1
  55. package/lib/tools/log.min.js +1 -1
  56. package/lib/v-x-e-table/index.js +1 -1
  57. package/lib/v-x-e-table/index.min.js +1 -1
  58. package/lib/v-x-e-table/src/conf.js +7 -5
  59. package/lib/v-x-e-table/src/conf.min.js +1 -1
  60. package/lib/v-x-e-table/style/style.css +124 -4
  61. package/lib/v-x-e-table/style/style.min.css +1 -1
  62. package/lib/vxe-icon/style/style.css +124 -4
  63. package/lib/vxe-icon/style/style.min.css +1 -1
  64. package/lib/vxe-table-custom-module/style/style.css +86 -21
  65. package/lib/vxe-table-custom-module/style/style.min.css +1 -1
  66. package/package.json +1 -1
  67. package/packages/custom/src/mixin.js +17 -1
  68. package/packages/custom/src/panel.js +349 -196
  69. package/packages/export/src/mixin.js +17 -0
  70. package/packages/locale/lang/en-US.js +2 -1
  71. package/packages/locale/lang/es-ES.js +2 -1
  72. package/packages/locale/lang/ja-JP.js +2 -1
  73. package/packages/locale/lang/pt-BR.js +2 -1
  74. package/packages/locale/lang/zh-CN.js +2 -1
  75. package/packages/locale/lang/zh-TC.js +2 -1
  76. package/packages/pager/src/pager.js +1 -1
  77. package/packages/table/src/columnInfo.js +3 -0
  78. package/packages/table/src/methods.js +5 -2
  79. package/packages/table/src/table.js +4 -1
  80. package/packages/v-x-e-table/src/conf.js +9 -7
  81. package/styles/custom.scss +86 -8
  82. package/styles/icon/iconfont.ttf +0 -0
  83. package/styles/icon/iconfont.woff +0 -0
  84. package/styles/icon/iconfont.woff2 +0 -0
  85. package/styles/icon.scss +124 -4
  86. package/styles/old-icon.scss +2 -2
  87. package/styles/variable.scss +1 -0
  88. package/lib/icon/style/iconfont.1717485750049.woff +0 -0
  89. package/lib/icon/style/iconfont.1717485750049.woff2 +0 -0
  90. package/lib/iconfont.1717485750049.woff +0 -0
  91. package/lib/iconfont.1717485750049.woff2 +0 -0
@@ -23,11 +23,11 @@ function updateDropHint (_vm, evnt) {
23
23
  }
24
24
  }
25
25
 
26
- function renderSimplePanel (h, _vm) {
27
- const { $xetable, customStore } = _vm
28
- const { customOpts, customColumnList, isMaxFixedColumn } = $xetable
26
+ const renderSimplePanel = (h, _vm) => {
27
+ const { _e, $xetable, customStore } = _vm
28
+ const { customColumnList, customOpts, isMaxFixedColumn } = $xetable
29
29
  const { maxHeight } = customStore
30
- const { checkMethod, visibleMethod, trigger } = customOpts
30
+ const { checkMethod, visibleMethod, allowSort, allowFixed, trigger } = customOpts
31
31
  const colVNs = []
32
32
  const customWrapperOns = {}
33
33
  // hover 触发
@@ -38,7 +38,7 @@ function renderSimplePanel (h, _vm) {
38
38
  XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
39
39
  const isVisible = visibleMethod ? visibleMethod({ column }) : true
40
40
  if (isVisible) {
41
- const isChecked = column.visible
41
+ const isChecked = column.renderVisible
42
42
  const isIndeterminate = column.halfVisible
43
43
  const isColGroup = column.children && column.children.length
44
44
  const colTitle = formatText(column.getTitle(), 1)
@@ -46,65 +46,100 @@ function renderSimplePanel (h, _vm) {
46
46
  colVNs.push(
47
47
  h('li', {
48
48
  key: column.id,
49
+ attrs: {
50
+ colid: column.id
51
+ },
49
52
  class: ['vxe-table-custom--option', `level--${column.level}`, {
50
53
  'is--group': isColGroup
51
- }]
54
+ }],
55
+ on: {
56
+ dragstart: _vm.sortDragstartEvent,
57
+ dragend: _vm.sortDragendEvent,
58
+ dragover: _vm.sortDragoverEvent
59
+ }
52
60
  }, [
53
61
  h('div', {
54
- title: colTitle,
55
62
  class: ['vxe-table-custom--checkbox-option', {
56
63
  'is--checked': isChecked,
57
64
  'is--indeterminate': isIndeterminate,
58
65
  'is--disabled': isDisabled
59
66
  }],
67
+ attrs: {
68
+ title: GlobalConfig.i18n('vxe.custom.setting.colVisible')
69
+ },
60
70
  on: {
61
71
  click: () => {
62
72
  if (!isDisabled) {
63
73
  _vm.changeCheckboxOption(column)
64
74
  }
65
75
  }
66
-
67
76
  }
68
77
  }, [
69
78
  h('span', {
70
79
  class: ['vxe-checkbox--icon', isIndeterminate ? GlobalConfig.icon.TABLE_CHECKBOX_INDETERMINATE : (isChecked ? GlobalConfig.icon.TABLE_CHECKBOX_CHECKED : GlobalConfig.icon.TABLE_CHECKBOX_UNCHECKED)]
71
- }),
72
- h('span', {
73
- class: 'vxe-checkbox--label'
74
- }, colTitle)
80
+ })
75
81
  ]),
76
- !parent && customOpts.allowFixed ? h('div', {
77
- class: 'vxe-table-custom--fixed-option'
78
- }, [
79
- h('span', {
80
- class: ['vxe-table-custom--fixed-left-option', column.fixed === 'left' ? GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_LEFT_ACTIVED : GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_LEFT, {
81
- 'is--checked': column.fixed === 'left',
82
- 'is--disabled': isMaxFixedColumn && !column.fixed
83
- }],
84
- attrs: {
85
- title: GlobalConfig.i18n(column.fixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
86
- },
87
- on: {
88
- click: () => {
89
- _vm.changeFixedOption(column, 'left')
82
+ allowSort && column.level === 1
83
+ ? h('div', {
84
+ class: 'vxe-table-custom--sort-option'
85
+ }, [
86
+ h('span', {
87
+ class: 'vxe-table-custom--sort-btn',
88
+ attrs: {
89
+ title: GlobalConfig.i18n('vxe.custom.setting.sortHelpTip')
90
+ },
91
+ on: {
92
+ mousedown: _vm.sortMousedownEvent,
93
+ mouseup: _vm.sortMouseupEvent
90
94
  }
91
- }
92
- }),
93
- h('span', {
94
- class: ['vxe-table-custom--fixed-right-option', column.fixed === 'right' ? GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVED : GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_RIGHT, {
95
- 'is--checked': column.fixed === 'right',
96
- 'is--disabled': isMaxFixedColumn && !column.fixed
97
- }],
98
- attrs: {
99
- title: GlobalConfig.i18n(column.fixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
100
- },
101
- on: {
102
- click: () => {
103
- _vm.changeFixedOption(column, 'right')
95
+ }, [
96
+ h('i', {
97
+ class: GlobalConfig.icon.TABLE_CUSTOM_SORT
98
+ })
99
+ ])
100
+ ])
101
+ : _e(),
102
+ h('div', {
103
+ class: 'vxe-table-custom--checkbox-label',
104
+ attrs: {
105
+ title: colTitle
106
+ }
107
+ }, colTitle),
108
+ !parent && allowFixed
109
+ ? h('div', {
110
+ class: 'vxe-table-custom--fixed-option'
111
+ }, [
112
+ h('span', {
113
+ class: ['vxe-table-custom--fixed-left-option', column.renderFixed === 'left' ? GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_LEFT, {
114
+ 'is--checked': column.renderFixed === 'left',
115
+ 'is--disabled': isMaxFixedColumn && !column.renderFixed
116
+ }],
117
+ attrs: {
118
+ title: GlobalConfig.i18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
119
+ },
120
+ on: {
121
+ click: () => {
122
+ _vm.changeFixedOption(column, 'left')
123
+ }
104
124
  }
105
- }
106
- })
107
- ]) : null
125
+ }),
126
+ h('span', {
127
+ class: ['vxe-table-custom--fixed-right-option', column.renderFixed === 'right' ? GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : GlobalConfig.icon.TOOLBAR_TOOLS_FIXED_RIGHT, {
128
+ 'is--checked': column.renderFixed === 'right',
129
+ 'is--disabled': isMaxFixedColumn && !column.renderFixed
130
+ }],
131
+ attrs: {
132
+ title: GlobalConfig.i18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
133
+ },
134
+ on: {
135
+
136
+ click: () => {
137
+ _vm.changeFixedOption(column, 'right')
138
+ }
139
+ }
140
+ })
141
+ ])
142
+ : _e()
108
143
  ])
109
144
  )
110
145
  }
@@ -116,69 +151,96 @@ function renderSimplePanel (h, _vm) {
116
151
  class: ['vxe-table-custom-wrapper', {
117
152
  'is--active': customStore.visible
118
153
  }]
119
- }, [
120
- h('ul', {
121
- class: 'vxe-table-custom--header'
122
- }, [
123
- h('li', {
124
- class: 'vxe-table-custom--option'
125
- }, [
154
+ }, customStore.visible
155
+ ? [
156
+ h('ul', {
157
+ class: 'vxe-table-custom--header'
158
+ }, [
159
+ h('li', {
160
+ class: 'vxe-table-custom--option'
161
+ }, [
162
+ h('div', {
163
+ class: ['vxe-table-custom--checkbox-option', {
164
+ 'is--checked': isAllChecked,
165
+ 'is--indeterminate': isAllIndeterminate
166
+ }],
167
+ attrs: {
168
+ title: GlobalConfig.i18n('vxe.table.allTitle')
169
+ },
170
+ on: {
171
+ click: _vm.allCustomEvent
172
+ }
173
+ }, [
174
+ h('span', {
175
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? GlobalConfig.icon.TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? GlobalConfig.icon.TABLE_CHECKBOX_CHECKED : GlobalConfig.icon.TABLE_CHECKBOX_UNCHECKED)]
176
+ }),
177
+ h('span', {
178
+ class: 'vxe-checkbox--label'
179
+ }, GlobalConfig.i18n('vxe.toolbar.customAll'))
180
+ ])
181
+ ])
182
+ ]),
126
183
  h('div', {
127
- class: ['vxe-table-custom--checkbox-option', {
128
- 'is--checked': isAllChecked,
129
- 'is--indeterminate': isAllIndeterminate
130
- }],
131
- attrs: {
132
- title: GlobalConfig.i18n('vxe.table.allTitle')
133
- },
134
- on: {
135
- click: _vm.allCustomEvent
136
- }
184
+ ref: 'bodyElemRef',
185
+ class: 'vxe-table-custom--list-wrapper'
137
186
  }, [
138
- h('span', {
139
- class: ['vxe-checkbox--icon', isAllIndeterminate ? GlobalConfig.icon.TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? GlobalConfig.icon.TABLE_CHECKBOX_CHECKED : GlobalConfig.icon.TABLE_CHECKBOX_UNCHECKED)]
140
- }),
141
- h('span', {
142
- class: 'vxe-checkbox--label'
143
- }, GlobalConfig.i18n('vxe.toolbar.customAll'))
144
- ])
145
- ])
146
- ]),
147
- h('ul', {
148
- class: 'vxe-table-custom--body',
149
- style: maxHeight ? {
150
- maxHeight: `${maxHeight}px`
151
- } : {},
152
- on: customWrapperOns
153
- }, colVNs),
154
- customOpts.showFooter ? h('div', {
155
- class: 'vxe-table-custom--footer'
156
- }, [
157
- h('button', {
158
- class: 'btn--reset',
159
- on: {
160
- click: _vm.resetCustomEvent
161
- }
162
- }, customOpts.resetButtonText || GlobalConfig.i18n('vxe.toolbar.customRestore')),
163
- h('button', {
164
- class: 'btn--confirm',
165
- on: {
166
- click: _vm.confirmCustomEvent
167
- }
168
- }, customOpts.confirmButtonText || GlobalConfig.i18n('vxe.toolbar.customConfirm'))
169
- ]) : null
170
- ])
187
+ h('transition-group', {
188
+ class: 'vxe-table-custom--body',
189
+ props: {
190
+ name: 'vxe-table-custom--list',
191
+ tag: 'ul'
192
+ },
193
+ style: maxHeight
194
+ ? {
195
+ maxHeight: `${maxHeight}px`
196
+ }
197
+ : {},
198
+ on: customWrapperOns
199
+ }, colVNs),
200
+ h('div', {
201
+ ref: 'dragHintElemRef',
202
+ class: 'vxe-table-custom-popup--drag-hint'
203
+ }, GlobalConfig.i18n('vxe.custom.cstmDragTarget', [_vm.dragColumn ? _vm.dragColumn.getTitle() : '']))
204
+ ]),
205
+ customOpts.showFooter
206
+ ? h('div', {
207
+ class: 'vxe-table-custom--footer'
208
+ }, [
209
+ h('button', {
210
+ class: 'btn--reset',
211
+ on: {
212
+ click: _vm.resetCustomEvent
213
+ }
214
+ }, customOpts.resetButtonText || GlobalConfig.i18n('vxe.table.customRestore')),
215
+ customOpts.immediate
216
+ ? _e()
217
+ : h('button', {
218
+ class: 'btn--cancel',
219
+ on: {
220
+ click: _vm.cancelCustomEvent
221
+ }
222
+ }, customOpts.resetButtonText || GlobalConfig.i18n('vxe.table.customCancel')),
223
+ h('button', {
224
+ class: 'btn--confirm',
225
+ on: {
226
+ click: _vm.confirmCustomEvent
227
+ }
228
+ }, customOpts.confirmButtonText || GlobalConfig.i18n('vxe.table.customConfirm'))
229
+ ])
230
+ : null
231
+ ]
232
+ : [])
171
233
  }
172
234
 
173
- function renderPopupPanel (h, _vm) {
174
- const { $xetable, customStore } = _vm
235
+ const renderPopupPanel = (h, _vm) => {
236
+ const { _e, $xetable, customStore } = _vm
175
237
  const { customOpts, customColumnList, columnOpts, isMaxFixedColumn } = $xetable
176
- const { checkMethod, visibleMethod } = customOpts
238
+ const { allowSort, allowFixed, checkMethod, visibleMethod } = customOpts
177
239
  const trVNs = []
178
240
  XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
179
241
  const isVisible = visibleMethod ? visibleMethod({ column }) : true
180
242
  if (isVisible) {
181
- const isChecked = column.visible
243
+ const isChecked = column.renderVisible
182
244
  const isIndeterminate = column.halfVisible
183
245
  const colTitle = formatText(column.getTitle(), 1)
184
246
  const isColGroup = column.children && column.children.length
@@ -186,43 +248,18 @@ function renderPopupPanel (h, _vm) {
186
248
  trVNs.push(
187
249
  h('tr', {
188
250
  key: column.id,
189
- class: [`vxe-table-custom-popup--row level--${column.level}`, {
190
- 'is--group': isColGroup
191
- }],
192
251
  attrs: {
193
252
  colid: column.id
194
253
  },
254
+ class: [`vxe-table-custom-popup--row level--${column.level}`, {
255
+ 'is--group': isColGroup
256
+ }],
195
257
  on: {
196
258
  dragstart: _vm.sortDragstartEvent,
197
259
  dragend: _vm.sortDragendEvent,
198
260
  dragover: _vm.sortDragoverEvent
199
261
  }
200
262
  }, [
201
- h('td', {
202
- class: 'vxe-table-custom-popup--column-item col--sort'
203
- }, [
204
- column.level === 1 ? h('span', {
205
- class: 'vxe-table-custom-popup--column-sort-btn',
206
- on: {
207
- mousedown: _vm.sortMousedownEvent,
208
- mouseup: _vm.sortMouseupEvent
209
- }
210
- }, [
211
- h('i', {
212
- class: 'vxe-icon-sort'
213
- })
214
- ]) : null
215
- ]),
216
- h('td', {
217
- class: 'vxe-table-custom-popup--column-item col--name'
218
- }, [
219
- h('div', {
220
- class: 'vxe-table-custom-popup--name',
221
- attrs: {
222
- title: colTitle
223
- }
224
- }, colTitle)
225
- ]),
226
263
  h('td', {
227
264
  class: 'vxe-table-custom-popup--column-item col--visible'
228
265
  }, [
@@ -232,6 +269,9 @@ function renderPopupPanel (h, _vm) {
232
269
  'is--indeterminate': isIndeterminate,
233
270
  'is--disabled': isDisabled
234
271
  }],
272
+ attrs: {
273
+ title: GlobalConfig.i18n('vxe.custom.setting.colVisible')
274
+ },
235
275
  on: {
236
276
  click: () => {
237
277
  if (!isDisabled) {
@@ -245,40 +285,78 @@ function renderPopupPanel (h, _vm) {
245
285
  })
246
286
  ])
247
287
  ]),
288
+ allowSort
289
+ ? h('td', {
290
+ class: 'vxe-table-custom-popup--column-item col--sort'
291
+ }, [
292
+ column.level === 1
293
+ ? h('span', {
294
+ class: 'vxe-table-custom-popup--column-sort-btn',
295
+ attrs: {
296
+ title: GlobalConfig.i18n('vxe.custom.setting.sortHelpTip')
297
+ },
298
+ on: {
299
+ mousedown: _vm.sortMousedownEvent,
300
+ mouseup: _vm.sortMouseupEvent
301
+ }
302
+ }, [
303
+ h('i', {
304
+ class: GlobalConfig.icon.TABLE_CUSTOM_SORT
305
+ })
306
+ ])
307
+ : null
308
+ ])
309
+ : _e(),
248
310
  h('td', {
249
- class: 'vxe-table-custom-popup--column-item col--fixed'
311
+ class: 'vxe-table-custom-popup--column-item col--name'
250
312
  }, [
251
- !parent && customOpts.allowFixed ? h('vxe-radio-group', {
252
- props: {
253
- value: column.fixed || '',
254
- type: 'button',
255
- size: 'mini',
256
- options: [
257
- { label: GlobalConfig.i18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isMaxFixedColumn },
258
- { label: GlobalConfig.i18n('vxe.custom.setting.fixedUnset'), value: '' },
259
- { label: GlobalConfig.i18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isMaxFixedColumn }
260
- ]
261
- },
262
- on: {
263
- input (value) {
264
- column.fixed = value
265
- },
266
- change () {
267
- _vm.changePopupFixedOption(column)
268
- }
313
+ h('div', {
314
+ class: 'vxe-table-custom-popup--name',
315
+ attrs: {
316
+ title: colTitle
269
317
  }
270
- }) : null
271
- ])
318
+ }, colTitle)
319
+ ]),
320
+ allowFixed
321
+ ? h('td', {
322
+ class: 'vxe-table-custom-popup--column-item col--fixed'
323
+ }, [
324
+ !parent
325
+ ? h('vxe-radio-group', {
326
+ props: {
327
+ value: column.renderFixed || '',
328
+ type: 'button',
329
+ size: 'mini',
330
+ options: [
331
+ { label: GlobalConfig.i18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isMaxFixedColumn },
332
+ { label: GlobalConfig.i18n('vxe.custom.setting.fixedUnset'), value: '' },
333
+ { label: GlobalConfig.i18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isMaxFixedColumn }
334
+ ]
335
+ },
336
+ on: {
337
+ input (value) {
338
+ column.renderFixed = value
339
+ }
340
+ // onChange () {
341
+ // changePopupFixedOption(column)
342
+ // }
343
+ }
344
+ })
345
+ : null
346
+ ])
347
+ : _e()
272
348
  ])
273
349
  )
274
350
  }
275
351
  })
352
+ const isAllChecked = customStore.isAll
353
+ const isAllIndeterminate = customStore.isIndeterminate
276
354
  return h('vxe-modal', {
277
355
  key: 'popup',
278
356
  props: {
357
+ className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
279
358
  value: customStore.visible,
280
359
  title: GlobalConfig.i18n('vxe.custom.cstmTitle'),
281
- className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
282
360
  width: '40vw',
283
361
  minWidth: 520,
284
362
  height: '50vh',
@@ -311,41 +389,74 @@ function renderPopupPanel (h, _vm) {
311
389
  width: '80px'
312
390
  }
313
391
  }),
314
- h('col'),
392
+ allowSort
393
+ ? h('col', {
394
+ style: {
395
+ width: '80px'
396
+ }
397
+ })
398
+ : _e(),
315
399
  h('col', {
316
400
  style: {
317
- width: '80px'
401
+ minWidth: '120px'
318
402
  }
319
403
  }),
320
- h('col', {
321
- style: {
322
- width: '200px'
323
- }
324
- })
404
+ allowFixed
405
+ ? h('col', {
406
+ style: {
407
+ width: '200px'
408
+ }
409
+ })
410
+ : _e()
325
411
  ]),
326
412
  h('thead', {}, [
327
413
  h('tr', {}, [
328
414
  h('th', {}, [
329
- h('span', {
330
- class: 'vxe-table-custom-popup--table-sort-help-title'
331
- }, GlobalConfig.i18n('vxe.custom.setting.colSort')),
332
- h('vxe-tooltip', {
333
- props: {
334
- enterable: true,
335
- content: '点击并拖动图标可以调整列的排序'
415
+ h('div', {
416
+ class: ['vxe-table-custom--checkbox-option', {
417
+ 'is--checked': isAllChecked,
418
+ 'is--indeterminate': isAllIndeterminate
419
+ }],
420
+ attrs: {
421
+ title: GlobalConfig.i18n('vxe.table.allTitle')
336
422
  },
337
- scopedSlots: {
338
- default: () => {
339
- return h('i', {
340
- class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
341
- })
342
- }
423
+ on: {
424
+ click: _vm.allCustomEvent
343
425
  }
344
- })
426
+
427
+ }, [
428
+ h('span', {
429
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? GlobalConfig.icon.TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? GlobalConfig.icon.TABLE_CHECKBOX_CHECKED : GlobalConfig.icon.TABLE_CHECKBOX_UNCHECKED)]
430
+ }),
431
+ h('span', {
432
+ class: 'vxe-checkbox--label'
433
+ }, GlobalConfig.i18n('vxe.toolbar.customAll'))
434
+ ])
345
435
  ]),
436
+ allowSort
437
+ ? h('th', {}, [
438
+ h('span', {
439
+ class: 'vxe-table-custom-popup--table-sort-help-title'
440
+ }, GlobalConfig.i18n('vxe.custom.setting.colSort')),
441
+ h('vxe-tooltip', {
442
+ props: {
443
+ enterable: true,
444
+ content: GlobalConfig.i18n('vxe.custom.setting.sortHelpTip')
445
+ },
446
+ scopedSlots: {
447
+ default: () => {
448
+ return h('i', {
449
+ class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
450
+ })
451
+ }
452
+ }
453
+ })
454
+ ])
455
+ : _e(),
346
456
  h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colTitle')),
347
- h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colVisible')),
348
- h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))
457
+ allowFixed
458
+ ? h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))
459
+ : _e()
349
460
  ])
350
461
  ]),
351
462
  h('transition-group', {
@@ -372,7 +483,7 @@ function renderPopupPanel (h, _vm) {
372
483
  content: customOpts.resetButtonText || GlobalConfig.i18n('vxe.custom.cstmRestore')
373
484
  },
374
485
  on: {
375
- click: _vm.resetPopupCustomEvent
486
+ click: _vm.resetCustomEvent
376
487
  }
377
488
  }),
378
489
  h('vxe-button', {
@@ -441,21 +552,72 @@ export default {
441
552
  }
442
553
  }, 300)
443
554
  },
555
+ getStoreData () {
556
+ return {}
557
+ },
558
+ handleSaveStore (type) {
559
+ const { $xetable } = this
560
+ const { id, customOpts } = $xetable
561
+ const { storage, updateStore } = customOpts
562
+ if (storage && id && updateStore) {
563
+ updateStore({
564
+ id,
565
+ type,
566
+ storeData: this.getStoreData()
567
+ })
568
+ }
569
+ },
444
570
  confirmCustomEvent (evnt) {
445
571
  const { $xetable } = this
572
+ const { customColumnList } = $xetable
573
+ customColumnList.forEach((column, index) => {
574
+ const sortIndex = index + 1
575
+ column.renderSortNumber = sortIndex
576
+ column.fixed = column.renderFixed
577
+ column.visible = column.renderVisible
578
+ })
446
579
  $xetable.closeCustom()
447
580
  $xetable.emitCustomEvent('confirm', evnt)
581
+ this.handleSaveStore('confirm')
448
582
  },
449
583
  cancelCustomEvent (evnt) {
450
584
  const { $xetable } = this
585
+ const { customStore, customColumnList } = $xetable
586
+ const { oldSortMaps, oldFixedMaps, oldVisibleMaps } = customStore
587
+ XEUtils.eachTree(customColumnList, column => {
588
+ const colid = column.getKey()
589
+ const visible = !!oldVisibleMaps[colid]
590
+ const fixed = oldFixedMaps[colid] || ''
591
+ column.renderVisible = visible
592
+ column.visible = visible
593
+ column.renderFixed = fixed
594
+ column.fixed = fixed
595
+ column.renderSortNumber = oldSortMaps[colid] || 0
596
+ }, { children: 'children' })
451
597
  $xetable.closeCustom()
452
598
  $xetable.emitCustomEvent('cancel', evnt)
453
599
  },
454
- resetCustomEvent (evnt) {
600
+ handleResetCustomEvent (evnt) {
455
601
  const { $xetable } = this
456
602
  $xetable.resetColumn(true)
457
603
  $xetable.closeCustom()
458
604
  $xetable.emitCustomEvent('reset', evnt)
605
+ this.handleSaveStore('confirm')
606
+ },
607
+ resetCustomEvent (evnt) {
608
+ if (VXETable.modal) {
609
+ VXETable.modal.confirm({
610
+ content: GlobalConfig.i18n('vxe.custom.cstmConfirmRestore'),
611
+ className: 'vxe-table--ignore-clear',
612
+ escClosable: true
613
+ }).then(type => {
614
+ if (type === 'confirm') {
615
+ this.handleResetCustomEvent(evnt)
616
+ }
617
+ })
618
+ } else {
619
+ this.handleResetCustomEvent(evnt)
620
+ }
459
621
  },
460
622
  resetPopupCustomEvent (evnt) {
461
623
  if (VXETable.modal) {
@@ -488,9 +650,9 @@ export default {
488
650
  changeCheckboxOption (column) {
489
651
  const { $xetable } = this
490
652
  const { customOpts } = $xetable
491
- const isChecked = !column.visible
653
+ const isChecked = !column.renderVisible
492
654
  XEUtils.eachTree([column], (item) => {
493
- item.visible = isChecked
655
+ item.renderVisible = isChecked
494
656
  item.halfVisible = false
495
657
  })
496
658
  this.handleOptionCheck(column)
@@ -502,21 +664,23 @@ export default {
502
664
  changeFixedOption (column, colFixed) {
503
665
  const { $xetable } = this
504
666
  const { isMaxFixedColumn } = $xetable
505
- if (column.fixed === colFixed) {
506
- $xetable.clearColumnFixed(column)
667
+ if (column.renderFixed === colFixed) {
668
+ column.renderFixed = ''
669
+ // $xeTable.clearColumnFixed(column)
507
670
  } else {
508
- if (!isMaxFixedColumn || column.fixed) {
509
- $xetable.setColumnFixed(column, colFixed)
671
+ if (!isMaxFixedColumn || column.renderFixed) {
672
+ column.renderFixed = colFixed
673
+ // $xeTable.setColumnFixed(column, colFixed)
510
674
  }
511
675
  }
512
676
  },
513
- changePopupFixedOption (column) {
514
- const { $xetable } = this
515
- const { isMaxFixedColumn } = $xetable
516
- if (!isMaxFixedColumn) {
517
- $xetable.setColumnFixed(column, column.fixed)
518
- }
519
- },
677
+ // changePopupFixedOption (column) {
678
+ // const { $xetable } = this
679
+ // const { isMaxFixedColumn } = $xetable
680
+ // if (!isMaxFixedColumn) {
681
+ // $xetable.setColumnFixed(column, column.fixed)
682
+ // }
683
+ // },
520
684
  allCustomEvent () {
521
685
  const { $xetable, customStore } = this
522
686
  const { customOpts, customColumnList } = $xetable
@@ -524,7 +688,7 @@ export default {
524
688
  const isAll = !customStore.isAll
525
689
  XEUtils.eachTree(customColumnList, (column) => {
526
690
  if (!checkMethod || checkMethod({ column })) {
527
- column.visible = isAll
691
+ column.renderVisible = isAll
528
692
  column.halfVisible = false
529
693
  }
530
694
  })
@@ -598,8 +762,6 @@ export default {
598
762
  }
599
763
  removeClass(trEl, 'active--drag-target')
600
764
  removeClass(trEl, 'active--drag-origin')
601
- // 更新顺序
602
- this.updateColumnSort()
603
765
  },
604
766
  sortDragoverEvent (evnt) {
605
767
  const { $xetable, prevDropTrEl } = this
@@ -619,15 +781,6 @@ export default {
619
781
  this.prevDropTrEl = trEl
620
782
  }
621
783
  updateDropHint(this, evnt)
622
- },
623
- updateColumnSort () {
624
- const { $xetable } = this
625
- const { customColumnList } = $xetable
626
- // 更新顺序
627
- customColumnList.forEach((column, index) => {
628
- const sortIndex = index + 1
629
- column.renderSortNumber = sortIndex
630
- })
631
784
  }
632
785
  }
633
786
  }