vxe-table 4.7.4 → 4.7.5

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 (40) hide show
  1. package/es/style.css +1 -1
  2. package/es/style.min.css +1 -1
  3. package/es/table/module/custom/hook.js +18 -2
  4. package/es/table/module/custom/panel.js +263 -159
  5. package/es/table/src/columnInfo.js +2 -0
  6. package/es/table/src/table.js +8 -2
  7. package/es/table/style.css +69 -9
  8. package/es/table/style.min.css +1 -1
  9. package/es/toolbar/src/toolbar.js +1 -1
  10. package/es/ui/index.js +4 -2
  11. package/es/vxe-table/style.css +69 -9
  12. package/es/vxe-table/style.min.css +1 -1
  13. package/lib/index.umd.js +214 -87
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/style.min.css +1 -1
  17. package/lib/table/module/custom/hook.js +23 -2
  18. package/lib/table/module/custom/hook.min.js +1 -1
  19. package/lib/table/module/custom/panel.js +174 -80
  20. package/lib/table/module/custom/panel.min.js +1 -1
  21. package/lib/table/src/columnInfo.js +2 -0
  22. package/lib/table/src/columnInfo.min.js +1 -1
  23. package/lib/table/src/table.js +11 -2
  24. package/lib/table/src/table.min.js +1 -1
  25. package/lib/table/style/style.css +69 -9
  26. package/lib/table/style/style.min.css +1 -1
  27. package/lib/toolbar/src/toolbar.js +1 -1
  28. package/lib/toolbar/src/toolbar.min.js +1 -1
  29. package/lib/ui/index.js +4 -2
  30. package/lib/ui/index.min.js +1 -1
  31. package/lib/vxe-table/style/style.css +69 -9
  32. package/lib/vxe-table/style/style.min.css +1 -1
  33. package/package.json +2 -2
  34. package/packages/table/module/custom/hook.ts +19 -3
  35. package/packages/table/module/custom/panel.ts +272 -165
  36. package/packages/table/src/columnInfo.ts +4 -0
  37. package/packages/table/src/table.ts +8 -2
  38. package/packages/toolbar/src/toolbar.ts +1 -1
  39. package/packages/ui/index.ts +2 -0
  40. package/styles/components/table-module/custom.scss +78 -4
