vxe-table 4.8.4 → 4.8.6

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 (55) hide show
  1. package/README.md +12 -12
  2. package/es/grid/src/grid.js +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/custom/hook.js +135 -3
  6. package/es/table/module/custom/panel.js +179 -181
  7. package/es/table/module/validator/hook.js +1 -1
  8. package/es/table/src/body.js +14 -8
  9. package/es/table/src/table.js +77 -73
  10. package/es/table/style.css +67 -52
  11. package/es/table/style.min.css +1 -1
  12. package/es/ui/index.js +3 -2
  13. package/es/ui/src/log.js +1 -1
  14. package/es/vxe-table/style.css +67 -52
  15. package/es/vxe-table/style.min.css +1 -1
  16. package/lib/grid/src/grid.js +1 -1
  17. package/lib/grid/src/grid.min.js +1 -1
  18. package/lib/index.umd.js +374 -247
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/style.css +1 -1
  21. package/lib/style.min.css +1 -1
  22. package/lib/table/module/custom/hook.js +177 -3
  23. package/lib/table/module/custom/hook.min.js +1 -1
  24. package/lib/table/module/custom/panel.js +108 -162
  25. package/lib/table/module/custom/panel.min.js +1 -1
  26. package/lib/table/module/validator/hook.js +1 -1
  27. package/lib/table/module/validator/hook.min.js +1 -1
  28. package/lib/table/src/body.js +5 -3
  29. package/lib/table/src/body.min.js +1 -1
  30. package/lib/table/src/table.js +78 -74
  31. package/lib/table/src/table.min.js +1 -1
  32. package/lib/table/style/style.css +67 -52
  33. package/lib/table/style/style.min.css +1 -1
  34. package/lib/ui/index.js +3 -2
  35. package/lib/ui/index.min.js +1 -1
  36. package/lib/ui/src/log.js +1 -1
  37. package/lib/ui/src/log.min.js +1 -1
  38. package/lib/vxe-table/style/style.css +67 -52
  39. package/lib/vxe-table/style/style.min.css +1 -1
  40. package/package.json +2 -2
  41. package/packages/grid/src/grid.ts +1 -1
  42. package/packages/table/module/custom/hook.ts +136 -3
  43. package/packages/table/module/custom/panel.ts +186 -185
  44. package/packages/table/module/validator/hook.ts +1 -1
  45. package/packages/table/src/body.ts +14 -8
  46. package/packages/table/src/table.ts +77 -73
  47. package/packages/ui/index.ts +2 -1
  48. package/styles/components/table-module/custom.scss +23 -6
  49. package/styles/components/table.scss +36 -26
  50. /package/es/{iconfont.1730946045701.ttf → iconfont.1731028500961.ttf} +0 -0
  51. /package/es/{iconfont.1730946045701.woff → iconfont.1731028500961.woff} +0 -0
  52. /package/es/{iconfont.1730946045701.woff2 → iconfont.1731028500961.woff2} +0 -0
  53. /package/lib/{iconfont.1730946045701.ttf → iconfont.1731028500961.ttf} +0 -0
  54. /package/lib/{iconfont.1730946045701.woff → iconfont.1731028500961.woff} +0 -0
  55. /package/lib/{iconfont.1730946045701.woff2 → iconfont.1731028500961.woff2} +0 -0
@@ -4,7 +4,7 @@ var _vue = require("vue");
4
4
  var _ui = require("../../../ui");
5
5
  var _xeUtils = _interopRequireDefault(require("xe-utils"));
