vxe-table 4.16.10 → 4.16.11

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 (34) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/src/cell.js +43 -25
  3. package/es/table/src/footer.js +3 -3
  4. package/es/table/src/props.js +4 -0
  5. package/es/table/src/table.js +35 -9
  6. package/es/ui/index.js +7 -1
  7. package/es/ui/src/log.js +1 -1
  8. package/lib/index.umd.js +88 -49
  9. package/lib/index.umd.min.js +1 -1
  10. package/lib/style.css +1 -1
  11. package/lib/table/src/cell.js +60 -32
  12. package/lib/table/src/cell.min.js +1 -1
  13. package/lib/table/src/footer.js +3 -3
  14. package/lib/table/src/footer.min.js +1 -1
  15. package/lib/table/src/props.js +4 -0
  16. package/lib/table/src/props.min.js +1 -1
  17. package/lib/table/src/table.js +10 -10
  18. package/lib/table/src/table.min.js +1 -1
  19. package/lib/ui/index.js +7 -1
  20. package/lib/ui/index.min.js +1 -1
  21. package/lib/ui/src/log.js +1 -1
  22. package/lib/ui/src/log.min.js +1 -1
  23. package/package.json +1 -1
  24. package/packages/table/src/cell.ts +41 -25
  25. package/packages/table/src/footer.ts +3 -3
  26. package/packages/table/src/props.ts +4 -0
  27. package/packages/table/src/table.ts +34 -9
  28. package/packages/ui/index.ts +6 -0
  29. /package/es/{iconfont.1757464778789.ttf → iconfont.1757578456216.ttf} +0 -0
  30. /package/es/{iconfont.1757464778789.woff → iconfont.1757578456216.woff} +0 -0
  31. /package/es/{iconfont.1757464778789.woff2 → iconfont.1757578456216.woff2} +0 -0
  32. /package/lib/{iconfont.1757464778789.ttf → iconfont.1757578456216.ttf} +0 -0
  33. /package/lib/{iconfont.1757464778789.woff → iconfont.1757578456216.woff} +0 -0
  34. /package/lib/{iconfont.1757464778789.woff2 → iconfont.1757578456216.woff2} +0 -0
