vxe-table 3.5.6 → 3.5.7

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 (89) hide show
  1. package/lib/all.js +15 -15
  2. package/lib/all.min.js +1 -1
  3. package/lib/button/style/style.css +0 -5
  4. package/lib/button/style/style.min.css +1 -1
  5. package/lib/checkbox/src/checkbox.js +12 -2
  6. package/lib/checkbox/src/checkbox.min.js +1 -1
  7. package/lib/checkbox/src/group.js +14 -2
  8. package/lib/checkbox/src/group.min.js +1 -1
  9. package/lib/edit/src/mixin.js +39 -4
  10. package/lib/edit/src/mixin.min.js +1 -1
  11. package/lib/form/src/form-config-item.js +185 -0
  12. package/lib/form/src/form-config-item.min.js +1 -0
  13. package/lib/form/src/form-gather.js +5 -1
  14. package/lib/form/src/form-gather.min.js +1 -1
  15. package/lib/form/src/form-item.js +17 -1
  16. package/lib/form/src/form-item.min.js +1 -1
  17. package/lib/form/src/form.js +35 -149
  18. package/lib/form/src/form.min.js +1 -1
  19. package/lib/form/src/util.js +3 -3
  20. package/lib/form/src/util.min.js +1 -1
  21. package/lib/form/style/style.css +6 -6
  22. package/lib/form/style/style.min.css +1 -1
  23. package/lib/icon/style/style.css +11 -9
  24. package/lib/icon/style/style.min.css +1 -1
  25. package/lib/index.css +1 -1
  26. package/lib/index.umd.js +1555 -1286
  27. package/lib/index.umd.min.js +1 -1
  28. package/lib/input/src/input.js +60 -7
  29. package/lib/input/src/input.min.js +1 -1
  30. package/lib/input/style/style.css +5 -0
  31. package/lib/input/style/style.min.css +1 -1
  32. package/lib/radio/src/button.js +12 -2
  33. package/lib/radio/src/button.min.js +1 -1
  34. package/lib/radio/src/group.js +14 -2
  35. package/lib/radio/src/group.min.js +1 -1
  36. package/lib/radio/src/radio.js +12 -2
  37. package/lib/radio/src/radio.min.js +1 -1
  38. package/lib/select/src/select.js +13 -1
  39. package/lib/select/src/select.min.js +1 -1
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/switch/src/switch.js +14 -1
  43. package/lib/switch/src/switch.min.js +1 -1
  44. package/lib/table/src/body.js +18 -9
  45. package/lib/table/src/body.min.js +1 -1
  46. package/lib/table/src/methods.js +1 -1
  47. package/lib/table/src/methods.min.js +1 -1
  48. package/lib/table/src/table.js +4 -2
  49. package/lib/table/src/table.min.js +1 -1
  50. package/lib/textarea/src/textarea.js +13 -1
  51. package/lib/textarea/src/textarea.min.js +1 -1
  52. package/lib/tools/log.js +1 -1
  53. package/lib/tools/log.min.js +1 -1
  54. package/lib/v-x-e-table/index.js +1 -1
  55. package/lib/v-x-e-table/index.min.js +1 -1
  56. package/lib/validator/src/mixin.js +1 -1
  57. package/lib/validator/src/mixin.min.js +1 -1
  58. package/package.json +2 -2
  59. package/packages/all.js +0 -2
  60. package/packages/checkbox/src/checkbox.js +11 -1
  61. package/packages/checkbox/src/group.js +13 -1
  62. package/packages/edit/src/mixin.js +39 -4
  63. package/packages/form/src/form-config-item.js +150 -0
  64. package/packages/form/src/form-gather.js +5 -1
  65. package/packages/form/src/form-item.js +17 -1
  66. package/packages/form/src/form.js +31 -126
  67. package/packages/form/src/util.js +3 -3
  68. package/packages/input/src/input.js +45 -6
  69. package/packages/radio/src/button.js +11 -1
  70. package/packages/radio/src/group.js +13 -1
  71. package/packages/radio/src/radio.js +11 -1
  72. package/packages/select/src/select.js +12 -0
  73. package/packages/switch/src/switch.js +12 -0
  74. package/packages/table/src/body.js +16 -7
  75. package/packages/table/src/methods.js +1 -1
  76. package/packages/table/src/table.js +3 -2
  77. package/packages/textarea/src/textarea.js +12 -0
  78. package/packages/validator/src/mixin.js +1 -1
  79. package/styles/button.scss +0 -5
  80. package/styles/form.scss +17 -19
  81. package/styles/icon.scss +10 -9
  82. package/styles/input.scss +4 -0
  83. package/styles/variable.scss +1 -0
  84. package/types/all.d.ts +0 -1
  85. package/types/optgroup.d.ts +1 -1
  86. package/types/option.d.ts +1 -1
  87. package/types/pulldown.d.ts +1 -1
  88. package/types/radio-button.d.ts +1 -1
  89. package/types/radio-group.d.ts +1 -1
package/lib/index.umd.js CHANGED
@@ -8804,7 +8804,7 @@ var es_array_concat = __webpack_require__("99af");
8804
8804
 
8805
8805
 
8806
8806
  function getLog(message, params) {
8807
- return "[vxe-table v".concat("3.5.6", "] ").concat(conf.i18n(message, params));
8807
+ return "[vxe-table v".concat("3.5.7-beta.2", "] ").concat(conf.i18n(message, params));
8808
8808
  }
8809
8809
 
