vxe-table 4.20.9 → 4.20.10

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 (39) hide show
  1. package/dist/all.esm.js +323 -202
  2. package/dist/style.css +1 -1
  3. package/es/grid/src/grid.js +252 -161
  4. package/es/style.css +1 -1
  5. package/es/table/module/custom/panel.js +3 -3
  6. package/es/table/module/export/hook.js +53 -33
  7. package/es/table/render/index.js +12 -2
  8. package/es/table/src/table.js +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/grid/src/grid.js +321 -204
  12. package/lib/grid/src/grid.min.js +1 -1
  13. package/lib/index.umd.js +440 -257
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/table/module/custom/panel.js +3 -3
  17. package/lib/table/module/custom/panel.min.js +1 -1
  18. package/lib/table/module/export/hook.js +67 -40
  19. package/lib/table/module/export/hook.min.js +1 -1
  20. package/lib/table/render/index.js +24 -2
  21. package/lib/table/render/index.min.js +1 -1
  22. package/lib/table/src/table.js +1 -1
  23. package/lib/table/src/table.min.js +1 -1
  24. package/lib/ui/index.js +1 -1
  25. package/lib/ui/index.min.js +1 -1
  26. package/lib/ui/src/log.js +1 -1
  27. package/lib/ui/src/log.min.js +1 -1
  28. package/package.json +2 -2
  29. package/packages/grid/src/grid.ts +243 -153
  30. package/packages/table/module/custom/panel.ts +3 -3
  31. package/packages/table/module/export/hook.ts +51 -30
  32. package/packages/table/render/index.ts +12 -2
  33. package/packages/table/src/table.ts +1 -1
  34. /package/es/{iconfont.1785242738274.ttf → iconfont.1785940490728.ttf} +0 -0
  35. /package/es/{iconfont.1785242738274.woff → iconfont.1785940490728.woff} +0 -0
  36. /package/es/{iconfont.1785242738274.woff2 → iconfont.1785940490728.woff2} +0 -0
  37. /package/lib/{iconfont.1785242738274.ttf → iconfont.1785940490728.ttf} +0 -0
  38. /package/lib/{iconfont.1785242738274.woff → iconfont.1785940490728.woff} +0 -0
  39. /package/lib/{iconfont.1785242738274.woff2 → iconfont.1785940490728.woff2} +0 -0
package/dist/all.esm.js CHANGED
@@ -44,7 +44,7 @@ function eqEmptyValue(cellValue) {
44
44
  return cellValue === '' || XEUtils.eqNull(cellValue);
45
45
  }
46
46
 
47
- const version = "4.20.9";
47
+ const version = "4.20.10";
48
48
  VxeUI.version = version;
49
49
  VxeUI.tableVersion = version;