@@ -161,12 +161,12 @@ function renderTitleContent(params, content) {
161
161
  const { $table, column } = params;
162
162
  const tableProps = $table.props;
163
163
  const tableReactData = $table.reactData;
164
- const { computeTooltipOpts } = $table.getComputeMaps();
164
+ const { computeHeaderTooltipOpts } = $table.getComputeMaps();
165
165
  const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
166
166
  const { isRowGroupStatus } = tableReactData;
167
167
  const { showHeaderOverflow } = column;
168
- const tooltipOpts = computeTooltipOpts.value;
169
- const showAllTip = tooltipOpts.showAll;
168
+ const headerTooltipOpts = computeHeaderTooltipOpts.value;
169
+ const showAllTip = headerTooltipOpts.showAll;
170
170
  const headOverflow = XEUtils.eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
171
171
  const showTitle = headOverflow === 'title';
172
172
  const showTooltip = headOverflow === true || headOverflow === 'tooltip';
@@ -759,7 +759,9 @@ export const Cell = {
759
759
  const { treeConfig } = tableProps;
760
760
  const { updateCheckboxFlag, isRowGroupStatus } = tableReactData;
761
761
  const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData;
762
- const { computeCheckboxOpts } = $table.getComputeMaps();
762
+ const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
763
+ const aggregateOpts = computeAggregateOpts.value;
764
+ const { mapChildrenField } = aggregateOpts;
763
765
  const checkboxOpts = computeCheckboxOpts.value;
764
766
  const { labelField, checkMethod, visibleMethod } = checkboxOpts;
765
767
  const { slots } = column;
@@ -767,23 +769,30 @@ export const Cell = {
767
769
  const checkboxSlot = slots ? slots.checkbox : null;
768
770
  let indeterminate = false;
769
771
  let isChecked = false;
770
- const isVisible = !visibleMethod || visibleMethod({ $table, row });
771
- let isDisabled = !!checkMethod;
772
+ let isVisible = true;
773
+ let isDisabled = false;
772
774
  const ons = {};
773
775
  if (!isHidden) {
774
776
  const rowid = getRowid($table, row);
775
777
  isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
776
- ons.onClick = (evnt) => {
777
- if (!isDisabled && isVisible) {
778
- $table.triggerCheckRowEvent(evnt, params, !isChecked);
778
+ if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
779
+ const childList = row[mapChildrenField || ''];
780
+ if (!childList || !childList.length || childList.every(item => !checkMethod({ $table, row: item }))) {
781
+ isDisabled = true;
779
782
  }
780
- };
781
- if (checkMethod) {
782
- isDisabled = !checkMethod({ $table, row });
783
+ }
784
+ else {
785
+ isVisible = !visibleMethod || visibleMethod({ $table, row });
786
+ isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod;
783
787
  }
784
788
  if (treeConfig || isRowGroupStatus) {
785
789
  indeterminate = !!treeIndeterminateRowMaps[rowid];
786
790
  }
791
+ ons.onClick = (evnt) => {
792
+ if (!isDisabled && isVisible) {
793
+ $table.triggerCheckRowEvent(evnt, params, !isChecked);
794
+ }
795
+ };
787
796
  }
788
797
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
789
798
  if (checkboxSlot) {
@@ -820,41 +829,50 @@ export const Cell = {
820
829
  const { treeConfig } = tableProps;
821
830
  const { updateCheckboxFlag, isRowGroupStatus } = tableReactData;
822
831
  const { treeIndeterminateRowMaps } = tableInternalData;
823
- const { computeCheckboxOpts } = $table.getComputeMaps();
832
+ const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
833
+ const aggregateOpts = computeAggregateOpts.value;
834
+ const { mapChildrenField } = aggregateOpts;
824
835
  const checkboxOpts = computeCheckboxOpts.value;
825
836
  const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts;
826
837
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
827
838
  const { slots } = column;
828
839
  const defaultSlot = slots ? slots.default : null;
829
840
  const checkboxSlot = slots ? slots.checkbox : null;
830
- let isIndeterminate = false;
841
+ let indeterminate = false;
831
842
  let isChecked = false;
832
- const isVisible = !visibleMethod || visibleMethod({ $table, row });
833
- let isDisabled = !!checkMethod;
843
+ let isVisible = true;
844
+ let isDisabled = false;
834
845
  const ons = {};
835
846
  if (!isHidden) {
836
847
  const rowid = getRowid($table, row);
837
848
  isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField);
849
+ if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
850
+ const childList = row[mapChildrenField || ''];
851
+ if (!childList || !childList.length || childList.every(item => !checkMethod({ $table, row: item }))) {
852
+ isDisabled = true;
853
+ }
854
+ }
855
+ else {
856
+ isVisible = !visibleMethod || visibleMethod({ $table, row });
857
+ isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod;
858
+ }
859
+ if (treeConfig || isRowGroupStatus) {
860
+ indeterminate = !!treeIndeterminateRowMaps[rowid];
861
+ }
838
862
  ons.onClick = (evnt) => {
839
863
  if (!isDisabled && isVisible) {
840
864
  $table.triggerCheckRowEvent(evnt, params, !isChecked);
841
865
  }
842
866
  };
843
- if (checkMethod) {
844
- isDisabled = !checkMethod({ $table, row });
845
- }
846
- if (treeConfig || isRowGroupStatus) {
847
- isIndeterminate = !!treeIndeterminateRowMaps[rowid];
848
- }
849
867
  }
850
- const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate });
868
+ const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
851
869
  if (checkboxSlot) {
852
870
  return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
853
871
  }
854
872
  const checkVNs = [];
855
873
  if (isVisible) {
856
874
  checkVNs.push(h('span', {
857
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : (isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED))]
875
+ class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : (isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED))]
858
876
  }));
