vxe-table 3.17.0-beta.8 → 3.17.0

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/es/grid/src/grid.js +88 -23
  2. package/es/style.css +1 -1
  3. package/es/table/module/custom/mixin.js +22 -14
  4. package/es/table/module/edit/mixin.js +5 -5
  5. package/es/table/src/body.js +7 -6
  6. package/es/table/src/cell.js +5 -5
  7. package/es/table/src/columnInfo.js +5 -0
  8. package/es/table/src/methods.js +201 -76
  9. package/es/table/src/table.js +7 -6
  10. package/es/table/src/util.js +9 -0
  11. package/es/ui/index.js +2 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/lib/grid/src/grid.js +104 -29
  14. package/lib/grid/src/grid.min.js +1 -1
  15. package/lib/index.umd.js +407 -131
  16. package/lib/index.umd.min.js +1 -1
  17. package/lib/style.css +1 -1
  18. package/lib/table/module/custom/mixin.js +25 -13
  19. package/lib/table/module/custom/mixin.min.js +1 -1
  20. package/lib/table/module/edit/mixin.js +5 -0
  21. package/lib/table/module/edit/mixin.min.js +1 -1
  22. package/lib/table/src/body.js +7 -6
  23. package/lib/table/src/body.min.js +1 -1
  24. package/lib/table/src/cell.js +5 -4
  25. package/lib/table/src/cell.min.js +1 -1
  26. package/lib/table/src/columnInfo.js +5 -0
  27. package/lib/table/src/columnInfo.min.js +1 -1
  28. package/lib/table/src/methods.js +238 -73
  29. package/lib/table/src/methods.min.js +1 -1
  30. package/lib/table/src/table.js +7 -6
  31. package/lib/table/src/table.min.js +1 -1
  32. package/lib/table/src/util.js +10 -0
  33. package/lib/table/src/util.min.js +1 -1
  34. package/lib/ui/index.js +2 -1
  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/package.json +2 -2
  39. package/packages/grid/src/grid.ts +101 -25
  40. package/packages/table/module/custom/mixin.ts +21 -13
  41. package/packages/table/module/edit/mixin.ts +5 -5
  42. package/packages/table/src/body.ts +7 -6
  43. package/packages/table/src/cell.ts +5 -5
  44. package/packages/table/src/columnInfo.ts +7 -0
  45. package/packages/table/src/methods.ts +215 -76
  46. package/packages/table/src/props.ts +1 -1
  47. package/packages/table/src/table.ts +7 -6
  48. package/packages/table/src/util.ts +10 -0
  49. package/packages/ui/index.ts +1 -0
  50. /package/es/{iconfont.1753445505513.ttf → iconfont.1753928711953.ttf} +0 -0
  51. /package/es/{iconfont.1753445505513.woff → iconfont.1753928711953.woff} +0 -0
  52. /package/es/{iconfont.1753445505513.woff2 → iconfont.1753928711953.woff2} +0 -0
  53. /package/lib/{iconfont.1753445505513.ttf → iconfont.1753928711953.ttf} +0 -0
  54. /package/lib/{iconfont.1753445505513.woff → iconfont.1753928711953.woff} +0 -0
  55. /package/lib/{iconfont.1753445505513.woff2 → iconfont.1753928711953.woff2} +0 -0
