@form-create/element-ui 3.1.31 → 3.1.33
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 +259 -106
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +258 -105
- package/dist/form-create.min.js +2 -2
- package/package.json +5 -5
package/dist/form-create.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.1.
|
|
2
|
+
* @form-create/element-ui v3.1.33
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import { defineComponent, toRef,
|
|
7
|
+
import { defineComponent, toRef, ref, watch, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h } from 'vue';
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) {
|
|
10
10
|
var keys = Object.keys(object);
|
|
@@ -205,6 +205,10 @@ function getSlot(slots, exclude) {
|
|
|
205
205
|
}, []);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
function toArray(value) {
|
|
209
|
+
return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
|
|
210
|
+
}
|
|
211
|
+
|
|
208
212
|
var NAME$9 = 'fcCheckbox';
|
|
209
213
|
var Checkbox = defineComponent({
|
|
210
214
|
name: NAME$9,
|
|
@@ -217,22 +221,72 @@ var Checkbox = defineComponent({
|
|
|
217
221
|
return [];
|
|
218
222
|
}
|
|
219
223
|
},
|
|
220
|
-
type: String
|
|
224
|
+
type: String,
|
|
225
|
+
input: Boolean,
|
|
226
|
+
inputValue: String
|
|
221
227
|
},
|
|
222
228
|
emits: ['update:modelValue', 'fc.el'],
|
|
223
229
|
setup: function setup(props, _) {
|
|
224
230
|
var options = toRef(props.formCreateInject, 'options', []);
|
|
225
231
|
var value = toRef(props, 'modelValue');
|
|
232
|
+
var inputValue = toRef(props, 'inputValue', '');
|
|
233
|
+
var customValue = ref(inputValue.value);
|
|
234
|
+
var input = toRef(props, 'input', false);
|
|
235
|
+
|
|
236
|
+
var updateCustomValue = function updateCustomValue(n) {
|
|
237
|
+
var _value = _toConsumableArray(toArray(value.value));
|
|
238
|
+
|
|
239
|
+
var idx = _value.indexOf(customValue.value);
|
|
240
|
+
|
|
241
|
+
customValue.value = n;
|
|
242
|
+
|
|
243
|
+
if (idx > -1) {
|
|
244
|
+
_value.splice(idx, 1);
|
|
245
|
+
|
|
246
|
+
_value.push(n);
|
|
247
|
+
|
|
248
|
+
onInput(_value);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
watch(inputValue, function (n) {
|
|
253
|
+
if (!input.value) {
|
|
254
|
+
customValue.value = n;
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
updateCustomValue(n);
|
|
259
|
+
});
|
|
226
260
|
|
|
227
261
|
var _options = function _options() {
|
|
228
262
|
return Array.isArray(options.value) ? options.value : [];
|
|
229
263
|
};
|
|
230
264
|
|
|
265
|
+
var onInput = function onInput(n) {
|
|
266
|
+
_.emit('update:modelValue', n);
|
|
267
|
+
};
|
|
268
|
+
|
|
231
269
|
return {
|
|
232
270
|
options: _options,
|
|
233
271
|
value: value,
|
|
234
|
-
onInput:
|
|
235
|
-
|
|
272
|
+
onInput: onInput,
|
|
273
|
+
updateCustomValue: updateCustomValue,
|
|
274
|
+
makeInput: function makeInput(Type) {
|
|
275
|
+
if (!input.value) {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return createVNode(Type, {
|
|
280
|
+
"value": customValue.value,
|
|
281
|
+
"label": customValue.value
|
|
282
|
+
}, {
|
|
283
|
+
"default": function _default() {
|
|
284
|
+
return [createVNode(resolveComponent("ElInput"), {
|
|
285
|
+
"modelValue": customValue.value,
|
|
286
|
+
"onUpdate:modelValue": updateCustomValue
|
|
287
|
+
}, null)];
|
|
288
|
+
}
|
|
289
|
+
});
|
|
236
290
|
}
|
|
237
291
|
};
|
|
238
292
|
},
|
|
@@ -257,7 +311,7 @@ var Checkbox = defineComponent({
|
|
|
257
311
|
delete props.value;
|
|
258
312
|
delete props.label;
|
|
259
313
|
return createVNode(Type, mergeProps$1(props, {
|
|
260
|
-
"label":
|
|
314
|
+
"label": value,
|
|
261
315
|
"value": value,
|
|
262
316
|
"key": name + index + '-' + value
|
|
263
317
|
}), {
|
|
@@ -265,7 +319,7 @@ var Checkbox = defineComponent({
|
|
|
265
319
|
return [label || value || ''];
|
|
266
320
|
}
|
|
267
321
|
});
|
|
268
|
-
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
322
|
+
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots), _this.makeInput(Type)];
|
|
269
323
|
}
|
|
270
324
|
}, getSlot(this.$slots, ['default'])));
|
|
271
325
|
},
|
|
@@ -274,10 +328,6 @@ var Checkbox = defineComponent({
|
|
|
274
328
|
}
|
|
275
329
|
});
|
|
276
330
|
|
|
277
|
-
function toArray(value) {
|
|
278
|
-
return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
|
|
279
|
-
}
|
|
280
|
-
|
|
281
331
|
// https://github.com/developit/mitt
|
|
282
332
|
function Mitt(all) {
|
|
283
333
|
all = all || new Map();
|
|
@@ -964,22 +1014,66 @@ var Radio = defineComponent({
|
|
|
964
1014
|
type: [String, Number, Boolean],
|
|
965
1015
|
"default": ''
|
|
966
1016
|
},
|
|
967
|
-
type: String
|
|
1017
|
+
type: String,
|
|
1018
|
+
input: Boolean,
|
|
1019
|
+
inputValue: String
|
|
968
1020
|
},
|
|
969
1021
|
emits: ['update:modelValue', 'fc.el'],
|
|
970
1022
|
setup: function setup(props, _) {
|
|
971
1023
|
var options = toRef(props.formCreateInject, 'options', []);
|
|
972
1024
|
var value = toRef(props, 'modelValue');
|
|
1025
|
+
var inputValue = toRef(props, 'inputValue', '');
|
|
1026
|
+
var customValue = ref(inputValue.value);
|
|
1027
|
+
var input = toRef(props, 'input', false);
|
|
973
1028
|
|
|
974
1029
|
var _options = function _options() {
|
|
975
1030
|
return Array.isArray(options.value) ? options.value : [];
|
|
976
1031
|
};
|
|
977
1032
|
|
|
1033
|
+
watch(inputValue, function (n) {
|
|
1034
|
+
if (!input.value) {
|
|
1035
|
+
customValue.value = n;
|
|
1036
|
+
return undefined;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
updateCustomValue(n);
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
var onInput = function onInput(n) {
|
|
1043
|
+
_.emit('update:modelValue', n);
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
var updateCustomValue = function updateCustomValue(n) {
|
|
1047
|
+
var o = customValue.value;
|
|
1048
|
+
customValue.value = n;
|
|
1049
|
+
|
|
1050
|
+
if (value.value === o) {
|
|
1051
|
+
onInput(n);
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
|
|
978
1055
|
return {
|
|
979
1056
|
options: _options,
|
|
980
1057
|
value: value,
|
|
981
|
-
onInput:
|
|
982
|
-
|
|
1058
|
+
onInput: onInput,
|
|
1059
|
+
updateCustomValue: updateCustomValue,
|
|
1060
|
+
customValue: customValue,
|
|
1061
|
+
makeInput: function makeInput(Type) {
|
|
1062
|
+
if (!input.value) {
|
|
1063
|
+
return undefined;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
return createVNode(Type, {
|
|
1067
|
+
"value": customValue.value,
|
|
1068
|
+
"label": customValue.value
|
|
1069
|
+
}, {
|
|
1070
|
+
"default": function _default() {
|
|
1071
|
+
return [createVNode(resolveComponent("ElInput"), {
|
|
1072
|
+
"modelValue": customValue.value,
|
|
1073
|
+
"onUpdate:modelValue": updateCustomValue
|
|
1074
|
+
}, null)];
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
983
1077
|
}
|
|
984
1078
|
};
|
|
985
1079
|
},
|
|
@@ -1004,7 +1098,7 @@ var Radio = defineComponent({
|
|
|
1004
1098
|
delete props.value;
|
|
1005
1099
|
delete props.label;
|
|
1006
1100
|
return createVNode(Type, mergeProps$1(props, {
|
|
1007
|
-
"label":
|
|
1101
|
+
"label": value,
|
|
1008
1102
|
"value": value,
|
|
1009
1103
|
"key": name + index + '-' + value
|
|
1010
1104
|
}), {
|
|
@@ -1012,7 +1106,7 @@ var Radio = defineComponent({
|
|
|
1012
1106
|
return [label || value || ''];
|
|
1013
1107
|
}
|
|
1014
1108
|
});
|
|
1015
|
-
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
1109
|
+
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots), _this.makeInput(Type)];
|
|
1016
1110
|
}
|
|
1017
1111
|
}, getSlot(this.$slots, ['default'])));
|
|
1018
1112
|
},
|
|
@@ -2140,6 +2234,10 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2140
2234
|
type: Boolean,
|
|
2141
2235
|
"default": undefined
|
|
2142
2236
|
},
|
|
2237
|
+
preview: {
|
|
2238
|
+
type: Boolean,
|
|
2239
|
+
"default": undefined
|
|
2240
|
+
},
|
|
2143
2241
|
api: Object,
|
|
2144
2242
|
name: String,
|
|
2145
2243
|
subForm: {
|
|
@@ -2230,6 +2328,10 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2230
2328
|
}
|
|
2231
2329
|
});
|
|
2232
2330
|
|
|
2331
|
+
if (props.option && props.option.style) {
|
|
2332
|
+
content += props.option.style;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2233
2335
|
if (content) {
|
|
2234
2336
|
styleEl = document.createElement('style');
|
|
2235
2337
|
styleEl.type = 'text/css';
|
|
@@ -2272,7 +2374,7 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2272
2374
|
deep: true
|
|
2273
2375
|
});
|
|
2274
2376
|
watch(function () {
|
|
2275
|
-
return props.disabled;
|
|
2377
|
+
return [props.disabled, props.preview];
|
|
2276
2378
|
}, function () {
|
|
2277
2379
|
fapi.refresh();
|
|
2278
2380
|
});
|
|
@@ -2551,6 +2653,64 @@ function setPrototypeOf(o, proto) {
|
|
|
2551
2653
|
return o;
|
|
2552
2654
|
}
|
|
2553
2655
|
|
|
2656
|
+
var changeType = function changeType(a, b) {
|
|
2657
|
+
if (typeof a === 'string') {
|
|
2658
|
+
return String(b);
|
|
2659
|
+
} else if (typeof a === 'number') {
|
|
2660
|
+
return Number(b);
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
return b;
|
|
2664
|
+
};
|
|
2665
|
+
|
|
2666
|
+
var condition = {
|
|
2667
|
+
'==': function _(a, b) {
|
|
2668
|
+
return JSON.stringify(a) === JSON.stringify(changeType(a, b));
|
|
2669
|
+
},
|
|
2670
|
+
'!=': function _(a, b) {
|
|
2671
|
+
return !condition['=='](a, b);
|
|
2672
|
+
},
|
|
2673
|
+
'>': function _(a, b) {
|
|
2674
|
+
return a > b;
|
|
2675
|
+
},
|
|
2676
|
+
'>=': function _(a, b) {
|
|
2677
|
+
return a >= b;
|
|
2678
|
+
},
|
|
2679
|
+
'<': function _(a, b) {
|
|
2680
|
+
return a < b;
|
|
2681
|
+
},
|
|
2682
|
+
'<=': function _(a, b) {
|
|
2683
|
+
return a <= b;
|
|
2684
|
+
},
|
|
2685
|
+
on: function on(a, b) {
|
|
2686
|
+
return a && a.indexOf && a.indexOf(changeType(a[0], b)) > -1;
|
|
2687
|
+
},
|
|
2688
|
+
notOn: function notOn(a, b) {
|
|
2689
|
+
return !condition.on(a, b);
|
|
2690
|
+
},
|
|
2691
|
+
"in": function _in(a, b) {
|
|
2692
|
+
return b && b.indexOf && b.indexOf(a) > -1;
|
|
2693
|
+
},
|
|
2694
|
+
notIn: function notIn(a, b) {
|
|
2695
|
+
return !condition["in"](a, b);
|
|
2696
|
+
},
|
|
2697
|
+
between: function between(a, b) {
|
|
2698
|
+
return a > b[0] && a < b[1];
|
|
2699
|
+
},
|
|
2700
|
+
notBetween: function notBetween(a, b) {
|
|
2701
|
+
return a < b[0] || a > b[1];
|
|
2702
|
+
},
|
|
2703
|
+
empty: function empty(a) {
|
|
2704
|
+
return is.empty(a);
|
|
2705
|
+
},
|
|
2706
|
+
notEmpty: function notEmpty(a) {
|
|
2707
|
+
return !is.empty(a);
|
|
2708
|
+
},
|
|
2709
|
+
pattern: function pattern(a, b) {
|
|
2710
|
+
return new RegExp(b, 'g').test(a);
|
|
2711
|
+
}
|
|
2712
|
+
};
|
|
2713
|
+
|
|
2554
2714
|
function baseRule() {
|
|
2555
2715
|
return {
|
|
2556
2716
|
props: {},
|
|
@@ -2803,7 +2963,7 @@ function Api(h) {
|
|
|
2803
2963
|
if (!ctx) return initial;
|
|
2804
2964
|
initial[ctx.field] = copy(ctx.rule.value);
|
|
2805
2965
|
return initial;
|
|
2806
|
-
}, {});
|
|
2966
|
+
}, h.options.appendValue ? copy(h.appendData) : {});
|
|
2807
2967
|
},
|
|
2808
2968
|
getValue: function getValue(field) {
|
|
2809
2969
|
var ctx = h.getFieldCtx(field);
|
|
@@ -3219,10 +3379,7 @@ function Api(h) {
|
|
|
3219
3379
|
|
|
3220
3380
|
if (config.type === 'fetch') {
|
|
3221
3381
|
api.fetch(config).then(function (res) {
|
|
3222
|
-
resolve(
|
|
3223
|
-
res: res,
|
|
3224
|
-
config: config
|
|
3225
|
-
});
|
|
3382
|
+
resolve(res);
|
|
3226
3383
|
})["catch"](inject);
|
|
3227
3384
|
} else {
|
|
3228
3385
|
resolve(config.data);
|
|
@@ -3466,7 +3623,7 @@ function useRender$1(Render) {
|
|
|
3466
3623
|
this.setOptions(ctx);
|
|
3467
3624
|
this.ctxProp(ctx);
|
|
3468
3625
|
var prop = ctx.prop;
|
|
3469
|
-
prop.preview = !!(
|
|
3626
|
+
prop.preview = !!(prop.preview != null ? prop.preview : this.vm.props.preview !== undefined ? this.vm.props.preview : this.options.preview || false);
|
|
3470
3627
|
prop.props.formCreateInject = this.injectProp(ctx);
|
|
3471
3628
|
var cacheFlag = prop.cache !== false;
|
|
3472
3629
|
var preview = prop.preview;
|
|
@@ -4194,14 +4351,31 @@ extend(RuleContext.prototype, {
|
|
|
4194
4351
|
var _this4 = this;
|
|
4195
4352
|
|
|
4196
4353
|
return toArray(this.prop.validate).map(function (item) {
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4354
|
+
if (is.Function(item.validator)) {
|
|
4355
|
+
var temp = _objectSpread2({}, item);
|
|
4356
|
+
|
|
4357
|
+
var that = _this4;
|
|
4358
|
+
|
|
4359
|
+
temp.validator = function () {
|
|
4360
|
+
var _item$validator;
|
|
4361
|
+
|
|
4362
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4363
|
+
args[_key] = arguments[_key];
|
|
4364
|
+
}
|
|
4365
|
+
|
|
4366
|
+
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
4367
|
+
that: this,
|
|
4368
|
+
id: that.id,
|
|
4369
|
+
field: that.field,
|
|
4370
|
+
rule: that.rule,
|
|
4371
|
+
api: that.$handle.api
|
|
4372
|
+
}].concat(args));
|
|
4373
|
+
};
|
|
4374
|
+
|
|
4375
|
+
return temp;
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4378
|
+
return item;
|
|
4205
4379
|
});
|
|
4206
4380
|
},
|
|
4207
4381
|
check: function check(handle) {
|
|
@@ -4310,73 +4484,6 @@ extend(RuleContext.prototype, {
|
|
|
4310
4484
|
}
|
|
4311
4485
|
});
|
|
4312
4486
|
|
|
4313
|
-
var condition = {
|
|
4314
|
-
'==': function _(b) {
|
|
4315
|
-
return function (a) {
|
|
4316
|
-
return a === b;
|
|
4317
|
-
};
|
|
4318
|
-
},
|
|
4319
|
-
'!=': function _(b) {
|
|
4320
|
-
return function (a) {
|
|
4321
|
-
return a !== b;
|
|
4322
|
-
};
|
|
4323
|
-
},
|
|
4324
|
-
'<>': function _(b) {
|
|
4325
|
-
return function (a) {
|
|
4326
|
-
return a !== b;
|
|
4327
|
-
};
|
|
4328
|
-
},
|
|
4329
|
-
'>': function _(b) {
|
|
4330
|
-
return function (a) {
|
|
4331
|
-
return a > b;
|
|
4332
|
-
};
|
|
4333
|
-
},
|
|
4334
|
-
'>=': function _(b) {
|
|
4335
|
-
return function (a) {
|
|
4336
|
-
return a >= b;
|
|
4337
|
-
};
|
|
4338
|
-
},
|
|
4339
|
-
'<': function _(b) {
|
|
4340
|
-
return function (a) {
|
|
4341
|
-
return a < b;
|
|
4342
|
-
};
|
|
4343
|
-
},
|
|
4344
|
-
'<=': function _(b) {
|
|
4345
|
-
return function (a) {
|
|
4346
|
-
return a <= b;
|
|
4347
|
-
};
|
|
4348
|
-
},
|
|
4349
|
-
'in': function _in(b) {
|
|
4350
|
-
return function (a) {
|
|
4351
|
-
return b && b.indexOf && b.indexOf(a) > -1;
|
|
4352
|
-
};
|
|
4353
|
-
},
|
|
4354
|
-
'on': function on(b) {
|
|
4355
|
-
return function (a) {
|
|
4356
|
-
return a && a.indexOf && a.indexOf(b) > -1;
|
|
4357
|
-
};
|
|
4358
|
-
},
|
|
4359
|
-
'notIn': function notIn(b) {
|
|
4360
|
-
return function (a) {
|
|
4361
|
-
return !condition["in"](b)(a);
|
|
4362
|
-
};
|
|
4363
|
-
},
|
|
4364
|
-
'notOn': function notOn(b) {
|
|
4365
|
-
return function (a) {
|
|
4366
|
-
return !condition.on(b)(a);
|
|
4367
|
-
};
|
|
4368
|
-
},
|
|
4369
|
-
'between': function between(b) {
|
|
4370
|
-
return function (a) {
|
|
4371
|
-
return a > b[0] && a < b[1];
|
|
4372
|
-
};
|
|
4373
|
-
},
|
|
4374
|
-
'notBetween': function notBetween(b) {
|
|
4375
|
-
return function (a) {
|
|
4376
|
-
return a < b[0] || a > b[1];
|
|
4377
|
-
};
|
|
4378
|
-
}
|
|
4379
|
-
};
|
|
4380
4487
|
function useLoader(Handler) {
|
|
4381
4488
|
extend(Handler.prototype, {
|
|
4382
4489
|
nextRefresh: function nextRefresh(fn) {
|
|
@@ -4566,7 +4673,7 @@ function useLoader(Handler) {
|
|
|
4566
4673
|
if (!ctx) {
|
|
4567
4674
|
var _rule2 = _this6.parseRule(_rule);
|
|
4568
4675
|
|
|
4569
|
-
ctx = new RuleContext(_this6, _rule2,
|
|
4676
|
+
ctx = new RuleContext(_this6, _rule2, defaultValue);
|
|
4570
4677
|
|
|
4571
4678
|
_this6.bindParser(ctx);
|
|
4572
4679
|
} else {
|
|
@@ -4649,7 +4756,10 @@ function useLoader(Handler) {
|
|
|
4649
4756
|
|
|
4650
4757
|
var _loop = function _loop(i) {
|
|
4651
4758
|
var control = controls[i],
|
|
4652
|
-
handleFn = control.handle ||
|
|
4759
|
+
handleFn = control.handle || function (val) {
|
|
4760
|
+
return (condition[control.condition || '=='] || condition['=='])(val, control.value);
|
|
4761
|
+
};
|
|
4762
|
+
|
|
4653
4763
|
if (!is.trueArray(control.rule)) return "continue";
|
|
4654
4764
|
|
|
4655
4765
|
var data = _objectSpread2(_objectSpread2({}, control), {}, {
|
|
@@ -4917,7 +5027,7 @@ function useInput(Handler) {
|
|
|
4917
5027
|
return this.deferSyncFn.sync = true;
|
|
4918
5028
|
}
|
|
4919
5029
|
|
|
4920
|
-
this.vm.setupState.updateValue(_objectSpread2({}, this.form));
|
|
5030
|
+
this.vm.setupState.updateValue(_objectSpread2(_objectSpread2({}, this.options.appendValue ? this.appendData : {}), this.form));
|
|
4921
5031
|
},
|
|
4922
5032
|
isChange: function isChange(ctx, value) {
|
|
4923
5033
|
return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
|
|
@@ -5171,15 +5281,56 @@ function useContext(Handler) {
|
|
|
5171
5281
|
if (!item) return undefined;
|
|
5172
5282
|
var fn;
|
|
5173
5283
|
|
|
5174
|
-
if (
|
|
5284
|
+
if (_typeof(item) === 'object') {
|
|
5285
|
+
var group = ctx.getParentGroup();
|
|
5286
|
+
|
|
5287
|
+
var checkCondition = function checkCondition(item) {
|
|
5288
|
+
item = Array.isArray(item) ? {
|
|
5289
|
+
mode: 'AND',
|
|
5290
|
+
group: item
|
|
5291
|
+
} : item;
|
|
5292
|
+
|
|
5293
|
+
if (!is.trueArray(item.group)) {
|
|
5294
|
+
return true;
|
|
5295
|
+
}
|
|
5296
|
+
|
|
5297
|
+
var or = item.mode === 'OR';
|
|
5298
|
+
var valid = true;
|
|
5299
|
+
|
|
5300
|
+
for (var i = 0; i < item.group.length; i++) {
|
|
5301
|
+
var one = item.group[i];
|
|
5302
|
+
var flag = void 0;
|
|
5303
|
+
|
|
5304
|
+
if (one.mode) {
|
|
5305
|
+
flag = checkCondition(one);
|
|
5306
|
+
} else if (!condition[one.condition]) {
|
|
5307
|
+
flag = false;
|
|
5308
|
+
} else {
|
|
5309
|
+
flag = new Function('_$', '_$val', 'top', 'group', "with(top){with(this){with(group){ return _$['".concat(one.condition, "'](").concat(one.field, ", ").concat(one.compare ? one.compare : '_$val', "); }}}")).call(_this.api.form, condition, one.value, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {});
|
|
5310
|
+
}
|
|
5311
|
+
|
|
5312
|
+
if (or && flag) {
|
|
5313
|
+
return true;
|
|
5314
|
+
}
|
|
5315
|
+
|
|
5316
|
+
if (!or) {
|
|
5317
|
+
valid = valid && flag;
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
|
|
5321
|
+
return or ? false : valid;
|
|
5322
|
+
};
|
|
5323
|
+
|
|
5324
|
+
return checkCondition(item);
|
|
5325
|
+
} else if (is.Function(item)) {
|
|
5175
5326
|
fn = function fn() {
|
|
5176
5327
|
return item(_this.api.form, _this.api);
|
|
5177
5328
|
};
|
|
5178
5329
|
} else {
|
|
5179
|
-
var
|
|
5330
|
+
var _group = ctx.getParentGroup();
|
|
5180
5331
|
|
|
5181
5332
|
fn = function fn() {
|
|
5182
|
-
return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form,
|
|
5333
|
+
return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, _group ? _this.subRuleData[_group.id] || {} : {}, ctx.rule, _this.api);
|
|
5183
5334
|
};
|
|
5184
5335
|
}
|
|
5185
5336
|
|
|
@@ -5870,6 +6021,8 @@ var fetch = function fetch(fc) {
|
|
|
5870
6021
|
return;
|
|
5871
6022
|
}
|
|
5872
6023
|
|
|
6024
|
+
option = deepCopy(option);
|
|
6025
|
+
|
|
5873
6026
|
if (!option.to) {
|
|
5874
6027
|
option.to = 'options';
|
|
5875
6028
|
}
|
|
@@ -6307,7 +6460,7 @@ function FormCreateFactory(config) {
|
|
|
6307
6460
|
},
|
|
6308
6461
|
mergeOptions: function mergeOptions(target, opt, parent) {
|
|
6309
6462
|
opt = deepCopy(opt);
|
|
6310
|
-
parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach(function (n) {
|
|
6463
|
+
parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
|
|
6311
6464
|
delete opt[n];
|
|
6312
6465
|
});
|
|
6313
6466
|
|
|
@@ -7316,7 +7469,7 @@ function install(FormCreate) {
|
|
|
7316
7469
|
function elmFormCreate() {
|
|
7317
7470
|
return FormCreateFactory({
|
|
7318
7471
|
ui: 'element-ui',
|
|
7319
|
-
version: '3.1.
|
|
7472
|
+
version: '3.1.33',
|
|
7320
7473
|
manager: manager,
|
|
7321
7474
|
extendApi: extendApi,
|
|
7322
7475
|
install: install,
|