6
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
- const tableCustomMethodKeys = ['openCustom', 'closeCustom'];
7
+ const tableCustomMethodKeys = ['openCustom', 'closeCustom', 'saveCustom', 'cancelCustom', 'resetCustom', 'toggleCustomAllCheckbox', 'setCustomAllCheckbox'];
8
8
  _ui.VxeUI.hooks.add('tableCustomModule', {
9
9
  setupTable($xeTable) {
10
10
  const {
@@ -28,7 +28,7 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
28
28
  if (el) {
29
29
  tableHeight = el.clientHeight - 28;
30
30
  }
31
- customStore.maxHeight = Math.max(4, tableHeight);
31
+ customStore.maxHeight = Math.max(88, tableHeight);
32
32
  };
33
33
  const openCustom = () => {
34
34
  const {
@@ -75,9 +75,183 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
75
75
  }
76
76
  return (0, _vue.nextTick)();
77
77
  };
78
+ const saveCustom = () => {
79
+ const {
80
+ customColumnList
81
+ } = reactData;
82
+ const customOpts = computeCustomOpts.value;
83
+ const {
84
+ allowVisible,
85
+ allowSort,
86
+ allowFixed,
87
+ allowResizable
88
+ } = customOpts;
89
+ _xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
90
+ if (parent) {
91
+ // 更新子列信息
92
+ column.fixed = parent.fixed;
93
+ } else {
94
+ if (allowSort) {
95
+ const sortIndex = index + 1;
96
+ column.renderSortNumber = sortIndex;
97
+ }
98
+ if (allowFixed) {
99
+ column.fixed = column.renderFixed;
100
+ }
101
+ }
102
+ if (allowResizable) {
103
+ if (column.renderVisible && (!column.children || column.children.length)) {
104
+ if (column.renderResizeWidth !== column.renderWidth) {
105
+ column.resizeWidth = column.renderResizeWidth;
106
+ column.renderWidth = column.renderResizeWidth;
107
+ }
108
+ }
109
+ }
110
+ if (allowVisible) {
111
+ column.visible = column.renderVisible;
112
+ }
113
+ });
114
+ return $xeTable.saveCustomStore('confirm');
115
+ };
116
+ const cancelCustom = () => {
117
+ const {
118
+ customColumnList,
119
+ customStore
120
+ } = reactData;
121
+ const {
122
+ oldSortMaps,
123
+ oldFixedMaps,
124
+ oldVisibleMaps
125
+ } = customStore;
126
+ const customOpts = computeCustomOpts.value;
127
+ const {
128
+ allowVisible,
129
+ allowSort,
130
+ allowFixed,
131
+ allowResizable
132
+ } = customOpts;
133
+ _xeUtils.default.eachTree(customColumnList, column => {
134
+ const colid = column.getKey();
135
+ const visible = !!oldVisibleMaps[colid];
136
+ const fixed = oldFixedMaps[colid] || '';
137
+ if (allowVisible) {
138
+ column.renderVisible = visible;
139
+ column.visible = visible;
140
+ }
141
+ if (allowFixed) {
142
+ column.renderFixed = fixed;
143
+ column.fixed = fixed;
144
+ }
145
+ if (allowSort) {
146
+ column.renderSortNumber = oldSortMaps[colid] || 0;
147
+ }
148
+ if (allowResizable) {
149
+ column.renderResizeWidth = column.renderWidth;
150
+ }
151
+ }, {
152
+ children: 'children'
153
+ });
154
+ return (0, _vue.nextTick)();
155
+ };
156
+ const setCustomAllCheckbox = checked => {
157
+ const {
158
+ customStore
159
+ } = reactData;
160
+ const {
161
+ customColumnList
162
+ } = reactData;
163
+ const customOpts = computeCustomOpts.value;
164
+ const {
165
+ checkMethod,
166
+ visibleMethod
167
+ } = customOpts;
168
+ const isAll = !!checked;
169
+ if (customOpts.immediate) {
170
+ _xeUtils.default.eachTree(customColumnList, column => {
171
+ if (visibleMethod && !visibleMethod({
172
+ column
173
+ })) {
174
+ return;
175
+ }
176
+ if (checkMethod && !checkMethod({
177
+ column
178
+ })) {
179
+ return;
180
+ }
181
+ column.visible = isAll;
182
+ column.renderVisible = isAll;
183
+ column.halfVisible = false;
184
+ });
185
+ customStore.isAll = isAll;
186
+ $xeTable.handleCustom();
187
+ $xeTable.saveCustomStore('update:visible');
188
+ } else {
189
+ _xeUtils.default.eachTree(customColumnList, column => {
190
+ if (visibleMethod && !visibleMethod({
191
+ column
192
+ })) {
193
+ return;
194
+ }
195
+ if (checkMethod && !checkMethod({
196
+ column
197
+ })) {
198
+ return;
199
+ }
200
+ column.renderVisible = isAll;
201
+ column.halfVisible = false;
202
+ });
203
+ customStore.isAll = isAll;
204
+ }
205
+ $xeTable.checkCustomStatus();
206
+ return (0, _vue.nextTick)();
207
+ };
78
208
  const customMethods = {
79
209
  openCustom,
80
- closeCustom
210
+ closeCustom,
211
+ saveCustom,
212
+ cancelCustom,
213
+ resetCustom(options) {
214
+ const {
215
+ collectColumn
216
+ } = internalData;
217
+ const customOpts = computeCustomOpts.value;
218
+ const {
219
+ checkMethod
220
+ } = customOpts;
221
+ const opts = Object.assign({
222
+ visible: true,
223
+ resizable: options === true,
224
+ fixed: options === true,
225
+ sort: options === true
226
+ }, options);
227
+ _xeUtils.default.eachTree(collectColumn, column => {
228
+ if (opts.resizable) {
229
+ column.resizeWidth = 0;
230
+ }
231
+ if (opts.fixed) {
232
+ column.fixed = column.defaultFixed;
233
+ }
234
+ if (opts.sort) {
235
+ column.renderSortNumber = column.sortNumber;
236
+ }
237
+ if (!checkMethod || checkMethod({
238
+ column
239
+ })) {
240
+ column.visible = column.defaultVisible;
241
+ }
242
+ column.renderResizeWidth = column.renderWidth;
243
+ });
244
+ $xeTable.saveCustomStore('reset');
245
+ return $xeTable.handleCustom();
246
+ },
247
+ toggleCustomAllCheckbox() {
248
+ const {
249
+ customStore
250
+ } = reactData;
251
+ const isAll = !customStore.isAll;
252
+ return setCustomAllCheckbox(isAll);
253
+ },
254
+ setCustomAllCheckbox
81
255
  };
82
256
  const checkCustomStatus = () => {
83
257
  const {
@@ -1 +1 @@
1
- "use strict";var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const tableCustomMethodKeys=["openCustom","closeCustom"];_ui.VxeUI.hooks.add("tableCustomModule",{setupTable(s){const{reactData:u,internalData:l}=s,o=s.getComputeMaps()["computeCustomOpts"],i=s.getRefMaps()["refElem"],r=s.xegrid,n=()=>{var e=u["customStore"],t=i.value;let s=0;t&&(s=t.clientHeight-28),e.maxHeight=Math.max(4,s)},a=()=>{var{initStore:e,customStore:t}=u,s=l["collectColumn"];const o={},i={},r={};return _xeUtils.default.eachTree(s,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,o[t]=e.renderSortNumber,i[t]=e.fixed,r[t]=e.visible},{children:"children"}),t.oldSortMaps=o,t.oldFixedMaps=i,t.oldVisibleMaps=r,u.customColumnList=s.slice(0),t.visible=!0,e.custom=!0,m(),n(),(0,_vue.nextTick)().then(()=>n())},c=()=>{var e=u["customStore"],t=o.value;return e.visible&&(e.visible=!1,t.immediate||s.handleCustom()),(0,_vue.nextTick)()};var e={openCustom:a,closeCustom:c};const m=()=>{var e=u["customStore"],t=l["collectColumn"];const s=o.value["checkMethod"];e.isAll=t.every(e=>!!s&&!s({column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&t.some(e=>(!s||s({column:e}))&&(e.renderVisible||e.halfVisible))},v=(e,t)=>{(r||s).dispatchEvent("custom",{type:e},t)};var t={checkCustomStatus:m,emitCustomEvent:v,triggerCustomEvent(e){var t=s.reactData["customStore"];t.visible?(c(),v("close",e)):(t.btnEl=e.target,a(),v("open",e))},customOpenEvent(e){var t=u["customStore"];t.visible||(t.activeBtn=!0,t.btnEl=e.target,s.openCustom(),s.emitCustomEvent("open",e))},customCloseEvent(e){var t=u["customStore"];t.visible&&(t.activeBtn=!1,s.closeCustom(),s.emitCustomEvent("close",e))}};return Object.assign(Object.assign({},e),t)},setupGrid(e){return e.extendTableMethods(tableCustomMethodKeys)}});
1
+ "use strict";var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const tableCustomMethodKeys=["openCustom","closeCustom","saveCustom","cancelCustom","resetCustom","toggleCustomAllCheckbox","setCustomAllCheckbox"];_ui.VxeUI.hooks.add("tableCustomModule",{setupTable(a){const{reactData:c,internalData:o}=a,m=a.getComputeMaps()["computeCustomOpts"],s=a.getRefMaps()["refElem"],i=a.xegrid,u=()=>{var e=c["customStore"],t=s.value;let i=0;t&&(i=t.clientHeight-28),e.maxHeight=Math.max(88,i)},r=()=>{var{initStore:e,customStore:t}=c,i=o["collectColumn"];const s={},r={},l={};return _xeUtils.default.eachTree(i,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,s[t]=e.renderSortNumber,r[t]=e.fixed,l[t]=e.visible},{children:"children"}),t.oldSortMaps=s,t.oldFixedMaps=r,t.oldVisibleMaps=l,c.customColumnList=i.slice(0),t.visible=!0,e.custom=!0,n(),u(),(0,_vue.nextTick)().then(()=>u())},l=()=>{var e=c["customStore"],t=m.value;return e.visible&&(e.visible=!1,t.immediate||a.handleCustom()),(0,_vue.nextTick)()};const t=e=>{var t=c["customStore"],i=c["customColumnList"],s=m.value;const{checkMethod:r,visibleMethod:l}=s,o=!!e;return s.immediate?(_xeUtils.default.eachTree(i,e=>{l&&!l({column:e})||r&&!r({column:e})||(e.visible=o,e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o,a.handleCustom(),a.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(i,e=>{l&&!l({column:e})||r&&!r({column:e})||(e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o),a.checkCustomStatus(),(0,_vue.nextTick)()};var e={openCustom:r,closeCustom:l,saveCustom:()=>{var e=c["customColumnList"];const{allowVisible:l,allowSort:o,allowFixed:u,allowResizable:n}=m.value;return _xeUtils.default.eachTree(e,(e,t,i,s,r)=>{r?e.fixed=r.fixed:(o&&(e.renderSortNumber=t+1),u&&(e.fixed=e.renderFixed)),n&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),l&&(e.visible=e.renderVisible)}),a.saveCustomStore("confirm")},cancelCustom:()=>{var{customColumnList:e,customStore:t}=c;const{oldSortMaps:r,oldFixedMaps:l,oldVisibleMaps:o}=t,{allowVisible:u,allowSort:n,allowFixed:a,allowResizable:d}=m.value;return _xeUtils.default.eachTree(e,e=>{var t=e.getKey(),i=!!o[t],s=l[t]||"";u&&(e.renderVisible=i,e.visible=i),a&&(e.renderFixed=s,e.fixed=s),n&&(e.renderSortNumber=r[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),(0,_vue.nextTick)()},resetCustom(e){var t=o["collectColumn"];const i=m.value["checkMethod"],s=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e},e);return _xeUtils.default.eachTree(t,e=>{s.resizable&&(e.resizeWidth=0),s.fixed&&(e.fixed=e.defaultFixed),s.sort&&(e.renderSortNumber=e.sortNumber),i&&!i({column:e})||(e.visible=e.defaultVisible),e.renderResizeWidth=e.renderWidth}),a.saveCustomStore("reset"),a.handleCustom()},toggleCustomAllCheckbox(){var e=c["customStore"],e=!e.isAll;return t(e)},setCustomAllCheckbox:t};const n=()=>{var e=c["customStore"],t=o["collectColumn"];const i=m.value["checkMethod"];e.isAll=t.every(e=>!!i&&!i({column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&t.some(e=>(!i||i({column:e}))&&(e.renderVisible||e.halfVisible))},d=(e,t)=>{(i||a).dispatchEvent("custom",{type:e},t)};var v={checkCustomStatus:n,emitCustomEvent:d,triggerCustomEvent(e){var t=a.reactData["customStore"];t.visible?(l(),d("close",e)):(t.btnEl=e.target,r(),d("open",e))},customOpenEvent(e){var t=c["customStore"];t.visible||(t.activeBtn=!0,t.btnEl=e.target,a.openCustom(),a.emitCustomEvent("open",e))},customCloseEvent(e){var t=c["customStore"];t.visible&&(t.activeBtn=!1,a.closeCustom(),a.emitCustomEvent("close",e))}};return Object.assign(Object.assign({},e),v)},setupGrid(e){return e.extendTableMethods(tableCustomMethodKeys)}});
@@ -13,7 +13,8 @@ var _xeUtils = _interopRequireDefault(require("xe-utils"));
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  const {
15
15
  getI18n,
16
- getIcon
16
+ getIcon,
17
+ renderEmptyElement
17
18
  } = _ui.VxeUI;
18
19
  var _default = exports.default = (0, _vue.defineComponent)({
19
20
  name: 'TableCustomPanel',
@@ -27,7 +28,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
27
28
  const VxeUIModalComponent = _ui.VxeUI.getComponent('VxeModal');
28
29
  const VxeUIDrawerComponent = _ui.VxeUI.getComponent('VxeDrawer');
29
30
  const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
30
- const VxeUIInputComponent = _ui.VxeUI.getComponent('VxeInput');
31
+ const VxeUINumberInputComponent = _ui.VxeUI.getComponent('VxeNumberInput');
31
32
  const VxeUITooltipComponent = _ui.VxeUI.getComponent('VxeTooltip');
32
33
  const VxeUIRadioGroupComponent = _ui.VxeUI.getComponent('VxeRadioGroup');
33
34
  const $xeTable = (0, _vue.inject)('$xeTable', {});
@@ -37,7 +38,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
37
38
  const {
38
39
  computeCustomOpts,
39
40
  computeColumnOpts,
40
- computeIsMaxFixedColumn
41
+ computeIsMaxFixedColumn,
42
+ computeResizableOpts
41
43
  } = $xeTable.getComputeMaps();
42
44
  const refElem = (0, _vue.ref)();
43
45
  const bodyElemRef = (0, _vue.ref)();
@@ -65,44 +67,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
65
67
  const confirmCustomEvent = ({
66
68
  $event
67
69
  }) => {
68
- const {
69
- customColumnList
70
- } = reactData;
71
- const customOpts = computeCustomOpts.value;
72
- const {
73
- allowVisible,
74
- allowSort,
75
- allowFixed,
76
- allowResizable
77
- } = customOpts;
78
- _xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
79
- if (parent) {
80
- // 更新子列信息
81
- column.fixed = parent.fixed;
82
- } else {
83
- if (allowSort) {
84
- const sortIndex = index + 1;
85
- column.renderSortNumber = sortIndex;
86
- }
87
- if (allowFixed) {
88
- column.fixed = column.renderFixed;
89
- }
90
- }
91
- if (allowResizable) {
92
- if (column.renderVisible && (!column.children || column.children.length)) {
93
- if (column.renderResizeWidth !== column.renderWidth) {
94
- column.resizeWidth = column.renderResizeWidth;
95
- column.renderWidth = column.renderResizeWidth;
96
- }
97
- }
98
- }
99
- if (allowVisible) {
100
- column.visible = column.renderVisible;
101
- }
102
- });
70
+ $xeTable.saveCustom();
103
71
  $xeTable.closeCustom();
104
72
  $xeTable.emitCustomEvent('confirm', $event);
105
- $xeTable.saveCustomStore('confirm');
106
73
  };
107
74
  const cancelCloseEvent = ({
108
75
  $event
@@ -113,50 +80,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
113
80
  const cancelCustomEvent = ({
114
81
  $event
115
82
  }) => {
116
- const {
117
- customStore
118
- } = props;
119
- const {
120
- customColumnList
121
- } = reactData;
122
- const {
123
- oldSortMaps,
124
- oldFixedMaps,
125
- oldVisibleMaps
126
- } = customStore;
127
- const customOpts = computeCustomOpts.value;
128
- const {
129
- allowVisible,
130
- allowSort,
131
- allowFixed,
132
- allowResizable
133
- } = customOpts;
134
- _xeUtils.default.eachTree(customColumnList, column => {
135
- const colid = column.getKey();
136
- const visible = !!oldVisibleMaps[colid];
137
- const fixed = oldFixedMaps[colid] || '';
138
- if (allowVisible) {
139
- column.renderVisible = visible;
140
- column.visible = visible;
141
- }
142
- if (allowFixed) {
143
- column.renderFixed = fixed;
144
- column.fixed = fixed;
145
- }
146
- if (allowSort) {
147
- column.renderSortNumber = oldSortMaps[colid] || 0;
148
- }
149
- if (allowResizable) {
150
- column.renderResizeWidth = column.renderWidth;
151
- }
152
- }, {
153
- children: 'children'
154
- });
83
+ $xeTable.cancelCustom();
155
84
  $xeTable.closeCustom();
156
85
  $xeTable.emitCustomEvent('cancel', $event);
157
86
  };
158
87
  const handleResetCustomEvent = evnt => {
159
- $xeTable.resetColumn(true);
88
+ $xeTable.resetCustom(true);
160
89
  $xeTable.closeCustom();
161
90
  $xeTable.emitCustomEvent('reset', evnt);
162
91
  };
@@ -247,55 +176,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
247
176
  }
248
177
  };
249
178
  const allOptionEvent = () => {
250
- const {
251
- customStore
252
- } = props;
253
- const {
254
- customColumnList
255
- } = reactData;
256
- const customOpts = computeCustomOpts.value;
257
- const {
258
- checkMethod,
259
- visibleMethod
260
- } = customOpts;
261
- const isAll = !customStore.isAll;
262
- if (customOpts.immediate) {
263
- _xeUtils.default.eachTree(customColumnList, column => {
264
- if (visibleMethod && !visibleMethod({
265
- column
266
- })) {
267
- return;
268
- }
269
- if (checkMethod && !checkMethod({
270
- column
271
- })) {
272
- return;
273
- }
274
- column.visible = isAll;
275
- column.renderVisible = isAll;
276
- column.halfVisible = false;
277
- });
278
- customStore.isAll = isAll;
279
- $xeTable.handleCustom();
280
- $xeTable.saveCustomStore('update:visible');
281
- } else {
282
- _xeUtils.default.eachTree(customColumnList, column => {
283
- if (visibleMethod && !visibleMethod({
284
- column
285
- })) {
286
- return;
287
- }
288
- if (checkMethod && !checkMethod({
289
- column
290
- })) {
291
- return;
292
- }
293
- column.renderVisible = isAll;
294
- column.halfVisible = false;
295
- });
296
- customStore.isAll = isAll;
297
- }
298
- $xeTable.checkCustomStatus();
179
+ $xeTable.toggleCustomAllCheckbox();
299
180
  };
300
181
  const sortMousedownEvent = evnt => {
301
182
  const btnEl = evnt.currentTarget;
@@ -306,6 +187,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
306
187
  trEl.draggable = true;
307
188
  dragColumnRef.value = column;
308
189
  (0, _dom.addClass)(trEl, 'active--drag-origin');
190
+ updateDropHint(evnt);
309
191
  };
310
192
  const sortMouseupEvent = evnt => {
311
193
  const btnEl = evnt.currentTarget;
@@ -429,13 +311,29 @@ var _default = exports.default = (0, _vue.defineComponent)({
429
311
  placement
430
312
  } = customOpts;
431
313
  const isMaxFixedColumn = computeIsMaxFixedColumn.value;
314
+ const slots = customOpts.slots || {};
315
+ const headerSlot = slots.header;
316
+ const topSlot = slots.top;
317
+ const bottomSlot = slots.bottom;
318
+ const defaultSlot = slots.default;
319
+ const footerSlot = slots.footer;
432
320
  const colVNs = [];
433
321
  const customWrapperOns = {};
322
+ const isAllChecked = customStore.isAll;
323
+ const isAllIndeterminate = customStore.isIndeterminate;
324
+ const dragColumn = dragColumnRef.value;
434
325
  // hover 触发
435
326
  if (trigger === 'hover') {
436
327
  customWrapperOns.onMouseenter = handleWrapperMouseenterEvent;
437
328
  customWrapperOns.onMouseleave = handleWrapperMouseleaveEvent;
438
329
  }
330
+ const params = {
331
+ $table: $xeTable,
332
+ $grid: $xeTable.xegrid,
333
+ columns: customColumnList,
334
+ isAllChecked,
335
+ isAllIndeterminate
336
+ };
439
337
  _xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
440
338
  const isVisible = visibleMethod ? visibleMethod({
441
339
  column
@@ -515,9 +413,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
515
413
  }) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)()]));
516
414
  }
517
415
  });
518
- const isAllChecked = customStore.isAll;
519
- const isAllIndeterminate = customStore.isIndeterminate;
520
- const dragColumn = dragColumnRef.value;
521
416
  return (0, _vue.h)('div', {
522
417
  ref: refElem,
523
418
  key: 'simple',
@@ -527,8 +422,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
527
422
  style: maxHeight && !['left', 'right'].includes(placement) ? {
528
423
  maxHeight: `${maxHeight}px`
529
424
  } : {}
530
- }, customStore.visible ? [(0, _vue.h)('ul', {
425
+ }, customStore.visible ? [(0, _vue.h)('div', {
531
426
  class: 'vxe-table-custom--header'
427
+ }, headerSlot ? $xeTable.callSlot(headerSlot, params) : [(0, _vue.h)('ul', {
428
+ class: 'vxe-table-custom--panel-list'
532
429
  }, [(0, _vue.h)('li', {
533
430
  class: 'vxe-table-custom--option'
534
431
  }, [allowVisible ? (0, _vue.h)('div', {
@@ -544,20 +441,28 @@ var _default = exports.default = (0, _vue.defineComponent)({
544
441
  class: 'vxe-checkbox--label'
545
442
  }, getI18n('vxe.toolbar.customAll'))]) : (0, _vue.h)('span', {
546
443
  class: 'vxe-checkbox--label'
547
- }, getI18n('vxe.table.customTitle'))])]), (0, _vue.h)('div', {
444
+ }, getI18n('vxe.table.customTitle'))])])]), (0, _vue.h)('div', {
548
445
  ref: bodyElemRef,
549
- class: 'vxe-table-custom--list-wrapper'
550
- }, [(0, _vue.h)(_vue.TransitionGroup, Object.assign({
551
- class: 'vxe-table-custom--body',
446
+ class: 'vxe-table-custom--body'
447
+ }, [topSlot ? (0, _vue.h)('div', {
448
+ class: 'vxe-table-custom--panel-top'
449
+ }, $xeTable.callSlot(topSlot, params)) : renderEmptyElement($xeTable), defaultSlot ? (0, _vue.h)('div', {
450
+ class: 'vxe-table-custom--panel-body'
451
+ }, $xeTable.callSlot(defaultSlot, params)) : (0, _vue.h)(_vue.TransitionGroup, Object.assign({
452
+ class: 'vxe-table-custom--panel-list',
552
453
  name: 'vxe-table-custom--list',
553
454
  tag: 'ul'
554
455
  }, customWrapperOns), {
555
456
  default: () => colVNs
556
- }), (0, _vue.h)('div', {
457
+ }), bottomSlot ? (0, _vue.h)('div', {
458
+ class: 'vxe-table-custom--panel-bottom'
459
+ }, $xeTable.callSlot(bottomSlot, params)) : renderEmptyElement($xeTable), (0, _vue.h)('div', {
557
460
  ref: dragHintElemRef,
558
461
  class: 'vxe-table-custom-popup--drag-hint'
559
462
  }, getI18n('vxe.custom.cstmDragTarget', [dragColumn && dragColumn.type !== 'html' ? dragColumn.getTitle() : '']))]), customOpts.showFooter ? (0, _vue.h)('div', {
560
463
  class: 'vxe-table-custom--footer'
464
+ }, footerSlot ? $xeTable.callSlot(footerSlot, params) : [(0, _vue.h)('div', {
465
+ class: 'vxe-table-custom--footer-buttons'
561
466
  }, [VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
562
467
  mode: 'text',
563
468
  content: customOpts.resetButtonText || getI18n('vxe.table.customRestore'),
@@ -575,7 +480,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
575
480
  status: 'primary',
576
481
  content: customOpts.confirmButtonText || getI18n('vxe.table.customConfirm'),
577
482
  onClick: confirmCustomEvent
578
- }) : (0, _vue.createCommentVNode)()]) : null] : []);
483
+ }) : (0, _vue.createCommentVNode)()])]) : null] : []);
579
484
  };