@@ -23,9 +23,11 @@ function getTableOns(_vm) {
23
23
  if (proxyConfig) {
24
24
  if (proxyOpts.sort) {
25
25
  ons['sort-change'] = _vm.sortChangeEvent;
26
+ ons['clear-all-sort'] = _vm.clearAllSortEvent;
26
27
  }
27
28
  if (proxyOpts.filter) {
28
29
  ons['filter-change'] = _vm.filterChangeEvent;
30
+ ons['clear-all-filter'] = _vm.clearAllFilterEvent;
29
31
  }
30
32
  }
31
33
  return ons;
@@ -251,6 +253,12 @@ export default {
251
253
  const pagerOpts = $xeGrid.computePagerOpts;
252
254
  return pagerOpts.total;
253
255
  },
256
+ computePageCount() {
257
+ const $xeGrid = this;
258
+ const reactData = $xeGrid.reactData;
259
+ const { tablePage } = reactData;
260
+ return Math.max(Math.ceil(tablePage.total / tablePage.pageSize), 1);
261
+ },
254
262
  computeIsLoading() {
255
263
  const $xeGrid = this;
256
264
  const props = $xeGrid;
@@ -321,7 +329,7 @@ export default {
321
329
  tablePage.pageSize = pageSize;
322
330
  }
323
331
  if (total) {
324
- tablePage.pageSize = total;
332
+ tablePage.total = total;
325
333
  }
326
334
  }
327
335
  }
@@ -919,29 +927,63 @@ export default {
919
927
  return $xeGrid.$nextTick();
920
928
  },
921
929
  homePage() {
930
+ const $xeGrid = this;
931
+ const reactData = $xeGrid.reactData;
932
+ const { tablePage } = reactData;
933
+ tablePage.currentPage = 1;
934
+ return $xeGrid.$nextTick();
935
+ },
936
+ homePageByEvent(evnt) {
922
937
  const $xeGrid = this;
923
938
  const $pager = $xeGrid.$refs.refPager;
924
939
  if ($pager) {
925
- return $pager.homePage();
940
+ $pager.homePageByEvent(evnt);
926
941
  }
927
- return $xeGrid.$nextTick();
928
942
  },
929
943
  endPage() {
944
+ const $xeGrid = this;
945
+ const reactData = $xeGrid.reactData;
946
+ const { tablePage } = reactData;
947
+ const pageCount = $xeGrid.computePageCount;
948
+ tablePage.currentPage = pageCount;
949
+ return $xeGrid.$nextTick();
950
+ },
951
+ endPageByEvent(evnt) {
930
952
  const $xeGrid = this;
931
953
  const $pager = $xeGrid.$refs.refPager;
932
954
  if ($pager) {
933
- return $pager.endPage();
955
+ $pager.endPageByEvent(evnt);
934
956
  }
957
+ },
958
+ setCurrentPage(currentPage) {
959
+ const $xeGrid = this;
960
+ const reactData = $xeGrid.reactData;
961
+ const { tablePage } = reactData;
962
+ const pageCount = $xeGrid.computePageCount;
963
+ tablePage.currentPage = Math.min(pageCount, Math.max(1, XEUtils.toNumber(currentPage)));
935
964
  return $xeGrid.$nextTick();
936
965
  },
937
- jumpPage(currentPage) {
966
+ setCurrentPageByEvent(evnt, currentPage) {
938
967
  const $xeGrid = this;
939
968
  const $pager = $xeGrid.$refs.refPager;
940
969
  if ($pager) {
941
- return $pager.jumpPage(currentPage);
970
+ $pager.setCurrentPageByEvent(evnt, currentPage);
942
971
  }
972
+ },
973
+ setPageSize(pageSize) {
974
+ const $xeGrid = this;
975
+ const reactData = $xeGrid.reactData;
976
+ const { tablePage } = reactData;
977
+ tablePage.pageSize = Math.max(1, XEUtils.toNumber(pageSize));
943
978
  return $xeGrid.$nextTick();
944
979
  },
980
+ setPageSizeByEvent(evnt, pageSize) {
981
+ const $xeGrid = this;
982
+ const $pager = $xeGrid.$refs.refPager;
983
+ if ($pager) {
984
+ $pager.setPageSizeByEvent(evnt, pageSize);
985
+ }
986
+ },
945
987
  triggerToolbarCommitEvent(params, evnt) {
946
988
  const $xeGrid = this;
947
989
  const { code } = params;
@@ -961,7 +1003,24 @@ export default {
961
1003
  $xeGrid.triggerToolbarCommitEvent(tool, evnt);
962
1004
  $xeGrid.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt);
963
1005
  },
964
- sortChangeEvent(params) {
1006
+ pageChangeEvent(params) {
1007
+ const $xeGrid = this;
1008
+ const props = $xeGrid;
1009
+ const reactData = $xeGrid.reactData;
1010
+ const { proxyConfig } = props;
1011
+ const { tablePage } = reactData;
1012
+ const { $event, currentPage, pageSize } = params;
1013
+ const proxyOpts = $xeGrid.computeProxyOpts;
1014
+ tablePage.currentPage = currentPage;
1015
+ tablePage.pageSize = pageSize;
1016
+ $xeGrid.dispatchEvent('page-change', params, $event);
1017
+ if (proxyConfig && isEnableConf(proxyOpts)) {
1018
+ $xeGrid.commitProxy('query').then((rest) => {
1019
+ $xeGrid.dispatchEvent('proxy-query', rest, $event);
1020
+ });
1021
+ }
1022
+ },
1023
+ handleSortEvent(params) {
965
1024
  const $xeGrid = this;
966
1025
  const props = $xeGrid;
967
1026
  const reactData = $xeGrid.reactData;
@@ -979,26 +1038,18 @@ export default {
979
1038
  });
980
1039
  }
981
1040
  }
