vxe-table 3.4.14-beta.1 → 3.4.15

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 (45) hide show
  1. package/README.md +1 -5
  2. package/lib/filter/src/mixin.js +24 -13
  3. package/lib/filter/src/mixin.min.js +1 -1
  4. package/lib/form/src/form-item.js +5 -0
  5. package/lib/form/src/form-item.min.js +1 -1
  6. package/lib/form/src/form.js +31 -27
  7. package/lib/form/src/form.min.js +1 -1
  8. package/lib/form/src/util.js +11 -0
  9. package/lib/form/src/util.min.js +1 -1
  10. package/lib/index.umd.js +591 -1272
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/input/src/date.js +54 -0
  13. package/lib/input/src/date.min.js +1 -0
  14. package/lib/input/src/input.js +12 -59
  15. package/lib/input/src/input.min.js +1 -1
  16. package/lib/input/src/number.js +23 -0
  17. package/lib/input/src/number.min.js +1 -0
  18. package/lib/pager/src/pager.js +15 -1
  19. package/lib/pager/src/pager.min.js +1 -1
  20. package/lib/table/src/body.js +35 -12
  21. package/lib/table/src/body.min.js +1 -1
  22. package/lib/table/src/methods.js +356 -304
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/tools/src/dom.js +12 -1
  25. package/lib/tools/src/dom.min.js +1 -1
  26. package/lib/tooltip/src/tooltip.js +81 -44
  27. package/lib/tooltip/src/tooltip.min.js +1 -1
  28. package/lib/v-x-e-table/src/conf.js +1 -0
  29. package/lib/v-x-e-table/src/conf.min.js +1 -1
  30. package/package.json +3 -3
  31. package/packages/filter/src/mixin.js +17 -10
  32. package/packages/form/src/form-item.js +5 -0
  33. package/packages/form/src/form.js +22 -16
  34. package/packages/form/src/util.js +7 -0
  35. package/packages/input/src/date.js +38 -0
  36. package/packages/input/src/input.js +4 -46
  37. package/packages/input/src/number.js +12 -0
  38. package/packages/pager/src/pager.js +15 -1
  39. package/packages/table/src/body.js +31 -13
  40. package/packages/table/src/methods.js +63 -26
  41. package/packages/tools/src/dom.js +13 -1
  42. package/packages/tooltip/src/tooltip.js +47 -23
  43. package/packages/v-x-e-table/src/conf.js +1 -0
  44. package/README.en.md +0 -170
  45. package/README.zh-TW.md +0 -174
@@ -53,6 +53,33 @@ function updateTipStyle(_vm) {
53
53
  }
54
54
  }
55
55
 