580
485
  const renderPopupPanel = () => {
581
486
  const {
@@ -599,18 +504,57 @@ var _default = exports.default = (0, _vue.defineComponent)({
599
504
  const {
600
505
  maxFixedSize
601
506
  } = columnOpts;
507
+ const resizableOpts = computeResizableOpts.value;
508
+ const {
509
+ minWidth: reMinWidth,
510
+ maxWidth: reMaxWidth
511
+ } = resizableOpts;
602
512
  const {
603
513
  mode
604
514
  } = customOpts;
605
515
  const modalOpts = Object.assign({}, modalOptions);
606
516
  const drawerOpts = Object.assign({}, drawerOptions);
607
517
  const isMaxFixedColumn = computeIsMaxFixedColumn.value;
518
+ const slots = customOpts.slots || {};
519
+ const headerSlot = slots.header;
520
+ const topSlot = slots.top;
521
+ const bottomSlot = slots.bottom;
522
+ const defaultSlot = slots.default;
523
+ const footerSlot = slots.footer;
608
524
  const trVNs = [];
525
+ const isAllChecked = customStore.isAll;
526
+ const isAllIndeterminate = customStore.isIndeterminate;
527
+ const dragColumn = dragColumnRef.value;
528
+ const params = {
529
+ $table: $xeTable,
530
+ $grid: $xeTable.xegrid,
531
+ columns: customColumnList,
532
+ isAllChecked,
533
+ isAllIndeterminate
534
+ };
609
535
  _xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
610
536
  const isVisible = visibleMethod ? visibleMethod({
611
537
  column
612
538
  }) : true;
613
539
  if (isVisible) {
540
+ // 默认继承调整宽度
541
+ let customMinWidth = 0;
542
+ let customMaxWidth = 0;
543
+ if (allowResizable) {
544
+ const resizeParams = {
545
+ $table: $xeTable,
546
+ column,
547
+ columnIndex: index,
548
+ $columnIndex: index,
549
+ $rowIndex: -1
550
+ };
551
+ if (reMinWidth) {
552
+ customMinWidth = _xeUtils.default.toNumber(_xeUtils.default.isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth);
553
+ }
554
+ if (reMaxWidth) {
555
+ customMaxWidth = _xeUtils.default.toNumber(_xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth);
556
+ }
557
+ }
614
558
  const isChecked = column.renderVisible;
615
559
  const isIndeterminate = column.halfVisible;
616
560
  const colTitle = (0, _utils.formatText)(column.getTitle(), 1);
@@ -668,10 +612,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
668
612
  title: colTitle
669
613
  }, colTitle)]), allowResizable ? (0, _vue.h)('td', {
670
614
  class: 'vxe-table-custom-popup--column-item col--resizable'
671
- }, [column.children && column.children.length ? (0, _vue.h)('span', '-') : VxeUIInputComponent ? (0, _vue.h)(VxeUIInputComponent, {
615
+ }, [column.children && column.children.length ? (0, _vue.h)('span', '-') : VxeUINumberInputComponent ? (0, _vue.h)(VxeUINumberInputComponent, {
672
616
  type: 'integer',
673
617
  disabled: isDisabled || isHidden,
674
618
  modelValue: column.renderResizeWidth,
619
+ min: customMinWidth || undefined,
620
+ max: customMaxWidth || undefined,
675
621
  'onUpdate:modelValue'(value) {
676
622
  column.renderResizeWidth = Math.max(0, Number(value));
677
623
  }
@@ -701,36 +647,28 @@ var _default = exports.default = (0, _vue.defineComponent)({
701
647
  }) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)()]));
702
648
  }
703
649
  });