1041
+ },
1042
+ sortChangeEvent(params) {
1043
+ const $xeGrid = this;
1044
+ $xeGrid.handleSortEvent(params);
982
1045
  $xeGrid.dispatchEvent('sort-change', params, params.$event);
983
1046
  },
984
- pageChangeEvent(params) {
1047
+ clearAllSortEvent(params) {
985
1048
  const $xeGrid = this;
986
- const props = $xeGrid;
987
- const reactData = $xeGrid.reactData;
988
- const { proxyConfig } = props;
989
- const { tablePage } = reactData;
990
- const { $event, currentPage, pageSize } = params;
991
- const proxyOpts = $xeGrid.computeProxyOpts;
992
- tablePage.currentPage = currentPage;
993
- tablePage.pageSize = pageSize;
994
- $xeGrid.dispatchEvent('page-change', params, $event);
995
- if (proxyConfig && isEnableConf(proxyOpts)) {
996
- $xeGrid.commitProxy('query').then((rest) => {
997
- $xeGrid.dispatchEvent('proxy-query', rest, $event);
998
- });
999
- }
1049
+ $xeGrid.handleSortEvent(params);
1050
+ $xeGrid.dispatchEvent('clear-all-sort', params, params.$event);
1000
1051
  },
1001
- filterChangeEvent(params) {
1052
+ handleFilterEvent(params) {
1002
1053
  const $xeGrid = this;
1003
1054
  const props = $xeGrid;
1004
1055
  const reactData = $xeGrid.reactData;
@@ -1016,8 +1067,17 @@ export default {
1016
1067
  });
1017
1068
  }
1018
1069
  }
1070
+ },
1071
+ filterChangeEvent(params) {
1072
+ const $xeGrid = this;
1073
+ $xeGrid.handleFilterEvent(params);
1019
1074
  $xeGrid.dispatchEvent('filter-change', params, params.$event);
1020
1075
  },
1076
+ clearAllFilterEvent(params) {
1077
+ const $xeGrid = this;
1078
+ $xeGrid.handleFilterEvent(params);
1079
+ $xeGrid.dispatchEvent('clear-all-filter', params, params.$event);
1080
+ },
1021
1081
  submitFormEvent(params) {
1022
1082
  const $xeGrid = this;
1023
1083
  const props = $xeGrid;
@@ -1065,6 +1125,11 @@ export default {
1065
1125
  $xeGrid.zoom();
1066
1126
  $xeGrid.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt);
1067
1127
  },
1128
+ getParams() {
1129
+ const $xeGrid = this;
1130
+ const props = $xeGrid;
1131
+ return props.params;
1132
+ },
1068
1133
  zoom() {
1069
1134
  const $xeGrid = this;
1070
1135
  const reactData = $xeGrid.reactData;