vxe-table 4.7.11 → 4.7.13

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.
package/README.en.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![star](https://gitee.com/xuliangzhan_admin/vxe-table/badge/star.svg?theme=gvp)](https://gitee.com/xuliangzhan_admin/vxe-table/stargazers)
6
6
  [![npm version](https://img.shields.io/npm/v/vxe-table.svg?style=flat-square)](https://www.npmjs.com/package/vxe-table)
7
- [![npm build](https://travis-ci.com/x-extends/vxe-table.svg?branch=master)](https://travis-ci.com/x-extends/vxe-table)
7
+ [![NodeJS with Webpack](https://github.com/x-extends/vxe-table/actions/workflows/webpack.yml/badge.svg)](https://github.com/x-extends/vxe-table/actions/workflows/webpack.yml)
8
8
  [![npm downloads](https://img.shields.io/npm/dt/vxe-table.svg?style=flat-square)](https://npm-stat.com/charts.html?package=vxe-table)
9
9
  [![issues](https://img.shields.io/github/issues/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/issues)
10
10
  [![issues closed](https://img.shields.io/github/issues-closed/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/issues?q=is%3Aissue+is%3Aclosed)
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![star](https://gitee.com/xuliangzhan_admin/vxe-table/badge/star.svg?theme=gvp)](https://gitee.com/xuliangzhan_admin/vxe-table/stargazers)
6
6
  [![npm version](https://img.shields.io/npm/v/vxe-table.svg?style=flat-square)](https://www.npmjs.com/package/vxe-table)
7
- [![npm build](https://app.travis-ci.com/x-extends/vxe-table.svg?branch=master)](https://app.travis-ci.com/x-extends/vxe-table)
7
+ [![NodeJS with Webpack](https://github.com/x-extends/vxe-table/actions/workflows/webpack.yml/badge.svg)](https://github.com/x-extends/vxe-table/actions/workflows/webpack.yml)
8
8
  [![npm downloads](https://img.shields.io/npm/dt/vxe-table.svg?style=flat-square)](https://npm-stat.com/charts.html?package=vxe-table)
9
9
  [![issues](https://img.shields.io/github/issues/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/issues)
10
10
  [![issues closed](https://img.shields.io/github/issues-closed/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/issues?q=is%3Aissue+is%3Aclosed)
package/README.zh-TW.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![star](https://gitee.com/xuliangzhan_admin/vxe-table/badge/star.svg?theme=gvp)](https://gitee.com/xuliangzhan_admin/vxe-table/stargazers)
6
6
  [![npm version](https://img.shields.io/npm/v/vxe-table.svg?style=flat-square)](https://www.npmjs.com/package/vxe-table)
7
- [![npm build](https://travis-ci.com/x-extends/vxe-table.svg?branch=master)](https://travis-ci.com/x-extends/vxe-table)
7
+ [![NodeJS with Webpack](https://github.com/x-extends/vxe-table/actions/workflows/webpack.yml/badge.svg)](https://github.com/x-extends/vxe-table/actions/workflows/webpack.yml)
8
8
  [![npm downloads](https://img.shields.io/npm/dt/vxe-table.svg?style=flat-square)](https://npm-stat.com/charts.html?package=vxe-table)
9
9
  [![issues](https://img.shields.io/github/issues/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/issues)
10
10
  [![issues closed](https://img.shields.io/github/issues-closed/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/issues?q=is%3Aissue+is%3Aclosed)
@@ -1,4 +1,3 @@
1
- import { __awaiter } from "tslib";
2
1
  import { defineComponent, h, createCommentVNode, resolveComponent, reactive, ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
3
2
  import XEUtils from 'xe-utils';
4
3
  import { browse, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, isNodeElement } from '../../ui/src/dom';
@@ -241,7 +240,8 @@ export default defineComponent({
241
240
  isFooter: false
242
241
  },
243
242
  scrollVMLoading: false,
244
- _isResize: false
243
+ _isResize: false,
244
+ _isLoading: false
245
245
  });
246
246
  const internalData = {
247
247
  tZindex: 0,
@@ -818,12 +818,42 @@ export default defineComponent({
818
818
  }
819
819
  return num;
820
820
  };
821
+ const handleCustomRestore = (storeData) => {
822
+ const { tableFullColumn } = internalData;
823
+ let { collectColumn } = internalData;
824
+ const { resizableData, sortData, visibleData, fixedData } = storeData;
825
+ let hasCustomSort = false;
826
+ // 处理还原
827
+ if (resizableData || sortData || visibleData || fixedData) {
828
+ tableFullColumn.forEach(column => {
829
+ const colKey = column.getKey();
830
+ if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
831
+ column.resizeWidth = resizableData[colKey];
832
+ }
833
+ if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
834
+ column.visible = visibleData[colKey];
835
+ }
836
+ if (fixedData && fixedData[colKey]) {
837
+ column.fixed = fixedData[colKey];
838
+ }
839
+ if (sortData && XEUtils.isNumber(sortData[colKey])) {
840
+ hasCustomSort = true;
841
+ column.renderSortNumber = sortData[colKey];
842
+ }
843
+ });
844
+ // 如果自定义了顺序
845
+ if (hasCustomSort) {
846
+ collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
847
+ internalData.collectColumn = collectColumn;
848
+ internalData.tableFullColumn = getColumnList(collectColumn);
849
+ }
850
+ }
851
+ };
821
852
  /**
822
853
  * 还原自定义列操作状态
823
854
  */
824
- const restoreCustomStorage = () => __awaiter(this, void 0, void 0, function* () {
855
+ const restoreCustomStorage = () => {
825
856
  const { id, customConfig } = props;
826
- const { tableFullColumn } = internalData;
827
857
  const customOpts = computeCustomOpts.value;
828
858
  const { storage, restoreStore } = customOpts;
829
859
  const isAllCustom = storage === true;
@@ -837,43 +867,20 @@ export default defineComponent({
837
867
  errLog('vxe.error.reqProp', ['id']);
838
868
  return;
839
869
  }
840
- let storeData = getCustomStorageMap(id);
870
+ const storeData = getCustomStorageMap(id);
841
871
  if (restoreStore) {
842
- storeData = yield restoreStore({ id, type: 'restore', storeData });
843
- }
844
- if (!storeData) {
845
- return;
846
- }
847
- let { collectColumn } = internalData;
848
- const { resizableData, sortData, visibleData, fixedData } = storeData;
849
- let hasCustomSort = false;
850
- // 处理还原
851
- if (resizableData || sortData || visibleData || fixedData) {
852
- tableFullColumn.forEach(column => {
853
- const colKey = column.getKey();
854
- if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
855
- column.resizeWidth = resizableData[colKey];
856
- }
857
- if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
858
- column.visible = visibleData[colKey];
859
- }
860
- if (fixedData && fixedData[colKey]) {
861
- column.fixed = fixedData[colKey];
862
- }
863
- if (sortData && XEUtils.isNumber(sortData[colKey])) {
864
- hasCustomSort = true;
865
- column.renderSortNumber = sortData[colKey];
872
+ return Promise.resolve(restoreStore({ id, type: 'restore', storeData })).then(storeData => {
873
+ if (!storeData) {
874
+ return;
866
875
  }
867
- });
868
- // 如果自定义了顺序
869
- if (hasCustomSort) {
870
- collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
871
- internalData.collectColumn = collectColumn;
872
- internalData.tableFullColumn = getColumnList(collectColumn);
873
- }
876
+ return handleCustomRestore(storeData);
877
+ }).catch(e => e);
878
+ }
879
+ else {
880
+ return handleCustomRestore(storeData);
874
881
  }
875
882
  }
876
- });
883
+ };
877
884
  /**
878
885
  * 更新数据列的 Map
879
886
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
@@ -2418,8 +2425,10 @@ export default defineComponent({
2418
2425
  internalData.collectColumn = collectColumn;
2419
2426
  const tableFullColumn = getColumnList(collectColumn);
2420
2427
  internalData.tableFullColumn = tableFullColumn;
2428
+ reactData._isLoading = true;
2421
2429
  initColumnSort();
2422
- return restoreCustomStorage().then(() => {
2430
+ return Promise.resolve(restoreCustomStorage()).then(() => {
2431
+ reactData._isLoading = false;
2423
2432
  cacheColumnMap();
2424
2433
  parseColumns().then(() => {
2425
2434
  if (reactData.scrollXLoad) {
@@ -6717,6 +6726,7 @@ export default defineComponent({
6717
6726
  const validTipOpts = computeValidTipOpts.value;
6718
6727
  const loadingOpts = computeLoadingOpts.value;
6719
6728
  const isMenu = computeIsMenu.value;
6729
+ const currLoading = reactData._isLoading || loading;
6720
6730
  return h('div', {
6721
6731
  ref: refElem,
6722
6732
  class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
@@ -6738,8 +6748,8 @@ export default defineComponent({
6738
6748
  'is--animat': !!props.animat,
6739
6749
  'is--round': props.round,
6740
6750
  'is--stripe': !treeConfig && stripe,
6741
- 'is--loading': loading,
6742
- 'is--empty': !loading && !tableData.length,
6751
+ 'is--loading': currLoading,
6752
+ 'is--empty': !currLoading && !tableData.length,
6743
6753
  'is--scroll-y': overflowY,
6744
6754
  'is--scroll-x': overflowX,
6745
6755
  'is--virtual-x': scrollXLoad,
@@ -6836,7 +6846,7 @@ export default defineComponent({
6836
6846
  */
6837
6847
  h(resolveComponent('vxe-loading'), {
6838
6848
  class: 'vxe-table--loading',
6839
- modelValue: loading,
6849
+ modelValue: currLoading,
6840
6850
  icon: loadingOpts.icon,
6841
6851
  text: loadingOpts.text
6842
6852
  }, loadingSlot
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from 'vxe-pc-ui';
2
- VxeUI.version = "4.7.11";
3
- VxeUI.tableVersion = "4.7.11";
2
+ VxeUI.version = "4.7.12";
3
+ VxeUI.tableVersion = "4.7.12";
4
4
  VxeUI.setConfig({
5
5
  emptyCell: ' ',
6
6
  table: {
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from 'vxe-pc-ui';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"4.7.11"}`;
3
+ const version = `table v${"4.7.12"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -1791,8 +1791,8 @@ var external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_ =
1791
1791
  var external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_default = /*#__PURE__*/__webpack_require__.n(external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_);
1792
1792
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
1793
1793
 
1794
- external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.version = "4.7.11";
1795
- external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.tableVersion = "4.7.11";
1794
+ external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.version = "4.7.12";
1795
+ external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.tableVersion = "4.7.12";
1796
1796
  external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.setConfig({
1797
1797
  emptyCell: ' ',
1798
1798
  table: {
@@ -2241,7 +2241,7 @@ function eqEmptyValue(cellValue) {
2241
2241
  const {
2242
2242
  log: log_log
2243
2243
  } = external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI;
2244
- const version = `table v${"4.7.11"}`;
2244
+ const version = `table v${"4.7.12"}`;
2245
2245
  const warnLog = log_log.create('warn', version);
2246
2246
  const errLog = log_log.create('error', version);
2247
2247
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -8235,7 +8235,8 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
8235
8235
  isFooter: false
8236
8236
  },
8237
8237
  scrollVMLoading: false,
8238
- _isResize: false
8238
+ _isResize: false,
8239
+ _isLoading: false
8239
8240
  });
8240
8241
  const internalData = {
8241
8242
  tZindex: 0,
@@ -8884,17 +8885,54 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
8884
8885
  }
8885
8886
  return num;
8886
8887
  };
8888
+ const handleCustomRestore = storeData => {
8889
+ const {
8890
+ tableFullColumn
8891
+ } = internalData;
8892
+ let {
8893
+ collectColumn
8894
+ } = internalData;
8895
+ const {
8896
+ resizableData,
8897
+ sortData,
8898
+ visibleData,
8899
+ fixedData
8900
+ } = storeData;
8901
+ let hasCustomSort = false;
8902
+ // 处理还原
8903
+ if (resizableData || sortData || visibleData || fixedData) {
8904
+ tableFullColumn.forEach(column => {
8905
+ const colKey = column.getKey();
8906
+ if (resizableData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizableData[colKey])) {
8907
+ column.resizeWidth = resizableData[colKey];
8908
+ }
8909
+ if (visibleData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visibleData[colKey])) {
8910
+ column.visible = visibleData[colKey];
8911
+ }
8912
+ if (fixedData && fixedData[colKey]) {
8913
+ column.fixed = fixedData[colKey];
8914
+ }
8915
+ if (sortData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(sortData[colKey])) {
8916
+ hasCustomSort = true;
8917
+ column.renderSortNumber = sortData[colKey];
8918
+ }
8919
+ });
8920
+ // 如果自定义了顺序
8921
+ if (hasCustomSort) {
8922
+ collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(collectColumn, 'renderSortNumber');
8923
+ internalData.collectColumn = collectColumn;
8924
+ internalData.tableFullColumn = getColumnList(collectColumn);
8925
+ }
8926
+ }
8927
+ };
8887
8928
  /**
8888
8929
  * 还原自定义列操作状态
8889
8930
  */
8890
- const restoreCustomStorage = async () => {
8931
+ const restoreCustomStorage = () => {
8891
8932
  const {
8892
8933
  id,
8893
8934
  customConfig
8894
8935
  } = props;
8895
- const {
8896
- tableFullColumn
8897
- } = internalData;
8898
8936
  const customOpts = computeCustomOpts.value;
8899
8937
  const {
8900
8938
  storage,
@@ -8911,51 +8949,20 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
8911
8949
  errLog('vxe.error.reqProp', ['id']);
8912
8950
  return;
8913
8951
  }
8914
- let storeData = getCustomStorageMap(id);
8952
+ const storeData = getCustomStorageMap(id);
8915
8953
  if (restoreStore) {
8916
- storeData = await restoreStore({
8954
+ return Promise.resolve(restoreStore({
8917
8955
  id,
8918
8956
  type: 'restore',
8919
8957
  storeData
8920
- });
8921
- }
8922
- if (!storeData) {
8923
- return;
8924
- }
8925
- let {
8926
- collectColumn
8927
- } = internalData;
8928
- const {
8929
- resizableData,
8930
- sortData,
8931
- visibleData,
8932
- fixedData
8933
- } = storeData;
8934
- let hasCustomSort = false;
8935
- // 处理还原
8936
- if (resizableData || sortData || visibleData || fixedData) {
8937
- tableFullColumn.forEach(column => {
8938
- const colKey = column.getKey();
8939
- if (resizableData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizableData[colKey])) {
8940
- column.resizeWidth = resizableData[colKey];
8941
- }
8942
- if (visibleData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visibleData[colKey])) {
8943
- column.visible = visibleData[colKey];
8944
- }
8945
- if (fixedData && fixedData[colKey]) {
8946
- column.fixed = fixedData[colKey];
8947
- }
8948
- if (sortData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(sortData[colKey])) {
8949
- hasCustomSort = true;
8950
- column.renderSortNumber = sortData[colKey];
8958
+ })).then(storeData => {
8959
+ if (!storeData) {
8960
+ return;
8951
8961
  }
8952
- });
8953
- // 如果自定义了顺序
8954
- if (hasCustomSort) {
8955
- collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(collectColumn, 'renderSortNumber');
8956
- internalData.collectColumn = collectColumn;
8957
- internalData.tableFullColumn = getColumnList(collectColumn);
8958
- }
8962
+ return handleCustomRestore(storeData);
8963
+ }).catch(e => e);
8964
+ } else {
8965
+ return handleCustomRestore(storeData);
8959
8966
  }
8960
8967
  }
8961
8968
  };
@@ -10824,8 +10831,10 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
10824
10831
  internalData.collectColumn = collectColumn;
10825
10832
  const tableFullColumn = getColumnList(collectColumn);
10826
10833
  internalData.tableFullColumn = tableFullColumn;
10834
+ reactData._isLoading = true;
10827
10835
  initColumnSort();
10828
- return restoreCustomStorage().then(() => {
10836
+ return Promise.resolve(restoreCustomStorage()).then(() => {
10837
+ reactData._isLoading = false;
10829
10838
  cacheColumnMap();
10830
10839
  parseColumns().then(() => {
10831
10840
  if (reactData.scrollXLoad) {
@@ -15825,6 +15834,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
15825
15834
  const validTipOpts = computeValidTipOpts.value;
15826
15835
  const loadingOpts = computeLoadingOpts.value;
15827
15836
  const isMenu = computeIsMenu.value;
15837
+ const currLoading = reactData._isLoading || loading;
15828
15838
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
15829
15839
  ref: refElem,
15830
15840
  class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
@@ -15846,8 +15856,8 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
15846
15856
  'is--animat': !!props.animat,
15847
15857
  'is--round': props.round,
15848
15858
  'is--stripe': !treeConfig && stripe,
15849
- 'is--loading': loading,
15850
- 'is--empty': !loading && !tableData.length,
15859
+ 'is--loading': currLoading,
15860
+ 'is--empty': !currLoading && !tableData.length,
15851
15861
  'is--scroll-y': overflowY,
15852
15862
  'is--scroll-x': overflowX,
15853
15863
  'is--virtual-x': scrollXLoad,
@@ -15930,7 +15940,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
15930
15940
  */
15931
15941
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)('vxe-loading'), {
15932
15942
  class: 'vxe-table--loading',
15933
- modelValue: loading,
15943
+ modelValue: currLoading,
15934
15944
  icon: loadingOpts.icon,
15935
15945
  text: loadingOpts.text
15936
15946
  }, loadingSlot ? {