704
- const isAllChecked = customStore.isAll;
705
- const isAllIndeterminate = customStore.isIndeterminate;
706
- const dragColumn = dragColumnRef.value;
707
650
  const scopedSlots = {
708
651
  default: () => {
652
+ if (defaultSlot) {
653
+ return $xeTable.callSlot(defaultSlot, params);
654
+ }
709
655
  return (0, _vue.h)('div', {
710
656
  ref: bodyElemRef,
711
657
  class: 'vxe-table-custom-popup--body'
712
- }, [(0, _vue.h)('div', {
658
+ }, [topSlot ? (0, _vue.h)('div', {
659
+ class: 'vxe-table-custom-popup--table-top'
660
+ }, $xeTable.callSlot(topSlot, params)) : renderEmptyElement($xeTable), (0, _vue.h)('div', {
713
661
  class: 'vxe-table-custom-popup--table-wrapper'
714
662
  }, [(0, _vue.h)('table', {}, [(0, _vue.h)('colgroup', {}, [allowVisible ? (0, _vue.h)('col', {
715
- style: {
716
- width: '80px'
717
- }
663
+ class: 'vxe-table-custom-popup--table-col-seq'
718
664
  }) : (0, _vue.createCommentVNode)(), allowSort ? (0, _vue.h)('col', {
719
- style: {
720
- width: '80px'
721
- }
665
+ class: 'vxe-table-custom-popup--table-col-sort'
722
666
  }) : (0, _vue.createCommentVNode)(), (0, _vue.h)('col', {
723
- style: {
724
- minWidth: '120px'
725
- }
667
+ class: 'vxe-table-custom-popup--table-col-title'
726
668
  }), allowResizable ? (0, _vue.h)('col', {
727
- style: {
728
- width: '140px'
729
- }
669
+ class: 'vxe-table-custom-popup--table-col-width'
730
670
  }) : (0, _vue.createCommentVNode)(), allowFixed ? (0, _vue.h)('col', {
731
- style: {
732
- width: '200px'
733
- }
671
+ class: 'vxe-table-custom-popup--table-col-fixed'
734
672
  }) : (0, _vue.createCommentVNode)()]), (0, _vue.h)('thead', {}, [(0, _vue.h)('tr', {}, [allowVisible ? (0, _vue.h)('th', {}, [(0, _vue.h)('div', {
735
673
  class: ['vxe-table-custom--checkbox-option', {
736
674
  'is--checked': isAllChecked,
@@ -755,17 +693,22 @@ var _default = exports.default = (0, _vue.defineComponent)({
755
693
  });
756
694
  }
757
695
  }) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colTitle')), allowResizable ? (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colResizable')) : (0, _vue.createCommentVNode)(), allowFixed ? (0, _vue.h)('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize])) : (0, _vue.createCommentVNode)()])]), (0, _vue.h)(_vue.TransitionGroup, {
758
- class: 'vxe-table-custom--body',
696
+ class: 'vxe-table-custom--panel-list',
759
697
  tag: 'tbody',
760
698
  name: 'vxe-table-custom--list'
761
699
  }, {
762
700
  default: () => trVNs
763
- })])]), (0, _vue.h)('div', {
701
+ })])]), bottomSlot ? (0, _vue.h)('div', {
702
+ class: 'vxe-table-custom-popup--table-bottom'
703
+ }, $xeTable.callSlot(bottomSlot, params)) : renderEmptyElement($xeTable), (0, _vue.h)('div', {
764
704
  ref: dragHintElemRef,
765
705
  class: 'vxe-table-custom-popup--drag-hint'
766
706
  }, getI18n('vxe.custom.cstmDragTarget', [dragColumn ? dragColumn.getTitle() : '']))]);
767
707
  },
768
708
  footer: () => {
709
+ if (footerSlot) {
710
+ return $xeTable.callSlot(footerSlot, params);
711
+ }
769
712
  return (0, _vue.h)('div', {
770
713
  class: 'vxe-table-custom-popup--footer'
771
714
  }, [VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
@@ -781,6 +724,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
781
724
  }) : (0, _vue.createCommentVNode)()]);
782
725
  }
783
726
  };
727
+ if (headerSlot) {
728
+ scopedSlots.header = () => $xeTable.callSlot(headerSlot, params);
729
+ }
784
730
  if (mode === 'drawer') {
785
731
  return VxeUIDrawerComponent ? (0, _vue.h)(VxeUIDrawerComponent, {
786
732
  key: 'drawer',
@@ -842,8 +788,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
842
788
  if (!VxeUIButtonComponent) {
843
789
  (0, _log.errLog)('vxe.error.reqComp', ['vxe-button']);
844
790
  }
845
- if (!VxeUIInputComponent) {
846
- (0, _log.errLog)('vxe.error.reqComp', ['vxe-input']);
791
+ if (!VxeUINumberInputComponent) {
792
+ (0, _log.errLog)('vxe.error.reqComp', ['vxe-number-input']);
847
793
  }
848
794
  if (!VxeUITooltipComponent) {
849
795
  (0, _log.errLog)('vxe.error.reqComp', ['vxe-tooltip']);