@form-create/element-ui 3.2.21 → 3.2.23
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/dist/form-create.esm.js +524 -77
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +524 -77
- package/dist/form-create.min.js +2 -2
- package/package.json +11 -11
- package/src/core/api.js +6 -4
- package/src/core/manager.js +2 -2
package/dist/form-create.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.23
|
|
3
3
|
* (c) 2018-2025 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -162,6 +162,10 @@ function _createSuper(Derived) {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
function _slicedToArray(arr, i) {
|
|
166
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
167
|
+
}
|
|
168
|
+
|
|
165
169
|
function _toConsumableArray(arr) {
|
|
166
170
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
167
171
|
}
|
|
@@ -170,10 +174,44 @@ function _arrayWithoutHoles(arr) {
|
|
|
170
174
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
171
175
|
}
|
|
172
176
|
|
|
177
|
+
function _arrayWithHoles(arr) {
|
|
178
|
+
if (Array.isArray(arr)) return arr;
|
|
179
|
+
}
|
|
180
|
+
|
|
173
181
|
function _iterableToArray(iter) {
|
|
174
182
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
175
183
|
}
|
|
176
184
|
|
|
185
|
+
function _iterableToArrayLimit(arr, i) {
|
|
186
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
187
|
+
|
|
188
|
+
if (_i == null) return;
|
|
189
|
+
var _arr = [];
|
|
190
|
+
var _n = true;
|
|
191
|
+
var _d = false;
|
|
192
|
+
|
|
193
|
+
var _s, _e;
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
197
|
+
_arr.push(_s.value);
|
|
198
|
+
|
|
199
|
+
if (i && _arr.length === i) break;
|
|
200
|
+
}
|
|
201
|
+
} catch (err) {
|
|
202
|
+
_d = true;
|
|
203
|
+
_e = err;
|
|
204
|
+
} finally {
|
|
205
|
+
try {
|
|
206
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
207
|
+
} finally {
|
|
208
|
+
if (_d) throw _e;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return _arr;
|
|
213
|
+
}
|
|
214
|
+
|
|
177
215
|
function _unsupportedIterableToArray(o, minLen) {
|
|
178
216
|
if (!o) return;
|
|
179
217
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -195,6 +233,10 @@ function _nonIterableSpread() {
|
|
|
195
233
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
196
234
|
}
|
|
197
235
|
|
|
236
|
+
function _nonIterableRest() {
|
|
237
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
238
|
+
}
|
|
239
|
+
|
|
198
240
|
function getSlot(slots, exclude) {
|
|
199
241
|
return Object.keys(slots).reduce(function (lst, name) {
|
|
200
242
|
if (!exclude || exclude.indexOf(name) === -1) {
|
|
@@ -1757,7 +1799,7 @@ var Group = defineComponent({
|
|
|
1757
1799
|
var keys = this.sort;
|
|
1758
1800
|
|
|
1759
1801
|
if (keys.filter(function (k) {
|
|
1760
|
-
return cacheRule[k].$f;
|
|
1802
|
+
return cacheRule[k] && cacheRule[k].$f;
|
|
1761
1803
|
}).length !== keys.length) {
|
|
1762
1804
|
return;
|
|
1763
1805
|
}
|
|
@@ -1810,6 +1852,7 @@ var Group = defineComponent({
|
|
|
1810
1852
|
rule: rule,
|
|
1811
1853
|
options: options
|
|
1812
1854
|
};
|
|
1855
|
+
this.sort = Object.keys(this.cacheRule);
|
|
1813
1856
|
|
|
1814
1857
|
if (emit) {
|
|
1815
1858
|
nextTick(function () {
|
|
@@ -1831,6 +1874,7 @@ var Group = defineComponent({
|
|
|
1831
1874
|
var index = Object.keys(this.cacheRule).indexOf(key);
|
|
1832
1875
|
delete this.cacheRule[key];
|
|
1833
1876
|
delete this.cacheValue[key];
|
|
1877
|
+
this.sort = Object.keys(this.cacheRule);
|
|
1834
1878
|
|
|
1835
1879
|
if (emit) {
|
|
1836
1880
|
nextTick(function () {
|
|
@@ -1953,15 +1997,6 @@ var Group = defineComponent({
|
|
|
1953
1997
|
}
|
|
1954
1998
|
},
|
|
1955
1999
|
created: function created() {
|
|
1956
|
-
var _this12 = this;
|
|
1957
|
-
|
|
1958
|
-
watch(function () {
|
|
1959
|
-
return _objectSpread2({}, _this12.cacheRule);
|
|
1960
|
-
}, function (n) {
|
|
1961
|
-
_this12.sort = Object.keys(n);
|
|
1962
|
-
}, {
|
|
1963
|
-
immediate: true
|
|
1964
|
-
});
|
|
1965
2000
|
var d = (this.expand || 0) - this.modelValue.length;
|
|
1966
2001
|
|
|
1967
2002
|
for (var i = 0; i < this.modelValue.length; i++) {
|
|
@@ -1973,7 +2008,7 @@ var Group = defineComponent({
|
|
|
1973
2008
|
}
|
|
1974
2009
|
},
|
|
1975
2010
|
render: function render() {
|
|
1976
|
-
var
|
|
2011
|
+
var _this12 = this;
|
|
1977
2012
|
|
|
1978
2013
|
var keys = this.sort;
|
|
1979
2014
|
var button = this.button;
|
|
@@ -1987,10 +2022,10 @@ var Group = defineComponent({
|
|
|
1987
2022
|
"class": "_fc-group-plus-minus _fc-group-add fc-clock",
|
|
1988
2023
|
"onClick": this.add
|
|
1989
2024
|
}, null) : keys.map(function (key, index) {
|
|
1990
|
-
var
|
|
1991
|
-
rule =
|
|
1992
|
-
options =
|
|
1993
|
-
var btn = button && !disabled ?
|
|
2025
|
+
var _this12$cacheRule$key = _this12.cacheRule[key],
|
|
2026
|
+
rule = _this12$cacheRule$key.rule,
|
|
2027
|
+
options = _this12$cacheRule$key.options;
|
|
2028
|
+
var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
|
|
1994
2029
|
return createVNode("div", {
|
|
1995
2030
|
"class": "_fc-group-container",
|
|
1996
2031
|
"key": key
|
|
@@ -1999,20 +2034,20 @@ var Group = defineComponent({
|
|
|
1999
2034
|
}, {
|
|
2000
2035
|
disabled: disabled,
|
|
2001
2036
|
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
2002
|
-
return
|
|
2037
|
+
return _this12.formData(key, formData);
|
|
2003
2038
|
},
|
|
2004
2039
|
'onEmit-event': function onEmitEvent(name) {
|
|
2005
2040
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2006
2041
|
args[_key - 1] = arguments[_key];
|
|
2007
2042
|
}
|
|
2008
2043
|
|
|
2009
|
-
return
|
|
2044
|
+
return _this12.emitEvent(name, args, index, key);
|
|
2010
2045
|
},
|
|
2011
2046
|
'onUpdate:api': function onUpdateApi($f) {
|
|
2012
|
-
return
|
|
2047
|
+
return _this12.add$f(index, key, $f);
|
|
2013
2048
|
},
|
|
2014
2049
|
inFor: true,
|
|
2015
|
-
modelValue:
|
|
2050
|
+
modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
|
|
2016
2051
|
rule: rule,
|
|
2017
2052
|
option: options,
|
|
2018
2053
|
extendOption: true
|
|
@@ -2318,7 +2353,7 @@ function parseFn(fn, mode) {
|
|
|
2318
2353
|
v.__inject = true;
|
|
2319
2354
|
return v;
|
|
2320
2355
|
} else if (v.indexOf('$FNX:') === 0) {
|
|
2321
|
-
v = makeFn('function($inject){' + v.substring(5) + '}');
|
|
2356
|
+
v = makeFn('function($inject){\n' + v.substring(5) + '\n}');
|
|
2322
2357
|
v.__json = fn;
|
|
2323
2358
|
v.__inject = true;
|
|
2324
2359
|
return v;
|
|
@@ -3230,6 +3265,10 @@ function Api(h) {
|
|
|
3230
3265
|
return undefined;
|
|
3231
3266
|
},
|
|
3232
3267
|
|
|
3268
|
+
get formulas() {
|
|
3269
|
+
return _objectSpread2({}, h.fc.formulas);
|
|
3270
|
+
},
|
|
3271
|
+
|
|
3233
3272
|
formData: function formData(fields) {
|
|
3234
3273
|
if (fields == null || typeof fields === 'boolean') {
|
|
3235
3274
|
var data = {};
|
|
@@ -3660,10 +3699,13 @@ function Api(h) {
|
|
|
3660
3699
|
}
|
|
3661
3700
|
}
|
|
3662
3701
|
},
|
|
3663
|
-
getChildrenFormData: function getChildrenFormData(id) {
|
|
3702
|
+
getChildrenFormData: function getChildrenFormData(id, flag) {
|
|
3664
3703
|
var rules = api.getChildrenRuleList(id);
|
|
3665
3704
|
return rules.reduce(function (formData, rule) {
|
|
3666
|
-
|
|
3705
|
+
if (rule.ignore !== true || flag === true) {
|
|
3706
|
+
formData[rule.field] = copy(rule.value);
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3667
3709
|
return formData;
|
|
3668
3710
|
}, {});
|
|
3669
3711
|
},
|
|
@@ -3756,7 +3798,7 @@ function Api(h) {
|
|
|
3756
3798
|
});
|
|
3757
3799
|
reject(e);
|
|
3758
3800
|
});
|
|
3759
|
-
});
|
|
3801
|
+
})["catch"](function (e) {});
|
|
3760
3802
|
});
|
|
3761
3803
|
},
|
|
3762
3804
|
watchFetch: function watchFetch(opt, callback, error, beforeFetch) {
|
|
@@ -3781,7 +3823,7 @@ function Api(h) {
|
|
|
3781
3823
|
});
|
|
3782
3824
|
error && error(e);
|
|
3783
3825
|
});
|
|
3784
|
-
});
|
|
3826
|
+
})["catch"](function (e) {});
|
|
3785
3827
|
}, opt.wait == null ? 1000 : opt.wait);
|
|
3786
3828
|
},
|
|
3787
3829
|
getData: function getData(id, def) {
|
|
@@ -5942,19 +5984,25 @@ function useContext(Handler) {
|
|
|
5942
5984
|
return info;
|
|
5943
5985
|
});
|
|
5944
5986
|
ctx.refRule['__$validate'] = computed(function () {
|
|
5987
|
+
var t = function t(msg) {
|
|
5988
|
+
var match = msg.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5989
|
+
|
|
5990
|
+
if (match) {
|
|
5991
|
+
var _ctx$refRule, _ctx$refRule$__$title;
|
|
5992
|
+
|
|
5993
|
+
return _this.api.t(match[1], {
|
|
5994
|
+
title: (_ctx$refRule = ctx.refRule) === null || _ctx$refRule === void 0 ? void 0 : (_ctx$refRule$__$title = _ctx$refRule.__$title) === null || _ctx$refRule$__$title === void 0 ? void 0 : _ctx$refRule$__$title.value
|
|
5995
|
+
});
|
|
5996
|
+
}
|
|
5997
|
+
|
|
5998
|
+
return msg;
|
|
5999
|
+
};
|
|
6000
|
+
|
|
5945
6001
|
return toArray(ctx.rule.validate).map(function (item) {
|
|
5946
6002
|
var temp = _objectSpread2({}, item);
|
|
5947
6003
|
|
|
5948
6004
|
if (temp.message) {
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
if (match) {
|
|
5952
|
-
var _ctx$refRule, _ctx$refRule$__$title;
|
|
5953
|
-
|
|
5954
|
-
temp.message = _this.api.t(match[1], {
|
|
5955
|
-
title: (_ctx$refRule = ctx.refRule) === null || _ctx$refRule === void 0 ? void 0 : (_ctx$refRule$__$title = _ctx$refRule.__$title) === null || _ctx$refRule$__$title === void 0 ? void 0 : _ctx$refRule$__$title.value
|
|
5956
|
-
});
|
|
5957
|
-
}
|
|
6005
|
+
temp.message = t(temp.message);
|
|
5958
6006
|
}
|
|
5959
6007
|
|
|
5960
6008
|
if (is.Function(temp.validator)) {
|
|
@@ -5975,8 +6023,19 @@ function useContext(Handler) {
|
|
|
5975
6023
|
api: that.$handle.api
|
|
5976
6024
|
}].concat(args));
|
|
5977
6025
|
};
|
|
6026
|
+
}
|
|
6027
|
+
|
|
6028
|
+
if (temp.adapter) {
|
|
6029
|
+
if (_typeof(temp.error) === 'object') {
|
|
6030
|
+
var msg = _objectSpread2({}, temp.error);
|
|
6031
|
+
|
|
6032
|
+
Object.keys(msg).forEach(function (key) {
|
|
6033
|
+
msg[key] = t(msg[key]);
|
|
6034
|
+
});
|
|
6035
|
+
temp.error = msg;
|
|
6036
|
+
}
|
|
5978
6037
|
|
|
5979
|
-
return temp;
|
|
6038
|
+
return _this.adapterValidate(temp, ctx);
|
|
5980
6039
|
}
|
|
5981
6040
|
|
|
5982
6041
|
return temp;
|
|
@@ -6010,7 +6069,6 @@ function useContext(Handler) {
|
|
|
6010
6069
|
}
|
|
6011
6070
|
|
|
6012
6071
|
Object.keys(computedRule).forEach(function (k) {
|
|
6013
|
-
var oldValue = undefined;
|
|
6014
6072
|
var computedValue = computed(function () {
|
|
6015
6073
|
var item = computedRule[k];
|
|
6016
6074
|
if (!item) return undefined;
|
|
@@ -6018,7 +6076,7 @@ function useContext(Handler) {
|
|
|
6018
6076
|
var value = _this.compute(ctx, item);
|
|
6019
6077
|
|
|
6020
6078
|
if (item.linkage && value === oldValueTag) {
|
|
6021
|
-
return
|
|
6079
|
+
return oldValueTag;
|
|
6022
6080
|
}
|
|
6023
6081
|
|
|
6024
6082
|
return value;
|
|
@@ -6039,18 +6097,307 @@ function useContext(Handler) {
|
|
|
6039
6097
|
}
|
|
6040
6098
|
|
|
6041
6099
|
ctx.watch.push(watch(computedValue, function (n) {
|
|
6042
|
-
|
|
6100
|
+
if (n === oldValueTag) {
|
|
6101
|
+
return;
|
|
6102
|
+
}
|
|
6103
|
+
|
|
6043
6104
|
setTimeout(function () {
|
|
6044
6105
|
callback(n);
|
|
6045
6106
|
});
|
|
6107
|
+
}, {
|
|
6108
|
+
deep: true
|
|
6046
6109
|
}));
|
|
6047
6110
|
});
|
|
6048
6111
|
});
|
|
6049
6112
|
this.watchEffect(ctx);
|
|
6050
6113
|
},
|
|
6051
|
-
|
|
6114
|
+
adapterValidate: function adapterValidate(validate, ctx) {
|
|
6052
6115
|
var _this2 = this;
|
|
6053
6116
|
|
|
6117
|
+
var validator = function validator(value, callback) {
|
|
6118
|
+
var before = validate.beforeValidate && invoke(function () {
|
|
6119
|
+
return validate.beforeValidate({
|
|
6120
|
+
value: value,
|
|
6121
|
+
api: _this2.api,
|
|
6122
|
+
validate: validate,
|
|
6123
|
+
rule: ctx.rule
|
|
6124
|
+
});
|
|
6125
|
+
});
|
|
6126
|
+
|
|
6127
|
+
if (before === false) {
|
|
6128
|
+
callback();
|
|
6129
|
+
} else {
|
|
6130
|
+
var key = _this2.validator(ctx, value, validate);
|
|
6131
|
+
|
|
6132
|
+
if (!key) {
|
|
6133
|
+
if (validate.validator) {
|
|
6134
|
+
var res = validate.validator && invoke(function () {
|
|
6135
|
+
return validate.validator(value, callback);
|
|
6136
|
+
});
|
|
6137
|
+
|
|
6138
|
+
if (res && is.Function(res.then)) {
|
|
6139
|
+
res.then(function () {
|
|
6140
|
+
return callback();
|
|
6141
|
+
})["catch"](function (e) {
|
|
6142
|
+
return callback(e);
|
|
6143
|
+
});
|
|
6144
|
+
}
|
|
6145
|
+
} else {
|
|
6146
|
+
callback();
|
|
6147
|
+
}
|
|
6148
|
+
} else {
|
|
6149
|
+
var message = '';
|
|
6150
|
+
|
|
6151
|
+
if (_typeof(validate.error) === 'object') {
|
|
6152
|
+
message = validate.error[key] || validate.error["default"];
|
|
6153
|
+
}
|
|
6154
|
+
|
|
6155
|
+
if (!message && typeof validate.message === 'string') {
|
|
6156
|
+
message = validate.message;
|
|
6157
|
+
}
|
|
6158
|
+
|
|
6159
|
+
if (!message) {
|
|
6160
|
+
message = _this2.getValidateMessage(ctx, {
|
|
6161
|
+
key: key,
|
|
6162
|
+
rule: validate[key]
|
|
6163
|
+
});
|
|
6164
|
+
}
|
|
6165
|
+
|
|
6166
|
+
callback(message);
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
};
|
|
6170
|
+
|
|
6171
|
+
return this.$manager.adapterValidate({
|
|
6172
|
+
required: validate.required,
|
|
6173
|
+
message: validate.message,
|
|
6174
|
+
target: validate.trigger
|
|
6175
|
+
}, validator);
|
|
6176
|
+
},
|
|
6177
|
+
getValidateMessage: function getValidateMessage(ctx, invalid) {
|
|
6178
|
+
var _ctx$refRule2, _ctx$refRule2$__$titl, _this$api$t;
|
|
6179
|
+
|
|
6180
|
+
var formatRule = Array.isArray(invalid.rule) ? invalid.rule.join(',') : '' + invalid.rule;
|
|
6181
|
+
return this.api.t(invalid.key === 'required' ? invalid.key : 'validate.' + invalid.key, (_this$api$t = {}, _defineProperty(_this$api$t, invalid.key, formatRule), _defineProperty(_this$api$t, "title", (_ctx$refRule2 = ctx.refRule) === null || _ctx$refRule2 === void 0 ? void 0 : (_ctx$refRule2$__$titl = _ctx$refRule2.__$title) === null || _ctx$refRule2$__$titl === void 0 ? void 0 : _ctx$refRule2$__$titl.value), _this$api$t));
|
|
6182
|
+
},
|
|
6183
|
+
validator: function validator(ctx, value, validate) {
|
|
6184
|
+
var _this3 = this;
|
|
6185
|
+
|
|
6186
|
+
var isEmpty = is.empty(value);
|
|
6187
|
+
|
|
6188
|
+
if (isEmpty) {
|
|
6189
|
+
if (validate.required) {
|
|
6190
|
+
return 'required';
|
|
6191
|
+
}
|
|
6192
|
+
|
|
6193
|
+
return;
|
|
6194
|
+
}
|
|
6195
|
+
|
|
6196
|
+
var _loop = function _loop() {
|
|
6197
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
6198
|
+
key = _Object$entries$_i[0],
|
|
6199
|
+
rule = _Object$entries$_i[1];
|
|
6200
|
+
|
|
6201
|
+
switch (key) {
|
|
6202
|
+
case 'len':
|
|
6203
|
+
case 'maxLen':
|
|
6204
|
+
case 'minLen':
|
|
6205
|
+
var check = function check(val) {
|
|
6206
|
+
if (key === 'len') {
|
|
6207
|
+
return val === rule;
|
|
6208
|
+
} else if (key === 'maxLen') {
|
|
6209
|
+
return val <= rule;
|
|
6210
|
+
} else {
|
|
6211
|
+
return val >= rule;
|
|
6212
|
+
}
|
|
6213
|
+
};
|
|
6214
|
+
|
|
6215
|
+
if (Array.isArray(value)) {
|
|
6216
|
+
if (!check(value.length)) {
|
|
6217
|
+
return {
|
|
6218
|
+
v: key
|
|
6219
|
+
};
|
|
6220
|
+
}
|
|
6221
|
+
} else if (_typeof(value) === 'object') {
|
|
6222
|
+
return {
|
|
6223
|
+
v: key
|
|
6224
|
+
};
|
|
6225
|
+
} else if (!check(('' + value).length)) {
|
|
6226
|
+
return {
|
|
6227
|
+
v: key
|
|
6228
|
+
};
|
|
6229
|
+
}
|
|
6230
|
+
|
|
6231
|
+
break;
|
|
6232
|
+
|
|
6233
|
+
case 'pattern':
|
|
6234
|
+
var reg = typeof rule === 'string' ? new RegExp(rule) : rule;
|
|
6235
|
+
|
|
6236
|
+
if (!reg.test('' + value)) {
|
|
6237
|
+
return {
|
|
6238
|
+
v: key
|
|
6239
|
+
};
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6242
|
+
break;
|
|
6243
|
+
|
|
6244
|
+
case 'uppercase':
|
|
6245
|
+
if (rule && (typeof value !== 'string' || !/^[A-Z]*$/.test(value))) {
|
|
6246
|
+
return {
|
|
6247
|
+
v: key
|
|
6248
|
+
};
|
|
6249
|
+
}
|
|
6250
|
+
|
|
6251
|
+
break;
|
|
6252
|
+
|
|
6253
|
+
case 'lowercase':
|
|
6254
|
+
if (rule && (typeof value !== 'string' || !/^[a-z]*$/.test(value))) {
|
|
6255
|
+
return {
|
|
6256
|
+
v: key
|
|
6257
|
+
};
|
|
6258
|
+
}
|
|
6259
|
+
|
|
6260
|
+
break;
|
|
6261
|
+
|
|
6262
|
+
case 'min':
|
|
6263
|
+
case 'max':
|
|
6264
|
+
case 'positive':
|
|
6265
|
+
case 'negative':
|
|
6266
|
+
case 'integer':
|
|
6267
|
+
case 'number':
|
|
6268
|
+
var num = Number(value);
|
|
6269
|
+
|
|
6270
|
+
if (Number.isNaN(num)) {
|
|
6271
|
+
return {
|
|
6272
|
+
v: key
|
|
6273
|
+
};
|
|
6274
|
+
}
|
|
6275
|
+
|
|
6276
|
+
if (key === 'min' && num < rule) {
|
|
6277
|
+
return {
|
|
6278
|
+
v: key
|
|
6279
|
+
};
|
|
6280
|
+
}
|
|
6281
|
+
|
|
6282
|
+
if (key === 'max' && num > rule) {
|
|
6283
|
+
return {
|
|
6284
|
+
v: key
|
|
6285
|
+
};
|
|
6286
|
+
}
|
|
6287
|
+
|
|
6288
|
+
if (key === 'positive' && num <= 0) {
|
|
6289
|
+
return {
|
|
6290
|
+
v: key
|
|
6291
|
+
};
|
|
6292
|
+
}
|
|
6293
|
+
|
|
6294
|
+
if (key === 'negative' && num >= 0) {
|
|
6295
|
+
return {
|
|
6296
|
+
v: key
|
|
6297
|
+
};
|
|
6298
|
+
}
|
|
6299
|
+
|
|
6300
|
+
if (key === 'integer' && !Number.isInteger(num)) {
|
|
6301
|
+
return {
|
|
6302
|
+
v: key
|
|
6303
|
+
};
|
|
6304
|
+
}
|
|
6305
|
+
|
|
6306
|
+
break;
|
|
6307
|
+
|
|
6308
|
+
case 'equal':
|
|
6309
|
+
if (value !== rule) {
|
|
6310
|
+
return {
|
|
6311
|
+
v: key
|
|
6312
|
+
};
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
break;
|
|
6316
|
+
|
|
6317
|
+
case 'enum':
|
|
6318
|
+
if (Array.isArray(rule) && !rule.includes(value)) {
|
|
6319
|
+
return {
|
|
6320
|
+
v: key
|
|
6321
|
+
};
|
|
6322
|
+
}
|
|
6323
|
+
|
|
6324
|
+
break;
|
|
6325
|
+
|
|
6326
|
+
case 'hasKeys':
|
|
6327
|
+
if (_typeof(value) !== 'object' || Array.isArray(rule) && rule.some(function (key) {
|
|
6328
|
+
return !(key in value);
|
|
6329
|
+
})) {
|
|
6330
|
+
return {
|
|
6331
|
+
v: key
|
|
6332
|
+
};
|
|
6333
|
+
}
|
|
6334
|
+
|
|
6335
|
+
break;
|
|
6336
|
+
|
|
6337
|
+
case 'email':
|
|
6338
|
+
var regexEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
6339
|
+
|
|
6340
|
+
if (!regexEmail.test('' + value)) {
|
|
6341
|
+
return {
|
|
6342
|
+
v: key
|
|
6343
|
+
};
|
|
6344
|
+
}
|
|
6345
|
+
|
|
6346
|
+
break;
|
|
6347
|
+
|
|
6348
|
+
case 'url':
|
|
6349
|
+
var regexUrl = new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", 'i');
|
|
6350
|
+
|
|
6351
|
+
if (!regexUrl.test('' + value)) {
|
|
6352
|
+
return {
|
|
6353
|
+
v: key
|
|
6354
|
+
};
|
|
6355
|
+
}
|
|
6356
|
+
|
|
6357
|
+
break;
|
|
6358
|
+
|
|
6359
|
+
case 'ip':
|
|
6360
|
+
var regexIp = /^(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}$/;
|
|
6361
|
+
|
|
6362
|
+
if (!regexIp.test('' + value)) {
|
|
6363
|
+
return {
|
|
6364
|
+
v: key
|
|
6365
|
+
};
|
|
6366
|
+
}
|
|
6367
|
+
|
|
6368
|
+
break;
|
|
6369
|
+
|
|
6370
|
+
case 'phone':
|
|
6371
|
+
var regexPhone = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
|
|
6372
|
+
|
|
6373
|
+
if (!regexPhone.test('' + value)) {
|
|
6374
|
+
return {
|
|
6375
|
+
v: key
|
|
6376
|
+
};
|
|
6377
|
+
}
|
|
6378
|
+
|
|
6379
|
+
break;
|
|
6380
|
+
|
|
6381
|
+
case 'computed':
|
|
6382
|
+
if (!_this3.compute(ctx, rule)) {
|
|
6383
|
+
return {
|
|
6384
|
+
v: key
|
|
6385
|
+
};
|
|
6386
|
+
}
|
|
6387
|
+
|
|
6388
|
+
break;
|
|
6389
|
+
}
|
|
6390
|
+
};
|
|
6391
|
+
|
|
6392
|
+
for (var _i = 0, _Object$entries = Object.entries(validate); _i < _Object$entries.length; _i++) {
|
|
6393
|
+
var _ret = _loop();
|
|
6394
|
+
|
|
6395
|
+
if (_typeof(_ret) === "object") return _ret.v;
|
|
6396
|
+
}
|
|
6397
|
+
},
|
|
6398
|
+
compute: function compute(ctx, item) {
|
|
6399
|
+
var _this4 = this;
|
|
6400
|
+
|
|
6054
6401
|
var fn;
|
|
6055
6402
|
|
|
6056
6403
|
if (_typeof(item) === 'object') {
|
|
@@ -6069,13 +6416,13 @@ function useContext(Handler) {
|
|
|
6069
6416
|
var or = item.mode === 'OR';
|
|
6070
6417
|
var valid = true;
|
|
6071
6418
|
|
|
6072
|
-
var
|
|
6419
|
+
var _loop2 = function _loop2(i) {
|
|
6073
6420
|
var one = item.group[i];
|
|
6074
6421
|
var flag = void 0;
|
|
6075
6422
|
var field = null;
|
|
6076
6423
|
|
|
6077
6424
|
if (one.variable) {
|
|
6078
|
-
field = JSON.stringify(
|
|
6425
|
+
field = JSON.stringify(_this4.fc.getLoadData(one.variable) || '');
|
|
6079
6426
|
} else if (one.field) {
|
|
6080
6427
|
field = convertFieldToConditions(one.field || '');
|
|
6081
6428
|
} else if (!one.mode) {
|
|
@@ -6096,11 +6443,11 @@ function useContext(Handler) {
|
|
|
6096
6443
|
flag = false;
|
|
6097
6444
|
} else if (is.Function(one.handler)) {
|
|
6098
6445
|
flag = invoke(function () {
|
|
6099
|
-
return one.handler(
|
|
6446
|
+
return one.handler(_this4.api, ctx.rule);
|
|
6100
6447
|
});
|
|
6101
6448
|
} else {
|
|
6102
6449
|
flag = invoke(function () {
|
|
6103
|
-
return new Function('$condition', '$val', '$form', '$scope', '$group', '$rule', "with($form){with($scope){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(field, ", ").concat(compare ? compare : '$val', "); }}}}")).call(
|
|
6450
|
+
return new Function('$condition', '$val', '$form', '$scope', '$group', '$rule', "with($form){with($scope){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(field, ", ").concat(compare ? compare : '$val', "); }}}}")).call(_this4.api.form, condition, one.value, _this4.api.top.form, _this4.api.top === _this4.api.scope ? {} : _this4.api.scope.form, group ? _this4.subRuleData[group.id] || {} : {}, ctx.rule);
|
|
6104
6451
|
});
|
|
6105
6452
|
}
|
|
6106
6453
|
|
|
@@ -6116,9 +6463,9 @@ function useContext(Handler) {
|
|
|
6116
6463
|
};
|
|
6117
6464
|
|
|
6118
6465
|
for (var i = 0; i < item.group.length; i++) {
|
|
6119
|
-
var
|
|
6466
|
+
var _ret2 = _loop2(i);
|
|
6120
6467
|
|
|
6121
|
-
if (_typeof(
|
|
6468
|
+
if (_typeof(_ret2) === "object") return _ret2.v;
|
|
6122
6469
|
}
|
|
6123
6470
|
|
|
6124
6471
|
return or ? false : valid;
|
|
@@ -6129,27 +6476,27 @@ function useContext(Handler) {
|
|
|
6129
6476
|
|
|
6130
6477
|
if (item.linkage) {
|
|
6131
6478
|
return val ? invoke(function () {
|
|
6132
|
-
return
|
|
6479
|
+
return _this4.computeValue(item.linkage, ctx, group);
|
|
6133
6480
|
}, undefined) : oldValueTag;
|
|
6134
6481
|
}
|
|
6135
6482
|
|
|
6136
6483
|
return val;
|
|
6137
6484
|
} else if (is.Function(item)) {
|
|
6138
6485
|
fn = function fn() {
|
|
6139
|
-
return item(
|
|
6486
|
+
return item(_this4.api.form, _this4.api);
|
|
6140
6487
|
};
|
|
6141
6488
|
} else {
|
|
6142
6489
|
var _group = ctx.getParentGroup();
|
|
6143
6490
|
|
|
6144
6491
|
fn = function fn() {
|
|
6145
|
-
return
|
|
6492
|
+
return _this4.computeValue(item, ctx, _group);
|
|
6146
6493
|
};
|
|
6147
6494
|
}
|
|
6148
6495
|
|
|
6149
6496
|
return invoke(fn, undefined);
|
|
6150
6497
|
},
|
|
6151
6498
|
computeValue: function computeValue(str, ctx, group) {
|
|
6152
|
-
var
|
|
6499
|
+
var _this5 = this;
|
|
6153
6500
|
|
|
6154
6501
|
var that = this;
|
|
6155
6502
|
var formulas = Object.keys(this.fc.formulas).reduce(function (obj, k) {
|
|
@@ -6171,35 +6518,35 @@ function useContext(Handler) {
|
|
|
6171
6518
|
return obj;
|
|
6172
6519
|
}, {});
|
|
6173
6520
|
return invoke(function () {
|
|
6174
|
-
return new Function('$formulas', '$form', '$scope', '$group', '$rule', '$api', "with($form){with($scope){with(this){with($group){with($formulas){ return ".concat(str, " }}}}}")).call(
|
|
6521
|
+
return new Function('$formulas', '$form', '$scope', '$group', '$rule', '$api', "with($form){with($scope){with(this){with($group){with($formulas){ return ".concat(str, " }}}}}")).call(_this5.api.form, formulas, _this5.api.top.form, _this5.api.top === _this5.api.scope ? {} : _this5.api.scope.form, group ? _this5.subRuleData[group.id] || {} : {}, ctx.rule, _this5.api);
|
|
6175
6522
|
}, undefined);
|
|
6176
6523
|
},
|
|
6177
6524
|
updateChildren: function updateChildren(ctx, n, o) {
|
|
6178
|
-
var
|
|
6525
|
+
var _this6 = this;
|
|
6179
6526
|
|
|
6180
6527
|
this.deferSyncValue(function () {
|
|
6181
6528
|
o && o.forEach(function (child) {
|
|
6182
6529
|
if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && child.__fc__.parent === ctx) {
|
|
6183
|
-
|
|
6530
|
+
_this6.rmCtx(child.__fc__);
|
|
6184
6531
|
}
|
|
6185
6532
|
});
|
|
6186
6533
|
|
|
6187
6534
|
if (is.trueArray(n)) {
|
|
6188
|
-
|
|
6535
|
+
_this6.loadChildren(n, ctx);
|
|
6189
6536
|
|
|
6190
|
-
|
|
6537
|
+
_this6.bus.$emit('update', _this6.api);
|
|
6191
6538
|
}
|
|
6192
6539
|
});
|
|
6193
6540
|
},
|
|
6194
6541
|
rmSub: function rmSub(sub) {
|
|
6195
|
-
var
|
|
6542
|
+
var _this7 = this;
|
|
6196
6543
|
|
|
6197
6544
|
is.trueArray(sub) && sub.forEach(function (r) {
|
|
6198
|
-
r && r.__fc__ &&
|
|
6545
|
+
r && r.__fc__ && _this7.rmCtx(r.__fc__);
|
|
6199
6546
|
});
|
|
6200
6547
|
},
|
|
6201
6548
|
rmCtx: function rmCtx(ctx) {
|
|
6202
|
-
var
|
|
6549
|
+
var _this8 = this;
|
|
6203
6550
|
|
|
6204
6551
|
if (ctx.deleted) return;
|
|
6205
6552
|
var id = ctx.id,
|
|
@@ -6228,19 +6575,19 @@ function useContext(Handler) {
|
|
|
6228
6575
|
}
|
|
6229
6576
|
|
|
6230
6577
|
this.deferSyncValue(function () {
|
|
6231
|
-
if (!
|
|
6578
|
+
if (!_this8.reloading) {
|
|
6232
6579
|
if (ctx.parser.loadChildren !== false) {
|
|
6233
6580
|
var children = ctx.getPending('children', ctx.rule.children);
|
|
6234
6581
|
|
|
6235
6582
|
if (is.trueArray(children)) {
|
|
6236
6583
|
children.forEach(function (h) {
|
|
6237
|
-
return h.__fc__ &&
|
|
6584
|
+
return h.__fc__ && _this8.rmCtx(h.__fc__);
|
|
6238
6585
|
});
|
|
6239
6586
|
}
|
|
6240
6587
|
}
|
|
6241
6588
|
|
|
6242
|
-
if (ctx.root ===
|
|
6243
|
-
|
|
6589
|
+
if (ctx.root === _this8.rules) {
|
|
6590
|
+
_this8.vm.setupState.renderRule();
|
|
6244
6591
|
}
|
|
6245
6592
|
}
|
|
6246
6593
|
}, input);
|
|
@@ -6613,7 +6960,26 @@ extend(Handler.prototype, {
|
|
|
6613
6960
|
}
|
|
6614
6961
|
}).then(function () {
|
|
6615
6962
|
return _this3.globalBeforeFetch(opt);
|
|
6616
|
-
})
|
|
6963
|
+
});
|
|
6964
|
+
},
|
|
6965
|
+
beforeSubmit: function beforeSubmit(formData) {
|
|
6966
|
+
var _this4 = this;
|
|
6967
|
+
|
|
6968
|
+
return new Promise(function (resolve, reject) {
|
|
6969
|
+
var res = _this4.options.beforeSubmit && invoke(function () {
|
|
6970
|
+
return _this4.options.beforeSubmit(formData, {
|
|
6971
|
+
api: _this4.api
|
|
6972
|
+
});
|
|
6973
|
+
});
|
|
6974
|
+
|
|
6975
|
+
if (res && is.Function(res.then)) {
|
|
6976
|
+
res.then(resolve)["catch"](reject);
|
|
6977
|
+
} else if (res === false) {
|
|
6978
|
+
reject();
|
|
6979
|
+
} else {
|
|
6980
|
+
resolve();
|
|
6981
|
+
}
|
|
6982
|
+
});
|
|
6617
6983
|
}
|
|
6618
6984
|
});
|
|
6619
6985
|
useInject(Handler);
|
|
@@ -6768,6 +7134,13 @@ extend(Manager.prototype, {
|
|
|
6768
7134
|
form: function form() {
|
|
6769
7135
|
return this.vm.refs[this.ref];
|
|
6770
7136
|
},
|
|
7137
|
+
adapterValidate: function adapterValidate(validate, validator) {
|
|
7138
|
+
validate.validator = function (rule, value, callback) {
|
|
7139
|
+
return validator(value, callback);
|
|
7140
|
+
};
|
|
7141
|
+
|
|
7142
|
+
return validate;
|
|
7143
|
+
},
|
|
6771
7144
|
getSlot: function getSlot(name) {
|
|
6772
7145
|
var _fn = function _fn(vm) {
|
|
6773
7146
|
if (vm) {
|
|
@@ -6825,14 +7198,30 @@ var loadData = function loadData(fc) {
|
|
|
6825
7198
|
attrs.forEach(function (attr) {
|
|
6826
7199
|
if (attr && (attr.attr || attr.template)) {
|
|
6827
7200
|
var fn = function fn(get) {
|
|
7201
|
+
var group;
|
|
7202
|
+
|
|
7203
|
+
if (rule && rule.__fc__) {
|
|
7204
|
+
group = rule.__fc__.getParentGroup();
|
|
7205
|
+
}
|
|
7206
|
+
|
|
6828
7207
|
var value;
|
|
6829
7208
|
|
|
6830
7209
|
if (attr.template) {
|
|
6831
|
-
value = fc.$handle.loadStrVar(attr.template, get
|
|
7210
|
+
value = fc.$handle.loadStrVar(attr.template, get, group ? {
|
|
7211
|
+
rule: rule,
|
|
7212
|
+
value: fc.$handle.subRuleData[group.id] || {}
|
|
7213
|
+
} : null);
|
|
6832
7214
|
} else if (attr.handler && is.Function(attr.handler)) {
|
|
6833
7215
|
value = attr.handler(get, rule, api);
|
|
6834
7216
|
} else {
|
|
6835
|
-
value =
|
|
7217
|
+
value = fc.$handle.loadStrVar("{{".concat(attr.attr, "}}"), get, group ? {
|
|
7218
|
+
rule: rule,
|
|
7219
|
+
value: fc.$handle.subRuleData[group.id] || {}
|
|
7220
|
+
} : null);
|
|
7221
|
+
}
|
|
7222
|
+
|
|
7223
|
+
if ((value == null || value === '') && attr["default"] != null) {
|
|
7224
|
+
value = attr["default"];
|
|
6836
7225
|
}
|
|
6837
7226
|
|
|
6838
7227
|
if (attr.copy !== false) {
|
|
@@ -7128,7 +7517,7 @@ var fetch = function fetch(fc) {
|
|
|
7128
7517
|
api: api
|
|
7129
7518
|
});
|
|
7130
7519
|
});
|
|
7131
|
-
});
|
|
7520
|
+
})["catch"](function (e) {});
|
|
7132
7521
|
}, option.wait || 600));
|
|
7133
7522
|
}
|
|
7134
7523
|
|
|
@@ -7262,6 +7651,57 @@ function sessionStorageDriver(name) {
|
|
|
7262
7651
|
return baseDriver(getSessionStorage, name);
|
|
7263
7652
|
}
|
|
7264
7653
|
|
|
7654
|
+
var baseLanguage = {
|
|
7655
|
+
en: {
|
|
7656
|
+
required: '{title} is required',
|
|
7657
|
+
validate: {
|
|
7658
|
+
url: '{title} is not a valid url',
|
|
7659
|
+
email: '{title} is not a valid email',
|
|
7660
|
+
ip: '{title} {title} is not a valid ip',
|
|
7661
|
+
phone: '{title} {title} is not a valid phone',
|
|
7662
|
+
pattern: '{title} does not match pattern {pattern}',
|
|
7663
|
+
uppercase: '{title} must be all uppercase',
|
|
7664
|
+
lowercase: '{title} must be all lowercased',
|
|
7665
|
+
positive: '{title} is not a positive number',
|
|
7666
|
+
negative: '{title} is not a negative number',
|
|
7667
|
+
equal: '{title} is not equal to {equal}',
|
|
7668
|
+
min: '{title} cannot be less than {min}',
|
|
7669
|
+
max: '{title} cannot be greater than {max}',
|
|
7670
|
+
"enum": '{title} must be one of {enum}',
|
|
7671
|
+
hasKeys: '{title} does not contain required fields {hasKeys}',
|
|
7672
|
+
minLen: '{title} must be at least {minLen}',
|
|
7673
|
+
maxLen: '{title} cannot be longer than {maxLen}',
|
|
7674
|
+
len: '{title} must be exactly {len}',
|
|
7675
|
+
integer: '{title} is not an integer',
|
|
7676
|
+
number: '{title} is not an number'
|
|
7677
|
+
}
|
|
7678
|
+
},
|
|
7679
|
+
'zh-cn': {
|
|
7680
|
+
required: '{title}不能为空',
|
|
7681
|
+
validate: {
|
|
7682
|
+
url: '{title}不是有效的 url 地址',
|
|
7683
|
+
email: '{title}不是有效的邮箱地址',
|
|
7684
|
+
ip: '{title}不是有效的 IP 地址',
|
|
7685
|
+
phone: '{title}不是正确的手机号',
|
|
7686
|
+
pattern: '{title}必须匹配 {pattern}',
|
|
7687
|
+
uppercase: '{title}必须全大写',
|
|
7688
|
+
lowercase: '{title}必须全小写',
|
|
7689
|
+
positive: '{title}不是正数',
|
|
7690
|
+
negative: '{title}不是负数',
|
|
7691
|
+
equal: '{title}必须等于 {equal}',
|
|
7692
|
+
min: '{title}必须大于等于 {min}',
|
|
7693
|
+
max: '{title}必须小于等于 {max}',
|
|
7694
|
+
"enum": '{title}必须是 {enum} 之一',
|
|
7695
|
+
hasKeys: '{title}必须包含 {hasKeys} 字段',
|
|
7696
|
+
minLen: '{title}长度必须大于 {minLen}',
|
|
7697
|
+
maxLen: '{title}长度必须小于 {maxLen}',
|
|
7698
|
+
len: '{title}长度必须为 {len}',
|
|
7699
|
+
integer: '{title}必须为整数',
|
|
7700
|
+
number: '{title}必须为数字'
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
};
|
|
7704
|
+
|
|
7265
7705
|
function parseProp(name, id) {
|
|
7266
7706
|
var prop;
|
|
7267
7707
|
|
|
@@ -7785,7 +8225,11 @@ function FormCreateFactory(config) {
|
|
|
7785
8225
|
|
|
7786
8226
|
var _locale = this.getLocale();
|
|
7787
8227
|
|
|
7788
|
-
value = deepGet(language[_locale], id);
|
|
8228
|
+
value = deepGet(language[_locale] || {}, id);
|
|
8229
|
+
|
|
8230
|
+
if (value == null) {
|
|
8231
|
+
value = deepGet(baseLanguage[_locale] || {}, id);
|
|
8232
|
+
}
|
|
7789
8233
|
}
|
|
7790
8234
|
|
|
7791
8235
|
return value;
|
|
@@ -8462,7 +8906,6 @@ var manager = {
|
|
|
8462
8906
|
e.preventDefault();
|
|
8463
8907
|
}
|
|
8464
8908
|
},
|
|
8465
|
-
"class": [form.className, form["class"], 'form-create', this.$handle.preview ? 'is-preview' : ''],
|
|
8466
8909
|
style: form.style,
|
|
8467
8910
|
type: 'form'
|
|
8468
8911
|
};
|
|
@@ -8471,9 +8914,11 @@ var manager = {
|
|
|
8471
8914
|
var key = this.key,
|
|
8472
8915
|
ref = this.ref,
|
|
8473
8916
|
$handle = this.$handle;
|
|
8917
|
+
var form = this.options.form;
|
|
8474
8918
|
extend(this.rule, {
|
|
8475
8919
|
key: key,
|
|
8476
|
-
ref: ref
|
|
8920
|
+
ref: ref,
|
|
8921
|
+
"class": [form.className, form["class"], 'form-create', this.$handle.preview ? 'is-preview' : '']
|
|
8477
8922
|
});
|
|
8478
8923
|
extend(this.rule.props, {
|
|
8479
8924
|
model: $handle.formData
|
|
@@ -8938,14 +9383,16 @@ function extendApi(api, h) {
|
|
|
8938
9383
|
var promise = h.options.validateOnSubmit === false ? Promise.resolve() : api.validate();
|
|
8939
9384
|
promise.then(function () {
|
|
8940
9385
|
var formData = api.formData();
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
9386
|
+
h.beforeSubmit(formData).then(function () {
|
|
9387
|
+
is.Function(successFn) && invoke(function () {
|
|
9388
|
+
return successFn(formData, api);
|
|
9389
|
+
});
|
|
9390
|
+
is.Function(h.options.onSubmit) && invoke(function () {
|
|
9391
|
+
return h.options.onSubmit(formData, api);
|
|
9392
|
+
});
|
|
9393
|
+
h.vm.emit('submit', formData, api);
|
|
9394
|
+
resolve(formData);
|
|
9395
|
+
})["catch"](function (e) {});
|
|
8949
9396
|
})["catch"](function () {
|
|
8950
9397
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8951
9398
|
args[_key] = arguments[_key];
|
|
@@ -9052,7 +9499,7 @@ function install(FormCreate) {
|
|
|
9052
9499
|
function elmFormCreate() {
|
|
9053
9500
|
return FormCreateFactory({
|
|
9054
9501
|
ui: 'element-ui',
|
|
9055
|
-
version: '3.2.
|
|
9502
|
+
version: '3.2.23',
|
|
9056
9503
|
manager: manager,
|
|
9057
9504
|
extendApi: extendApi,
|
|
9058
9505
|
install: install,
|