8810
8810
  function outLog(type) {
@@ -10073,7 +10073,7 @@ function _t(key, args) {
10073
10073
  var v = 'v3';
10074
10074
  var VXETable = {
10075
10075
  v: v,
10076
- version: "3.5.6",
10076
+ version: "3.5.7-beta.2",
10077
10077
  reg: reg,
10078
10078
  use: use,
10079
10079
  setup: setup,
@@ -11270,17 +11270,30 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
11270
11270
  row: row,
11271
11271
  rowIndex: rowIndex,
11272
11272
  $rowIndex: $rowIndex
11273
- };
11273
+ }; // 行是否被展开
11274
+
11275
+ var isExpandRow = expandColumn && rowExpandeds.length && rowExpandeds.indexOf(row) > -1; // 树节点是否被展开
11276
+
11277
+ var isExpandTree = false;
11278
+ var rowChildren = []; // 是否新增行
11279
+
11274
11280
  var isNewRow = false;
11275
11281
 
11276
11282
  if (editConfig) {
11277
11283
  isNewRow = editStore.insertList.indexOf(row) > -1;
11278
11284
  }
11279
11285
 
11286
+ if (treeConfig && !scrollYLoad && !treeOpts.transform && treeExpandeds.length) {
11287
+ rowChildren = row[treeOpts.children];
11288
+ isExpandTree = rowChildren && rowChildren.length && treeExpandeds.indexOf(row) > -1;
11289
+ }
11290
+
11280
11291
  rows.push(h('tr', {
11281
- class: ['vxe-body--row', {
11292
+ class: ['vxe-body--row', treeConfig ? "row--level-".concat(rowLevel) : '', {
11282
11293
  'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
11283
11294
  'is--new': isNewRow,
11295
+ 'is--expand-row': isExpandRow,
11296
+ 'is--expand-tree': isExpandTree,
11284
11297
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
11285
11298
  'row--radio': radioOpts.highlight && $xetable.selectRow === row,
11286
11299
  'row--checked': checkboxOpts.highlight && $xetable.isCheckedByCheckboxRow(row)
@@ -11295,7 +11308,7 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
11295
11308
  return renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
11296
11309
  }))); // 如果行被展开了
11297
11310
 
11298
- if (expandColumn && rowExpandeds.length && rowExpandeds.indexOf(row) > -1) {
11311
+ if (isExpandRow) {
11299
11312
  var cellStyle;
11300
11313
 
11301
11314
  if (treeConfig) {
@@ -11337,12 +11350,8 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
11337
11350
  } // 如果是树形表格
11338
11351
 
11339
11352
 
11340
- if (treeConfig && !scrollYLoad && !treeOpts.transform && treeExpandeds.length) {
11341
- var rowChildren = row[treeOpts.children];
11342
-
11343
- if (rowChildren && rowChildren.length && treeExpandeds.indexOf(row) > -1) {
11344
- rows.push.apply(rows, _toConsumableArray(renderRows(h, _vm, $xetable, fixedType, rowChildren, tableColumn)));
11345
- }
11353
+ if (isExpandTree) {
11354
+ rows.push.apply(rows, _toConsumableArray(renderRows(h, _vm, $xetable, fixedType, rowChildren, tableColumn)));
11346
11355
  }
11347
11356
  });
11348
11357
  return rows;
@@ -11799,201 +11808,647 @@ function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
11799
11808
  }
11800
11809
  }
11801
11810
  });
11802
- // CONCATENATED MODULE: ./packages/mixins/size.js
11803
- /* harmony default export */ var size = ({
11804
- computed: {
11805
- vSize: function vSize() {
11806
- var $parent = this.$parent,
11807
- size = this.size;
11808
- return size || $parent && ($parent.size || $parent.vSize);
11809
- }
11810
- }
11811
- });
11812
- // CONCATENATED MODULE: ./packages/tools/resize.js
11811
+ // CONCATENATED MODULE: ./packages/header/src/util.js
11813
11812
 
11814
11813
 
11815
11814
 
11815
+ var util_getAllColumns = function getAllColumns(columns, parentColumn) {
11816
+ var result = [];
11817
+ columns.forEach(function (column) {
11818
+ column.parentId = parentColumn ? parentColumn.id : null;
11816
11819
 
11820
+ if (column.visible) {
11821
+ if (column.children && column.children.length && column.children.some(function (column) {
11822
+ return column.visible;
11823
+ })) {
11824
+ result.push(column);
11825
+ result.push.apply(result, _toConsumableArray(getAllColumns(column.children, column)));
11826
+ } else {
11827
+ result.push(column);
11828
+ }
11829
+ }
11830
+ });
11831
+ return result;
11832
+ };
11817
11833
 
11818
- /**
11819
- * 监听 resize 事件
11820
- * 如果项目中已使用了 resize-observer-polyfill,那么只需要将方法定义全局,该组件就会自动使用
11821
- */
11834
+ var convertToRows = function convertToRows(originColumns) {
11835
+ var maxLevel = 1;
11822
11836
 
11823
- var resizeTimeout;
11824
- var eventStore = [];
11825
- var defaultInterval = 500;
11837
+ var traverse = function traverse(column, parent) {
11838
+ if (parent) {
11839
+ column.level = parent.level + 1;
11826
11840
 
11827
- function eventHandle() {
11828
- if (eventStore.length) {
11829
- eventStore.forEach(function (item) {
11830
- item.tarList.forEach(function (observer) {
11831
- var target = observer.target,
11832
- width = observer.width,
11833
- heighe = observer.heighe;
11834
- var clientWidth = target.clientWidth;
11835
- var clientHeight = target.clientHeight;
11836
- var rWidth = clientWidth && width !== clientWidth;
11837
- var rHeight = clientHeight && heighe !== clientHeight;
11841
+ if (maxLevel < column.level) {
11842
+ maxLevel = column.level;
11843
+ }
11844
+ }
11838
11845
 
11839
- if (rWidth || rHeight) {
11840
- observer.width = clientWidth;
11841
- observer.heighe = clientHeight;
11842
- setTimeout(item.callback);
11846
+ if (column.children && column.children.length && column.children.some(function (column) {
11847
+ return column.visible;
11848
+ })) {
11849
+ var colSpan = 0;
11850
+ column.children.forEach(function (subColumn) {
11851
+ if (subColumn.visible) {
11852
+ traverse(subColumn, column);
11853
+ colSpan += subColumn.colSpan;
11843
11854
  }
11844
11855
  });
11845
- });
11846
- /* eslint-disable @typescript-eslint/no-use-before-define */
11847
-
11848
- eventListener();
11849
- }
11850
- }
11851
-
11852
- function eventListener() {
11853
- clearTimeout(resizeTimeout);
11854
- resizeTimeout = setTimeout(eventHandle, conf.resizeInterval || defaultInterval);
11855
- }
11856
+ column.colSpan = colSpan;
11857
+ } else {
11858
+ column.colSpan = 1;
11859
+ }
11860
+ };
11856
11861
 
11857
- var resize_ResizeObserverPolyfill = /*#__PURE__*/function () {
11858
- function ResizeObserverPolyfill(callback) {
11859
- _classCallCheck(this, ResizeObserverPolyfill);
11862
+ originColumns.forEach(function (column) {
11863
+ column.level = 1;
11864
+ traverse(column);
11865
+ });
11866
+ var rows = [];
11860
11867
 
11861
- this.tarList = [];
11862
- this.callback = callback;
11868
+ for (var i = 0; i < maxLevel; i++) {
11869
+ rows.push([]);
11863
11870
  }
11864
11871
 
11865
- _createClass(ResizeObserverPolyfill, [{
11866
- key: "observe",
11867
- value: function observe(target) {
11868
- var _this = this;
11872
+ var allColumns = util_getAllColumns(originColumns);
11873
+ allColumns.forEach(function (column) {
11874
+ if (column.children && column.children.length && column.children.some(function (column) {
11875
+ return column.visible;
11876
+ })) {
11877
+ column.rowSpan = 1;
11878
+ } else {
11879
+ column.rowSpan = maxLevel - column.level + 1;
11880
+ }
11869
11881
 
11870
- if (target) {
11871
- if (!this.tarList.some(function (observer) {
11872
- return observer.target === target;
11873
- })) {
11874
- this.tarList.push({
11875
- target: target,
11876
- width: target.clientWidth,
11877
- heighe: target.clientHeight
11878
- });
11879
- }
11882
+ rows[column.level - 1].push(column);
11883
+ });
11884
+ return rows;
11885
+ };
11886
+ // CONCATENATED MODULE: ./packages/header/src/header.js
11880
11887
 
11881
- if (!eventStore.length) {
11882
- eventListener();
11883
- }
11884
11888
 
11885
- if (!eventStore.some(function (item) {
11886
- return item === _this;
11887
- })) {
11888
- eventStore.push(this);
11889
- }
11890
- }
11891
- }
11892
- }, {
11893
- key: "unobserve",
11894
- value: function unobserve(target) {
11895
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.remove(eventStore, function (item) {
11896
- return item.tarList.some(function (observer) {
11897
- return observer.target === target;
11898
- });
11899
- });
11900
- }
11901
- }, {
11902
- key: "disconnect",
11903
- value: function disconnect() {
11904
- var _this2 = this;
11905
11889
 
11906
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.remove(eventStore, function (item) {
11907
- return item === _this2;
11908
- });
11909
- }
11910
- }]);
11911
11890
 
11912
- return ResizeObserverPolyfill;
11913
- }();
11914
11891
 
11915
- function createResizeEvent(callback) {
11916
- if (window.ResizeObserver) {
11917
- return new window.ResizeObserver(callback);
11918
- }
11919
11892
 
11920
- return new resize_ResizeObserverPolyfill(callback);
11921
- }
11922
- // CONCATENATED MODULE: ./packages/tools/event.js
11923
11893
 
11924
11894
 
11925
- var EVENT_KEYS = {
11926
- F2: 'F2',
11927
- ESCAPE: 'Escape',
11928
- ENTER: 'Enter',
11929
- TAB: 'Tab',
11930
- DELETE: 'Delete',
11931
- BACKSPACE: 'Backspace',
11932
- SPACEBAR: ' ',
11933
- CONTEXT_MENU: 'ContextMenu',
11934
- ARROW_UP: 'ArrowUp',
11935
- ARROW_DOWN: 'ArrowDown',
11936
- ARROW_LEFT: 'ArrowLeft',
11937
- ARROW_RIGHT: 'ArrowRight',
11938
- PAGE_UP: 'PageUp',
11939
- PAGE_DOWN: 'PageDown'
11940
- };
11941
- var convertEventKeys = {
11942
- ' ': 'Spacebar',
11943
- Apps: EVENT_KEYS.CONTEXT_MENU,
11944
- Del: EVENT_KEYS.DELETE,
11945
- Up: EVENT_KEYS.ARROW_UP,
11946
- Down: EVENT_KEYS.ARROW_DOWN,
11947
- Left: EVENT_KEYS.ARROW_LEFT,
11948
- Right: EVENT_KEYS.ARROW_RIGHT
11949
- }; // 监听全局事件
11950
11895
 
11951
- var wheelName = browse.firefox ? 'DOMMouseScroll' : 'mousewheel';
11952
- var event_eventStore = [];
11953
- var hasEventKey = function hasEventKey(evnt, targetKey) {
11954
- var key = evnt.key;
11955
- targetKey = targetKey.toLowerCase();
11956
- return key ? targetKey === key.toLowerCase() || !!(convertEventKeys[key] && convertEventKeys[key].toLowerCase() === targetKey) : false;
11957
- };
11958
- var GlobalEvent = {
11959
- on: function on(comp, type, cb) {
11960
- if (cb) {
11961
- event_eventStore.push({
11962
- comp: comp,
11963
- type: type,
11964
- cb: cb
11965
- });
11966
- }
11967
- },
11968
- off: function off(comp, type) {
11969
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.remove(event_eventStore, function (item) {
11970
- return item.comp === comp && item.type === type;
11971
- });
11896
+ var cellType = 'header';
11897
+ /* harmony default export */ var header = ({
11898
+ name: 'VxeTableHeader',
11899
+ props: {
11900
+ tableData: Array,
11901
+ tableColumn: Array,
11902
+ tableGroupColumn: Array,
11903
+ fixedColumn: Array,
11904
+ size: String,
11905
+ fixedType: String
11972
11906
  },
11973
- trigger: function trigger(evnt) {
11974
- var isWheel = evnt.type === wheelName;
11975
- event_eventStore.forEach(function (_ref) {
11976
- var comp = _ref.comp,
11977
- type = _ref.type,
11978
- cb = _ref.cb;
11979
-
11980
- // 如果被取消冒泡,不再执行
11981
- if (!evnt.cancelBubble) {
11982
- if (type === evnt.type || isWheel && type === 'mousewheel') {
11983
- cb.call(comp, evnt);
11984
- }
11985
- }
11986
- });
11907
+ data: function data() {
11908
+ return {
11909
+ headerColumn: []
11910
+ };
11987
11911
  },
11988
- eqKeypad: function eqKeypad(evnt, keyVal) {
11989
- var key = evnt.key;
11990
-
11991
- if (keyVal.toLowerCase() === key.toLowerCase()) {
11992
- return true;
11912
+ watch: {
11913
+ tableColumn: function tableColumn() {
11914
+ this.uploadColumn();
11993
11915
  }
11994
-
11995
- return false;
11996
- }
11916
+ },
11917
+ created: function created() {
11918
+ this.uploadColumn();
11919
+ },
11920
+ mounted: function mounted() {
11921
+ var $xetable = this.$parent,
11922
+ $el = this.$el,
11923
+ $refs = this.$refs,
11924
+ fixedType = this.fixedType;
11925
+ var elemStore = $xetable.elemStore;
11926
+ var prefix = "".concat(fixedType || 'main', "-header-");
11927
+ elemStore["".concat(prefix, "wrapper")] = $el;
11928
+ elemStore["".concat(prefix, "table")] = $refs.table;
11929
+ elemStore["".concat(prefix, "colgroup")] = $refs.colgroup;
11930
+ elemStore["".concat(prefix, "list")] = $refs.thead;
11931
+ elemStore["".concat(prefix, "xSpace")] = $refs.xSpace;
11932
+ elemStore["".concat(prefix, "repair")] = $refs.repair;
11933
+ },
11934
+ destroyed: function destroyed() {
11935
+ var $xetable = this.$parent,
11936
+ fixedType = this.fixedType;
11937
+ var elemStore = $xetable.elemStore;
11938
+ var prefix = "".concat(fixedType || 'main', "-header-");
11939
+ elemStore["".concat(prefix, "wrapper")] = null;
11940
+ elemStore["".concat(prefix, "table")] = null;
11941
+ elemStore["".concat(prefix, "colgroup")] = null;
11942
+ elemStore["".concat(prefix, "list")] = null;
11943
+ elemStore["".concat(prefix, "xSpace")] = null;
11944
+ elemStore["".concat(prefix, "repair")] = null;
11945
+ },
11946
+ render: function render(h) {
11947
+ var _this = this;
11948
+
11949
+ var _e = this._e,
11950
+ $xetable = this.$parent,
11951
+ fixedType = this.fixedType,
11952
+ headerColumn = this.headerColumn,
11953
+ fixedColumn = this.fixedColumn;
11954
+ var tableListeners = $xetable.$listeners,
11955
+ tId = $xetable.tId,
11956
+ isGroup = $xetable.isGroup,
11957
+ resizable = $xetable.resizable,
11958
+ border = $xetable.border,
11959
+ columnKey = $xetable.columnKey,
11960
+ headerRowClassName = $xetable.headerRowClassName,
11961
+ headerCellClassName = $xetable.headerCellClassName,
11962
+ headerRowStyle = $xetable.headerRowStyle,
11963
+ headerCellStyle = $xetable.headerCellStyle,
11964
+ allColumnHeaderOverflow = $xetable.showHeaderOverflow,
11965
+ allHeaderAlign = $xetable.headerAlign,
11966
+ allAlign = $xetable.align,
11967
+ highlightCurrentColumn = $xetable.highlightCurrentColumn,
11968
+ currentColumn = $xetable.currentColumn,
11969
+ scrollXLoad = $xetable.scrollXLoad,
11970
+ overflowX = $xetable.overflowX,
11971
+ scrollbarWidth = $xetable.scrollbarWidth,
11972
+ sortOpts = $xetable.sortOpts,
11973
+ mouseConfig = $xetable.mouseConfig,
11974
+ columnOpts = $xetable.columnOpts;
11975
+ var tableColumn = this.tableColumn;
11976
+ var headerGroups = headerColumn; // 如果是使用优化模式
11977
+
11978
+ if (!isGroup) {
11979
+ if (fixedType) {
11980
+ if (scrollXLoad || allColumnHeaderOverflow) {
11981
+ tableColumn = fixedColumn;
11982
+ }
11983
+ }
11984
+
11985
+ headerGroups = [tableColumn];
11986
+ }
11987
+
11988
+ return h('div', {
11989
+ class: ['vxe-table--header-wrapper', fixedType ? "fixed-".concat(fixedType, "--wrapper") : 'body--wrapper'],
11990
+ attrs: {
11991
+ xid: tId
11992
+ }
11993
+ }, [fixedType ? _e() : h('div', {
11994
+ class: 'vxe-body--x-space',
11995
+ ref: 'xSpace'
11996
+ }), h('table', {
11997
+ class: 'vxe-table--header',
11998
+ attrs: {
11999
+ xid: tId,
12000
+ cellspacing: 0,
12001
+ cellpadding: 0,
12002
+ border: 0
12003
+ },
12004
+ ref: 'table'
12005
+ }, [
12006
+ /**
12007
+ * 列宽
12008
+ */
12009
+ h('colgroup', {
12010
+ ref: 'colgroup'
12011
+ }, tableColumn.map(function (column, $columnIndex) {
12012
+ return h('col', {
12013
+ attrs: {
12014
+ name: column.id
12015
+ },
12016
+ key: $columnIndex
12017
+ });
12018
+ }).concat(scrollbarWidth ? [h('col', {
12019
+ attrs: {
12020
+ name: 'col_gutter'
12021
+ }
12022
+ })] : [])),
12023
+ /**
12024
+ * 头部
12025
+ */
12026
+ h('thead', {
12027
+ ref: 'thead'
12028
+ }, headerGroups.map(function (cols, $rowIndex) {
12029
+ return h('tr', {
12030
+ class: ['vxe-header--row', headerRowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(headerRowClassName) ? headerRowClassName({
12031
+ $table: $xetable,
12032
+ $rowIndex: $rowIndex,
12033
+ fixed: fixedType,
12034
+ type: cellType
12035
+ }) : headerRowClassName : ''],
12036
+ style: headerRowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(headerRowStyle) ? headerRowStyle({
12037
+ $table: $xetable,
12038
+ $rowIndex: $rowIndex,
12039
+ fixed: fixedType,
12040
+ type: cellType
12041
+ }) : headerRowStyle : null
12042
+ }, cols.map(function (column, $columnIndex) {
12043
+ var _ref;
12044
+
12045
+ var type = column.type,
12046
+ showHeaderOverflow = column.showHeaderOverflow,
12047
+ headerAlign = column.headerAlign,
12048
+ align = column.align,
12049
+ headerClassName = column.headerClassName; // const { enabled } = tooltipOpts
12050
+
12051
+ var isColGroup = column.children && column.children.length;
12052
+ var fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
12053
+ var headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isUndefined(showHeaderOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
12054
+ var headAlign = headerAlign || align || allHeaderAlign || allAlign;
12055
+ var showEllipsis = headOverflow === 'ellipsis';
12056
+ var showTitle = headOverflow === 'title';
12057
+ var showTooltip = headOverflow === true || headOverflow === 'tooltip';
12058
+ var hasEllipsis = showTitle || showTooltip || showEllipsis;
12059
+ var thOns = {};
12060
+ var hasFilter = column.filters && column.filters.some(function (item) {
12061
+ return item.checked;
12062
+ });
12063
+ var columnIndex = $xetable.getColumnIndex(column);
12064
+
12065
+ var _columnIndex = $xetable.getVTColumnIndex(column);
12066
+
12067
+ var params = {
12068
+ $table: $xetable,
12069
+ $rowIndex: $rowIndex,
12070
+ column: column,
12071
+ columnIndex: columnIndex,
12072
+ $columnIndex: $columnIndex,
12073
+ _columnIndex: _columnIndex,
12074
+ fixed: fixedType,
12075
+ type: cellType,
12076
+ isHidden: fixedHiddenColumn,
12077
+ hasFilter: hasFilter
12078
+ }; // 虚拟滚动不支持动态高度
12079
+
12080
+ if (scrollXLoad && !hasEllipsis) {
12081
+ showEllipsis = hasEllipsis = true;
12082
+ }
12083
+
12084
+ if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
12085
+ thOns.click = function (evnt) {
12086
+ return $xetable.triggerHeaderCellClickEvent(evnt, params);
12087
+ };
12088
+ }
12089
+
12090
+ if (tableListeners['header-cell-dblclick']) {
12091
+ thOns.dblclick = function (evnt) {
12092
+ return $xetable.triggerHeaderCellDblclickEvent(evnt, params);
12093
+ };
12094
+ } // 按下事件处理
12095
+
12096
+
12097
+ if (mouseConfig) {
12098
+ thOns.mousedown = function (evnt) {
12099
+ return $xetable.triggerHeaderCellMousedownEvent(evnt, params);
12100
+ };
12101
+ }
12102
+
12103
+ return h('th', {
12104
+ class: ['vxe-header--column', column.id, (_ref = {}, _defineProperty(_ref, "col--".concat(headAlign), headAlign), _defineProperty(_ref, "col--".concat(type), type), _defineProperty(_ref, 'col--last', $columnIndex === cols.length - 1), _defineProperty(_ref, 'col--fixed', column.fixed), _defineProperty(_ref, 'col--group', isColGroup), _defineProperty(_ref, 'col--ellipsis', hasEllipsis), _defineProperty(_ref, 'fixed--hidden', fixedHiddenColumn), _defineProperty(_ref, 'is--sortable', column.sortable), _defineProperty(_ref, 'col--filter', !!column.filters), _defineProperty(_ref, 'is--filter-active', hasFilter), _defineProperty(_ref, 'col--current', currentColumn === column), _ref), utils.getClass(headerClassName, params), utils.getClass(headerCellClassName, params)],
12105
+ attrs: {
12106
+ colid: column.id,
12107
+ colspan: column.colSpan > 1 ? column.colSpan : null,
12108
+ rowspan: column.rowSpan > 1 ? column.rowSpan : null
12109
+ },
12110
+ style: headerCellStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle : null,
12111
+ on: thOns,
12112
+ key: columnKey || columnOpts.useKey || isColGroup ? column.id : $columnIndex
12113
+ }, [h('div', {
12114
+ class: ['vxe-cell', {
12115
+ 'c--title': showTitle,
12116
+ 'c--tooltip': showTooltip,
12117
+ 'c--ellipsis': showEllipsis
12118
+ }]
12119
+ }, column.renderHeader(h, params)),
12120
+ /**
12121
+ * 列宽拖动
12122
+ */
12123
+ !fixedHiddenColumn && !isColGroup && (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || resizable) ? h('div', {
12124
+ class: ['vxe-resizable', {
12125
+ 'is--line': !border || border === 'none'
12126
+ }],
12127
+ on: {
12128
+ mousedown: function mousedown(evnt) {
12129
+ return _this.resizeMousedown(evnt, params);
12130
+ }
12131
+ }
12132
+ }) : null]);
12133
+ }).concat(scrollbarWidth ? [h('th', {
12134
+ class: 'vxe-header--gutter col--gutter'
12135
+ })] : []));
12136
+ }))]),
12137
+ /**
12138
+ * 其他
12139
+ */
12140
+ h('div', {
12141
+ class: 'vxe-table--header-border-line',
12142
+ ref: 'repair'
12143
+ })]);
12144
+ },
12145
+ methods: {
12146
+ uploadColumn: function uploadColumn() {
12147
+ var $xetable = this.$parent;
12148
+ this.headerColumn = $xetable.isGroup ? convertToRows(this.tableGroupColumn) : [];
12149
+ },
12150
+ resizeMousedown: function resizeMousedown(evnt, params) {
12151
+ var column = params.column;
12152
+ var $xetable = this.$parent,
12153
+ $el = this.$el,
12154
+ fixedType = this.fixedType;
12155
+ var _$xetable$$refs = $xetable.$refs,
12156
+ tableBody = _$xetable$$refs.tableBody,
12157
+ leftContainer = _$xetable$$refs.leftContainer,
12158
+ rightContainer = _$xetable$$refs.rightContainer,
12159
+ resizeBarElem = _$xetable$$refs.resizeBar;
12160
+ var dragBtnElem = evnt.target,
12161
+ dragClientX = evnt.clientX;
12162
+ var cell = params.cell = dragBtnElem.parentNode;
12163
+ var dragLeft = 0;
12164
+ var tableBodyElem = tableBody.$el;
12165
+ var pos = dom.getOffsetPos(dragBtnElem, $el);
12166
+ var dragBtnWidth = dragBtnElem.clientWidth;
12167
+ var dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
12168
+ var minInterval = getColMinWidth(params) - dragBtnOffsetWidth; // 列之间的最小间距
12169
+
12170
+ var dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
12171
+ var dragPosLeft = pos.left + dragBtnOffsetWidth;
12172
+ var domMousemove = document.onmousemove;
12173
+ var domMouseup = document.onmouseup;
12174
+ var isLeftFixed = fixedType === 'left';
12175
+ var isRightFixed = fixedType === 'right'; // 计算左右侧固定列偏移量
12176
+
12177
+ var fixedOffsetWidth = 0;
12178
+
12179
+ if (isLeftFixed || isRightFixed) {
12180
+ var siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
12181
+ var tempCellElem = cell[siblingProp];
12182
+
12183
+ while (tempCellElem) {
12184
+ if (dom.hasClass(tempCellElem, 'fixed--hidden')) {
12185
+ break;
12186
+ } else if (!dom.hasClass(tempCellElem, 'col--group')) {
12187
+ fixedOffsetWidth += tempCellElem.offsetWidth;
12188
+ }
12189
+
12190
+ tempCellElem = tempCellElem[siblingProp];
12191
+ }
12192
+
12193
+ if (isRightFixed && rightContainer) {
12194
+ dragPosLeft = rightContainer.offsetLeft + fixedOffsetWidth;
12195
+ }
12196
+ } // 处理拖动事件
12197
+
12198
+
12199
+ var updateEvent = function updateEvent(evnt) {
12200
+ evnt.stopPropagation();
12201
+ evnt.preventDefault();
12202
+ var offsetX = evnt.clientX - dragClientX;
12203
+ var left = dragPosLeft + offsetX;
12204
+ var scrollLeft = fixedType ? 0 : tableBodyElem.scrollLeft;
12205
+
12206
+ if (isLeftFixed) {
12207
+ // 左固定列(不允许超过右侧固定列、不允许超过右边距)
12208
+ left = Math.min(left, (rightContainer ? rightContainer.offsetLeft : tableBodyElem.clientWidth) - fixedOffsetWidth - minInterval);
12209
+ } else if (isRightFixed) {
12210
+ // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
12211
+ dragMinLeft = (leftContainer ? leftContainer.clientWidth : 0) + fixedOffsetWidth + minInterval;
12212
+ left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
12213
+ } else {
12214
+ dragMinLeft = Math.max(tableBodyElem.scrollLeft, dragMinLeft); // left = Math.min(left, tableBodyElem.clientWidth + tableBodyElem.scrollLeft - 40)
12215
+ }
12216
+
12217
+ dragLeft = Math.max(left, dragMinLeft);
12218
+ resizeBarElem.style.left = "".concat(dragLeft - scrollLeft, "px");
12219
+ };
12220
+
12221
+ $xetable._isResize = true;
12222
+ dom.addClass($xetable.$el, 'drag--resize');
12223
+ resizeBarElem.style.display = 'block';
12224
+ document.onmousemove = updateEvent;
12225
+
12226
+ document.onmouseup = function (evnt) {
12227
+ document.onmousemove = domMousemove;
12228
+ document.onmouseup = domMouseup;
12229
+ column.resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
12230
+ resizeBarElem.style.display = 'none';
12231
+ $xetable._isResize = false;
12232
+ $xetable._lastResizeTime = Date.now();
12233
+ $xetable.analyColumnWidth();
12234
+ $xetable.recalculate(true).then(function () {
12235
+ $xetable.saveCustomResizable();
12236
+ $xetable.updateCellAreas();
12237
+ $xetable.emitEvent('resizable-change', params, evnt);
12238
+ });
12239
+ dom.removeClass($xetable.$el, 'drag--resize');
12240
+ };
12241
+
12242
+ updateEvent(evnt);
12243
+ $xetable.closeMenu();
12244
+ }
12245
+ }
12246
+ });
12247
+ // CONCATENATED MODULE: ./packages/header/index.js
12248
+
12249
+
12250
+
12251
+ var Header = Object.assign(header, {
12252
+ install: function install(Vue) {
12253
+ Vue.component(header.name, header);
12254
+ }
12255
+ });
12256
+ /* harmony default export */ var packages_header = (Header);
12257
+ // CONCATENATED MODULE: ./packages/mixins/size.js
12258
+ /* harmony default export */ var size = ({
12259
+ computed: {
12260
+ vSize: function vSize() {
12261
+ var $parent = this.$parent,
12262
+ size = this.size;
12263
+ return size || $parent && ($parent.size || $parent.vSize);
12264
+ }
12265
+ }
12266
+ });
12267
+ // CONCATENATED MODULE: ./packages/tools/resize.js
12268
+
12269
+
12270
+
12271
+
12272
+
12273
+ /**
12274
+ * 监听 resize 事件
12275
+ * 如果项目中已使用了 resize-observer-polyfill,那么只需要将方法定义全局,该组件就会自动使用
12276
+ */
12277
+
12278
+ var resizeTimeout;
12279
+ var eventStore = [];
12280
+ var defaultInterval = 500;
12281
+
12282
+ function eventHandle() {
12283
+ if (eventStore.length) {
12284
+ eventStore.forEach(function (item) {
12285
+ item.tarList.forEach(function (observer) {
12286
+ var target = observer.target,
12287
+ width = observer.width,
12288
+ heighe = observer.heighe;
12289
+ var clientWidth = target.clientWidth;
12290
+ var clientHeight = target.clientHeight;
12291
+ var rWidth = clientWidth && width !== clientWidth;
12292
+ var rHeight = clientHeight && heighe !== clientHeight;
12293
+
12294
+ if (rWidth || rHeight) {
12295
+ observer.width = clientWidth;
12296
+ observer.heighe = clientHeight;
12297
+ setTimeout(item.callback);
12298
+ }
12299
+ });
12300
+ });
12301
+ /* eslint-disable @typescript-eslint/no-use-before-define */
12302
+
12303
+ eventListener();
12304
+ }
12305
+ }
12306
+
12307
+ function eventListener() {
12308
+ clearTimeout(resizeTimeout);
12309
+ resizeTimeout = setTimeout(eventHandle, conf.resizeInterval || defaultInterval);
12310
+ }
12311
+
12312
+ var resize_ResizeObserverPolyfill = /*#__PURE__*/function () {
12313
+ function ResizeObserverPolyfill(callback) {
12314
+ _classCallCheck(this, ResizeObserverPolyfill);
12315
+
12316
+ this.tarList = [];
12317
+ this.callback = callback;
12318
+ }
12319
+
12320
+ _createClass(ResizeObserverPolyfill, [{
12321
+ key: "observe",
12322
+ value: function observe(target) {
12323
+ var _this = this;
12324
+
12325
+ if (target) {
12326
+ if (!this.tarList.some(function (observer) {
12327
+ return observer.target === target;
12328
+ })) {
12329
+ this.tarList.push({
12330
+ target: target,
12331
+ width: target.clientWidth,
12332
+ heighe: target.clientHeight
12333
+ });
12334
+ }
12335
+
12336
+ if (!eventStore.length) {
12337
+ eventListener();
12338
+ }
12339
+
12340
+ if (!eventStore.some(function (item) {
12341
+ return item === _this;
12342
+ })) {
12343
+ eventStore.push(this);
12344
+ }
12345
+ }
12346
+ }
12347
+ }, {
12348
+ key: "unobserve",
12349
+ value: function unobserve(target) {
12350
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.remove(eventStore, function (item) {
12351
+ return item.tarList.some(function (observer) {
12352
+ return observer.target === target;
12353
+ });
12354
+ });
12355
+ }
12356
+ }, {
12357
+ key: "disconnect",
12358
+ value: function disconnect() {
12359
+ var _this2 = this;
12360
+
12361
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.remove(eventStore, function (item) {
12362
+ return item === _this2;
12363
+ });
12364
+ }
12365
+ }]);
12366
+
12367
+ return ResizeObserverPolyfill;
12368
+ }();
12369
+
12370
+ function createResizeEvent(callback) {
12371
+ if (window.ResizeObserver) {
12372
+ return new window.ResizeObserver(callback);
12373
+ }
12374
+
12375
+ return new resize_ResizeObserverPolyfill(callback);
12376
+ }
12377
+ // CONCATENATED MODULE: ./packages/tools/event.js
12378
+
12379
+
12380
+ var EVENT_KEYS = {
12381
+ F2: 'F2',
12382
+ ESCAPE: 'Escape',
12383
+ ENTER: 'Enter',
12384
+ TAB: 'Tab',
12385
+ DELETE: 'Delete',
12386
+ BACKSPACE: 'Backspace',
12387
+ SPACEBAR: ' ',
12388
+ CONTEXT_MENU: 'ContextMenu',
12389
+ ARROW_UP: 'ArrowUp',
12390
+ ARROW_DOWN: 'ArrowDown',
12391
+ ARROW_LEFT: 'ArrowLeft',
12392
+ ARROW_RIGHT: 'ArrowRight',
12393
+ PAGE_UP: 'PageUp',
12394
+ PAGE_DOWN: 'PageDown'
12395
+ };
12396
+ var convertEventKeys = {
12397
+ ' ': 'Spacebar',
12398
+ Apps: EVENT_KEYS.CONTEXT_MENU,
12399
+ Del: EVENT_KEYS.DELETE,
12400
+ Up: EVENT_KEYS.ARROW_UP,
12401
+ Down: EVENT_KEYS.ARROW_DOWN,
12402
+ Left: EVENT_KEYS.ARROW_LEFT,
12403
+ Right: EVENT_KEYS.ARROW_RIGHT
12404
+ }; // 监听全局事件
12405
+
12406
+ var wheelName = browse.firefox ? 'DOMMouseScroll' : 'mousewheel';
12407
+ var event_eventStore = [];
12408
+ var hasEventKey = function hasEventKey(evnt, targetKey) {
12409
+ var key = evnt.key;
12410
+ targetKey = targetKey.toLowerCase();
12411
+ return key ? targetKey === key.toLowerCase() || !!(convertEventKeys[key] && convertEventKeys[key].toLowerCase() === targetKey) : false;
12412
+ };
12413
+ var GlobalEvent = {
12414
+ on: function on(comp, type, cb) {
12415
+ if (cb) {
12416
+ event_eventStore.push({
12417
+ comp: comp,
12418
+ type: type,
12419
+ cb: cb
12420
+ });
12421
+ }
12422
+ },
12423
+ off: function off(comp, type) {
12424
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.remove(event_eventStore, function (item) {
12425
+ return item.comp === comp && item.type === type;
12426
+ });
12427
+ },
12428
+ trigger: function trigger(evnt) {
12429
+ var isWheel = evnt.type === wheelName;
12430
+ event_eventStore.forEach(function (_ref) {
12431
+ var comp = _ref.comp,
12432
+ type = _ref.type,
12433
+ cb = _ref.cb;
12434
+
12435
+ // 如果被取消冒泡,不再执行
12436
+ if (!evnt.cancelBubble) {
12437
+ if (type === evnt.type || isWheel && type === 'mousewheel') {
12438
+ cb.call(comp, evnt);
12439
+ }
12440
+ }
12441
+ });
12442
+ },
12443
+ eqKeypad: function eqKeypad(evnt, keyVal) {
12444
+ var key = evnt.key;
12445
+
12446
+ if (keyVal.toLowerCase() === key.toLowerCase()) {
12447
+ return true;
12448
+ }
12449
+
12450
+ return false;
12451
+ }
11997
12452
  };
11998
12453
 
11999
12454
  if (browse.isDoc) {
@@ -19291,7 +19746,7 @@ var Methods = {
19291
19746
  }
19292
19747
  }; // Module methods
19293
19748
 
19294
- var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
19749
+ var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
19295
19750
  funcs.forEach(function (name) {
19296
19751
  Methods[name] = function () {
19297
19752
  if (false) {}
@@ -19323,6 +19778,7 @@ funcs.forEach(function (name) {
19323
19778
 
19324
19779
 
19325
19780
 
19781
+
19326
19782
 
19327
19783
 
19328
19784
  /**
@@ -19348,7 +19804,7 @@ function renderFixed(h, $xetable, fixedType) {
19348
19804
  return h('div', {
19349
19805
  class: "vxe-table--fixed-".concat(fixedType, "-wrapper"),
19350
19806
  ref: "".concat(fixedType, "Container")
19351
- }, [showHeader ? h('vxe-table-header', {
19807
+ }, [showHeader ? h(packages_header, {
19352
19808
  props: {
19353
19809
  fixedType: fixedType,
19354
19810
  tableData: tableData,
@@ -20398,7 +20854,7 @@ function handleUupdateResize(_vm) {
20398
20854
  /**
20399
20855
  * 表头
20400
20856
  */
20401
- showHeader ? h('vxe-table-header', {
20857
+ showHeader ? h(packages_header, {
20402
20858
  ref: 'tableHeader',
20403
20859
  props: {
20404
20860
  tableData: tableData,
@@ -22311,11 +22767,18 @@ function insertTreeRow(_vm, newRecords, isAppend) {
22311
22767
  }
22312
22768
  }
22313
22769
  },
22770
+ _clearActived: function _clearActived(evnt) {
22771
+ // if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
22772
+ // warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit'])
22773
+ // }
22774
+ // 即将废弃
22775
+ return this.clearEdit(evnt);
22776
+ },
22314
22777
 
22315
22778
  /**
22316
22779
  * 清除激活的编辑
22317
22780
  */
22318
- _clearActived: function _clearActived(evnt) {
22781
+ _clearEdit: function _clearEdit(evnt) {
22319
22782
  var editStore = this.editStore;
22320
22783
  var actived = editStore.actived;
22321
22784
  var row = actived.row,
@@ -22341,6 +22804,13 @@ function insertTreeRow(_vm, newRecords, isAppend) {
22341
22804
  return v_x_e_table._valid ? this.clearValidate() : this.$nextTick();
22342
22805
  },
22343
22806
  _getActiveRecord: function _getActiveRecord() {
22807
+ // if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
22808
+ // warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord'])
22809
+ // }
22810
+ // 即将废弃
22811
+ return this.getEditRecord();
22812
+ },
22813
+ _getEditRecord: function _getEditRecord() {
22344
22814
  var $el = this.$el,
22345
22815
  editStore = this.editStore,
22346
22816
  afterFullData = this.afterFullData;
@@ -22354,12 +22824,19 @@ function insertTreeRow(_vm, newRecords, isAppend) {
22354
22824
 
22355
22825
  return null;
22356
22826
  },
22827
+ _isActiveByRow: function _isActiveByRow(row) {
22828
+ // if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
22829
+ // warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
22830
+ // }
22831
+ // 即将废弃
22832
+ return this.isEditByRow(row);
22833
+ },
22357
22834
 
22358
22835
  /**
22359
22836
  * 判断行是否为激活编辑状态
22360
22837
  * @param {Row} row 行对象
22361
22838
  */
22362
- _isActiveByRow: function _isActiveByRow(row) {
22839
+ _isEditByRow: function _isEditByRow(row) {
22363
22840
  return this.editStore.actived.row === row;
22364
22841
  },
22365
22842
 
@@ -22406,20 +22883,34 @@ function insertTreeRow(_vm, newRecords, isAppend) {
22406
22883
  }
22407
22884
  }
22408
22885
  },
22886
+ _setActiveRow: function _setActiveRow(row) {
22887
+ // if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
22888
+ // warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow'])
22889
+ // }
22890
+ // 即将废弃
22891
+ return this.setEditRow(row);
22892
+ },
22409
22893
 
22410
22894
  /**
22411
22895
  * 激活行编辑
22412
22896
  */
22413
- _setActiveRow: function _setActiveRow(row) {
22897
+ _setEditRow: function _setEditRow(row) {
22414
22898
  return this.setActiveCell(row, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.find(this.visibleColumn, function (column) {
22415
22899
  return isEnableConf(column.editRender);
22416
22900
  }));
22417
22901
  },
22902
+ _setActiveCell: function _setActiveCell(row) {
22903
+ // if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
22904
+ // warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell'])
22905
+ // }
22906
+ // 即将废弃
22907
+ return this.setEditCell(row);
22908
+ },
22418
22909
 
22419
22910
  /**
22420
22911
  * 激活单元格编辑
22421
22912
  */
22422
- _setActiveCell: function _setActiveCell(row, fieldOrColumn) {
22913
+ _setEditCell: function _setEditCell(row, fieldOrColumn) {
22423
22914
  var _this9 = this;
22424
22915
 
22425
22916
  var editConfig = this.editConfig;
@@ -24429,7 +24920,9 @@ function renderNumberIcon(h, _vm) {
24429
24920
  return h('span', {
24430
24921
  class: 'vxe-input--number-suffix'
24431
24922
  }, [h('span', {
24432
- class: 'vxe-input--number-prev is--prev',
24923
+ class: ['vxe-input--number-prev is--prev', {
24924
+ 'is--disabled': _vm.isDisabledAddNumber
24925
+ }],
24433
24926
  on: {
24434
24927
  mousedown: _vm.numberMousedownEvent,
24435
24928
  mouseup: _vm.numberStopDown,
@@ -24438,7 +24931,9 @@ function renderNumberIcon(h, _vm) {
24438
24931
  }, [h('i', {
24439
24932
  class: ['vxe-input--number-prev-icon', conf.icon.INPUT_PREV_NUM]
24440
24933
  })]), h('span', {
24441
- class: 'vxe-input--number-next is--next',
24934
+ class: ['vxe-input--number-next is--next', {
24935
+ 'is--disabled': _vm.isDisabledSubtractNumber
24936
+ }],
24442
24937
  on: {
24443
24938
  mousedown: _vm.numberMousedownEvent,
24444
24939
  mouseup: _vm.numberStopDown,
@@ -24704,6 +25199,14 @@ function renderExtraSuffixIcon(h, _vm) {
24704
25199
  }
24705
25200
  }
24706
25201
  },
25202
+ inject: {
25203
+ $xeform: {
25204
+ default: null
25205
+ },
25206
+ $xeformiteminfo: {
25207
+ default: null
25208
+ }
25209
+ },
24707
25210
  data: function data() {
24708
25211
  return {
24709
25212
  panelIndex: 0,
@@ -25152,6 +25655,41 @@ function renderExtraSuffixIcon(h, _vm) {
25152
25655
  editable = this.editable,
25153
25656
  multiple = this.multiple;
25154
25657
  return readonly || multiple || !editable || type === 'week' || type === 'quarter';
25658
+ },
25659
+ numValue: function numValue() {
25660
+ var type = this.type,
25661
+ isNumType = this.isNumType,
25662
+ inputValue = this.inputValue;
25663
+
25664
+ if (isNumType) {
25665
+ return type === 'integer' ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toInteger(handleNumber(inputValue)) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(handleNumber(inputValue));
25666
+ }
25667
+
25668
+ return 0;
25669
+ },
25670
+ isDisabledSubtractNumber: function isDisabledSubtractNumber() {
25671
+ var min = this.min,
25672
+ isNumType = this.isNumType,
25673
+ inputValue = this.inputValue,
25674
+ numValue = this.numValue; // 当有值时再进行判断
25675
+
25676
+ if ((inputValue || inputValue === 0) && isNumType && min !== null) {
25677
+ return numValue <= external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(min);
25678
+ }
25679
+
25680
+ return false;
25681
+ },
25682
+ isDisabledAddNumber: function isDisabledAddNumber() {
25683
+ var max = this.max,
25684
+ isNumType = this.isNumType,
25685
+ inputValue = this.inputValue,
25686
+ numValue = this.numValue; // 当有值时再进行判断
25687
+
25688
+ if ((inputValue || inputValue === 0) && isNumType && max !== null) {
25689
+ return numValue >= external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(max);
25690
+ }
25691
+
25692
+ return false;
25155
25693
  }
25156
25694
  },
25157
25695
  watch: {
@@ -25316,7 +25854,11 @@ function renderExtraSuffixIcon(h, _vm) {
25316
25854
  this.$emit('change', {
25317
25855
  value: value,
25318
25856
  $event: evnt
25319
- });
25857
+ }); // 自动更新校验状态
25858
+
25859
+ if (this.$xeform && this.$xeformiteminfo) {
25860
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value);
25861
+ }
25320
25862
  }
25321
25863
  },
25322
25864
  emitInputEvent: function emitInputEvent(value, evnt) {
@@ -25689,10 +26231,11 @@ function renderExtraSuffixIcon(h, _vm) {
25689
26231
  },
25690
26232
  numberPrevEvent: function numberPrevEvent(evnt) {
25691
26233
  var disabled = this.disabled,
25692
- readonly = this.readonly;
26234
+ readonly = this.readonly,
26235
+ isDisabledAddNumber = this.isDisabledAddNumber;
25693
26236
  clearTimeout(this.downbumTimeout);
25694
26237
 
25695
- if (!disabled && !readonly) {
26238
+ if (!disabled && !readonly && !isDisabledAddNumber) {
25696
26239
  this.numberChange(true, evnt);
25697
26240
  }
25698
26241
 
@@ -25702,10 +26245,11 @@ function renderExtraSuffixIcon(h, _vm) {
25702
26245
  },
25703
26246
  numberNextEvent: function numberNextEvent(evnt) {
25704
26247
  var disabled = this.disabled,
25705
- readonly = this.readonly;
26248
+ readonly = this.readonly,
26249
+ isDisabledSubtractNumber = this.isDisabledSubtractNumber;
25706
26250
  clearTimeout(this.downbumTimeout);
25707
26251
 
25708
- if (!disabled && !readonly) {
26252
+ if (!disabled && !readonly && !isDisabledSubtractNumber) {
25709
26253
  this.numberChange(false, evnt);
25710
26254
  }
25711
26255
 
@@ -26511,6 +27055,12 @@ function renderExtraSuffixIcon(h, _vm) {
26511
27055
  inject: {
26512
27056
  $xecheckboxgroup: {
26513
27057
  default: null
27058
+ },
27059
+ $xeform: {
27060
+ default: null
27061
+ },
27062
+ $xeformiteminfo: {
27063
+ default: null
26514
27064
  }
26515
27065
  },
26516
27066
  computed: {
@@ -26582,10 +27132,14 @@ function renderExtraSuffixIcon(h, _vm) {
26582
27132
  };
26583
27133
 
26584
27134
  if (isGroup) {
26585
- $xecheckboxgroup.handleChecked(params);
27135
+ $xecheckboxgroup.handleChecked(params, evnt);
26586
27136
  } else {
26587
27137
  this.$emit('input', value);
26588
- this.$emit('change', params);
27138
+ this.$emit('change', params); // 自动更新校验状态
27139
+
27140
+ if (this.$xeform && this.$xeformiteminfo) {
27141
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value);
27142
+ }
26589
27143
  }
26590
27144
  }
26591
27145
  }
@@ -26903,6 +27457,14 @@ function select_renderOpts(h, _vm) {
26903
27457
  components: {
26904
27458
  VxeInput: input
26905
27459
  },
27460
+ inject: {
27461
+ $xeform: {
27462
+ default: null
27463
+ },
27464
+ $xeformiteminfo: {
27465
+ default: null
27466
+ }
27467
+ },
26906
27468
  provide: function provide() {
26907
27469
  return {
26908
27470
  $xeselect: this
@@ -27195,7 +27757,11 @@ function select_renderOpts(h, _vm) {
27195
27757
  this.$emit('change', {
27196
27758
  value: selectValue,
27197
27759
  $event: evnt
27198
- });
27760
+ }); // 自动更新校验状态
27761
+
27762
+ if (this.$xeform && this.$xeformiteminfo) {
27763
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, selectValue);
27764
+ }
27199
27765
  }
27200
27766
  },
27201
27767
  mousedownOptionEvent: function mousedownOptionEvent(evnt) {
@@ -28089,6 +28655,12 @@ Object.keys(option_props).forEach(function (name) {
28089
28655
  inject: {
28090
28656
  $xeradiogroup: {
28091
28657
  default: null
28658
+ },
28659
+ $xeform: {
28660
+ default: null
28661
+ },
28662
+ $xeformiteminfo: {
28663
+ default: null
28092
28664
  }
28093
28665
  },
28094
28666
  computed: {
@@ -28151,10 +28723,14 @@ Object.keys(option_props).forEach(function (name) {
28151
28723
  };
28152
28724
 
28153
28725
  if ($xeradiogroup) {
28154
- $xeradiogroup.handleChecked(params);
28726
+ $xeradiogroup.handleChecked(params, evnt);
28155
28727
  } else {
28156
28728
  this.$emit('input', label);
28157
- this.$emit('change', params);
28729
+ this.$emit('change', params); // 自动更新校验状态
28730
+
28731
+ if (this.$xeform && this.$xeformiteminfo) {
28732
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, label);
28733
+ }
28158
28734
  }
28159
28735
  },
28160
28736
  changeEvent: function changeEvent(evnt) {
@@ -29845,7 +30421,7 @@ var mixin_getConvertColumns = function getConvertColumns(columns) {
29845
30421
  return result;
29846
30422
  };
29847
30423
 
29848
- var convertToRows = function convertToRows(originColumns) {
30424
+ var mixin_convertToRows = function convertToRows(originColumns) {
29849
30425
  var maxLevel = 1;
29850
30426
 
29851
30427
  var traverse = function traverse(column, parent) {
@@ -30025,7 +30601,7 @@ var convertToRows = function convertToRows(originColumns) {
30025
30601
  }); // 构建分组层级
30026
30602
 
30027
30603
  opts.columns = cols;
30028
- opts.colgroups = convertToRows(groups);
30604
+ opts.colgroups = mixin_convertToRows(groups);
30029
30605
 
30030
30606
  if (!opts.filename) {
30031
30607
  opts.filename = conf.i18n(opts.original ? 'vxe.table.expOriginFilename' : 'vxe.table.expFilename', [external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toDateString(Date.now(), 'yyyyMMddHHmmss')]);
@@ -30741,985 +31317,539 @@ function getCheckboxRangeRows(_vm, params, targetTrElem, moveRange) {
30741
31317
  isMouseScrollDown = true;
30742
31318
  mouseScrollSpaceSize = clientY - boundingTop - bodyWrapperElem.clientHeight;
30743
31319
 
30744
- if (!mouseScrollTimeout) {
30745
- startMouseScroll(evnt);
30746
- }
30747
- } else if (mouseScrollTimeout) {
30748
- stopMouseScroll();
30749
- }
30750
-
30751
- handleChecked(evnt);
30752
- };
30753
-
30754
- document.onmouseup = function (evnt) {
30755
- stopMouseScroll();
30756
- dom.removeClass($el, 'drag--range');
30757
- checkboxRangeElem.removeAttribute('style');
30758
- document.onmousemove = domMousemove;
30759
- document.onmouseup = domMouseup;
30760
- triggerEvent('end', evnt);
30761
- };
30762
-
30763
- triggerEvent('start', evnt);
30764
- }
30765
- }
30766
- }
30767
- });
30768
- // CONCATENATED MODULE: ./packages/keyboard/index.js
30769
-
30770
-
30771
-
30772
- var Keyboard = {
30773
- install: function install() {
30774
- v_x_e_table.reg('keyboard');
30775
- packages_table.mixins.push(keyboard_src_mixin);
30776
- }
30777
- };
30778
- /* harmony default export */ var packages_keyboard = (Keyboard);
30779
- // CONCATENATED MODULE: ./packages/validator/src/mixin.js
30780
-
30781
-
30782
-
30783
-
30784
-
30785
-
30786
-
30787
-
30788
-
30789
-
30790
-
30791
-
30792
-
30793
-
30794
-
30795
-
30796
-
30797
-
30798
-
30799
- /**
30800
- * 校验规则
30801
- */
30802
-
30803
- var mixin_Rule = /*#__PURE__*/function () {
30804
- function Rule(rule) {
30805
- _classCallCheck(this, Rule);
30806
-
30807
- Object.assign(this, {
30808
- $options: rule,
30809
- required: rule.required,
30810
- min: rule.min,
30811
- max: rule.max,
30812
- type: rule.type,
30813
- pattern: rule.pattern,
30814
- validator: rule.validator,
30815
- trigger: rule.trigger,
30816
- maxWidth: rule.maxWidth
30817
- });
30818
- }
30819
- /**
30820
- * 获取校验不通过的消息
30821
- * 支持国际化翻译
30822
- */
30823
-
30824
-
30825
- _createClass(Rule, [{
30826
- key: "content",
30827
- get: function get() {
30828
- return getFuncText(this.$options.content || this.$options.message);
30829
- }
30830
- }, {
30831
- key: "message",
30832
- get: function get() {
30833
- return this.content;
30834
- }
30835
- }]);
30836
-
30837
- return Rule;
30838
- }();
30839
-
30840
- function validErrorRuleValue(rule, val) {
30841
- var type = rule.type,
30842
- min = rule.min,
30843
- max = rule.max,
30844
- pattern = rule.pattern;
30845
- var isNumType = type === 'number';
30846
- var numVal = isNumType ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(val) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getSize(val); // 判断数值
30847
-
30848
- if (isNumType && isNaN(val)) {
30849
- return true;
30850
- } // 如果存在 min,判断最小值
30851
-
30852
-
30853
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(min) && numVal < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(min)) {
30854
- return true;
30855
- } // 如果存在 max,判断最大值
30856
-
30857
-
30858
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(max) && numVal > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(max)) {
30859
- return true;
30860
- } // 如果存在 pattern,正则校验
30861
-
30862
-
30863
- if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
30864
- return true;
30865
- }
30866
-
30867
- return false;
30868
- }
30869
-
30870
- /* harmony default export */ var validator_src_mixin = ({
30871
- methods: {
30872
- /**
30873
- * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
30874
- */
30875
- _fullValidate: function _fullValidate(rows, cb) {
30876
- return this.beginValidate(rows, cb, true);
30877
- },
30878
-
30879
- /**
30880
- * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
30881
- */
30882
- _validate: function _validate(rows, cb) {
30883
- return this.beginValidate(rows, cb);
30884
- },
30885
-
30886
- /**
30887
- * 聚焦到校验通过的单元格并弹出校验错误提示
30888
- */
30889
- handleValidError: function handleValidError(params) {
30890
- var _this = this;
30891
-
30892
- return new Promise(function (resolve) {
30893
- if (_this.validOpts.autoPos === false) {
30894
- _this.emitEvent('valid-error', params);
30895
-
30896
- resolve();
30897
- } else {
30898
- _this.handleActived(params, {
30899
- type: 'valid-error',
30900
- trigger: 'call'
30901
- }).then(function () {
30902
- setTimeout(function () {
30903
- resolve(_this.showValidTooltip(params));
30904
- }, 10);
30905
- });
30906
- }
30907
- });
30908
- },
30909
-
30910
- /**
30911
- * 对表格数据进行校验
30912
- * 如果不指定数据,则默认只校验临时变动的数据,例如新增或修改
30913
- * 如果传 true 则校验当前表格数据
30914
- * 如果传 row 指定行记录,则只验证传入的行
30915
- * 如果传 rows 为多行记录,则只验证传入的行
30916
- * 如果只传 callback 否则默认验证整个表格数据
30917
- * 返回 Promise 对象,或者使用回调方式
30918
- */
30919
- beginValidate: function beginValidate(rows, cb, isFull) {
30920
- var _this2 = this;
30921
-
30922
- var validRest = {};
30923
- var editRules = this.editRules,
30924
- afterFullData = this.afterFullData,
30925
- treeConfig = this.treeConfig,
30926
- treeOpts = this.treeOpts;
30927
- var vaildDatas;
30928
-
30929
- if (rows === true) {
30930
- vaildDatas = afterFullData;
30931
- } else if (rows) {
30932
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(rows)) {
30933
- cb = rows;
30934
- } else {
30935
- vaildDatas = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(rows) ? rows : [rows];
30936
- }
30937
- }
30938
-
30939
- if (!vaildDatas) {
30940
- vaildDatas = this.getInsertRecords().concat(this.getUpdateRecords());
30941
- }
31320
+ if (!mouseScrollTimeout) {
31321
+ startMouseScroll(evnt);
31322
+ }
31323
+ } else if (mouseScrollTimeout) {
31324
+ stopMouseScroll();
31325
+ }
30942
31326
 
30943
- var rowValids = [];
30944
- this.lastCallTime = Date.now();
30945
- this.validRuleErr = false; // 如果为快速校验,当存在某列校验不通过时将终止执行
31327
+ handleChecked(evnt);
31328
+ };
30946
31329
 
30947
- this.clearValidate();
31330
+ document.onmouseup = function (evnt) {
31331
+ stopMouseScroll();
31332
+ dom.removeClass($el, 'drag--range');
31333
+ checkboxRangeElem.removeAttribute('style');
31334
+ document.onmousemove = domMousemove;
31335
+ document.onmouseup = domMouseup;
31336
+ triggerEvent('end', evnt);
31337
+ };
30948
31338
 
30949
- if (editRules) {
30950
- var columns = this.getColumns();
31339
+ triggerEvent('start', evnt);
31340
+ }
31341
+ }
31342
+ }
31343
+ });
31344
+ // CONCATENATED MODULE: ./packages/keyboard/index.js
30951
31345
 
30952
- var handleVaild = function handleVaild(row) {
30953
- if (isFull || !_this2.validRuleErr) {
30954
- var colVailds = [];
30955
- columns.forEach(function (column) {
30956
- if ((isFull || !_this2.validRuleErr) && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.has(editRules, column.property)) {
30957
- colVailds.push(_this2.validCellRules('all', row, column).catch(function (_ref) {
30958
- var rule = _ref.rule,
30959
- rules = _ref.rules;
30960
- var rest = {
30961
- rule: rule,
30962
- rules: rules,
30963
- rowIndex: _this2.getRowIndex(row),
30964
- row: row,
30965
- columnIndex: _this2.getColumnIndex(column),
30966
- column: column,
30967
- field: column.property,
30968
- $table: _this2
30969
- };
30970
31346
 
30971
- if (!validRest[column.property]) {
30972
- validRest[column.property] = [];
30973
- }
30974
31347
 
30975
- validRest[column.property].push(rest);
31348
+ var Keyboard = {
31349
+ install: function install() {
31350
+ v_x_e_table.reg('keyboard');
31351
+ packages_table.mixins.push(keyboard_src_mixin);
31352
+ }
31353
+ };
31354
+ /* harmony default export */ var packages_keyboard = (Keyboard);
31355
+ // CONCATENATED MODULE: ./packages/validator/src/mixin.js
30976
31356
 
30977
- if (!isFull) {
30978
- _this2.validRuleErr = true;
30979
- return Promise.reject(rest);
30980
- }
30981
- }));
30982
- }
30983
- });
30984
- rowValids.push(Promise.all(colVailds));
30985
- }
30986
- };
30987
31357
 
30988
- if (treeConfig) {
30989
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eachTree(vaildDatas, handleVaild, treeOpts);
30990
- } else {
30991
- vaildDatas.forEach(handleVaild);
30992
- }
30993
31358
 
30994
- return Promise.all(rowValids).then(function () {
30995
- var ruleProps = Object.keys(validRest);
30996
- return _this2.$nextTick().then(function () {
30997
- if (ruleProps.length) {
30998
- return Promise.reject(validRest[ruleProps[0]][0]);
30999
- }
31000
31359
 
31001
- if (cb) {
31002
- cb();
31003
- }
31004
- });
31005
- }).catch(function (firstErrParams) {
31006
- return new Promise(function (resolve, reject) {
31007
- var finish = function finish() {
31008
- _this2.$nextTick(function () {
31009
- if (cb) {
31010
- cb(validRest);
31011
- resolve();
31012
- } else {
31013
- if (conf.validToReject === 'obsolete') {
31014
- // 已废弃,校验失败将不会执行catch
31015
- reject(validRest);
31016
- } else {
31017
- resolve(validRest);
31018
- }
31019
- }
31020
- });
31021
- };
31022
31360
 
31023
- var posAndFinish = function posAndFinish() {
31024
- firstErrParams.cell = _this2.getCell(firstErrParams.row, firstErrParams.column);
31025
- dom.scrollToView(firstErrParams.cell);
31026
31361
 
31027
- _this2.handleValidError(firstErrParams).then(finish);
31028
- };
31029
- /**
31030
- * 当校验不通过时
31031
- * 将表格滚动到可视区
31032
- * 由于提示信息至少需要占一行,定位向上偏移一行
31033
- */
31034
31362
 
31035
31363
 
31036
- var row = firstErrParams.row;
31037
- var rowIndex = afterFullData.indexOf(row);
31038
- var locatRow = rowIndex > 0 ? afterFullData[rowIndex - 1] : row;
31039
31364
 
31040
- if (_this2.validOpts.autoPos === false) {
31041
- finish();
31042
- } else {
31043
- if (treeConfig) {
31044
- _this2.scrollToTreeRow(locatRow).then(posAndFinish);
31045
- } else {
31046
- _this2.scrollToRow(locatRow).then(posAndFinish);
31047
- }
31048
- }
31049
- });
31050
- });
31051
- }
31052
31365
 
31053
- return this.$nextTick().then(function () {
31054
- if (cb) {
31055
- cb();
31056
- }
31057
- });
31058
- },
31059
- hasCellRules: function hasCellRules(type, row, column) {
31060
- var editRules = this.editRules;
31061
- var property = column.property;
31062
31366
 
31063
- if (property && editRules) {
31064
- var rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.get(editRules, property);
31065
- return rules && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.find(rules, function (rule) {
31066
- return type === 'all' || !rule.trigger || type === rule.trigger;
31067
- });
31068
- }
31069
31367
 
31070
- return false;
31071
- },
31072
31368
 
31073
- /**
31074
- * 校验数据
31075
- * 按表格行、列顺序依次校验(同步或异步)
31076
- * 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
31077
- * 如果校验失败则,触发回调或者Promise<不通过列的错误消息>
31078
- * 如果是传回调方式这返回一个校验不通过列的错误消息
31079
- *
31080
- * rule 配置:
31081
- * required=Boolean 是否必填
31082
- * min=Number 最小长度
31083
- * max=Number 最大长度
31084
- * validator=Function({ cellValue, rule, rules, row, column, rowIndex, columnIndex }) 自定义校验,接收一个 Promise
31085
- * trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
31086
- */
31087
- validCellRules: function validCellRules(validType, row, column, val) {
31088
- var _this3 = this;
31089
31369
 
31090
- var editRules = this.editRules;
31091
- var property = column.property;
31092
- var errorRules = [];
31093
- var syncVailds = [];
31094
31370
 
31095
- if (property && editRules) {
31096
- var rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.get(editRules, property);
31097
31371
 
31098
- if (rules) {
31099
- var cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isUndefined(val) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.get(row, property) : val;
31100
- rules.forEach(function (rule) {
31101
- var type = rule.type,
31102
- trigger = rule.trigger,
31103
- required = rule.required;
31104
31372
 
31105
- if (validType === 'all' || !trigger || validType === trigger) {
31106
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(rule.validator)) {
31107
- var customValid = rule.validator({
31108
- cellValue: cellValue,
31109
- rule: rule,
31110
- rules: rules,
31111
- row: row,
31112
- rowIndex: _this3.getRowIndex(row),
31113
- column: column,
31114
- columnIndex: _this3.getColumnIndex(column),
31115
- field: column.property,
31116
- $table: _this3
31117
- });
31118
31373
 
31119
- if (customValid) {
31120
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isError(customValid)) {
31121
- _this3.validRuleErr = true;
31122
- errorRules.push(new mixin_Rule({
31123
- type: 'custom',
31124
- trigger: trigger,
31125
- content: customValid.message,
31126
- rule: new mixin_Rule(rule)
31127
- }));
31128
- } else if (customValid.catch) {
31129
- // 如果为异步校验(注:异步校验是并发无序的)
31130
- syncVailds.push(customValid.catch(function (e) {
31131
- _this3.validRuleErr = true;
31132
- errorRules.push(new mixin_Rule({
31133
- type: 'custom',
31134
- trigger: trigger,
31135
- content: e && e.message ? e.message : rule.content || rule.message,
31136
- rule: new mixin_Rule(rule)
31137
- }));
31138
- }));
31139
- }
31140
- }
31141
- } else {
31142
- var isArrType = type === 'array';
31143
- var hasEmpty = isArrType ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(cellValue) || !cellValue.length : eqEmptyValue(cellValue);
31144
31374
 
31145
- if (required ? hasEmpty || validErrorRuleValue(rule, cellValue) : !hasEmpty && validErrorRuleValue(rule, cellValue)) {
31146
- _this3.validRuleErr = true;
31147
- errorRules.push(new mixin_Rule(rule));
31148
- }
31149
- }
31150
- }
31151
- });
31152
- }
31153
- }
31375
+ /**
31376
+ * 校验规则
31377
+ */
31154
31378
 
31155
- return Promise.all(syncVailds).then(function () {
31156
- if (errorRules.length) {
31157
- var rest = {
31158
- rules: errorRules,
31159
- rule: errorRules[0]
31160
- };
31161
- return Promise.reject(rest);
31162
- }
31163
- });
31164
- },
31165
- _clearValidate: function _clearValidate() {
31166
- var validTip = this.$refs.validTip;
31167
- Object.assign(this.validStore, {
31168
- visible: false,
31169
- row: null,
31170
- column: null,
31171
- content: '',
31172
- rule: null
31173
- });
31379
+ var mixin_Rule = /*#__PURE__*/function () {
31380
+ function Rule(rule) {
31381
+ _classCallCheck(this, Rule);
31382
+
31383
+ Object.assign(this, {
31384
+ $options: rule,
31385
+ required: rule.required,
31386
+ min: rule.min,
31387
+ max: rule.max,
31388
+ type: rule.type,
31389
+ pattern: rule.pattern,
31390
+ validator: rule.validator,
31391
+ trigger: rule.trigger,
31392
+ maxWidth: rule.maxWidth
31393
+ });
31394
+ }
31395
+ /**
31396
+ * 获取校验不通过的消息
31397
+ * 支持国际化翻译
31398
+ */
31174
31399
 
31175
- if (validTip && validTip.visible) {
31176
- validTip.close();
31177
- }
31178
31400
 
31179
- return this.$nextTick();
31180
- },
31401
+ _createClass(Rule, [{
31402
+ key: "content",
31403
+ get: function get() {
31404
+ return getFuncText(this.$options.content || this.$options.message);
31405
+ }
31406
+ }, {
31407
+ key: "message",
31408
+ get: function get() {
31409
+ return this.content;
31410
+ }
31411
+ }]);
31181
31412
 
31182
- /**
31183
- * 触发校验
31184
- */
31185
- triggerValidate: function triggerValidate(type) {
31186
- var _this4 = this;
31413
+ return Rule;
31414
+ }();
31187
31415
 
31188
- var editConfig = this.editConfig,
31189
- editStore = this.editStore,
31190
- editRules = this.editRules,
31191
- validStore = this.validStore;
31192
- var actived = editStore.actived;
31416
+ function validErrorRuleValue(rule, val) {
31417
+ var type = rule.type,
31418
+ min = rule.min,
31419
+ max = rule.max,
31420
+ pattern = rule.pattern;
31421
+ var isNumType = type === 'number';
31422
+ var numVal = isNumType ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(val) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getSize(val); // 判断数值
31193
31423
 
31194
- if (actived.row && editRules) {
31195
- var _actived$args = actived.args,
31196
- row = _actived$args.row,
31197
- column = _actived$args.column,
31198
- cell = _actived$args.cell;
31424
+ if (isNumType && isNaN(val)) {
31425
+ return true;
31426
+ } // 如果存在 min,判断最小值
31199
31427
 
31200
- if (this.hasCellRules(type, row, column)) {
31201
- return this.validCellRules(type, row, column).then(function () {
31202
- if (editConfig.mode === 'row') {
31203
- if (validStore.visible && validStore.row === row && validStore.column === column) {
31204
- _this4.clearValidate();
31205
- }
31206
- }
31207
- }).catch(function (_ref2) {
31208
- var rule = _ref2.rule;
31209
31428
 
31210
- // 如果校验不通过与触发方式一致,则聚焦提示错误,否则跳过并不作任何处理
31211
- if (!rule.trigger || type === rule.trigger) {
31212
- var rest = {
31213
- rule: rule,
31214
- row: row,
31215
- column: column,
31216
- cell: cell
31217
- };
31429
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(min) && numVal < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(min)) {
31430
+ return true;
31431
+ } // 如果存在 max,判断最大值
31218
31432
 
31219
- _this4.showValidTooltip(rest);
31220
31433
 
31221
- return Promise.reject(rest);
31222
- }
31434
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(max) && numVal > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(max)) {
31435
+ return true;
31436
+ } // 如果存在 pattern,正则校验
31223
31437
 
31224
- return Promise.resolve();
31225
- });
31226
- }
31227
- }
31228
31438
 
31229
- return Promise.resolve();
31439
+ if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
31440
+ return true;
31441
+ }
31442
+
31443
+ return false;
31444
+ }
31445
+
31446
+ /* harmony default export */ var validator_src_mixin = ({
31447
+ methods: {
31448
+ /**
31449
+ * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
31450
+ */
31451
+ _fullValidate: function _fullValidate(rows, cb) {
31452
+ return this.beginValidate(rows, cb, true);
31230
31453
  },
31231
31454
 
31232
31455
  /**
31233
- * 弹出校验错误提示
31456
+ * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
31234
31457
  */
31235
- showValidTooltip: function showValidTooltip(params) {
31236
- var _this5 = this;
31458
+ _validate: function _validate(rows, cb) {
31459
+ return this.beginValidate(rows, cb);
31460
+ },
31237
31461
 
31238
- var $refs = this.$refs,
31239
- height = this.height,
31240
- tableData = this.tableData,
31241
- validOpts = this.validOpts;
31242
- var rule = params.rule,
31243
- row = params.row,
31244
- column = params.column,
31245
- cell = params.cell;
31246
- var validTip = $refs.validTip;
31247
- var content = rule.content;
31248
- return this.$nextTick(function () {
31249
- Object.assign(_this5.validStore, {
31250
- row: row,
31251
- column: column,
31252
- rule: rule,
31253
- content: content,
31254
- visible: true
31255
- });
31462
+ /**
31463
+ * 聚焦到校验通过的单元格并弹出校验错误提示
31464
+ */
31465
+ handleValidError: function handleValidError(params) {
31466
+ var _this = this;
31256
31467
 
31257
- _this5.emitEvent('valid-error', params);
31468
+ return new Promise(function (resolve) {
31469
+ if (_this.validOpts.autoPos === false) {
31470
+ _this.emitEvent('valid-error', params);
31258
31471
 
31259
- if (validTip && (validOpts.message === 'tooltip' || validOpts.message === 'default' && !height && tableData.length < 2)) {
31260
- return validTip.open(cell, content);
31472
+ resolve();
31473
+ } else {
31474
+ _this.handleActived(params, {
31475
+ type: 'valid-error',
31476
+ trigger: 'call'
31477
+ }).then(function () {
31478
+ setTimeout(function () {
31479
+ resolve(_this.showValidTooltip(params));
31480
+ }, 10);
31481
+ });
31261
31482
  }
31262
31483
  });
31263
- }
31264
- }
31265
- });
31266
- // CONCATENATED MODULE: ./packages/validator/index.js
31267
-
31268
-
31269
-
31270
- var Validator = {
31271
- install: function install() {
31272
- v_x_e_table.reg('valid');
31273
- packages_table.mixins.push(validator_src_mixin);
31274
- }
31275
- };
31276
- /* harmony default export */ var validator = (Validator);
31277
- // CONCATENATED MODULE: ./packages/header/src/util.js
31278
-
31484
+ },
31279
31485
 
31486
+ /**
31487
+ * 对表格数据进行校验
31488
+ * 如果不指定数据,则默认只校验临时变动的数据,例如新增或修改
31489
+ * 如果传 true 则校验当前表格数据
31490
+ * 如果传 row 指定行记录,则只验证传入的行
31491
+ * 如果传 rows 为多行记录,则只验证传入的行
31492
+ * 如果只传 callback 否则默认验证整个表格数据
31493
+ * 返回 Promise 对象,或者使用回调方式
31494
+ */
31495
+ beginValidate: function beginValidate(rows, cb, isFull) {
31496
+ var _this2 = this;
31280
31497
 
31281
- var util_getAllColumns = function getAllColumns(columns, parentColumn) {
31282
- var result = [];
31283
- columns.forEach(function (column) {
31284
- column.parentId = parentColumn ? parentColumn.id : null;
31498
+ var validRest = {};
31499
+ var editRules = this.editRules,
31500
+ afterFullData = this.afterFullData,
31501
+ treeConfig = this.treeConfig,
31502
+ treeOpts = this.treeOpts;
31503
+ var vaildDatas;
31285
31504
 
31286
- if (column.visible) {
31287
- if (column.children && column.children.length && column.children.some(function (column) {
31288
- return column.visible;
31289
- })) {
31290
- result.push(column);
31291
- result.push.apply(result, _toConsumableArray(getAllColumns(column.children, column)));
31292
- } else {
31293
- result.push(column);
31505
+ if (rows === true) {
31506
+ vaildDatas = afterFullData;
31507
+ } else if (rows) {
31508
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(rows)) {
31509
+ cb = rows;
31510
+ } else {
31511
+ vaildDatas = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(rows) ? rows : [rows];
31512
+ }
31294
31513
  }
31295
- }
31296
- });
31297
- return result;
31298
- };
31299
-
31300
- var util_convertToRows = function convertToRows(originColumns) {
31301
- var maxLevel = 1;
31302
-
31303
- var traverse = function traverse(column, parent) {
31304
- if (parent) {
31305
- column.level = parent.level + 1;
31306
31514
 
31307
- if (maxLevel < column.level) {
31308
- maxLevel = column.level;
31515
+ if (!vaildDatas) {
31516
+ vaildDatas = this.getInsertRecords().concat(this.getUpdateRecords());
31309
31517
  }
31310
- }
31311
-
31312
- if (column.children && column.children.length && column.children.some(function (column) {
31313
- return column.visible;
31314
- })) {
31315
- var colSpan = 0;
31316
- column.children.forEach(function (subColumn) {
31317
- if (subColumn.visible) {
31318
- traverse(subColumn, column);
31319
- colSpan += subColumn.colSpan;
31320
- }
31321
- });
31322
- column.colSpan = colSpan;
31323
- } else {
31324
- column.colSpan = 1;
31325
- }
31326
- };
31327
31518
 
31328
- originColumns.forEach(function (column) {
31329
- column.level = 1;
31330
- traverse(column);
31331
- });
31332
- var rows = [];
31519
+ var rowValids = [];
31520
+ this.lastCallTime = Date.now();
31521
+ this.validRuleErr = false; // 如果为快速校验,当存在某列校验不通过时将终止执行
31333
31522
 
31334
- for (var i = 0; i < maxLevel; i++) {
31335
- rows.push([]);
31336
- }
31523
+ this.clearValidate();
31337
31524
 
31338
- var allColumns = util_getAllColumns(originColumns);
31339
- allColumns.forEach(function (column) {
31340
- if (column.children && column.children.length && column.children.some(function (column) {
31341
- return column.visible;
31342
- })) {
31343
- column.rowSpan = 1;
31344
- } else {
31345
- column.rowSpan = maxLevel - column.level + 1;
31346
- }
31525
+ if (editRules) {
31526
+ var columns = this.getColumns();
31347
31527
 
31348
- rows[column.level - 1].push(column);
31349
- });
31350
- return rows;
31351
- };
31352
- // CONCATENATED MODULE: ./packages/header/src/header.js
31528
+ var handleVaild = function handleVaild(row) {
31529
+ if (isFull || !_this2.validRuleErr) {
31530
+ var colVailds = [];
31531
+ columns.forEach(function (column) {
31532
+ if ((isFull || !_this2.validRuleErr) && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.has(editRules, column.property)) {
31533
+ colVailds.push(_this2.validCellRules('all', row, column).catch(function (_ref) {
31534
+ var rule = _ref.rule,
31535
+ rules = _ref.rules;
31536
+ var rest = {
31537
+ rule: rule,
31538
+ rules: rules,
31539
+ rowIndex: _this2.getRowIndex(row),
31540
+ row: row,
31541
+ columnIndex: _this2.getColumnIndex(column),
31542
+ column: column,
31543
+ field: column.property,
31544
+ $table: _this2
31545
+ };
31353
31546
 
31547
+ if (!validRest[column.property]) {
31548
+ validRest[column.property] = [];
31549
+ }
31354
31550
 
31551
+ validRest[column.property].push(rest);
31355
31552
 
31553
+ if (!isFull) {
31554
+ _this2.validRuleErr = true;
31555
+ return Promise.reject(rest);
31556
+ }
31557
+ }));
31558
+ }
31559
+ });
31560
+ rowValids.push(Promise.all(colVailds));
31561
+ }
31562
+ };
31356
31563
 
31564
+ if (treeConfig) {
31565
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eachTree(vaildDatas, handleVaild, treeOpts);
31566
+ } else {
31567
+ vaildDatas.forEach(handleVaild);
31568
+ }
31357
31569
 
31570
+ return Promise.all(rowValids).then(function () {
31571
+ var ruleProps = Object.keys(validRest);
31572
+ return _this2.$nextTick().then(function () {
31573
+ if (ruleProps.length) {
31574
+ return Promise.reject(validRest[ruleProps[0]][0]);
31575
+ }
31358
31576
 
31577
+ if (cb) {
31578
+ cb();
31579
+ }
31580
+ });
31581
+ }).catch(function (firstErrParams) {
31582
+ return new Promise(function (resolve, reject) {
31583
+ var finish = function finish() {
31584
+ _this2.$nextTick(function () {
31585
+ if (cb) {
31586
+ cb(validRest);
31587
+ resolve();
31588
+ } else {
31589
+ if (conf.validToReject === 'obsolete') {
31590
+ // 已废弃,校验失败将不会执行catch
31591
+ reject(validRest);
31592
+ } else {
31593
+ resolve(validRest);
31594
+ }
31595
+ }
31596
+ });
31597
+ };
31359
31598
 
31599
+ var posAndFinish = function posAndFinish() {
31600
+ firstErrParams.cell = _this2.getCell(firstErrParams.row, firstErrParams.column);
31601
+ dom.scrollToView(firstErrParams.cell);
31360
31602
 
31603
+ _this2.handleValidError(firstErrParams).then(finish);
31604
+ };
31605
+ /**
31606
+ * 当校验不通过时
31607
+ * 将表格滚动到可视区
31608
+ * 由于提示信息至少需要占一行,定位向上偏移一行
31609
+ */
31361
31610
 
31362
- var cellType = 'header';
31363
- /* harmony default export */ var header = ({
31364
- name: 'VxeTableHeader',
31365
- props: {
31366
- tableData: Array,
31367
- tableColumn: Array,
31368
- tableGroupColumn: Array,
31369
- fixedColumn: Array,
31370
- size: String,
31371
- fixedType: String
31372
- },
31373
- data: function data() {
31374
- return {
31375
- headerColumn: []
31376
- };
31377
- },
31378
- watch: {
31379
- tableColumn: function tableColumn() {
31380
- this.uploadColumn();
31381
- }
31382
- },
31383
- created: function created() {
31384
- this.uploadColumn();
31385
- },
31386
- mounted: function mounted() {
31387
- var $xetable = this.$parent,
31388
- $el = this.$el,
31389
- $refs = this.$refs,
31390
- fixedType = this.fixedType;
31391
- var elemStore = $xetable.elemStore;
31392
- var prefix = "".concat(fixedType || 'main', "-header-");
31393
- elemStore["".concat(prefix, "wrapper")] = $el;
31394
- elemStore["".concat(prefix, "table")] = $refs.table;
31395
- elemStore["".concat(prefix, "colgroup")] = $refs.colgroup;
31396
- elemStore["".concat(prefix, "list")] = $refs.thead;
31397
- elemStore["".concat(prefix, "xSpace")] = $refs.xSpace;
31398
- elemStore["".concat(prefix, "repair")] = $refs.repair;
31399
- },
31400
- destroyed: function destroyed() {
31401
- var $xetable = this.$parent,
31402
- fixedType = this.fixedType;
31403
- var elemStore = $xetable.elemStore;
31404
- var prefix = "".concat(fixedType || 'main', "-header-");
31405
- elemStore["".concat(prefix, "wrapper")] = null;
31406
- elemStore["".concat(prefix, "table")] = null;
31407
- elemStore["".concat(prefix, "colgroup")] = null;
31408
- elemStore["".concat(prefix, "list")] = null;
31409
- elemStore["".concat(prefix, "xSpace")] = null;
31410
- elemStore["".concat(prefix, "repair")] = null;
31411
- },
31412
- render: function render(h) {
31413
- var _this = this;
31414
31611
 
31415
- var _e = this._e,
31416
- $xetable = this.$parent,
31417
- fixedType = this.fixedType,
31418
- headerColumn = this.headerColumn,
31419
- fixedColumn = this.fixedColumn;
31420
- var tableListeners = $xetable.$listeners,
31421
- tId = $xetable.tId,
31422
- isGroup = $xetable.isGroup,
31423
- resizable = $xetable.resizable,
31424
- border = $xetable.border,
31425
- columnKey = $xetable.columnKey,
31426
- headerRowClassName = $xetable.headerRowClassName,
31427
- headerCellClassName = $xetable.headerCellClassName,
31428
- headerRowStyle = $xetable.headerRowStyle,
31429
- headerCellStyle = $xetable.headerCellStyle,
31430
- allColumnHeaderOverflow = $xetable.showHeaderOverflow,
31431
- allHeaderAlign = $xetable.headerAlign,
31432
- allAlign = $xetable.align,
31433
- highlightCurrentColumn = $xetable.highlightCurrentColumn,
31434
- currentColumn = $xetable.currentColumn,
31435
- scrollXLoad = $xetable.scrollXLoad,
31436
- overflowX = $xetable.overflowX,
31437
- scrollbarWidth = $xetable.scrollbarWidth,
31438
- sortOpts = $xetable.sortOpts,
31439
- mouseConfig = $xetable.mouseConfig,
31440
- columnOpts = $xetable.columnOpts;
31441
- var tableColumn = this.tableColumn;
31442
- var headerGroups = headerColumn; // 如果是使用优化模式
31612
+ var row = firstErrParams.row;
31613
+ var rowIndex = afterFullData.indexOf(row);
31614
+ var locatRow = rowIndex > 0 ? afterFullData[rowIndex - 1] : row;
31443
31615
 
31444
- if (!isGroup) {
31445
- if (fixedType) {
31446
- if (scrollXLoad || allColumnHeaderOverflow) {
31447
- tableColumn = fixedColumn;
31448
- }
31616
+ if (_this2.validOpts.autoPos === false) {
31617
+ finish();
31618
+ } else {
31619
+ if (treeConfig) {
31620
+ _this2.scrollToTreeRow(locatRow).then(posAndFinish);
31621
+ } else {
31622
+ _this2.scrollToRow(locatRow).then(posAndFinish);
31623
+ }
31624
+ }
31625
+ });
31626
+ });
31449
31627
  }
31450
31628
 
31451
- headerGroups = [tableColumn];
31452
- }
31453
-
31454
- return h('div', {
31455
- class: ['vxe-table--header-wrapper', fixedType ? "fixed-".concat(fixedType, "--wrapper") : 'body--wrapper'],
31456
- attrs: {
31457
- xid: tId
31458
- }
31459
- }, [fixedType ? _e() : h('div', {
31460
- class: 'vxe-body--x-space',
31461
- ref: 'xSpace'
31462
- }), h('table', {
31463
- class: 'vxe-table--header',
31464
- attrs: {
31465
- xid: tId,
31466
- cellspacing: 0,
31467
- cellpadding: 0,
31468
- border: 0
31469
- },
31470
- ref: 'table'
31471
- }, [
31472
- /**
31473
- * 列宽
31474
- */
31475
- h('colgroup', {
31476
- ref: 'colgroup'
31477
- }, tableColumn.map(function (column, $columnIndex) {
31478
- return h('col', {
31479
- attrs: {
31480
- name: column.id
31481
- },
31482
- key: $columnIndex
31629
+ return this.$nextTick().then(function () {
31630
+ if (cb) {
31631
+ cb();
31632
+ }
31483
31633
  });
31484
- }).concat(scrollbarWidth ? [h('col', {
31485
- attrs: {
31486
- name: 'col_gutter'
31487
- }
31488
- })] : [])),
31489
- /**
31490
- * 头部
31491
- */
31492
- h('thead', {
31493
- ref: 'thead'
31494
- }, headerGroups.map(function (cols, $rowIndex) {
31495
- return h('tr', {
31496
- class: ['vxe-header--row', headerRowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(headerRowClassName) ? headerRowClassName({
31497
- $table: $xetable,
31498
- $rowIndex: $rowIndex,
31499
- fixed: fixedType,
31500
- type: cellType
31501
- }) : headerRowClassName : ''],
31502
- style: headerRowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(headerRowStyle) ? headerRowStyle({
31503
- $table: $xetable,
31504
- $rowIndex: $rowIndex,
31505
- fixed: fixedType,
31506
- type: cellType
31507
- }) : headerRowStyle : null
31508
- }, cols.map(function (column, $columnIndex) {
31509
- var _ref;
31510
-
31511
- var type = column.type,
31512
- showHeaderOverflow = column.showHeaderOverflow,
31513
- headerAlign = column.headerAlign,
31514
- align = column.align,
31515
- headerClassName = column.headerClassName; // const { enabled } = tooltipOpts
31634
+ },
31635
+ hasCellRules: function hasCellRules(type, row, column) {
31636
+ var editRules = this.editRules;
31637
+ var property = column.property;
31516
31638
 
31517
- var isColGroup = column.children && column.children.length;
31518
- var fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
31519
- var headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isUndefined(showHeaderOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
31520
- var headAlign = headerAlign || align || allHeaderAlign || allAlign;
31521
- var showEllipsis = headOverflow === 'ellipsis';
31522
- var showTitle = headOverflow === 'title';
31523
- var showTooltip = headOverflow === true || headOverflow === 'tooltip';
31524
- var hasEllipsis = showTitle || showTooltip || showEllipsis;
31525
- var thOns = {};
31526
- var hasFilter = column.filters && column.filters.some(function (item) {
31527
- return item.checked;
31639
+ if (property && editRules) {
31640
+ var rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.get(editRules, property);
31641
+ return rules && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.find(rules, function (rule) {
31642
+ return type === 'all' || !rule.trigger || type === rule.trigger;
31528
31643
  });
31529
- var columnIndex = $xetable.getColumnIndex(column);
31644
+ }
31530
31645
 
31531
- var _columnIndex = $xetable.getVTColumnIndex(column);
31646
+ return false;
31647
+ },
31532
31648
 
31533
- var params = {
31534
- $table: $xetable,
31535
- $rowIndex: $rowIndex,
31536
- column: column,
31537
- columnIndex: columnIndex,
31538
- $columnIndex: $columnIndex,
31539
- _columnIndex: _columnIndex,
31540
- fixed: fixedType,
31541
- type: cellType,
31542
- isHidden: fixedHiddenColumn,
31543
- hasFilter: hasFilter
31544
- }; // 虚拟滚动不支持动态高度
31649
+ /**
31650
+ * 校验数据
31651
+ * 按表格行、列顺序依次校验(同步或异步)
31652
+ * 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
31653
+ * 如果校验失败则,触发回调或者Promise<不通过列的错误消息>
31654
+ * 如果是传回调方式这返回一个校验不通过列的错误消息
31655
+ *
31656
+ * rule 配置:
31657
+ * required=Boolean 是否必填
31658
+ * min=Number 最小长度
31659
+ * max=Number 最大长度
31660
+ * validator=Function({ cellValue, rule, rules, row, column, rowIndex, columnIndex }) 自定义校验,接收一个 Promise
31661
+ * trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
31662
+ */
31663
+ validCellRules: function validCellRules(validType, row, column, val) {
31664
+ var _this3 = this;
31545
31665
 
31546
- if (scrollXLoad && !hasEllipsis) {
31547
- showEllipsis = hasEllipsis = true;
31548
- }
31666
+ var editRules = this.editRules;
31667
+ var property = column.property;
31668
+ var errorRules = [];
31669
+ var syncVailds = [];
31549
31670
 
31550
- if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
31551
- thOns.click = function (evnt) {
31552
- return $xetable.triggerHeaderCellClickEvent(evnt, params);
31553
- };
31554
- }
31671
+ if (property && editRules) {
31672
+ var rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.get(editRules, property);
31555
31673
 
31556
- if (tableListeners['header-cell-dblclick']) {
31557
- thOns.dblclick = function (evnt) {
31558
- return $xetable.triggerHeaderCellDblclickEvent(evnt, params);
31559
- };
31560
- } // 按下事件处理
31674
+ if (rules) {
31675
+ var cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isUndefined(val) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.get(row, property) : val;
31676
+ rules.forEach(function (rule) {
31677
+ var type = rule.type,
31678
+ trigger = rule.trigger,
31679
+ required = rule.required;
31561
31680
 
31681
+ if (validType === 'all' || !trigger || validType === trigger) {
31682
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(rule.validator)) {
31683
+ var customValid = rule.validator({
31684
+ cellValue: cellValue,
31685
+ rule: rule,
31686
+ rules: rules,
31687
+ row: row,
31688
+ rowIndex: _this3.getRowIndex(row),
31689
+ column: column,
31690
+ columnIndex: _this3.getColumnIndex(column),
31691
+ field: column.property,
31692
+ $table: _this3
31693
+ });
31562
31694
 
31563
- if (mouseConfig) {
31564
- thOns.mousedown = function (evnt) {
31565
- return $xetable.triggerHeaderCellMousedownEvent(evnt, params);
31566
- };
31567
- }
31695
+ if (customValid) {
31696
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isError(customValid)) {
31697
+ _this3.validRuleErr = true;
31698
+ errorRules.push(new mixin_Rule({
31699
+ type: 'custom',
31700
+ trigger: trigger,
31701
+ content: customValid.message,
31702
+ rule: new mixin_Rule(rule)
31703
+ }));
31704
+ } else if (customValid.catch) {
31705
+ // 如果为异步校验(注:异步校验是并发无序的)
31706
+ syncVailds.push(customValid.catch(function (e) {
31707
+ _this3.validRuleErr = true;
31708
+ errorRules.push(new mixin_Rule({
31709
+ type: 'custom',
31710
+ trigger: trigger,
31711
+ content: e && e.message ? e.message : rule.content || rule.message,
31712
+ rule: new mixin_Rule(rule)
31713
+ }));
31714
+ }));
31715
+ }
31716
+ }
31717
+ } else {
31718
+ var isArrType = type === 'array';
31719
+ var hasEmpty = isArrType || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(cellValue) ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(cellValue) || !cellValue.length : eqEmptyValue(cellValue);
31568
31720
 
31569
- return h('th', {
31570
- class: ['vxe-header--column', column.id, (_ref = {}, _defineProperty(_ref, "col--".concat(headAlign), headAlign), _defineProperty(_ref, "col--".concat(type), type), _defineProperty(_ref, 'col--last', $columnIndex === cols.length - 1), _defineProperty(_ref, 'col--fixed', column.fixed), _defineProperty(_ref, 'col--group', isColGroup), _defineProperty(_ref, 'col--ellipsis', hasEllipsis), _defineProperty(_ref, 'fixed--hidden', fixedHiddenColumn), _defineProperty(_ref, 'is--sortable', column.sortable), _defineProperty(_ref, 'col--filter', !!column.filters), _defineProperty(_ref, 'is--filter-active', hasFilter), _defineProperty(_ref, 'col--current', currentColumn === column), _ref), utils.getClass(headerClassName, params), utils.getClass(headerCellClassName, params)],
31571
- attrs: {
31572
- colid: column.id,
31573
- colspan: column.colSpan > 1 ? column.colSpan : null,
31574
- rowspan: column.rowSpan > 1 ? column.rowSpan : null
31575
- },
31576
- style: headerCellStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle : null,
31577
- on: thOns,
31578
- key: columnKey || columnOpts.useKey || isColGroup ? column.id : $columnIndex
31579
- }, [h('div', {
31580
- class: ['vxe-cell', {
31581
- 'c--title': showTitle,
31582
- 'c--tooltip': showTooltip,
31583
- 'c--ellipsis': showEllipsis
31584
- }]
31585
- }, column.renderHeader(h, params)),
31586
- /**
31587
- * 列宽拖动
31588
- */
31589
- !fixedHiddenColumn && !isColGroup && (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || resizable) ? h('div', {
31590
- class: ['vxe-resizable', {
31591
- 'is--line': !border || border === 'none'
31592
- }],
31593
- on: {
31594
- mousedown: function mousedown(evnt) {
31595
- return _this.resizeMousedown(evnt, params);
31721
+ if (required ? hasEmpty || validErrorRuleValue(rule, cellValue) : !hasEmpty && validErrorRuleValue(rule, cellValue)) {
31722
+ _this3.validRuleErr = true;
31723
+ errorRules.push(new mixin_Rule(rule));
31724
+ }
31725
+ }
31596
31726
  }
31597
- }
31598
- }) : null]);
31599
- }).concat(scrollbarWidth ? [h('th', {
31600
- class: 'vxe-header--gutter col--gutter'
31601
- })] : []));
31602
- }))]),
31603
- /**
31604
- * 其他
31605
- */
31606
- h('div', {
31607
- class: 'vxe-table--header-border-line',
31608
- ref: 'repair'
31609
- })]);
31610
- },
31611
- methods: {
31612
- uploadColumn: function uploadColumn() {
31613
- var $xetable = this.$parent;
31614
- this.headerColumn = $xetable.isGroup ? util_convertToRows(this.tableGroupColumn) : [];
31727
+ });
31728
+ }
31729
+ }
31730
+
31731
+ return Promise.all(syncVailds).then(function () {
31732
+ if (errorRules.length) {
31733
+ var rest = {
31734
+ rules: errorRules,
31735
+ rule: errorRules[0]
31736
+ };
31737
+ return Promise.reject(rest);
31738
+ }
31739
+ });
31615
31740
  },
31616
- resizeMousedown: function resizeMousedown(evnt, params) {
31617
- var column = params.column;
31618
- var $xetable = this.$parent,
31619
- $el = this.$el,
31620
- fixedType = this.fixedType;
31621
- var _$xetable$$refs = $xetable.$refs,
31622
- tableBody = _$xetable$$refs.tableBody,
31623
- leftContainer = _$xetable$$refs.leftContainer,
31624
- rightContainer = _$xetable$$refs.rightContainer,
31625
- resizeBarElem = _$xetable$$refs.resizeBar;
31626
- var dragBtnElem = evnt.target,
31627
- dragClientX = evnt.clientX;
31628
- var cell = params.cell = dragBtnElem.parentNode;
31629
- var dragLeft = 0;
31630
- var tableBodyElem = tableBody.$el;
31631
- var pos = dom.getOffsetPos(dragBtnElem, $el);
31632
- var dragBtnWidth = dragBtnElem.clientWidth;
31633
- var dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
31634
- var minInterval = getColMinWidth(params) - dragBtnOffsetWidth; // 列之间的最小间距
31741
+ _clearValidate: function _clearValidate() {
31742
+ var validTip = this.$refs.validTip;
31743
+ Object.assign(this.validStore, {
31744
+ visible: false,
31745
+ row: null,
31746
+ column: null,
31747
+ content: '',
31748
+ rule: null
31749
+ });
31635
31750
 
31636
- var dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
31637
- var dragPosLeft = pos.left + dragBtnOffsetWidth;
31638
- var domMousemove = document.onmousemove;
31639
- var domMouseup = document.onmouseup;
31640
- var isLeftFixed = fixedType === 'left';
31641
- var isRightFixed = fixedType === 'right'; // 计算左右侧固定列偏移量
31751
+ if (validTip && validTip.visible) {
31752
+ validTip.close();
31753
+ }
31642
31754
 
31643
- var fixedOffsetWidth = 0;
31755
+ return this.$nextTick();
31756
+ },
31644
31757
 
31645
- if (isLeftFixed || isRightFixed) {
31646
- var siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
31647
- var tempCellElem = cell[siblingProp];
31758
+ /**
31759
+ * 触发校验
31760
+ */
31761
+ triggerValidate: function triggerValidate(type) {
31762
+ var _this4 = this;
31648
31763
 
31649
- while (tempCellElem) {
31650
- if (dom.hasClass(tempCellElem, 'fixed--hidden')) {
31651
- break;
31652
- } else if (!dom.hasClass(tempCellElem, 'col--group')) {
31653
- fixedOffsetWidth += tempCellElem.offsetWidth;
31654
- }
31764
+ var editConfig = this.editConfig,
31765
+ editStore = this.editStore,
31766
+ editRules = this.editRules,
31767
+ validStore = this.validStore;
31768
+ var actived = editStore.actived;
31655
31769
 
31656
- tempCellElem = tempCellElem[siblingProp];
31657
- }
31770
+ if (actived.row && editRules) {
31771
+ var _actived$args = actived.args,
31772
+ row = _actived$args.row,
31773
+ column = _actived$args.column,
31774
+ cell = _actived$args.cell;
31658
31775
 
31659
- if (isRightFixed && rightContainer) {
31660
- dragPosLeft = rightContainer.offsetLeft + fixedOffsetWidth;
31661
- }
31662
- } // 处理拖动事件
31776
+ if (this.hasCellRules(type, row, column)) {
31777
+ return this.validCellRules(type, row, column).then(function () {
31778
+ if (editConfig.mode === 'row') {
31779
+ if (validStore.visible && validStore.row === row && validStore.column === column) {
31780
+ _this4.clearValidate();
31781
+ }
31782
+ }
31783
+ }).catch(function (_ref2) {
31784
+ var rule = _ref2.rule;
31663
31785
 
31786
+ // 如果校验不通过与触发方式一致,则聚焦提示错误,否则跳过并不作任何处理
31787
+ if (!rule.trigger || type === rule.trigger) {
31788
+ var rest = {
31789
+ rule: rule,
31790
+ row: row,
31791
+ column: column,
31792
+ cell: cell
31793
+ };
31664
31794
 
31665
- var updateEvent = function updateEvent(evnt) {
31666
- evnt.stopPropagation();
31667
- evnt.preventDefault();
31668
- var offsetX = evnt.clientX - dragClientX;
31669
- var left = dragPosLeft + offsetX;
31670
- var scrollLeft = fixedType ? 0 : tableBodyElem.scrollLeft;
31795
+ _this4.showValidTooltip(rest);
31671
31796
 
31672
- if (isLeftFixed) {
31673
- // 左固定列(不允许超过右侧固定列、不允许超过右边距)
31674
- left = Math.min(left, (rightContainer ? rightContainer.offsetLeft : tableBodyElem.clientWidth) - fixedOffsetWidth - minInterval);
31675
- } else if (isRightFixed) {
31676
- // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
31677
- dragMinLeft = (leftContainer ? leftContainer.clientWidth : 0) + fixedOffsetWidth + minInterval;
31678
- left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
31679
- } else {
31680
- dragMinLeft = Math.max(tableBodyElem.scrollLeft, dragMinLeft); // left = Math.min(left, tableBodyElem.clientWidth + tableBodyElem.scrollLeft - 40)
31797
+ return Promise.reject(rest);
31798
+ }
31799
+
31800
+ return Promise.resolve();
31801
+ });
31681
31802
  }
31803
+ }
31682
31804
 
31683
- dragLeft = Math.max(left, dragMinLeft);
31684
- resizeBarElem.style.left = "".concat(dragLeft - scrollLeft, "px");
31685
- };
31805
+ return Promise.resolve();
31806
+ },
31686
31807
 
31687
- $xetable._isResize = true;
31688
- dom.addClass($xetable.$el, 'drag--resize');
31689
- resizeBarElem.style.display = 'block';
31690
- document.onmousemove = updateEvent;
31808
+ /**
31809
+ * 弹出校验错误提示
31810
+ */
31811
+ showValidTooltip: function showValidTooltip(params) {
31812
+ var _this5 = this;
31691
31813
 
31692
- document.onmouseup = function (evnt) {
31693
- document.onmousemove = domMousemove;
31694
- document.onmouseup = domMouseup;
31695
- column.resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
31696
- resizeBarElem.style.display = 'none';
31697
- $xetable._isResize = false;
31698
- $xetable._lastResizeTime = Date.now();
31699
- $xetable.analyColumnWidth();
31700
- $xetable.recalculate(true).then(function () {
31701
- $xetable.saveCustomResizable();
31702
- $xetable.updateCellAreas();
31703
- $xetable.emitEvent('resizable-change', params, evnt);
31814
+ var $refs = this.$refs,
31815
+ height = this.height,
31816
+ tableData = this.tableData,
31817
+ validOpts = this.validOpts;
31818
+ var rule = params.rule,
31819
+ row = params.row,
31820
+ column = params.column,
31821
+ cell = params.cell;
31822
+ var validTip = $refs.validTip;
31823
+ var content = rule.content;
31824
+ return this.$nextTick(function () {
31825
+ Object.assign(_this5.validStore, {
31826
+ row: row,
31827
+ column: column,
31828
+ rule: rule,
31829
+ content: content,
31830
+ visible: true
31704
31831
  });
31705
- dom.removeClass($xetable.$el, 'drag--resize');
31706
- };
31707
31832
 
31708
- updateEvent(evnt);
31709
- $xetable.closeMenu();
31833
+ _this5.emitEvent('valid-error', params);
31834
+
31835
+ if (validTip && (validOpts.message === 'tooltip' || validOpts.message === 'default' && !height && tableData.length < 2)) {
31836
+ return validTip.open(cell, content);
31837
+ }
31838
+ });
31710
31839
  }
31711
31840
  }
31712
31841
  });
31713
- // CONCATENATED MODULE: ./packages/header/index.js
31842
+ // CONCATENATED MODULE: ./packages/validator/index.js
31714
31843
 
31715
31844
 
31716
31845
 
31717
- var Header = Object.assign(header, {
31718
- install: function install(Vue) {
31719
- Vue.component(header.name, header);
31846
+ var Validator = {
31847
+ install: function install() {
31848
+ v_x_e_table.reg('valid');
31849
+ packages_table.mixins.push(validator_src_mixin);
31720
31850
  }
31721
- });
31722
- /* harmony default export */ var packages_header = (Header);
31851
+ };
31852
+ /* harmony default export */ var validator = (Validator);
31723
31853
  // CONCATENATED MODULE: ./packages/footer/src/footer.js
31724
31854
 
31725
31855
 
@@ -34848,6 +34978,14 @@ var Checkbox = Object.assign(src_checkbox, {
34848
34978
  }
34849
34979
  }
34850
34980
  },
34981
+ inject: {
34982
+ $xeform: {
34983
+ default: null
34984
+ },
34985
+ $xeformiteminfo: {
34986
+ default: null
34987
+ }
34988
+ },
34851
34989
  provide: function provide() {
34852
34990
  return {
34853
34991
  $xecheckboxgroup: this
@@ -34865,7 +35003,7 @@ var Checkbox = Object.assign(src_checkbox, {
34865
35003
  }, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : []);
34866
35004
  },
34867
35005
  methods: {
34868
- handleChecked: function handleChecked(params) {
35006
+ handleChecked: function handleChecked(params, evnt) {
34869
35007
  var checked = params.checked,
34870
35008
  label = params.label;
34871
35009
  var checklist = this.value || [];
@@ -34882,7 +35020,11 @@ var Checkbox = Object.assign(src_checkbox, {
34882
35020
  this.$emit('input', checklist);
34883
35021
  this.$emit('change', Object.assign({
34884
35022
  checklist: checklist
34885
- }, params));
35023
+ }, params)); // 自动更新校验状态
35024
+
35025
+ if (this.$xeform && this.$xeformiteminfo) {
35026
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, checklist);
35027
+ }
34886
35028
  }
34887
35029
  }
34888
35030
  });
@@ -34928,6 +35070,14 @@ var Radio = Object.assign(src_radio, {
34928
35070
  }
34929
35071
  }
34930
35072
  },
35073
+ inject: {
35074
+ $xeform: {
35075
+ default: null
35076
+ },
35077
+ $xeformiteminfo: {
35078
+ default: null
35079
+ }
35080
+ },
34931
35081
  provide: function provide() {
34932
35082
  return {
34933
35083
  $xeradiogroup: this
@@ -34950,9 +35100,13 @@ var Radio = Object.assign(src_radio, {
34950
35100
  }, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : []);
34951
35101
  },
34952
35102
  methods: {
34953
- handleChecked: function handleChecked(params) {
35103
+ handleChecked: function handleChecked(params, evnt) {
34954
35104
  this.$emit('input', params.label);
34955
- this.$emit('change', params);
35105
+ this.$emit('change', params); // 自动更新校验状态
35106
+
35107
+ if (this.$xeform && this.$xeformiteminfo) {
35108
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, params.label);
35109
+ }
34956
35110
  }
34957
35111
  }
34958
35112
  });
@@ -34996,6 +35150,12 @@ var RadioGroup = Object.assign(radio_src_group, {
34996
35150
  inject: {
34997
35151
  $xeradiogroup: {
34998
35152
  default: null
35153
+ },
35154
+ $xeform: {
35155
+ default: null
35156
+ },
35157
+ $xeformiteminfo: {
35158
+ default: null
34999
35159
  }
35000
35160
  },
35001
35161
  computed: {
@@ -35058,10 +35218,14 @@ var RadioGroup = Object.assign(radio_src_group, {
35058
35218
  };
35059
35219
 
35060
35220
  if ($xeradiogroup) {
35061
- $xeradiogroup.handleChecked(params);
35221
+ $xeradiogroup.handleChecked(params, evnt);
35062
35222
  } else {
35063
35223
  this.$emit('input', label);
35064
- this.$emit('change', params);
35224
+ this.$emit('change', params); // 自动更新校验状态
35225
+
35226
+ if (this.$xeform && this.$xeformiteminfo) {
35227
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, label);
35228
+ }
35065
35229
  }
35066
35230
  },
35067
35231
  changeEvent: function changeEvent(evnt) {
@@ -35162,6 +35326,14 @@ var autoTxtElem;
35162
35326
  }
35163
35327
  }
35164
35328
  },
35329
+ inject: {
35330
+ $xeform: {
35331
+ default: null
35332
+ },
35333
+ $xeformiteminfo: {
35334
+ default: null
35335
+ }
35336
+ },
35165
35337
  data: function data() {
35166
35338
  return {
35167
35339
  inputValue: this.value
@@ -35288,7 +35460,11 @@ var autoTxtElem;
35288
35460
  this.$emit('change', {
35289
35461
  value: value,
35290
35462
  $event: evnt
35291
- });
35463
+ }); // 自动更新校验状态
35464
+
35465
+ if (this.$xeform && this.$xeformiteminfo) {
35466
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value);
35467
+ }
35292
35468
  }
35293
35469
  },
35294
35470
  inputEvent: function inputEvent(evnt) {
@@ -36418,9 +36594,9 @@ function destroyItem(_vm) {
36418
36594
  function assemItem(_vm) {
36419
36595
  var $el = _vm.$el,
36420
36596
  $xeform = _vm.$xeform,
36421
- xeformgather = _vm.xeformgather,
36597
+ $xeformgather = _vm.$xeformgather,
36422
36598
  itemConfig = _vm.itemConfig;
36423
- var itemGather = xeformgather ? xeformgather.itemConfig : null;
36599
+ var itemGather = $xeformgather ? $xeformgather.itemConfig : null;
36424
36600
  itemConfig.slots = _vm.$scopedSlots;
36425
36601
 
36426
36602
  if (itemGather) {
@@ -36428,188 +36604,121 @@ function assemItem(_vm) {
36428
36604
  itemGather.children = [];
36429
36605
  }
36430
36606
 
36431
- itemGather.children.splice([].indexOf.call(xeformgather.$el.children, $el), 0, itemConfig);
36607
+ itemGather.children.splice([].indexOf.call($xeformgather.$el.children, $el), 0, itemConfig);
36432
36608
  } else {
36433
36609
  $xeform.staticItems.splice([].indexOf.call($xeform.$refs.hideItem.children, $el), 0, itemConfig);
36434
36610
  }
36435
- }
36436
- // CONCATENATED MODULE: ./packages/form/src/render.js
36437
-
36438
-
36439
-
36440
-
36441
-
36442
-
36443
- function renderPrefixIcon(h, titlePrefix) {
36444
- return h('span', {
36445
- class: 'vxe-form--item-title-prefix'
36446
- }, [h('i', {
36447
- class: titlePrefix.icon || conf.icon.FORM_PREFIX
36448
- })]);
36449
- }
36450
-
36451
- function render_renderSuffixIcon(h, titleSuffix) {
36452
- return h('span', {
36453
- class: 'vxe-form--item-title-suffix'
36454
- }, [h('i', {
36455
- class: titleSuffix.icon || conf.icon.FORM_SUFFIX
36456
- })]);
36457
- }
36458
-
36459
- function renderTitle(h, _vm, item) {
36460
- var data = _vm.data,
36461
- tooltipOpts = _vm.tooltipOpts;
36462
- var slots = item.slots,
36463
- field = item.field,
36464
- itemRender = item.itemRender,
36465
- titlePrefix = item.titlePrefix,
36466
- titleSuffix = item.titleSuffix;
36467
- var compConf = isEnableConf(itemRender) ? v_x_e_table.renderer.get(itemRender.name) : null;
36468
- var params = {
36469
- data: data,
36470
- property: field,
36471
- item: item,
36472
- $form: _vm
36473
- };
36474
- var contVNs = [];
36475
- var titVNs = [];
36476
-
36477
- if (titlePrefix) {
36478
- titVNs.push(titlePrefix.content || titlePrefix.message ? h('vxe-tooltip', {
36479
- props: _objectSpread2(_objectSpread2(_objectSpread2({}, tooltipOpts), titlePrefix), {}, {
36480
- content: getFuncText(titlePrefix.content || titlePrefix.message)
36481
- })
36482
- }, [renderPrefixIcon(h, titlePrefix)]) : renderPrefixIcon(h, titlePrefix));
36483
- }
36484
-
36485
- titVNs.push(h('span', {
36486
- class: 'vxe-form--item-title-label'
36487
- }, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : slots && slots.title ? _vm.callSlot(slots.title, params, h) : getFuncText(item.title)));
36488
- contVNs.push(h('div', {
36489
- class: 'vxe-form--item-title-content'
36490
- }, titVNs));
36491
- var fixVNs = [];
36492
-
36493
- if (titleSuffix) {
36494
- fixVNs.push(titleSuffix.content || titleSuffix.message ? h('vxe-tooltip', {
36495
- props: _objectSpread2(_objectSpread2(_objectSpread2({}, tooltipOpts), titlePrefix), {}, {
36496
- content: getFuncText(titleSuffix.content || titleSuffix.message)
36497
- })
36498
- }, [render_renderSuffixIcon(h, titleSuffix)]) : render_renderSuffixIcon(h, titleSuffix));
36499
- }
36500
-
36501
- contVNs.push(h('div', {
36502
- class: 'vxe-form--item-title-postfix'
36503
- }, fixVNs));
36504
- return contVNs;
36505
- }
36506
- // CONCATENATED MODULE: ./packages/form/src/form.js
36507
-
36508
-
36509
-
36510
-
36511
-
36512
-
36513
-
36514
-
36515
-
36516
-
36517
-
36518
-
36519
-
36520
-
36521
-
36522
-
36523
-
36524
-
36525
-
36526
-
36527
-
36528
-
36529
-
36530
-
36531
-
36532
-
36533
-
36534
-
36535
- var form_Rule = /*#__PURE__*/function () {
36536
- function Rule(rule) {
36537
- _classCallCheck(this, Rule);
36538
-
36539
- Object.assign(this, {
36540
- $options: rule,
36541
- required: rule.required,
36542
- min: rule.min,
36543
- max: rule.min,
36544
- type: rule.type,
36545
- pattern: rule.pattern,
36546
- validator: rule.validator,
36547
- trigger: rule.trigger,
36548
- maxWidth: rule.maxWidth
36549
- });
36550
- }
36551
-
36552
- _createClass(Rule, [{
36553
- key: "content",
36554
- get: function get() {
36555
- return getFuncText(this.$options.content || this.$options.message);
36556
- }
36557
- }, {
36558
- key: "message",
36559
- get: function get() {
36560
- return this.content;
36561
- }
36562
- }]);
36563
-
36564
- return Rule;
36565
- }();
36566
-
36567
- function form_validErrorRuleValue(rule, val) {
36568
- var type = rule.type,
36569
- min = rule.min,
36570
- max = rule.max,
36571
- pattern = rule.pattern;
36572
- var isNumType = type === 'number';
36573
- var numVal = isNumType ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(val) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getSize(val); // 判断数值
36611
+ }
36612
+ // CONCATENATED MODULE: ./packages/form/src/render.js
36574
36613
 
36575
- if (isNumType && isNaN(val)) {
36576
- return true;
36577
- } // 如果存在 min,判断最小值
36578
36614
 
36579
36615
 
36580
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(min) && numVal < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(min)) {
36581
- return true;
36582
- } // 如果存在 max,判断最大值
36583
36616
 
36584
36617
 
36585
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(max) && numVal > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(max)) {
36586
- return true;
36587
- } // 如果存在 pattern,正则校验
36588
36618
 
36619
+ function renderPrefixIcon(h, titlePrefix) {
36620
+ return h('span', {
36621
+ class: 'vxe-form--item-title-prefix'
36622
+ }, [h('i', {
36623
+ class: titlePrefix.icon || conf.icon.FORM_PREFIX
36624
+ })]);
36625
+ }
36626
+
36627
+ function render_renderSuffixIcon(h, titleSuffix) {
36628
+ return h('span', {
36629
+ class: 'vxe-form--item-title-suffix'
36630
+ }, [h('i', {
36631
+ class: titleSuffix.icon || conf.icon.FORM_SUFFIX
36632
+ })]);
36633
+ }
36589
36634
 
36590
- if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
36591
- return true;
36635
+ function renderTitle(h, _vm, item) {
36636
+ var data = _vm.data,
36637
+ tooltipOpts = _vm.tooltipOpts;
36638
+ var slots = item.slots,
36639
+ field = item.field,
36640
+ itemRender = item.itemRender,
36641
+ titlePrefix = item.titlePrefix,
36642
+ titleSuffix = item.titleSuffix;
36643
+ var compConf = isEnableConf(itemRender) ? v_x_e_table.renderer.get(itemRender.name) : null;
36644
+ var params = {
36645
+ data: data,
36646
+ property: field,
36647
+ item: item,
36648
+ $form: _vm
36649
+ };
36650
+ var contVNs = [];
36651
+ var titVNs = [];
36652
+
36653
+ if (titlePrefix) {
36654
+ titVNs.push(titlePrefix.content || titlePrefix.message ? h('vxe-tooltip', {
36655
+ props: _objectSpread2(_objectSpread2(_objectSpread2({}, tooltipOpts), titlePrefix), {}, {
36656
+ content: getFuncText(titlePrefix.content || titlePrefix.message)
36657
+ })
36658
+ }, [renderPrefixIcon(h, titlePrefix)]) : renderPrefixIcon(h, titlePrefix));
36592
36659
  }
36593
36660
 
36594
- return false;
36595
- }
36661
+ titVNs.push(h('span', {
36662
+ class: 'vxe-form--item-title-label'
36663
+ }, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : slots && slots.title ? _vm.callSlot(slots.title, params, h) : getFuncText(item.title)));
36664
+ contVNs.push(h('div', {
36665
+ class: 'vxe-form--item-title-content'
36666
+ }, titVNs));
36667
+ var fixVNs = [];
36596
36668
 
36597
- function getResetValue(value, resetValue) {
36598
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(value)) {
36599
- resetValue = [];
36669
+ if (titleSuffix) {
36670
+ fixVNs.push(titleSuffix.content || titleSuffix.message ? h('vxe-tooltip', {
36671
+ props: _objectSpread2(_objectSpread2(_objectSpread2({}, tooltipOpts), titlePrefix), {}, {
36672
+ content: getFuncText(titleSuffix.content || titleSuffix.message)
36673
+ })
36674
+ }, [render_renderSuffixIcon(h, titleSuffix)]) : render_renderSuffixIcon(h, titleSuffix));
36600
36675
  }
36601
36676
 
36602
- return resetValue;
36677
+ contVNs.push(h('div', {
36678
+ class: 'vxe-form--item-title-postfix'
36679
+ }, fixVNs));
36680
+ return contVNs;
36603
36681
  }
36682
+ // CONCATENATED MODULE: ./packages/form/src/form-config-item.js
36604
36683
 
36605
- function renderItems(h, _vm, itemList) {
36606
- var _e = _vm._e,
36607
- rules = _vm.rules,
36608
- data = _vm.data,
36609
- collapseAll = _vm.collapseAll,
36610
- validOpts = _vm.validOpts,
36611
- allTitleOverflow = _vm.titleOverflow;
36612
- return itemList.map(function (item) {
36684
+
36685
+
36686
+
36687
+
36688
+
36689
+
36690
+
36691
+ /**
36692
+ * 配置式项
36693
+ */
36694
+
36695
+ var VxeFormConfigItem = {
36696
+ name: 'VxeFormConfigItem',
36697
+ props: {
36698
+ itemConfig: Object
36699
+ },
36700
+ inject: {
36701
+ $xeform: {
36702
+ default: null
36703
+ }
36704
+ },
36705
+ provide: function provide() {
36706
+ return {
36707
+ $xeformgather: null,
36708
+ $xeformiteminfo: {
36709
+ itemConfig: this.itemConfig
36710
+ }
36711
+ };
36712
+ },
36713
+ render: function render(h) {
36714
+ var _e = this._e,
36715
+ $xeform = this.$xeform,
36716
+ item = this.itemConfig;
36717
+ var rules = $xeform.rules,
36718
+ data = $xeform.data,
36719
+ collapseAll = $xeform.collapseAll,
36720
+ validOpts = $xeform.validOpts,
36721
+ allTitleOverflow = $xeform.titleOverflow;
36613
36722
  var slots = item.slots,
36614
36723
  title = item.title,
36615
36724
  folding = item.folding,
@@ -36624,10 +36733,12 @@ function renderItems(h, _vm, itemList) {
36624
36733
  titleOverflow = item.titleOverflow,
36625
36734
  children = item.children;
36626
36735
  var compConf = isEnableConf(itemRender) ? v_x_e_table.renderer.get(itemRender.name) : null;
36627
- var span = item.span || _vm.span;
36628
- var align = item.align || _vm.align;
36629
- var titleAlign = item.titleAlign || _vm.titleAlign;
36630
- var titleWidth = item.titleWidth || _vm.titleWidth;
36736
+ var span = item.span || $xeform.span;
36737
+ var align = item.align || $xeform.align;
36738
+ var titleAlign = item.titleAlign || $xeform.titleAlign;
36739
+ var titleWidth = item.titleWidth || $xeform.titleWidth;
36740
+ var titleColon = item.titleColon === null ? $xeform.titleColon : item.titleColon;
36741
+ var titleAsterisk = item.titleAsterisk === null ? $xeform.titleAsterisk : item.titleAsterisk;
36631
36742
  var itemVisibleMethod = visibleMethod;
36632
36743
  var itemOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isUndefined(titleOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isNull(titleOverflow) ? allTitleOverflow : titleOverflow;
36633
36744
  var showEllipsis = itemOverflow === 'ellipsis';
@@ -36639,7 +36750,7 @@ function renderItems(h, _vm, itemList) {
36639
36750
  field: field,
36640
36751
  property: field,
36641
36752
  item: item,
36642
- $form: _vm
36753
+ $form: $xeform
36643
36754
  };
36644
36755
  var isRequired;
36645
36756
 
@@ -36651,7 +36762,14 @@ function renderItems(h, _vm, itemList) {
36651
36762
  var isGather = children && children.length > 0;
36652
36763
 
36653
36764
  if (isGather) {
36654
- var childVNs = renderItems(h, _vm, item.children);
36765
+ var childVNs = item.children.map(function (childItem, index) {
36766
+ return h(VxeFormConfigItem, {
36767
+ key: index,
36768
+ props: {
36769
+ itemConfig: childItem
36770
+ }
36771
+ });
36772
+ });
36655
36773
  return childVNs.length ? h('div', {
36656
36774
  class: ['vxe-form--gather vxe-row', item.id, span ? "vxe-col--".concat(span, " is--span") : '', className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(className) ? className(params) : className : '']
36657
36775
  }, childVNs) : _e();
@@ -36674,29 +36792,34 @@ function renderItems(h, _vm, itemList) {
36674
36792
  var contentVNs = [];
36675
36793
 
36676
36794
  if (slots && slots.default) {
36677
- contentVNs = _vm.callSlot(slots.default, params, h);
36795
+ contentVNs = $xeform.callSlot(slots.default, params, h);
36678
36796
  } else if (compConf && compConf.renderItemContent) {
36679
- contentVNs = compConf.renderItemContent.call(_vm, h, itemRender, params);
36797
+ contentVNs = compConf.renderItemContent.call($xeform, h, itemRender, params);
36680
36798
  } else if (compConf && compConf.renderItem) {
36681
- contentVNs = compConf.renderItem.call(_vm, h, itemRender, params);
36799
+ contentVNs = compConf.renderItem.call($xeform, h, itemRender, params);
36682
36800
  } else if (field) {
36683
36801
  contentVNs = ["".concat(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.get(data, field))];
36684
36802
  }
36685
36803
 
36686
36804
  var ons = showTooltip ? {
36687
36805
  mouseenter: function mouseenter(evnt) {
36688
- _vm.triggerTitleTipEvent(evnt, params);
36806
+ $xeform.triggerTitleTipEvent(evnt, params);
36689
36807
  },
36690
- mouseleave: _vm.handleTitleTipLeaveEvent
36808
+ mouseleave: $xeform.handleTitleTipLeaveEvent
36691
36809
  } : {};
36692
36810
  return h('div', {
36693
36811
  class: ['vxe-form--item', item.id, span ? "vxe-col--".concat(span, " is--span") : null, className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(className) ? className(params) : className : '', {
36694
36812
  'is--title': title,
36813
+ 'is--colon': titleColon,
36814
+ 'is--asterisk': titleAsterisk,
36695
36815
  'is--required': isRequired,
36696
36816
  'is--hidden': folding && collapseAll,
36697
36817
  'is--active': !itemVisibleMethod || itemVisibleMethod(params),
36698
36818
  'is--error': showError
36699
36819
  }],
36820
+ props: {
36821
+ itemConfig: item
36822
+ },
36700
36823
  key: item.id
36701
36824
  }, [h('div', {
36702
36825
  class: 'vxe-form--item-inner'
@@ -36711,12 +36834,12 @@ function renderItems(h, _vm, itemList) {
36711
36834
  title: showTitle ? getFuncText(title) : null
36712
36835
  },
36713
36836
  on: ons
36714
- }, renderTitle(h, _vm, item)) : null, h('div', {
36837
+ }, renderTitle(h, $xeform, item)) : null, h('div', {
36715
36838
  class: ['vxe-form--item-content', align ? "align--".concat(align) : null]
36716
36839
  }, contentVNs.concat([collapseNode ? h('div', {
36717
36840
  class: 'vxe-form--item-trigger-node',
36718
36841
  on: {
36719
- click: _vm.toggleCollapseEvent
36842
+ click: $xeform.toggleCollapseEvent
36720
36843
  }
36721
36844
  }, [h('span', {
36722
36845
  class: 'vxe-form--item-trigger-text'
@@ -36728,7 +36851,106 @@ function renderItems(h, _vm, itemList) {
36728
36851
  width: "".concat(errRule.maxWidth, "px")
36729
36852
  } : null
36730
36853
  }, errRule.content) : null]))])]);
36731
- });
36854
+ }
36855
+ };
36856
+ /* harmony default export */ var form_config_item = (VxeFormConfigItem);
36857
+ // CONCATENATED MODULE: ./packages/form/src/form.js
36858
+
36859
+
36860
+
36861
+
36862
+
36863
+
36864
+
36865
+
36866
+
36867
+
36868
+
36869
+
36870
+
36871
+
36872
+
36873
+
36874
+
36875
+
36876
+
36877
+
36878
+
36879
+
36880
+
36881
+
36882
+
36883
+
36884
+
36885
+
36886
+ var form_Rule = /*#__PURE__*/function () {
36887
+ function Rule(rule) {
36888
+ _classCallCheck(this, Rule);
36889
+
36890
+ Object.assign(this, {
36891
+ $options: rule,
36892
+ required: rule.required,
36893
+ min: rule.min,
36894
+ max: rule.min,
36895
+ type: rule.type,
36896
+ pattern: rule.pattern,
36897
+ validator: rule.validator,
36898
+ trigger: rule.trigger,
36899
+ maxWidth: rule.maxWidth
36900
+ });
36901
+ }
36902
+
36903
+ _createClass(Rule, [{
36904
+ key: "content",
36905
+ get: function get() {
36906
+ return getFuncText(this.$options.content || this.$options.message);
36907
+ }
36908
+ }, {
36909
+ key: "message",
36910
+ get: function get() {
36911
+ return this.content;
36912
+ }
36913
+ }]);
36914
+
36915
+ return Rule;
36916
+ }();
36917
+
36918
+ function form_validErrorRuleValue(rule, val) {
36919
+ var type = rule.type,
36920
+ min = rule.min,
36921
+ max = rule.max,
36922
+ pattern = rule.pattern;
36923
+ var isNumType = type === 'number';
36924
+ var numVal = isNumType ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(val) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getSize(val); // 判断数值
36925
+
36926
+ if (isNumType && isNaN(val)) {
36927
+ return true;
36928
+ } // 如果存在 min,判断最小值
36929
+
36930
+
36931
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(min) && numVal < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(min)) {
36932
+ return true;
36933
+ } // 如果存在 max,判断最大值
36934
+
36935
+
36936
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.eqNull(max) && numVal > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(max)) {
36937
+ return true;
36938
+ } // 如果存在 pattern,正则校验
36939
+
36940
+
36941
+ if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
36942
+ return true;
36943
+ }
36944
+
36945
+ return false;
36946
+ }
36947
+
36948
+ function getResetValue(value, resetValue) {
36949
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(value)) {
36950
+ resetValue = [];
36951
+ }
36952
+
36953
+ return resetValue;
36732
36954
  }
36733
36955
 
36734
36956
  /* harmony default export */ var src_form = ({
@@ -36819,7 +37041,10 @@ function renderItems(h, _vm, itemList) {
36819
37041
  },
36820
37042
  provide: function provide() {
36821
37043
  return {
36822
- $xeform: this
37044
+ $xeform: this,
37045
+ $xeformgather: null,
37046
+ $xeformitem: null,
37047
+ $xeformiteminfo: null
36823
37048
  };
36824
37049
  },
36825
37050
  computed: {
@@ -36866,22 +37091,30 @@ function renderItems(h, _vm, itemList) {
36866
37091
  formItems = this.formItems,
36867
37092
  customLayout = this.customLayout;
36868
37093
  var hasUseTooltip = v_x_e_table._tooltip;
37094
+ var defaultSlot = this.$scopedSlots.default;
36869
37095
  return h('form', {
36870
37096
  class: ['vxe-form', className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isFunction(className) ? className({
36871
37097
  items: formItems,
36872
37098
  data: data,
36873
37099
  $form: this
36874
- }) : className : '', (_ref = {}, _defineProperty(_ref, "size--".concat(vSize), vSize), _defineProperty(_ref, 'is--colon', this.titleColon), _defineProperty(_ref, 'is--asterisk', this.titleAsterisk), _defineProperty(_ref, 'is--loading', loading), _ref)],
37100
+ }) : className : '', (_ref = {}, _defineProperty(_ref, "size--".concat(vSize), vSize), _defineProperty(_ref, 'is--loading', loading), _ref)],
36875
37101
  on: {
36876
37102
  submit: this.submitEvent,
36877
37103
  reset: this.resetEvent
36878
37104
  }
36879
37105
  }, [h('div', {
36880
37106
  class: 'vxe-form--wrapper vxe-row'
36881
- }, customLayout ? this.$slots.default : renderItems(h, this, formItems)), h('div', {
37107
+ }, customLayout ? defaultSlot ? defaultSlot.call(this, h, {}) : [] : formItems.map(function (item, index) {
37108
+ return h(form_config_item, {
37109
+ key: index,
37110
+ props: {
37111
+ itemConfig: item
37112
+ }
37113
+ });
37114
+ })), h('div', {
36882
37115
  class: 'vxe-form-slots',
36883
37116
  ref: 'hideItem'
36884
- }, customLayout ? [] : this.$slots.default), h('div', {
37117
+ }, customLayout ? [] : defaultSlot ? defaultSlot.call(this, h, {}) : []), h('div', {
36885
37118
  class: ['vxe-loading', {
36886
37119
  'is--visible': loading
36887
37120
  }]
@@ -37260,7 +37493,7 @@ function renderItems(h, _vm, itemList) {
37260
37493
  }
37261
37494
  } else {
37262
37495
  var isArrType = type === 'array';
37263
- var hasEmpty = isArrType ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(itemValue) || !itemValue.length : eqEmptyValue(itemValue);
37496
+ var hasEmpty = isArrType || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(itemValue) ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isArray(itemValue) || !itemValue.length : eqEmptyValue(itemValue);
37264
37497
 
37265
37498
  if (required ? hasEmpty || form_validErrorRuleValue(rule, itemValue) : !hasEmpty && form_validErrorRuleValue(rule, itemValue)) {
37266
37499
  errorRules.push(new form_Rule(rule));
@@ -37321,24 +37554,16 @@ function renderItems(h, _vm, itemList) {
37321
37554
  }
37322
37555
  });
37323
37556
  },
37324
-
37325
- /**
37326
- * 更新项状态
37327
- * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
37328
- * 如果单元格配置了校验规则,则会进行校验
37329
- */
37330
- updateStatus: function updateStatus(scope, itemValue) {
37557
+ triggerItemEvent: function triggerItemEvent(evnt, field, itemValue) {
37331
37558
  var _this9 = this;
37332
37559
 
37333
- var property = scope.property;
37334
-
37335
- if (property) {
37336
- this.validItemRules('change', property, itemValue).then(function () {
37337
- _this9.clearValidate(property);
37560
+ if (field) {
37561
+ return this.validItemRules(evnt ? evnt.type : 'all', field, itemValue).then(function () {
37562
+ _this9.clearValidate(field);
37338
37563
  }).catch(function (_ref3) {
37339
37564
  var rule = _ref3.rule;
37340
37565
 
37341
- var item = _this9.getItemByField(property);
37566
+ var item = _this9.getItemByField(field);
37342
37567
 
37343
37568
  if (item) {
37344
37569
  item.showError = true;
@@ -37346,6 +37571,18 @@ function renderItems(h, _vm, itemList) {
37346
37571
  }
37347
37572
  });
37348
37573
  }
37574
+
37575
+ return this.$nextTick();
37576
+ },
37577
+
37578
+ /**
37579
+ * 更新项状态
37580
+ * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
37581
+ * 如果单元格配置了校验规则,则会进行校验
37582
+ */
37583
+ updateStatus: function updateStatus(scope, itemValue) {
37584
+ var field = scope.field;
37585
+ return this.triggerItemEvent(new Event('change'), field, itemValue);
37349
37586
  }
37350
37587
  }
37351
37588
  });
@@ -37379,6 +37616,14 @@ var form_item_props = {
37379
37616
  align: String,
37380
37617
  titleAlign: String,
37381
37618
  titleWidth: [String, Number],
37619
+ titleColon: {
37620
+ type: Boolean,
37621
+ default: null
37622
+ },
37623
+ titleAsterisk: {
37624
+ type: Boolean,
37625
+ default: null
37626
+ },
37382
37627
  className: [String, Function],
37383
37628
  titleOverflow: {
37384
37629
  type: [Boolean, String],
@@ -37520,10 +37765,18 @@ var form_item_renderItem = function renderItem(h, _vm, item, slots) {
37520
37765
  $xeform: {
37521
37766
  default: null
37522
37767
  },
37523
- xeformgather: {
37768
+ $xeformgather: {
37524
37769
  default: null
37525
37770
  }
37526
37771
  },
37772
+ provide: function provide() {
37773
+ return {
37774
+ $xeformitem: this,
37775
+ $xeformiteminfo: {
37776
+ itemConfig: this.itemConfig
37777
+ }
37778
+ };
37779
+ },
37527
37780
  data: function data() {
37528
37781
  return {
37529
37782
  itemConfig: null
@@ -37562,7 +37815,11 @@ var FormItem = Object.assign(form_item, {
37562
37815
  extends: form_item,
37563
37816
  provide: function provide() {
37564
37817
  return {
37565
- xeformgather: this
37818
+ $xeformgather: this,
37819
+ xeformitem: null,
37820
+ $xeformiteminfo: {
37821
+ itemConfig: this.itemConfig
37822
+ }
37566
37823
  };
37567
37824
  },
37568
37825
  created: function created() {
@@ -37708,6 +37965,14 @@ var Option = Object.assign(src_option, {
37708
37965
  openIcon: String,
37709
37966
  closeIcon: String
37710
37967
  },
37968
+ inject: {
37969
+ $xeform: {
37970
+ default: null
37971
+ },
37972
+ $xeformiteminfo: {
37973
+ default: null
37974
+ }
37975
+ },
37711
37976
  data: function data() {
37712
37977
  return {
37713
37978
  isActivated: false,
@@ -37798,7 +38063,12 @@ var Option = Object.assign(src_option, {
37798
38063
  this.$emit('change', {
37799
38064
  value: value,
37800
38065
  $event: evnt
37801
- });
38066
+ }); // 自动更新校验状态
38067
+
38068
+ if (this.$xeform && this.$xeformiteminfo) {
38069
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value);
38070
+ }
38071
+
37802
38072
  this.activeTimeout = setTimeout(function () {
37803
38073
  _this2.hasAnimat = false;
37804
38074
  }, 400);
@@ -38886,13 +39156,12 @@ var Pulldown = Object.assign(pulldown, {
38886
39156
 
38887
39157
 
38888
39158
 
38889
-
38890
39159
 
38891
39160
 
38892
39161
  // 按需加载的组件
38893
39162
 
38894
39163
  var components = [// 功能模块
38895
- Header, Footer, Icon, Filter, Menu, Edit, Export, Keyboard, Validator, // 可选组件
39164
+ Footer, Icon, Filter, Menu, Edit, Export, Keyboard, Validator, // 可选组件
38896
39165
  Column, Colgroup, Grid, Toolbar, Pager, Checkbox, CheckboxGroup, Radio, RadioGroup, RadioButton, Input, Textarea, Button, Modal, Tooltip, Form, FormItem, FormGather, Select, Optgroup, Option, Switch, List, Pulldown, // 核心
38897
39166
  Table]; // 默认安装
38898
39167