859
877
  if (defaultSlot || labelField) {
860
878
  checkVNs.push(h('span', {
@@ -866,7 +884,7 @@ export const Cell = {
866
884
  h('span', Object.assign({ class: ['vxe-cell--checkbox', {
867
885
  'is--checked': isChecked,
868
886
  'is--disabled': isDisabled,
869
- 'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : isIndeterminate,
887
+ 'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : indeterminate,
870
888
  'is--hidden': !isVisible
871
889
  }] }, ons), checkVNs)
872
890
  ]);
@@ -29,7 +29,7 @@ export default defineVxeComponent({
29
29
  setup(props) {
30
30
  const $xeTable = inject('$xeTable', {});
31
31
  const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable;
32
- const { computeTooltipOpts, computeColumnOpts, computeCellOpts, computeFooterCellOpts, computeDefaultRowHeight, computeResizableOpts, computeVirtualXOpts } = $xeTable.getComputeMaps();
32
+ const { computeFooterTooltipOpts, computeColumnOpts, computeCellOpts, computeFooterCellOpts, computeDefaultRowHeight, computeResizableOpts, computeVirtualXOpts } = $xeTable.getComputeMaps();
33
33
  const refElem = ref();
34
34
  const refFooterScroll = ref();
35
35
  const refFooterTable = ref();
@@ -44,7 +44,7 @@ export default defineVxeComponent({
44
44
  const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFootFlag } = tableReactData;
45
45
  const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore } = tableInternalData;
46
46
  const virtualXOpts = computeVirtualXOpts.value;
47
- const tooltipOpts = computeTooltipOpts.value;
47
+ const footerTooltipOpts = computeFooterTooltipOpts.value;
48
48
  const resizableOpts = computeResizableOpts.value;
49
49
  const { isAllColumnDrag } = resizableOpts;
50
50
  const columnOpts = computeColumnOpts.value;
@@ -58,7 +58,7 @@ export default defineVxeComponent({
58
58
  const colRest = fullColumnIdData[colid] || {};
59
59
  const renderOpts = editRender || cellRender;
60
60
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
61
- const showAllTip = tooltipOpts.showAll;
61
+ const showAllTip = footerTooltipOpts.showAll;
62
62
  const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed);
63
63
  const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding;
64
64
  const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
@@ -241,6 +241,10 @@ export const tableProps = {
241
241
  checkboxConfig: Object,
242
242
  // tooltip 配置项
243
243
  tooltipConfig: Object,
244
+ // 表头 tooltip 配置项
245
+ headerTooltipConfig: Object,
246
+ // 表尾 tooltip 配置项
247
+ footerTooltipConfig: Object,
244
248
  // 导出配置项
245
249
  exportConfig: Object,
246
250
  // 导入配置项
@@ -509,6 +509,12 @@ export default defineVxeComponent({
509
509
  const computeTooltipOpts = computed(() => {
510
510
  return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig);
511
511
  });
512
+ const computeHeaderTooltipOpts = computed(() => {
513
+ return Object.assign({}, getConfig().tooltip, getConfig().table.headerTooltipConfig, props.headerTooltipConfig);
514
+ });
515
+ const computeFooterTooltipOpts = computed(() => {
516
+ return Object.assign({}, getConfig().tooltip, getConfig().table.footerTooltipConfig, props.footerTooltipConfig);
517
+ });
512
518
  const computeTableTipConfig = computed(() => {
513
519
  const { tooltipStore } = reactData;
514
520
  const tooltipOpts = computeTooltipOpts.value;
@@ -785,6 +791,8 @@ export default defineVxeComponent({
785
791
  computeRadioOpts,
786
792
  computeCheckboxOpts,
787
793
  computeTooltipOpts,
794
+ computeHeaderTooltipOpts,
795
+ computeFooterTooltipOpts,
788
796
  computeEditOpts,
789
797
  computeSortOpts,
790
798
  computeFilterOpts,
@@ -8068,16 +8076,15 @@ export default defineVxeComponent({
8068
8076
  * @param {Event} evnt 事件
8069
8077
  * @param {Row} row 行对象
8070
8078
  */
8071
- const handleTooltip = (evnt, type, tdEl, overflowElem, tipElem, params) => {
8079
+ const handleTooltip = (evnt, tipOpts, type, tdEl, overflowElem, tipElem, params) => {
8072
8080
  const tipOverEl = overflowElem || tdEl;
8073
8081
  if (!tipOverEl) {
8074
8082
  return nextTick();
8075
8083
  }
8076
8084
  params.cell = tdEl;
8077
8085
  const { tooltipStore } = reactData;
8078
- const tooltipOpts = computeTooltipOpts.value;
8079
8086
  const { column, row } = params;
8080
- const { showAll, contentMethod } = tooltipOpts;
8087
+ const { showAll, contentMethod } = tipOpts;
8081
8088
  const customContent = contentMethod ? contentMethod(params) : null;
8082
8089
  const useCustom = contentMethod && !XEUtils.eqNull(customContent);
8083
8090
  const content = useCustom ? customContent : XEUtils.toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
@@ -8090,7 +8097,7 @@ export default defineVxeComponent({
8090
8097
  visible: true,
8091
8098
  content: tipContent,
8092
8099
  type,
8093
- currOpts: {}
8100
+ currOpts: tipOpts
8094
8101
  });
8095
8102
  nextTick(() => {
8096
8103
  const $tooltip = refTooltip.value;
@@ -8997,6 +9004,8 @@ export default defineVxeComponent({
8997
9004
  const { treeConfig } = props;
8998
9005
  const { isRowGroupStatus } = reactData;
8999
9006
  const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData;
9007
+ const aggregateOpts = computeAggregateOpts.value;
9008
+ const { mapChildrenField } = aggregateOpts;
9000
9009
  const checkboxOpts = computeCheckboxOpts.value;
9001
9010
  const { checkField, checkMethod, showReserveStatus } = checkboxOpts;
9002
9011
  const { handleGetRowId } = createHandleGetRowId($xeTable);
@@ -9010,7 +9019,21 @@ export default defineVxeComponent({
9010
9019
  ? row => {
9011
9020
  const childRowid = handleGetRowId(row);
9012
9021
  const selected = checkField ? XEUtils.get(row, checkField) : selectCheckboxMaps[childRowid];
9013
- if (checkMethod({ $table: $xeTable, row })) {
9022
+ if (isRowGroupStatus && $xeTable.isAggregateRecord(row)) {
9023
+ const childList = row[mapChildrenField || ''];
9024
+ if (selected) {
9025
+ vLen++;
9026
+ sLen++;
9027
+ }
9028
+ else if (treeIndeterminateRowMaps[childRowid]) {
9029
+ vLen++;
9030
+ hLen++;
9031
+ }
9032
+ else if (childList && childList.length && childList.some(item => checkMethod({ $table: $xeTable, row: item }))) {
9033
+ vLen++;
9034
+ }
9035
+ }
9036
+ else if (checkMethod({ $table: $xeTable, row })) {
9014
9037
  if (selected) {
9015
9038
  sLen++;
9016
9039
  }
@@ -9207,6 +9230,7 @@ export default defineVxeComponent({
9207
9230
  */
9208
9231
  triggerHeaderTooltipEvent(evnt, params) {
9209
9232
  const { tooltipStore } = reactData;
9233
+ const headerTooltipOpts = computeHeaderTooltipOpts.value;
9210
9234
  const { column } = params;
9211
9235
  handleTargetEnterEvent(true);
9212
9236
  const titleElem = evnt.currentTarget;
@@ -9227,7 +9251,7 @@ export default defineVxeComponent({
9227
9251
  }
9228
9252
  if (tooltipStore.column !== column || !tooltipStore.visible) {
9229
9253
  const ctEl = thEl.querySelector('.vxe-cell--title');
9230
- handleTooltip(evnt, 'header', thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
9254
+ handleTooltip(evnt, headerTooltipOpts, 'header', thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
9231
9255
  }
9232
9256
  },
9233
9257
  /**
@@ -9237,6 +9261,7 @@ export default defineVxeComponent({
9237
9261
  const { editConfig } = props;
9238
9262
  const { editStore } = reactData;
9239
9263
  const { tooltipStore } = reactData;
9264
+ const tooltipOpts = computeTooltipOpts.value;
9240
9265
  const editOpts = computeEditOpts.value;
9241
9266
  const { actived } = editStore;
9242
9267
  const { row, column } = params;
@@ -9263,7 +9288,7 @@ export default defineVxeComponent({
9263
9288
  if (!tipEl) {
9264
9289
  tipEl = ctEl;
9265
9290
  }
9266
- handleTooltip(evnt, 'body', tdEl, ovEl || ctEl, tipEl, params);
9291
+ handleTooltip(evnt, tooltipOpts, 'body', tdEl, ovEl || ctEl, tipEl, params);
9267
9292
  }
9268
9293
  },
9269
9294
  /**
@@ -9272,6 +9297,7 @@ export default defineVxeComponent({
9272
9297
  triggerFooterTooltipEvent(evnt, params) {
9273
9298
  const { column } = params;
9274
9299
  const { tooltipStore } = reactData;
9300
+ const footerTooltipOpts = computeFooterTooltipOpts.value;
9275
9301
  const tdEl = evnt.currentTarget;
9276
9302
  handleTargetEnterEvent(tooltipStore.column !== column || !!tooltipStore.row);
9277
9303
  if (tooltipStore.column !== column || !tooltipStore.visible) {
@@ -9284,7 +9310,7 @@ export default defineVxeComponent({
9284
9310
  if (!tipEl) {
9285
9311
  tipEl = ctEl;
9286
9312
  }
9287
- handleTooltip(evnt, 'footer', tdEl, ovEl || ctEl, tipEl, params);
9313
+ handleTooltip(evnt, footerTooltipOpts, 'footer', tdEl, ovEl || ctEl, tipEl, params);
9288
9314
  }
9289
9315
  },
9290
9316
  handleTargetLeaveEvent() {
@@ -9524,7 +9550,7 @@ export default defineVxeComponent({
9524
9550
  }
9525
9551
  }
9526
9552
  }
9527
- if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
9553
+ if (isRowGroupStatus || !checkMethod || checkMethod({ $table: $xeTable, row })) {
9528
9554
  $xeTable.handleBatchSelectRows([row], checked);
9529
9555
  $xeTable.checkSelectionStatus();
9530
9556
  dispatchEvent('checkbox-change', Object.assign({
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "4.16.10";
3
+ export const version = "4.16.11";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
@@ -62,6 +62,12 @@ VxeUI.setConfig({
62
62
  tooltipConfig: {
63
63
  enterable: true
64
64
  },
65
+ headerTooltipConfig: {
66
+ enterable: true
67
+ },
68
+ footerTooltipConfig: {
69
+ enterable: true
70
+ },
65
71
  validConfig: {
66
72
  showMessage: true,
67
73
  autoClear: true,
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"4.16.10"}`;
3
+ const version = `table v${"4.16.11"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);