56
+ function showTip(_vm) {
57
+ var $el = _vm.$el,
58
+ tipStore = _vm.tipStore,
59
+ zIndex = _vm.zIndex;
60
+ var parentNode = $el.parentNode;
61
+
62
+ if (!parentNode) {
63
+ document.body.appendChild($el);
64
+ }
65
+
66
+ _vm.updateValue(true);
67
+
68
+ _vm.updateZindex();
69
+
70
+ tipStore.placement = 'top';
71
+ tipStore.style = {
72
+ width: 'auto',
73
+ left: 0,
74
+ top: 0,
75
+ zIndex: zIndex || _vm.tipZindex
76
+ };
77
+ tipStore.arrowStyle = {
78
+ left: '50%'
79
+ };
80
+ return _vm.updatePlacement();
81
+ }
82
+
56
83
  var _default2 = {
57
84
  name: 'VxeTooltip',
58
85
  mixins: [_size.default],
@@ -83,6 +110,12 @@ var _default2 = {
83
110
  default: true
84
111
  },
85
112
  enterable: Boolean,
113
+ enterDelay: {
114
+ type: Number,
115
+ default: function _default() {
116
+ return _conf.default.tooltip.enterDelay;
117
+ }
118
+ },
86
119
  leaveDelay: {
87
120
  type: Number,
88
121
  default: function _default() {
@@ -94,9 +127,9 @@ var _default2 = {
94
127
  data: function data() {
95
128
  return {
96
129
  isUpdate: false,
97
- isHover: false,
98
130
  visible: false,
99
131
  message: '',
132
+ tipActive: false,
100
133
  tipTarget: null,
101
134
  tipZindex: 0,
102
135
  tipStore: {
@@ -118,6 +151,18 @@ var _default2 = {
118
151
  this.isUpdate = false;
119
152
  }
120
153
  },
154
+ created: function created() {
155
+ var _this = this;
156
+
157
+ this.showDelayTip = _xeUtils.default.debounce(function () {
158
+ if (_this.tipActive) {
159
+ showTip(_this);
160
+ }
161
+ }, this.enterDelay, {
162
+ leading: false,
163
+ trailing: true
164
+ });
165
+ },
121
166
  mounted: function mounted() {
122
167
  var $el = this.$el,
123
168
  trigger = this.trigger,
@@ -180,7 +225,7 @@ var _default2 = {
180
225
  vSize = this.vSize,
181
226
  theme = this.theme,
182
227
  message = this.message,
183
- isHover = this.isHover,
228
+ tipActive = this.tipActive,
184
229
  isArrow = this.isArrow,
185
230
  visible = this.visible,
186
231
  tipStore = this.tipStore,
@@ -195,7 +240,7 @@ var _default2 = {
195
240
  }
196
241
 
197
242
  return h('div', {
198
- class: ['vxe-table--tooltip-wrapper', "theme--".concat(theme), (_ref = {}, _defineProperty(_ref, "size--".concat(vSize), vSize), _defineProperty(_ref, "placement--".concat(tipStore.placement), tipStore.placement), _defineProperty(_ref, 'is--enterable', enterable), _defineProperty(_ref, 'is--visible', visible), _defineProperty(_ref, 'is--arrow', isArrow), _defineProperty(_ref, 'is--hover', isHover), _ref)],
243
+ class: ['vxe-table--tooltip-wrapper', "theme--".concat(theme), (_ref = {}, _defineProperty(_ref, "size--".concat(vSize), vSize), _defineProperty(_ref, "placement--".concat(tipStore.placement), tipStore.placement), _defineProperty(_ref, 'is--enterable', enterable), _defineProperty(_ref, 'is--visible', visible), _defineProperty(_ref, 'is--arrow', isArrow), _defineProperty(_ref, 'is--actived', tipActive), _ref)],
199
244
  style: tipStore.style,
200
245
  ref: 'tipWrapper',
201
246
  on: on
@@ -212,15 +257,16 @@ var _default2 = {
212
257
  },
213
258
  close: function close() {
214
259
  this.tipTarget = null;
260
+ this.tipActive = false;
215
261
  Object.assign(this.tipStore, {
216
262
  style: {},
217
263
  placement: '',
218
264
  arrowStyle: null
219
265
  });
220
- this.update(false);
266
+ this.updateValue(false);
221
267
  return this.$nextTick();
222
268
  },
223
- update: function update(value) {
269
+ updateValue: function updateValue(value) {
224
270
  if (value !== this.visible) {
225
271
  this.visible = value;
226
272
  this.isUpdate = true;
@@ -236,55 +282,46 @@ var _default2 = {
236
282
  }
237
283
  },
238
284
  toVisible: function toVisible(target, message) {
239
- this.targetActive = true;
240
-
241
285
  if (target) {
242
- var $el = this.$el,
243
- tipStore = this.tipStore,
244
- zIndex = this.zIndex;
245
- var parentNode = $el.parentNode;
246
-
247
- if (!parentNode) {
248
- document.body.appendChild($el);
249
- }
286
+ var trigger = this.trigger,
287
+ enterDelay = this.enterDelay;
288
+ this.tipActive = true;
289
+ this.tipTarget = target;
250
290
 
251
291
  if (message) {
252
292
  this.message = message;
253
293
  }
254
294
 
255
- this.tipTarget = target;
256
- this.update(true);
257
- this.updateZindex();
258
- tipStore.placement = 'top';
259
- tipStore.style = {
260
- width: 'auto',
261
- left: 0,
262
- top: 0,
263
- zIndex: zIndex || this.tipZindex
264
- };
265
- tipStore.arrowStyle = {
266
- left: '50%'
267
- };
268
- return this.updatePlacement();
295
+ if (enterDelay && trigger === 'hover') {
296
+ this.showDelayTip();
297
+ } else {
298
+ return showTip(this);
299
+ }
269
300
  }
270
301
 
271
302
  return this.$nextTick();
272
303
  },
273
304
  updatePlacement: function updatePlacement() {
274
- var _this = this;
305
+ var _this2 = this;
275
306
 
276
307
  return this.$nextTick().then(function () {
277
- var wrapperElem = _this.$el,
278
- tipTarget = _this.tipTarget;
308
+ var wrapperElem = _this2.$el,
309
+ tipTarget = _this2.tipTarget;
279
310
 
280
311
  if (tipTarget && wrapperElem) {
281
- updateTipStyle(_this);
282
- return _this.$nextTick().then(function () {
283
- return updateTipStyle(_this);
312
+ updateTipStyle(_this2);
313
+ return _this2.$nextTick().then(function () {
314
+ return updateTipStyle(_this2);
284
315
  });
285
316
  }
286
317
  });
287
318
  },
319
+ isActived: function isActived() {
320
+ return this.tipActive;
321
+ },
322
+ setActived: function setActived(actived) {
323
+ this.tipActive = !!actived;
324
+ },
288
325
  clickEvent: function clickEvent() {
289
326
  this[this.visible ? 'close' : 'open']();
290
327
  },
@@ -292,17 +329,17 @@ var _default2 = {
292
329
  this.open();
293
330
  },
294
331
  targetMouseleaveEvent: function targetMouseleaveEvent() {
295
- var _this2 = this;
332
+ var _this3 = this;
296
333
 
297
334
  var trigger = this.trigger,
298
335
  enterable = this.enterable,
299
336
  leaveDelay = this.leaveDelay;
300
- this.targetActive = false;
337
+ this.tipActive = false;
301
338
 
302
339
  if (enterable && trigger === 'hover') {
303
340
  setTimeout(function () {
304
- if (!_this2.isHover) {
305
- _this2.close();
341
+ if (!_this3.tipActive) {
342
+ _this3.close();
306
343
  }
307
344
  }, leaveDelay);
308
345
  } else {
@@ -310,24 +347,24 @@ var _default2 = {
310
347
  }
311
348
  },
312
349
  wrapperMouseenterEvent: function wrapperMouseenterEvent() {
313
- this.isHover = true;
350
+ this.tipActive = true;
314
351
  },
315
352
  wrapperMouseleaveEvent: function wrapperMouseleaveEvent(evnt) {
316
- var _this3 = this;
353
+ var _this4 = this;
317
354
 
318
355
  var leaveMethod = this.leaveMethod,
319
356
  trigger = this.trigger,
320
357
  enterable = this.enterable,
321
358
  leaveDelay = this.leaveDelay;
322
- this.isHover = false;
359
+ this.tipActive = false;
323
360
 
324
361
  if (!leaveMethod || leaveMethod({
325
362
  $event: evnt
326
363
  }) !== false) {
327
364
  if (enterable && trigger === 'hover') {
328
365
  setTimeout(function () {
329
- if (!_this3.targetActive) {
330
- _this3.close();
366
+ if (!_this4.tipActive) {
367
+ _this4.close();
331
368
  }
332
369
  }, leaveDelay);
333
370
  }
@@ -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")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function updateTipStyle(e){var t,i,o,n,s,r,l,a=e.$el,u=e.tipTarget,c=e.tipStore;u&&(t=(r=_tools.DomTools.getDomNode()).scrollTop,i=r.scrollLeft,o=r.visibleWidth,n=(l=_tools.DomTools.getAbsolutePos(u)).top,s=l.left,e=a.offsetHeight,r=a.offsetWidth,l=n-e-6,i+o<(a=Math.max(6,s+Math.floor((u.offsetWidth-r)/2)))+r+6&&(a=i+o-r-6),n-e<t+6&&(c.placement="bottom",l=n+u.offsetHeight+6),c.style.top="".concat(l,"px"),c.style.left="".concat(a,"px"),c.arrowStyle.left="".concat(s-a+u.offsetWidth/2,"px"))}var _default2={name:"VxeTooltip",mixins:[_size.default],props:{value:Boolean,size:{type:String,default:function(){return _conf.default.tooltip.size||_conf.default.size}},trigger:{type:String,default:function(){return _conf.default.tooltip.trigger}},theme:{type:String,default:function(){return _conf.default.tooltip.theme}},content:[String,Number],zIndex:[String,Number],isArrow:{type:Boolean,default:!0},enterable:Boolean,leaveDelay:{type:Number,default:function(){return _conf.default.tooltip.leaveDelay}},leaveMethod:Function},data:function(){return{isUpdate:!1,isHover:!1,visible:!1,message:"",tipTarget:null,tipZindex:0,tipStore:{style:{},placement:"",arrowStyle:null}}},watch:{content:function(e){this.message=e},value:function(e){this.isUpdate||this[e?"open":"close"](),this.isUpdate=!1}},mounted:function(){var i,o=this.$el,e=this.trigger,t=this.content,n=this.value,s=o.parentNode;this.message=t,this.tipZindex=_tools.UtilTools.nextZIndex(),_xeUtils.default.arrayEach(o.children,function(e,t){1<t&&(s.insertBefore(e,o),i=i||e)}),s.removeChild(o),(this.target=i)&&("hover"===e?(i.onmouseleave=this.targetMouseleaveEvent,i.onmouseenter=this.targetMouseenterEvent):"click"===e&&(i.onclick=this.clickEvent)),n&&this.open()},beforeDestroy:function(){var e=this.$el,t=this.target,i=this.trigger,o=e.parentNode;o&&o.removeChild(e),t&&("hover"===i?(t.onmouseenter=null,t.onmouseleave=null):"click"===i&&(t.onclick=null))},render:function(e){var t,i=this.$scopedSlots,o=this.vSize,n=this.theme,s=this.message,r=this.isHover,l=this.isArrow,a=this.visible,u=this.tipStore,c=this.enterable;return c&&(t={mouseenter:this.wrapperMouseenterEvent,mouseleave:this.wrapperMouseleaveEvent}),e("div",{class:["vxe-table--tooltip-wrapper","theme--".concat(n),(_defineProperty(n={},"size--".concat(o),o),_defineProperty(n,"placement--".concat(u.placement),u.placement),_defineProperty(n,"is--enterable",c),_defineProperty(n,"is--visible",a),_defineProperty(n,"is--arrow",l),_defineProperty(n,"is--hover",r),n)],style:u.style,ref:"tipWrapper",on:t},[e("div",{class:"vxe-table--tooltip-content"},i.content?i.content.call(this,{}):s),e("div",{class:"vxe-table--tooltip-arrow",style:u.arrowStyle})].concat(i.default?i.default.call(this,{}):[]))},methods:{open:function(e,t){return this.toVisible(e||this.target,t)},close:function(){return this.tipTarget=null,Object.assign(this.tipStore,{style:{},placement:"",arrowStyle:null}),this.update(!1),this.$nextTick()},update:function(e){e!==this.visible&&(this.visible=e,this.isUpdate=!0,this.$listeners.input&&this.$emit("input",this.visible))},updateZindex:function(){this.tipZindex<_tools.UtilTools.getLastZIndex()&&(this.tipZindex=_tools.UtilTools.nextZIndex())},toVisible:function(e,t){if(this.targetActive=!0,e){var i=this.$el,o=this.tipStore,n=this.zIndex;return i.parentNode||document.body.appendChild(i),t&&(this.message=t),this.tipTarget=e,this.update(!0),this.updateZindex(),o.placement="top",o.style={width:"auto",left:0,top:0,zIndex:n||this.tipZindex},o.arrowStyle={left:"50%"},this.updatePlacement()}return this.$nextTick()},updatePlacement:function(){var t=this;return this.$nextTick().then(function(){var e=t.$el;if(t.tipTarget&&e)return updateTipStyle(t),t.$nextTick().then(function(){return updateTipStyle(t)})})},clickEvent:function(){this[this.visible?"close":"open"]()},targetMouseenterEvent:function(){this.open()},targetMouseleaveEvent:function(){var e=this,t=this.trigger,i=this.enterable,o=this.leaveDelay;this.targetActive=!1,i&&"hover"===t?setTimeout(function(){e.isHover||e.close()},o):this.close()},wrapperMouseenterEvent:function(){this.isHover=!0},wrapperMouseleaveEvent:function(e){var t=this,i=this.leaveMethod,o=this.trigger,n=this.enterable,s=this.leaveDelay;this.isHover=!1,i&&!1===i({$event:e})||n&&"hover"===o&&setTimeout(function(){t.targetActive||t.close()},s)}}};exports.default=_default2;
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")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function updateTipStyle(e){var t,i,n,o,r,s,l,a=e.$el,u=e.tipTarget,c=e.tipStore;u&&(t=(s=_tools.DomTools.getDomNode()).scrollTop,i=s.scrollLeft,n=s.visibleWidth,o=(l=_tools.DomTools.getAbsolutePos(u)).top,r=l.left,e=a.offsetHeight,s=a.offsetWidth,l=o-e-6,i+n<(a=Math.max(6,r+Math.floor((u.offsetWidth-s)/2)))+s+6&&(a=i+n-s-6),o-e<t+6&&(c.placement="bottom",l=o+u.offsetHeight+6),c.style.top="".concat(l,"px"),c.style.left="".concat(a,"px"),c.arrowStyle.left="".concat(r-a+u.offsetWidth/2,"px"))}function showTip(e){var t=e.$el,i=e.tipStore,n=e.zIndex;return t.parentNode||document.body.appendChild(t),e.updateValue(!0),e.updateZindex(),i.placement="top",i.style={width:"auto",left:0,top:0,zIndex:n||e.tipZindex},i.arrowStyle={left:"50%"},e.updatePlacement()}var _default2={name:"VxeTooltip",mixins:[_size.default],props:{value:Boolean,size:{type:String,default:function(){return _conf.default.tooltip.size||_conf.default.size}},trigger:{type:String,default:function(){return _conf.default.tooltip.trigger}},theme:{type:String,default:function(){return _conf.default.tooltip.theme}},content:[String,Number],zIndex:[String,Number],isArrow:{type:Boolean,default:!0},enterable:Boolean,enterDelay:{type:Number,default:function(){return _conf.default.tooltip.enterDelay}},leaveDelay:{type:Number,default:function(){return _conf.default.tooltip.leaveDelay}},leaveMethod:Function},data:function(){return{isUpdate:!1,visible:!1,message:"",tipActive:!1,tipTarget:null,tipZindex:0,tipStore:{style:{},placement:"",arrowStyle:null}}},watch:{content:function(e){this.message=e},value:function(e){this.isUpdate||this[e?"open":"close"](),this.isUpdate=!1}},created:function(){var e=this;this.showDelayTip=_xeUtils.default.debounce(function(){e.tipActive&&showTip(e)},this.enterDelay,{leading:!1,trailing:!0})},mounted:function(){var i,n=this.$el,e=this.trigger,t=this.content,o=this.value,r=n.parentNode;this.message=t,this.tipZindex=_tools.UtilTools.nextZIndex(),_xeUtils.default.arrayEach(n.children,function(e,t){1<t&&(r.insertBefore(e,n),i=i||e)}),r.removeChild(n),(this.target=i)&&("hover"===e?(i.onmouseleave=this.targetMouseleaveEvent,i.onmouseenter=this.targetMouseenterEvent):"click"===e&&(i.onclick=this.clickEvent)),o&&this.open()},beforeDestroy:function(){var e=this.$el,t=this.target,i=this.trigger,n=e.parentNode;n&&n.removeChild(e),t&&("hover"===i?(t.onmouseenter=null,t.onmouseleave=null):"click"===i&&(t.onclick=null))},render:function(e){var t,i=this.$scopedSlots,n=this.vSize,o=this.theme,r=this.message,s=this.tipActive,l=this.isArrow,a=this.visible,u=this.tipStore,c=this.enterable;return c&&(t={mouseenter:this.wrapperMouseenterEvent,mouseleave:this.wrapperMouseleaveEvent}),e("div",{class:["vxe-table--tooltip-wrapper","theme--".concat(o),(_defineProperty(o={},"size--".concat(n),n),_defineProperty(o,"placement--".concat(u.placement),u.placement),_defineProperty(o,"is--enterable",c),_defineProperty(o,"is--visible",a),_defineProperty(o,"is--arrow",l),_defineProperty(o,"is--actived",s),o)],style:u.style,ref:"tipWrapper",on:t},[e("div",{class:"vxe-table--tooltip-content"},i.content?i.content.call(this,{}):r),e("div",{class:"vxe-table--tooltip-arrow",style:u.arrowStyle})].concat(i.default?i.default.call(this,{}):[]))},methods:{open:function(e,t){return this.toVisible(e||this.target,t)},close:function(){return this.tipTarget=null,this.tipActive=!1,Object.assign(this.tipStore,{style:{},placement:"",arrowStyle:null}),this.updateValue(!1),this.$nextTick()},updateValue:function(e){e!==this.visible&&(this.visible=e,this.isUpdate=!0,this.$listeners.input&&this.$emit("input",this.visible))},updateZindex:function(){this.tipZindex<_tools.UtilTools.getLastZIndex()&&(this.tipZindex=_tools.UtilTools.nextZIndex())},toVisible:function(e,t){if(e){var i=this.trigger,n=this.enterDelay;if(this.tipActive=!0,this.tipTarget=e,t&&(this.message=t),!n||"hover"!==i)return showTip(this);this.showDelayTip()}return this.$nextTick()},updatePlacement:function(){var t=this;return this.$nextTick().then(function(){var e=t.$el;if(t.tipTarget&&e)return updateTipStyle(t),t.$nextTick().then(function(){return updateTipStyle(t)})})},isActived:function(){return this.tipActive},setActived:function(e){this.tipActive=!!e},clickEvent:function(){this[this.visible?"close":"open"]()},targetMouseenterEvent:function(){this.open()},targetMouseleaveEvent:function(){var e=this,t=this.trigger,i=this.enterable,n=this.leaveDelay;this.tipActive=!1,i&&"hover"===t?setTimeout(function(){e.tipActive||e.close()},n):this.close()},wrapperMouseenterEvent:function(){this.tipActive=!0},wrapperMouseleaveEvent:function(e){var t=this,i=this.leaveMethod,n=this.trigger,o=this.enterable,r=this.leaveDelay;this.tipActive=!1,i&&!1===i({$event:e})||o&&"hover"===n&&setTimeout(function(){t.tipActive||t.close()},r)}}};exports.default=_default2;
@@ -229,6 +229,7 @@ var _default = {
229
229
  // size: null,
230
230
  trigger: 'hover',
231
231
  theme: 'dark',
232
+ enterDelay: 500,
232
233
  leaveDelay: 300
233
234
  },
234
235
  pager: {// size: null,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var iconPrefix="vxe-icon--",_default={size:null,zIndex:999,version:0,emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!0,radioConfig:{strict:!0},checkboxConfig:{strict:!0},validConfig:{showMessage:!0,message:"default"},sortConfig:{showIcon:!0},filterConfig:{showIcon:!0},treeConfig:{rowField:"id",parentField:"parentId",children:"children",hasChild:"hasChild",mapChildren:"_X_CHILD",indent:20,showIcon:!0},expandConfig:{showIcon:!0},editConfig:{showIcon:!0,showAsterisk:!0},importConfig:{modes:["insert","covering"]},exportConfig:{modes:["current","selected"]},printConfig:{modes:["current","selected"]},mouseConfig:{extension:!0},keyboardConfig:{isEsc:!0},areaConfig:{selectCellByHeader:!0},clipConfig:{isCopy:!0,isCut:!0,isPaste:!0},fnrConfig:{isFind:!0,isReplace:!0},scrollX:{enabled:!0,gt:60},scrollY:{enabled:!0,gt:100}},export:{types:{}},icon:{TABLE_SORT_ASC:iconPrefix+"caret-top",TABLE_SORT_DESC:iconPrefix+"caret-bottom",TABLE_FILTER_NONE:iconPrefix+"funnel",TABLE_FILTER_MATCH:iconPrefix+"funnel",TABLE_EDIT:iconPrefix+"edit-outline",TABLE_HELP:iconPrefix+"question",TABLE_TREE_LOADED:iconPrefix+"refresh roll",TABLE_TREE_OPEN:iconPrefix+"caret-right rotate90",TABLE_TREE_CLOSE:iconPrefix+"caret-right",TABLE_EXPAND_LOADED:iconPrefix+"refresh roll",TABLE_EXPAND_OPEN:iconPrefix+"arrow-right rotate90",TABLE_EXPAND_CLOSE:iconPrefix+"arrow-right",BUTTON_DROPDOWN:iconPrefix+"arrow-bottom",BUTTON_LOADING:iconPrefix+"refresh roll",SELECT_LOADED:iconPrefix+"refresh roll",SELECT_OPEN:iconPrefix+"caret-bottom rotate180",SELECT_CLOSE:iconPrefix+"caret-bottom",PAGER_JUMP_PREV:iconPrefix+"d-arrow-left",PAGER_JUMP_NEXT:iconPrefix+"d-arrow-right",PAGER_PREV_PAGE:iconPrefix+"arrow-left",PAGER_NEXT_PAGE:iconPrefix+"arrow-right",PAGER_JUMP_MORE:iconPrefix+"more",INPUT_CLEAR:iconPrefix+"close",INPUT_PWD:iconPrefix+"eye-slash",INPUT_SHOW_PWD:iconPrefix+"eye",INPUT_PREV_NUM:iconPrefix+"caret-top",INPUT_NEXT_NUM:iconPrefix+"caret-bottom",INPUT_DATE:iconPrefix+"calendar",INPUT_SEARCH:iconPrefix+"search",MODAL_ZOOM_IN:iconPrefix+"square",MODAL_ZOOM_OUT:iconPrefix+"zoomout",MODAL_CLOSE:iconPrefix+"close",MODAL_INFO:iconPrefix+"info",MODAL_SUCCESS:iconPrefix+"success",MODAL_WARNING:iconPrefix+"warning",MODAL_ERROR:iconPrefix+"error",MODAL_QUESTION:iconPrefix+"question",MODAL_LOADING:iconPrefix+"refresh roll",TOOLBAR_TOOLS_REFRESH:iconPrefix+"refresh",TOOLBAR_TOOLS_REFRESH_LOADING:iconPrefix+"refresh roll",TOOLBAR_TOOLS_IMPORT:iconPrefix+"upload",TOOLBAR_TOOLS_EXPORT:iconPrefix+"download",TOOLBAR_TOOLS_PRINT:iconPrefix+"print",TOOLBAR_TOOLS_ZOOM_IN:iconPrefix+"zoomin",TOOLBAR_TOOLS_ZOOM_OUT:iconPrefix+"zoomout",TOOLBAR_TOOLS_CUSTOM:iconPrefix+"menu",FORM_PREFIX:iconPrefix+"question",FORM_SUFFIX:iconPrefix+"question",FORM_FOLDING:iconPrefix+"arrow-top rotate180",FORM_UNFOLDING:iconPrefix+"arrow-top"},grid:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,message:!0,props:{list:null,result:"result",total:"page.total",message:"message"}}},tooltip:{trigger:"hover",theme:"dark",leaveDelay:300},pager:{},form:{validConfig:{showMessage:!0,autoPos:!0},titleAsterisk:!0},input:{minDate:new Date(1900,0,1),maxDate:new Date(2100,0,1),startDay:1,selectDay:1,digits:2,controls:!0},textarea:{},select:{multiCharOverflow:8},toolbar:{},button:{},radio:{strict:!0},radioButton:{strict:!0},radioGroup:{strict:!0},checkbox:{},switch:{},modal:{top:15,showHeader:!0,minWidth:340,minHeight:140,lockView:!0,mask:!0,duration:3e3,marginSize:0,dblclickZoom:!0,showTitleOverflow:!0,animat:!0,showClose:!0,draggable:!0,storageKey:"VXE_MODAL_POSITION"},list:{scrollY:{enabled:!0,gt:100}},i18n:function(e){return e}};exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var iconPrefix="vxe-icon--",_default={size:null,zIndex:999,version:0,emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!0,radioConfig:{strict:!0},checkboxConfig:{strict:!0},validConfig:{showMessage:!0,message:"default"},sortConfig:{showIcon:!0},filterConfig:{showIcon:!0},treeConfig:{rowField:"id",parentField:"parentId",children:"children",hasChild:"hasChild",mapChildren:"_X_CHILD",indent:20,showIcon:!0},expandConfig:{showIcon:!0},editConfig:{showIcon:!0,showAsterisk:!0},importConfig:{modes:["insert","covering"]},exportConfig:{modes:["current","selected"]},printConfig:{modes:["current","selected"]},mouseConfig:{extension:!0},keyboardConfig:{isEsc:!0},areaConfig:{selectCellByHeader:!0},clipConfig:{isCopy:!0,isCut:!0,isPaste:!0},fnrConfig:{isFind:!0,isReplace:!0},scrollX:{enabled:!0,gt:60},scrollY:{enabled:!0,gt:100}},export:{types:{}},icon:{TABLE_SORT_ASC:iconPrefix+"caret-top",TABLE_SORT_DESC:iconPrefix+"caret-bottom",TABLE_FILTER_NONE:iconPrefix+"funnel",TABLE_FILTER_MATCH:iconPrefix+"funnel",TABLE_EDIT:iconPrefix+"edit-outline",TABLE_HELP:iconPrefix+"question",TABLE_TREE_LOADED:iconPrefix+"refresh roll",TABLE_TREE_OPEN:iconPrefix+"caret-right rotate90",TABLE_TREE_CLOSE:iconPrefix+"caret-right",TABLE_EXPAND_LOADED:iconPrefix+"refresh roll",TABLE_EXPAND_OPEN:iconPrefix+"arrow-right rotate90",TABLE_EXPAND_CLOSE:iconPrefix+"arrow-right",BUTTON_DROPDOWN:iconPrefix+"arrow-bottom",BUTTON_LOADING:iconPrefix+"refresh roll",SELECT_LOADED:iconPrefix+"refresh roll",SELECT_OPEN:iconPrefix+"caret-bottom rotate180",SELECT_CLOSE:iconPrefix+"caret-bottom",PAGER_JUMP_PREV:iconPrefix+"d-arrow-left",PAGER_JUMP_NEXT:iconPrefix+"d-arrow-right",PAGER_PREV_PAGE:iconPrefix+"arrow-left",PAGER_NEXT_PAGE:iconPrefix+"arrow-right",PAGER_JUMP_MORE:iconPrefix+"more",INPUT_CLEAR:iconPrefix+"close",INPUT_PWD:iconPrefix+"eye-slash",INPUT_SHOW_PWD:iconPrefix+"eye",INPUT_PREV_NUM:iconPrefix+"caret-top",INPUT_NEXT_NUM:iconPrefix+"caret-bottom",INPUT_DATE:iconPrefix+"calendar",INPUT_SEARCH:iconPrefix+"search",MODAL_ZOOM_IN:iconPrefix+"square",MODAL_ZOOM_OUT:iconPrefix+"zoomout",MODAL_CLOSE:iconPrefix+"close",MODAL_INFO:iconPrefix+"info",MODAL_SUCCESS:iconPrefix+"success",MODAL_WARNING:iconPrefix+"warning",MODAL_ERROR:iconPrefix+"error",MODAL_QUESTION:iconPrefix+"question",MODAL_LOADING:iconPrefix+"refresh roll",TOOLBAR_TOOLS_REFRESH:iconPrefix+"refresh",TOOLBAR_TOOLS_REFRESH_LOADING:iconPrefix+"refresh roll",TOOLBAR_TOOLS_IMPORT:iconPrefix+"upload",TOOLBAR_TOOLS_EXPORT:iconPrefix+"download",TOOLBAR_TOOLS_PRINT:iconPrefix+"print",TOOLBAR_TOOLS_ZOOM_IN:iconPrefix+"zoomin",TOOLBAR_TOOLS_ZOOM_OUT:iconPrefix+"zoomout",TOOLBAR_TOOLS_CUSTOM:iconPrefix+"menu",FORM_PREFIX:iconPrefix+"question",FORM_SUFFIX:iconPrefix+"question",FORM_FOLDING:iconPrefix+"arrow-top rotate180",FORM_UNFOLDING:iconPrefix+"arrow-top"},grid:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,message:!0,props:{list:null,result:"result",total:"page.total",message:"message"}}},tooltip:{trigger:"hover",theme:"dark",enterDelay:500,leaveDelay:300},pager:{},form:{validConfig:{showMessage:!0,autoPos:!0},titleAsterisk:!0},input:{minDate:new Date(1900,0,1),maxDate:new Date(2100,0,1),startDay:1,selectDay:1,digits:2,controls:!0},textarea:{},select:{multiCharOverflow:8},toolbar:{},button:{},radio:{strict:!0},radioButton:{strict:!0},radioGroup:{strict:!0},checkbox:{},switch:{},modal:{top:15,showHeader:!0,minWidth:340,minHeight:140,lockView:!0,mask:!0,duration:3e3,marginSize:0,dblclickZoom:!0,showTitleOverflow:!0,animat:!0,showClose:!0,draggable:!0,storageKey:"VXE_MODAL_POSITION"},list:{scrollY:{enabled:!0,gt:100}},i18n:function(e){return e}};exports.default=_default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.4.14-beta.1",
3
+ "version": "3.4.15",
4
4
  "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、贼灵活的配置项、扩展接口等...",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -66,11 +66,11 @@
66
66
  "vuex": "^3.4.0",
67
67
  "xe-ajax": "^4.0.5",
68
68
  "xe-clipboard": "^1.10.1",
69
- "xe-utils": "^3.5.2"
69
+ "xe-utils": "^3.5.4"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "vue": "^2.6.0",
73
- "xe-utils": "^3.5.2"
73
+ "xe-utils": "^3.5.0"
74
74
  },
75
75
  "vetur": {
76
76
  "tags": "helper/vetur/tags.json",
@@ -159,7 +159,7 @@ export default {
159
159
  * @param {Event} evnt 事件
160
160
  */
161
161
  confirmFilterEvent (evnt) {
162
- const { filterStore, filterOpts, scrollXLoad, scrollYLoad } = this
162
+ const { filterStore, filterOpts, scrollXLoad: oldScrollXLoad, scrollYLoad: oldScrollYLoad } = this
163
163
  const { column } = filterStore
164
164
  const { property } = column
165
165
  const values = []
@@ -175,19 +175,26 @@ export default {
175
175
  if (!filterOpts.remote) {
176
176
  this.handleTableData(true)
177
177
  this.checkSelectionStatus()
178
- this.updateFooter()
179
- if (scrollXLoad || scrollYLoad) {
180
- this.refreshScroll()
181
- if (scrollYLoad) {
182
- this.updateScrollYSpace()
183
- }
184
- }
185
178
  }
186
179
  this.emitEvent('filter-change', { column, property, values, datas, filters: filterList, filterList }, evnt)
187
180
  this.closeFilter()
188
- this.$nextTick(() => {
189
- this.recalculate()
181
+ this.updateFooter().then(() => {
182
+ const { scrollXLoad, scrollYLoad } = this
183
+ if ((oldScrollXLoad || scrollXLoad) || (oldScrollYLoad || scrollYLoad)) {
184
+ if ((oldScrollXLoad || scrollXLoad)) {
185
+ this.updateScrollXSpace()
186
+ }
187
+ if ((oldScrollYLoad || scrollYLoad)) {
188
+ this.updateScrollYSpace()
189
+ }
190
+ return this.refreshScroll()
191
+ }
192
+ }).then(() => {
190
193
  this.updateCellAreas()
194
+ return this.recalculate(true)
195
+ }).then(() => {
196
+ // 存在滚动行为未结束情况
197
+ setTimeout(() => this.recalculate(), 50)
191
198
  })
192
199
  },
193
200
  handleClearFilter (column) {
@@ -137,6 +137,11 @@ export default {
137
137
  default: null
138
138
  }
139
139
  },
140
+ data () {
141
+ return {
142
+ itemConfig: null
143
+ }
144
+ },
140
145
  watch,
141
146
  mounted () {
142
147
  assemItem(this)
@@ -3,7 +3,7 @@ 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
5
  import { UtilTools, DomTools, isEnableConf } from '../../tools'
6
- import { createItem } from './util'
6
+ import { createItem, handleFieldOrItem } from './util'
7
7
  import { renderTitle } from './render'
8
8
  import { eqEmptyValue } from '../../tools/src/utils'
9
9
  import { browse } from '../../tools/src/dom'
@@ -325,6 +325,10 @@ export default {
325
325
  }, { children: 'children' })
326
326
  return itemList
327
327
  },
328
+ getItemByField (field) {
329
+ const rest = XEUtils.findTree(this.formItems, item => item.field === field, { children: 'children' })
330
+ return rest ? rest.item : null
331
+ },
328
332
  toggleCollapse () {
329
333
  const status = !this.collapseAll
330
334
  this.collapseAll = status
@@ -416,11 +420,15 @@ export default {
416
420
  },
417
421
  handleTargetLeaveEvent () {
418
422
  const { tooltipOpts } = this
423
+ let $tooltip = this.$refs.tooltip
419
424
  this.tooltipActive = false
425
+ if ($tooltip) {
426
+ $tooltip.setActived(false)
427
+ }
420
428
  if (tooltipOpts.enterable) {
421
429
  this.tooltipTimeout = setTimeout(() => {
422
- const $tooltip = this.$refs.tooltip
423
- if ($tooltip && !$tooltip.isHover) {
430
+ $tooltip = this.$refs.tooltip
431
+ if ($tooltip && !$tooltip.isActived()) {
424
432
  this.closeTooltip()
425
433
  }
426
434
  }, tooltipOpts.leaveDelay)
@@ -428,15 +436,14 @@ export default {
428
436
  this.closeTooltip()
429
437
  }
430
438
  },
431
- clearValidate (field) {
432
- const itemList = this.getItems()
433
- if (field) {
434
- const item = itemList.find(item => item.field === field)
439
+ clearValidate (fieldOrItem) {
440
+ if (fieldOrItem) {
441
+ const item = handleFieldOrItem(this, fieldOrItem)
435
442
  if (item) {
436
443
  item.showError = false
437
444
  }
438
445
  } else {
439
- itemList.forEach(item => {
446
+ this.getItems().forEach(item => {
440
447
  item.showError = false
441
448
  })
442
449
  }
@@ -446,8 +453,9 @@ export default {
446
453
  this.clearValidate()
447
454
  return this.beginValidate(this.getItems(), '', callback)
448
455
  },
449
- validateField (field, callback) {
450
- return this.beginValidate(this.getItems().filter(item => item.field === field), '', callback)
456
+ validateField (fieldOrItem, callback) {
457
+ const item = handleFieldOrItem(this, fieldOrItem)
458
+ return this.beginValidate(item ? [item] : [], '', callback)
451
459
  },
452
460
  beginValidate (itemList, type, callback) {
453
461
  const { data, rules: formRules, validOpts } = this
@@ -480,7 +488,7 @@ export default {
480
488
  callback()
481
489
  }
482
490
  }).catch(() => {
483
- return new Promise((resolve, reject) => {
491
+ return new Promise((resolve) => {
484
492
  this.showErrTime = setTimeout(() => {
485
493
  itemList.forEach(item => {
486
494
  if (item.errRule) {
@@ -497,7 +505,7 @@ export default {
497
505
  callback(validRest)
498
506
  resolve()
499
507
  } else {
500
- reject(validRest)
508
+ resolve(validRest)
501
509
  }
502
510
  })
503
511
  })
@@ -574,9 +582,8 @@ export default {
574
582
  },
575
583
  handleFocus (fields) {
576
584
  const { $el } = this
577
- const itemList = this.getItems()
578
585
  fields.some((property, index) => {
579
- const item = itemList.find(item => item.field === property)
586
+ const item = this.getItemByField(property)
580
587
  if (item && isEnableConf(item.itemRender)) {
581
588
  const { itemRender } = item
582
589
  const compConf = VXETable.renderer.get(itemRender.name)
@@ -619,8 +626,7 @@ export default {
619
626
  this.clearValidate(property)
620
627
  })
621
628
  .catch(({ rule }) => {
622
- const itemList = this.getItems()
623
- const item = itemList.find(item => item.field === property)
629
+ const item = this.getItemByField(property)
624
630
  if (item) {
625
631
  item.showError = true
626
632
  item.errRule = rule
@@ -49,6 +49,13 @@ export function getItemConfig ($xeform, _vm, options) {
49
49
  return isItem(_vm) ? _vm : new ItemConfig($xeform, _vm, options)
50
50
  }
51
51
 
52
+ export const handleFieldOrItem = ($xeform, fieldOrItem) => {
53
+ if (fieldOrItem) {
54
+ return XEUtils.isString(fieldOrItem) ? $xeform.getItemByField(fieldOrItem) : fieldOrItem
55
+ }
56
+ return null
57
+ }
58
+
52
59
  export function createItem ($xeform, _vm) {
53
60
  return getItemConfig($xeform, _vm)
54
61
  }
@@ -0,0 +1,38 @@
1
+ import XEUtils from 'xe-utils'
2
+
3
+ export function toStringTimeDate (str) {
4
+ if (str) {
5
+ const rest = new Date()
6
+ let h, m, s
7
+ if (XEUtils.isDate(str)) {
8
+ h = str.getHours()
9
+ m = str.getMinutes()
10
+ s = str.getSeconds()
11
+ } else {
12
+ str = XEUtils.toValueString(str)
13
+ const parses = str.match(/^(\d{1,2})(:(\d{1,2}))?(:(\d{1,2}))?/)
14
+ if (parses) {
15
+ h = parses[1]
16
+ m = parses[3]
17
+ s = parses[5]
18
+ }
19
+ }
20
+ rest.setHours(h || 0)
21
+ rest.setMinutes(m || 0)
22
+ rest.setSeconds(s || 0)
23
+ return rest
24
+ }
25
+ return new Date('')
26
+ }
27
+
28
+ export function getDateQuarter (date) {
29
+ const month = date.getMonth()
30
+ if (month < 3) {
31
+ return 1
32
+ } else if (month < 6) {
33
+ return 2
34
+ } else if (month < 9) {
35
+ return 3
36
+ }
37
+ return 4
38
+ }
@@ -2,55 +2,13 @@ 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 { UtilTools, DomTools, GlobalEvent } from '../../tools'
5
+ import { toStringTimeDate, getDateQuarter } from './date'
6
+ import { handleNumber, toFloatValueFixed } from './number'
5
7
 
6
8
  const yearSize = 20
7
9
  const monthSize = 20
8
10
  const quarterSize = 8
9
11
 
10
- function toStringTimeDate (str) {
11
- if (str) {
12
- const rest = new Date()
13
- let h, m, s
14
- if (XEUtils.isDate(str)) {
15
- h = str.getHours()
16
- m = str.getMinutes()
17
- s = str.getSeconds()
18
- } else {
19
- str = XEUtils.toValueString(str)
20
- const parses = str.match(/^(\d{1,2})(:(\d{1,2}))?(:(\d{1,2}))?/)
21
- if (parses) {
22
- h = parses[1]
23
- m = parses[3]
24
- s = parses[5]
25
- }
26
- }
27
- rest.setHours(h || 0)
28
- rest.setMinutes(m || 0)
29
- rest.setSeconds(s || 0)
30
- return rest
31
- }
32
- return new Date('')
33
- }
34
-
35
- function getDateQuarter (date) {
36
- const month = date.getMonth()
37
- if (month < 3) {
38
- return 1
39
- } else if (month < 6) {
40
- return 2
41
- } else if (month < 9) {
42
- return 3
43
- }
44
- return 4
45
- }
46
-
47
- function toFloatValueFixed (inputValue, digitsValue) {
48
- if (/^-/.test('' + inputValue)) {
49
- return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue)
50
- }
51
- return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue)
52
- }
53
-
54
12
  function getNumberValue (_vm, val) {
55
13
  const { type, exponential, digitsValue, inpMaxlength } = _vm
56
14
  const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val))
@@ -1304,7 +1262,7 @@ export default {
1304
1262
  if (!inpReadonly) {
1305
1263
  if (isNumType) {
1306
1264
  if (inputValue) {
1307
- let inpNumVal = type === 'integer' ? XEUtils.toInteger(inputValue) : XEUtils.toNumber(inputValue)
1265
+ let inpNumVal = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
1308
1266
  if (!this.vaildMinNum(inpNumVal)) {
1309
1267
  inpNumVal = min
1310
1268
  } else if (!this.vaildMaxNum(inpNumVal)) {
@@ -1446,7 +1404,7 @@ export default {
1446
1404
  },
1447
1405
  numberChange (isPlus, evnt) {
1448
1406
  const { min, max, type, inputValue, stepValue } = this
1449
- const numValue = type === 'integer' ? XEUtils.toInteger(inputValue) : XEUtils.toNumber(inputValue)
1407
+ const numValue = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
1450
1408
  const newValue = isPlus ? XEUtils.add(numValue, stepValue) : XEUtils.subtract(numValue, stepValue)
1451
1409
  let restNum
1452
1410
  if (!this.vaildMinNum(newValue)) {
@@ -0,0 +1,12 @@
1
+ import XEUtils from 'xe-utils'
2
+
3
+ export function handleNumber (val) {
4
+ return XEUtils.isString(val) ? val.replace(/,/g, '') : val
5
+ }
6
+
7
+ export function toFloatValueFixed (inputValue, digitsValue) {
8
+ if (/^-/.test('' + inputValue)) {
9
+ return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue)
10
+ }
11
+ return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue)
12
+ }