50
50
  VxeUI.setConfig({
@@ -758,7 +758,7 @@ function wheelScrollTopTo(diffNum, cb) {
758
758
  }
759
759
 
760
760
  const { log } = VxeUI;
761
- const tableVersion = `table v${"4.20.9"}`;
761
+ const tableVersion = `table v${"4.20.10"}`;
762
762
  function createComponentLog(name) {
763
763
  const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
764
764
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
@@ -6964,7 +6964,7 @@ var TableCustomPanelComponent = defineVxeComponent({
6964
6964
  }, VxeUIRadioGroupComponent
6965
6965
  ? [
6966
6966
  h(VxeUIRadioGroupComponent, {
6967
- modelValue: column.renderAlign || '',
6967
+ modelValue: column.renderAlign || 'left',
6968
6968
  type: 'button',
6969
6969
  strict: false,
6970
6970
  disabled: isHidden,
@@ -6985,7 +6985,7 @@ var TableCustomPanelComponent = defineVxeComponent({
6985
6985
  : (VxeUIRadioGroupComponent
6986
6986
  ? [
6987
6987
  h(VxeUIRadioGroupComponent, {
6988
- modelValue: column.renderHeaderAlign || '',
6988
+ modelValue: column.renderHeaderAlign || 'left',
6989
6989
  type: 'button',
6990
6990
  strict: false,
6991
6991
  disabled: isHidden,
@@ -7006,7 +7006,7 @@ var TableCustomPanelComponent = defineVxeComponent({
7006
7006
  : (VxeUIRadioGroupComponent
7007
7007
  ? [
7008
7008
  h(VxeUIRadioGroupComponent, {
7009
- modelValue: column.renderFooterAlign || '',
7009
+ modelValue: column.renderFooterAlign || 'left',
7010
7010
  type: 'button',
7011
7011
  strict: false,
7012
7012
  disabled: isHidden,
@@ -12055,15 +12055,17 @@ hooks$4.add('tableExportModule', {
12055
12055
  const { computeProxyOpts } = $xeGGWrapper.getComputeMaps();
12056
12056
  const proxyOpts = computeProxyOpts.value;
12057
12057
  const { sortData } = gridReactData;
12058
- const { beforeQueryAll, afterQueryAll, ajax = {} } = proxyOpts;
12058
+ const { beforeQueryAll: oldBeforeQueryAll, afterQueryAll: oldAfterQueryAll, ajax = {} } = proxyOpts;
12059
12059
  const resConfigs = proxyOpts.response || proxyOpts.props || {};
12060
- const ajaxMethods = ajax.queryAll;
12061
- const queryAllSuccessMethods = ajax.queryAllSuccess;
12062
- const queryAllErrorMethods = ajax.queryAllError;
12063
- if (!ajaxMethods) {
12060
+ const beforeQueryAllMethod = ajax.beforeQueryAll;
12061
+ const queryAllMethod = ajax.queryAll;
12062
+ const afterQueryAllMethod = ajax.afterQueryAll;
12063
+ const queryAllSuccessMethod = ajax.queryAllSuccess;
12064
+ const queryAllErrorMethod = ajax.queryAllError;
12065
+ if (!queryAllMethod) {
12064
12066
  errLog$5('vxe.error.notFunc', ['proxy-config.ajax.queryAll']);
12065
12067
  }
12066
- if (ajaxMethods) {
12068
+ if (queryAllMethod) {
12067
12069
  const params = {
12068
12070
  $table: $xeTable,
12069
12071
  $grid: $xeGrid,
@@ -12074,37 +12076,55 @@ hooks$4.add('tableExportModule', {
12074
12076
  form: gridReactData.formData,
12075
12077
  options: handleOptions
12076
12078
  };
12077
- return Promise.resolve((beforeQueryAll || ajaxMethods)(params))
12078
- .then(rest => {
12079
- const listProp = resConfigs.list;
12080
- let tdData = [];
12081
- if (listProp) {
12082
- if (XEUtils.isFunction(listProp)) {
12083
- tdData = listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
12079
+ const handleQueryAll = () => {
12080
+ return Promise.resolve((oldBeforeQueryAll || queryAllMethod)(params))
12081
+ .then((rest) => {
12082
+ if (afterQueryAllMethod) {
12083
+ afterQueryAllMethod(Object.assign(Object.assign({}, params), { response: rest, status: 'success' }));
12084
12084
  }
12085
12085
  else {
12086
- tdData = XEUtils.isArray(rest) ? rest : XEUtils.get(rest, listProp);
12086
+ const listProp = resConfigs.list;
12087
+ let tdData = [];
12088
+ if (listProp) {
12089
+ if (XEUtils.isFunction(listProp)) {
12090
+ tdData = listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
12091
+ }
12092
+ else {
12093
+ tdData = XEUtils.isArray(rest) ? rest : XEUtils.get(rest, listProp);
12094
+ }
12095
+ }
12096
+ else {
12097
+ if (XEUtils.isArray(rest)) {
12098
+ tdData = rest;
12099
+ }
12100
+ }
12101
+ handleOptions.data = tdData;
12102
+ if (oldAfterQueryAll) {
12103
+ oldAfterQueryAll(Object.assign(Object.assign({}, params), { response: rest }));
12104
+ }
12087
12105
  }
12088
- }
12089
- else {
12090
- if (XEUtils.isArray(rest)) {
12091
- tdData = rest;
12106
+ if (queryAllSuccessMethod) {
12107
+ queryAllSuccessMethod(Object.assign(Object.assign({}, params), { response: rest }));
12092
12108
  }
12093
- }
12094
- handleOptions.data = tdData;
12095
- if (afterQueryAll) {
12096
- afterQueryAll(params);
12097
- }
12098
- if (queryAllSuccessMethods) {
12099
- queryAllSuccessMethods(Object.assign(Object.assign({}, params), { response: rest }));
12100
- }
12101
- return handleExport(handleOptions);
12102
- })
12103
- .catch((rest) => {
12104
- if (queryAllErrorMethods) {
12105
- queryAllErrorMethods(Object.assign(Object.assign({}, params), { response: rest }));
12106
- }
12107
- });
12109
+ return handleExport(handleOptions);
12110
+ })
12111
+ .catch((rest) => {
12112
+ if (afterQueryAllMethod) {
12113
+ afterQueryAllMethod(Object.assign(Object.assign({}, params), { response: rest, status: 'error' }));
12114
+ }
12115
+ if (queryAllErrorMethod) {
12116
+ queryAllErrorMethod(Object.assign(Object.assign({}, params), { response: rest }));
12117
+ }
12118
+ });
12119
+ };
12120
+ if (beforeQueryAllMethod) {
12121
+ return Promise.resolve(beforeQueryAllMethod(params)).then(status => {
12122
+ if (status !== false) {
12123
+ return handleQueryAll();
12124
+ }
12125
+ });
12126
+ }
12127
+ return handleQueryAll();
12108
12128
  }
12109
12129
  }
12110
12130
  }
@@ -14775,7 +14795,12 @@ renderer$2.mixin({
14775
14795
  },
14776
14796
  FormatNumberInput: {
14777
14797
  renderTableDefault: handleNumberCell,
14778
- tableFilterDefaultMethod: handleInputFilterMethod,
14798
+ tableFilterDefaultMethod({ option, row, column }) {
14799
+ const { data } = option;
14800
+ const cellValue = XEUtils.get(row, column.field);
14801
+ /* eslint-disable eqeqeq */
14802
+ return cellValue == data;
14803
+ },
14779
14804
  tableExportMethod(params) {
14780
14805
  const { row, column } = params;
14781
14806
  const cellValue = XEUtils.get(row, column.field);
@@ -14827,7 +14852,12 @@ renderer$2.mixin({
14827
14852
  createTableFilterOptions: defaultFilterOptions,
14828
14853
  renderTableFilter: defaultFilterRender,
14829
14854
  renderTableFloatingFilter: defaultFloatingFilterRender,
14830
- tableFilterDefaultMethod: handleInputFilterMethod,
14855
+ tableFilterDefaultMethod({ option, row, column }) {
14856
+ const { data } = option;
14857
+ const cellValue = XEUtils.get(row, column.field);
14858
+ /* eslint-disable eqeqeq */
14859
+ return cellValue == data;
14860
+ },
14831
14861
  tableExportMethod(params) {
14832
14862
  const { row, column } = params;
14833
14863
  const cellValue = XEUtils.get(row, column.field);
@@ -18765,7 +18795,7 @@ var VxeTableComponent = defineVxeComponent({
18765
18795
  return;
18766
18796
  }
18767
18797
  internalData.rsePending = true;
18768
- handleLazyRecalculate(false, true, true, {
18798
+ handleLazyRecalculate(true, true, true, {
18769
18799
  minRunDelay: 200
18770
18800
  }).then(() => {
18771
18801
  internalData.rsePending = false;
@@ -31563,7 +31593,7 @@ var VxeGridComponent = defineVxeComponent({
31563
31593
  const proxyOpts = computeProxyOpts.value;
31564
31594
  const pagerOpts = computePagerOpts.value;
31565
31595
  const toolbarOpts = computeToolbarOpts.value;
31566
- const { beforeQuery, afterQuery, beforeQueryFooter, afterQueryFooter, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts;
31596
+ const { beforeQuery: oldBeforeQuery, afterQuery: oldAfterQuery, beforeQueryFooter: oldBeforeQueryFooter, afterQueryFooter: oldAfterQueryFooter, beforeDelete: oldBeforeDelete, afterDelete: oldAfterDelete, beforeSave: oldBeforeSave, afterSave: oldAfterSave, ajax = {} } = proxyOpts;
31567
31597
  const resConfigs = (proxyOpts.response || proxyOpts.props || {});
31568
31598
  const $xeTable = refTable.value;
31569
31599
  if (!$xeTable) {
@@ -31614,10 +31644,12 @@ var VxeGridComponent = defineVxeComponent({
31614
31644
  case 'initial':
31615
31645
  case 'reload':
31616
31646
  case 'query': {
31617
- const qMethods = ajax.query;
31618
- const qsMethods = ajax.querySuccess;
31619
- const qeMethods = ajax.queryError;
31620
- if (qMethods) {
31647
+ const bqMethod = ajax.beforeQuery;
31648
+ const qMethod = ajax.query;
31649
+ const aqMethod = ajax.afterQuery;
31650
+ const qsMethod = ajax.querySuccess;
31651
+ const qeMethod = ajax.queryError;
31652
+ if (qMethod) {
31621
31653
  const isInited = code === 'initial';
31622
31654
  const isReload = code === 'reload';
31623
31655
  if (!isInited && reactData.tableLoading) {
@@ -31699,73 +31731,91 @@ var VxeGridComponent = defineVxeComponent({
31699
31731
  sorts: sortList,
31700
31732
  filters: filterList,
31701
31733
  form: formData,
31702
- options: qMethods
31734
+ options: qMethod
31703
31735
  };
31704
- reactData.sortData = sortList;
31705
- reactData.filterData = filterList;
31706
- reactData.tableLoading = true;
31707
- return Promise.all([
31708
- Promise.resolve((beforeQuery || qMethods)(commitParams, ...args)),
31709
- operPromise
31710
- ]).then(([rest]) => {
31711
- let tableData = [];
31712
- reactData.tableLoading = false;
31713
- if (rest) {
31714
- const reParams = { data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null };
31715
- if (pagerConfig && isEnableConf(pagerOpts)) {
31716
- const totalProp = resConfigs.total;
31717
- const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
31718
- tablePage.total = XEUtils.toNumber(total);
31719
- const resultProp = resConfigs.result;
31720
- tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
31721
- // 检验当前页码,不能超出当前最大页数
31722
- const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
31723
- if (tablePage.currentPage > pageCount) {
31724
- tablePage.currentPage = pageCount;
31725
- }
31736
+ const handleQuery = () => {
31737
+ reactData.sortData = sortList;
31738
+ reactData.filterData = filterList;
31739
+ reactData.tableLoading = true;
31740
+ return Promise.all([
31741
+ Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)),
31742
+ operPromise
31743
+ ]).then(([rest]) => {
31744
+ reactData.tableLoading = false;
31745
+ if (aqMethod) {
31746
+ aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31726
31747
  }
31727
31748
  else {
31728
- const listProp = resConfigs.list;
31729
- if (XEUtils.isArray(rest)) {
31730
- tableData = rest;
31731
- }
31732
- else if (listProp) {
31733
- tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || [];
31734
- }
31735
- }
31736
- if (showFooter) {
31737
- const fdProp = resConfigs.footerData;
31738
- const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : [];
31739
- if (XEUtils.isArray(footerList)) {
31740
- reactData.footerData = footerList;
31749
+ let tableData = [];
31750
+ if (rest) {
31751
+ const reParams = { data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null };
31752
+ if (pagerConfig && isEnableConf(pagerOpts)) {
31753
+ const totalProp = resConfigs.total;
31754
+ const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
31755
+ tablePage.total = XEUtils.toNumber(total);
31756
+ const resultProp = resConfigs.result;
31757
+ tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
31758
+ // 检验当前页码,不能超出当前最大页数
31759
+ const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
31760
+ if (tablePage.currentPage > pageCount) {
31761
+ tablePage.currentPage = pageCount;
31762
+ }
31763
+ }
31764
+ else {
31765
+ const listProp = resConfigs.list;
31766
+ if (XEUtils.isArray(rest)) {
31767
+ tableData = rest;
31768
+ }
31769
+ else if (listProp) {
31770
+ tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || [];
31771
+ }
31772
+ }
31773
+ if (showFooter) {
31774
+ const fdProp = resConfigs.footerData;
31775
+ const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : [];
31776
+ if (XEUtils.isArray(footerList)) {
31777
+ reactData.footerData = footerList;
31778
+ }
31779
+ }
31741
31780
  }
31742
- }
31743
- }
31744
- if ($xeTable) {
31745
- $xeTable.loadData(tableData);
31746
- }
31747
- else {
31748
- nextTick(() => {
31749
- const $xeTable = refTable.value;
31750
31781
  if ($xeTable) {
31751
31782
  $xeTable.loadData(tableData);
31752
31783
  }
31753
- });
31754
- }
31755
- if (afterQuery) {
31756
- afterQuery(commitParams, ...args);
31757
- }
31758
- if (qsMethods) {
31759
- qsMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31760
- }
31761
- return { status: true };
31762
- }).catch((rest) => {
31763
- reactData.tableLoading = false;
31764
- if (qeMethods) {
31765
- qeMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31766
- }
31767
- return { status: false };
31768
- });
31784
+ else {
31785
+ nextTick(() => {
31786
+ const $xeTable = refTable.value;
31787
+ if ($xeTable) {
31788
+ $xeTable.loadData(tableData);
31789
+ }
31790
+ });
31791
+ }
31792
+ if (oldAfterQuery) {
31793
+ oldAfterQuery(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
31794
+ }
31795
+ }
31796
+ if (qsMethod) {
31797
+ qsMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31798
+ }
31799
+ return { status: true };
31800
+ }).catch((rest) => {
31801
+ reactData.tableLoading = false;
31802
+ if (aqMethod) {
31803
+ aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
31804
+ }
31805
+ if (qeMethod) {
31806
+ qeMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31807
+ }
31808
+ return { status: false };
31809
+ });
31810
+ };
31811
+ if (bqMethod) {
31812
+ return Promise.resolve(bqMethod(commitParams, ...args)).then(status => {
31813
+ if (status !== false) {
31814
+ return handleQuery();
31815
+ }
31816
+ });
31817
+ }
31818
+ return handleQuery();
31769
31819
  }
31770
31820
  else {
31771
31821
  errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
@@ -31773,39 +31823,66 @@ var VxeGridComponent = defineVxeComponent({
31773
31823
  break;
31774
31824
  }
31775
31825
  case 'queryFooter': {
31776
- const qfMethods = ajax.queryFooter;
31777
- const qfSuccessMethods = ajax.queryFooterSuccess;
31778
- const qfErrorMethods = ajax.queryFooterError;
31779
- if (qfMethods) {
31826
+ const bqfMethod = ajax.beforeQueryFooter;
31827
+ const qfMethod = ajax.queryFooter;
31828
+ const aqfMethod = ajax.afterQueryFooter;
31829
+ const qfSuccessMethod = ajax.queryFooterSuccess;
31830
+ const qfErrorMethod = ajax.queryFooterError;
31831
+ if (qfMethod) {
31780
31832
  let filterList = [];
31781
31833
  if ($xeTable) {
31782
31834
  filterList = $xeTable.getCheckedFilters();
31783
31835
  }
31836
+ let pageParams = {};
31837
+ if (pagerConfig) {
31838
+ if (isEnableConf(pagerOpts)) {
31839
+ pageParams = Object.assign({}, tablePage);
31840
+ }
31841
+ }
31784
31842
  const commitParams = {
31785
31843
  $table: $xeTable,
31786
31844
  $grid: $xeGrid,
31787
31845
  $gantt: null,
31788
31846
  code,
31789
31847
  button,
31848
+ page: pageParams,
31790
31849
  filters: filterList,
31791
31850
  form: formData,
31792
- options: qfMethods
31851
+ options: qfMethod
31793
31852
  };
31794
- return Promise.resolve((beforeQueryFooter || qfMethods)(commitParams, ...args)).then(rest => {
31795
- reactData.footerData = XEUtils.isArray(rest) ? rest : [];
31796
- if (afterQueryFooter) {
31797
- afterQueryFooter(commitParams, ...args);
31798
- }
31799
- if (qfSuccessMethods) {
31800
- qfSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31801
- }
31802
- return { status: true };
31803
- }).catch((rest) => {
31804
- if (qfErrorMethods) {
31805
- qfErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31806
- }
31807
- return { status: false };
31808
- });
31853
+ const handleQueryFooter = () => {
31854
+ return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args)).then(rest => {
31855
+ if (aqfMethod) {
31856
+ aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31857
+ }
31858
+ else {
31859
+ reactData.footerData = XEUtils.isArray(rest) ? rest : [];
31860
+ if (oldAfterQueryFooter) {
31861
+ oldAfterQueryFooter(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
31862
+ }
31863
+ }
31864
+ if (qfSuccessMethod) {
31865
+ qfSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31866
+ }
31867
+ return { status: true };
31868
+ }).catch((rest) => {
31869
+ if (aqfMethod) {
31870
+ aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
31871
+ }
31872
+ if (qfErrorMethod) {
31873
+ qfErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31874
+ }
31875
+ return { status: false };
31876
+ });
31877
+ };
31878
+ if (bqfMethod) {
31879
+ return Promise.resolve(bqfMethod(commitParams, ...args)).then(status => {
31880
+ if (status !== false) {
31881
+ return handleQueryFooter();
31882
+ }
31883
+ });
31884
+ }
31885
+ return handleQueryFooter();
31809
31886
  }
31810
31887
  else {
31811
31888
  errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter']);
@@ -31813,10 +31890,12 @@ var VxeGridComponent = defineVxeComponent({
31813
31890
  break;
31814
31891
  }
31815
31892
  case 'delete': {
31816
- const dMethods = ajax.delete;
31893
+ const bdMethod = ajax.beforeDelete;
31894
+ const dMethod = ajax.delete;
31895
+ const adMethod = ajax.afterDelete;
31817
31896
  const deleteSuccessMethods = ajax.deleteSuccess;
31818
31897
  const deleteErrorMethods = ajax.deleteError;
31819
- if (dMethods) {
31898
+ if (dMethod) {
31820
31899
  const selectRecords = $xeGrid.getCheckboxRecords();
31821
31900
  const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
31822
31901
  const body = { removeRecords };
@@ -31828,49 +31907,69 @@ var VxeGridComponent = defineVxeComponent({
31828
31907
  button,
31829
31908
  body,
31830
31909
  form: formData,
31831
- options: dMethods
31910
+ options: dMethod
31832
31911
  };
31833
31912
  if (selectRecords.length) {
31834
31913
  return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
31835
31914
  if (!removeRecords.length) {
31836
31915
  return $xeTable.remove(selectRecords);
31837
31916
  }
31838
- reactData.tableLoading = true;
31839
- return Promise.resolve((beforeDelete || dMethods)(commitParams, ...args))
31840
- .then(rest => {
31841
- reactData.tableLoading = false;
31842
- $xeTable.setPendingRow(removeRecords, false);
31843
- if (isRespMsg) {
31844
- if (VxeUI.modal) {
31845
- VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' });
31917
+ const handleDelete = () => {
31918
+ reactData.tableLoading = true;
31919
+ return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args))
31920
+ .then(rest => {
31921
+ reactData.tableLoading = false;
31922
+ if (adMethod) {
31923
+ adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31846
31924
  }
31847
- }
31848
- if (afterDelete) {
31849
- afterDelete(commitParams, ...args);
31850
- }
31851
- else {
31852
- internalData.uFoot = true;
31853
- $xeGrid.commitProxy('query');
31854
- internalData.uFoot = false;
31855
- updateQueryFooter();
31856
- }
31857
- if (deleteSuccessMethods) {
31858
- deleteSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31859
- }
31860
- return { status: true };
31861
- })
31862
- .catch(rest => {
31863
- reactData.tableLoading = false;
31864
- if (isRespMsg) {
31865
- if (VxeUI.modal) {
31866
- VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
31925
+ else {
31926
+ $xeTable.setPendingRow(removeRecords, false);
31927
+ if (isRespMsg) {
31928
+ if (VxeUI.modal) {
31929
+ VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' });
31930
+ }
31931
+ }
31932
+ if (oldAfterDelete) {
31933
+ oldAfterDelete(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
31934
+ }
31935
+ else {
31936
+ internalData.uFoot = true;
31937
+ $xeGrid.commitProxy('query');
31938
+ internalData.uFoot = false;
31939
+ updateQueryFooter();
31940
+ }
31867
31941
  }
31868
- }
31869
- if (deleteErrorMethods) {
31870
- deleteErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31871
- }
31872
- return { status: false };
31873
- });
31942
+ if (deleteSuccessMethods) {
31943
+ deleteSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31944
+ }
31945
+ return { status: true };
31946
+ })
31947
+ .catch(rest => {
31948
+ reactData.tableLoading = false;
31949
+ if (adMethod) {
31950
+ adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
31951
+ }
31952
+ else {
31953
+ if (isRespMsg) {
31954
+ if (VxeUI.modal) {
31955
+ VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
31956
+ }
31957
+ }
31958
+ }
31959
+ if (deleteErrorMethods) {
31960
+ deleteErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31961
+ }
31962
+ return { status: false };
31963
+ });
31964
+ };
31965
+ if (bdMethod) {
31966
+ return Promise.resolve(bdMethod(commitParams, ...args)).then(status => {
31967
+ if (status !== false) {
31968
+ return handleDelete();
31969
+ }
31970
+ });
31971
+ }
31972
+ return handleDelete();
31874
31973
  });
31875
31974
  }
31876
31975
  else {
@@ -31887,10 +31986,12 @@ var VxeGridComponent = defineVxeComponent({
31887
31986
  break;
31888
31987
  }
31889
31988
  case 'save': {
31890
- const ajaxMethods = ajax.save;
31891
- const saveSuccessMethods = ajax.saveSuccess;
31892
- const saveErrorMethods = ajax.saveError;
31893
- if (ajaxMethods) {
31989
+ const bSaveMethod = ajax.beforeSave;
31990
+ const sMethod = ajax.save;
31991
+ const aSaveMethod = ajax.afterSave;
31992
+ const sSuccessMethod = ajax.saveSuccess;
31993
+ const sErrorMethod = ajax.saveError;
31994
+ if (sMethod) {
31894
31995
  const body = $xeTable.getRecordset();
31895
31996
  const { insertRecords, removeRecords, updateRecords, pendingRecords } = body;
31896
31997
  const commitParams = {
@@ -31901,7 +32002,7 @@ var VxeGridComponent = defineVxeComponent({
31901
32002
  button,
31902
32003
  body,
31903
32004
  form: formData,
31904
- options: ajaxMethods
32005
+ options: sMethod
31905
32006
  };
31906
32007
  // 排除掉新增且标记为删除的数据
31907
32008
  if (insertRecords.length) {
@@ -31922,42 +32023,62 @@ var VxeGridComponent = defineVxeComponent({
31922
32023
  return;
31923
32024
  }
31924
32025
  if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
31925
- reactData.tableLoading = true;
31926
- return Promise.resolve((beforeSave || ajaxMethods)(commitParams, ...args))
31927
- .then(rest => {
31928
- reactData.tableLoading = false;
31929
- $xeTable.clearPendingRow();
31930
- if (isRespMsg) {
31931
- if (VxeUI.modal) {
31932
- VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' });
32026
+ const handleSave = () => {
32027
+ reactData.tableLoading = true;
32028
+ return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args))
32029
+ .then(rest => {
32030
+ reactData.tableLoading = false;
32031
+ if (aSaveMethod) {
32032
+ aSaveMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31933
32033
  }
31934
- }
31935
- if (afterSave) {
31936
- afterSave(commitParams, ...args);
31937
- }
31938
- else {
31939
- internalData.uFoot = true;
31940
- $xeGrid.commitProxy('query');
31941
- internalData.uFoot = false;
31942
- updateQueryFooter();
31943
- }
31944
- if (saveSuccessMethods) {
31945
- saveSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31946
- }
31947
- return { status: true };
31948
- })
31949
- .catch(rest => {
31950
- reactData.tableLoading = false;
31951
- if (isRespMsg) {
31952
- if (VxeUI.modal) {
31953
- VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
32034
+ else {
32035
+ $xeTable.clearPendingRow();
32036
+ if (isRespMsg) {
32037
+ if (VxeUI.modal) {
32038
+ VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' });
32039
+ }
32040
+ }
32041
+ if (oldAfterSave) {
32042
+ oldAfterSave(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
32043
+ }
32044
+ else {
32045
+ internalData.uFoot = true;
32046
+ $xeGrid.commitProxy('query');
32047
+ internalData.uFoot = false;
32048
+ updateQueryFooter();
32049
+ }
31954
32050
  }
31955
- }
31956
- if (saveErrorMethods) {
31957
- saveErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31958
- }
31959
- return { status: false };
31960
- });
32051
+ if (sSuccessMethod) {
32052
+ sSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
32053
+ }
32054
+ return { status: true };
32055
+ })
32056
+ .catch(rest => {
32057
+ reactData.tableLoading = false;
32058
+ if (aSaveMethod) {
32059
+ aSaveMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
32060
+ }
32061
+ else {
32062
+ if (isRespMsg) {
32063
+ if (VxeUI.modal) {
32064
+ VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
32065
+ }
32066
+ }
32067
+ }
32068
+ if (sErrorMethod) {
32069
+ sErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
32070
+ }
32071
+ return { status: false };
32072
+ });
32073
+ };
32074
+ if (bSaveMethod) {
32075
+ return Promise.resolve(bSaveMethod(commitParams, ...args)).then(status => {
32076
+ if (status !== false) {
32077
+ return handleSave();
32078
+ }
32079
+ });
32080
+ }
32081
+ return handleSave();
31961
32082
  }
31962
32083
  else {
31963
32084
  if (isActiveMsg) {