vxe-table 4.19.22 → 4.19.24

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 (183) hide show
  1. package/dist/all.esm.js +634 -335
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/{iconfont.1782890314097.ttf → iconfont.1783331249334.ttf} +0 -0
  5. package/es/iconfont.1783331249334.woff +0 -0
  6. package/es/iconfont.1783331249334.woff2 +0 -0
  7. package/es/index.css +1 -1
  8. package/es/index.min.css +1 -1
  9. package/es/locale/lang/ar-EG.js +12 -3
  10. package/es/locale/lang/de-DE.js +12 -3
  11. package/es/locale/lang/en-US.js +16 -7
  12. package/es/locale/lang/es-ES.js +12 -3
  13. package/es/locale/lang/fr-FR.js +12 -3
  14. package/es/locale/lang/hu-HU.js +12 -3
  15. package/es/locale/lang/hy-AM.js +12 -3
  16. package/es/locale/lang/id-ID.js +12 -3
  17. package/es/locale/lang/it-IT.js +11 -2
  18. package/es/locale/lang/ja-JP.js +12 -3
  19. package/es/locale/lang/ko-KR.js +12 -3
  20. package/es/locale/lang/ms-MY.js +12 -3
  21. package/es/locale/lang/nb-NO.js +12 -3
  22. package/es/locale/lang/pt-BR.js +12 -3
  23. package/es/locale/lang/ru-RU.js +12 -3
  24. package/es/locale/lang/th-TH.js +12 -3
  25. package/es/locale/lang/ug-CN.js +12 -3
  26. package/es/locale/lang/uk-UA.js +12 -3
  27. package/es/locale/lang/uz-UZ.js +12 -3
  28. package/es/locale/lang/vi-VN.js +11 -2
  29. package/es/locale/lang/zh-CHT.js +14 -5
  30. package/es/locale/lang/zh-CN.js +14 -5
  31. package/es/style.css +1 -1
  32. package/es/style.min.css +1 -1
  33. package/es/table/module/custom/hook.js +83 -12
  34. package/es/table/module/custom/panel.js +398 -257
  35. package/es/table/src/cell.js +2 -2
  36. package/es/table/src/columnInfo.js +14 -8
  37. package/es/table/src/emits.js +3 -0
  38. package/es/table/src/table.js +78 -46
  39. package/es/table/src/util.js +32 -1
  40. package/es/table/style.css +96 -49
  41. package/es/table/style.min.css +1 -1
  42. package/es/ui/index.js +16 -4
  43. package/es/ui/src/log.js +1 -1
  44. package/es/vxe-table/style.css +96 -49
  45. package/es/vxe-table/style.min.css +1 -1
  46. package/lib/{iconfont.1782890314097.ttf → iconfont.1783331249334.ttf} +0 -0
  47. package/lib/iconfont.1783331249334.woff +0 -0
  48. package/lib/iconfont.1783331249334.woff2 +0 -0
  49. package/lib/index.css +1 -1
  50. package/lib/index.min.css +1 -1
  51. package/lib/index.umd.js +521 -181
  52. package/lib/index.umd.min.js +1 -1
  53. package/lib/locale/lang/ar-EG.js +12 -3
  54. package/lib/locale/lang/ar-EG.min.js +1 -1
  55. package/lib/locale/lang/ar-EG.umd.js +12 -3
  56. package/lib/locale/lang/de-DE.js +12 -3
  57. package/lib/locale/lang/de-DE.min.js +1 -1
  58. package/lib/locale/lang/de-DE.umd.js +12 -3
  59. package/lib/locale/lang/en-US.js +16 -7
  60. package/lib/locale/lang/en-US.min.js +1 -1
  61. package/lib/locale/lang/en-US.umd.js +16 -7
  62. package/lib/locale/lang/es-ES.js +12 -3
  63. package/lib/locale/lang/es-ES.min.js +1 -1
  64. package/lib/locale/lang/es-ES.umd.js +12 -3
  65. package/lib/locale/lang/fr-FR.js +12 -3
  66. package/lib/locale/lang/fr-FR.min.js +1 -1
  67. package/lib/locale/lang/fr-FR.umd.js +12 -3
  68. package/lib/locale/lang/hu-HU.js +12 -3
  69. package/lib/locale/lang/hu-HU.min.js +1 -1
  70. package/lib/locale/lang/hu-HU.umd.js +12 -3
  71. package/lib/locale/lang/hy-AM.js +12 -3
  72. package/lib/locale/lang/hy-AM.min.js +1 -1
  73. package/lib/locale/lang/hy-AM.umd.js +12 -3
  74. package/lib/locale/lang/id-ID.js +12 -3
  75. package/lib/locale/lang/id-ID.min.js +1 -1
  76. package/lib/locale/lang/id-ID.umd.js +12 -3
  77. package/lib/locale/lang/it-IT.js +11 -2
  78. package/lib/locale/lang/it-IT.min.js +1 -1
  79. package/lib/locale/lang/it-IT.umd.js +11 -2
  80. package/lib/locale/lang/ja-JP.js +12 -3
  81. package/lib/locale/lang/ja-JP.min.js +1 -1
  82. package/lib/locale/lang/ja-JP.umd.js +12 -3
  83. package/lib/locale/lang/ko-KR.js +12 -3
  84. package/lib/locale/lang/ko-KR.min.js +1 -1
  85. package/lib/locale/lang/ko-KR.umd.js +12 -3
  86. package/lib/locale/lang/ms-MY.js +12 -3
  87. package/lib/locale/lang/ms-MY.min.js +1 -1
  88. package/lib/locale/lang/ms-MY.umd.js +12 -3
  89. package/lib/locale/lang/nb-NO.js +12 -3
  90. package/lib/locale/lang/nb-NO.min.js +1 -1
  91. package/lib/locale/lang/nb-NO.umd.js +12 -3
  92. package/lib/locale/lang/pt-BR.js +12 -3
  93. package/lib/locale/lang/pt-BR.min.js +1 -1
  94. package/lib/locale/lang/pt-BR.umd.js +12 -3
  95. package/lib/locale/lang/ru-RU.js +12 -3
  96. package/lib/locale/lang/ru-RU.min.js +1 -1
  97. package/lib/locale/lang/ru-RU.umd.js +12 -3
  98. package/lib/locale/lang/th-TH.js +12 -3
  99. package/lib/locale/lang/th-TH.min.js +1 -1
  100. package/lib/locale/lang/th-TH.umd.js +12 -3
  101. package/lib/locale/lang/ug-CN.js +12 -3
  102. package/lib/locale/lang/ug-CN.min.js +1 -1
  103. package/lib/locale/lang/ug-CN.umd.js +12 -3
  104. package/lib/locale/lang/uk-UA.js +12 -3
  105. package/lib/locale/lang/uk-UA.min.js +1 -1
  106. package/lib/locale/lang/uk-UA.umd.js +12 -3
  107. package/lib/locale/lang/uz-UZ.js +12 -3
  108. package/lib/locale/lang/uz-UZ.min.js +1 -1
  109. package/lib/locale/lang/uz-UZ.umd.js +12 -3
  110. package/lib/locale/lang/vi-VN.js +11 -2
  111. package/lib/locale/lang/vi-VN.min.js +1 -1
  112. package/lib/locale/lang/vi-VN.umd.js +11 -2
  113. package/lib/locale/lang/zh-CHT.js +14 -5
  114. package/lib/locale/lang/zh-CHT.min.js +1 -1
  115. package/lib/locale/lang/zh-CHT.umd.js +14 -5
  116. package/lib/locale/lang/zh-CN.js +14 -5
  117. package/lib/locale/lang/zh-CN.min.js +1 -1
  118. package/lib/locale/lang/zh-CN.umd.js +14 -5
  119. package/lib/style.css +1 -1
  120. package/lib/style.min.css +1 -1
  121. package/lib/table/module/custom/hook.js +90 -10
  122. package/lib/table/module/custom/hook.min.js +1 -1
  123. package/lib/table/module/custom/panel.js +333 -141
  124. package/lib/table/module/custom/panel.min.js +1 -1
  125. package/lib/table/src/cell.js +2 -1
  126. package/lib/table/src/cell.min.js +1 -1
  127. package/lib/table/src/columnInfo.js +17 -7
  128. package/lib/table/src/columnInfo.min.js +1 -1
  129. package/lib/table/src/emits.js +1 -1
  130. package/lib/table/src/emits.min.js +1 -1
  131. package/lib/table/src/table.js +10 -10
  132. package/lib/table/src/table.min.js +1 -1
  133. package/lib/table/src/util.js +38 -1
  134. package/lib/table/src/util.min.js +1 -1
  135. package/lib/table/style/style.css +96 -49
  136. package/lib/table/style/style.min.css +1 -1
  137. package/lib/ui/index.js +16 -4
  138. package/lib/ui/index.min.js +1 -1
  139. package/lib/ui/src/log.js +1 -1
  140. package/lib/ui/src/log.min.js +1 -1
  141. package/lib/vxe-table/style/style.css +96 -49
  142. package/lib/vxe-table/style/style.min.css +1 -1
  143. package/package.json +2 -2
  144. package/packages/locale/lang/ar-EG.ts +12 -3
  145. package/packages/locale/lang/de-DE.ts +12 -3
  146. package/packages/locale/lang/en-US.ts +16 -7
  147. package/packages/locale/lang/es-ES.ts +12 -3
  148. package/packages/locale/lang/fr-FR.ts +12 -3
  149. package/packages/locale/lang/hu-HU.ts +12 -3
  150. package/packages/locale/lang/hy-AM.ts +12 -3
  151. package/packages/locale/lang/id-ID.ts +12 -3
  152. package/packages/locale/lang/it-IT.ts +11 -2
  153. package/packages/locale/lang/ja-JP.ts +12 -3
  154. package/packages/locale/lang/ko-KR.ts +12 -3
  155. package/packages/locale/lang/ms-MY.ts +12 -3
  156. package/packages/locale/lang/nb-NO.ts +12 -3
  157. package/packages/locale/lang/pt-BR.ts +12 -3
  158. package/packages/locale/lang/ru-RU.ts +12 -3
  159. package/packages/locale/lang/th-TH.ts +12 -3
  160. package/packages/locale/lang/ug-CN.ts +12 -3
  161. package/packages/locale/lang/uk-UA.ts +12 -3
  162. package/packages/locale/lang/uz-UZ.ts +12 -3
  163. package/packages/locale/lang/vi-VN.ts +11 -2
  164. package/packages/locale/lang/zh-CHT.ts +14 -5
  165. package/packages/locale/lang/zh-CN.ts +14 -5
  166. package/packages/table/module/custom/hook.ts +83 -12
  167. package/packages/table/module/custom/panel.ts +481 -286
  168. package/packages/table/src/cell.ts +2 -2
  169. package/packages/table/src/columnInfo.ts +14 -8
  170. package/packages/table/src/emits.ts +3 -0
  171. package/packages/table/src/table.ts +89 -47
  172. package/packages/table/src/util.ts +35 -1
  173. package/packages/ui/index.ts +15 -3
  174. package/styles/components/icon.scss +29 -2
  175. package/styles/components/table-module/custom.scss +88 -67
  176. package/styles/icon/iconfont.ttf +0 -0
  177. package/styles/icon/iconfont.woff +0 -0
  178. package/styles/icon/iconfont.woff2 +0 -0
  179. package/styles/theme/base.scss +11 -0
  180. package/es/iconfont.1782890314097.woff +0 -0
  181. package/es/iconfont.1782890314097.woff2 +0 -0
  182. package/lib/iconfont.1782890314097.woff +0 -0
  183. package/lib/iconfont.1782890314097.woff2 +0 -0
