vxe-table 4.20.9 → 4.20.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 (39) hide show
  1. package/dist/all.esm.js +339 -204
  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 +17 -3
  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 +442 -259
  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 +3 -3
  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 +17 -3
  34. /package/es/{iconfont.1785242738274.ttf → iconfont.1786329229929.ttf} +0 -0
  35. /package/es/{iconfont.1785242738274.woff → iconfont.1786329229929.woff} +0 -0
  36. /package/es/{iconfont.1785242738274.woff2 → iconfont.1786329229929.woff2} +0 -0
  37. /package/lib/{iconfont.1785242738274.ttf → iconfont.1786329229929.ttf} +0 -0
  38. /package/lib/{iconfont.1785242738274.woff → iconfont.1786329229929.woff} +0 -0
  39. /package/lib/{iconfont.1785242738274.woff2 → iconfont.1786329229929.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.11";
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.11"}`;
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;
@@ -20704,6 +20734,18 @@ var VxeTableComponent = defineVxeComponent({
20704
20734
  }
20705
20735
  const { editConfig } = props;
20706
20736
  const { formatter, editRender, cellRender } = column;
20737
+ let etOpSize = null;
20738
+ let etOgSize = null;
20739
+ let clOpSize = null;
20740
+ let clOgSize = null;
20741
+ if (editRender) {
20742
+ etOpSize = editRender.options ? editRender.options.length : 0;
20743
+ etOgSize = editRender.optionGroups ? editRender.optionGroups.length : 0;
20744
+ }
20745
+ if (cellRender) {
20746
+ clOpSize = cellRender.options ? cellRender.options.length : 0;
20747
+ clOgSize = cellRender.optionGroups ? cellRender.optionGroups.length : 0;
20748
+ }
20707
20749
  // formatter > tableCellFormatter
20708
20750
  const renderOpts = formatter ? null : (editConfig && isEnableConf(editRender) ? editRender : (isEnableConf(cellRender) ? cellRender : null));
20709
20751
  const compConf = renderOpts ? renderer$1.get(renderOpts.name) : null;
@@ -20722,7 +20764,8 @@ var VxeTableComponent = defineVxeComponent({
20722
20764
  formatData = fullAllDataRowIdData[rowid].formatData = {};
20723
20765
  }
20724
20766
  if (rowRest && formatData[colid]) {
20725
- if (formatData[colid].value === cellValue) {
20767
+ const ftValue = formatData[colid].value;
20768
+ if (ftValue && ftValue[0] === cellValue && ftValue[1] === etOpSize && ftValue[2] === etOgSize && ftValue[3] === clOpSize && ftValue[4] === clOgSize) {
20726
20769
  return formatData[colid].label;
20727
20770
  }
20728
20771
  }
@@ -20754,7 +20797,8 @@ var VxeTableComponent = defineVxeComponent({
20754
20797
  cellLabel = tcFormatter(renderOpts, formatParams);
20755
20798
  }
20756
20799
  if (formatData) {
20757
- formatData[colid] = { value: cellValue, label: cellLabel };
20800
+ const ftValue = [cellValue, etOpSize, etOgSize, clOpSize, clOgSize];
20801
+ formatData[colid] = { value: ftValue, label: cellLabel };
20758
20802
  }
20759
20803
  }
20760
20804
  return cellLabel;
@@ -31563,7 +31607,7 @@ var VxeGridComponent = defineVxeComponent({
31563
31607
  const proxyOpts = computeProxyOpts.value;
31564
31608
  const pagerOpts = computePagerOpts.value;
31565
31609
  const toolbarOpts = computeToolbarOpts.value;
31566
- const { beforeQuery, afterQuery, beforeQueryFooter, afterQueryFooter, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts;
31610
+ const { beforeQuery: oldBeforeQuery, afterQuery: oldAfterQuery, beforeQueryFooter: oldBeforeQueryFooter, afterQueryFooter: oldAfterQueryFooter, beforeDelete: oldBeforeDelete, afterDelete: oldAfterDelete, beforeSave: oldBeforeSave, afterSave: oldAfterSave, ajax = {} } = proxyOpts;
31567
31611
  const resConfigs = (proxyOpts.response || proxyOpts.props || {});
31568
31612
  const $xeTable = refTable.value;
31569
31613
  if (!$xeTable) {
@@ -31614,10 +31658,12 @@ var VxeGridComponent = defineVxeComponent({
31614
31658
  case 'initial':
31615
31659
  case 'reload':
31616
31660
  case 'query': {
31617
- const qMethods = ajax.query;
31618
- const qsMethods = ajax.querySuccess;
31619
- const qeMethods = ajax.queryError;
31620
- if (qMethods) {
31661
+ const bqMethod = ajax.beforeQuery;
31662
+ const qMethod = ajax.query;
31663
+ const aqMethod = ajax.afterQuery;
31664
+ const qsMethod = ajax.querySuccess;
31665
+ const qeMethod = ajax.queryError;
31666
+ if (qMethod) {
31621
31667
  const isInited = code === 'initial';
31622
31668
  const isReload = code === 'reload';
31623
31669
  if (!isInited && reactData.tableLoading) {
@@ -31699,73 +31745,91 @@ var VxeGridComponent = defineVxeComponent({
31699
31745
  sorts: sortList,
31700
31746
  filters: filterList,
31701
31747
  form: formData,
31702
- options: qMethods
31748
+ options: qMethod
31703
31749
  };
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
- }
31750
+ const handleQuery = () => {
31751
+ reactData.sortData = sortList;
31752
+ reactData.filterData = filterList;
31753
+ reactData.tableLoading = true;
31754
+ return Promise.all([
31755
+ Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)),
31756
+ operPromise
31757
+ ]).then(([rest]) => {
31758
+ reactData.tableLoading = false;
31759
+ if (aqMethod) {
31760
+ aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31726
31761
  }
31727
31762
  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;
31763
+ let tableData = [];
31764
+ if (rest) {
31765
+ const listProp = resConfigs.list;
31766
+ const resultProp = resConfigs.result;
31767
+ const reParams = { data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null };
31768
+ if (pagerConfig && isEnableConf(pagerOpts)) {
31769
+ const totalProp = resConfigs.total;
31770
+ const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
31771
+ tablePage.total = XEUtils.toNumber(total);
31772
+ tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
31773
+ // 检验当前页码,不能超出当前最大页数
31774
+ const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
31775
+ if (tablePage.currentPage > pageCount) {
31776
+ tablePage.currentPage = pageCount;
31777
+ }
31778
+ }
31779
+ else {
31780
+ if (XEUtils.isArray(rest)) {
31781
+ tableData = rest;
31782
+ }
31783
+ else if (listProp) {
31784
+ tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || [];
31785
+ }
31786
+ }
31787
+ if (showFooter) {
31788
+ const fdProp = resConfigs.footerData;
31789
+ const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : [];
31790
+ if (XEUtils.isArray(footerList)) {
31791
+ reactData.footerData = footerList;
31792
+ }
31793
+ }
31741
31794
  }
31742
- }
31743
- }
31744
- if ($xeTable) {
31745
- $xeTable.loadData(tableData);
31746
- }
31747
- else {
31748
- nextTick(() => {
31749
- const $xeTable = refTable.value;
31750
31795
  if ($xeTable) {
31751
31796
  $xeTable.loadData(tableData);
31752
31797
  }
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
- });
31798
+ else {
31799
+ nextTick(() => {
31800
+ const $xeTable = refTable.value;
31801
+ if ($xeTable) {
31802
+ $xeTable.loadData(tableData);
31803
+ }
31804
+ });
31805
+ }
31806
+ if (oldAfterQuery) {
31807
+ oldAfterQuery(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
31808
+ }
31809
+ }
31810
+ if (qsMethod) {
31811
+ qsMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31812
+ }
31813
+ return { status: true };
31814
+ }).catch((rest) => {
31815
+ reactData.tableLoading = false;
31816
+ if (aqMethod) {
31817
+ aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
31818
+ }
31819
+ if (qeMethod) {
31820
+ qeMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31821
+ }
31822
+ return { status: false };
31823
+ });
31824
+ };
31825
+ if (bqMethod) {
31826
+ return Promise.resolve(bqMethod(commitParams, ...args)).then(status => {
31827
+ if (status !== false) {
31828
+ return handleQuery();
31829
+ }
31830
+ });
31831
+ }
31832
+ return handleQuery();
31769
31833
  }
31770
31834
  else {
31771
31835
  errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
@@ -31773,39 +31837,66 @@ var VxeGridComponent = defineVxeComponent({
31773
31837
  break;
31774
31838
  }
31775
31839
  case 'queryFooter': {
31776
- const qfMethods = ajax.queryFooter;
31777
- const qfSuccessMethods = ajax.queryFooterSuccess;
31778
- const qfErrorMethods = ajax.queryFooterError;
31779
- if (qfMethods) {
31840
+ const bqfMethod = ajax.beforeQueryFooter;
31841
+ const qfMethod = ajax.queryFooter;
31842
+ const aqfMethod = ajax.afterQueryFooter;
31843
+ const qfSuccessMethod = ajax.queryFooterSuccess;
31844
+ const qfErrorMethod = ajax.queryFooterError;
31845
+ if (qfMethod) {
31780
31846
  let filterList = [];
31781
31847
  if ($xeTable) {
31782
31848
  filterList = $xeTable.getCheckedFilters();
31783
31849
  }
31850
+ let pageParams = {};
31851
+ if (pagerConfig) {
31852
+ if (isEnableConf(pagerOpts)) {
31853
+ pageParams = Object.assign({}, tablePage);
31854
+ }
31855
+ }
31784
31856
  const commitParams = {
31785
31857
  $table: $xeTable,
31786
31858
  $grid: $xeGrid,
31787
31859
  $gantt: null,
31788
31860
  code,
31789
31861
  button,
31862
+ page: pageParams,
31790
31863
  filters: filterList,
31791
31864
  form: formData,
31792
- options: qfMethods
31865
+ options: qfMethod
31793
31866
  };
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
- });
31867
+ const handleQueryFooter = () => {
31868
+ return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args)).then(rest => {
31869
+ if (aqfMethod) {
31870
+ aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31871
+ }
31872
+ else {
31873
+ reactData.footerData = XEUtils.isArray(rest) ? rest : [];
31874
+ if (oldAfterQueryFooter) {
31875
+ oldAfterQueryFooter(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
31876
+ }
31877
+ }
31878
+ if (qfSuccessMethod) {
31879
+ qfSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31880
+ }
31881
+ return { status: true };
31882
+ }).catch((rest) => {
31883
+ if (aqfMethod) {
31884
+ aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
31885
+ }
31886
+ if (qfErrorMethod) {
31887
+ qfErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
31888
+ }
31889
+ return { status: false };
31890
+ });
31891
+ };
31892
+ if (bqfMethod) {
31893
+ return Promise.resolve(bqfMethod(commitParams, ...args)).then(status => {
31894
+ if (status !== false) {
31895
+ return handleQueryFooter();
31896
+ }
31897
+ });
31898
+ }
31899
+ return handleQueryFooter();
31809
31900
  }
31810
31901
  else {
31811
31902
  errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter']);
@@ -31813,10 +31904,12 @@ var VxeGridComponent = defineVxeComponent({
31813
31904
  break;
31814
31905
  }
31815
31906
  case 'delete': {
31816
- const dMethods = ajax.delete;
31907
+ const bdMethod = ajax.beforeDelete;
31908
+ const dMethod = ajax.delete;
31909
+ const adMethod = ajax.afterDelete;
31817
31910
  const deleteSuccessMethods = ajax.deleteSuccess;
31818
31911
  const deleteErrorMethods = ajax.deleteError;
31819
- if (dMethods) {
31912
+ if (dMethod) {
31820
31913
  const selectRecords = $xeGrid.getCheckboxRecords();
31821
31914
  const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
31822
31915
  const body = { removeRecords };
@@ -31828,49 +31921,69 @@ var VxeGridComponent = defineVxeComponent({
31828
31921
  button,
31829
31922
  body,
31830
31923
  form: formData,
31831
- options: dMethods
31924
+ options: dMethod
31832
31925
  };
31833
31926
  if (selectRecords.length) {
31834
31927
  return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
31835
31928
  if (!removeRecords.length) {
31836
31929
  return $xeTable.remove(selectRecords);
31837
31930
  }
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' });
31931
+ const handleDelete = () => {
31932
+ reactData.tableLoading = true;
31933
+ return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args))
31934
+ .then(rest => {
31935
+ reactData.tableLoading = false;
31936
+ if (adMethod) {
31937
+ adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31846
31938
  }
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' });
31939
+ else {
31940
+ $xeTable.setPendingRow(removeRecords, false);
31941
+ if (isRespMsg) {
31942
+ if (VxeUI.modal) {
31943
+ VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' });
31944
+ }
31945
+ }
31946
+ if (oldAfterDelete) {
31947
+ oldAfterDelete(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
31948
+ }
31949
+ else {
31950
+ internalData.uFoot = true;
31951
+ $xeGrid.commitProxy('query');
31952
+ internalData.uFoot = false;
31953
+ updateQueryFooter();
31954
+ }
31867
31955
  }
31868
- }
31869
- if (deleteErrorMethods) {
31870
- deleteErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31871
- }
31872
- return { status: false };
31873
- });
31956
+ if (deleteSuccessMethods) {
31957
+ deleteSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31958
+ }
31959
+ return { status: true };
31960
+ })
31961
+ .catch(rest => {
31962
+ reactData.tableLoading = false;
31963
+ if (adMethod) {
31964
+ adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
31965
+ }
31966
+ else {
31967
+ if (isRespMsg) {
31968
+ if (VxeUI.modal) {
31969
+ VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
31970
+ }
31971
+ }
31972
+ }
31973
+ if (deleteErrorMethods) {
31974
+ deleteErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31975
+ }
31976
+ return { status: false };
31977
+ });
31978
+ };
31979
+ if (bdMethod) {
31980
+ return Promise.resolve(bdMethod(commitParams, ...args)).then(status => {
31981
+ if (status !== false) {
31982
+ return handleDelete();
31983
+ }
31984
+ });
31985
+ }
31986
+ return handleDelete();
31874
31987
  });
31875
31988
  }
31876
31989
  else {
@@ -31887,10 +32000,12 @@ var VxeGridComponent = defineVxeComponent({
31887
32000
  break;
31888
32001
  }
31889
32002
  case 'save': {
31890
- const ajaxMethods = ajax.save;
31891
- const saveSuccessMethods = ajax.saveSuccess;
31892
- const saveErrorMethods = ajax.saveError;
31893
- if (ajaxMethods) {
32003
+ const bSaveMethod = ajax.beforeSave;
32004
+ const sMethod = ajax.save;
32005
+ const aSaveMethod = ajax.afterSave;
32006
+ const sSuccessMethod = ajax.saveSuccess;
32007
+ const sErrorMethod = ajax.saveError;
32008
+ if (sMethod) {
31894
32009
  const body = $xeTable.getRecordset();
31895
32010
  const { insertRecords, removeRecords, updateRecords, pendingRecords } = body;
31896
32011
  const commitParams = {
@@ -31901,7 +32016,7 @@ var VxeGridComponent = defineVxeComponent({
31901
32016
  button,
31902
32017
  body,
31903
32018
  form: formData,
31904
- options: ajaxMethods
32019
+ options: sMethod
31905
32020
  };
31906
32021
  // 排除掉新增且标记为删除的数据
31907
32022
  if (insertRecords.length) {
@@ -31922,42 +32037,62 @@ var VxeGridComponent = defineVxeComponent({
31922
32037
  return;
31923
32038
  }
31924
32039
  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' });
32040
+ const handleSave = () => {
32041
+ reactData.tableLoading = true;
32042
+ return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args))
32043
+ .then(rest => {
32044
+ reactData.tableLoading = false;
32045
+ if (aSaveMethod) {
32046
+ aSaveMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
31933
32047
  }
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' });
32048
+ else {
32049
+ $xeTable.clearPendingRow();
32050
+ if (isRespMsg) {
32051
+ if (VxeUI.modal) {
32052
+ VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' });
32053
+ }
32054
+ }
32055
+ if (oldAfterSave) {
32056
+ oldAfterSave(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
32057
+ }
32058
+ else {
32059
+ internalData.uFoot = true;
32060
+ $xeGrid.commitProxy('query');
32061
+ internalData.uFoot = false;
32062
+ updateQueryFooter();
32063
+ }
31954
32064
  }
31955
- }
31956
- if (saveErrorMethods) {
31957
- saveErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
31958
- }
31959
- return { status: false };
31960
- });
32065
+ if (sSuccessMethod) {
32066
+ sSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
32067
+ }
32068
+ return { status: true };
32069
+ })
32070
+ .catch(rest => {
32071
+ reactData.tableLoading = false;
32072
+ if (aSaveMethod) {
32073
+ aSaveMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
32074
+ }
32075
+ else {
32076
+ if (isRespMsg) {
32077
+ if (VxeUI.modal) {
32078
+ VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
32079
+ }
32080
+ }
32081
+ }
32082
+ if (sErrorMethod) {
32083
+ sErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
32084
+ }
32085
+ return { status: false };
32086
+ });
32087
+ };
32088
+ if (bSaveMethod) {
32089
+ return Promise.resolve(bSaveMethod(commitParams, ...args)).then(status => {
32090
+ if (status !== false) {
32091
+ return handleSave();
32092
+ }
32093
+ });
32094
+ }
32095
+ return handleSave();
31961
32096
  }
31962
32097
  else {
31963
32098
  if (isActiveMsg) {