vxe-table 3.4.15 → 3.5.0-beta.2

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 (168) hide show
  1. package/README.md +1 -1
  2. package/helper/vetur/attributes.json +30 -10
  3. package/helper/vetur/tags.json +7 -2
  4. package/lib/button/src/button.js +19 -9
  5. package/lib/button/src/button.min.js +1 -1
  6. package/lib/checkbox/src/checkbox.js +2 -2
  7. package/lib/checkbox/src/checkbox.min.js +1 -1
  8. package/lib/edit/src/mixin.js +26 -18
  9. package/lib/edit/src/mixin.min.js +1 -1
  10. package/lib/export/src/export-panel.js +2 -2
  11. package/lib/export/src/export-panel.min.js +1 -1
  12. package/lib/export/src/import-panel.js +2 -2
  13. package/lib/export/src/import-panel.min.js +1 -1
  14. package/lib/export/src/mixin.js +26 -24
  15. package/lib/export/src/mixin.min.js +1 -1
  16. package/lib/filter/src/mixin.js +4 -4
  17. package/lib/filter/src/mixin.min.js +1 -1
  18. package/lib/filter/src/panel.js +2 -2
  19. package/lib/filter/src/panel.min.js +1 -1
  20. package/lib/footer/src/footer.js +7 -4
  21. package/lib/footer/src/footer.min.js +1 -1
  22. package/lib/form/src/form-gather.js +2 -2
  23. package/lib/form/src/form-gather.min.js +1 -1
  24. package/lib/form/src/form-item.js +5 -5
  25. package/lib/form/src/form-item.min.js +1 -1
  26. package/lib/form/src/form.js +49 -64
  27. package/lib/form/src/form.min.js +1 -1
  28. package/lib/form/src/render.js +17 -14
  29. package/lib/form/src/render.min.js +1 -1
  30. package/lib/form/src/util.js +2 -2
  31. package/lib/form/src/util.min.js +1 -1
  32. package/lib/grid/src/grid.js +44 -34
  33. package/lib/grid/src/grid.min.js +1 -1
  34. package/lib/header/src/header.js +10 -8
  35. package/lib/header/src/header.min.js +1 -1
  36. package/lib/index.css +1 -1
  37. package/lib/index.umd.js +2390 -1553
  38. package/lib/index.umd.min.js +1 -2
  39. package/lib/input/src/input.js +30 -18
  40. package/lib/input/src/input.min.js +1 -1
  41. package/lib/keyboard/src/mixin.js +12 -8
  42. package/lib/keyboard/src/mixin.min.js +1 -1
  43. package/lib/list/src/list.js +7 -5
  44. package/lib/list/src/list.min.js +1 -1
  45. package/lib/menu/src/mixin.js +24 -14
  46. package/lib/menu/src/mixin.min.js +1 -1
  47. package/lib/menu/src/panel.js +3 -3
  48. package/lib/menu/src/panel.min.js +1 -1
  49. package/lib/modal/src/modal.js +24 -12
  50. package/lib/modal/src/modal.min.js +1 -1
  51. package/lib/pulldown/src/pulldown.js +16 -12
  52. package/lib/pulldown/src/pulldown.min.js +1 -1
  53. package/lib/radio/src/button.js +2 -2
  54. package/lib/radio/src/button.min.js +1 -1
  55. package/lib/radio/src/radio.js +2 -2
  56. package/lib/radio/src/radio.min.js +1 -1
  57. package/lib/select/src/select.js +42 -21
  58. package/lib/select/src/select.min.js +1 -1
  59. package/lib/select/style/style.css +1 -1
  60. package/lib/select/style/style.min.css +1 -1
  61. package/lib/style.css +1 -1
  62. package/lib/style.min.css +1 -1
  63. package/lib/switch/src/switch.js +4 -4
  64. package/lib/switch/src/switch.min.js +1 -1
  65. package/lib/table/src/body.js +34 -36
  66. package/lib/table/src/body.min.js +1 -1
  67. package/lib/table/src/cell.js +22 -14
  68. package/lib/table/src/cell.min.js +1 -1
  69. package/lib/table/src/column.js +6 -4
  70. package/lib/table/src/column.min.js +1 -1
  71. package/lib/table/src/columnInfo.js +202 -0
  72. package/lib/table/src/columnInfo.min.js +1 -0
  73. package/lib/table/src/methods.js +247 -263
  74. package/lib/table/src/methods.min.js +1 -1
  75. package/lib/table/src/table.js +104 -129
  76. package/lib/table/src/table.min.js +1 -1
  77. package/lib/table/src/util.js +52 -3
  78. package/lib/table/src/util.min.js +1 -1
  79. package/lib/textarea/src/textarea.js +2 -2
  80. package/lib/textarea/src/textarea.min.js +1 -1
  81. package/lib/toolbar/src/toolbar.js +16 -10
  82. package/lib/toolbar/src/toolbar.min.js +1 -1
  83. package/lib/tools/{src/dom.js → dom.js} +0 -0
  84. package/lib/tools/{src/dom.min.js → dom.min.js} +0 -0
  85. package/lib/tools/{src/event.js → event.js} +3 -6
  86. package/lib/tools/event.min.js +1 -0
  87. package/lib/tools/log.js +29 -0
  88. package/lib/tools/log.min.js +1 -0
  89. package/lib/tools/{src/resize.js → resize.js} +1 -1
  90. package/lib/tools/resize.min.js +1 -0
  91. package/lib/tools/utils.js +142 -0
  92. package/lib/tools/utils.min.js +1 -0
  93. package/lib/tooltip/src/tooltip.js +59 -34
  94. package/lib/tooltip/src/tooltip.min.js +1 -1
  95. package/lib/tooltip/style/style.css +1 -1
  96. package/lib/tooltip/style/style.min.css +1 -1
  97. package/lib/v-x-e-table/index.js +7 -4
  98. package/lib/v-x-e-table/index.min.js +1 -1
  99. package/lib/v-x-e-table/src/conf.js +14 -7
  100. package/lib/v-x-e-table/src/conf.min.js +1 -1
  101. package/lib/v-x-e-table/src/interceptor.js +4 -4
  102. package/lib/v-x-e-table/src/interceptor.min.js +1 -1
  103. package/lib/v-x-e-table/src/renderer.js +18 -10
  104. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  105. package/lib/v-x-e-table/src/store.js +3 -3
  106. package/lib/v-x-e-table/src/store.min.js +1 -1
  107. package/lib/validator/src/mixin.js +4 -4
  108. package/lib/validator/src/mixin.min.js +1 -1
  109. package/package.json +1 -1
  110. package/packages/button/src/button.js +4 -2
  111. package/packages/checkbox/src/checkbox.js +2 -2
  112. package/packages/edit/src/mixin.js +7 -6
  113. package/packages/export/src/export-panel.js +1 -1
  114. package/packages/export/src/import-panel.js +1 -1
  115. package/packages/export/src/mixin.js +20 -19
  116. package/packages/filter/src/mixin.js +3 -3
  117. package/packages/filter/src/panel.js +1 -1
  118. package/packages/footer/src/footer.js +4 -2
  119. package/packages/form/src/form-gather.js +2 -2
  120. package/packages/form/src/form-item.js +4 -4
  121. package/packages/form/src/form.js +19 -32
  122. package/packages/form/src/render.js +9 -9
  123. package/packages/form/src/util.js +2 -2
  124. package/packages/grid/src/grid.js +22 -20
  125. package/packages/header/src/header.js +3 -2
  126. package/packages/input/src/input.js +6 -3
  127. package/packages/keyboard/src/mixin.js +1 -2
  128. package/packages/list/src/list.js +3 -2
  129. package/packages/menu/src/mixin.js +5 -3
  130. package/packages/menu/src/panel.js +3 -3
  131. package/packages/modal/src/modal.js +7 -4
  132. package/packages/pulldown/src/pulldown.js +3 -1
  133. package/packages/radio/src/button.js +2 -2
  134. package/packages/radio/src/radio.js +2 -2
  135. package/packages/select/src/select.js +19 -8
  136. package/packages/switch/src/switch.js +4 -4
  137. package/packages/table/src/body.js +26 -25
  138. package/packages/table/src/cell.js +8 -7
  139. package/packages/table/src/column.js +4 -2
  140. package/packages/table/src/columnInfo.js +149 -0
  141. package/packages/table/src/methods.js +73 -95
  142. package/packages/table/src/table.js +73 -103
  143. package/packages/table/src/util.js +30 -1
  144. package/packages/textarea/src/textarea.js +2 -2
  145. package/packages/toolbar/src/toolbar.js +7 -4
  146. package/packages/tools/{src/dom.js → dom.js} +0 -0
  147. package/packages/tools/{src/event.js → event.js} +1 -3
  148. package/packages/tools/log.js +16 -0
  149. package/packages/tools/{src/resize.js → resize.js} +1 -1
  150. package/packages/tools/utils.js +97 -0
  151. package/packages/tooltip/src/tooltip.js +46 -26
  152. package/packages/v-x-e-table/index.js +4 -2
  153. package/packages/v-x-e-table/src/conf.js +14 -7
  154. package/packages/v-x-e-table/src/interceptor.js +3 -3
  155. package/packages/v-x-e-table/src/renderer.js +4 -3
  156. package/packages/v-x-e-table/src/store.js +2 -2
  157. package/packages/validator/src/mixin.js +3 -3
  158. package/styles/select.scss +1 -1
  159. package/styles/tooltip.scss +1 -1
  160. package/types/v-x-e-table/index.d.ts +8 -0
  161. package/lib/tools/index.js +0 -76
  162. package/lib/tools/index.min.js +0 -1
  163. package/lib/tools/src/event.min.js +0 -1
  164. package/lib/tools/src/resize.min.js +0 -1
  165. package/lib/tools/src/utils.js +0 -365
  166. package/lib/tools/src/utils.min.js +0 -1
  167. package/packages/tools/index.js +0 -14
  168. package/packages/tools/src/utils.js +0 -272
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _tools=require("../../tools"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var Store=function(){function r(){_classCallCheck(this,r),this.store={}}return _createClass(r,[{key:"mixin",value:function(e){return Object.assign(this.store,e),r}},{key:"get",value:function(e){return this.store[e]}},{key:"add",value:function(e,t){return"development"===process.env.NODE_ENV&&(_xeUtils.default.eqNull(this.store[e])||this.store[e]===t||_tools.UtilTools.warn("vxe.error.coverProp",[this._name,e])),this.store[e]=t,r}},{key:"delete",value:function(e){return delete this.store[e],r}}]),r}(),_default=Store;exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_log=require("../../tools/log");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var Store=function(){function r(){_classCallCheck(this,r),this.store={}}return _createClass(r,[{key:"mixin",value:function(e){return Object.assign(this.store,e),r}},{key:"get",value:function(e){return this.store[e]}},{key:"add",value:function(e,t){return"development"===process.env.NODE_ENV&&(_xeUtils.default.eqNull(this.store[e])||this.store[e]===t||(0,_log.warnLog)("vxe.error.coverProp",[this._name,e])),this.store[e]=t,r}},{key:"delete",value:function(e){return delete this.store[e],r}}]),r}(),_default=Store;exports.default=_default;
@@ -9,9 +9,9 @@ var _xeUtils = _interopRequireDefault(require("xe-utils"));
9
9
 
10
10
  var _conf = _interopRequireDefault(require("../../v-x-e-table/src/conf"));
11
11
 
12
- var _tools = require("../../tools");
12
+ var _utils = require("../../tools/utils");
13
13
 
14
- var _utils = require("../../tools/src/utils");
14
+ var _dom = _interopRequireDefault(require("../../tools/dom"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
@@ -49,7 +49,7 @@ var Rule = /*#__PURE__*/function () {
49
49
  _createClass(Rule, [{
50
50
  key: "content",
51
51
  get: function get() {
52
- return _tools.UtilTools.getFuncText(this.$options.content || this.$options.message);
52
+ return (0, _utils.getFuncText)(this.$options.content || this.$options.message);
53
53
  }
54
54
  }, {
55
55
  key: "message",
@@ -247,7 +247,7 @@ var _default = {
247
247
  var posAndFinish = function posAndFinish() {
248
248
  firstErrParams.cell = _this2.getCell(firstErrParams.row, firstErrParams.column);
249
249
 
250
- _tools.DomTools.scrollToView(firstErrParams.cell);
250
+ _dom.default.scrollToView(firstErrParams.cell);
251
251
 
252
252
  _this2.handleValidError(firstErrParams).then(finish);
253
253
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_tools=require("../../tools"),_utils=require("../../tools/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var l=t[r];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var Rule=function(){function t(e){_classCallCheck(this,t),Object.assign(this,{$options:e,required:e.required,min:e.min,max:e.max,type:e.type,pattern:e.pattern,validator:e.validator,trigger:e.trigger,maxWidth:e.maxWidth})}return _createClass(t,[{key:"content",get:function(){return _tools.UtilTools.getFuncText(this.$options.content||this.$options.message)}},{key:"message",get:function(){return this.content}}]),t}();function validErrorRuleValue(e,t){var r=e.type,l=e.min,i=e.max,n=e.pattern,e="number"===r,r=e?_xeUtils.default.toNumber(t):_xeUtils.default.getSize(t);return!(!e||!isNaN(t))||(!_xeUtils.default.eqNull(l)&&r<_xeUtils.default.toNumber(l)||(!_xeUtils.default.eqNull(i)&&r>_xeUtils.default.toNumber(i)||!(!n||(_xeUtils.default.isRegExp(n)?n:new RegExp(n)).test(t))))}var _default={methods:{_fullValidate:function(e,t){return this.beginValidate(e,t,!0)},_validate:function(e,t){return this.beginValidate(e,t)},handleValidError:function(t){var r=this;return new Promise(function(e){!1===r.validOpts.autoPos?(r.emitEvent("valid-error",t),e()):r.handleActived(t,{type:"valid-error",trigger:"call"}).then(function(){setTimeout(function(){e(r.showValidTooltip(t))},10)})})},beginValidate:function(e,u,l){var a=this,s={},i=this.editRules,c=this.afterFullData,d=this.treeConfig,t=this.treeOpts;!0===e?r=c:e&&(_xeUtils.default.isFunction(e)?u=e:r=_xeUtils.default.isArray(e)?e:[e]);var r=r||this.getInsertRecords().concat(this.getUpdateRecords()),n=[];if(this.lastCallTime=Date.now(),this.validRuleErr=!1,this.clearValidate(),i){var o=this.getColumns(),e=function(r){var e;!l&&a.validRuleErr||(e=[],o.forEach(function(t){!l&&a.validRuleErr||!_xeUtils.default.has(i,t.property)||e.push(a.validCellRules("all",r,t).catch(function(e){e={rule:e.rule,rules:e.rules,rowIndex:a.getRowIndex(r),row:r,columnIndex:a.getColumnIndex(t),column:t,field:t.property,$table:a};if(s[t.property]||(s[t.property]=[]),s[t.property].push(e),!l)return a.validRuleErr=!0,Promise.reject(e)}))}),n.push(Promise.all(e)))};return d?_xeUtils.default.eachTree(r,e,t):r.forEach(e),Promise.all(n).then(function(){var e=Object.keys(s);return a.$nextTick().then(function(){return e.length?Promise.reject(s[e[0]][0]):void(u&&u())})}).catch(function(o){return new Promise(function(e,t){function r(){a.$nextTick(function(){u?(u(s),e()):("obsolete"===_conf.default.validToReject?t:e)(s)})}function l(){o.cell=a.getCell(o.row,o.column),_tools.DomTools.scrollToView(o.cell),a.handleValidError(o).then(r)}var i=o.row,n=c.indexOf(i),i=0<n?c[n-1]:i;!1===a.validOpts.autoPos?r():(d?a.scrollToTreeRow(i):a.scrollToRow(i)).then(l)})})}return this.$nextTick().then(function(){u&&u()})},hasCellRules:function(t,e,r){var l=this.editRules,r=r.property;if(r&&l){r=_xeUtils.default.get(l,r);return r&&_xeUtils.default.find(r,function(e){return"all"===t||!e.trigger||t===e.trigger})}return!1},validCellRules:function(n,o,u,e){var a,s,c=this,t=this.editRules,r=u.property,d=[],f=[];return r&&t&&((a=_xeUtils.default.get(t,r))&&(s=_xeUtils.default.isUndefined(e)?_xeUtils.default.get(o,r):e,a.forEach(function(t){var e,r=t.type,l=t.trigger,i=t.required;"all"!==n&&l&&n!==l||(_xeUtils.default.isFunction(t.validator)?(e=t.validator({cellValue:s,rule:t,rules:a,row:o,rowIndex:c.getRowIndex(o),column:u,columnIndex:c.getColumnIndex(u),field:u.property,$table:c}))&&(_xeUtils.default.isError(e)?(c.validRuleErr=!0,d.push(new Rule({type:"custom",trigger:l,content:e.message,rule:new Rule(t)}))):e.catch&&f.push(e.catch(function(e){c.validRuleErr=!0,d.push(new Rule({type:"custom",trigger:l,content:e&&e.message?e.message:t.content||t.message,rule:new Rule(t)}))}))):(r="array"===r?!_xeUtils.default.isArray(s)||!s.length:(0,_utils.eqEmptyValue)(s),(i?r||validErrorRuleValue(t,s):!r&&validErrorRuleValue(t,s))&&(c.validRuleErr=!0,d.push(new Rule(t)))))}))),Promise.all(f).then(function(){if(d.length){var e={rules:d,rule:d[0]};return Promise.reject(e)}})},_clearValidate:function(){var e=this.$refs.validTip;return Object.assign(this.validStore,{visible:!1,row:null,column:null,content:"",rule:null}),e&&e.visible&&e.close(),this.$nextTick()},triggerValidate:function(t){var r=this,e=this.editConfig,l=this.editStore,i=this.editRules,n=this.validStore,l=l.actived;if(l.row&&i){var l=l.args,o=l.row,u=l.column,a=l.cell;if(this.hasCellRules(t,o,u))return this.validCellRules(t,o,u).then(function(){"row"===e.mode&&n.visible&&n.row===o&&n.column===u&&r.clearValidate()}).catch(function(e){e=e.rule;if(e.trigger&&t!==e.trigger)return Promise.resolve();e={rule:e,row:o,column:u,cell:a};return r.showValidTooltip(e),Promise.reject(e)})}return Promise.resolve()},showValidTooltip:function(e){var t=this,r=this.$refs,l=this.height,i=this.tableData,n=this.validOpts,o=e.rule,u=e.row,a=e.column,s=e.cell,c=r.validTip,d=o.content;return this.$nextTick(function(){if(Object.assign(t.validStore,{row:u,column:a,rule:o,content:d,visible:!0}),t.emitEvent("valid-error",e),c&&("tooltip"===n.message||"default"===n.message&&!l&&i.length<2))return c.open(s,d)})}}};exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_utils=require("../../tools/utils"),_dom=_interopRequireDefault(require("../../tools/dom"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var Rule=function(){function t(e){_classCallCheck(this,t),Object.assign(this,{$options:e,required:e.required,min:e.min,max:e.max,type:e.type,pattern:e.pattern,validator:e.validator,trigger:e.trigger,maxWidth:e.maxWidth})}return _createClass(t,[{key:"content",get:function(){return(0,_utils.getFuncText)(this.$options.content||this.$options.message)}},{key:"message",get:function(){return this.content}}]),t}();function validErrorRuleValue(e,t){var r=e.type,i=e.min,l=e.max,n=e.pattern,e="number"===r,r=e?_xeUtils.default.toNumber(t):_xeUtils.default.getSize(t);return!(!e||!isNaN(t))||(!_xeUtils.default.eqNull(i)&&r<_xeUtils.default.toNumber(i)||(!_xeUtils.default.eqNull(l)&&r>_xeUtils.default.toNumber(l)||!(!n||(_xeUtils.default.isRegExp(n)?n:new RegExp(n)).test(t))))}var _default={methods:{_fullValidate:function(e,t){return this.beginValidate(e,t,!0)},_validate:function(e,t){return this.beginValidate(e,t)},handleValidError:function(t){var r=this;return new Promise(function(e){!1===r.validOpts.autoPos?(r.emitEvent("valid-error",t),e()):r.handleActived(t,{type:"valid-error",trigger:"call"}).then(function(){setTimeout(function(){e(r.showValidTooltip(t))},10)})})},beginValidate:function(e,o,i){var a=this,s={},l=this.editRules,c=this.afterFullData,d=this.treeConfig,t=this.treeOpts;!0===e?r=c:e&&(_xeUtils.default.isFunction(e)?o=e:r=_xeUtils.default.isArray(e)?e:[e]);var r=r||this.getInsertRecords().concat(this.getUpdateRecords()),n=[];if(this.lastCallTime=Date.now(),this.validRuleErr=!1,this.clearValidate(),l){var u=this.getColumns(),e=function(r){var e;!i&&a.validRuleErr||(e=[],u.forEach(function(t){!i&&a.validRuleErr||!_xeUtils.default.has(l,t.property)||e.push(a.validCellRules("all",r,t).catch(function(e){e={rule:e.rule,rules:e.rules,rowIndex:a.getRowIndex(r),row:r,columnIndex:a.getColumnIndex(t),column:t,field:t.property,$table:a};if(s[t.property]||(s[t.property]=[]),s[t.property].push(e),!i)return a.validRuleErr=!0,Promise.reject(e)}))}),n.push(Promise.all(e)))};return d?_xeUtils.default.eachTree(r,e,t):r.forEach(e),Promise.all(n).then(function(){var e=Object.keys(s);return a.$nextTick().then(function(){return e.length?Promise.reject(s[e[0]][0]):void(o&&o())})}).catch(function(u){return new Promise(function(e,t){function r(){a.$nextTick(function(){o?(o(s),e()):("obsolete"===_conf.default.validToReject?t:e)(s)})}function i(){u.cell=a.getCell(u.row,u.column),_dom.default.scrollToView(u.cell),a.handleValidError(u).then(r)}var l=u.row,n=c.indexOf(l),l=0<n?c[n-1]:l;!1===a.validOpts.autoPos?r():(d?a.scrollToTreeRow(l):a.scrollToRow(l)).then(i)})})}return this.$nextTick().then(function(){o&&o()})},hasCellRules:function(t,e,r){var i=this.editRules,r=r.property;if(r&&i){r=_xeUtils.default.get(i,r);return r&&_xeUtils.default.find(r,function(e){return"all"===t||!e.trigger||t===e.trigger})}return!1},validCellRules:function(n,u,o,e){var a,s,c=this,t=this.editRules,r=o.property,d=[],f=[];return r&&t&&((a=_xeUtils.default.get(t,r))&&(s=_xeUtils.default.isUndefined(e)?_xeUtils.default.get(u,r):e,a.forEach(function(t){var e,r=t.type,i=t.trigger,l=t.required;"all"!==n&&i&&n!==i||(_xeUtils.default.isFunction(t.validator)?(e=t.validator({cellValue:s,rule:t,rules:a,row:u,rowIndex:c.getRowIndex(u),column:o,columnIndex:c.getColumnIndex(o),field:o.property,$table:c}))&&(_xeUtils.default.isError(e)?(c.validRuleErr=!0,d.push(new Rule({type:"custom",trigger:i,content:e.message,rule:new Rule(t)}))):e.catch&&f.push(e.catch(function(e){c.validRuleErr=!0,d.push(new Rule({type:"custom",trigger:i,content:e&&e.message?e.message:t.content||t.message,rule:new Rule(t)}))}))):(r="array"===r?!_xeUtils.default.isArray(s)||!s.length:(0,_utils.eqEmptyValue)(s),(l?r||validErrorRuleValue(t,s):!r&&validErrorRuleValue(t,s))&&(c.validRuleErr=!0,d.push(new Rule(t)))))}))),Promise.all(f).then(function(){if(d.length){var e={rules:d,rule:d[0]};return Promise.reject(e)}})},_clearValidate:function(){var e=this.$refs.validTip;return Object.assign(this.validStore,{visible:!1,row:null,column:null,content:"",rule:null}),e&&e.visible&&e.close(),this.$nextTick()},triggerValidate:function(t){var r=this,e=this.editConfig,i=this.editStore,l=this.editRules,n=this.validStore,i=i.actived;if(i.row&&l){var i=i.args,u=i.row,o=i.column,a=i.cell;if(this.hasCellRules(t,u,o))return this.validCellRules(t,u,o).then(function(){"row"===e.mode&&n.visible&&n.row===u&&n.column===o&&r.clearValidate()}).catch(function(e){e=e.rule;if(e.trigger&&t!==e.trigger)return Promise.resolve();e={rule:e,row:u,column:o,cell:a};return r.showValidTooltip(e),Promise.reject(e)})}return Promise.resolve()},showValidTooltip:function(e){var t=this,r=this.$refs,i=this.height,l=this.tableData,n=this.validOpts,u=e.rule,o=e.row,a=e.column,s=e.cell,c=r.validTip,d=u.content;return this.$nextTick(function(){if(Object.assign(t.validStore,{row:o,column:a,rule:u,content:d,visible:!0}),t.emitEvent("valid-error",e),c&&("tooltip"===n.message||"default"===n.message&&!i&&l.length<2))return c.open(s,d)})}}};exports.default=_default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.4.15",
3
+ "version": "3.5.0-beta.2",
4
4
  "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、贼灵活的配置项、扩展接口等...",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,7 +1,9 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import vSize from '../../mixins/size'
4
- import { UtilTools, DomTools, GlobalEvent } from '../../tools'
4
+ import UtilTools, { getFuncText } from '../../tools/utils'
5
+ import DomTools from '../../tools/dom'
6
+ import { GlobalEvent } from '../../tools/event'
5
7
 
6
8
  export default {
7
9
  name: 'VxeButton',
@@ -155,7 +157,7 @@ export default {
155
157
  contents.push(
156
158
  h('span', {
157
159
  class: 'vxe-button--content'
158
- }, [UtilTools.getFuncText(content)])
160
+ }, [getFuncText(content)])
159
161
  )
160
162
  }
161
163
  return contents
@@ -1,4 +1,4 @@
1
- import { UtilTools } from '../../tools'
1
+ import { getFuncText } from '../../tools/utils'
2
2
  import XEUtils from 'xe-utils'
3
3
  import GlobalConfig from '../../v-x-e-table/src/conf'
4
4
  import vSize from '../../mixins/size'
@@ -62,7 +62,7 @@ export default {
62
62
  }),
63
63
  h('span', {
64
64
  class: 'vxe-checkbox--label'
65
- }, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [UtilTools.getFuncText(content)])
65
+ }, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [getFuncText(content)])
66
66
  ])
67
67
  },
68
68
  methods: {
@@ -1,7 +1,8 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import VXETable from '../../v-x-e-table'
3
- import { UtilTools, DomTools, isEnableConf } from '../../tools'
4
- import { browse } from '../../tools/src/dom'
3
+ import UtilTools, { isEnableConf } from '../../tools/utils'
4
+ import DomTools, { browse } from '../../tools/dom'
5
+ import { warnLog, errLog } from '../../tools/log'
5
6
 
6
7
  const { getRowid } = UtilTools
7
8
 
@@ -28,7 +29,7 @@ function insertTreeRow (_vm, newRecords, isAppend) {
28
29
  } else {
29
30
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
30
31
  if (parentRowId) {
31
- UtilTools.warn('vxe.error.unableInsert')
32
+ warnLog('vxe.error.unableInsert')
32
33
  }
33
34
  }
34
35
  afterFullData[funcName](item)
@@ -110,7 +111,7 @@ export default {
110
111
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
111
112
  if (item[treeOpts.parentField]) {
112
113
  if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
113
- UtilTools.error('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`])
114
+ errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`])
114
115
  }
115
116
  }
116
117
  }
@@ -124,7 +125,7 @@ export default {
124
125
  })
125
126
  } else {
126
127
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
127
- UtilTools.warn('vxe.error.unableInsert')
128
+ warnLog('vxe.error.unableInsert')
128
129
  }
129
130
  insertTreeRow(this, newRecords, true)
130
131
  }
@@ -142,7 +143,7 @@ export default {
142
143
  afIndex = afterFullData.indexOf(row)
143
144
  }
144
145
  if (afIndex === -1) {
145
- throw new Error(UtilTools.error('vxe.error.unableInsert'))
146
+ throw new Error(errLog('vxe.error.unableInsert'))
146
147
  }
147
148
  afterFullData.splice(afIndex, 0, ...newRecords)
148
149
  tableFullData.splice(tableFullData.indexOf(row), 0, ...newRecords)
@@ -5,7 +5,7 @@ import VxeInput from '../../input/src/input'
5
5
  import VxeCheckbox from '../../checkbox/src/checkbox'
6
6
  import VxeSelect from '../../select/src/select'
7
7
  import VxeOption from '../../select/src/option'
8
- import { UtilTools } from '../../tools'
8
+ import UtilTools from '../../tools/utils'
9
9
 
10
10
  export default {
11
11
  name: 'VxeExportPanel',
@@ -2,7 +2,7 @@ import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import VxeModal from '../../modal/src/modal'
4
4
  import VxeRadio from '../../radio/src/radio'
5
- import { UtilTools } from '../../tools'
5
+ import UtilTools from '../../tools/utils'
6
6
 
7
7
  export default {
8
8
  name: 'VxeImportPanel',
@@ -1,9 +1,10 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import VXETable from '../../v-x-e-table'
4
- import { UtilTools } from '../../tools'
5
- import { mergeBodyMethod } from '../../table/src/util'
6
- import { browse } from '../../tools/src/dom'
4
+ import UtilTools from '../../tools/utils'
5
+ import { mergeBodyMethod, isColumnInfo } from '../../table/src/util'
6
+ import { browse } from '../../tools/dom'
7
+ import { warnLog, errLog } from '../../tools/log'
7
8
 
8
9
  const { formatText } = UtilTools
9
10
 
@@ -589,7 +590,7 @@ function downloadFile ($xetable, opts, content) {
589
590
  // 检测弹窗模块
590
591
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
591
592
  if (!VXETable.modal) {
592
- UtilTools.error('vxe.error.reqModule', ['Modal'])
593
+ errLog('vxe.error.reqModule', ['Modal'])
593
594
  }
594
595
  }
595
596
  VXETable.modal.message({ content: GlobalConfig.i18n('vxe.table.expSuccess'), status: 'success' })
@@ -816,7 +817,7 @@ function handleImport ($xetable, content, opts) {
816
817
  // 检测弹窗模块
817
818
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
818
819
  if (!VXETable.modal) {
819
- UtilTools.error('vxe.error.reqModule', ['Modal'])
820
+ errLog('vxe.error.reqModule', ['Modal'])
820
821
  }
821
822
  }
822
823
  VXETable.modal.message({ content: GlobalConfig.i18n('vxe.table.impSuccess', [rows.length]), status: 'success' })
@@ -831,7 +832,7 @@ function handleImport ($xetable, content, opts) {
831
832
  // 检测弹窗模块
832
833
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
833
834
  if (!VXETable.modal) {
834
- UtilTools.error('vxe.error.reqModule', ['Modal'])
835
+ errLog('vxe.error.reqModule', ['Modal'])
835
836
  }
836
837
  }
837
838
  VXETable.modal.message({ content: GlobalConfig.i18n('vxe.error.impFields'), status: 'error' })
@@ -851,7 +852,7 @@ function handleFileImport ($xetable, file, opts) {
851
852
  // 检测弹窗模块
852
853
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
853
854
  if (!VXETable.modal) {
854
- UtilTools.error('vxe.error.reqModule', ['Modal'])
855
+ errLog('vxe.error.reqModule', ['Modal'])
855
856
  }
856
857
  }
857
858
  VXETable.modal.message({ content: GlobalConfig.i18n('vxe.error.notType', [type]), status: 'error' })
@@ -889,7 +890,7 @@ function handleFileImport ($xetable, file, opts) {
889
890
  $xetable.preventEvent(null, 'event.import', { file, options, columns: $xetable.tableFullColumn }, () => {
890
891
  const reader = new FileReader()
891
892
  reader.onerror = () => {
892
- UtilTools.error('vxe.error.notType', [type])
893
+ errLog('vxe.error.notType', [type])
893
894
  _importReject({ status: false })
894
895
  }
895
896
  reader.onload = (e) => {
@@ -901,7 +902,7 @@ function handleFileImport ($xetable, file, opts) {
901
902
  } else {
902
903
  // 不支持的浏览器
903
904
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
904
- UtilTools.error('vxe.error.notExp')
905
+ errLog('vxe.error.notExp')
905
906
  }
906
907
  _importResolve({ status: true })
907
908
  }
@@ -959,7 +960,7 @@ export function readLocalFile (options = {}) {
959
960
  // 检测弹窗模块
960
961
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
961
962
  if (!VXETable.modal) {
962
- UtilTools.error('vxe.error.reqModule', ['Modal'])
963
+ errLog('vxe.error.reqModule', ['Modal'])
963
964
  }
964
965
  }
965
966
  VXETable.modal.message({ content: GlobalConfig.i18n('vxe.error.notType', [errType]), status: 'error' })
@@ -1053,7 +1054,7 @@ function handleExportAndPrint ($xetable, options, isPrint) {
1053
1054
  const isColGroup = column.children && column.children.length
1054
1055
  if (isColGroup || defaultFilterExportColumn(column)) {
1055
1056
  column.checked = columns ? columns.some((item) => {
1056
- if (UtilTools.isColumn(item)) {
1057
+ if (isColumnInfo(item)) {
1057
1058
  return column === item
1058
1059
  } else if (XEUtils.isString(item)) {
1059
1060
  return column.field === item
@@ -1209,7 +1210,7 @@ export default {
1209
1210
  XEUtils.mapTree(customCols, item => {
1210
1211
  let targetColumn
1211
1212
  if (item) {
1212
- if (UtilTools.isColumn(item)) {
1213
+ if (isColumnInfo(item)) {
1213
1214
  targetColumn = item
1214
1215
  } else if (XEUtils.isString(item)) {
1215
1216
  targetColumn = this.getColumnByField(item)
@@ -1233,7 +1234,7 @@ export default {
1233
1234
  children: 'childNodes',
1234
1235
  mapChildren: '_children'
1235
1236
  }),
1236
- (column, index) => UtilTools.isColumn(column) && (!columnFilterMethod || columnFilterMethod({ column, $columnIndex: index })),
1237
+ (column, index) => isColumnInfo(column) && (!columnFilterMethod || columnFilterMethod({ column, $columnIndex: index })),
1237
1238
  {
1238
1239
  children: '_children',
1239
1240
  mapChildren: 'childNodes',
@@ -1264,7 +1265,7 @@ export default {
1264
1265
  // 检查类型,如果为自定义导出,则不需要校验类型
1265
1266
  if (!opts.exportMethod && !XEUtils.includes(VXETable.config.exportTypes, type)) {
1266
1267
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1267
- UtilTools.error('vxe.error.notType', [type])
1268
+ errLog('vxe.error.notType', [type])
1268
1269
  }
1269
1270
  const params = { status: false }
1270
1271
  return Promise.reject(params)
@@ -1288,7 +1289,7 @@ export default {
1288
1289
  } else if (mode === 'all') {
1289
1290
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1290
1291
  if (!$xegrid) {
1291
- UtilTools.warn('vxe.error.errProp', ['all', 'mode=current,selected'])
1292
+ warnLog('vxe.error.errProp', ['all', 'mode=current,selected'])
1292
1293
  }
1293
1294
  }
1294
1295
 
@@ -1298,7 +1299,7 @@ export default {
1298
1299
 
1299
1300
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1300
1301
  if (!ajaxMethods) {
1301
- UtilTools.warn('vxe.error.notFunc', ['proxy-config.ajax.queryAll'])
1302
+ warnLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll'])
1302
1303
  }
1303
1304
  }
1304
1305
 
@@ -1397,7 +1398,7 @@ export default {
1397
1398
  return
1398
1399
  }
1399
1400
  if (!this.importConfig) {
1400
- UtilTools.error('vxe.error.reqProp', ['import-config'])
1401
+ errLog('vxe.error.reqProp', ['import-config'])
1401
1402
  }
1402
1403
  // 处理类型
1403
1404
  const typeList = types.map(value => {
@@ -1427,7 +1428,7 @@ export default {
1427
1428
  const { exportOpts } = this
1428
1429
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1429
1430
  if (!this.exportConfig) {
1430
- UtilTools.error('vxe.error.reqProp', ['export-config'])
1431
+ errLog('vxe.error.reqProp', ['export-config'])
1431
1432
  }
1432
1433
  }
1433
1434
  return handleExportAndPrint(this, Object.assign({}, exportOpts, options))
@@ -1436,7 +1437,7 @@ export default {
1436
1437
  const { printOpts } = this
1437
1438
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1438
1439
  if (!this.printConfig) {
1439
- UtilTools.error('vxe.error.reqProp', ['print-config'])
1440
+ errLog('vxe.error.reqProp', ['print-config'])
1440
1441
  }
1441
1442
  }
1442
1443
  return handleExportAndPrint(this, Object.assign({}, printOpts, options), true)
@@ -1,6 +1,6 @@
1
1
  import XEUtils from 'xe-utils'
2
- import { UtilTools, DomTools } from '../../tools'
3
- import { handleFieldOrColumn } from '../../table/src/util'
2
+ import DomTools from '../../tools/dom'
3
+ import { toFilters, handleFieldOrColumn } from '../../table/src/util'
4
4
  import VXETable from '../../v-x-e-table'
5
5
 
6
6
  export default {
@@ -32,7 +32,7 @@ export default {
32
32
  _setFilter (fieldOrColumn, options) {
33
33
  const column = handleFieldOrColumn(this, fieldOrColumn)
34
34
  if (column && column.filters && options) {
35
- column.filters = UtilTools.getFilters(options)
35
+ column.filters = toFilters(options)
36
36
  }
37
37
  return this.$nextTick()
38
38
  },
@@ -1,6 +1,6 @@
1
1
  import GlobalConfig from '../../v-x-e-table/src/conf'
2
2
  import VXETable from '../../v-x-e-table'
3
- import { UtilTools } from '../../tools'
3
+ import UtilTools from '../../tools/utils'
4
4
  import XEUtils from 'xe-utils'
5
5
 
6
6
  export default {
@@ -1,5 +1,6 @@
1
1
  import XEUtils from 'xe-utils'
2
- import { UtilTools, DomTools } from '../../tools'
2
+ import UtilTools from '../../tools/utils'
3
+ import DomTools from '../../tools/dom'
3
4
 
4
5
  const cellType = 'footer'
5
6
 
@@ -61,6 +62,7 @@ export default {
61
62
  align: allAlign,
62
63
  scrollXLoad,
63
64
  columnKey,
65
+ columnOpts,
64
66
  showFooterOverflow: allColumnFooterOverflow,
65
67
  currentColumn,
66
68
  overflowX,
@@ -227,7 +229,7 @@ export default {
227
229
  attrs,
228
230
  style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(params) : footerCellStyle) : null,
229
231
  on: tfOns,
230
- key: columnKey ? column.id : $columnIndex
232
+ key: columnKey || columnOpts.useKey ? column.id : $columnIndex
231
233
  }, [
232
234
  h('div', {
233
235
  class: ['vxe-cell', {
@@ -1,5 +1,5 @@
1
1
  import VxeFormItem from './form-item'
2
- import { UtilTools } from '../../tools'
2
+ import { errLog } from '../../tools/log'
3
3
 
4
4
  export default {
5
5
  name: 'VxeFormGather',
@@ -13,7 +13,7 @@ export default {
13
13
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
14
14
  this.$nextTick(() => {
15
15
  if (this.$xeform && this.$xeform.customLayout) {
16
- UtilTools.error('vxe.error.errConflicts', ['custom-layout', '<form-gather ...>'])
16
+ errLog('vxe.error.errConflicts', ['custom-layout', '<form-gather ...>'])
17
17
  }
18
18
  })
19
19
  }
@@ -1,7 +1,7 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import VXETable from '../../v-x-e-table'
4
- import { UtilTools, isEnableConf } from '../../tools'
4
+ import { isEnableConf, getFuncText } from '../../tools/utils'
5
5
  import { createItem, destroyItem, assemItem } from './util'
6
6
  import { renderTitle } from './render'
7
7
 
@@ -69,9 +69,9 @@ const renderItem = (h, _vm, item, slots) => {
69
69
  }
70
70
  const ons = showTooltip ? {
71
71
  mouseenter (evnt) {
72
- _vm.triggerHeaderHelpEvent(evnt, params)
72
+ _vm.triggerTitleTipEvent(evnt, params)
73
73
  },
74
- mouseleave: _vm.handleTargetLeaveEvent
74
+ mouseleave: _vm.handleTitleTipLeaveEvent
75
75
  } : {}
76
76
  return h('div', {
77
77
  class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
@@ -93,7 +93,7 @@ const renderItem = (h, _vm, item, slots) => {
93
93
  width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
94
94
  } : null,
95
95
  attrs: {
96
- title: showTitle ? UtilTools.getFuncText(title) : null
96
+ title: showTitle ? getFuncText(title) : null
97
97
  },
98
98
  on: ons
99
99
  }, renderTitle(h, _vm, item)) : null,
@@ -2,11 +2,11 @@ import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import vSize from '../../mixins/size'
4
4
  import VXETable from '../../v-x-e-table'
5
- import { UtilTools, DomTools, isEnableConf } from '../../tools'
5
+ import { isEnableConf, eqEmptyValue, getFuncText } from '../../tools/utils'
6
+ import DomTools, { browse } from '../../tools/dom'
6
7
  import { createItem, handleFieldOrItem } from './util'
7
8
  import { renderTitle } from './render'
8
- import { eqEmptyValue } from '../../tools/src/utils'
9
- import { browse } from '../../tools/src/dom'
9
+ import { errLog } from '../../tools/log'
10
10
 
11
11
  class Rule {
12
12
  constructor (rule) {
@@ -24,7 +24,7 @@ class Rule {
24
24
  }
25
25
 
26
26
  get content () {
27
- return UtilTools.getFuncText(this.$options.content || this.$options.message)
27
+ return getFuncText(this.$options.content || this.$options.message)
28
28
  }
29
29
 
30
30
  get message () {
@@ -64,7 +64,7 @@ function getResetValue (value, resetValue) {
64
64
 
65
65
  function renderItems (h, _vm, itemList) {
66
66
  const { _e, rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
67
- return itemList.map((item, index) => {
67
+ return itemList.map((item) => {
68
68
  const { slots, title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children } = item
69
69
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
70
70
  const span = item.span || _vm.span
@@ -111,9 +111,9 @@ function renderItems (h, _vm, itemList) {
111
111
  }
112
112
  const ons = showTooltip ? {
113
113
  mouseenter (evnt) {
114
- _vm.triggerHeaderHelpEvent(evnt, params)
114
+ _vm.triggerTitleTipEvent(evnt, params)
115
115
  },
116
- mouseleave: _vm.handleTargetLeaveEvent
116
+ mouseleave: _vm.handleTitleTipLeaveEvent
117
117
  } : {}
118
118
  return h('div', {
119
119
  class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
@@ -123,7 +123,7 @@ function renderItems (h, _vm, itemList) {
123
123
  'is--active': !itemVisibleMethod || itemVisibleMethod(params),
124
124
  'is--error': showError
125
125
  }],
126
- key: index
126
+ key: item.id
127
127
  }, [
128
128
  h('div', {
129
129
  class: 'vxe-form--item-inner'
@@ -136,7 +136,7 @@ function renderItems (h, _vm, itemList) {
136
136
  width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
137
137
  } : null,
138
138
  attrs: {
139
- title: showTitle ? UtilTools.getFuncText(title) : null
139
+ title: showTitle ? getFuncText(title) : null
140
140
  },
141
141
  on: ons
142
142
  }, renderTitle(h, _vm, item)) : null,
@@ -190,6 +190,7 @@ export default {
190
190
  rules: Object,
191
191
  preventSubmit: { type: Boolean, default: () => GlobalConfig.form.preventSubmit },
192
192
  validConfig: Object,
193
+ tooltipConfig: Object,
193
194
  customLayout: { type: Boolean, default: () => GlobalConfig.form.customLayout }
194
195
  },
195
196
  data () {
@@ -199,7 +200,6 @@ export default {
199
200
  formItems: [],
200
201
 
201
202
  tooltipTimeout: null,
202
- tooltipActive: false,
203
203
  tooltipStore: {
204
204
  item: null,
205
205
  visible: false
@@ -216,11 +216,7 @@ export default {
216
216
  return Object.assign({}, GlobalConfig.form.validConfig, this.validConfig)
217
217
  },
218
218
  tooltipOpts () {
219
- const opts = Object.assign({ leaveDelay: 300 }, GlobalConfig.form.tooltipConfig, this.tooltipConfig)
220
- if (opts.enterable) {
221
- opts.leaveMethod = this.handleTooltipLeaveMethod
222
- }
223
- return opts
219
+ return Object.assign({}, GlobalConfig.tooltip, GlobalConfig.form.tooltipConfig, this.tooltipConfig)
224
220
  }
225
221
  },
226
222
  watch: {
@@ -239,7 +235,7 @@ export default {
239
235
  const { items } = this
240
236
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
241
237
  if (this.customLayout && this.items) {
242
- UtilTools.error('vxe.error.errConflicts', ['custom-layout', 'items'])
238
+ errLog('vxe.error.errConflicts', ['custom-layout', 'items'])
243
239
  }
244
240
  }
245
241
  if (items) {
@@ -283,7 +279,7 @@ export default {
283
279
  */
284
280
  hasUseTooltip ? h('vxe-tooltip', {
285
281
  ref: 'tooltip',
286
- ...tooltipOpts
282
+ props: tooltipOpts
287
283
  }) : _e()
288
284
  ])
289
285
  },
@@ -308,7 +304,7 @@ export default {
308
304
  XEUtils.each(item.slots, (func) => {
309
305
  if (!XEUtils.isFunction(func)) {
310
306
  if (!$scopedSlots[func]) {
311
- UtilTools.error('vxe.error.notSlot', [func])
307
+ errLog('vxe.error.notSlot', [func])
312
308
  }
313
309
  }
314
310
  })
@@ -375,15 +371,6 @@ export default {
375
371
  this.reset()
376
372
  this.$emit('reset', { data: this.data, $form: this, $event: evnt })
377
373
  },
378
- handleTooltipLeaveMethod () {
379
- const { tooltipOpts } = this
380
- setTimeout(() => {
381
- if (!this.tooltipActive) {
382
- this.closeTooltip()
383
- }
384
- }, tooltipOpts.leaveDelay)
385
- return false
386
- },
387
374
  closeTooltip () {
388
375
  const { tooltipStore } = this
389
376
  const $tooltip = this.$refs.tooltip
@@ -398,7 +385,7 @@ export default {
398
385
  }
399
386
  return this.$nextTick()
400
387
  },
401
- triggerHeaderHelpEvent (evnt, params) {
388
+ triggerTitleTipEvent (evnt, params) {
402
389
  const { item } = params
403
390
  const { tooltipStore } = this
404
391
  const $tooltip = this.$refs.tooltip
@@ -406,8 +393,9 @@ export default {
406
393
  const content = (overflowElem.textContent || '').trim()
407
394
  const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth
408
395
  clearTimeout(this.tooltipTimeout)
409
- this.tooltipActive = true
410
- this.closeTooltip()
396
+ if (tooltipStore.item !== item) {
397
+ this.closeTooltip()
398
+ }
411
399
  if (content && isCellOverflow) {
412
400
  Object.assign(tooltipStore, {
413
401
  item,
@@ -418,10 +406,9 @@ export default {
418
406
  }
419
407
  }
420
408
  },
421
- handleTargetLeaveEvent () {
409
+ handleTitleTipLeaveEvent () {
422
410
  const { tooltipOpts } = this
423
411
  let $tooltip = this.$refs.tooltip
424
- this.tooltipActive = false
425
412
  if ($tooltip) {
426
413
  $tooltip.setActived(false)
427
414
  }
@@ -1,6 +1,6 @@
1
1
  import GlobalConfig from '../../v-x-e-table/src/conf'
2
2
  import VXETable from '../../v-x-e-table'
3
- import { UtilTools, isEnableConf } from '../../tools'
3
+ import { isEnableConf, getFuncText } from '../../tools/utils'
4
4
 
5
5
  function renderPrefixIcon (h, titlePrefix) {
6
6
  return h('span', {
@@ -23,7 +23,7 @@ function renderSuffixIcon (h, titleSuffix) {
23
23
  }
24
24
 
25
25
  export function renderTitle (h, _vm, item) {
26
- const { data } = _vm
26
+ const { data, tooltipOpts } = _vm
27
27
  const { slots, field, itemRender, titlePrefix, titleSuffix } = item
28
28
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
29
29
  const params = { data, property: field, item, $form: _vm }
@@ -34,9 +34,9 @@ export function renderTitle (h, _vm, item) {
34
34
  (titlePrefix.content || titlePrefix.message)
35
35
  ? h('vxe-tooltip', {
36
36
  props: {
37
- content: UtilTools.getFuncText(titlePrefix.content || titlePrefix.message),
38
- enterable: titlePrefix.enterable,
39
- theme: titlePrefix.theme
37
+ ...tooltipOpts,
38
+ ...titlePrefix,
39
+ content: getFuncText(titlePrefix.content || titlePrefix.message)
40
40
  }
41
41
  }, [
42
42
  renderPrefixIcon(h, titlePrefix)
@@ -47,7 +47,7 @@ export function renderTitle (h, _vm, item) {
47
47
  titVNs.push(
48
48
  h('span', {
49
49
  class: 'vxe-form--item-title-label'
50
- }, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : (slots && slots.title ? _vm.callSlot(slots.title, params, h) : UtilTools.getFuncText(item.title)))
50
+ }, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : (slots && slots.title ? _vm.callSlot(slots.title, params, h) : getFuncText(item.title)))
51
51
  )
52
52
  contVNs.push(
53
53
  h('div', {
@@ -60,9 +60,9 @@ export function renderTitle (h, _vm, item) {
60
60
  (titleSuffix.content || titleSuffix.message)
61
61
  ? h('vxe-tooltip', {
62
62
  props: {
63
- content: UtilTools.getFuncText(titleSuffix.content || titleSuffix.message),
64
- enterable: titleSuffix.enterable,
65
- theme: titleSuffix.theme
63
+ ...tooltipOpts,
64
+ ...titlePrefix,
65
+ content: getFuncText(titleSuffix.content || titleSuffix.message)
66
66
  }
67
67
  }, [
68
68
  renderSuffixIcon(h, titleSuffix)