vxe-table 3.16.0-beta.0 → 3.16.0-beta.1

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 (35) hide show
  1. package/es/grid/src/grid.js +851 -689
  2. package/es/style.css +1 -1
  3. package/es/table/module/keyboard/mixin.js +2 -2
  4. package/es/table/src/columnInfo.js +1 -1
  5. package/es/table/src/table.js +1 -1
  6. package/es/ui/index.js +2 -2
  7. package/es/ui/src/log.js +1 -1
  8. package/lib/grid/src/grid.js +950 -804
  9. package/lib/grid/src/grid.min.js +1 -1
  10. package/lib/index.umd.js +960 -816
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/table/module/keyboard/mixin.js +2 -2
  14. package/lib/table/module/keyboard/mixin.min.js +1 -1
  15. package/lib/table/src/columnInfo.js +1 -1
  16. package/lib/table/src/columnInfo.min.js +1 -1
  17. package/lib/table/src/table.js +1 -1
  18. package/lib/table/src/table.min.js +1 -1
  19. package/lib/ui/index.js +2 -2
  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/grid/src/grid.ts +991 -776
  25. package/packages/table/module/keyboard/mixin.ts +2 -2
  26. package/packages/table/src/columnInfo.ts +1 -1
  27. package/packages/table/src/props.ts +4 -4
  28. package/packages/table/src/table.ts +1 -1
  29. package/packages/ui/index.ts +1 -1
  30. /package/es/{iconfont.1750770351840.ttf → iconfont.1750910486943.ttf} +0 -0
  31. /package/es/{iconfont.1750770351840.woff → iconfont.1750910486943.woff} +0 -0
  32. /package/es/{iconfont.1750770351840.woff2 → iconfont.1750910486943.woff2} +0 -0
  33. /package/lib/{iconfont.1750770351840.ttf → iconfont.1750910486943.ttf} +0 -0
  34. /package/lib/{iconfont.1750770351840.woff → iconfont.1750910486943.woff} +0 -0
  35. /package/lib/{iconfont.1750770351840.woff2 → iconfont.1750910486943.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -2002,7 +2002,7 @@ function getClass(property, params) {
2002
2002
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2003
2003
 
2004
2004
 
2005
- const version = "3.16.0-beta.0";
2005
+ const version = "3.16.0-beta.1";
2006
2006
  core_.VxeUI.version = version;
2007
2007
  core_.VxeUI.tableVersion = version;
2008
2008
  core_.VxeUI.setConfig({
@@ -2255,7 +2255,7 @@ core_.VxeUI.setConfig({
2255
2255
  autoLoad: true,
2256
2256
  showResponseMsg: true,
2257
2257
  showActiveMsg: true,
2258
- props: {
2258
+ response: {
2259
2259
  list: null,
2260
2260
  result: 'result',
2261
2261
  total: 'page.total',
@@ -2666,7 +2666,7 @@ function isNodeElement(elem) {
2666
2666
  const {
2667
2667
  log: log_log
2668
2668
  } = core_.VxeUI;
2669
- const log_version = `table v${"3.16.0-beta.0"}`;
2669
+ const log_version = `table v${"3.16.0-beta.1"}`;
2670
2670
  const warnLog = log_log.create('warn', log_version);
2671
2671
  const errLog = log_log.create('error', log_version);
2672
2672
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -2689,7 +2689,7 @@ class ColumnInfo {
2689
2689
  } = {}) {
2690
2690
  const tableProps = $xeTable;
2691
2691
  const $xeGrid = $xeTable.$xeGrid;
2692
- const proxyOpts = $xeGrid ? $xeGrid.proxyOpts : null;
2692
+ const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : null;
2693
2693
  const formatter = _vm.formatter;
2694
2694
  const visible = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(_vm.visible) ? _vm.visible : true;
2695
2695
  const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
@@ -26275,8 +26275,8 @@ function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRigh
26275
26275
  mouseConfig,
26276
26276
  mouseOpts
26277
26277
  } = this;
26278
- if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaMousedownEvent) {
26279
- return $xeTable.triggerCellAreaMousedownEvent(evnt, params);
26278
+ if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaMousednEvent) {
26279
+ return $xeTable.triggerCellAreaMousednEvent(evnt, params);
26280
26280
  } else {
26281
26281
  if (checkboxConfig && checkboxOpts.range) {
26282
26282
  this.handleCheckboxRangeEvent(evnt, params);
@@ -29207,7 +29207,7 @@ function renderBody(h, $xeTable) {
29207
29207
  if (rowOpts.height && !this.showOverflow) {
29208
29208
  warnLog('vxe.error.notProp', ['table.show-overflow']);
29209
29209
  }
29210
- if (!$xeTable.triggerCellAreaMousedownEvent) {
29210
+ if (!$xeTable.triggerCellAreaMousednEvent) {
29211
29211
  if (props.areaConfig) {
29212
29212
  warnLog('vxe.error.notProp', ['area-config']);
29213
29213
  }
@@ -30650,176 +30650,20 @@ const {
30650
30650
 
30651
30651
 
30652
30652
 
30653
+
30653
30654
  const {
30654
30655
  getConfig: grid_getConfig,
30655
30656
  getI18n: grid_getI18n,
30656
30657
  commands: grid_commands,
30657
30658
  globalEvents: grid_globalEvents,
30658
30659
  globalMixins: grid_globalMixins,
30660
+ createEvent: grid_createEvent,
30661
+ GLOBAL_EVENT_KEYS: grid_GLOBAL_EVENT_KEYS,
30659
30662
  renderEmptyElement: grid_renderEmptyElement
30660
30663
  } = core_.VxeUI;
30661
- const grid_methods = {};
30664
+ const tableMethods = {};
30662
30665
  const propKeys = Object.keys(props);
30663
30666
  const defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']];
30664
- function initPages($xeGrid, propKey) {
30665
- const props = $xeGrid;
30666
- const reactData = $xeGrid;
30667
- const {
30668
- tablePage
30669
- } = reactData;
30670
- const {
30671
- pagerConfig
30672
- } = props;
30673
- const pagerOpts = $xeGrid.computePagerOpts;
30674
- if (pagerConfig && isEnableConf(pagerOpts)) {
30675
- if (propKey) {
30676
- if (pagerOpts[propKey]) {
30677
- tablePage[propKey] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(pagerOpts[propKey]);
30678
- }
30679
- } else {
30680
- const {
30681
- currentPage,
30682
- pageSize,
30683
- total
30684
- } = pagerOpts;
30685
- if (currentPage) {
30686
- tablePage.currentPage = currentPage;
30687
- }
30688
- if (pageSize) {
30689
- tablePage.pageSize = pageSize;
30690
- }
30691
- if (total) {
30692
- tablePage.pageSize = total;
30693
- }
30694
- }
30695
- }
30696
- }
30697
- function renderDefaultForm(h, $xeGrid) {
30698
- const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
30699
- const props = $xeGrid;
30700
- const slots = $xeGrid.$scopedSlots;
30701
- const reactData = $xeGrid;
30702
- const {
30703
- proxyConfig,
30704
- formConfig
30705
- } = props;
30706
- const {
30707
- formData
30708
- } = reactData;
30709
- const proxyOpts = $xeGrid.computeProxyOpts;
30710
- const formOpts = $xeGrid.computeFormOpts;
30711
- if (isEnableConf(formConfig) && formOpts.items && formOpts.items.length) {
30712
- const formSlots = {};
30713
- if (!formOpts.inited) {
30714
- formOpts.inited = true;
30715
- const beforeItem = proxyOpts.beforeItem;
30716
- if (proxyOpts && beforeItem) {
30717
- formOpts.items.forEach(item => {
30718
- beforeItem.call($xeGrid, {
30719
- $grid: $xeGrid,
30720
- item
30721
- });
30722
- });
30723
- }
30724
- }
30725
- // 处理插槽
30726
- formOpts.items.forEach(item => {
30727
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(item.slots, func => {
30728
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
30729
- if (slots[func]) {
30730
- formSlots[func] = slots[func];
30731
- }
30732
- }
30733
- });
30734
- });
30735
- return [VxeUIFormComponent ? h(VxeUIFormComponent, {
30736
- props: Object.assign({}, formOpts, {
30737
- data: proxyConfig && proxyOpts.form ? formData : formOpts.data
30738
- }),
30739
- on: {
30740
- submit: $xeGrid.submitEvent,
30741
- reset: $xeGrid.resetEvent,
30742
- collapse: $xeGrid.collapseEvent,
30743
- 'submit-invalid': $xeGrid.submitInvalidEvent
30744
- },
30745
- scopedSlots: formSlots
30746
- }) : grid_renderEmptyElement($xeGrid)];
30747
- }
30748
- return [];
30749
- }
30750
- function getFuncSlot($xeGrid, optSlots, slotKey) {
30751
- const slots = $xeGrid.$scopedSlots;
30752
- const funcSlot = optSlots[slotKey];
30753
- if (funcSlot) {
30754
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(funcSlot)) {
30755
- if (slots[funcSlot]) {
30756
- return slots[funcSlot];
30757
- } else {
30758
- errLog('vxe.error.notSlot', [funcSlot]);
30759
- }
30760
- } else {
30761
- return funcSlot;
30762
- }
30763
- }
30764
- return null;
30765
- }
30766
- const getConfigSlot = ($xeGrid, slotConfigs) => {
30767
- const slots = $xeGrid.$scopedSlots;
30768
- const slotConf = {};
30769
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectMap(slotConfigs, (slotFunc, slotKey) => {
30770
- if (slotFunc) {
30771
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
30772
- if (slots[slotFunc]) {
30773
- slotConf[slotKey] = slots[slotFunc];
30774
- } else {
30775
- errLog('vxe.error.notSlot', [slotFunc]);
30776
- }
30777
- } else {
30778
- slotConf[slotKey] = slotFunc;
30779
- }
30780
- }
30781
- });
30782
- return slotConf;
30783
- };
30784
- function getToolbarSlots($xeGrid) {
30785
- const slots = $xeGrid.$scopedSlots;
30786
- const toolbarOpts = $xeGrid.computeToolbarOpts;
30787
- const toolbarOptSlots = toolbarOpts.slots;
30788
- const toolbarSlots = {};
30789
- if (slots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
30790
- warnLog('vxe.error.reqProp', ['toolbar-config.slots.buttons']);
30791
- }
30792
- if (slots.tools && (!toolbarOptSlots || toolbarOptSlots.tools !== 'tools')) {
30793
- warnLog('vxe.error.reqProp', ['toolbar-config.slots.tools']);
30794
- }
30795
- if (toolbarOptSlots) {
30796
- const buttonsSlot = getFuncSlot($xeGrid, toolbarOptSlots, 'buttons');
30797
- const buttonPrefixSlot = getFuncSlot($xeGrid, toolbarOptSlots, 'buttonPrefix');
30798
- const buttonSuffixSlot = getFuncSlot($xeGrid, toolbarOptSlots, 'buttonSuffix');
30799
- const toolsSlot = getFuncSlot($xeGrid, toolbarOptSlots, 'tools');
30800
- const toolPrefixSlot = getFuncSlot($xeGrid, toolbarOptSlots, 'toolPrefix');
30801
- const toolSuffixSlot = getFuncSlot($xeGrid, toolbarOptSlots, 'toolSuffix');
30802
- if (buttonsSlot) {
30803
- toolbarSlots.buttons = buttonsSlot;
30804
- }
30805
- if (buttonPrefixSlot) {
30806
- toolbarSlots.buttonPrefix = buttonPrefixSlot;
30807
- }
30808
- if (buttonSuffixSlot) {
30809
- toolbarSlots.buttonSuffix = buttonSuffixSlot;
30810
- }
30811
- if (toolsSlot) {
30812
- toolbarSlots.tools = toolsSlot;
30813
- }
30814
- if (toolPrefixSlot) {
30815
- toolbarSlots.toolPrefix = toolPrefixSlot;
30816
- }
30817
- if (toolSuffixSlot) {
30818
- toolbarSlots.toolSuffix = toolSuffixSlot;
30819
- }
30820
- }
30821
- return toolbarSlots;
30822
- }
30823
30667
  function getTableOns(_vm) {
30824
30668
  const {
30825
30669
  $listeners,
@@ -30842,260 +30686,48 @@ function getTableOns(_vm) {
30842
30686
  }
30843
30687
  return ons;
30844
30688
  }
30845
- function pageChangeEvent($xeGrid, params) {
30846
- const props = $xeGrid;
30847
- const reactData = $xeGrid;
30848
- const {
30849
- proxyConfig
30850
- } = props;
30851
- const {
30852
- tablePage
30853
- } = reactData;
30854
- const {
30855
- $event,
30856
- currentPage,
30857
- pageSize
30858
- } = params;
30859
- const proxyOpts = $xeGrid.computeProxyOpts;
30860
- tablePage.currentPage = currentPage;
30861
- tablePage.pageSize = pageSize;
30862
- $xeGrid.dispatchEvent('page-change', params, $event);
30863
- if (proxyConfig && isEnableConf(proxyOpts)) {
30864
- $xeGrid.commitProxy('query').then(rest => {
30865
- $xeGrid.dispatchEvent('proxy-query', rest, $event);
30866
- });
30867
- }
30868
- }
30869
- /**
30870
- * 渲染表单
30871
- */
30872
- function renderForm(h, $xeGrid) {
30873
- const slots = $xeGrid.$scopedSlots;
30874
- const props = $xeGrid;
30875
- const {
30876
- formConfig
30877
- } = props;
30878
- const formSlot = slots.form;
30879
- const hasForm = !!(formSlot || isEnableConf(formConfig));
30880
- if (hasForm) {
30881
- return h('div', {
30882
- key: 'form',
30883
- ref: 'refFormWrapper',
30884
- class: 'vxe-grid--form-wrapper'
30885
- }, formSlot ? formSlot.call($xeGrid, {
30886
- $grid: $xeGrid
30887
- }) : renderDefaultForm(h, $xeGrid));
30888
- }
30889
- return grid_renderEmptyElement($xeGrid);
30890
- }
30891
- /**
30892
- * 渲染工具栏
30893
- */
30894
- function renderToolbar(h, $xeGrid) {
30895
- const slots = $xeGrid.$scopedSlots;
30896
- const props = $xeGrid;
30897
- const {
30898
- toolbarConfig
30899
- } = props;
30900
- const toolbarSlot = slots.toolbar;
30901
- const hasToolbar = !!(toolbarSlot || isEnableConf(toolbarConfig) || toolbar);
30902
- const toolbarOpts = $xeGrid.computeToolbarOpts;
30903
- if (hasToolbar) {
30904
- return h('div', {
30905
- key: 'toolbar',
30906
- ref: 'refToolbarWrapper',
30907
- class: 'vxe-grid--toolbar-wrapper'
30908
- }, toolbarSlot ? toolbarSlot.call($xeGrid, {
30909
- $grid: $xeGrid
30910
- }) : [h(src_toolbar, {
30911
- props: Object.assign({}, toolbarOpts, {
30912
- slots: undefined
30913
- }),
30914
- ref: 'xToolbar',
30915
- scopedSlots: getToolbarSlots($xeGrid)
30916
- })]);
30917
- }
30918
- return grid_renderEmptyElement($xeGrid);
30919
- }
30920
- /**
30921
- * 渲染表格顶部区域
30922
- */
30923
- function renderTop(h, $xeGrid) {
30924
- const slots = $xeGrid.$scopedSlots;
30925
- const topSlot = slots.top;
30926
- return topSlot ? h('div', {
30927
- key: 'top',
30928
- ref: 'refTopWrapper',
30929
- class: 'vxe-grid--top-wrapper'
30930
- }, topSlot.call($xeGrid, {
30931
- $grid: $xeGrid
30932
- })) : grid_renderEmptyElement($xeGrid);
30933
- }
30934
- function renderTableLeft(h, $xeGrid) {
30935
- const slots = $xeGrid.$scopedSlots;
30936
- const leftSlot = slots.left;
30937
- if (leftSlot) {
30938
- return h('div', {
30939
- class: 'vxe-grid--left-wrapper'
30940
- }, leftSlot({
30941
- $grid: $xeGrid
30942
- }));
30943
- }
30944
- return grid_renderEmptyElement($xeGrid);
30945
- }
30946
- function renderTableRight(h, $xeGrid) {
30947
- const slots = $xeGrid.$scopedSlots;
30948
- const rightSlot = slots.right;
30949
- if (rightSlot) {
30950
- return h('div', {
30951
- class: 'vxe-grid--right-wrapper'
30952
- }, rightSlot({
30953
- $grid: $xeGrid
30954
- }));
30955
- }
30956
- return grid_renderEmptyElement($xeGrid);
30957
- }
30958
- /**
30959
- * 渲染表格
30960
- */
30961
- function renderTable(h, $xeGrid) {
30962
- const slots = $xeGrid.$scopedSlots;
30963
- const tableProps = $xeGrid.computeTableProps;
30964
- return h('div', {
30965
- class: 'vxe-grid--table-wrapper'
30966
- }, [h('vxe-table', {
30967
- key: 'table',
30968
- props: tableProps,
30969
- on: getTableOns($xeGrid),
30970
- scopedSlots: slots,
30971
- ref: 'xTable'
30972
- })]);
30973
- }
30974
- /**
30975
- * 渲染表格底部区域
30976
- */
30977
- function renderBottom(h, $xeGrid) {
30978
- const slots = $xeGrid.$scopedSlots;
30979
- const bottomSlot = slots.bottom;
30980
- return bottomSlot ? h('div', {
30981
- key: 'bottom',
30982
- ref: 'refBottomWrapper',
30983
- class: 'vxe-grid--bottom-wrapper'
30984
- }, bottomSlot.call($xeGrid, {
30985
- $grid: $xeGrid
30986
- })) : grid_renderEmptyElement($xeGrid);
30987
- }
30988
- /**
30989
- * 渲染分页
30990
- */
30991
- function renderPager(h, $xeGrid) {
30992
- const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
30993
- const props = $xeGrid;
30994
- const slots = $xeGrid.$scopedSlots;
30995
- const reactData = $xeGrid;
30996
- const {
30997
- proxyConfig,
30998
- pagerConfig
30999
- } = props;
31000
- const proxyOpts = $xeGrid.computeProxyOpts;
31001
- const pagerOpts = $xeGrid.computePagerOpts;
31002
- const pagerSlot = slots.pager;
31003
- if (pagerConfig && isEnableConf(pagerOpts) || slots.pager) {
31004
- return h('div', {
31005
- ref: 'refPagerWrapper',
31006
- key: 'pager',
31007
- class: 'vxe-grid--pager-wrapper'
31008
- }, pagerSlot ? pagerSlot.call($xeGrid, {
31009
- $grid: $xeGrid
31010
- }) : [VxeUIPagerComponent ? h(VxeUIPagerComponent, {
31011
- ref: 'refPager',
31012
- props: {
31013
- ...pagerOpts,
31014
- ...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {})
31015
- },
31016
- on: {
31017
- 'page-change'(params) {
31018
- pageChangeEvent($xeGrid, params);
31019
- }
31020
- },
31021
- scopedSlots: getConfigSlot($xeGrid, pagerOpts.slots)
31022
- }) : grid_renderEmptyElement($xeGrid)]);
31023
- }
31024
- return grid_renderEmptyElement($xeGrid);
31025
- }
31026
- function renderChildLayout(h, $xeGrid, layoutKeys) {
31027
- const childVNs = [];
31028
- layoutKeys.forEach(key => {
31029
- switch (key) {
31030
- case 'Form':
31031
- childVNs.push(renderForm(h, $xeGrid));
31032
- break;
31033
- case 'Toolbar':
31034
- childVNs.push(renderToolbar(h, $xeGrid));
31035
- break;
31036
- case 'Top':
31037
- childVNs.push(renderTop(h, $xeGrid));
31038
- break;
31039
- case 'Table':
31040
- childVNs.push(h('div', {
31041
- key: 'table',
31042
- class: 'vxe-grid--table-container'
31043
- }, [renderTableLeft(h, $xeGrid), renderTable(h, $xeGrid), renderTableRight(h, $xeGrid)]));
31044
- break;
31045
- case 'Bottom':
31046
- childVNs.push(renderBottom(h, $xeGrid));
31047
- break;
31048
- case 'Pager':
31049
- childVNs.push(renderPager(h, $xeGrid));
31050
- break;
31051
- default:
31052
- errLog('vxe.error.notProp', [`layouts -> ${key}`]);
31053
- break;
31054
- }
31055
- });
31056
- return childVNs;
31057
- }
31058
- function renderLayout(h, $xeGrid) {
31059
- const slots = $xeGrid.$scopedSlots;
31060
- const currLayoutConf = $xeGrid.computeCurrLayoutConf;
31061
- const {
31062
- headKeys,
31063
- bodyKeys,
31064
- footKeys
31065
- } = currLayoutConf;
31066
- const asideLeftSlot = slots.asideLeft || slots['aside-left'];
31067
- const asideRightSlot = slots.asideRight || slots['aside-right'];
31068
- return [h('div', {
31069
- class: 'vxe-grid--layout-header-wrapper'
31070
- }, renderChildLayout(h, $xeGrid, headKeys)), h('div', {
31071
- class: 'vxe-grid--layout-body-wrapper'
31072
- }, [asideLeftSlot ? h('div', {
31073
- class: 'vxe-grid--layout-aside-left-wrapper'
31074
- }, asideLeftSlot({})) : grid_renderEmptyElement($xeGrid), h('div', {
31075
- class: 'vxe-grid--layout-body-content-wrapper'
31076
- }, renderChildLayout(h, $xeGrid, bodyKeys)), asideRightSlot ? h('div', {
31077
- class: 'vxe-grid--layout-aside-right-wrapper'
31078
- }, asideRightSlot({})) : grid_renderEmptyElement($xeGrid)]), h('div', {
31079
- class: 'vxe-grid--layout-footer-wrapper'
31080
- }, renderChildLayout(h, $xeGrid, footKeys))];
31081
- }
31082
- Object.keys(table.methods).forEach(name => {
31083
- grid_methods[name] = function (...args) {
31084
- return this.$refs.xTable && this.$refs.xTable[name](...args);
30689
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(table.methods, (fn, name) => {
30690
+ tableMethods[name] = function (...args) {
30691
+ const $xeGrid = this;
30692
+ const $xeTable = $xeGrid.$refs.refTable;
30693
+ return $xeTable && $xeTable[name](...args);
31085
30694
  };
31086
30695
  });
31087
- /* harmony default export */ var grid = ({
30696
+ /* harmony default export */ var grid = (/* define-vxe-component start */defineVxeComponent({
31088
30697
  name: 'VxeGrid',
31089
30698
  mixins: [grid_globalMixins.sizeMixin],
31090
30699
  props: {
30700
+ // 以下仅用于类型
30701
+ round: {
30702
+ type: Boolean,
30703
+ default: () => grid_getConfig().table.round
30704
+ },
30705
+ height: [Number, String],
30706
+ minHeight: {
30707
+ type: [Number, String],
30708
+ default: () => grid_getConfig().table.minHeight
30709
+ },
30710
+ maxHeight: [Number, String],
30711
+ seqConfig: Object,
30712
+ sortConfig: Object,
30713
+ filterConfig: Object,
30714
+ editConfig: [Boolean, Object],
30715
+ loading: Boolean,
30716
+ validConfig: Object,
30717
+ editRules: Object,
30718
+ animat: {
30719
+ type: Boolean,
30720
+ default: () => grid_getConfig().table.animat
30721
+ },
30722
+ // eslint-disable-next-line @typescript-eslint/ban-types
31091
30723
  ...props,
30724
+ // 以上仅用于类型
31092
30725
  layouts: Array,
31093
30726
  columns: Array,
31094
- pagerConfig: [Boolean, Object],
30727
+ pagerConfig: Object,
31095
30728
  proxyConfig: Object,
31096
- toolbar: [Boolean, Object],
31097
- toolbarConfig: [Boolean, Object],
31098
- formConfig: [Boolean, Object],
30729
+ toolbarConfig: Object,
30730
+ formConfig: Object,
31099
30731
  zoomConfig: Object,
31100
30732
  size: {
31101
30733
  type: String,
@@ -31103,13 +30735,16 @@ Object.keys(table.methods).forEach(name => {
31103
30735
  }
31104
30736
  },
31105
30737
  provide() {
30738
+ const $xeGrid = this;
31106
30739
  return {
31107
- $xeGrid: this
30740
+ $xeGrid
31108
30741
  };
31109
30742
  },
31110
30743
  data() {
31111
- return {
30744
+ const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
30745
+ const reactData = {
31112
30746
  tableLoading: false,
30747
+ proxyInited: false,
31113
30748
  isZMax: false,
31114
30749
  tableData: [],
31115
30750
  filterData: [],
@@ -31122,51 +30757,80 @@ Object.keys(table.methods).forEach(name => {
31122
30757
  currentPage: 1
31123
30758
  }
31124
30759
  };
30760
+ return {
30761
+ xID,
30762
+ reactData
30763
+ };
31125
30764
  },
31126
30765
  computed: {
30766
+ ...{},
31127
30767
  isRespMsg() {
31128
- const {
31129
- proxyOpts
31130
- } = this;
31131
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg;
30768
+ const $xeGrid = this;
30769
+ return $xeGrid.computeIsRespMsg;
30770
+ },
30771
+ computeIsRespMsg() {
30772
+ const $xeGrid = this;
30773
+ const proxyOpts = $xeGrid.computeProxyOpts;
30774
+ return !!(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg);
31132
30775
  },
31133
30776
  isActiveMsg() {
31134
- return this.proxyOpts.showActiveMsg;
30777
+ const $xeGrid = this;
30778
+ return $xeGrid.computeIsActiveMsg;
30779
+ },
30780
+ computeIsActiveMsg() {
30781
+ const $xeGrid = this;
30782
+ const proxyOpts = $xeGrid.computeProxyOpts;
30783
+ return !!proxyOpts.showActiveMsg;
31135
30784
  },
31136
30785
  proxyOpts() {
31137
- return this.computeProxyOpts;
30786
+ const $xeGrid = this;
30787
+ return $xeGrid.computeProxyOpts;
31138
30788
  },
31139
30789
  computeProxyOpts() {
31140
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().merge({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(grid_getConfig().grid.proxyConfig, true), this.proxyConfig);
30790
+ const $xeGrid = this;
30791
+ const props = $xeGrid;
30792
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().merge({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(grid_getConfig().grid.proxyConfig, true), props.proxyConfig);
31141
30793
  },
31142
30794
  pagerOpts() {
31143
- return this.computePagerOpts;
30795
+ const $xeGrid = this;
30796
+ return $xeGrid.computePagerOpts;
31144
30797
  },
31145
30798
  computePagerOpts() {
31146
- return Object.assign({}, grid_getConfig().grid.pagerConfig, this.pagerConfig);
30799
+ const $xeGrid = this;
30800
+ const props = $xeGrid;
30801
+ return Object.assign({}, grid_getConfig().grid.pagerConfig, props.pagerConfig);
31147
30802
  },
31148
30803
  formOpts() {
31149
- return this.computeFormOpts;
30804
+ const $xeGrid = this;
30805
+ return $xeGrid.computeFormOpts;
31150
30806
  },
31151
30807
  computeFormOpts() {
31152
- return Object.assign({}, grid_getConfig().grid.formConfig, this.formConfig);
30808
+ const $xeGrid = this;
30809
+ const props = $xeGrid;
30810
+ return Object.assign({}, grid_getConfig().grid.formConfig, props.formConfig);
31153
30811
  },
31154
30812
  toolbarOpts() {
31155
- return this.computeToolbarOpts;
30813
+ const $xeGrid = this;
30814
+ return $xeGrid.computeToolbarOpts;
31156
30815
  },
31157
30816
  computeToolbarOpts() {
31158
- return Object.assign({}, grid_getConfig().grid.toolbarConfig, this.toolbarConfig || this.toolbar);
30817
+ const $xeGrid = this;
30818
+ const props = $xeGrid;
30819
+ return Object.assign({}, grid_getConfig().grid.toolbarConfig, props.toolbarConfig);
31159
30820
  },
31160
30821
  zoomOpts() {
31161
- return this.computeZoomOpts;
30822
+ const $xeGrid = this;
30823
+ return $xeGrid.computeZoomOpts;
31162
30824
  },
31163
30825
  computeZoomOpts() {
31164
- return Object.assign({}, grid_getConfig().grid.zoomConfig, this.zoomConfig);
30826
+ const $xeGrid = this;
30827
+ const props = $xeGrid;
30828
+ return Object.assign({}, grid_getConfig().grid.zoomConfig, props.zoomConfig);
31165
30829
  },
31166
30830
  computeStyles() {
31167
30831
  const $xeGrid = this;
31168
30832
  const props = $xeGrid;
31169
- const reactData = $xeGrid;
30833
+ const reactData = $xeGrid.reactData;
31170
30834
  const {
31171
30835
  height,
31172
30836
  maxHeight
@@ -31188,26 +30852,35 @@ Object.keys(table.methods).forEach(name => {
31188
30852
  }
31189
30853
  return stys;
31190
30854
  },
31191
- tableExtendProps() {
30855
+ computeTableExtendProps() {
30856
+ const $xeGrid = this;
30857
+ const props = $xeGrid;
31192
30858
  const rest = {};
30859
+ const gridProps = props;
31193
30860
  propKeys.forEach(key => {
31194
- rest[key] = this[key];
30861
+ rest[key] = gridProps[key];
31195
30862
  });
31196
30863
  return rest;
31197
30864
  },
31198
30865
  computeTableProps() {
30866
+ const $xeGrid = this;
30867
+ const props = $xeGrid;
30868
+ const reactData = $xeGrid.reactData;
31199
30869
  const {
31200
- isZMax,
31201
30870
  seqConfig,
31202
30871
  pagerConfig,
31203
30872
  loading,
31204
30873
  editConfig,
31205
- proxyConfig,
31206
- proxyOpts,
31207
- tableExtendProps,
30874
+ proxyConfig
30875
+ } = props;
30876
+ const {
30877
+ isZMax,
31208
30878
  tableLoading,
31209
30879
  tablePage
31210
- } = this;
30880
+ } = reactData;
30881
+ const tableExtendProps = $xeGrid.computeTableExtendProps;
30882
+ const proxyOpts = $xeGrid.computeProxyOpts;
30883
+ const pagerOpts = $xeGrid.computePagerOpts;
31211
30884
  const tProps = Object.assign({}, tableExtendProps);
31212
30885
  if (isZMax) {
31213
30886
  if (tableExtendProps.maxHeight) {
@@ -31216,9 +30889,9 @@ Object.keys(table.methods).forEach(name => {
31216
30889
  tProps.height = '100%';
31217
30890
  }
31218
30891
  }
31219
- if (proxyConfig) {
30892
+ if (proxyConfig && isEnableConf(proxyOpts)) {
31220
30893
  tProps.loading = loading || tableLoading;
31221
- if (proxyOpts.seq && isEnableConf(pagerConfig)) {
30894
+ if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
31222
30895
  tProps.seqConfig = Object.assign({}, seqConfig, {
31223
30896
  startIndex: (tablePage.currentPage - 1) * tablePage.pageSize
31224
30897
  });
@@ -31230,7 +30903,8 @@ Object.keys(table.methods).forEach(name => {
31230
30903
  return tProps;
31231
30904
  },
31232
30905
  tableProps() {
31233
- return this.computeTableProps;
30906
+ const $xeGrid = this;
30907
+ return $xeGrid.computeTableProps;
31234
30908
  },
31235
30909
  computeCurrLayoutConf() {
31236
30910
  const $xeGrid = this;
@@ -31280,98 +30954,80 @@ Object.keys(table.methods).forEach(name => {
31280
30954
  },
31281
30955
  watch: {
31282
30956
  columns(value) {
31283
- this.$nextTick(() => this.loadColumn(value));
30957
+ const $xeGrid = this;
30958
+ $xeGrid.$nextTick(() => $xeGrid.loadColumn(value));
31284
30959
  },
31285
30960
  toolbar(value) {
30961
+ const $xeGrid = this;
31286
30962
  if (value) {
31287
- this.initToolbar();
30963
+ $xeGrid.initToolbar();
31288
30964
  }
31289
30965
  },
31290
30966
  toolbarConfig(value) {
30967
+ const $xeGrid = this;
31291
30968
  if (value) {
31292
- this.initToolbar();
30969
+ $xeGrid.initToolbar();
31293
30970
  }
31294
30971
  },
31295
30972
  proxyConfig() {
31296
- this.initProxy();
30973
+ const $xeGrid = this;
30974
+ $xeGrid.initProxy();
31297
30975
  },
31298
30976
  computeCustomCurrentPageFlag() {
31299
30977
  const $xeGrid = this;
31300
- initPages($xeGrid, 'currentPage');
30978
+ $xeGrid.initPages('currentPage');
31301
30979
  },
31302
30980
  computeCustomPageSizeFlag() {
31303
30981
  const $xeGrid = this;
31304
- initPages($xeGrid, 'pageSize');
30982
+ $xeGrid.initPages('pageSize');
31305
30983
  },
31306
30984
  computeCustomTotalFlag() {
31307
30985
  const $xeGrid = this;
31308
- initPages($xeGrid, 'total');
30986
+ $xeGrid.initPages('total');
31309
30987
  }
31310
30988
  },
31311
- created() {
31312
- const $xeGrid = this;
31313
- const props = $xeGrid;
31314
- // const { data, formOpts, proxyOpts, proxyConfig } = this
31315
- // if (proxyConfig && (data || (proxyOpts.form && formOpts.data))) {
31316
- // errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
31317
- // }
31318
- if (this.toolbar) {
31319
- warnLog('vxe.error.delProp', ['grid.toolbar', 'grid.toolbar-config']);
31320
- }
31321
- if (this.toolbarConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(this.toolbarConfig)) {
31322
- warnLog('vxe.error.errProp', [`grid.toolbar-config=${this.toolbarConfig}`, 'grid.toolbar-config={}']);
31323
- }
31324
- // if (proxyOpts.props) {
31325
- // warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
31326
- // }
31327
- // 使用已安装的组件,如果未安装则不渲染
31328
- const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
31329
- const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
31330
- $xeGrid.$nextTick(() => {
31331
- if (props.formConfig) {
31332
- if (!VxeUIFormComponent) {
31333
- errLog('vxe.error.reqComp', ['vxe-form']);
31334
- }
31335
- }
31336
- if (props.pagerConfig) {
31337
- if (!VxeUIPagerComponent) {
31338
- errLog('vxe.error.reqComp', ['vxe-pager']);
30989
+ methods: {
30990
+ ...tableMethods,
30991
+ dispatchEvent(type, params, evnt) {
30992
+ const $xeGrid = this;
30993
+ $xeGrid.$emit(type, grid_createEvent(evnt, {
30994
+ $grid: $xeGrid
30995
+ }, params));
30996
+ },
30997
+ initPages(propKey) {
30998
+ const $xeGrid = this;
30999
+ const props = $xeGrid;
31000
+ const reactData = $xeGrid.reactData;
31001
+ const {
31002
+ tablePage
31003
+ } = reactData;
31004
+ const {
31005
+ pagerConfig
31006
+ } = props;
31007
+ const pagerOpts = $xeGrid.computePagerOpts;
31008
+ if (pagerConfig && isEnableConf(pagerOpts)) {
31009
+ if (propKey) {
31010
+ if (pagerOpts[propKey]) {
31011
+ tablePage[propKey] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(pagerOpts[propKey]);
31012
+ }
31013
+ } else {
31014
+ const {
31015
+ currentPage,
31016
+ pageSize,
31017
+ total
31018
+ } = pagerOpts;
31019
+ if (currentPage) {
31020
+ tablePage.currentPage = currentPage;
31021
+ }
31022
+ if (pageSize) {
31023
+ tablePage.pageSize = pageSize;
31024
+ }
31025
+ if (total) {
31026
+ tablePage.pageSize = total;
31027
+ }
31339
31028
  }
31340
31029
  }
31341
- });
31342
- initPages($xeGrid);
31343
- grid_globalEvents.on(this, 'keydown', this.handleGlobalKeydownEvent);
31344
- },
31345
- mounted() {
31346
- if (this.columns && this.columns.length) {
31347
- this.loadColumn(this.columns);
31348
- }
31349
- this.initToolbar();
31350
- this.initProxy();
31351
- },
31352
- destroyed() {
31353
- grid_globalEvents.off(this, 'keydown');
31354
- },
31355
- render(h) {
31356
- const $xeGrid = this;
31357
- const props = $xeGrid;
31358
- const reactData = $xeGrid;
31359
- const vSize = $xeGrid.computeSize;
31360
- const styles = $xeGrid.computeStyles;
31361
- return h('div', {
31362
- ref: 'refElem',
31363
- class: ['vxe-grid', {
31364
- [`size--${vSize}`]: vSize,
31365
- 'is--animat': !!this.animat,
31366
- 'is--round': this.round,
31367
- 'is--maximize': reactData.isZMax,
31368
- 'is--loading': props.loading || reactData.tableLoading
31369
- }],
31370
- style: styles
31371
- }, renderLayout(h, $xeGrid));
31372
- },
31373
- methods: {
31374
- ...grid_methods,
31030
+ },
31375
31031
  callSlot(slotFunc, params, h, vNodes) {
31376
31032
  const $xeGrid = this;
31377
31033
  const slots = $xeGrid.$scopedSlots;
@@ -31394,7 +31050,7 @@ Object.keys(table.methods).forEach(name => {
31394
31050
  */
31395
31051
  getExcludeHeight() {
31396
31052
  const $xeGrid = this;
31397
- const reactData = $xeGrid;
31053
+ const reactData = $xeGrid.reactData;
31398
31054
  const {
31399
31055
  isZMax
31400
31056
  } = reactData;
@@ -31413,7 +31069,7 @@ Object.keys(table.methods).forEach(name => {
31413
31069
  },
31414
31070
  getParentHeight() {
31415
31071
  const $xeGrid = this;
31416
- const reactData = $xeGrid;
31072
+ const reactData = $xeGrid.reactData;
31417
31073
  const el = $xeGrid.$refs.refElem;
31418
31074
  if (el) {
31419
31075
  const parentEl = el.parentElement;
@@ -31422,68 +31078,148 @@ Object.keys(table.methods).forEach(name => {
31422
31078
  return 0;
31423
31079
  },
31424
31080
  initToolbar() {
31425
- this.$nextTick(() => {
31426
- const {
31427
- xTable,
31428
- xToolbar
31429
- } = this.$refs;
31430
- if (xTable && xToolbar) {
31431
- xTable.connect(xToolbar);
31081
+ const $xeGrid = this;
31082
+ $xeGrid.$nextTick(() => {
31083
+ const $xeTable = $xeGrid.$refs.refTable;
31084
+ const $xeToolbar = $xeGrid.$refs.refToolbar;
31085
+ if ($xeTable && $xeToolbar) {
31086
+ $xeTable.connect($xeToolbar);
31432
31087
  }
31433
31088
  });
31434
31089
  },
31435
- initProxy() {
31436
- const {
31437
- proxyInited,
31438
- proxyConfig,
31439
- proxyOpts,
31440
- formConfig,
31441
- formOpts
31442
- } = this;
31443
- if (proxyConfig) {
31444
- if (isEnableConf(formConfig) && proxyOpts.form && formOpts.items) {
31445
- const fData = {};
31446
- formOpts.items.forEach(item => {
31447
- const {
31448
- field,
31449
- itemRender
31450
- } = item;
31451
- if (field) {
31452
- let itemValue = null;
31453
- if (itemRender) {
31454
- const {
31455
- defaultValue
31456
- } = itemRender;
31457
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(defaultValue)) {
31458
- itemValue = defaultValue({
31459
- item
31460
- });
31461
- } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(defaultValue)) {
31462
- itemValue = defaultValue;
31463
- }
31090
+ getDefaultFormData() {
31091
+ const $xeGrid = this;
31092
+ const formOpts = $xeGrid.computeFormOpts;
31093
+ if (formOpts.items) {
31094
+ const fData = {};
31095
+ formOpts.items.forEach(item => {
31096
+ const {
31097
+ field,
31098
+ itemRender
31099
+ } = item;
31100
+ if (field) {
31101
+ let itemValue = null;
31102
+ if (itemRender) {
31103
+ const {
31104
+ defaultValue
31105
+ } = itemRender;
31106
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(defaultValue)) {
31107
+ itemValue = defaultValue({
31108
+ item
31109
+ });
31110
+ } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(defaultValue)) {
31111
+ itemValue = defaultValue;
31464
31112
  }
31465
- fData[field] = itemValue;
31466
31113
  }
31467
- });
31468
- this.formData = fData;
31114
+ fData[field] = itemValue;
31115
+ }
31116
+ });
31117
+ return fData;
31118
+ }
31119
+ return {};
31120
+ },
31121
+ initProxy() {
31122
+ const $xeGrid = this;
31123
+ const props = $xeGrid;
31124
+ const reactData = $xeGrid.reactData;
31125
+ const {
31126
+ proxyConfig,
31127
+ formConfig
31128
+ } = props;
31129
+ const {
31130
+ proxyInited
31131
+ } = reactData;
31132
+ const proxyOpts = $xeGrid.computeProxyOpts;
31133
+ const formOpts = $xeGrid.computeFormOpts;
31134
+ if (proxyConfig) {
31135
+ if (isEnableConf(formConfig) && proxyOpts.form && formOpts.items) {
31136
+ reactData.formData = $xeGrid.getDefaultFormData();
31469
31137
  }
31470
31138
  if (!proxyInited && proxyOpts.autoLoad !== false) {
31471
- this.proxyInited = true;
31472
- this.$nextTick().then(() => this.commitProxy('_init')).then(rest => {
31473
- this.$emit('proxy-query', {
31139
+ reactData.proxyInited = true;
31140
+ $xeGrid.$nextTick().then(() => $xeGrid.commitProxy('initial')).then(rest => {
31141
+ $xeGrid.dispatchEvent('proxy-query', {
31474
31142
  ...rest,
31475
- isInited: true,
31476
- $grid: this,
31477
- $event: new Event('init')
31478
- });
31143
+ isInited: true
31144
+ }, new Event('initial'));
31479
31145
  });
31480
31146
  }
31481
31147
  }
31482
31148
  },
31483
31149
  handleGlobalKeydownEvent(evnt) {
31484
- const isEsc = evnt.keyCode === 27;
31485
- if (isEsc && this.isZMax && this.zoomOpts.escRestore !== false) {
31486
- this.triggerZoomEvent(evnt);
31150
+ const $xeGrid = this;
31151
+ const reactData = $xeGrid.reactData;
31152
+ const zoomOpts = $xeGrid.computeZoomOpts;
31153
+ const isEsc = grid_globalEvents.hasKey(evnt, grid_GLOBAL_EVENT_KEYS.ESCAPE);
31154
+ if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
31155
+ $xeGrid.triggerZoomEvent(evnt);
31156
+ }
31157
+ },
31158
+ getRespMsg(rest, defaultMsg) {
31159
+ const $xeGrid = this;
31160
+ const proxyOpts = $xeGrid.computeProxyOpts;
31161
+ const resConfigs = proxyOpts.response || proxyOpts.props || {};
31162
+ const messageProp = resConfigs.message;
31163
+ let msg;
31164
+ if (rest && messageProp) {
31165
+ msg = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(messageProp) ? messageProp({
31166
+ data: rest,
31167
+ $grid: $xeGrid
31168
+ }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, messageProp);
31169
+ }
31170
+ return msg || grid_getI18n(defaultMsg);
31171
+ },
31172
+ handleDeleteRow(code, alertKey, callback) {
31173
+ const $xeGrid = this;
31174
+ const isActiveMsg = $xeGrid.computeIsActiveMsg;
31175
+ const selectRecords = $xeGrid.getCheckboxRecords();
31176
+ if (isActiveMsg) {
31177
+ if (selectRecords.length) {
31178
+ if (core_.VxeUI.modal) {
31179
+ return core_.VxeUI.modal.confirm({
31180
+ id: `cfm_${code}`,
31181
+ content: grid_getI18n(alertKey),
31182
+ escClosable: true
31183
+ }).then(type => {
31184
+ if (type === 'confirm') {
31185
+ return callback();
31186
+ }
31187
+ });
31188
+ }
31189
+ } else {
31190
+ if (core_.VxeUI.modal) {
31191
+ core_.VxeUI.modal.message({
31192
+ id: `msg_${code}`,
31193
+ content: grid_getI18n('vxe.grid.selectOneRecord'),
31194
+ status: 'warning'
31195
+ });
31196
+ }
31197
+ }
31198
+ } else {
31199
+ if (selectRecords.length) {
31200
+ callback();
31201
+ }
31202
+ }
31203
+ return Promise.resolve();
31204
+ },
31205
+ triggerPendingEvent(code) {
31206
+ const $xeGrid = this;
31207
+ const isActiveMsg = $xeGrid.computeIsActiveMsg;
31208
+ const $xeTable = $xeGrid.$refs.refTable;
31209
+ const selectRecords = $xeTable.getCheckboxRecords();
31210
+ if (selectRecords.length) {
31211
+ $xeTable.togglePendingRow(selectRecords);
31212
+ $xeGrid.clearCheckboxRow();
31213
+ } else {
31214
+ if (isActiveMsg) {
31215
+ if (core_.VxeUI.modal) {
31216
+ core_.VxeUI.modal.message({
31217
+ id: code,
31218
+ content: grid_getI18n('vxe.grid.selectOneRecord'),
31219
+ status: 'warning'
31220
+ });
31221
+ }
31222
+ }
31487
31223
  }
31488
31224
  },
31489
31225
  /**
@@ -31492,21 +31228,28 @@ Object.keys(table.methods).forEach(name => {
31492
31228
  */
31493
31229
  commitProxy(proxyTarget, ...args) {
31494
31230
  const $xeGrid = this;
31495
- const reactData = $xeGrid;
31231
+ const props = $xeGrid;
31232
+ const reactData = $xeGrid.reactData;
31233
+ /**
31234
+ * 已废弃
31235
+ * @deprecated
31236
+ */
31237
+ const toolbar = props.toolbar;
31496
31238
  const {
31497
- $refs,
31498
- toolbar,
31239
+ proxyConfig,
31499
31240
  toolbarConfig,
31500
- toolbarOpts,
31501
- proxyOpts,
31502
- tablePage,
31503
31241
  pagerConfig,
31504
31242
  editRules,
31505
- isRespMsg,
31506
- isActiveMsg,
31507
- validConfig,
31508
- pagerOpts
31509
- } = this;
31243
+ validConfig
31244
+ } = props;
31245
+ const {
31246
+ tablePage
31247
+ } = reactData;
31248
+ const isActiveMsg = $xeGrid.computeIsActiveMsg;
31249
+ const isRespMsg = $xeGrid.computeIsRespMsg;
31250
+ const proxyOpts = $xeGrid.computeProxyOpts;
31251
+ const pagerOpts = $xeGrid.computePagerOpts;
31252
+ const toolbarOpts = $xeGrid.computeToolbarOpts;
31510
31253
  const {
31511
31254
  beforeQuery,
31512
31255
  afterQuery,
@@ -31517,16 +31260,19 @@ Object.keys(table.methods).forEach(name => {
31517
31260
  ajax = {}
31518
31261
  } = proxyOpts;
31519
31262
  const resConfigs = proxyOpts.response || proxyOpts.props || {};
31520
- const $xeTable = $refs.xTable;
31521
- const formData = this.getFormData();
31522
- let button;
31523
- let code;
31263
+ const $xeTable = $xeGrid.$refs.refTable;
31264
+ let formData = $xeGrid.getFormData();
31265
+ let button = null;
31266
+ let code = null;
31524
31267
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(proxyTarget)) {
31525
- const matchObj = toolbarConfig || toolbar ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(toolbarOpts.buttons, item => item.code === proxyTarget, {
31268
+ const {
31269
+ buttons
31270
+ } = toolbarOpts;
31271
+ const matchObj = (toolbarConfig || toolbar) && isEnableConf(toolbarOpts) && buttons ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(buttons, item => item.code === proxyTarget, {
31526
31272
  children: 'dropdowns'
31527
31273
  }) : null;
31528
- code = proxyTarget;
31529
31274
  button = matchObj ? matchObj.item : null;
31275
+ code = proxyTarget;
31530
31276
  } else {
31531
31277
  button = proxyTarget;
31532
31278
  code = button.code;
@@ -31546,10 +31292,10 @@ Object.keys(table.methods).forEach(name => {
31546
31292
  }) => $xeTable.setEditRow(row));
31547
31293
  // 已废弃
31548
31294
  case 'mark_cancel':
31549
- this.triggerPendingEvent(code);
31295
+ $xeGrid.triggerPendingEvent(code);
31550
31296
  break;
31551
31297
  case 'remove':
31552
- return this.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => this.removeCheckboxRow());
31298
+ return $xeGrid.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => $xeTable.removeCheckboxRow());
31553
31299
  case 'import':
31554
31300
  $xeTable.importData(btnParams);
31555
31301
  break;
@@ -31565,7 +31311,7 @@ Object.keys(table.methods).forEach(name => {
31565
31311
  case 'reset_custom':
31566
31312
  $xeTable.resetCustom(true);
31567
31313
  break;
31568
- case '_init':
31314
+ case 'initial':
31569
31315
  case 'reload':
31570
31316
  case 'query':
31571
31317
  {
@@ -31573,7 +31319,7 @@ Object.keys(table.methods).forEach(name => {
31573
31319
  const querySuccessMethods = ajax.querySuccess;
31574
31320
  const queryErrorMethods = ajax.queryError;
31575
31321
  if (ajaxMethods) {
31576
- const isInited = code === '_init';
31322
+ const isInited = code === 'initial';
31577
31323
  const isReload = code === 'reload';
31578
31324
  if (!isInited && reactData.tableLoading) {
31579
31325
  return $xeGrid.$nextTick();
@@ -31592,27 +31338,48 @@ Object.keys(table.methods).forEach(name => {
31592
31338
  }
31593
31339
  }
31594
31340
  if (isInited) {
31595
- let defaultSort = null;
31341
+ // 重置代理表单数据
31342
+ if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
31343
+ formData = $xeGrid.getDefaultFormData();
31344
+ reactData.formData = formData;
31345
+ }
31596
31346
  if ($xeTable) {
31597
31347
  const {
31598
- sortOpts
31348
+ internalData: tableInternalData
31599
31349
  } = $xeTable;
31600
- defaultSort = sortOpts.defaultSort;
31601
- }
31602
- // 如果使用默认排序
31603
- if (defaultSort) {
31604
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(defaultSort)) {
31605
- defaultSort = [defaultSort];
31606
- }
31607
- sortList = defaultSort.map(item => {
31608
- return {
31609
- field: item.field,
31610
- property: item.field,
31611
- order: item.order
31612
- };
31350
+ const {
31351
+ tableFullColumn,
31352
+ fullColumnFieldData
31353
+ } = tableInternalData;
31354
+ const sortOpts = $xeTable.computeSortOpts;
31355
+ let defaultSort = sortOpts.defaultSort;
31356
+ tableFullColumn.forEach(column => {
31357
+ column.order = null;
31613
31358
  });
31614
- }
31615
- if ($xeTable) {
31359
+ // 如果使用默认排序
31360
+ if (defaultSort) {
31361
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(defaultSort)) {
31362
+ defaultSort = [defaultSort];
31363
+ }
31364
+ sortList = defaultSort.map(item => {
31365
+ const {
31366
+ field,
31367
+ order
31368
+ } = item;
31369
+ const colRest = fullColumnFieldData[field];
31370
+ if (colRest) {
31371
+ const column = colRest.column;
31372
+ if (column) {
31373
+ column.order = order;
31374
+ }
31375
+ }
31376
+ return {
31377
+ field,
31378
+ property: field,
31379
+ order
31380
+ };
31381
+ });
31382
+ }
31616
31383
  filterList = $xeTable.getCheckedFilters();
31617
31384
  }
31618
31385
  } else {
@@ -31630,7 +31397,7 @@ Object.keys(table.methods).forEach(name => {
31630
31397
  button,
31631
31398
  isInited,
31632
31399
  isReload,
31633
- $grid: this,
31400
+ $grid: $xeGrid,
31634
31401
  page: pageParams,
31635
31402
  sort: sortList.length ? sortList[0] : {},
31636
31403
  sorts: sortList,
@@ -31638,25 +31405,25 @@ Object.keys(table.methods).forEach(name => {
31638
31405
  form: formData,
31639
31406
  options: ajaxMethods
31640
31407
  };
31641
- this.sortData = sortList;
31642
- this.filterData = filterList;
31643
- this.tableLoading = true;
31408
+ reactData.sortData = sortList;
31409
+ reactData.filterData = filterList;
31410
+ reactData.tableLoading = true;
31644
31411
  const applyArgs = [commitParams].concat(args);
31645
31412
  return Promise.resolve((beforeQuery || ajaxMethods)(...applyArgs)).then(rest => {
31646
31413
  let tableData = [];
31647
- this.tableLoading = false;
31414
+ reactData.tableLoading = false;
31648
31415
  if (rest) {
31649
31416
  if (pagerConfig && isEnableConf(pagerOpts)) {
31650
31417
  const totalProp = resConfigs.total;
31651
31418
  const total = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(totalProp) ? totalProp({
31652
31419
  data: rest,
31653
- $grid: this
31420
+ $grid: $xeGrid
31654
31421
  }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, totalProp || 'page.total')) || 0;
31655
31422
  tablePage.total = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(total);
31656
31423
  const resultProp = resConfigs.result;
31657
31424
  tableData = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resultProp) ? resultProp({
31658
31425
  data: rest,
31659
- $grid: this
31426
+ $grid: $xeGrid
31660
31427
  }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, resultProp || 'result')) || [];
31661
31428
  // 检验当前页码,不能超出当前最大页数
31662
31429
  const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
@@ -31667,7 +31434,7 @@ Object.keys(table.methods).forEach(name => {
31667
31434
  const listProp = resConfigs.list;
31668
31435
  tableData = (listProp ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(listProp) ? listProp({
31669
31436
  data: rest,
31670
- $grid: this
31437
+ $grid: $xeGrid
31671
31438
  }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, listProp) : rest) || [];
31672
31439
  }
31673
31440
  }
@@ -31693,7 +31460,7 @@ Object.keys(table.methods).forEach(name => {
31693
31460
  status: true
31694
31461
  };
31695
31462
  }).catch(rest => {
31696
- this.tableLoading = false;
31463
+ reactData.tableLoading = false;
31697
31464
  if (queryErrorMethods) {
31698
31465
  queryErrorMethods({
31699
31466
  ...commitParams,
@@ -31721,7 +31488,7 @@ Object.keys(table.methods).forEach(name => {
31721
31488
  removeRecords
31722
31489
  };
31723
31490
  const commitParams = {
31724
- $grid: this,
31491
+ $grid: $xeGrid,
31725
31492
  code,
31726
31493
  button,
31727
31494
  body,
@@ -31730,13 +31497,13 @@ Object.keys(table.methods).forEach(name => {
31730
31497
  };
31731
31498
  const applyArgs = [commitParams].concat(args);
31732
31499
  if (selectRecords.length) {
31733
- return this.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
31500
+ return $xeGrid.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
31734
31501
  if (!removeRecords.length) {
31735
31502
  return $xeTable.remove(selectRecords);
31736
31503
  }
31737
- this.tableLoading = true;
31504
+ reactData.tableLoading = true;
31738
31505
  return Promise.resolve((beforeDelete || ajaxMethods)(...applyArgs)).then(rest => {
31739
- this.tableLoading = false;
31506
+ reactData.tableLoading = false;
31740
31507
  $xeTable.setPendingRow(removeRecords, false);
31741
31508
  if (isRespMsg) {
31742
31509
  // 检测弹窗模块
@@ -31744,14 +31511,14 @@ Object.keys(table.methods).forEach(name => {
31744
31511
  errLog('vxe.error.reqModule', ['Modal']);
31745
31512
  }
31746
31513
  core_.VxeUI.modal.message({
31747
- content: this.getRespMsg(rest, 'vxe.grid.delSuccess'),
31514
+ content: $xeGrid.getRespMsg(rest, 'vxe.grid.delSuccess'),
31748
31515
  status: 'success'
31749
31516
  });
31750
31517
  }
31751
31518
  if (afterDelete) {
31752
31519
  afterDelete(...applyArgs);
31753
31520
  } else {
31754
- this.commitProxy('query');
31521
+ $xeGrid.commitProxy('query');
31755
31522
  }
31756
31523
  if (deleteSuccessMethods) {
31757
31524
  deleteSuccessMethods({
@@ -31763,7 +31530,7 @@ Object.keys(table.methods).forEach(name => {
31763
31530
  status: true
31764
31531
  };
31765
31532
  }).catch(rest => {
31766
- this.tableLoading = false;
31533
+ reactData.tableLoading = false;
31767
31534
  if (isRespMsg) {
31768
31535
  // 检测弹窗模块
31769
31536
  if (!core_.VxeUI.modal) {
@@ -31771,7 +31538,7 @@ Object.keys(table.methods).forEach(name => {
31771
31538
  }
31772
31539
  core_.VxeUI.modal.message({
31773
31540
  id: code,
31774
- content: this.getRespMsg(rest, 'vxe.grid.operError'),
31541
+ content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
31775
31542
  status: 'error'
31776
31543
  });
31777
31544
  }
@@ -31810,7 +31577,7 @@ Object.keys(table.methods).forEach(name => {
31810
31577
  const saveSuccessMethods = ajax.saveSuccess;
31811
31578
  const saveErrorMethods = ajax.saveError;
31812
31579
  if (ajaxMethods) {
31813
- const body = this.getRecordset();
31580
+ const body = $xeGrid.getRecordset();
31814
31581
  const {
31815
31582
  insertRecords,
31816
31583
  removeRecords,
@@ -31818,7 +31585,7 @@ Object.keys(table.methods).forEach(name => {
31818
31585
  pendingRecords
31819
31586
  } = body;
31820
31587
  const commitParams = {
31821
- $grid: this,
31588
+ $grid: $xeGrid,
31822
31589
  code,
31823
31590
  button,
31824
31591
  body,
@@ -31837,7 +31604,7 @@ Object.keys(table.methods).forEach(name => {
31837
31604
  let restPromise = Promise.resolve();
31838
31605
  if (editRules) {
31839
31606
  // 只校验新增和修改的数据
31840
- restPromise = this[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords));
31607
+ restPromise = $xeGrid[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords));
31841
31608
  }
31842
31609
  return restPromise.then(errMap => {
31843
31610
  if (errMap) {
@@ -31845,9 +31612,9 @@ Object.keys(table.methods).forEach(name => {
31845
31612
  return;
31846
31613
  }
31847
31614
  if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
31848
- this.tableLoading = true;
31615
+ reactData.tableLoading = true;
31849
31616
  return Promise.resolve((beforeSave || ajaxMethods)(...applyArgs)).then(rest => {
31850
- this.tableLoading = false;
31617
+ reactData.tableLoading = false;
31851
31618
  $xeTable.clearPendingRow();
31852
31619
  if (isRespMsg) {
31853
31620
  // 检测弹窗模块
@@ -31855,14 +31622,14 @@ Object.keys(table.methods).forEach(name => {
31855
31622
  errLog('vxe.error.reqModule', ['Modal']);
31856
31623
  }
31857
31624
  core_.VxeUI.modal.message({
31858
- content: this.getRespMsg(rest, 'vxe.grid.saveSuccess'),
31625
+ content: $xeGrid.getRespMsg(rest, 'vxe.grid.saveSuccess'),
31859
31626
  status: 'success'
31860
31627
  });
31861
31628
  }
31862
31629
  if (afterSave) {
31863
31630
  afterSave(...applyArgs);
31864
31631
  } else {
31865
- this.commitProxy('query');
31632
+ $xeGrid.commitProxy('query');
31866
31633
  }
31867
31634
  if (saveSuccessMethods) {
31868
31635
  saveSuccessMethods({
@@ -31874,7 +31641,7 @@ Object.keys(table.methods).forEach(name => {
31874
31641
  status: true
31875
31642
  };
31876
31643
  }).catch(rest => {
31877
- this.tableLoading = false;
31644
+ reactData.tableLoading = false;
31878
31645
  if (isRespMsg) {
31879
31646
  // 检测弹窗模块
31880
31647
  if (!core_.VxeUI.modal) {
@@ -31882,7 +31649,7 @@ Object.keys(table.methods).forEach(name => {
31882
31649
  }
31883
31650
  core_.VxeUI.modal.message({
31884
31651
  id: code,
31885
- content: this.getRespMsg(rest, 'vxe.grid.operError'),
31652
+ content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
31886
31653
  status: 'error'
31887
31654
  });
31888
31655
  }
@@ -31923,7 +31690,7 @@ Object.keys(table.methods).forEach(name => {
31923
31690
  gCommandOpts.commandMethod({
31924
31691
  code,
31925
31692
  button,
31926
- $grid: this,
31693
+ $grid: $xeGrid,
31927
31694
  $table: $xeTable
31928
31695
  }, ...args);
31929
31696
  } else {
@@ -31932,66 +31699,34 @@ Object.keys(table.methods).forEach(name => {
31932
31699
  }
31933
31700
  }
31934
31701
  }
31935
- return this.$nextTick();
31936
- },
31937
- getRespMsg(rest, defaultMsg) {
31938
- const {
31939
- proxyOpts
31940
- } = this;
31941
- const resConfigs = proxyOpts.response || proxyOpts.props || {};
31942
- let msg;
31943
- if (rest && resConfigs.message) {
31944
- msg = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, resConfigs.message);
31945
- }
31946
- return msg || grid_getI18n(defaultMsg);
31947
- },
31948
- handleDeleteRow(code, alertKey, callback) {
31949
- const selectRecords = this.getCheckboxRecords();
31950
- if (this.isActiveMsg) {
31951
- if (selectRecords.length) {
31952
- return core_.VxeUI.modal.confirm({
31953
- id: `cfm_${code}`,
31954
- content: grid_getI18n(alertKey),
31955
- escClosable: true
31956
- }).then(type => {
31957
- if (type === 'confirm') {
31958
- return callback();
31959
- }
31960
- });
31961
- } else {
31962
- // 检测弹窗模块
31963
- if (!core_.VxeUI.modal) {
31964
- errLog('vxe.error.reqModule', ['Modal']);
31965
- }
31966
- core_.VxeUI.modal.message({
31967
- id: `msg_${code}`,
31968
- content: grid_getI18n('vxe.grid.selectOneRecord'),
31969
- status: 'warning'
31970
- });
31971
- }
31972
- } else {
31973
- if (selectRecords.length) {
31974
- callback();
31975
- }
31976
- }
31977
- return Promise.resolve();
31702
+ return $xeGrid.$nextTick();
31978
31703
  },
31979
31704
  getFormData() {
31705
+ const $xeGrid = this;
31706
+ const props = $xeGrid;
31707
+ const reactData = $xeGrid.reactData;
31708
+ const {
31709
+ proxyConfig
31710
+ } = props;
31980
31711
  const {
31981
- proxyConfig,
31982
- proxyOpts,
31983
- formOpts,
31984
31712
  formData
31985
- } = this;
31713
+ } = reactData;
31714
+ const proxyOpts = $xeGrid.computeProxyOpts;
31715
+ const formOpts = $xeGrid.computeFormOpts;
31986
31716
  return proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data;
31987
31717
  },
31988
31718
  getFormItems(itemIndex) {
31719
+ const $xeGrid = this;
31720
+ const props = $xeGrid;
31721
+ const formOpts = $xeGrid.computeFormOpts;
31989
31722
  const {
31990
- formConfig,
31991
- formOpts
31992
- } = this;
31723
+ formConfig
31724
+ } = props;
31725
+ const {
31726
+ items
31727
+ } = formOpts;
31993
31728
  const itemList = [];
31994
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(isEnableConf(formConfig) && formOpts.items ? formOpts.items : [], item => {
31729
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(formConfig && isEnableConf(formOpts) && items ? items : [], item => {
31995
31730
  itemList.push(item);
31996
31731
  }, {
31997
31732
  children: 'children'
@@ -31999,215 +31734,218 @@ Object.keys(table.methods).forEach(name => {
31999
31734
  return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(itemIndex) ? itemList : itemList[itemIndex];
32000
31735
  },
32001
31736
  triggerToolbarCommitEvent(params, evnt) {
31737
+ const $xeGrid = this;
32002
31738
  const {
32003
31739
  code
32004
31740
  } = params;
32005
- return this.commitProxy(params, evnt).then(rest => {
31741
+ return $xeGrid.commitProxy(params, evnt).then(rest => {
32006
31742
  if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
32007
- this.$emit(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', {
31743
+ $xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', {
32008
31744
  ...rest,
32009
- isReload: code === 'reload',
32010
- $grid: this,
32011
- $event: evnt
32012
- });
31745
+ isReload: code === 'reload'
31746
+ }, evnt);
32013
31747
  }
32014
31748
  });
32015
31749
  },
32016
31750
  triggerToolbarBtnEvent(button, evnt) {
32017
- this.triggerToolbarCommitEvent(button, evnt);
32018
- this.$emit('toolbar-button-click', {
31751
+ const $xeGrid = this;
31752
+ $xeGrid.triggerToolbarCommitEvent(button, evnt);
31753
+ $xeGrid.dispatchEvent('toolbar-button-click', {
32019
31754
  code: button.code,
32020
- button,
32021
- $grid: this,
32022
- $event: evnt
32023
- });
31755
+ button
31756
+ }, evnt);
32024
31757
  },
32025
31758
  triggerToolbarTolEvent(tool, evnt) {
32026
- this.triggerToolbarCommitEvent(tool, evnt);
32027
- this.$emit('toolbar-tool-click', {
31759
+ const $xeGrid = this;
31760
+ $xeGrid.triggerToolbarCommitEvent(tool, evnt);
31761
+ $xeGrid.dispatchEvent('toolbar-tool-click', {
32028
31762
  code: tool.code,
32029
- tool,
32030
- $grid: this,
32031
- $event: evnt
32032
- });
31763
+ tool
31764
+ }, evnt);
32033
31765
  },
32034
- triggerPendingEvent(code) {
31766
+ sortChangeEvent(params) {
31767
+ const $xeGrid = this;
31768
+ const props = $xeGrid;
31769
+ const reactData = $xeGrid.reactData;
31770
+ const $xeTable = $xeGrid.$refs.refTable;
32035
31771
  const {
32036
- isActiveMsg
32037
- } = this;
32038
- const selectRecords = this.getCheckboxRecords();
32039
- if (selectRecords.length) {
32040
- this.togglePendingRow(selectRecords);
32041
- this.clearCheckboxRow();
32042
- } else {
32043
- if (isActiveMsg) {
32044
- // 检测弹窗模块
32045
- if (!core_.VxeUI.modal) {
32046
- errLog('vxe.error.reqModule', ['Modal']);
32047
- }
32048
- core_.VxeUI.modal.message({
32049
- id: code,
32050
- content: grid_getI18n('vxe.grid.selectOneRecord'),
32051
- status: 'warning'
31772
+ proxyConfig
31773
+ } = props;
31774
+ const proxyOpts = $xeGrid.computeProxyOpts;
31775
+ const sortOpts = $xeTable.computeSortOpts;
31776
+ // 如果是服务端排序
31777
+ if (sortOpts.remote) {
31778
+ reactData.sortData = params.sortList;
31779
+ if (proxyConfig && isEnableConf(proxyOpts)) {
31780
+ reactData.tablePage.currentPage = 1;
31781
+ $xeGrid.commitProxy('query').then(rest => {
31782
+ $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
32052
31783
  });
32053
31784
  }
32054
31785
  }
31786
+ $xeGrid.dispatchEvent('sort-change', params, params.$event);
32055
31787
  },
32056
- sortChangeEvent(params) {
31788
+ pageChangeEvent(params) {
31789
+ const $xeGrid = this;
31790
+ const props = $xeGrid;
31791
+ const reactData = $xeGrid.reactData;
32057
31792
  const {
32058
- $table,
32059
- column,
32060
- sortList
31793
+ proxyConfig
31794
+ } = props;
31795
+ const {
31796
+ tablePage
31797
+ } = reactData;
31798
+ const {
31799
+ $event,
31800
+ currentPage,
31801
+ pageSize
32061
31802
  } = params;
32062
- const isRemote = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.remoteSort) ? column.remoteSort : $table.sortOpts.remote;
32063
- // 如果是服务端排序
32064
- if (isRemote) {
32065
- this.sortData = sortList;
32066
- if (this.proxyConfig) {
32067
- this.tablePage.currentPage = 1;
32068
- this.commitProxy('query').then(rest => {
32069
- this.$emit('proxy-query', {
32070
- ...rest,
32071
- $grid: this,
32072
- $event: params.$event
32073
- });
32074
- });
32075
- }
31803
+ const proxyOpts = $xeGrid.computeProxyOpts;
31804
+ tablePage.currentPage = currentPage;
31805
+ tablePage.pageSize = pageSize;
31806
+ $xeGrid.dispatchEvent('page-change', params, $event);
31807
+ if (proxyConfig && isEnableConf(proxyOpts)) {
31808
+ $xeGrid.commitProxy('query').then(rest => {
31809
+ $xeGrid.dispatchEvent('proxy-query', rest, $event);
31810
+ });
32076
31811
  }
32077
- this.$emit('sort-change', Object.assign({
32078
- $grid: this
32079
- }, params));
32080
31812
  },
32081
31813
  filterChangeEvent(params) {
31814
+ const $xeGrid = this;
31815
+ const props = $xeGrid;
31816
+ const reactData = $xeGrid.reactData;
31817
+ const $xeTable = $xeGrid.$refs.refTable;
32082
31818
  const {
32083
- $table,
32084
- filterList
32085
- } = params;
31819
+ proxyConfig
31820
+ } = props;
31821
+ const proxyOpts = $xeGrid.computeProxyOpts;
31822
+ const filterOpts = $xeTable.computeFilterOpts;
32086
31823
  // 如果是服务端过滤
32087
- if ($table.filterOpts.remote) {
32088
- this.filterData = filterList;
32089
- if (this.proxyConfig) {
32090
- this.tablePage.currentPage = 1;
32091
- this.commitProxy('query').then(rest => {
32092
- this.$emit('proxy-query', {
32093
- ...rest,
32094
- $grid: this,
32095
- $event: params.$event
32096
- });
31824
+ if (filterOpts.remote) {
31825
+ reactData.filterData = params.filterList;
31826
+ if (proxyConfig && isEnableConf(proxyOpts)) {
31827
+ reactData.tablePage.currentPage = 1;
31828
+ $xeGrid.commitProxy('query').then(rest => {
31829
+ $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
32097
31830
  });
32098
31831
  }
32099
31832
  }
32100
- this.$emit('filter-change', Object.assign({
32101
- $grid: this
32102
- }, params));
31833
+ $xeGrid.dispatchEvent('filter-change', params, params.$event);
32103
31834
  },
32104
- submitEvent(params) {
31835
+ submitFormEvent(params) {
32105
31836
  const $xeGrid = this;
32106
- const reactData = $xeGrid;
31837
+ const props = $xeGrid;
31838
+ const reactData = $xeGrid.reactData;
32107
31839
  const {
32108
31840
  proxyConfig
32109
- } = this;
31841
+ } = props;
31842
+ const proxyOpts = $xeGrid.computeProxyOpts;
32110
31843
  if (reactData.tableLoading) {
32111
31844
  return;
32112
31845
  }
32113
- if (proxyConfig) {
32114
- this.commitProxy('reload').then(rest => {
32115
- this.$emit('proxy-query', {
31846
+ if (proxyConfig && isEnableConf(proxyOpts)) {
31847
+ $xeGrid.commitProxy('reload').then(rest => {
31848
+ $xeGrid.dispatchEvent('proxy-query', {
32116
31849
  ...rest,
32117
- isReload: true,
32118
- $grid: this,
32119
- $event: params.$event
32120
- });
31850
+ isReload: true
31851
+ }, params.$event);
32121
31852
  });
32122
31853
  }
32123
- this.$emit('form-submit', Object.assign({
32124
- $grid: this
32125
- }, params));
31854
+ $xeGrid.dispatchEvent('form-submit', params, params.$event);
32126
31855
  },
32127
- resetEvent(params) {
31856
+ resetFormEvent(params) {
31857
+ const $xeGrid = this;
31858
+ const props = $xeGrid;
31859
+ const $xeTable = $xeGrid.$refs.refTable;
32128
31860
  const {
32129
31861
  proxyConfig
32130
- } = this;
32131
- const $xeTable = this.$refs.xTable;
32132
- if (proxyConfig) {
31862
+ } = props;
31863
+ const {
31864
+ $event
31865
+ } = params;
31866
+ const proxyOpts = $xeGrid.computeProxyOpts;
31867
+ if (proxyConfig && isEnableConf(proxyOpts)) {
32133
31868
  $xeTable.clearScroll();
32134
- this.commitProxy('reload').then(rest => {
32135
- this.$emit('proxy-query', {
31869
+ $xeGrid.commitProxy('reload').then(rest => {
31870
+ $xeGrid.dispatchEvent('proxy-query', {
32136
31871
  ...rest,
32137
- isReload: true,
32138
- $grid: this,
32139
- $event: params.$event
32140
- });
31872
+ isReload: true
31873
+ }, $event);
32141
31874
  });
32142
31875
  }
32143
- this.$emit('form-reset', Object.assign({
32144
- $grid: this
32145
- }, params));
31876
+ $xeGrid.dispatchEvent('form-reset', params, $event);
32146
31877
  },
32147
31878
  submitInvalidEvent(params) {
32148
- this.$emit('form-submit-invalid', Object.assign({
32149
- $grid: this
32150
- }, params));
31879
+ const $xeGrid = this;
31880
+ $xeGrid.dispatchEvent('form-submit-invalid', params, params.$event);
32151
31881
  },
32152
31882
  collapseEvent(params) {
32153
- this.$nextTick(() => this.recalculate(true));
32154
- this.$emit('form-toggle-collapse', Object.assign({
32155
- $grid: this
32156
- }, params));
32157
- this.$emit('form-collapse', Object.assign({
32158
- $grid: this
32159
- }, params));
31883
+ const $xeGrid = this;
31884
+ const {
31885
+ $event
31886
+ } = params;
31887
+ $xeGrid.dispatchEvent('form-toggle-collapse', params, $event);
31888
+ $xeGrid.dispatchEvent('form-collapse', params, $event);
32160
31889
  },
32161
31890
  triggerZoomEvent(evnt) {
32162
- this.zoom();
32163
- this.$emit('zoom', {
32164
- $grid: this,
32165
- type: this.isZMax ? 'max' : 'revert',
32166
- $event: evnt
32167
- });
31891
+ const $xeGrid = this;
31892
+ const reactData = $xeGrid.reactData;
31893
+ $xeGrid.zoom();
31894
+ $xeGrid.dispatchEvent('zoom', {
31895
+ type: reactData.isZMax ? 'max' : 'revert'
31896
+ }, evnt);
32168
31897
  },
32169
31898
  zoom() {
32170
- return this[this.isZMax ? 'revert' : 'maximize']();
31899
+ const $xeGrid = this;
31900
+ const reactData = $xeGrid.reactData;
31901
+ return $xeGrid[reactData.isZMax ? 'revert' : 'maximize']();
32171
31902
  },
32172
31903
  isMaximized() {
32173
- return this.isZMax;
31904
+ const $xeGrid = this;
31905
+ const reactData = $xeGrid.reactData;
31906
+ return reactData.isZMax;
32174
31907
  },
32175
31908
  maximize() {
32176
- return this.handleZoom(true);
31909
+ const $xeGrid = this;
31910
+ return $xeGrid.handleZoom(true);
32177
31911
  },
32178
31912
  revert() {
32179
- return this.handleZoom();
31913
+ const $xeGrid = this;
31914
+ return $xeGrid.handleZoom();
32180
31915
  },
32181
31916
  handleZoom(isMax) {
31917
+ const $xeGrid = this;
31918
+ const reactData = $xeGrid.reactData;
32182
31919
  const {
32183
31920
  isZMax
32184
- } = this;
31921
+ } = reactData;
32185
31922
  if (isMax ? !isZMax : isZMax) {
32186
- this.isZMax = !isZMax;
32187
- if (this.tZindex < getLastZIndex()) {
32188
- this.tZindex = nextZIndex();
31923
+ reactData.isZMax = !isZMax;
31924
+ if (reactData.tZindex < getLastZIndex()) {
31925
+ reactData.tZindex = nextZIndex();
32189
31926
  }
32190
31927
  }
32191
- return this.$nextTick().then(() => this.recalculate(true)).then(() => {
32192
- setTimeout(() => this.recalculate(true), 15);
32193
- return this.isZMax;
31928
+ return $xeGrid.$nextTick().then(() => $xeGrid.recalculate(true)).then(() => {
31929
+ setTimeout(() => $xeGrid.recalculate(true), 15);
31930
+ return reactData.isZMax;
32194
31931
  });
32195
31932
  },
32196
31933
  getProxyInfo() {
32197
31934
  const $xeGrid = this;
32198
- const $xeTable = $xeGrid.$refs.xTable;
32199
- const {
32200
- sortData,
32201
- proxyConfig
32202
- } = this;
32203
- if (proxyConfig) {
31935
+ const props = $xeGrid;
31936
+ const $xeTable = $xeGrid.$refs.refTable;
31937
+ const reactData = $xeGrid.reactData;
31938
+ if (props.proxyConfig) {
31939
+ const {
31940
+ sortData
31941
+ } = reactData;
32204
31942
  return {
32205
31943
  data: $xeTable ? $xeTable.getFullData() : [],
32206
- filter: this.filterData,
32207
- form: this.getFormData(),
31944
+ filter: reactData.filterData,
31945
+ form: $xeGrid.getFormData(),
32208
31946
  sort: sortData.length ? sortData[0] : {},
32209
31947
  sorts: sortData,
32210
- pager: this.tablePage,
31948
+ pager: reactData.tablePage,
32211
31949
  pendingRecords: $xeTable ? $xeTable.getPendingRecords() : []
32212
31950
  };
32213
31951
  }
@@ -32215,15 +31953,13 @@ Object.keys(table.methods).forEach(name => {
32215
31953
  },
32216
31954
  loadColumn(columns) {
32217
31955
  const $xeGrid = this;
32218
- const $xeTable = $xeGrid.$refs.xTable;
32219
- const {
32220
- $scopedSlots
32221
- } = this;
31956
+ const slots = $xeGrid.$scopedSlots;
31957
+ const $xeTable = $xeGrid.$refs.refTable;
32222
31958
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(columns, column => {
32223
31959
  if (column.slots) {
32224
31960
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(column.slots, func => {
32225
31961
  if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
32226
- if (!$scopedSlots[func]) {
31962
+ if (!slots[func]) {
32227
31963
  errLog('vxe.error.notSlot', [func]);
32228
31964
  }
32229
31965
  }
@@ -32236,9 +31972,417 @@ Object.keys(table.methods).forEach(name => {
32236
31972
  const $xeGrid = this;
32237
31973
  $xeGrid.clearAll();
32238
31974
  return $xeGrid.loadColumn(columns);
31975
+ },
31976
+ getConfigSlot(slotConfigs) {
31977
+ const $xeGrid = this;
31978
+ const slots = $xeGrid.$scopedSlots;
31979
+ const slotConf = {};
31980
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectMap(slotConfigs, (slotFunc, slotKey) => {
31981
+ if (slotFunc) {
31982
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
31983
+ if (slots[slotFunc]) {
31984
+ slotConf[slotKey] = slots[slotFunc];
31985
+ } else {
31986
+ errLog('vxe.error.notSlot', [slotFunc]);
31987
+ }
31988
+ } else {
31989
+ slotConf[slotKey] = slotFunc;
31990
+ }
31991
+ }
31992
+ });
31993
+ return slotConf;
31994
+ },
31995
+ getToolbarSlots() {
31996
+ const $xeGrid = this;
31997
+ const slots = $xeGrid.$scopedSlots;
31998
+ const toolbarOpts = $xeGrid.computeToolbarOpts;
31999
+ const toolbarOptSlots = toolbarOpts.slots;
32000
+ const toolbarSlots = {};
32001
+ if (slots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
32002
+ warnLog('vxe.error.reqProp', ['toolbar-config.slots.buttons']);
32003
+ }
32004
+ if (slots.tools && (!toolbarOptSlots || toolbarOptSlots.tools !== 'tools')) {
32005
+ warnLog('vxe.error.reqProp', ['toolbar-config.slots.tools']);
32006
+ }
32007
+ if (toolbarOptSlots) {
32008
+ const buttonsSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttons');
32009
+ const buttonPrefixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttonPrefix');
32010
+ const buttonSuffixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttonSuffix');
32011
+ const toolsSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'tools');
32012
+ const toolPrefixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'toolPrefix');
32013
+ const toolSuffixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'toolSuffix');
32014
+ if (buttonsSlot) {
32015
+ toolbarSlots.buttons = buttonsSlot;
32016
+ }
32017
+ if (buttonPrefixSlot) {
32018
+ toolbarSlots.buttonPrefix = buttonPrefixSlot;
32019
+ }
32020
+ if (buttonSuffixSlot) {
32021
+ toolbarSlots.buttonSuffix = buttonSuffixSlot;
32022
+ }
32023
+ if (toolsSlot) {
32024
+ toolbarSlots.tools = toolsSlot;
32025
+ }
32026
+ if (toolPrefixSlot) {
32027
+ toolbarSlots.toolPrefix = toolPrefixSlot;
32028
+ }
32029
+ if (toolSuffixSlot) {
32030
+ toolbarSlots.toolSuffix = toolSuffixSlot;
32031
+ }
32032
+ }
32033
+ return toolbarSlots;
32034
+ },
32035
+ getFuncSlot(optSlots, slotKey) {
32036
+ const $xeGrid = this;
32037
+ const slots = $xeGrid.$scopedSlots;
32038
+ const funcSlot = optSlots[slotKey];
32039
+ if (funcSlot) {
32040
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(funcSlot)) {
32041
+ if (slots[funcSlot]) {
32042
+ return slots[funcSlot];
32043
+ } else {
32044
+ errLog('vxe.error.notSlot', [funcSlot]);
32045
+ }
32046
+ } else {
32047
+ return funcSlot;
32048
+ }
32049
+ }
32050
+ return null;
32051
+ },
32052
+ //
32053
+ // Render
32054
+ //
32055
+ renderDefaultForm(h) {
32056
+ const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
32057
+ const $xeGrid = this;
32058
+ const props = $xeGrid;
32059
+ const slots = $xeGrid.$scopedSlots;
32060
+ const reactData = $xeGrid.reactData;
32061
+ const {
32062
+ proxyConfig,
32063
+ formConfig
32064
+ } = props;
32065
+ const {
32066
+ formData
32067
+ } = reactData;
32068
+ const proxyOpts = $xeGrid.computeProxyOpts;
32069
+ const formOpts = $xeGrid.computeFormOpts;
32070
+ if (isEnableConf(formConfig) && formOpts.items && formOpts.items.length) {
32071
+ const formSlots = {};
32072
+ if (!formOpts.inited) {
32073
+ formOpts.inited = true;
32074
+ const beforeItem = proxyOpts.beforeItem;
32075
+ if (proxyOpts && beforeItem) {
32076
+ formOpts.items.forEach(item => {
32077
+ beforeItem.call($xeGrid, {
32078
+ $grid: $xeGrid,
32079
+ item
32080
+ });
32081
+ });
32082
+ }
32083
+ }
32084
+ // 处理插槽
32085
+ formOpts.items.forEach(item => {
32086
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(item.slots, func => {
32087
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
32088
+ if (slots[func]) {
32089
+ formSlots[func] = slots[func];
32090
+ }
32091
+ }
32092
+ });
32093
+ });
32094
+ return [VxeUIFormComponent ? h(VxeUIFormComponent, {
32095
+ props: Object.assign({}, formOpts, {
32096
+ data: proxyConfig && proxyOpts.form ? formData : formOpts.data
32097
+ }),
32098
+ on: {
32099
+ submit: $xeGrid.submitFormEvent,
32100
+ reset: $xeGrid.resetFormEvent,
32101
+ collapse: $xeGrid.collapseEvent,
32102
+ 'submit-invalid': $xeGrid.submitInvalidEvent
32103
+ },
32104
+ scopedSlots: formSlots
32105
+ }) : grid_renderEmptyElement($xeGrid)];
32106
+ }
32107
+ return [];
32108
+ },
32109
+ renderForm(h) {
32110
+ const $xeGrid = this;
32111
+ const props = $xeGrid;
32112
+ const slots = $xeGrid.$scopedSlots;
32113
+ const {
32114
+ formConfig
32115
+ } = props;
32116
+ const formSlot = slots.form;
32117
+ const hasForm = !!(formSlot || isEnableConf(formConfig));
32118
+ if (hasForm) {
32119
+ return h('div', {
32120
+ key: 'form',
32121
+ ref: 'refFormWrapper',
32122
+ class: 'vxe-grid--form-wrapper'
32123
+ }, formSlot ? formSlot.call($xeGrid, {
32124
+ $grid: $xeGrid
32125
+ }) : $xeGrid.renderDefaultForm(h));
32126
+ }
32127
+ return grid_renderEmptyElement($xeGrid);
32128
+ },
32129
+ renderToolbar(h) {
32130
+ const $xeGrid = this;
32131
+ const props = $xeGrid;
32132
+ const slots = $xeGrid.$scopedSlots;
32133
+ const {
32134
+ toolbarConfig
32135
+ } = props;
32136
+ const toolbarSlot = slots.toolbar;
32137
+ const hasToolbar = !!(toolbarSlot || isEnableConf(toolbarConfig) || toolbar);
32138
+ const toolbarOpts = $xeGrid.computeToolbarOpts;
32139
+ if (hasToolbar) {
32140
+ return h('div', {
32141
+ key: 'toolbar',
32142
+ ref: 'refToolbarWrapper',
32143
+ class: 'vxe-grid--toolbar-wrapper'
32144
+ }, toolbarSlot ? toolbarSlot.call($xeGrid, {
32145
+ $grid: $xeGrid
32146
+ }) : [h(src_toolbar, {
32147
+ props: Object.assign({}, toolbarOpts, {
32148
+ slots: undefined
32149
+ }),
32150
+ ref: 'xToolbar',
32151
+ scopedSlots: $xeGrid.getToolbarSlots()
32152
+ })]);
32153
+ }
32154
+ return grid_renderEmptyElement($xeGrid);
32155
+ },
32156
+ renderTop(h) {
32157
+ const $xeGrid = this;
32158
+ const slots = $xeGrid.$scopedSlots;
32159
+ const topSlot = slots.top;
32160
+ return topSlot ? h('div', {
32161
+ key: 'top',
32162
+ ref: 'refTopWrapper',
32163
+ class: 'vxe-grid--top-wrapper'
32164
+ }, topSlot.call($xeGrid, {
32165
+ $grid: $xeGrid
32166
+ })) : grid_renderEmptyElement($xeGrid);
32167
+ },
32168
+ renderTableLeft(h) {
32169
+ const $xeGrid = this;
32170
+ const slots = $xeGrid.$scopedSlots;
32171
+ const leftSlot = slots.left;
32172
+ if (leftSlot) {
32173
+ return h('div', {
32174
+ class: 'vxe-grid--left-wrapper'
32175
+ }, leftSlot({
32176
+ $grid: $xeGrid
32177
+ }));
32178
+ }
32179
+ return grid_renderEmptyElement($xeGrid);
32180
+ },
32181
+ renderTableRight(h) {
32182
+ const $xeGrid = this;
32183
+ const slots = $xeGrid.$scopedSlots;
32184
+ const rightSlot = slots.right;
32185
+ if (rightSlot) {
32186
+ return h('div', {
32187
+ class: 'vxe-grid--right-wrapper'
32188
+ }, rightSlot({
32189
+ $grid: $xeGrid
32190
+ }));
32191
+ }
32192
+ return grid_renderEmptyElement($xeGrid);
32193
+ },
32194
+ renderTable(h) {
32195
+ const $xeGrid = this;
32196
+ const slots = $xeGrid.$scopedSlots;
32197
+ const tableProps = $xeGrid.computeTableProps;
32198
+ return h('div', {
32199
+ class: 'vxe-grid--table-wrapper'
32200
+ }, [h(table, {
32201
+ key: 'table',
32202
+ props: tableProps,
32203
+ on: getTableOns($xeGrid),
32204
+ scopedSlots: slots,
32205
+ ref: 'refTable'
32206
+ })]);
32207
+ },
32208
+ renderBottom(h) {
32209
+ const $xeGrid = this;
32210
+ const slots = $xeGrid.$scopedSlots;
32211
+ const bottomSlot = slots.bottom;
32212
+ return bottomSlot ? h('div', {
32213
+ key: 'bottom',
32214
+ ref: 'refBottomWrapper',
32215
+ class: 'vxe-grid--bottom-wrapper'
32216
+ }, bottomSlot.call($xeGrid, {
32217
+ $grid: $xeGrid
32218
+ })) : grid_renderEmptyElement($xeGrid);
32219
+ },
32220
+ renderPager(h) {
32221
+ const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
32222
+ const $xeGrid = this;
32223
+ const props = $xeGrid;
32224
+ const slots = $xeGrid.$scopedSlots;
32225
+ const reactData = $xeGrid.reactData;
32226
+ const {
32227
+ proxyConfig,
32228
+ pagerConfig
32229
+ } = props;
32230
+ const proxyOpts = $xeGrid.computeProxyOpts;
32231
+ const pagerOpts = $xeGrid.computePagerOpts;
32232
+ const pagerSlot = slots.pager;
32233
+ if (pagerConfig && isEnableConf(pagerOpts) || slots.pager) {
32234
+ return h('div', {
32235
+ ref: 'refPagerWrapper',
32236
+ key: 'pager',
32237
+ class: 'vxe-grid--pager-wrapper'
32238
+ }, pagerSlot ? pagerSlot.call($xeGrid, {
32239
+ $grid: $xeGrid
32240
+ }) : [VxeUIPagerComponent ? h(VxeUIPagerComponent, {
32241
+ ref: 'refPager',
32242
+ props: {
32243
+ ...pagerOpts,
32244
+ ...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {})
32245
+ },
32246
+ on: {
32247
+ 'page-change': $xeGrid.pageChangeEvent
32248
+ },
32249
+ scopedSlots: $xeGrid.getConfigSlot(pagerOpts.slots)
32250
+ }) : grid_renderEmptyElement($xeGrid)]);
32251
+ }
32252
+ return grid_renderEmptyElement($xeGrid);
32253
+ },
32254
+ renderChildLayout(h, layoutKeys) {
32255
+ const $xeGrid = this;
32256
+ const childVNs = [];
32257
+ layoutKeys.forEach(key => {
32258
+ switch (key) {
32259
+ case 'Form':
32260
+ childVNs.push($xeGrid.renderForm(h));
32261
+ break;
32262
+ case 'Toolbar':
32263
+ childVNs.push($xeGrid.renderToolbar(h));
32264
+ break;
32265
+ case 'Top':
32266
+ childVNs.push($xeGrid.renderTop(h));
32267
+ break;
32268
+ case 'Table':
32269
+ childVNs.push(h('div', {
32270
+ key: 'table',
32271
+ class: 'vxe-grid--table-container'
32272
+ }, [$xeGrid.renderTableLeft(h), $xeGrid.renderTable(h), $xeGrid.renderTableRight(h)]));
32273
+ break;
32274
+ case 'Bottom':
32275
+ childVNs.push($xeGrid.renderBottom(h));
32276
+ break;
32277
+ case 'Pager':
32278
+ childVNs.push($xeGrid.renderPager(h));
32279
+ break;
32280
+ default:
32281
+ errLog('vxe.error.notProp', [`layouts -> ${key}`]);
32282
+ break;
32283
+ }
32284
+ });
32285
+ return childVNs;
32286
+ },
32287
+ renderLayout(h) {
32288
+ const $xeGrid = this;
32289
+ const slots = $xeGrid.$scopedSlots;
32290
+ const currLayoutConf = $xeGrid.computeCurrLayoutConf;
32291
+ const {
32292
+ headKeys,
32293
+ bodyKeys,
32294
+ footKeys
32295
+ } = currLayoutConf;
32296
+ const asideLeftSlot = slots.asideLeft || slots['aside-left'];
32297
+ const asideRightSlot = slots.asideRight || slots['aside-right'];
32298
+ return [h('div', {
32299
+ class: 'vxe-grid--layout-header-wrapper'
32300
+ }, $xeGrid.renderChildLayout(h, headKeys)), h('div', {
32301
+ class: 'vxe-grid--layout-body-wrapper'
32302
+ }, [asideLeftSlot ? h('div', {
32303
+ class: 'vxe-grid--layout-aside-left-wrapper'
32304
+ }, asideLeftSlot({})) : grid_renderEmptyElement($xeGrid), h('div', {
32305
+ class: 'vxe-grid--layout-body-content-wrapper'
32306
+ }, $xeGrid.renderChildLayout(h, bodyKeys)), asideRightSlot ? h('div', {
32307
+ class: 'vxe-grid--layout-aside-right-wrapper'
32308
+ }, asideRightSlot({})) : grid_renderEmptyElement($xeGrid)]), h('div', {
32309
+ class: 'vxe-grid--layout-footer-wrapper'
32310
+ }, $xeGrid.renderChildLayout(h, footKeys))];
32311
+ },
32312
+ renderVN(h) {
32313
+ const $xeGrid = this;
32314
+ const props = $xeGrid;
32315
+ const reactData = $xeGrid.reactData;
32316
+ const vSize = $xeGrid.computeSize;
32317
+ const styles = $xeGrid.computeStyles;
32318
+ return h('div', {
32319
+ ref: 'refElem',
32320
+ class: ['vxe-grid', {
32321
+ [`size--${vSize}`]: vSize,
32322
+ 'is--animat': !!props.animat,
32323
+ 'is--round': props.round,
32324
+ 'is--maximize': reactData.isZMax,
32325
+ 'is--loading': props.loading || reactData.tableLoading
32326
+ }],
32327
+ style: styles
32328
+ }, $xeGrid.renderLayout(h));
32239
32329
  }
32330
+ },
32331
+ created() {
32332
+ // 使用已安装的组件,如果未安装则不渲染
32333
+ const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
32334
+ const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
32335
+ const $xeGrid = this;
32336
+ const props = $xeGrid;
32337
+ const proxyOpts = $xeGrid.computeProxyOpts;
32338
+ // const { data, formOpts, proxyOpts, proxyConfig } = this
32339
+ // if (proxyConfig && (data || (proxyOpts.form && formOpts.data))) {
32340
+ // errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
32341
+ // }
32342
+ if (props.toolbar) {
32343
+ errLog('vxe.error.delProp', ['grid.toolbar', 'grid.toolbar-config']);
32344
+ }
32345
+ if (props.toolbarConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.toolbarConfig)) {
32346
+ errLog('vxe.error.errProp', [`grid.toolbar-config=${props.toolbarConfig}`, 'grid.toolbar-config={}']);
32347
+ }
32348
+ if (proxyOpts.props) {
32349
+ warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response']);
32350
+ }
32351
+ $xeGrid.$nextTick(() => {
32352
+ if (props.formConfig) {
32353
+ if (!VxeUIFormComponent) {
32354
+ errLog('vxe.error.reqComp', ['vxe-form']);
32355
+ }
32356
+ }
32357
+ if (props.pagerConfig) {
32358
+ if (!VxeUIPagerComponent) {
32359
+ errLog('vxe.error.reqComp', ['vxe-pager']);
32360
+ }
32361
+ }
32362
+ });
32363
+ $xeGrid.initPages();
32364
+ grid_globalEvents.on($xeGrid, 'keydown', $xeGrid.handleGlobalKeydownEvent);
32365
+ },
32366
+ mounted() {
32367
+ const $xeGrid = this;
32368
+ const props = $xeGrid;
32369
+ const {
32370
+ columns
32371
+ } = props;
32372
+ if (columns && columns.length) {
32373
+ $xeGrid.loadColumn(columns);
32374
+ }
32375
+ $xeGrid.initToolbar();
32376
+ $xeGrid.initProxy();
32377
+ },
32378
+ destroyed() {
32379
+ const $xeGrid = this;
32380
+ grid_globalEvents.off($xeGrid, 'keydown');
32381
+ },
32382
+ render(h) {
32383
+ return this.renderVN(h);
32240
32384
  }
32241
- });
32385
+ })); /* define-vxe-component end */
32242
32386
  ;// CONCATENATED MODULE: ./packages/grid/index.ts
32243
32387
 
32244
32388