@@ -25,6 +25,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
25
25
  setup(props) {
26
26
  const $xeTable = (0, _vue.inject)('$xeTable', {});
27
27
  const {
28
+ props: tableProps,
28
29
  reactData
29
30
  } = $xeTable;
30
31
  const {
@@ -51,25 +52,78 @@ var _default = exports.default = (0, _vue.defineComponent)({
51
52
  customStore.activeWrapper = false;
52
53
  setTimeout(() => {
53
54
  if (!customStore.activeBtn && !customStore.activeWrapper) {
54
- $xeTable.customColseEvent(evnt);
55
+ $xeTable.customCloseEvent(evnt);
55
56
  }
56
57
  }, 300);
57
58
  };
59
+ const getStoreData = () => {
60
+ return {};
61
+ };
62
+ const handleSaveStore = type => {
63
+ const {
64
+ id
65
+ } = tableProps;
66
+ const customOpts = computeCustomOpts.value;
67
+ const {
68
+ storage,
69
+ updateStore
70
+ } = customOpts;
71
+ if (storage && id && updateStore) {
72
+ updateStore({
73
+ id,
74
+ type,
75
+ storeData: getStoreData()
76
+ });
77
+ }
78
+ };
58
79
  const confirmCustomEvent = evnt => {
59
- updateColumnSort();
80
+ const {
81
+ customColumnList
82
+ } = reactData;
83
+ customColumnList.forEach((column, index) => {
84
+ const sortIndex = index + 1;
85
+ column.renderSortNumber = sortIndex;
86
+ column.fixed = column.renderFixed;
87
+ column.visible = column.renderVisible;
88
+ });
60
89
  $xeTable.closeCustom();
61
90
  $xeTable.emitCustomEvent('confirm', evnt);
91
+ handleSaveStore('confirm');
62
92
  };
63
93
  const cancelCustomEvent = evnt => {
94
+ const {
95
+ customStore
96
+ } = props;
97
+ const {
98
+ customColumnList
99
+ } = reactData;
100
+ const {
101
+ oldSortMaps,
102
+ oldFixedMaps,
103
+ oldVisibleMaps
104
+ } = customStore;
105
+ _xeUtils.default.eachTree(customColumnList, column => {
106
+ const colid = column.getKey();
107
+ const visible = !!oldVisibleMaps[colid];
108
+ const fixed = oldFixedMaps[colid] || '';
109
+ column.renderVisible = visible;
110
+ column.visible = visible;
111
+ column.renderFixed = fixed;
112
+ column.fixed = fixed;
113
+ column.renderSortNumber = oldSortMaps[colid] || 0;
114
+ }, {
115
+ children: 'children'
116
+ });
64
117
  $xeTable.closeCustom();
65
118
  $xeTable.emitCustomEvent('cancel', evnt);
66
119
  };
67
- const resetCustomEvent = evnt => {
120
+ const handleResetCustomEvent = evnt => {
68
121
  $xeTable.resetColumn(true);
69
122
  $xeTable.closeCustom();
70
123
  $xeTable.emitCustomEvent('reset', evnt);
124
+ handleSaveStore('confirm');
71
125
  };
72
- const resetPopupCustomEvent = evnt => {
126
+ const resetCustomEvent = evnt => {
73
127
  if (_ui.VxeUI.modal) {
74
128
  _ui.VxeUI.modal.confirm({
75
129
  content: getI18n('vxe.custom.cstmConfirmRestore'),
@@ -77,11 +131,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
77
131
  escClosable: true
78
132
  }).then(type => {
79
133
  if (type === 'confirm') {
80
- resetCustomEvent(evnt);
134
+ handleResetCustomEvent(evnt);
81
135
  }
82
136
  });
83
137
  } else {
84
- resetCustomEvent(evnt);
138
+ handleResetCustomEvent(evnt);
85
139
  }
86
140
  };
87
141
  const handleOptionCheck = column => {
@@ -94,17 +148,17 @@ var _default = exports.default = (0, _vue.defineComponent)({
94
148
  parent
95
149
  } = matchObj;
96
150
  if (parent.children && parent.children.length) {
97
- parent.visible = parent.children.every(column => column.visible);
98
- parent.halfVisible = !parent.visible && parent.children.some(column => column.visible || column.halfVisible);
151
+ parent.renderVisible = parent.children.every(column => column.renderVisible);
152
+ parent.halfVisible = !parent.renderVisible && parent.children.some(column => column.renderVisible || column.halfVisible);
99
153
  handleOptionCheck(parent);
100
154
  }
101
155
  }
102
156
  };
103
157
  const changeCheckboxOption = column => {
104
- const isChecked = !column.visible;
158
+ const isChecked = !column.renderVisible;
105
159
  const customOpts = computeCustomOpts.value;
106
160
  _xeUtils.default.eachTree([column], item => {
107
- item.visible = isChecked;
161
+ item.renderVisible = isChecked;
108
162
  item.halfVisible = false;
109
163
  });
110
164
  handleOptionCheck(column);
@@ -115,20 +169,22 @@ var _default = exports.default = (0, _vue.defineComponent)({
115
169
  };
116
170
  const changeFixedOption = (column, colFixed) => {
117
171
  const isMaxFixedColumn = computeIsMaxFixedColumn.value;
118
- if (column.fixed === colFixed) {
119
- $xeTable.clearColumnFixed(column);
172
+ if (column.renderFixed === colFixed) {
173
+ column.renderFixed = '';
174
+ // $xeTable.clearColumnFixed(column)
120
175
  } else {
121
- if (!isMaxFixedColumn || column.fixed) {
122
- $xeTable.setColumnFixed(column, colFixed);
176
+ if (!isMaxFixedColumn || column.renderFixed) {
177
+ column.renderFixed = colFixed;
178
+ // $xeTable.setColumnFixed(column, colFixed)
123
179
  }
124
180
  }
125
181
  };
126
- const changePopupFixedOption = column => {
127
- const isMaxFixedColumn = computeIsMaxFixedColumn.value;
128
- if (!isMaxFixedColumn) {
129
- $xeTable.setColumnFixed(column, column.fixed);
130
- }
131
- };
182
+ // const changePopupFixedOption = () => {
183
+ // const isMaxFixedColumn = computeIsMaxFixedColumn.value
184
+ // if (!isMaxFixedColumn) {
185
+ // // $xeTable.setColumnFixed(column, column.fixed)
186
+ // }
187
+ // }
132
188
  const allCustomEvent = () => {
133
189
  const {
134
190
  customStore
@@ -145,7 +201,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
145
201
  if (!checkMethod || checkMethod({
146
202
  column
147
203
  })) {
148
- column.visible = isAll;
204
+ column.renderVisible = isAll;
149
205
  column.halfVisible = false;
150
206
  }
151
207
  });
@@ -180,16 +236,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
180
236
  evnt.dataTransfer.setDragImage(img, 0, 0);
181
237
  }
182
238
  };
183
- const updateColumnSort = () => {
184
- const {
185
- customColumnList
186
- } = reactData;
187
- // 更新顺序
188
- customColumnList.forEach((column, index) => {
189
- const sortIndex = index + 1;
190
- column.renderSortNumber = sortIndex;
191
- });
192
- };
193
239
  const sortDragendEvent = evnt => {
194
240
  const {
195
241
  customColumnList
@@ -229,8 +275,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
229
275
  }
230
276
  (0, _dom.removeClass)(trEl, 'active--drag-target');
231
277
  (0, _dom.removeClass)(trEl, 'active--drag-origin');
232
- // 更新顺序
233
- updateColumnSort();
234
278
  };
235
279
  const sortDragoverEvent = evnt => {
236
280
  const trEl = evnt.currentTarget;
@@ -278,6 +322,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
278
322
  const {
279
323
  checkMethod,
280
324
  visibleMethod,
325
+ allowSort,
326
+ allowFixed,
281
327
  trigger
282
328
  } = customOpts;
283
329
  const isMaxFixedColumn = computeIsMaxFixedColumn.value;
@@ -293,7 +339,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
293
339
  column
294
340
  }) : true;
295
341
  if (isVisible) {
296
- const isChecked = column.visible;
342
+ const isChecked = column.renderVisible;
297
343
  const isIndeterminate = column.halfVisible;
298
344
  const isColGroup = column.children && column.children.length;
299
345
  const colTitle = (0, _utils.formatText)(column.getTitle(), 1);
@@ -302,16 +348,20 @@ var _default = exports.default = (0, _vue.defineComponent)({
302
348
  }) : false;
303
349
  colVNs.push((0, _vue.h)('li', {
304
350
  key: column.id,
351
+ colid: column.id,
305
352
  class: ['vxe-table-custom--option', `level--${column.level}`, {
306
353
  'is--group': isColGroup
307
- }]
354
+ }],
355
+ onDragstart: sortDragstartEvent,
356
+ onDragend: sortDragendEvent,
357
+ onDragover: sortDragoverEvent
308
358
  }, [(0, _vue.h)('div', {
309
- title: colTitle,
310
359
  class: ['vxe-table-custom--checkbox-option', {
311
360
  'is--checked': isChecked,
312
361
  'is--indeterminate': isIndeterminate,
313
362
  'is--disabled': isDisabled
314
363
  }],
364
+ title: getI18n('vxe.custom.setting.colVisible'),
315
365
  onClick: () => {
316
366
  if (!isDisabled) {
317
367
  changeCheckboxOption(column);
@@ -319,29 +369,39 @@ var _default = exports.default = (0, _vue.defineComponent)({
319
369
  }
320
370
  }, [(0, _vue.h)('span', {
321
371
  class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
322
- }), (0, _vue.h)('span', {
323
- class: 'vxe-checkbox--label'
324
- }, colTitle)]), !parent && customOpts.allowFixed ? (0, _vue.h)('div', {
372
+ })]), allowSort && column.level === 1 ? (0, _vue.h)('div', {
373
+ class: 'vxe-table-custom--sort-option'
374
+ }, [(0, _vue.h)('span', {
375
+ class: 'vxe-table-custom--sort-btn',
376
+ title: getI18n('vxe.custom.setting.sortHelpTip'),
377
+ onMousedown: sortMousedownEvent,
378
+ onMouseup: sortMouseupEvent
379
+ }, [(0, _vue.h)('i', {
380
+ class: getIcon().TABLE_CUSTOM_SORT
381
+ })])]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('div', {
382
+ class: 'vxe-table-custom--checkbox-label',
383
+ title: colTitle
384
+ }, colTitle), !parent && allowFixed ? (0, _vue.h)('div', {
325
385
  class: 'vxe-table-custom--fixed-option'
326
386
  }, [(0, _vue.h)('span', {
327
- class: ['vxe-table-custom--fixed-left-option', column.fixed === 'left' ? getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_LEFT, {
328
- 'is--checked': column.fixed === 'left',
329
- 'is--disabled': isMaxFixedColumn && !column.fixed
387
+ class: ['vxe-table-custom--fixed-left-option', column.renderFixed === 'left' ? getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_LEFT, {
388
+ 'is--checked': column.renderFixed === 'left',
389
+ 'is--disabled': isMaxFixedColumn && !column.renderFixed
330
390
  }],
331
- title: getI18n(column.fixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft'),
391
+ title: getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft'),
332
392
  onClick: () => {
333
393
  changeFixedOption(column, 'left');
334
394
  }
335
395
  }), (0, _vue.h)('span', {
336
- class: ['vxe-table-custom--fixed-right-option', column.fixed === 'right' ? getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_RIGHT, {
337
- 'is--checked': column.fixed === 'right',
338
- 'is--disabled': isMaxFixedColumn && !column.fixed
396
+ class: ['vxe-table-custom--fixed-right-option', column.renderFixed === 'right' ? getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_RIGHT, {
397
+ 'is--checked': column.renderFixed === 'right',
398
+ 'is--disabled': isMaxFixedColumn && !column.renderFixed
339
399
  }],
340
- title: getI18n(column.fixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight'),
400
+ title: getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight'),
341
401
  onClick: () => {
342
402
  changeFixedOption(column, 'right');
343
403
  }
344
- })]) : null]));
404
+ })]) : (0, _vue.createCommentVNode)()]));
345
405
  }
346
406
  });
347
407
  const isAllChecked = customStore.isAll;
@@ -352,7 +412,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
352
412
  class: ['vxe-table-custom-wrapper', {
353
413
  'is--active': customStore.visible
354
414
  }]
355
- }, [(0, _vue.h)('ul', {
415
+ }, customStore.visible ? [(0, _vue.h)('ul', {
356
416
  class: 'vxe-table-custom--header'
357
417
  }, [(0, _vue.h)('li', {
358
418
  class: 'vxe-table-custom--option'
@@ -367,20 +427,33 @@ var _default = exports.default = (0, _vue.defineComponent)({
367
427
  class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
368
428
  }), (0, _vue.h)('span', {
369
429
  class: 'vxe-checkbox--label'
370
- }, getI18n('vxe.toolbar.customAll'))])])]), (0, _vue.h)('ul', Object.assign({
430
+ }, getI18n('vxe.toolbar.customAll'))])])]), (0, _vue.h)('div', {
431
+ ref: bodyElemRef,
432
+ class: 'vxe-table-custom--list-wrapper'
433
+ }, [(0, _vue.h)(_vue.TransitionGroup, Object.assign({
371
434
  class: 'vxe-table-custom--body',
435
+ name: 'vxe-table-custom--list',
436
+ tag: 'ul',
372
437
  style: maxHeight ? {
373
438
  maxHeight: `${maxHeight}px`
374
439
  } : {}
375
- }, customWrapperOns), colVNs), customOpts.showFooter ? (0, _vue.h)('div', {
440
+ }, customWrapperOns), {
441
+ default: () => colVNs
442
+ }), (0, _vue.h)('div', {
443
+ ref: dragHintElemRef,
444
+ class: 'vxe-table-custom-popup--drag-hint'
445
+ }, getI18n('vxe.custom.cstmDragTarget', [dragColumn.value ? dragColumn.value.getTitle() : '']))]), customOpts.showFooter ? (0, _vue.h)('div', {
376
446
  class: 'vxe-table-custom--footer'
377
447
  }, [(0, _vue.h)('button', {
378
448
  class: 'btn--reset',
379
449
  onClick: resetCustomEvent
380
- }, customOpts.resetButtonText || getI18n('vxe.toolbar.customRestore')), (0, _vue.h)('button', {
450
+ }, customOpts.resetButtonText || getI18n('vxe.table.customRestore')), customOpts.immediate ? (0, _vue.createCommentVNode)() : (0, _vue.h)('button', {
451
+ class: 'btn--cancel',
452
+ onClick: cancelCustomEvent
453
+ }, customOpts.resetButtonText || getI18n('vxe.table.customCancel')), (0, _vue.h)('button', {
381
454
  class: 'btn--confirm',
382
455
  onClick: confirmCustomEvent
383
- }, customOpts.confirmButtonText || getI18n('vxe.toolbar.customConfirm'))]) : null]);
456
+ }, customOpts.confirmButtonText || getI18n('vxe.table.customConfirm'))]) : null] : []);
384
457
  };
