@form-create/element-ui 3.2.10 → 3.2.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 +95 -8
- package/dist/form-create.esm.js +111 -49
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +111 -49
- package/dist/form-create.min.js +2 -2
- package/package.json +3 -3
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.11
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -2145,7 +2145,7 @@
|
|
|
2145
2145
|
},
|
|
2146
2146
|
inFor: Boolean
|
|
2147
2147
|
},
|
|
2148
|
-
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
|
|
2148
|
+
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'reset', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
|
|
2149
2149
|
render: function render() {
|
|
2150
2150
|
return this.fc.render();
|
|
2151
2151
|
},
|
|
@@ -2448,7 +2448,7 @@
|
|
|
2448
2448
|
};
|
|
2449
2449
|
};
|
|
2450
2450
|
|
|
2451
|
-
var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate', 'computed', 'preview', 'component', 'cache', 'modelEmit'];
|
|
2451
|
+
var keyAttrs = ['type', 'slot', 'ignore', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate', 'computed', 'preview', 'component', 'cache', 'modelEmit'];
|
|
2452
2452
|
var arrayAttrs = ['validate', 'children', 'control'];
|
|
2453
2453
|
var normalAttrs = ['effect', 'deep'];
|
|
2454
2454
|
function attrs() {
|
|
@@ -3076,16 +3076,33 @@
|
|
|
3076
3076
|
},
|
|
3077
3077
|
|
|
3078
3078
|
formData: function formData(fields) {
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3079
|
+
if (fields == null) {
|
|
3080
|
+
return api.fields().reduce(function (initial, id) {
|
|
3081
|
+
var ctx = (h.fieldCtx[id] || []).filter(function (ctx) {
|
|
3082
|
+
return !h.isIgnore(ctx.rule);
|
|
3083
|
+
})[0];
|
|
3084
|
+
if (!ctx) return initial;
|
|
3085
|
+
initial[ctx.field] = copy(ctx.rule.value);
|
|
3086
|
+
return initial;
|
|
3087
|
+
}, h.options.appendValue !== false ? copy(h.appendData) : {});
|
|
3088
|
+
} else {
|
|
3089
|
+
return tidyFields(fields).reduce(function (initial, id) {
|
|
3090
|
+
initial[id] = api.getValue(id);
|
|
3091
|
+
return initial;
|
|
3092
|
+
}, {});
|
|
3093
|
+
}
|
|
3085
3094
|
},
|
|
3086
3095
|
getValue: function getValue(field) {
|
|
3087
3096
|
var ctx = h.getFieldCtx(field);
|
|
3088
|
-
|
|
3097
|
+
|
|
3098
|
+
if (!ctx) {
|
|
3099
|
+
if (h.options.appendValue !== false && hasProperty(h.appendData, field)) {
|
|
3100
|
+
return copy(h.appendData[field]);
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
return undefined;
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3089
3106
|
return copy(ctx.rule.value);
|
|
3090
3107
|
},
|
|
3091
3108
|
coverValue: function coverValue(formData) {
|
|
@@ -3393,6 +3410,13 @@
|
|
|
3393
3410
|
vue.nextTick(function () {
|
|
3394
3411
|
api.clearValidateState();
|
|
3395
3412
|
});
|
|
3413
|
+
|
|
3414
|
+
if (fields == null) {
|
|
3415
|
+
is.Function(h.options.onReset) && invoke(function () {
|
|
3416
|
+
return h.options.onReset(api);
|
|
3417
|
+
});
|
|
3418
|
+
h.vm.emit('reset', api);
|
|
3419
|
+
}
|
|
3396
3420
|
},
|
|
3397
3421
|
method: function method(id, name) {
|
|
3398
3422
|
var el = api.el(id);
|
|
@@ -3969,6 +3993,9 @@
|
|
|
3969
3993
|
getSubForm: function getSubForm() {
|
|
3970
3994
|
return _this6.$handle.subForm[ctx.id];
|
|
3971
3995
|
},
|
|
3996
|
+
slots: function slots() {
|
|
3997
|
+
return _this6.vm.setupState.top.slots;
|
|
3998
|
+
},
|
|
3972
3999
|
options: [],
|
|
3973
4000
|
children: [],
|
|
3974
4001
|
preview: false,
|
|
@@ -5299,12 +5326,18 @@
|
|
|
5299
5326
|
fields.reduce(function (initial, field) {
|
|
5300
5327
|
var ctx = _this2.getCtx(field);
|
|
5301
5328
|
|
|
5302
|
-
|
|
5329
|
+
if (!_this2.isIgnore(ctx.rule)) {
|
|
5330
|
+
initial[field] = vue.toRef(ctx.rule, 'value');
|
|
5331
|
+
}
|
|
5332
|
+
|
|
5303
5333
|
return initial;
|
|
5304
5334
|
}, data);
|
|
5305
5335
|
this.form = data;
|
|
5306
5336
|
this.syncValue();
|
|
5307
5337
|
},
|
|
5338
|
+
isIgnore: function isIgnore(rule) {
|
|
5339
|
+
return rule.ignore || this.options.ignoreHiddenFields && rule.hidden;
|
|
5340
|
+
},
|
|
5308
5341
|
appendValue: function appendValue(rule) {
|
|
5309
5342
|
if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
|
|
5310
5343
|
return;
|
|
@@ -5542,7 +5575,13 @@
|
|
|
5542
5575
|
|
|
5543
5576
|
_this.watching = true;
|
|
5544
5577
|
|
|
5545
|
-
if (key === '
|
|
5578
|
+
if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
|
|
5579
|
+
_this.$render.clearCacheAll();
|
|
5580
|
+
}
|
|
5581
|
+
|
|
5582
|
+
if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && _this.options.ignoreHiddenFields) {
|
|
5583
|
+
_this.syncForm();
|
|
5584
|
+
} else if (key === 'link') {
|
|
5546
5585
|
ctx.link();
|
|
5547
5586
|
return;
|
|
5548
5587
|
} else if (['props', 'on', 'deep'].indexOf(key) > -1) {
|
|
@@ -5553,8 +5592,6 @@
|
|
|
5553
5592
|
}
|
|
5554
5593
|
} else if (key === 'emit') {
|
|
5555
5594
|
_this.parseEmit(ctx);
|
|
5556
|
-
} else if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
|
|
5557
|
-
_this.$render.clearCacheAll();
|
|
5558
5595
|
} else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
|
|
5559
5596
|
ctx.updateType();
|
|
5560
5597
|
|
|
@@ -5609,10 +5646,18 @@
|
|
|
5609
5646
|
}
|
|
5610
5647
|
|
|
5611
5648
|
Object.keys(computedRule).forEach(function (k) {
|
|
5649
|
+
var oldValue = undefined;
|
|
5612
5650
|
var computedValue = vue.computed(function () {
|
|
5613
5651
|
var item = computedRule[k];
|
|
5614
5652
|
if (!item) return undefined;
|
|
5615
|
-
|
|
5653
|
+
|
|
5654
|
+
var value = _this.compute(ctx, item);
|
|
5655
|
+
|
|
5656
|
+
if (item.linkage && value === undefined) {
|
|
5657
|
+
return oldValue;
|
|
5658
|
+
}
|
|
5659
|
+
|
|
5660
|
+
return value;
|
|
5616
5661
|
});
|
|
5617
5662
|
|
|
5618
5663
|
var callback = function callback(n) {
|
|
@@ -5630,6 +5675,7 @@
|
|
|
5630
5675
|
}
|
|
5631
5676
|
|
|
5632
5677
|
ctx.watch.push(vue.watch(computedValue, function (n) {
|
|
5678
|
+
oldValue = n;
|
|
5633
5679
|
setTimeout(function () {
|
|
5634
5680
|
callback(n);
|
|
5635
5681
|
});
|
|
@@ -5684,41 +5730,51 @@
|
|
|
5684
5730
|
};
|
|
5685
5731
|
|
|
5686
5732
|
var val = checkCondition(item);
|
|
5687
|
-
|
|
5733
|
+
val = item.invert === true ? !val : val;
|
|
5734
|
+
|
|
5735
|
+
if (item.linkage) {
|
|
5736
|
+
return val ? invoke(function () {
|
|
5737
|
+
return _this2.computeValue(item.linkage, ctx, group);
|
|
5738
|
+
}, undefined) : undefined;
|
|
5739
|
+
}
|
|
5740
|
+
|
|
5741
|
+
return val;
|
|
5688
5742
|
} else if (is.Function(item)) {
|
|
5689
5743
|
fn = function fn() {
|
|
5690
5744
|
return item(_this2.api.form, _this2.api);
|
|
5691
5745
|
};
|
|
5692
5746
|
} else {
|
|
5693
|
-
var that = this;
|
|
5694
|
-
var formulas = Object.keys(this.fc.formulas).reduce(function (obj, k) {
|
|
5695
|
-
obj[k] = function () {
|
|
5696
|
-
var _that$fc$formulas$k;
|
|
5697
|
-
|
|
5698
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5699
|
-
args[_key] = arguments[_key];
|
|
5700
|
-
}
|
|
5701
|
-
|
|
5702
|
-
return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
|
|
5703
|
-
that: this,
|
|
5704
|
-
rule: ctx.rule,
|
|
5705
|
-
api: that.api,
|
|
5706
|
-
fc: that.fc
|
|
5707
|
-
}].concat(args));
|
|
5708
|
-
};
|
|
5709
|
-
|
|
5710
|
-
return obj;
|
|
5711
|
-
}, {});
|
|
5712
|
-
|
|
5713
5747
|
var _group = ctx.getParentGroup();
|
|
5714
5748
|
|
|
5715
5749
|
fn = function fn() {
|
|
5716
|
-
return
|
|
5750
|
+
return _this2.computeValue(item, ctx, _group);
|
|
5717
5751
|
};
|
|
5718
5752
|
}
|
|
5719
5753
|
|
|
5720
5754
|
return invoke(fn, undefined);
|
|
5721
5755
|
},
|
|
5756
|
+
computeValue: function computeValue(str, ctx, group) {
|
|
5757
|
+
var that = this;
|
|
5758
|
+
var formulas = Object.keys(this.fc.formulas).reduce(function (obj, k) {
|
|
5759
|
+
obj[k] = function () {
|
|
5760
|
+
var _that$fc$formulas$k;
|
|
5761
|
+
|
|
5762
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5763
|
+
args[_key] = arguments[_key];
|
|
5764
|
+
}
|
|
5765
|
+
|
|
5766
|
+
return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
|
|
5767
|
+
that: this,
|
|
5768
|
+
rule: ctx.rule,
|
|
5769
|
+
api: that.api,
|
|
5770
|
+
fc: that.fc
|
|
5771
|
+
}].concat(args));
|
|
5772
|
+
};
|
|
5773
|
+
|
|
5774
|
+
return obj;
|
|
5775
|
+
}, {});
|
|
5776
|
+
return new Function('$formulas', '$form', '$group', '$rule', '$api', "with($form){with(this){with($group){with($formulas){ return ".concat(str, " }}}}")).call(this.api.form, formulas, this.api.top.form, group ? this.subRuleData[group.id] || {} : {}, ctx.rule, this.api);
|
|
5777
|
+
},
|
|
5722
5778
|
updateChildren: function updateChildren(ctx, n, o) {
|
|
5723
5779
|
var _this3 = this;
|
|
5724
5780
|
|
|
@@ -6700,6 +6756,7 @@
|
|
|
6700
6756
|
var CreateNode = CreateNodeFactory();
|
|
6701
6757
|
var formulas = {};
|
|
6702
6758
|
var isMobile = config.isMobile === true;
|
|
6759
|
+
var prototype = {};
|
|
6703
6760
|
exportAttrs(config.attrs || {});
|
|
6704
6761
|
|
|
6705
6762
|
function getApi(name) {
|
|
@@ -6814,6 +6871,8 @@
|
|
|
6814
6871
|
return vm.$refs.fc.fapi;
|
|
6815
6872
|
}
|
|
6816
6873
|
|
|
6874
|
+
setPrototypeOf(create, prototype);
|
|
6875
|
+
|
|
6817
6876
|
function factory(inherit) {
|
|
6818
6877
|
var _config = _objectSpread2({}, config);
|
|
6819
6878
|
|
|
@@ -7161,9 +7220,9 @@
|
|
|
7161
7220
|
var split = id.split('.');
|
|
7162
7221
|
var key = split.shift();
|
|
7163
7222
|
|
|
7164
|
-
if (key === '$
|
|
7223
|
+
if (key === '$topForm') {
|
|
7165
7224
|
val = this.$handle.api.top.formData();
|
|
7166
|
-
} else if (key === '$
|
|
7225
|
+
} else if (key === '$form') {
|
|
7167
7226
|
val = this.$handle.api.formData();
|
|
7168
7227
|
} else if (key === '$options') {
|
|
7169
7228
|
val = this.options.value;
|
|
@@ -7175,7 +7234,7 @@
|
|
|
7175
7234
|
split = [];
|
|
7176
7235
|
} else {
|
|
7177
7236
|
var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
|
|
7178
|
-
val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(
|
|
7237
|
+
val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(id);
|
|
7179
7238
|
split = [];
|
|
7180
7239
|
}
|
|
7181
7240
|
|
|
@@ -7210,7 +7269,9 @@
|
|
|
7210
7269
|
var callback = debounce(function () {
|
|
7211
7270
|
var temp = _this6.getLoadData(id, def);
|
|
7212
7271
|
|
|
7213
|
-
if (
|
|
7272
|
+
if (!unwatch[id]) {
|
|
7273
|
+
return;
|
|
7274
|
+
} else if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
|
|
7214
7275
|
unwatch[id].val = temp;
|
|
7215
7276
|
run(true);
|
|
7216
7277
|
}
|
|
@@ -7331,6 +7392,7 @@
|
|
|
7331
7392
|
extend(formCreate, {
|
|
7332
7393
|
version: config.version,
|
|
7333
7394
|
ui: config.ui,
|
|
7395
|
+
isMobile: isMobile,
|
|
7334
7396
|
extendApi: extendApi,
|
|
7335
7397
|
getData: getData,
|
|
7336
7398
|
setDataDriver: setDataDriver,
|
|
@@ -7351,6 +7413,7 @@
|
|
|
7351
7413
|
componentAlias: componentAlias,
|
|
7352
7414
|
copyRule: copyRule,
|
|
7353
7415
|
copyRules: copyRules,
|
|
7416
|
+
mergeRule: mergeRule,
|
|
7354
7417
|
fetch: fetch$1,
|
|
7355
7418
|
$form: $form,
|
|
7356
7419
|
parseFn: parseFn,
|
|
@@ -7365,7 +7428,6 @@
|
|
|
7365
7428
|
function useStatic(formCreate) {
|
|
7366
7429
|
extend(formCreate, {
|
|
7367
7430
|
create: create,
|
|
7368
|
-
isMobile: isMobile,
|
|
7369
7431
|
install: function install(app, options) {
|
|
7370
7432
|
globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
|
|
7371
7433
|
var key = '_installedFormCreate_' + config.ui;
|
|
@@ -7390,8 +7452,8 @@
|
|
|
7390
7452
|
});
|
|
7391
7453
|
}
|
|
7392
7454
|
|
|
7393
|
-
useAttr(
|
|
7394
|
-
useStatic(
|
|
7455
|
+
useAttr(prototype);
|
|
7456
|
+
useStatic(prototype);
|
|
7395
7457
|
setDataDriver('$cookie', cookieDriver);
|
|
7396
7458
|
setDataDriver('$localStorage', localStorageDriver);
|
|
7397
7459
|
CreateNode.use({
|
|
@@ -7419,18 +7481,18 @@
|
|
|
7419
7481
|
}
|
|
7420
7482
|
|
|
7421
7483
|
var FcComponent = $form();
|
|
7422
|
-
setPrototypeOf(FcComponent,
|
|
7484
|
+
setPrototypeOf(FcComponent, prototype);
|
|
7423
7485
|
Object.defineProperties(FcComponent, {
|
|
7424
7486
|
fetch: {
|
|
7425
7487
|
get: function get() {
|
|
7426
|
-
return
|
|
7488
|
+
return prototype.fetch;
|
|
7427
7489
|
},
|
|
7428
7490
|
set: function set(val) {
|
|
7429
|
-
|
|
7491
|
+
prototype.fetch = val;
|
|
7430
7492
|
}
|
|
7431
7493
|
}
|
|
7432
7494
|
});
|
|
7433
|
-
FcComponent.util =
|
|
7495
|
+
FcComponent.util = prototype;
|
|
7434
7496
|
return FcComponent;
|
|
7435
7497
|
}
|
|
7436
7498
|
|
|
@@ -8315,7 +8377,7 @@
|
|
|
8315
8377
|
function elmFormCreate() {
|
|
8316
8378
|
return FormCreateFactory({
|
|
8317
8379
|
ui: 'element-ui',
|
|
8318
|
-
version: '3.2.
|
|
8380
|
+
version: '3.2.11',
|
|
8319
8381
|
manager: manager,
|
|
8320
8382
|
extendApi: extendApi,
|
|
8321
8383
|
install: install,
|