vxe-table 3.7.0-beta.1 → 3.7.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -9
- package/helper/vetur/attributes.json +86 -22
- package/helper/vetur/tags.json +17 -1
- package/lib/button/src/button.js +9 -3
- package/lib/button/src/button.min.js +1 -1
- package/lib/edit/src/mixin.js +10 -10
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/export/src/mixin.js +24 -13
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/filter/src/mixin.js +13 -7
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/form/src/form.js +27 -5
- package/lib/form/src/form.min.js +1 -1
- package/lib/grid/src/grid.js +7 -3
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +559 -229
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +11 -1
- package/lib/input/src/input.min.js +1 -1
- package/lib/locale/lang/en-US.js +8 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +8 -0
- package/lib/locale/lang/es-ES.js +8 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +8 -0
- package/lib/locale/lang/ja-JP.d.ts +1 -1
- package/lib/locale/lang/ja-JP.js +8 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +8 -0
- package/lib/locale/lang/pt-BR.d.ts +8 -0
- package/lib/locale/lang/pt-BR.js +330 -0
- package/lib/locale/lang/pt-BR.min.js +1 -0
- package/lib/locale/lang/pt-BR.umd.js +344 -0
- package/lib/locale/lang/zh-CN.d.ts +1 -1
- package/lib/locale/lang/zh-CN.js +8 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +8 -0
- package/lib/locale/lang/zh-HK.d.ts +1 -1
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +8 -0
- package/lib/locale/lang/zh-MO.d.ts +1 -1
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +8 -0
- package/lib/locale/lang/zh-TC.d.ts +1 -1
- package/lib/locale/lang/zh-TC.js +8 -0
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +8 -0
- package/lib/locale/lang/zh-TW.d.ts +1 -1
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +8 -0
- package/lib/menu/src/mixin.js +3 -3
- package/lib/menu/src/mixin.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +11 -2
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/select/src/select.js +11 -2
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +3 -2
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +9 -7
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +7 -7
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +171 -124
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +22 -29
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +3 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +7 -2
- package/lib/table/style/style.min.css +1 -1
- package/lib/textarea/src/textarea.js +6 -1
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +23 -7
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/tooltip/src/tooltip.js +5 -1
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tooltip/style/style.css +0 -6
- package/lib/tooltip/style/style.min.css +1 -1
- package/lib/v-x-e-table/index.js +3 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/commands.js +60 -2
- package/lib/v-x-e-table/src/commands.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +7 -4
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/lib/v-x-e-table/src/formats.js +60 -2
- package/lib/v-x-e-table/src/formats.min.js +1 -1
- package/lib/v-x-e-table/src/menus.js +60 -2
- package/lib/v-x-e-table/src/menus.min.js +1 -1
- package/lib/v-x-e-table/src/renderer.js +10 -0
- package/lib/v-x-e-table/src/renderer.min.js +1 -1
- package/lib/v-x-e-table/src/store.js +5 -2
- package/lib/v-x-e-table/src/store.min.js +1 -1
- package/lib/v-x-e-table/src/validators.js +15 -0
- package/lib/v-x-e-table/src/validators.min.js +1 -0
- package/lib/validator/src/mixin.js +36 -4
- package/lib/validator/src/mixin.min.js +1 -1
- package/package.json +2 -2
- package/packages/button/src/button.js +5 -4
- package/packages/edit/src/mixin.js +10 -9
- package/packages/export/src/mixin.js +22 -13
- package/packages/filter/src/mixin.js +5 -1
- package/packages/form/src/form.js +27 -6
- package/packages/grid/src/grid.js +7 -3
- package/packages/input/src/input.js +9 -1
- package/packages/locale/lang/en-US.js +8 -0
- package/packages/locale/lang/es-ES.js +8 -0
- package/packages/locale/lang/ja-JP.d.ts +1 -1
- package/packages/locale/lang/ja-JP.js +8 -0
- package/packages/locale/lang/pt-BR.d.ts +8 -0
- package/packages/locale/lang/pt-BR.js +323 -0
- package/packages/locale/lang/zh-CN.d.ts +1 -1
- package/packages/locale/lang/zh-CN.js +8 -0
- package/packages/locale/lang/zh-HK.d.ts +1 -1
- package/packages/locale/lang/zh-MO.d.ts +1 -1
- package/packages/locale/lang/zh-TC.d.ts +1 -1
- package/packages/locale/lang/zh-TC.js +8 -0
- package/packages/locale/lang/zh-TW.d.ts +1 -1
- package/packages/menu/src/mixin.js +3 -3
- package/packages/pulldown/src/pulldown.js +6 -3
- package/packages/select/src/select.js +7 -3
- package/packages/table/src/body.js +3 -2
- package/packages/table/src/cell.js +9 -5
- package/packages/table/src/columnInfo.js +7 -7
- package/packages/table/src/methods.js +142 -93
- package/packages/table/src/table.js +17 -7
- package/packages/table/src/util.js +3 -1
- package/packages/textarea/src/textarea.js +4 -1
- package/packages/toolbar/src/toolbar.js +22 -7
- package/packages/tooltip/src/tooltip.js +3 -2
- package/packages/v-x-e-table/index.js +2 -0
- package/packages/v-x-e-table/src/commands.js +50 -2
- package/packages/v-x-e-table/src/conf.js +7 -4
- package/packages/v-x-e-table/src/formats.js +50 -2
- package/packages/v-x-e-table/src/menus.js +50 -2
- package/packages/v-x-e-table/src/renderer.js +11 -1
- package/packages/v-x-e-table/src/store.js +4 -2
- package/packages/v-x-e-table/src/validators.js +7 -0
- package/packages/validator/src/mixin.js +35 -4
- package/styles/all.scss +30 -0
- package/styles/css-variable.scss +272 -0
- package/styles/cssvar.scss +2 -275
- package/styles/index.scss +2 -0
- package/styles/modules.scss +4 -1
- package/styles/table.scss +11 -4
- package/styles/tooltip.scss +0 -8
- package/styles/variable.scss +1 -4
- package/types/all.d.ts +2 -2
- package/types/colgroup.d.ts +3 -1
- package/types/column.d.ts +3 -0
- package/types/edit.d.ts +4 -2
- package/types/export.d.ts +3 -0
- package/types/filter.d.ts +3 -1
- package/types/footer.d.ts +3 -1
- package/types/form-item.d.ts +2 -0
- package/types/form.d.ts +16 -12
- package/types/grid.d.ts +3 -0
- package/types/header.d.ts +3 -1
- package/types/index.d.ts +1 -1
- package/types/input.d.ts +2 -0
- package/types/list.d.ts +1 -1
- package/types/menu.d.ts +2 -0
- package/types/modal.d.ts +7 -3
- package/types/pulldown.d.ts +2 -3
- package/types/table.d.ts +54 -30
- package/types/textarea.d.ts +1 -0
- package/types/toolbar.d.ts +2 -0
- package/types/tooltip.d.ts +1 -1
- package/types/v-x-e-table/commands.d.ts +23 -13
- package/types/v-x-e-table/formats.d.ts +21 -12
- package/types/v-x-e-table/index.d.ts +33 -26
- package/types/v-x-e-table/interceptor.d.ts +1 -1
- package/types/v-x-e-table/menus.d.ts +17 -6
- package/types/v-x-e-table/renderer.d.ts +5 -3
- package/types/v-x-e-table/setup.d.ts +10 -33
- package/types/v-x-e-table/validators.d.ts +30 -0
- package/types/validator.d.ts +15 -4
- /package/lib/icon/style/{iconfont.1688948811910.ttf → iconfont.1691021948915.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1688948811910.woff → iconfont.1691021948915.woff} +0 -0
- /package/lib/icon/style/{iconfont.1688948811910.woff2 → iconfont.1691021948915.woff2} +0 -0
- /package/lib/{iconfont.1688948811910.ttf → iconfont.1691021948915.ttf} +0 -0
- /package/lib/{iconfont.1688948811910.woff → iconfont.1691021948915.woff} +0 -0
- /package/lib/{iconfont.1688948811910.woff2 → iconfont.1691021948915.woff2} +0 -0
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
8
|
+
var _vXETable = _interopRequireDefault(require("../../v-x-e-table"));
|
|
8
9
|
var _conf = _interopRequireDefault(require("../../v-x-e-table/src/conf"));
|
|
9
10
|
var _utils = require("../../tools/utils");
|
|
11
|
+
var _log = require("../../tools/log");
|
|
10
12
|
var _dom = _interopRequireDefault(require("../../tools/dom"));
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -79,12 +81,22 @@ var _default = {
|
|
|
79
81
|
* 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
|
|
80
82
|
*/
|
|
81
83
|
_fullValidate: function _fullValidate(rows, cb) {
|
|
84
|
+
if (process.env.NODE_ENV === 'development') {
|
|
85
|
+
if (_xeUtils["default"].isFunction(cb)) {
|
|
86
|
+
(0, _log.warnLog)('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)']);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
82
89
|
return this.beginValidate(rows, cb, true);
|
|
83
90
|
},
|
|
84
91
|
/**
|
|
85
92
|
* 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
|
|
86
93
|
*/
|
|
87
94
|
_validate: function _validate(rows, cb) {
|
|
95
|
+
if (process.env.NODE_ENV === 'development') {
|
|
96
|
+
if (_xeUtils["default"].isFunction(cb)) {
|
|
97
|
+
(0, _log.warnLog)('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)']);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
88
100
|
return this.beginValidate(rows, cb);
|
|
89
101
|
},
|
|
90
102
|
/**
|
|
@@ -276,10 +288,11 @@ var _default = {
|
|
|
276
288
|
rules.forEach(function (rule) {
|
|
277
289
|
var type = rule.type,
|
|
278
290
|
trigger = rule.trigger,
|
|
279
|
-
required = rule.required
|
|
291
|
+
required = rule.required,
|
|
292
|
+
validator = rule.validator;
|
|
280
293
|
if (validType === 'all' || !trigger || validType === trigger) {
|
|
281
|
-
if (
|
|
282
|
-
var
|
|
294
|
+
if (validator) {
|
|
295
|
+
var validParams = {
|
|
283
296
|
cellValue: cellValue,
|
|
284
297
|
rule: rule,
|
|
285
298
|
rules: rules,
|
|
@@ -289,7 +302,26 @@ var _default = {
|
|
|
289
302
|
columnIndex: _this3.getColumnIndex(column),
|
|
290
303
|
field: column.property,
|
|
291
304
|
$table: _this3
|
|
292
|
-
}
|
|
305
|
+
};
|
|
306
|
+
var customValid;
|
|
307
|
+
if (_xeUtils["default"].isString(validator)) {
|
|
308
|
+
var gvItem = _vXETable["default"].validators.get(validator);
|
|
309
|
+
if (gvItem) {
|
|
310
|
+
if (gvItem.cellValidatorMethod) {
|
|
311
|
+
customValid = gvItem.cellValidatorMethod(validParams);
|
|
312
|
+
} else {
|
|
313
|
+
if (process.env.NODE_ENV === 'development') {
|
|
314
|
+
(0, _log.warnLog)('vxe.error.notValidators', [validator]);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
if (process.env.NODE_ENV === 'development') {
|
|
319
|
+
(0, _log.errLog)('vxe.error.notValidators', [validator]);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
customValid = validator(validParams);
|
|
324
|
+
}
|
|
293
325
|
if (customValid) {
|
|
294
326
|
if (_xeUtils["default"].isError(customValid)) {
|
|
295
327
|
_this3.validRuleErr = true;
|
|
@@ -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")),_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
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_vXETable=_interopRequireDefault(require("../../v-x-e-table")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_utils=require("../../tools/utils"),_log=require("../../tools/log"),_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 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),Object.defineProperty(e,"prototype",{writable:!1}),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,l=e.min,i=e.max,e=e.pattern,r="number"===r,n=r?_xeUtils.default.toNumber(t):_xeUtils.default.getSize(t);return!(!r||!isNaN(t))||!_xeUtils.default.eqNull(l)&&n<_xeUtils.default.toNumber(l)||!_xeUtils.default.eqNull(i)&&n>_xeUtils.default.toNumber(i)||!(!e||(_xeUtils.default.isRegExp(e)?e:new RegExp(e)).test(t))}var _default={methods:{_fullValidate:function(e,t){return"development"===process.env.NODE_ENV&&_xeUtils.default.isFunction(t)&&(0,_log.warnLog)("vxe.error.notValidators",["fullValidate(rows, callback)","fullValidate(rows)"]),this.beginValidate(e,t,!0)},_validate:function(e,t){return"development"===process.env.NODE_ENV&&_xeUtils.default.isFunction(t)&&(0,_log.warnLog)("vxe.error.notValidators",["validate(rows, callback)","validate(rows)"]),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,a,l){var t,i,u=this,s={},n=this.editRules,c=this.afterFullData,d=this.treeConfig,r=this.treeOpts,o=(!0===e?t=c:e&&(_xeUtils.default.isFunction(e)?a=e:t=_xeUtils.default.isArray(e)?e:[e]),t=t||this.getInsertRecords().concat(this.getUpdateRecords()),[]);return this.lastCallTime=Date.now(),this.validRuleErr=!1,this.clearValidate(),n?(i=this.getColumns(),e=function(r){var e;!l&&u.validRuleErr||(e=[],i.forEach(function(t){!l&&u.validRuleErr||!_xeUtils.default.has(n,t.property)||e.push(u.validCellRules("all",r,t).catch(function(e){e={rule:e.rule,rules:e.rules,rowIndex:u.getRowIndex(r),row:r,columnIndex:u.getColumnIndex(t),column:t,field:t.property,$table:u};if(s[t.property]||(s[t.property]=[]),s[t.property].push(e),!l)return u.validRuleErr=!0,Promise.reject(e)}))}),o.push(Promise.all(e)))},d?_xeUtils.default.eachTree(t,e,r):t.forEach(e),Promise.all(o).then(function(){var e=Object.keys(s);return u.$nextTick().then(function(){if(e.length)return Promise.reject(s[e[0]][0]);a&&a()})}).catch(function(o){return new Promise(function(e,t){function r(){u.$nextTick(function(){a?(a(s),e()):("obsolete"===_conf.default.validToReject?t:e)(s)})}function l(){o.cell=u.getCell(o.row,o.column),_dom.default.scrollToView(o.cell),u.handleValidError(o).then(r)}var i=o.row,n=c.indexOf(i),n=0<n?c[n-1]:i;!1===u.validOpts.autoPos?r():(d?u.scrollToTreeRow(n):u.scrollToRow(n)).then(l)})})):this.$nextTick().then(function(){a&&a()})},hasCellRules:function(t,e,r){var l=this.editRules,r=r.property;return!(!r||!l)&&(l=_xeUtils.default.get(l,r))&&_xeUtils.default.find(l,function(e){return"all"===t||!e.trigger||t===e.trigger})},validCellRules:function(u,s,c,e){var d,f,h=this,t=this.editRules,r=c.property,v=[],p=[];return r&&t&&(d=_xeUtils.default.get(t,r))&&(f=_xeUtils.default.isUndefined(e)?_xeUtils.default.get(s,r):e,d.forEach(function(t){var e,r,l,i=t.type,n=t.trigger,o=t.required,a=t.validator;"all"!==u&&n&&u!==n||(a?(l={cellValue:f,rule:t,rules:d,row:s,rowIndex:h.getRowIndex(s),column:c,columnIndex:h.getColumnIndex(c),field:c.property,$table:h},_xeUtils.default.isString(a)?(r=_vXETable.default.validators.get(a))?r.cellValidatorMethod?e=r.cellValidatorMethod(l):"development"===process.env.NODE_ENV&&(0,_log.warnLog)("vxe.error.notValidators",[a]):"development"===process.env.NODE_ENV&&(0,_log.errLog)("vxe.error.notValidators",[a]):e=a(l),e&&(_xeUtils.default.isError(e)?(h.validRuleErr=!0,v.push(new Rule({type:"custom",trigger:n,content:e.message,rule:new Rule(t)}))):e.catch&&p.push(e.catch(function(e){h.validRuleErr=!0,v.push(new Rule({type:"custom",trigger:n,content:e&&e.message?e.message:t.content||t.message,rule:new Rule(t)}))})))):(r="array"===i,a=_xeUtils.default.isArray(f),l=!0,l=r||a?!a||!f.length:_xeUtils.default.isString(f)?(0,_utils.eqEmptyValue)(f.trim()):(0,_utils.eqEmptyValue)(f),(o?l||validErrorRuleValue(t,f):!l&&validErrorRuleValue(t,f))&&(h.validRuleErr=!0,v.push(new Rule(t)))))})),Promise.all(p).then(function(){if(v.length)return Promise.reject({rules:v,rule:v[0]})})},_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 i=l.args,o=i.row,a=i.column,u=i.cell;if(this.hasCellRules(t,o,a))return this.validCellRules(t,o,a).then(function(){"row"===e.mode&&n.visible&&n.row===o&&n.column===a&&r.clearValidate()}).catch(function(e){var e=e.rule;return e.trigger&&t!==e.trigger?Promise.resolve():(r.showValidTooltip(e={rule:e,row:o,column:a,cell:u}),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,a=e.row,u=e.column,s=e.cell,c=r.validTip,d=o.content;return this.$nextTick(function(){if(Object.assign(t.validStore,{row:a,column:u,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;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
4
|
-
"description": "一个基于 vue 的 PC
|
|
3
|
+
"version": "3.7.0-beta.11",
|
|
4
|
+
"description": "一个基于 vue 的 PC 端表单/表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式为零代码而设计...",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
7
7
|
"serve": "vue-cli-service serve",
|
|
@@ -21,7 +21,8 @@ export default {
|
|
|
21
21
|
disabled: Boolean,
|
|
22
22
|
loading: Boolean,
|
|
23
23
|
destroyOnClose: Boolean,
|
|
24
|
-
className: String,
|
|
24
|
+
className: [String, Function],
|
|
25
|
+
popupClassName: [String, Function],
|
|
25
26
|
transfer: { type: Boolean, default: () => GlobalConfig.button.transfer }
|
|
26
27
|
},
|
|
27
28
|
data () {
|
|
@@ -58,10 +59,10 @@ export default {
|
|
|
58
59
|
GlobalEvent.off(this, 'mousewheel')
|
|
59
60
|
},
|
|
60
61
|
render (h) {
|
|
61
|
-
const { $scopedSlots, $listeners, className, inited, type, destroyOnClose, isFormBtn, status, btnType, vSize, name, disabled, loading, showPanel, animatVisible, panelPlacement } = this
|
|
62
|
+
const { $scopedSlots, $listeners, className, popupClassName, inited, type, destroyOnClose, isFormBtn, status, btnType, vSize, name, disabled, loading, showPanel, animatVisible, panelPlacement } = this
|
|
62
63
|
const downsSlot = $scopedSlots.dropdowns
|
|
63
64
|
return downsSlot ? h('div', {
|
|
64
|
-
class: ['vxe-button--dropdown', className, {
|
|
65
|
+
class: ['vxe-button--dropdown', className ? (XEUtils.isFunction(className) ? className({ $button: this }) : className) : '', {
|
|
65
66
|
[`size--${vSize}`]: vSize,
|
|
66
67
|
'is--active': showPanel
|
|
67
68
|
}]
|
|
@@ -92,7 +93,7 @@ export default {
|
|
|
92
93
|
])),
|
|
93
94
|
h('div', {
|
|
94
95
|
ref: 'panel',
|
|
95
|
-
class: ['vxe-button--dropdown-panel', {
|
|
96
|
+
class: ['vxe-button--dropdown-panel', popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $button: this }) : popupClassName) : '', {
|
|
96
97
|
[`size--${vSize}`]: vSize,
|
|
97
98
|
'animat--leave': animatVisible,
|
|
98
99
|
'animat--enter': showPanel
|
|
@@ -7,19 +7,20 @@ import { warnLog, errLog, getLog } from '../../tools/log'
|
|
|
7
7
|
|
|
8
8
|
function insertTreeRow (_vm, newRecords, isAppend) {
|
|
9
9
|
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
|
|
10
|
-
const { rowField, parentField,
|
|
10
|
+
const { rowField, parentField, mapChildrenField } = treeOpts
|
|
11
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
11
12
|
const funcName = isAppend ? 'push' : 'unshift'
|
|
12
13
|
newRecords.forEach(item => {
|
|
13
14
|
const parentRowId = item[parentField]
|
|
14
15
|
const rowid = getRowid(_vm, item)
|
|
15
|
-
const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, item => parentRowId === item[rowField], { children:
|
|
16
|
+
const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, item => parentRowId === item[rowField], { children: mapChildrenField }) : null
|
|
16
17
|
if (matchObj) {
|
|
17
18
|
const { item: parentRow } = matchObj
|
|
18
19
|
const parentRest = fullAllDataRowIdData[getRowid(_vm, parentRow)]
|
|
19
20
|
const parentLevel = parentRest ? parentRest.level : 0
|
|
20
|
-
let parentChilds = parentRow[
|
|
21
|
+
let parentChilds = parentRow[childrenField]
|
|
21
22
|
if (!XEUtils.isArray(parentChilds)) {
|
|
22
|
-
parentChilds = parentRow[
|
|
23
|
+
parentChilds = parentRow[childrenField] = []
|
|
23
24
|
}
|
|
24
25
|
parentChilds[funcName](item)
|
|
25
26
|
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
|
|
@@ -60,7 +61,7 @@ export default {
|
|
|
60
61
|
*/
|
|
61
62
|
_insertAt (records, row) {
|
|
62
63
|
const { tableFullTreeData, mergeList, afterFullData, editStore, tableFullData, treeConfig, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = this
|
|
63
|
-
const { transform, rowField,
|
|
64
|
+
const { transform, rowField, mapChildrenField } = treeOpts
|
|
64
65
|
if (!XEUtils.isArray(records)) {
|
|
65
66
|
records = [records]
|
|
66
67
|
}
|
|
@@ -99,7 +100,7 @@ export default {
|
|
|
99
100
|
} else {
|
|
100
101
|
// 如果为虚拟树
|
|
101
102
|
if (treeConfig && transform) {
|
|
102
|
-
const matchObj = XEUtils.findTree(tableFullTreeData, item => row[rowField] === item[rowField], { children:
|
|
103
|
+
const matchObj = XEUtils.findTree(tableFullTreeData, item => row[rowField] === item[rowField], { children: mapChildrenField })
|
|
103
104
|
if (matchObj) {
|
|
104
105
|
const { parent: parentRow } = matchObj
|
|
105
106
|
const parentChilds = matchObj.items
|
|
@@ -192,7 +193,7 @@ export default {
|
|
|
192
193
|
* 如果为空则删除所有
|
|
193
194
|
*/
|
|
194
195
|
_remove (rows) {
|
|
195
|
-
const { afterFullData, tableFullData, tableFullTreeData, treeConfig, mergeList, editStore, checkboxOpts,
|
|
196
|
+
const { afterFullData, tableFullData, tableFullTreeData, treeConfig, mergeList, editStore, checkboxOpts, selectCheckboxRows, isInsertByRow, treeOpts } = this
|
|
196
197
|
const { transform } = treeOpts
|
|
197
198
|
const { actived, removeList, insertList, insertMaps } = editStore
|
|
198
199
|
const { checkField } = checkboxOpts
|
|
@@ -211,9 +212,9 @@ export default {
|
|
|
211
212
|
// 如果绑定了多选属性,则更新状态
|
|
212
213
|
if (!checkField) {
|
|
213
214
|
rows.forEach(row => {
|
|
214
|
-
const sIndex = this.findRowIndexOf(
|
|
215
|
+
const sIndex = this.findRowIndexOf(selectCheckboxRows, row)
|
|
215
216
|
if (sIndex > -1) {
|
|
216
|
-
|
|
217
|
+
selectCheckboxRows.splice(sIndex, 1)
|
|
217
218
|
}
|
|
218
219
|
})
|
|
219
220
|
}
|
|
@@ -38,7 +38,8 @@ function getExportBlobByContent (content, options) {
|
|
|
38
38
|
|
|
39
39
|
function hasTreeChildren ($xetable, row) {
|
|
40
40
|
const treeOpts = $xetable.treeOpts
|
|
41
|
-
|
|
41
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
42
|
+
return row[childrenField] && row[childrenField].length > 0
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
function getSeq ($xetable, row, $rowIndex, column, $columnIndex) {
|
|
@@ -77,7 +78,7 @@ function toBooleanValue (cellValue) {
|
|
|
77
78
|
|
|
78
79
|
function getLabelData ($xetable, opts, columns, datas) {
|
|
79
80
|
const { isAllExpand, mode } = opts
|
|
80
|
-
const { treeConfig, treeOpts, radioOpts, checkboxOpts } = $xetable
|
|
81
|
+
const { treeConfig, treeOpts, radioOpts, checkboxOpts, columnOpts } = $xetable
|
|
81
82
|
if (!htmlCellElem) {
|
|
82
83
|
htmlCellElem = document.createElement('div')
|
|
83
84
|
}
|
|
@@ -99,15 +100,18 @@ function getLabelData ($xetable, opts, columns, datas) {
|
|
|
99
100
|
columns.forEach((column, $columnIndex) => {
|
|
100
101
|
let cellValue = ''
|
|
101
102
|
const renderOpts = column.editRender || column.cellRender
|
|
102
|
-
let
|
|
103
|
-
if (!
|
|
103
|
+
let bodyExportMethod = column.exportMethod
|
|
104
|
+
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
104
105
|
const compConf = VXETable.renderer.get(renderOpts.name)
|
|
105
106
|
if (compConf) {
|
|
106
|
-
|
|
107
|
+
bodyExportMethod = compConf.exportMethod || compConf.cellExportMethod
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
if (
|
|
110
|
-
|
|
110
|
+
if (!bodyExportMethod) {
|
|
111
|
+
bodyExportMethod = columnOpts.exportMethod
|
|
112
|
+
}
|
|
113
|
+
if (bodyExportMethod) {
|
|
114
|
+
cellValue = bodyExportMethod({ $table: $xetable, row, column, options: opts })
|
|
111
115
|
} else {
|
|
112
116
|
switch (column.type) {
|
|
113
117
|
case 'seq':
|
|
@@ -216,21 +220,26 @@ function getBooleanValue (cellValue) {
|
|
|
216
220
|
}
|
|
217
221
|
|
|
218
222
|
function getHeaderTitle ($xetable, opts, column) {
|
|
219
|
-
const {
|
|
220
|
-
|
|
223
|
+
const { columnOpts } = $xetable
|
|
224
|
+
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod
|
|
225
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xetable }) : ((opts.original ? column.property : column.getTitle()) || '')
|
|
221
226
|
}
|
|
222
227
|
|
|
223
228
|
function getFooterCellValue ($xetable, opts, items, column) {
|
|
229
|
+
const { columnOpts } = $xetable
|
|
224
230
|
const renderOpts = column.editRender || column.cellRender
|
|
225
|
-
let
|
|
226
|
-
if (!
|
|
231
|
+
let footLabelMethod = column.footerExportMethod
|
|
232
|
+
if (!footLabelMethod && renderOpts && renderOpts.name) {
|
|
227
233
|
const compConf = VXETable.renderer.get(renderOpts.name)
|
|
228
234
|
if (compConf) {
|
|
229
|
-
|
|
235
|
+
footLabelMethod = compConf.footerExportMethod || compConf.footerCellExportMethod
|
|
230
236
|
}
|
|
231
237
|
}
|
|
238
|
+
if (!footLabelMethod) {
|
|
239
|
+
footLabelMethod = columnOpts.footerExportMethod
|
|
240
|
+
}
|
|
232
241
|
const _columnIndex = $xetable.getVTColumnIndex(column)
|
|
233
|
-
const cellValue =
|
|
242
|
+
const cellValue = footLabelMethod ? footLabelMethod({ $table: $xetable, items, itemIndex: _columnIndex, _columnIndex, column, options: opts }) : XEUtils.toValueString(items[_columnIndex])
|
|
234
243
|
return cellValue
|
|
235
244
|
}
|
|
236
245
|
|
|
@@ -171,12 +171,16 @@ export default {
|
|
|
171
171
|
}
|
|
172
172
|
})
|
|
173
173
|
const filterList = this.getCheckedFilters()
|
|
174
|
+
const params = { $table: this, $event: evnt, column, field, property: field, values, datas, filters: filterList, filterList }
|
|
174
175
|
// 如果是服务端筛选,则跳过本地筛选处理
|
|
175
176
|
if (!filterOpts.remote) {
|
|
176
177
|
this.handleTableData(true)
|
|
177
178
|
this.checkSelectionStatus()
|
|
178
179
|
}
|
|
179
|
-
this.
|
|
180
|
+
if (this.mouseConfig && this.mouseOpts.area && this.handleFilterEvent) {
|
|
181
|
+
this.handleFilterEvent(evnt, params)
|
|
182
|
+
}
|
|
183
|
+
this.emitEvent('filter-change', params, evnt)
|
|
180
184
|
this.closeFilter()
|
|
181
185
|
this.updateFooter().then(() => {
|
|
182
186
|
const { scrollXLoad, scrollYLoad } = this
|
|
@@ -5,7 +5,7 @@ import VXETable from '../../v-x-e-table'
|
|
|
5
5
|
import { isEnableConf, eqEmptyValue, getFuncText } from '../../tools/utils'
|
|
6
6
|
import DomTools, { browse } from '../../tools/dom'
|
|
7
7
|
import { createItem, handleFieldOrItem, isHiddenItem, isActivetem } from './util'
|
|
8
|
-
import { errLog } from '../../tools/log'
|
|
8
|
+
import { warnLog, errLog } from '../../tools/log'
|
|
9
9
|
import VxeFormConfigItem from './form-config-item'
|
|
10
10
|
import VxeLoading from '../../loading/index'
|
|
11
11
|
import { getSlotVNs } from '../../tools/vn'
|
|
@@ -367,7 +367,9 @@ export default {
|
|
|
367
367
|
},
|
|
368
368
|
validateField (fieldOrItem, callback) {
|
|
369
369
|
let fields = []
|
|
370
|
-
if (
|
|
370
|
+
if (XEUtils.isArray(fieldOrItem)) {
|
|
371
|
+
fields = fieldOrItem
|
|
372
|
+
} else {
|
|
371
373
|
fields = [fieldOrItem]
|
|
372
374
|
}
|
|
373
375
|
return this.beginValidate(fields.map(field => handleFieldOrItem(this, field)), '', callback)
|
|
@@ -459,10 +461,10 @@ export default {
|
|
|
459
461
|
if (rules) {
|
|
460
462
|
const itemValue = XEUtils.isUndefined(val) ? XEUtils.get(data, property) : val
|
|
461
463
|
rules.forEach(rule => {
|
|
462
|
-
const { type, trigger, required } = rule
|
|
464
|
+
const { type, trigger, required, validator } = rule
|
|
463
465
|
if (validType === 'all' || !trigger || validType === rule.trigger) {
|
|
464
|
-
if (
|
|
465
|
-
const
|
|
466
|
+
if (validator) {
|
|
467
|
+
const validParams = {
|
|
466
468
|
itemValue,
|
|
467
469
|
rule,
|
|
468
470
|
rules,
|
|
@@ -470,7 +472,26 @@ export default {
|
|
|
470
472
|
field: property,
|
|
471
473
|
property,
|
|
472
474
|
$form: this
|
|
473
|
-
}
|
|
475
|
+
}
|
|
476
|
+
let customValid
|
|
477
|
+
if (XEUtils.isString(validator)) {
|
|
478
|
+
const gvItem = VXETable.validators.get(validator)
|
|
479
|
+
if (gvItem) {
|
|
480
|
+
if (gvItem.itemValidatorMethod) {
|
|
481
|
+
customValid = gvItem.itemValidatorMethod(validParams)
|
|
482
|
+
} else {
|
|
483
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
484
|
+
warnLog('vxe.error.notValidators', [validator])
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
} else {
|
|
488
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
489
|
+
errLog('vxe.error.notValidators', [validator])
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
} else {
|
|
493
|
+
customValid = validator(validParams)
|
|
494
|
+
}
|
|
474
495
|
if (customValid) {
|
|
475
496
|
if (XEUtils.isError(customValid)) {
|
|
476
497
|
errorRules.push(new Rule({ type: 'custom', trigger, content: customValid.message, rule: new Rule(rule) }))
|
|
@@ -747,9 +747,13 @@ export default {
|
|
|
747
747
|
break
|
|
748
748
|
}
|
|
749
749
|
default: {
|
|
750
|
-
const
|
|
751
|
-
if (
|
|
752
|
-
|
|
750
|
+
const gCommandOpts = VXETable.commands.get(code)
|
|
751
|
+
if (gCommandOpts.commandMethod) {
|
|
752
|
+
gCommandOpts.commandMethod({ code, button, $grid: this, $table: $xetable }, ...args)
|
|
753
|
+
} else {
|
|
754
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
755
|
+
errLog('vxe.error.notCommands', [code])
|
|
756
|
+
}
|
|
753
757
|
}
|
|
754
758
|
}
|
|
755
759
|
}
|
|
@@ -624,7 +624,10 @@ export default {
|
|
|
624
624
|
clearable: { type: Boolean, default: () => GlobalConfig.input.clearable },
|
|
625
625
|
readonly: Boolean,
|
|
626
626
|
disabled: Boolean,
|
|
627
|
-
placeholder:
|
|
627
|
+
placeholder: {
|
|
628
|
+
type: String,
|
|
629
|
+
default: () => XEUtils.eqNull(GlobalConfig.input.placeholder) ? GlobalConfig.i18n('vxe.base.pleaseInput') : GlobalConfig.input.placeholder
|
|
630
|
+
},
|
|
628
631
|
maxlength: [String, Number],
|
|
629
632
|
autocomplete: { type: String, default: 'off' },
|
|
630
633
|
align: String,
|
|
@@ -1195,6 +1198,11 @@ export default {
|
|
|
1195
1198
|
this.isActivated = false
|
|
1196
1199
|
return this.$nextTick()
|
|
1197
1200
|
},
|
|
1201
|
+
select () {
|
|
1202
|
+
this.$refs.input.select()
|
|
1203
|
+
this.isActivated = false
|
|
1204
|
+
return this.$nextTick()
|
|
1205
|
+
},
|
|
1198
1206
|
triggerEvent (evnt) {
|
|
1199
1207
|
const { $refs, inputValue } = this
|
|
1200
1208
|
this.$emit(evnt.type, { $panel: $refs.panel, value: inputValue, $event: evnt })
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
vxe: {
|
|
3
|
+
base: {
|
|
4
|
+
pleaseInput: 'Please input',
|
|
5
|
+
pleaseSelect: 'Select'
|
|
6
|
+
},
|
|
3
7
|
loading: {
|
|
4
8
|
text: 'Loading...'
|
|
5
9
|
},
|
|
@@ -19,6 +23,10 @@ export default {
|
|
|
19
23
|
errProp: 'Unsupported parameter "{0}", possibly "{1}".',
|
|
20
24
|
colRepet: 'column.{0}="{0}" is duplicated, which may make some features unusable',
|
|
21
25
|
notFunc: 'method "{0}" not exist.',
|
|
26
|
+
errFunc: 'The argument "{0}" is not a method',
|
|
27
|
+
notValidators: 'Global validators "{0}" no existe.',
|
|
28
|
+
notFormats: 'Global formats "{0}" no existe.',
|
|
29
|
+
notCommands: 'Global commands "{0}" no existe.',
|
|
22
30
|
notSlot: 'slot "{0}" does not exist',
|
|
23
31
|
noTree: 'The tree structure does not support "{0}".',
|
|
24
32
|
notProp: 'Unsupported parameters "{0}"',
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
vxe: {
|
|
3
|
+
base: {
|
|
4
|
+
pleaseInput: 'Please input',
|
|
5
|
+
pleaseSelect: 'Select'
|
|
6
|
+
},
|
|
3
7
|
loading: {
|
|
4
8
|
text: 'Cargando...'
|
|
5
9
|
},
|
|
@@ -19,6 +23,10 @@ export default {
|
|
|
19
23
|
errProp: 'Parámetro no compatible "{0}", posiblemente "{1}".',
|
|
20
24
|
colRepet: 'columna.{0}="{0}" está duplicado, lo que puede hacer que algunas funciones sean inutilizables',
|
|
21
25
|
notFunc: 'El método "{0}" no existe.',
|
|
26
|
+
errFunc: 'The argument "{0}" is not a method',
|
|
27
|
+
notValidators: 'Global validators "{0}" no existe.',
|
|
28
|
+
notFormats: 'Global formats "{0}" no existe.',
|
|
29
|
+
notCommands: 'Global commands "{0}" no existe.',
|
|
22
30
|
notSlot: 'La ranura "{0}" no existe.',
|
|
23
31
|
noTree: 'La estructura de árbol no soporta "{0}".',
|
|
24
32
|
notProp: 'Parámetros no compatibles "{0}"',
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
vxe: {
|
|
3
|
+
base: {
|
|
4
|
+
pleaseInput: 'Please input',
|
|
5
|
+
pleaseSelect: 'Select'
|
|
6
|
+
},
|
|
3
7
|
loading: {
|
|
4
8
|
text: 'Loading...'
|
|
5
9
|
},
|
|
@@ -19,6 +23,10 @@ export default {
|
|
|
19
23
|
errProp: 'サポートされていないパラメーター "{0}","{1}" の可能性があります',
|
|
20
24
|
colRepet: 'column.{0}="{0}" が重複しているため、機能が使えなくなることがあります。',
|
|
21
25
|
notFunc: 'method "{0}" はありません',
|
|
26
|
+
errFunc: 'The argument "{0}" is not a method',
|
|
27
|
+
notValidators: 'Global validators "{0}" no existe.',
|
|
28
|
+
notFormats: 'Global formats "{0}" no existe.',
|
|
29
|
+
notCommands: 'Global commands "{0}" no existe.',
|
|
22
30
|
notSlot: 'slot "{0}" はありません',
|
|
23
31
|
noTree: 'Tree structureは "{0}" をサポートしていません',
|
|
24
32
|
notProp: 'サポートされていないパラメータ "{0}"',
|