385
458
  const renderPopupPanel = () => {
386
459
  const {
@@ -391,6 +464,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
391
464
  } = reactData;
392
465
  const customOpts = computeCustomOpts.value;
393
466
  const {
467
+ allowSort,
468
+ allowFixed,
394
469
  checkMethod,
395
470
  visibleMethod
396
471
  } = customOpts;
@@ -402,7 +477,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
402
477
  column
403
478
  }) : true;
404
479
  if (isVisible) {
405
- const isChecked = column.visible;
480
+ const isChecked = column.renderVisible;
406
481
  const isIndeterminate = column.halfVisible;
407
482
  const colTitle = (0, _utils.formatText)(column.getTitle(), 1);
408
483
  const isColGroup = column.children && column.children.length;
@@ -419,19 +494,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
419
494
  onDragend: sortDragendEvent,
420
495
  onDragover: sortDragoverEvent
421
496
  }, [(0, _vue.h)('td', {
422
- class: 'vxe-table-custom-popup--column-item col--sort'
423
- }, [column.level === 1 ? (0, _vue.h)('span', {
424
- class: 'vxe-table-custom-popup--column-sort-btn',
425
- onMousedown: sortMousedownEvent,
426
- onMouseup: sortMouseupEvent
427
- }, [(0, _vue.h)('i', {
428
- class: 'vxe-icon-sort'
429
- })]) : null]), (0, _vue.h)('td', {
430
- class: 'vxe-table-custom-popup--column-item col--name'
431
- }, [(0, _vue.h)('div', {
432
- class: 'vxe-table-custom-popup--name',
433
- title: colTitle
434
- }, colTitle)]), (0, _vue.h)('td', {
435
497
  class: 'vxe-table-custom-popup--column-item col--visible'
436
498
  }, [(0, _vue.h)('div', {
437
499
  class: ['vxe-table-custom--checkbox-option', {
@@ -439,6 +501,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
439
501
  'is--indeterminate': isIndeterminate,
440
502
  'is--disabled': isDisabled
441
503
  }],
504
+ title: getI18n('vxe.custom.setting.colVisible'),
442
505
  onClick: () => {
443
506
  if (!isDisabled) {
444
507
  changeCheckboxOption(column);
@@ -446,10 +509,24 @@ var _default = exports.default = (0, _vue.defineComponent)({
446
509
  }
447
510
  }, [(0, _vue.h)('span', {
448
511
  class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
449
- })])]), (0, _vue.h)('td', {
512
+ })])]), allowSort ? (0, _vue.h)('td', {
513
+ class: 'vxe-table-custom-popup--column-item col--sort'
514
+ }, [column.level === 1 ? (0, _vue.h)('span', {
515
+ class: 'vxe-table-custom-popup--column-sort-btn',
516
+ title: getI18n('vxe.custom.setting.sortHelpTip'),
517
+ onMousedown: sortMousedownEvent,
518
+ onMouseup: sortMouseupEvent
519
+ }, [(0, _vue.h)('i', {
520
+ class: getIcon().TABLE_CUSTOM_SORT
521
+ })]) : null]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('td', {
522
+ class: 'vxe-table-custom-popup--column-item col--name'
523
+ }, [(0, _vue.h)('div', {
524
+ class: 'vxe-table-custom-popup--name',
525
+ title: colTitle
526
+ }, colTitle)]), allowFixed ? (0, _vue.h)('td', {
450
527
  class: 'vxe-table-custom-popup--column-item col--fixed'
451
- }, [!parent && customOpts.allowFixed ? (0, _vue.h)((0, _vue.resolveComponent)('vxe-radio-group'), {
452
- modelValue: column.fixed || '',
528
+ }, [!parent ? (0, _vue.h)((0, _vue.resolveComponent)('vxe-radio-group'), {
529
+ modelValue: column.renderFixed || '',
453
530
  type: 'button',
454
531
  size: 'mini',
455
532
  options: [{
@@ -465,14 +542,16 @@ var _default = exports.default = (0, _vue.defineComponent)({
465
542
  disabled: isMaxFixedColumn
466
543
  }],
467
544
  'onUpdate:modelValue'(value) {
468
- column.fixed = value;
469
- },
470
- onChange() {
471
- changePopupFixedOption(column);
545
+ column.renderFixed = value;
472
546
  }
473
- }) : null])]));
547
+ // onChange () {
548
+ // changePopupFixedOption(column)
549
+ // }
550
+ }) : null]) : (0, _vue.createCommentVNode)()]));
474
551
  }
475
552
  });
553
+ const isAllChecked = customStore.isAll;
554
+ const isAllIndeterminate = customStore.isIndeterminate;
476
555
  return (0, _vue.h)((0, _vue.resolveComponent)('vxe-modal'), {
477
556
  key: 'popup',
478
557
  className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
@@ -502,15 +581,30 @@ var _default = exports.default = (0, _vue.defineComponent)({
502
581
  style: {
503
582
  width: '80px'
504
583
  }
505
- }), (0, _vue.h)('col', {}), (0, _vue.h)('col', {
584
+ }), allowSort ? (0, _vue.h)('col', {
506
585
  style: {
507
586
  width: '80px'
508
587
  }
509
- }), (0, _vue.h)('col', {
588
+ }) : (0, _vue.createCommentVNode)(), (0, _vue.h)('col', {
589
+ style: {
590
+ minWidth: '120px'
591
+ }
592
+ }), allowFixed ? (0, _vue.h)('col', {
510
593
  style: {
511
594
  width: '200px'
512
595
  }
513
- })]), (0, _vue.h)('thead', {}, [(0, _vue.h)('tr', {}, [(0, _vue.h)('th', {}, [(0, _vue.h)('span', {
596
+ }) : (0, _vue.createCommentVNode)()]), (0, _vue.h)('thead', {}, [(0, _vue.h)('tr', {}, [(0, _vue.h)('th', {}, [(0, _vue.h)('div', {
597
+ class: ['vxe-table-custom--checkbox-option', {
598
+ 'is--checked': isAllChecked,
599
+ 'is--indeterminate': isAllIndeterminate
600
+ }],
601
+ title: getI18n('vxe.table.allTitle'),
602
+ onClick: allCustomEvent
603
+ }, [(0, _vue.h)('span', {
604
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
605
+ }), (0, _vue.h)('span', {
606
+ class: 'vxe-checkbox--label'
607
+ }, getI18n('vxe.toolbar.customAll'))])]), allowSort ? (0, _vue.h)('th', {}, [(0, _vue.h)('span', {
514
608
  class: 'vxe-table-custom-popup--table-sort-help-title'
515
609
  }, getI18n('vxe.custom.setting.colSort')), (0, _vue.h)((0, _vue.resolveComponent)('vxe-tooltip'), {
516
610
  enterable: true,
@@ -521,7 +615,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
521
615
  class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
522
616
  });
523
617
  }
524
- })]), (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colTitle')), (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colVisible')), (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))])]), (0, _vue.h)(_vue.TransitionGroup, {
618
+ })]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colTitle')), allowFixed ? (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0])) : (0, _vue.createCommentVNode)()])]), (0, _vue.h)(_vue.TransitionGroup, {
525
619
  class: 'vxe-table-custom--body',