@@ -7,6 +7,7 @@ var _util = require("../../src/util");
7
7
  var _dom = require("../../../ui/src/dom");
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const tableCustomMethodKeys = ['openCustom', 'closeCustom', 'getCustomVisible', 'toggleCustom', 'saveCustom', 'cancelCustom', 'resetCustom', 'toggleCustomAllCheckbox', 'setCustomAllCheckbox'];
10
+ const customColumnCssKeys = ['checkbox', 'sort', 'title', 'width', 'fixed', 'align', 'header-align', 'footer-align'];
10
11
  _ui.VxeUI.hooks.add('tableCustomModule', {
11
12
  setupTable($xeTable) {
12
13
  const {
@@ -37,6 +38,8 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
37
38
  const showSimple = !(mode === 'modal' || mode === 'drawer');
38
39
  const {
39
40
  transfer,
41
+ minWidth,
42
+ maxWidth,
40
43
  maxHeight
41
44
  } = popupOptions || {};
42
45
  const customSimpleMode = computeCustomSimpleMode.value;
@@ -45,7 +48,8 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
45
48
  let wrapperEl = refElem.value;
46
49
  let popupTop = 0;
47
50
  let popupMaxHeight = 0;
48
- const popupStys = {};
51
+ const defPupStys = {};
52
+ const panePupStys = {};
49
53
  if ($xeGantt) {
50
54
  const {
51
55
  refGanttContainerElem
@@ -78,23 +82,40 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
78
82
  }
79
83
  if (!placement || !['left', 'right', 'bottom-left', 'bottom-right'].includes(placement)) {
80
84
  if (popupTop) {
81
- popupStys.top = (0, _dom.toCssUnit)(popupTop);
85
+ defPupStys.top = (0, _dom.toCssUnit)(popupTop);
82
86
  }
83
87
  }
84
88
  if (showSimple && transfer) {
85
89
  if (placement === 'bottom-left' || placement === 'bottom-right') {
86
- popupStys.bottom = (0, _dom.toCssUnit)(bodyEl.scrollHeight - tableRect.top - tableRect.height + 1);
90
+ defPupStys.bottom = (0, _dom.toCssUnit)(bodyEl.scrollHeight - tableRect.top - tableRect.height + 1);
87
91
  }
88
92
  if (placement === 'top-left' || placement === 'bottom-left') {
89
- popupStys.left = (0, _dom.toCssUnit)(tableRect.left);
93
+ defPupStys.left = (0, _dom.toCssUnit)(tableRect.left);
90
94
  } else if (!placement || placement === 'top-right' || placement === 'bottom-right') {
91
- popupStys.right = (0, _dom.toCssUnit)(bodyEl.scrollWidth - tableRect.left - tableRect.width + 1);
95
+ defPupStys.right = (0, _dom.toCssUnit)(bodyEl.scrollWidth - tableRect.left - tableRect.width + 1);
92
96
  }
93
97
  }
98
+ // 同步表格的css变量到弹窗中
99
+ const bodyComputeStyle = getComputedStyle(bodyEl);
100
+ const tableComputeStyle = getComputedStyle(wrapperEl);
101
+ customColumnCssKeys.forEach(key => {
102
+ const currCssKey = `--vxe-ui-vxe-table-custom-column-${key}-${key === 'title' ? 'min-' : ''}width`;
103
+ const currCssVal = tableComputeStyle.getPropertyValue(currCssKey);
104
+ if (currCssVal && currCssVal !== bodyComputeStyle.getPropertyValue(currCssKey)) {
105
+ panePupStys[currCssKey] = currCssVal;
106
+ }
107
+ });
108
+ if (minWidth) {
109
+ defPupStys['--vxe-ui-vxe-table-custom-default-min-width'] = (0, _dom.toCssUnit)(minWidth);
110
+ }
111
+ if (maxWidth) {
112
+ defPupStys['--vxe-ui-vxe-table-custom-default-max-width'] = (0, _dom.toCssUnit)(maxWidth);
113
+ }
94
114
  if (popupMxHeight) {
95
- popupStys.maxHeight = (0, _dom.toCssUnit)(popupMxHeight);
115
+ defPupStys.maxHeight = (0, _dom.toCssUnit)(popupMxHeight);
96
116
  }
97
- customStore.popupStyle = popupStys;
117
+ customStore.defPopupStyle = defPupStys;
118
+ customStore.panePopupStyle = panePupStys;
98
119
  customStore.maxHeight = popupMxHeight;
99
120
  return (0, _vue.nextTick)();
100
121
  };
@@ -156,6 +177,9 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
156
177
  column.renderFixed = column.fixed;
157
178
  column.renderVisible = column.visible;
158
179
  column.renderResizeWidth = column.renderWidth;
180
+ column.renderAlign = column.align;
181
+ column.renderHeaderAlign = column.headerAlign;
182
+ column.renderFooterAlign = column.footerAlign;
159
183
  sortMaps[colid] = column.renderSortNumber;
160
184
  fixedMaps[colid] = column.fixed;
161
185
  visibleMaps[colid] = column.visible;
@@ -200,10 +224,21 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
200
224
  allowSort,
201
225
  allowFixed,
202
226
  allowResizable,
227
+ allowAlign,
228
+ allowHeaderAlign,
229
+ allowFooterAlign,
203
230
  allowGroup,
204
231
  allowValues
205
232
  } = customOpts;
206
- if (!isDirectly) {
233
+ if (isDirectly) {
234
+ _xeUtils.default.eachTree(customColumnList, column => {
235
+ if (allowResizable) {
236
+ if (column.renderVisible && (!column.children || !column.children.length)) {
237
+ column.resizeWidth = Math.max(0, _xeUtils.default.toNumber(column.renderWidth));
238
+ }
239
+ }
240
+ });
241
+ } else {
207
242
  _xeUtils.default.eachTree(customColumnList, (column, index, items, path, parentColumn) => {
208
243
  if (parentColumn) {
209
244
  // 更新子列信息
@@ -228,6 +263,15 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
228
263
  if (allowVisible) {
229
264
  column.visible = column.renderVisible;
230
265
  }
266
+ if (allowAlign) {
267
+ column.align = column.renderAlign;
268
+ }
269
+ if (allowHeaderAlign) {
270
+ column.headerAlign = column.renderHeaderAlign;
271
+ }
272
+ if (allowFooterAlign) {
273
+ column.footerAlign = column.renderFooterAlign;
274
+ }
231
275
  if (allowGroup && allowValues) {
232
276
  column.aggFunc = column.renderAggFn;
233
277
  }
@@ -267,7 +311,12 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
267
311
  allowVisible,
268
312
  allowSort,
269
313
  allowFixed,
270
- allowResizable
314
+ allowAlign,
315
+ allowHeaderAlign,
316
+ allowFooterAlign,
317
+ allowResizable,
318
+ allowGroup,
319
+ allowValues
271
320
  } = customOpts;
272
321
  _xeUtils.default.eachTree(customColumnList, column => {
273
322
  const colid = column.getKey();
@@ -287,6 +336,21 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
287
336
  if (allowResizable) {
288
337
  column.renderResizeWidth = column.renderWidth;
289
338
  }
339
+ if (allowAlign) {
340
+ column.align = column.renderAlign;
341
+ }
342
+ if (allowHeaderAlign) {
343
+ column.headerAlign = column.renderHeaderAlign;
344
+ }
345
+ if (allowFooterAlign) {
346
+ column.footerAlign = column.renderFooterAlign;
347
+ }
348
+ if (allowGroup) {
349
+ // 无
350
+ }
351
+ if (allowValues) {
352
+ // 无
353
+ }
290
354
  }, {
291
355
  children: 'children'
292
356
  });
@@ -377,7 +441,10 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
377
441
  resizable: options === true,
378
442
  fixed: options === true,
379
443
  sort: options === true,
380
- aggFunc: options === true
444
+ aggFunc: options === true,
445
+ align: options === true,
446
+ headerAlign: options === true,
447
+ footerAlign: options === true
381
448
  }, options);
382
449
  const allCols = [];
383
450
  _xeUtils.default.eachTree(collectColumn, column => {
@@ -386,6 +453,7 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
386
453
  }
387
454
  if (opts.fixed) {
388
455
  column.fixed = column.defaultFixed;
456
+ column.renderFixed = column.defaultFixed;
389
457
  }
390
458
  if (opts.sort) {
391
459
  column.renderSortNumber = column.sortNumber;
@@ -397,6 +465,18 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
397
465
  })) {
398
466
  column.visible = column.defaultVisible;
399
467
  }
468
+ if (opts.align) {
469
+ column.align = column.defaultAlign;
470
+ column.renderAlign = column.defaultAlign;
471
+ }
472
+ if (opts.headerAlign) {
473
+ column.headerAlign = column.defaultHeaderAlign;
474
+ column.renderHeaderAlign = column.defaultHeaderAlign;
475
+ }
476
+ if (opts.footerAlign) {
477
+ column.footerAlign = column.defaultFooterAlign;
478
+ column.renderFooterAlign = column.defaultFooterAlign;
479
+ }
400
480
  if (opts.aggFunc) {
401
481
  column.aggFunc = column.defaultAggFunc;
402
482
  column.renderAggFn = column.defaultAggFunc;
@@ -1 +1 @@
1
- var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util"),_dom=require("../../../ui/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let tableCustomMethodKeys=["openCustom","closeCustom","getCustomVisible","toggleCustom","saveCustom","cancelCustom","resetCustom","toggleCustomAllCheckbox","setCustomAllCheckbox"];_ui.VxeUI.hooks.add("tableCustomModule",{setupTable(m){let{reactData:h,internalData:c}=m,{computeCustomOpts:v,computeRowGroupFields:i,computeCustomSimpleMode:b}=m.getComputeMaps(),p=m.getRefMaps().refElem;var e=m.xeGrid;let g=m.xeGantt,C=e||g,u=()=>{var e=h.customStore,{mode:t,placement:l,popupOptions:o}=v.value,t=!("modal"===t||"drawer"===t),{transfer:o,maxHeight:s}=o||{},r="outside"===b.value,i=document.documentElement;let u=p.value,a=0,n=0;var d={},m=(u=g&&(m=g.getRefMaps().refGanttContainerElem,m=m.value)?m:u).getBoundingClientRect();n=t&&o?(a=m.top+i.scrollTop,_xeUtils.default.eqNull(s)?360:s):r?(C&&u&&(a=u.offsetTop),_xeUtils.default.eqNull(s)?360:s):(u&&(n=u.clientHeight-22),Math.max(88,n));let c=0;return"left"!==l&&"right"!==l&&(c=_xeUtils.default.eqNull(s)?n:s),l&&["left","right","bottom-left","bottom-right"].includes(l)||a&&(d.top=(0,_dom.toCssUnit)(a)),t&&o&&("bottom-left"!==l&&"bottom-right"!==l||(d.bottom=(0,_dom.toCssUnit)(i.scrollHeight-m.top-m.height+1)),"top-left"===l||"bottom-left"===l?d.left=(0,_dom.toCssUnit)(m.left):l&&"top-right"!==l&&"bottom-right"!==l||(d.right=(0,_dom.toCssUnit)(i.scrollWidth-m.left-m.width+1))),c&&(d.maxHeight=(0,_dom.toCssUnit)(c)),e.popupStyle=d,e.maxHeight=c,(0,_vue.nextTick)()},l=()=>{var{initStore:e,customStore:t}=h,{mode:l,popupOptions:o}=v.value,l=!("modal"===l||"drawer"===l),o=(o||{}).transfer,s=b.value;let r=null;return l&&o?r=document.body:"outside"===s&&C&&(l=C.getRefMaps().refPopupContainerElem,o=l.value)&&(r=o),c.customPopupToElem!==r&&h.ctPopupFlag++,c.customPopupToElem=r,t.visible=!0,e.custom=!0,a(),n(),u(),(0,_vue.nextTick)().then(()=>u())},a=()=>{var e=h.customStore,t=c.collectColumn;if(e.visible){let l={},o={},s={};_xeUtils.default.eachTree(t,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,l[t]=e.renderSortNumber,o[t]=e.fixed,s[t]=e.visible}),e.oldSortMaps=l,e.oldFixedMaps=o,e.oldVisibleMaps=s,h.customColumnList=t.slice(0)}},o=()=>{var e=h.customStore,t=v.value;return e.visible&&(e.visible=!1,t.immediate||m.handleCustom()),(0,_vue.nextTick)()};let t=e=>{var t=h.customStore,l=h.customColumnList,o=v.value;let{checkMethod:s,visibleMethod:r}=o,i=!!e;return o.immediate?(_xeUtils.default.eachTree(l,e=>{r&&!r({$table:m,column:e})||s&&!s({$table:m,column:e})||(e.visible=i,e.renderVisible=i,e.halfVisible=!1)}),t.isAll=i,h.isCustomStatus=!0,m.handleCustom(),m.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(l,e=>{r&&!r({$table:m,column:e})||s&&!s({$table:m,column:e})||(e.renderVisible=i,e.halfVisible=!1)}),t.isAll=i),m.checkCustomStatus(),(0,_vue.nextTick)()};e={getCustomVisible(){var e=h.customStore;return e.visible},openCustom:l,closeCustom:o,toggleCustom:()=>{var e=h.customStore;return(e.visible?o:l)()},saveCustom:e=>{let{customColumnList:t,aggHandleFields:l,rowGroupList:o}=h;let{allowVisible:r,allowSort:i,allowFixed:u,allowResizable:a,allowGroup:n,allowValues:d}=v.value;return e||_xeUtils.default.eachTree(t,(e,t,l,o,s)=>{s?e.fixed=s.fixed:(i&&(e.renderSortNumber=t+1),u&&(e.fixed=e.renderFixed)),!a||!e.renderVisible||e.children&&e.children.length||e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),r&&(e.visible=e.renderVisible),n&&d&&(e.aggFunc=e.renderAggFn)}),h.isCustomStatus=!0,n&&m.handlePivotTableAggData&&(o.length!==l.length||o.some((e,t)=>e.field!==l[t])?l.length?m.setRowGroups(l):m.clearRowGroups():d&&m.handleUpdateAggData()),i&&(c.collectColumn=t),m.saveCustomStore("confirm")},cancelCustom:()=>{var{customColumnList:e,customStore:t}=h;let{oldSortMaps:s,oldFixedMaps:r,oldVisibleMaps:i}=t,{allowVisible:u,allowSort:a,allowFixed:n,allowResizable:d}=v.value;return _xeUtils.default.eachTree(e,e=>{var t=e.getKey(),l=!!i[t],o=r[t]||"";u&&(e.renderVisible=l,e.visible=l),n&&(e.renderFixed=o,e.fixed=o),a&&(e.renderSortNumber=s[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),(0,_vue.nextTick)()},resetCustom(e){let t=h.rowGroupList;var l=c.collectColumn;let o=v.value.checkMethod,s=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e),r=[];return _xeUtils.default.eachTree(l,e=>{s.resizable&&(e.resizeWidth=0),s.fixed&&(e.fixed=e.defaultFixed),s.sort&&(e.renderSortNumber=e.sortNumber,e.parentId=e.defaultParentId),o&&!o({$table:m,column:e})||(e.visible=e.defaultVisible),s.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth,r.push(e)}),s.sort&&(e=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(r,"renderSortNumber"),{key:"id",parentKey:"parentId",children:"children"}),c.collectColumn=e,c.tableFullColumn=(0,_util.getColumnList)(e)),h.isCustomStatus=!1,m.handleCustom().then(()=>{var e;s.aggFunc&&m.handlePivotTableAggData&&(((e=i.value)||t).length?e&&e.length?m.setRowGroups(e):m.clearRowGroups():m.handleUpdateAggData()),m.saveCustomStore("reset")})},toggleCustomAllCheckbox(){var e=h.customStore,e=!e.isAll;return t(e)},setCustomAllCheckbox:t};let n=()=>{var e=h.customStore,t=c.collectColumn;let l=v.value.checkMethod;e.isAll=t.every(e=>!!l&&!l({$table:m,column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&t.some(e=>(!l||l({$table:m,column:e}))&&(e.renderVisible||e.halfVisible))},s=(e,t)=>{m.dispatchEvent("custom",{type:e},t)};var r={checkCustomStatus:n,emitCustomEvent:s,triggerCustomEvent(e){var t=m.reactData.customStore;t.visible?(o(),s("close",e),m.dispatchEvent("custom-close",{},e)):(t.btnEl=e.target,l(),s("open",e),m.dispatchEvent("custom-open",{},e))},customOpenEvent(e){var t=m.reactData.customStore;t.visible||(t.activeBtn=!0,t.btnEl=e.target,m.openCustom(),m.emitCustomEvent("open",e),m.dispatchEvent("custom-open",{},e))},customCloseEvent(e){var t=m.reactData.customStore;t.visible&&(t.activeBtn=!1,m.closeCustom(),m.emitCustomEvent("close",e),m.dispatchEvent("custom-close",{},e))},handleUpdateCustomColumn:a,handleCustomStyle(){return m.reactData.isCustomDragStatus=!1,u()}};return Object.assign(Object.assign({},e),r)},setupGrid(e){return e.extendTableMethods(tableCustomMethodKeys)},setupGantt(e){return e.extendTableMethods(tableCustomMethodKeys)}});
1
+ var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util"),_dom=require("../../../ui/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let tableCustomMethodKeys=["openCustom","closeCustom","getCustomVisible","toggleCustom","saveCustom","cancelCustom","resetCustom","toggleCustomAllCheckbox","setCustomAllCheckbox"],customColumnCssKeys=["checkbox","sort","title","width","fixed","align","header-align","footer-align"];_ui.VxeUI.hooks.add("tableCustomModule",{setupTable(h){let{reactData:C,internalData:v}=h,{computeCustomOpts:f,computeRowGroupFields:s,computeCustomSimpleMode:x}=h.getComputeMaps(),A=h.getRefMaps().refElem;var e=h.xeGrid;let S=h.xeGantt,_=e||S,a=()=>{var e=C.customStore,{mode:t,placement:l,popupOptions:o}=f.value,t=!("modal"===t||"drawer"===t),{transfer:o,minWidth:r,maxWidth:i,maxHeight:s}=o||{},a="outside"===x.value,u=document.documentElement;let n=A.value,d=0,m=0;var c={};let g={};var h=(n=S&&(h=S.getRefMaps().refGanttContainerElem,h=h.value)?h:n).getBoundingClientRect();m=t&&o?(d=h.top+u.scrollTop,_xeUtils.default.eqNull(s)?360:s):a?(_&&n&&(d=n.offsetTop),_xeUtils.default.eqNull(s)?360:s):(n&&(m=n.clientHeight-22),Math.max(88,m));let v=0,b=("left"!==l&&"right"!==l&&(v=_xeUtils.default.eqNull(s)?m:s),l&&["left","right","bottom-left","bottom-right"].includes(l)||d&&(c.top=(0,_dom.toCssUnit)(d)),t&&o&&("bottom-left"!==l&&"bottom-right"!==l||(c.bottom=(0,_dom.toCssUnit)(u.scrollHeight-h.top-h.height+1)),"top-left"===l||"bottom-left"===l?c.left=(0,_dom.toCssUnit)(h.left):l&&"top-right"!==l&&"bottom-right"!==l||(c.right=(0,_dom.toCssUnit)(u.scrollWidth-h.left-h.width+1))),getComputedStyle(u)),p=getComputedStyle(n);return customColumnCssKeys.forEach(e=>{var e=`--vxe-ui-vxe-table-custom-column-${e}-${"title"===e?"min-":""}width`,t=p.getPropertyValue(e);t&&t!==b.getPropertyValue(e)&&(g[e]=t)}),r&&(c["--vxe-ui-vxe-table-custom-default-min-width"]=(0,_dom.toCssUnit)(r)),i&&(c["--vxe-ui-vxe-table-custom-default-max-width"]=(0,_dom.toCssUnit)(i)),v&&(c.maxHeight=(0,_dom.toCssUnit)(v)),e.defPopupStyle=c,e.panePopupStyle=g,e.maxHeight=v,(0,_vue.nextTick)()},l=()=>{var{initStore:e,customStore:t}=C,{mode:l,popupOptions:o}=f.value,l=!("modal"===l||"drawer"===l),o=(o||{}).transfer,r=x.value;let i=null;return l&&o?i=document.body:"outside"===r&&_&&(l=_.getRefMaps().refPopupContainerElem,o=l.value)&&(i=o),v.customPopupToElem!==i&&C.ctPopupFlag++,v.customPopupToElem=i,t.visible=!0,e.custom=!0,u(),n(),a(),(0,_vue.nextTick)().then(()=>a())},u=()=>{var e=C.customStore,t=v.collectColumn;if(e.visible){let l={},o={},r={};_xeUtils.default.eachTree(t,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,e.renderAlign=e.align,e.renderHeaderAlign=e.headerAlign,e.renderFooterAlign=e.footerAlign,l[t]=e.renderSortNumber,o[t]=e.fixed,r[t]=e.visible}),e.oldSortMaps=l,e.oldFixedMaps=o,e.oldVisibleMaps=r,C.customColumnList=t.slice(0)}},o=()=>{var e=C.customStore,t=f.value;return e.visible&&(e.visible=!1,t.immediate||h.handleCustom()),(0,_vue.nextTick)()};let t=e=>{var t=C.customStore,l=C.customColumnList,o=f.value;let{checkMethod:r,visibleMethod:i}=o,s=!!e;return o.immediate?(_xeUtils.default.eachTree(l,e=>{i&&!i({$table:h,column:e})||r&&!r({$table:h,column:e})||(e.visible=s,e.renderVisible=s,e.halfVisible=!1)}),t.isAll=s,C.isCustomStatus=!0,h.handleCustom(),h.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(l,e=>{i&&!i({$table:h,column:e})||r&&!r({$table:h,column:e})||(e.renderVisible=s,e.halfVisible=!1)}),t.isAll=s),h.checkCustomStatus(),(0,_vue.nextTick)()};e={getCustomVisible(){var e=C.customStore;return e.visible},openCustom:l,closeCustom:o,toggleCustom:()=>{var e=C.customStore;return(e.visible?o:l)()},saveCustom:e=>{let{customColumnList:t,aggHandleFields:l,rowGroupList:o}=C;let{allowVisible:i,allowSort:s,allowFixed:a,allowResizable:u,allowAlign:n,allowHeaderAlign:d,allowFooterAlign:m,allowGroup:c,allowValues:g}=f.value;return e?_xeUtils.default.eachTree(t,e=>{!u||!e.renderVisible||e.children&&e.children.length||(e.resizeWidth=Math.max(0,_xeUtils.default.toNumber(e.renderWidth)))}):_xeUtils.default.eachTree(t,(e,t,l,o,r)=>{r?e.fixed=r.fixed:(s&&(e.renderSortNumber=t+1),a&&(e.fixed=e.renderFixed)),!u||!e.renderVisible||e.children&&e.children.length||e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),i&&(e.visible=e.renderVisible),n&&(e.align=e.renderAlign),d&&(e.headerAlign=e.renderHeaderAlign),m&&(e.footerAlign=e.renderFooterAlign),c&&g&&(e.aggFunc=e.renderAggFn)}),C.isCustomStatus=!0,c&&h.handlePivotTableAggData&&(o.length!==l.length||o.some((e,t)=>e.field!==l[t])?l.length?h.setRowGroups(l):h.clearRowGroups():g&&h.handleUpdateAggData()),s&&(v.collectColumn=t),h.saveCustomStore("confirm")},cancelCustom:()=>{var{customColumnList:e,customStore:t}=C;let{oldSortMaps:r,oldFixedMaps:i,oldVisibleMaps:s}=t,{allowVisible:a,allowSort:u,allowFixed:n,allowAlign:d,allowHeaderAlign:m,allowFooterAlign:c,allowResizable:g,allowGroup:h,allowValues:v}=f.value;return _xeUtils.default.eachTree(e,e=>{var t=e.getKey(),l=!!s[t],o=i[t]||"";a&&(e.renderVisible=l,e.visible=l),n&&(e.renderFixed=o,e.fixed=o),u&&(e.renderSortNumber=r[t]||0),g&&(e.renderResizeWidth=e.renderWidth),d&&(e.align=e.renderAlign),m&&(e.headerAlign=e.renderHeaderAlign),c&&(e.footerAlign=e.renderFooterAlign),h,v},{children:"children"}),(0,_vue.nextTick)()},resetCustom(e){let t=C.rowGroupList;var l=v.collectColumn;let o=f.value.checkMethod,r=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e,align:!0===e,headerAlign:!0===e,footerAlign:!0===e},e),i=[];return _xeUtils.default.eachTree(l,e=>{r.resizable&&(e.resizeWidth=0),r.fixed&&(e.fixed=e.defaultFixed,e.renderFixed=e.defaultFixed),r.sort&&(e.renderSortNumber=e.sortNumber,e.parentId=e.defaultParentId),o&&!o({$table:h,column:e})||(e.visible=e.defaultVisible),r.align&&(e.align=e.defaultAlign,e.renderAlign=e.defaultAlign),r.headerAlign&&(e.headerAlign=e.defaultHeaderAlign,e.renderHeaderAlign=e.defaultHeaderAlign),r.footerAlign&&(e.footerAlign=e.defaultFooterAlign,e.renderFooterAlign=e.defaultFooterAlign),r.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth,i.push(e)}),r.sort&&(e=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(i,"renderSortNumber"),{key:"id",parentKey:"parentId",children:"children"}),v.collectColumn=e,v.tableFullColumn=(0,_util.getColumnList)(e)),C.isCustomStatus=!1,h.handleCustom().then(()=>{var e;r.aggFunc&&h.handlePivotTableAggData&&(((e=s.value)||t).length?e&&e.length?h.setRowGroups(e):h.clearRowGroups():h.handleUpdateAggData()),h.saveCustomStore("reset")})},toggleCustomAllCheckbox(){var e=C.customStore,e=!e.isAll;return t(e)},setCustomAllCheckbox:t};let n=()=>{var e=C.customStore,t=v.collectColumn;let l=f.value.checkMethod;e.isAll=t.every(e=>!!l&&!l({$table:h,column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&t.some(e=>(!l||l({$table:h,column:e}))&&(e.renderVisible||e.halfVisible))},r=(e,t)=>{h.dispatchEvent("custom",{type:e},t)};var i={checkCustomStatus:n,emitCustomEvent:r,triggerCustomEvent(e){var t=h.reactData.customStore;t.visible?(o(),r("close",e),h.dispatchEvent("custom-close",{},e)):(t.btnEl=e.target,l(),r("open",e),h.dispatchEvent("custom-open",{},e))},customOpenEvent(e){var t=h.reactData.customStore;t.visible||(t.activeBtn=!0,t.btnEl=e.target,h.openCustom(),h.emitCustomEvent("open",e),h.dispatchEvent("custom-open",{},e))},customCloseEvent(e){var t=h.reactData.customStore;t.visible&&(t.activeBtn=!1,h.closeCustom(),h.emitCustomEvent("close",e),h.dispatchEvent("custom-close",{},e))},handleUpdateCustomColumn:u,handleCustomStyle(){return h.reactData.isCustomDragStatus=!1,a()}};return Object.assign(Object.assign({},e),i)},setupGrid(e){return e.extendTableMethods(tableCustomMethodKeys)},setupGantt(e){return e.extendTableMethods(tableCustomMethodKeys)}});