526
620
  tag: 'tbody',
527
621
  name: 'vxe-table-custom--list'
@@ -537,7 +631,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
537
631
  class: 'vxe-table-custom-popup--footer'
538
632
  }, [(0, _vue.h)((0, _vue.resolveComponent)('vxe-button'), {
539
633
  content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
540
- onClick: resetPopupCustomEvent
634
+ onClick: resetCustomEvent
541
635
  }), (0, _vue.h)((0, _vue.resolveComponent)('vxe-button'), {
542
636
  content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel'),
543
637
  onClick: cancelCustomEvent
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_ui=require("../../../ui"),_utils=require("../../../ui/src/utils"),_dom=require("../../../ui/src/dom"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{getI18n,getIcon}=_ui.VxeUI;var _default=exports.default=(0,_vue.defineComponent)({name:"TableCustomPanel",props:{customStore:{type:Object,default:()=>({})}},setup(c){const n=(0,_vue.inject)("$xeTable",{}),f=n["reactData"],{computeCustomOpts:C,computeColumnOpts:I,computeIsMaxFixedColumn:T}=n.getComputeMaps(),E=(0,_vue.ref)(),k=(0,_vue.ref)(),B=(0,_vue.ref)(),O=(0,_vue.ref)();let r;const y=e=>{var t=c["customStore"];t.activeWrapper=!0,n.customOpenEvent(e)},A=e=>{const t=c["customStore"];t.activeWrapper=!1,setTimeout(()=>{t.activeBtn||t.activeWrapper||n.customColseEvent(e)},300)},L=e=>{v(),n.closeCustom(),n.emitCustomEvent("confirm",e)},H=e=>{n.closeCustom(),n.emitCustomEvent("cancel",e)},D=e=>{n.resetColumn(!0),n.closeCustom(),n.emitCustomEvent("reset",e)},F=t=>{_ui.VxeUI.modal?_ui.VxeUI.modal.confirm({content:getI18n("vxe.custom.cstmConfirmRestore"),className:"vxe-table--ignore-clear",escClosable:!0}).then(e=>{"confirm"===e&&D(t)}):D(t)},l=t=>{var e=f["customColumnList"],e=_xeUtils.default.findTree(e,e=>e===t);e&&e.parent&&(e=e["parent"],e.children)&&e.children.length&&(e.visible=e.children.every(e=>e.visible),e.halfVisible=!e.visible&&e.children.some(e=>e.visible||e.halfVisible),l(e))},M=e=>{const t=!e.visible;var o=C.value;_xeUtils.default.eachTree([e],e=>{e.visible=t,e.halfVisible=!1}),l(e),o.immediate&&n.handleCustom(),n.checkCustomStatus()},R=(e,t)=>{var o=T.value;e.fixed===t?n.clearColumnFixed(e):o&&!e.fixed||n.setColumnFixed(e,t)},N=e=>{T.value||n.setColumnFixed(e,e.fixed)},U=()=>{var e=c["customStore"],t=f["customColumnList"];const o=C.value["checkMethod"],l=!e.isAll;_xeUtils.default.eachTree(t,e=>{o&&!o({column:e})||(e.visible=l,e.halfVisible=!1)}),e.isAll=l,n.checkCustomStatus()},V=e=>{var e=e.currentTarget.parentNode.parentNode,t=e.getAttribute("colid"),t=n.getColumnById(t);e.draggable=!0,O.value=t,(0,_dom.addClass)(e,"active--drag-origin")},w=e=>{var e=e.currentTarget.parentNode.parentNode,t=B.value;e.draggable=!1,(O.value=null,_dom.removeClass)(e,"active--drag-origin"),t&&(t.style.display="")},K=e=>{var t=new Image;e.dataTransfer&&e.dataTransfer.setDragImage(t,0,0)},v=()=>{var e=f["customColumnList"];e.forEach((e,t)=>{e.renderSortNumber=t+1})},S=e=>{var t=f["customColumnList"],e=e.currentTarget,o=B.value;if(r){if(r!==e){var l=r.getAttribute("drag-pos"),s=e.getAttribute("colid");const a=n.getColumnById(s);if(!a)return;var s=_xeUtils.default.findIndexOf(t,e=>e.id===a.id),i=r.getAttribute("colid");const u=n.getColumnById(i);if(!u)return;t.splice(s,1);i=_xeUtils.default.findIndexOf(t,e=>e.id===u.id);t.splice(i+("bottom"===l?1:0),0,a)}r.draggable=!1,r.removeAttribute("drag-pos"),(0,_dom.removeClass)(r,"active--drag-target")}O.value=null,e.draggable=!1,e.removeAttribute("drag-pos"),o&&(o.style.display=""),(0,_dom.removeClass)(e,"active--drag-target"),(0,_dom.removeClass)(e,"active--drag-origin"),v()},X=e=>{var t=e.currentTarget,o=(r!==t&&(0,_dom.removeClass)(r,"active--drag-target"),t.getAttribute("colid")),o=n.getColumnById(o);o&&1===o.level&&(e.preventDefault(),o=e.clientY-t.getBoundingClientRect().y<t.clientHeight/2?"top":"bottom",(0,_dom.addClass)(t,"active--drag-target"),t.setAttribute("drag-pos",o),r=t);{o=e;var l=B.value,s=k.value;s&&l&&(e=(t=s.parentNode).getBoundingClientRect(),l.style.display="block",l.style.top=Math.min(t.clientHeight-t.scrollTop-l.clientHeight,o.clientY-e.y)+"px",l.style.left=Math.min(t.clientWidth-t.scrollLeft-l.clientWidth-16,o.clientX-e.x)+"px")}};return()=>{if("popup"===C.value.mode){const i=c["customStore"];var e=f["customColumnList"];const r=C.value,{checkMethod:v,visibleMethod:d}=r,a=I.value,m=T.value,p=[];return _xeUtils.default.eachTree(e,(t,e,o,l,s)=>{if(!d||d({column:t})){var i=t.visible,a=t.halfVisible,u=(0,_utils.formatText)(t.getTitle(),1),c=t.children&&t.children.length;const n=!!v&&!v({column:t});p.push((0,_vue.h)("tr",{key:t.id,colid:t.id,class:["vxe-table-custom-popup--row level--"+t.level,{"is--group":c}],onDragstart:K,onDragend:S,onDragover:X},[(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--sort"},[1===t.level?(0,_vue.h)("span",{class:"vxe-table-custom-popup--column-sort-btn",onMousedown:V,onMouseup:w},[(0,_vue.h)("i",{class:"vxe-icon-sort"})]):null]),(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--name"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--name",title:u},u)]),(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--visible"},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":i,"is--indeterminate":a,"is--disabled":n}],onClick:()=>{n||M(t)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",a?getIcon().TABLE_CHECKBOX_INDETERMINATE:i?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]})])]),(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--fixed"},[!s&&r.allowFixed?(0,_vue.h)((0,_vue.resolveComponent)("vxe-radio-group"),{modelValue:t.fixed||"",type:"button",size:"mini",options:[{label:getI18n("vxe.custom.setting.fixedLeft"),value:"left",disabled:m},{label:getI18n("vxe.custom.setting.fixedUnset"),value:""},{label:getI18n("vxe.custom.setting.fixedRight"),value:"right",disabled:m}],"onUpdate:modelValue"(e){t.fixed=e},onChange(){N(t)}}):null])]))}}),(0,_vue.h)((0,_vue.resolveComponent)("vxe-modal"),{key:"popup",className:"vxe-table-custom-popup-wrapper vxe-table--ignore-clear",modelValue:i.visible,title:getI18n("vxe.custom.cstmTitle"),width:"40vw",minWidth:520,height:"50vh",minHeight:300,mask:!0,lockView:!0,showFooter:!0,resize:!0,escClosable:!0,destroyOnClose:!0,"onUpdate:modelValue"(e){i.visible=e}},{default:()=>(0,_vue.h)("div",{ref:k,class:"vxe-table-custom-popup--body"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-wrapper"},[(0,_vue.h)("table",{},[(0,_vue.h)("colgroup",{},[(0,_vue.h)("col",{style:{width:"80px"}}),(0,_vue.h)("col",{}),(0,_vue.h)("col",{style:{width:"80px"}}),(0,_vue.h)("col",{style:{width:"200px"}})]),(0,_vue.h)("thead",{},[(0,_vue.h)("tr",{},[(0,_vue.h)("th",{},[(0,_vue.h)("span",{class:"vxe-table-custom-popup--table-sort-help-title"},getI18n("vxe.custom.setting.colSort")),(0,_vue.h)((0,_vue.resolveComponent)("vxe-tooltip"),{enterable:!0,content:getI18n("vxe.custom.setting.sortHelpTip")},{default:()=>(0,_vue.h)("i",{class:"vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill"})})]),(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colTitle")),(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colVisible")),(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colFixed",[a.maxFixedSize||0]))])]),(0,_vue.h)(_vue.TransitionGroup,{class:"vxe-table-custom--body",tag:"tbody",name:"vxe-table-custom--list"},{default:()=>p})])]),(0,_vue.h)("div",{ref:B,class:"vxe-table-custom-popup--drag-hint"},getI18n("vxe.custom.cstmDragTarget",[O.value?O.value.getTitle():""]))]),footer:()=>(0,_vue.h)("div",{class:"vxe-table-custom-popup--footer"},[(0,_vue.h)((0,_vue.resolveComponent)("vxe-button"),{content:r.resetButtonText||getI18n("vxe.custom.cstmRestore"),onClick:F}),(0,_vue.h)((0,_vue.resolveComponent)("vxe-button"),{content:r.resetButtonText||getI18n("vxe.custom.cstmCancel"),onClick:H}),(0,_vue.h)((0,_vue.resolveComponent)("vxe-button"),{status:"primary",content:r.confirmButtonText||getI18n("vxe.custom.cstmConfirm"),onClick:L})])})}{var e=c["customStore"],t=f["customColumnList"];const x=C.value;var o=e["maxHeight"];const{checkMethod:h,visibleMethod:g,trigger:u}=x,_=T.value,b=[];var l={},t=("hover"===u&&(l.onMouseenter=y,l.onMouseleave=A),_xeUtils.default.eachTree(t,(e,t,o,l,s)=>{if(!g||g({column:e})){var i=e.visible,a=e.halfVisible,u=e.children&&e.children.length,c=(0,_utils.formatText)(e.getTitle(),1);const n=!!h&&!h({column:e});b.push((0,_vue.h)("li",{key:e.id,class:["vxe-table-custom--option","level--"+e.level,{"is--group":u}]},[(0,_vue.h)("div",{title:c,class:["vxe-table-custom--checkbox-option",{"is--checked":i,"is--indeterminate":a,"is--disabled":n}],onClick:()=>{n||M(e)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",a?getIcon().TABLE_CHECKBOX_INDETERMINATE:i?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},c)]),!s&&x.allowFixed?(0,_vue.h)("div",{class:"vxe-table-custom--fixed-option"},[(0,_vue.h)("span",{class:["vxe-table-custom--fixed-left-option","left"===e.fixed?getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_LEFT,{"is--checked":"left"===e.fixed,"is--disabled":_&&!e.fixed}],title:getI18n("left"===e.fixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedLeft"),onClick:()=>{R(e,"left")}}),(0,_vue.h)("span",{class:["vxe-table-custom--fixed-right-option","right"===e.fixed?getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,{"is--checked":"right"===e.fixed,"is--disabled":_&&!e.fixed}],title:getI18n("right"===e.fixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedRight"),onClick:()=>{R(e,"right")}})]):null]))}}),e.isAll),s=e.isIndeterminate;return(0,_vue.h)("div",{ref:E,key:"simple",class:["vxe-table-custom-wrapper",{"is--active":e.visible}]},[(0,_vue.h)("ul",{class:"vxe-table-custom--header"},[(0,_vue.h)("li",{class:"vxe-table-custom--option"},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":t,"is--indeterminate":s}],title:getI18n("vxe.table.allTitle"),onClick:U},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",s?getIcon().TABLE_CHECKBOX_INDETERMINATE:t?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.toolbar.customAll"))])])]),(0,_vue.h)("ul",Object.assign({class:"vxe-table-custom--body",style:o?{maxHeight:o+"px"}:{}},l),b),x.showFooter?(0,_vue.h)("div",{class:"vxe-table-custom--footer"},[(0,_vue.h)("button",{class:"btn--reset",onClick:D},x.resetButtonText||getI18n("vxe.toolbar.customRestore")),(0,_vue.h)("button",{class:"btn--confirm",onClick:L},x.confirmButtonText||getI18n("vxe.toolbar.customConfirm"))]):null]);return}}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_ui=require("../../../ui"),_utils=require("../../../ui/src/utils"),_dom=require("../../../ui/src/dom"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{getI18n,getIcon}=_ui.VxeUI;var _default=exports.default=(0,_vue.defineComponent)({name:"TableCustomPanel",props:{customStore:{type:Object,default:()=>({})}},setup(E){const r=(0,_vue.inject)("$xeTable",{}),{props:s,reactData:B}=r,{computeCustomOpts:k,computeColumnOpts:O,computeIsMaxFixedColumn:V}=r.getComputeMaps(),A=(0,_vue.ref)(),y=(0,_vue.ref)(),L=(0,_vue.ref)(),F=(0,_vue.ref)();let u;const H=e=>{var t=E["customStore"];t.activeWrapper=!0,r.customOpenEvent(e)},D=e=>{const t=E["customStore"];t.activeWrapper=!1,setTimeout(()=>{t.activeBtn||t.activeWrapper||r.customCloseEvent(e)},300)},o=e=>{var t=s["id"],{storage:o,updateStore:l}=k.value;o&&t&&l&&l({id:t,type:e,storeData:{}})},N=e=>{var t=B["customColumnList"];t.forEach((e,t)=>{e.renderSortNumber=t+1,e.fixed=e.renderFixed,e.visible=e.renderVisible}),r.closeCustom(),r.emitCustomEvent("confirm",e),o("confirm")},M=e=>{var t=E["customStore"],o=B["customColumnList"];const{oldSortMaps:s,oldFixedMaps:i,oldVisibleMaps:a}=t;_xeUtils.default.eachTree(o,e=>{var t=e.getKey(),o=!!a[t],l=i[t]||"";e.renderVisible=o,e.visible=o,e.renderFixed=l,e.fixed=l,e.renderSortNumber=s[t]||0},{children:"children"}),r.closeCustom(),r.emitCustomEvent("cancel",e)},l=e=>{r.resetColumn(!0),r.closeCustom(),r.emitCustomEvent("reset",e),o("confirm")},S=t=>{_ui.VxeUI.modal?_ui.VxeUI.modal.confirm({content:getI18n("vxe.custom.cstmConfirmRestore"),className:"vxe-table--ignore-clear",escClosable:!0}).then(e=>{"confirm"===e&&l(t)}):l(t)},i=t=>{var e=B["customColumnList"],e=_xeUtils.default.findTree(e,e=>e===t);e&&e.parent&&(e=e["parent"],e.children)&&e.children.length&&(e.renderVisible=e.children.every(e=>e.renderVisible),e.halfVisible=!e.renderVisible&&e.children.some(e=>e.renderVisible||e.halfVisible),i(e))},K=e=>{const t=!e.renderVisible;var o=k.value;_xeUtils.default.eachTree([e],e=>{e.renderVisible=t,e.halfVisible=!1}),i(e),o.immediate&&r.handleCustom(),r.checkCustomStatus()},R=(e,t)=>{var o=V.value;e.renderFixed===t?e.renderFixed="":o&&!e.renderFixed||(e.renderFixed=t)},U=()=>{var e=E["customStore"],t=B["customColumnList"];const o=k.value["checkMethod"],l=!e.isAll;_xeUtils.default.eachTree(t,e=>{o&&!o({column:e})||(e.renderVisible=l,e.halfVisible=!1)}),e.isAll=l,r.checkCustomStatus()},w=e=>{var e=e.currentTarget.parentNode.parentNode,t=e.getAttribute("colid"),t=r.getColumnById(t);e.draggable=!0,F.value=t,(0,_dom.addClass)(e,"active--drag-origin")},X=e=>{var e=e.currentTarget.parentNode.parentNode,t=L.value;e.draggable=!1,(F.value=null,_dom.removeClass)(e,"active--drag-origin"),t&&(t.style.display="")},q=e=>{var t=new Image;e.dataTransfer&&e.dataTransfer.setDragImage(t,0,0)},W=e=>{var t=B["customColumnList"],e=e.currentTarget,o=L.value;if(u){if(u!==e){var l=u.getAttribute("drag-pos"),s=e.getAttribute("colid");const a=r.getColumnById(s);if(!a)return;var s=_xeUtils.default.findIndexOf(t,e=>e.id===a.id),i=u.getAttribute("colid");const n=r.getColumnById(i);if(!n)return;t.splice(s,1);i=_xeUtils.default.findIndexOf(t,e=>e.id===n.id);t.splice(i+("bottom"===l?1:0),0,a)}u.draggable=!1,u.removeAttribute("drag-pos"),(0,_dom.removeClass)(u,"active--drag-target")}F.value=null,e.draggable=!1,e.removeAttribute("drag-pos"),o&&(o.style.display=""),(0,_dom.removeClass)(e,"active--drag-target"),(0,_dom.removeClass)(e,"active--drag-origin")},j=e=>{var t=e.currentTarget,o=(u!==t&&(0,_dom.removeClass)(u,"active--drag-target"),t.getAttribute("colid")),o=r.getColumnById(o);o&&1===o.level&&(e.preventDefault(),o=e.clientY-t.getBoundingClientRect().y<t.clientHeight/2?"top":"bottom",(0,_dom.addClass)(t,"active--drag-target"),t.setAttribute("drag-pos",o),u=t);{o=e;var l=L.value,s=y.value;s&&l&&(e=(t=s.parentNode).getBoundingClientRect(),l.style.display="block",l.style.top=Math.min(t.clientHeight-t.scrollTop-l.clientHeight,o.clientY-e.y)+"px",l.style.left=Math.min(t.clientWidth-t.scrollLeft-l.clientWidth-16,o.clientX-e.x)+"px")}};return()=>{if("popup"===k.value.mode){const a=E["customStore"];var e=B["customColumnList"];const n=k.value,{allowSort:c,allowFixed:v,checkMethod:d,visibleMethod:m}=n,r=O.value,p=V.value,x=[],u=(_xeUtils.default.eachTree(e,(t,e,o,l,s)=>{if(!m||m({column:t})){var i=t.renderVisible,a=t.halfVisible,n=(0,_utils.formatText)(t.getTitle(),1),r=t.children&&t.children.length;const u=!!d&&!d({column:t});x.push((0,_vue.h)("tr",{key:t.id,colid:t.id,class:["vxe-table-custom-popup--row level--"+t.level,{"is--group":r}],onDragstart:q,onDragend:W,onDragover:j},[(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--visible"},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":i,"is--indeterminate":a,"is--disabled":u}],title:getI18n("vxe.custom.setting.colVisible"),onClick:()=>{u||K(t)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",a?getIcon().TABLE_CHECKBOX_INDETERMINATE:i?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]})])]),c?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--sort"},[1===t.level?(0,_vue.h)("span",{class:"vxe-table-custom-popup--column-sort-btn",title:getI18n("vxe.custom.setting.sortHelpTip"),onMousedown:w,onMouseup:X},[(0,_vue.h)("i",{class:getIcon().TABLE_CUSTOM_SORT})]):null]):(0,_vue.createCommentVNode)(),(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--name"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--name",title:n},n)]),v?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--fixed"},[s?null:(0,_vue.h)((0,_vue.resolveComponent)("vxe-radio-group"),{modelValue:t.renderFixed||"",type:"button",size:"mini",options:[{label:getI18n("vxe.custom.setting.fixedLeft"),value:"left",disabled:p},{label:getI18n("vxe.custom.setting.fixedUnset"),value:""},{label:getI18n("vxe.custom.setting.fixedRight"),value:"right",disabled:p}],"onUpdate:modelValue"(e){t.renderFixed=e}})]):(0,_vue.createCommentVNode)()]))}}),a.isAll),_=a.isIndeterminate;return(0,_vue.h)((0,_vue.resolveComponent)("vxe-modal"),{key:"popup",className:"vxe-table-custom-popup-wrapper vxe-table--ignore-clear",modelValue:a.visible,title:getI18n("vxe.custom.cstmTitle"),width:"40vw",minWidth:520,height:"50vh",minHeight:300,mask:!0,lockView:!0,showFooter:!0,resize:!0,escClosable:!0,destroyOnClose:!0,"onUpdate:modelValue"(e){a.visible=e}},{default:()=>(0,_vue.h)("div",{ref:y,class:"vxe-table-custom-popup--body"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-wrapper"},[(0,_vue.h)("table",{},[(0,_vue.h)("colgroup",{},[(0,_vue.h)("col",{style:{width:"80px"}}),c?(0,_vue.h)("col",{style:{width:"80px"}}):(0,_vue.createCommentVNode)(),(0,_vue.h)("col",{style:{minWidth:"120px"}}),v?(0,_vue.h)("col",{style:{width:"200px"}}):(0,_vue.createCommentVNode)()]),(0,_vue.h)("thead",{},[(0,_vue.h)("tr",{},[(0,_vue.h)("th",{},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":u,"is--indeterminate":_}],title:getI18n("vxe.table.allTitle"),onClick:U},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",_?getIcon().TABLE_CHECKBOX_INDETERMINATE:u?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.toolbar.customAll"))])]),c?(0,_vue.h)("th",{},[(0,_vue.h)("span",{class:"vxe-table-custom-popup--table-sort-help-title"},getI18n("vxe.custom.setting.colSort")),(0,_vue.h)((0,_vue.resolveComponent)("vxe-tooltip"),{enterable:!0,content:getI18n("vxe.custom.setting.sortHelpTip")},{default:()=>(0,_vue.h)("i",{class:"vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill"})})]):(0,_vue.createCommentVNode)(),(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colTitle")),v?(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colFixed",[r.maxFixedSize||0])):(0,_vue.createCommentVNode)()])]),(0,_vue.h)(_vue.TransitionGroup,{class:"vxe-table-custom--body",tag:"tbody",name:"vxe-table-custom--list"},{default:()=>x})])]),(0,_vue.h)("div",{ref:L,class:"vxe-table-custom-popup--drag-hint"},getI18n("vxe.custom.cstmDragTarget",[F.value?F.value.getTitle():""]))]),footer:()=>(0,_vue.h)("div",{class:"vxe-table-custom-popup--footer"},[(0,_vue.h)((0,_vue.resolveComponent)("vxe-button"),{content:n.resetButtonText||getI18n("vxe.custom.cstmRestore"),onClick:S}),(0,_vue.h)((0,_vue.resolveComponent)("vxe-button"),{content:n.resetButtonText||getI18n("vxe.custom.cstmCancel"),onClick:M}),(0,_vue.h)((0,_vue.resolveComponent)("vxe-button"),{status:"primary",content:n.confirmButtonText||getI18n("vxe.custom.cstmConfirm"),onClick:N})])})}{var e=E["customStore"],t=B["customColumnList"],o=k.value,l=e["maxHeight"];const{checkMethod:h,visibleMethod:g,allowSort:b,allowFixed:C,trigger:f}=o,T=V.value,I=[];var s={},t=("hover"===f&&(s.onMouseenter=H,s.onMouseleave=D),_xeUtils.default.eachTree(t,(e,t,o,l,s)=>{if(!g||g({column:e})){var i=e.renderVisible,a=e.halfVisible,n=e.children&&e.children.length,r=(0,_utils.formatText)(e.getTitle(),1);const u=!!h&&!h({column:e});I.push((0,_vue.h)("li",{key:e.id,colid:e.id,class:["vxe-table-custom--option","level--"+e.level,{"is--group":n}],onDragstart:q,onDragend:W,onDragover:j},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":i,"is--indeterminate":a,"is--disabled":u}],title:getI18n("vxe.custom.setting.colVisible"),onClick:()=>{u||K(e)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",a?getIcon().TABLE_CHECKBOX_INDETERMINATE:i?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]})]),b&&1===e.level?(0,_vue.h)("div",{class:"vxe-table-custom--sort-option"},[(0,_vue.h)("span",{class:"vxe-table-custom--sort-btn",title:getI18n("vxe.custom.setting.sortHelpTip"),onMousedown:w,onMouseup:X},[(0,_vue.h)("i",{class:getIcon().TABLE_CUSTOM_SORT})])]):(0,_vue.createCommentVNode)(),(0,_vue.h)("div",{class:"vxe-table-custom--checkbox-label",title:r},r),!s&&C?(0,_vue.h)("div",{class:"vxe-table-custom--fixed-option"},[(0,_vue.h)("span",{class:["vxe-table-custom--fixed-left-option","left"===e.renderFixed?getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_LEFT,{"is--checked":"left"===e.renderFixed,"is--disabled":T&&!e.renderFixed}],title:getI18n("left"===e.renderFixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedLeft"),onClick:()=>{R(e,"left")}}),(0,_vue.h)("span",{class:["vxe-table-custom--fixed-right-option","right"===e.renderFixed?getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,{"is--checked":"right"===e.renderFixed,"is--disabled":T&&!e.renderFixed}],title:getI18n("right"===e.renderFixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedRight"),onClick:()=>{R(e,"right")}})]):(0,_vue.createCommentVNode)()]))}}),e.isAll),i=e.isIndeterminate;return(0,_vue.h)("div",{ref:A,key:"simple",class:["vxe-table-custom-wrapper",{"is--active":e.visible}]},e.visible?[(0,_vue.h)("ul",{class:"vxe-table-custom--header"},[(0,_vue.h)("li",{class:"vxe-table-custom--option"},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":t,"is--indeterminate":i}],title:getI18n("vxe.table.allTitle"),onClick:U},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",i?getIcon().TABLE_CHECKBOX_INDETERMINATE:t?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.toolbar.customAll"))])])]),(0,_vue.h)("div",{ref:y,class:"vxe-table-custom--list-wrapper"},[(0,_vue.h)(_vue.TransitionGroup,Object.assign({class:"vxe-table-custom--body",name:"vxe-table-custom--list",tag:"ul",style:l?{maxHeight:l+"px"}:{}},s),{default:()=>I}),(0,_vue.h)("div",{ref:L,class:"vxe-table-custom-popup--drag-hint"},getI18n("vxe.custom.cstmDragTarget",[F.value?F.value.getTitle():""]))]),o.showFooter?(0,_vue.h)("div",{class:"vxe-table-custom--footer"},[(0,_vue.h)("button",{class:"btn--reset",onClick:S},o.resetButtonText||getI18n("vxe.table.customRestore")),o.immediate?(0,_vue.createCommentVNode)():(0,_vue.h)("button",{class:"btn--cancel",onClick:M},o.resetButtonText||getI18n("vxe.table.customCancel")),(0,_vue.h)("button",{class:"btn--confirm",onClick:N},o.confirmButtonText||getI18n("vxe.table.customConfirm"))]):null]:[]);return}}}});
@@ -134,6 +134,8 @@ class ColumnInfo {
134
134
  // 列排序
135
135
  sortNumber: 0,
136
136
  renderSortNumber: 0,
137
+ renderFixed: '',
138
+ renderVisible: false,
137
139
  renderWidth: 0,
138
140
  renderHeight: 0,
139
141
  resizeWidth: 0,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ColumnInfo=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_util=require("./util"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{getI18n,formats,log}=_ui.VxeUI;class ColumnInfo{constructor(e,r,{renderHeader:t,renderCell:l,renderFooter:o,renderData:i}={}){var d,n=e.xegrid,s=r.formatter,a=!_xeUtils.default.isBoolean(r.visible)||r.visible;"development"===process.env.NODE_ENV&&(d=["seq","checkbox","radio","expand","html"],r.type&&-1===d.indexOf(r.type)&&log.warn("vxe.error.errProp",["type="+r.type,d.join(", ")]),(_xeUtils.default.isBoolean(r.cellRender)||r.cellRender&&!_xeUtils.default.isObject(r.cellRender))&&log.warn("vxe.error.errProp",["column.cell-render="+r.cellRender,"column.cell-render={}"]),(_xeUtils.default.isBoolean(r.editRender)||r.editRender&&!_xeUtils.default.isObject(r.editRender))&&log.warn("vxe.error.errProp",["column.edit-render="+r.editRender,"column.edit-render={}"]),r.cellRender&&r.editRender&&log.warn("vxe.error.errConflicts",["column.cell-render","column.edit-render"]),"expand"===r.type&&(d=e["props"],d=d["treeConfig"],e=e.getComputeMaps()["computeTreeOpts"],e=e.value,d)&&(e.showLine||e.line)&&log.err("vxe.error.errConflicts",["tree-config.showLine","column.type=expand"]),s)&&(_xeUtils.default.isString(s)?(d=formats.get(s)||_xeUtils.default[s])&&_xeUtils.default.isFunction(d.cellFormatMethod)||log.err("vxe.error.notFormats",[s]):!_xeUtils.default.isArray(s)||(e=formats.get(s[0])||_xeUtils.default[s[0]])&&_xeUtils.default.isFunction(e.cellFormatMethod)||log.err("vxe.error.notFormats",[s[0]])),Object.assign(this,{type:r.type,property:r.field,field:r.field,title:r.title,width:r.width,minWidth:r.minWidth,maxWidth:r.maxWidth,resizable:r.resizable,fixed:r.fixed,align:r.align,headerAlign:r.headerAlign,footerAlign:r.footerAlign,showOverflow:r.showOverflow,showHeaderOverflow:r.showHeaderOverflow,showFooterOverflow:r.showFooterOverflow,className:r.className,headerClassName:r.headerClassName,footerClassName:r.footerClassName,formatter:s,sortable:r.sortable,sortBy:r.sortBy,sortType:r.sortType,filters:(0,_util.toFilters)(r.filters),filterMultiple:!_xeUtils.default.isBoolean(r.filterMultiple)||r.filterMultiple,filterMethod:r.filterMethod,filterResetMethod:r.filterResetMethod,filterRecoverMethod:r.filterRecoverMethod,filterRender:r.filterRender,treeNode:r.treeNode,cellType:r.cellType,cellRender:r.cellRender,editRender:r.editRender,contentRender:r.contentRender,headerExportMethod:r.headerExportMethod,exportMethod:r.exportMethod,footerExportMethod:r.footerExportMethod,titleHelp:r.titleHelp,titlePrefix:r.titlePrefix,titleSuffix:r.titleSuffix,params:r.params,id:r.colId||_xeUtils.default.uniqueId("col_"),parentId:null,visible:a,halfVisible:!1,defaultVisible:a,defaultFixed:r.fixed,checked:!1,halfChecked:!1,disabled:!1,level:1,rowSpan:1,colSpan:1,order:null,sortTime:0,sortNumber:0,renderSortNumber:0,renderWidth:0,renderHeight:0,resizeWidth:0,renderLeft:0,renderArgs:[],model:{},renderHeader:t||r.renderHeader,renderCell:l||r.renderCell,renderFooter:o||r.renderFooter,renderData:i,slots:r.slots}),n&&(d=n.getComputeMaps()["computeProxyOpts"],(e=d.value).beforeColumn)&&e.beforeColumn({$grid:n,column:this})}getTitle(){return(0,_utils.getFuncText)(this.title||("seq"===this.type?getI18n("vxe.table.seqTitle"):""))}getKey(){return this.field||(this.type?"type="+this.type:null)}update(e,r){"filters"!==e&&("field"===e&&(this.property=r),this[e]=r)}}exports.ColumnInfo=ColumnInfo;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ColumnInfo=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_util=require("./util"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{getI18n,formats,log}=_ui.VxeUI;class ColumnInfo{constructor(e,r,{renderHeader:t,renderCell:l,renderFooter:o,renderData:i}={}){var d,n=e.xegrid,s=r.formatter,a=!_xeUtils.default.isBoolean(r.visible)||r.visible;"development"===process.env.NODE_ENV&&(d=["seq","checkbox","radio","expand","html"],r.type&&-1===d.indexOf(r.type)&&log.warn("vxe.error.errProp",["type="+r.type,d.join(", ")]),(_xeUtils.default.isBoolean(r.cellRender)||r.cellRender&&!_xeUtils.default.isObject(r.cellRender))&&log.warn("vxe.error.errProp",["column.cell-render="+r.cellRender,"column.cell-render={}"]),(_xeUtils.default.isBoolean(r.editRender)||r.editRender&&!_xeUtils.default.isObject(r.editRender))&&log.warn("vxe.error.errProp",["column.edit-render="+r.editRender,"column.edit-render={}"]),r.cellRender&&r.editRender&&log.warn("vxe.error.errConflicts",["column.cell-render","column.edit-render"]),"expand"===r.type&&(d=e["props"],d=d["treeConfig"],e=e.getComputeMaps()["computeTreeOpts"],e=e.value,d)&&(e.showLine||e.line)&&log.err("vxe.error.errConflicts",["tree-config.showLine","column.type=expand"]),s)&&(_xeUtils.default.isString(s)?(d=formats.get(s)||_xeUtils.default[s])&&_xeUtils.default.isFunction(d.cellFormatMethod)||log.err("vxe.error.notFormats",[s]):!_xeUtils.default.isArray(s)||(e=formats.get(s[0])||_xeUtils.default[s[0]])&&_xeUtils.default.isFunction(e.cellFormatMethod)||log.err("vxe.error.notFormats",[s[0]])),Object.assign(this,{type:r.type,property:r.field,field:r.field,title:r.title,width:r.width,minWidth:r.minWidth,maxWidth:r.maxWidth,resizable:r.resizable,fixed:r.fixed,align:r.align,headerAlign:r.headerAlign,footerAlign:r.footerAlign,showOverflow:r.showOverflow,showHeaderOverflow:r.showHeaderOverflow,showFooterOverflow:r.showFooterOverflow,className:r.className,headerClassName:r.headerClassName,footerClassName:r.footerClassName,formatter:s,sortable:r.sortable,sortBy:r.sortBy,sortType:r.sortType,filters:(0,_util.toFilters)(r.filters),filterMultiple:!_xeUtils.default.isBoolean(r.filterMultiple)||r.filterMultiple,filterMethod:r.filterMethod,filterResetMethod:r.filterResetMethod,filterRecoverMethod:r.filterRecoverMethod,filterRender:r.filterRender,treeNode:r.treeNode,cellType:r.cellType,cellRender:r.cellRender,editRender:r.editRender,contentRender:r.contentRender,headerExportMethod:r.headerExportMethod,exportMethod:r.exportMethod,footerExportMethod:r.footerExportMethod,titleHelp:r.titleHelp,titlePrefix:r.titlePrefix,titleSuffix:r.titleSuffix,params:r.params,id:r.colId||_xeUtils.default.uniqueId("col_"),parentId:null,visible:a,halfVisible:!1,defaultVisible:a,defaultFixed:r.fixed,checked:!1,halfChecked:!1,disabled:!1,level:1,rowSpan:1,colSpan:1,order:null,sortTime:0,sortNumber:0,renderSortNumber:0,renderFixed:"",renderVisible:!1,renderWidth:0,renderHeight:0,resizeWidth:0,renderLeft:0,renderArgs:[],model:{},renderHeader:t||r.renderHeader,renderCell:l||r.renderCell,renderFooter:o||r.renderFooter,renderData:i,slots:r.slots}),n&&(d=n.getComputeMaps()["computeProxyOpts"],(e=d.value).beforeColumn)&&e.beforeColumn({$grid:n,column:this})}getTitle(){return(0,_utils.getFuncText)(this.title||("seq"===this.type?getI18n("vxe.table.seqTitle"):""))}getKey(){return this.field||(this.type?"type="+this.type:null)}update(e,r){"filters"!==e&&("field"===e&&(this.property=r),this[e]=r)}}exports.ColumnInfo=ColumnInfo;
@@ -141,7 +141,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
141
141
  activeBtn: false,
142
142
  activeWrapper: false,
143
143
  visible: false,
144
- maxHeight: 0
144
+ maxHeight: 0,
145
+ oldSortMaps: {},
146
+ oldFixedMaps: {},
147
+ oldVisibleMaps: {}
145
148
  },
146
149
  customColumnList: [],
147
150
  // 当前选中的筛选列
@@ -913,7 +916,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
913
916
  } = props;
914
917
  const customOpts = computeCustomOpts.value;
915
918
  const {
916
- storage
919
+ storage,
920
+ restoreStore
917
921
  } = customOpts;
918
922
  const isAllCustom = storage === true;
919
923
  const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
@@ -921,6 +925,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
921
925
  const isCustomVisible = isAllCustom || storageOpts.visible;
922
926
  const isCustomFixed = isAllCustom || storageOpts.fixed;
923
927
  const isCustomSort = isAllCustom || storageOpts.sort;
928
+ if (storage && id && restoreStore) {
929
+ restoreStore({
930
+ id
931
+ });
932
+ }
924
933
  if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
925
934
  const customMap = {};
926
935
  if (!id) {