@form-create/element-ui 3.2.7 → 3.2.9

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/element-ui v3.2.7
2
+ * @form-create/element-ui v3.2.9
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -281,11 +281,12 @@
281
281
  }
282
282
 
283
283
  return vue.createVNode(Type, {
284
- "value": customValue.value,
285
- "label": customValue.value
284
+ "value": customValue.value || undefined,
285
+ "label": customValue.value || undefined
286
286
  }, {
287
287
  "default": function _default() {
288
288
  return [vue.createVNode(vue.resolveComponent("ElInput"), {
289
+ "size": "small",
289
290
  "modelValue": customValue.value,
290
291
  "onUpdate:modelValue": updateCustomValue
291
292
  }, null)];
@@ -1068,11 +1069,13 @@
1068
1069
  }
1069
1070
 
1070
1071
  return vue.createVNode(Type, {
1071
- "value": customValue.value,
1072
- "label": customValue.value
1072
+ "checked": false,
1073
+ "value": customValue.value || undefined,
1074
+ "label": customValue.value || undefined
1073
1075
  }, {
1074
1076
  "default": function _default() {
1075
1077
  return [vue.createVNode(vue.resolveComponent("ElInput"), {
1078
+ "size": "small",
1076
1079
  "modelValue": customValue.value,
1077
1080
  "onUpdate:modelValue": updateCustomValue
1078
1081
  }, null)];
@@ -1287,7 +1290,7 @@
1287
1290
  return vue.createVNode(vue.resolveComponent("ElTree"), vue.mergeProps(this.$attrs, {
1288
1291
  "ref": "tree",
1289
1292
  "onCheck": this.updateValue,
1290
- "onNode-click": this.updateValue
1293
+ "onNodeClick": this.updateValue
1291
1294
  }), this.$slots);
1292
1295
  },
1293
1296
  mounted: function mounted() {
@@ -1415,7 +1418,7 @@
1415
1418
  }, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
1416
1419
  "key": len
1417
1420
  }, this.$attrs, {
1418
- "list-type": this.listType || 'picture-card',
1421
+ "listType": this.listType || 'picture-card',
1419
1422
  "class": {
1420
1423
  '_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= len : false
1421
1424
  },
@@ -1825,13 +1828,18 @@
1825
1828
  }, null);
1826
1829
  },
1827
1830
  changeSort: function changeSort(index, sort) {
1831
+ var _this10 = this;
1832
+
1828
1833
  var a = this.sort[index];
1829
1834
  this.sort[index] = this.sort[index + sort];
1830
1835
  this.sort[index + sort] = a;
1836
+ this.formCreateInject.subForm(this.sort.map(function (k) {
1837
+ return _this10.cacheRule[k].$f;
1838
+ }));
1831
1839
  this.formData(0);
1832
1840
  },
1833
1841
  makeIcon: function makeIcon(total, index, key) {
1834
- var _this10 = this;
1842
+ var _this11 = this;
1835
1843
 
1836
1844
  if (this.$slots.button) {
1837
1845
  return this.$slots.button({
@@ -1840,7 +1848,7 @@
1840
1848
  vm: this,
1841
1849
  key: key,
1842
1850
  del: function del() {
1843
- return _this10.del(index, key);
1851
+ return _this11.del(index, key);
1844
1852
  },
1845
1853
  add: this.add
1846
1854
  });
@@ -1876,12 +1884,12 @@
1876
1884
  }
1877
1885
  },
1878
1886
  created: function created() {
1879
- var _this11 = this;
1887
+ var _this12 = this;
1880
1888
 
1881
1889
  vue.watch(function () {
1882
- return _objectSpread2({}, _this11.cacheRule);
1890
+ return _objectSpread2({}, _this12.cacheRule);
1883
1891
  }, function (n) {
1884
- _this11.sort = Object.keys(n);
1892
+ _this12.sort = Object.keys(n);
1885
1893
  }, {
1886
1894
  immediate: true
1887
1895
  });
@@ -1896,7 +1904,7 @@
1896
1904
  }
1897
1905
  },
1898
1906
  render: function render() {
1899
- var _this12 = this;
1907
+ var _this13 = this;
1900
1908
 
1901
1909
  var keys = this.sort;
1902
1910
  var button = this.button;
@@ -1910,10 +1918,10 @@
1910
1918
  "class": "_fc-group-plus-minus _fc-group-add fc-clock",
1911
1919
  "onClick": this.add
1912
1920
  }, null) : keys.map(function (key, index) {
1913
- var _this12$cacheRule$key = _this12.cacheRule[key],
1914
- rule = _this12$cacheRule$key.rule,
1915
- options = _this12$cacheRule$key.options;
1916
- var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
1921
+ var _this13$cacheRule$key = _this13.cacheRule[key],
1922
+ rule = _this13$cacheRule$key.rule,
1923
+ options = _this13$cacheRule$key.options;
1924
+ var btn = button && !disabled ? _this13.makeIcon(keys.length, index, key) : [];
1917
1925
  return vue.createVNode("div", {
1918
1926
  "class": "_fc-group-container",
1919
1927
  "key": key
@@ -1922,20 +1930,20 @@
1922
1930
  }, {
1923
1931
  disabled: disabled,
1924
1932
  'onUpdate:modelValue': function onUpdateModelValue(formData) {
1925
- return _this12.formData(key, formData);
1933
+ return _this13.formData(key, formData);
1926
1934
  },
1927
1935
  'onEmit-event': function onEmitEvent(name) {
1928
1936
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1929
1937
  args[_key - 1] = arguments[_key];
1930
1938
  }
1931
1939
 
1932
- return _this12.emitEvent(name, args, index, key);
1940
+ return _this13.emitEvent(name, args, index, key);
1933
1941
  },
1934
1942
  'onUpdate:api': function onUpdateApi($f) {
1935
- return _this12.add$f(index, key, $f);
1943
+ return _this13.add$f(index, key, $f);
1936
1944
  },
1937
1945
  inFor: true,
1938
- modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
1946
+ modelValue: _this13.field ? _defineProperty({}, _this13.field, _this13._value(_this13.modelValue[index])) : _this13.modelValue[index],
1939
1947
  rule: rule,
1940
1948
  option: options,
1941
1949
  extendOption: true
@@ -2084,7 +2092,7 @@
2084
2092
  return str.replace(str[0], str[0].toLocaleUpperCase());
2085
2093
  }
2086
2094
 
2087
- var getRuleInject = function getRuleInject(vm, parent) {
2095
+ var _getGroupInject = function getGroupInject(vm, parent) {
2088
2096
  if (!vm || vm === parent) {
2089
2097
  return;
2090
2098
  }
@@ -2094,7 +2102,7 @@
2094
2102
  }
2095
2103
 
2096
2104
  if (vm.parent) {
2097
- return getRuleInject(vm.parent, parent);
2105
+ return _getGroupInject(vm.parent, parent);
2098
2106
  }
2099
2107
  };
2100
2108
 
@@ -2145,6 +2153,15 @@
2145
2153
  var vm = vue.getCurrentInstance();
2146
2154
  vue.provide('parentFC', vm);
2147
2155
  var parent = vue.inject('parentFC', null);
2156
+ var top = parent;
2157
+
2158
+ if (parent) {
2159
+ while (top.setupState.parent) {
2160
+ top = top.setupState.parent;
2161
+ }
2162
+ } else {
2163
+ top = vm;
2164
+ }
2148
2165
 
2149
2166
  var _toRefs = vue.toRefs(props),
2150
2167
  rule = _toRefs.rule,
@@ -2166,7 +2183,7 @@
2166
2183
 
2167
2184
  var addSubForm = function addSubForm() {
2168
2185
  if (parent) {
2169
- var _inject = getRuleInject(vm, parent);
2186
+ var _inject = _getGroupInject(vm, parent);
2170
2187
 
2171
2188
  if (_inject) {
2172
2189
  var sub;
@@ -2184,7 +2201,7 @@
2184
2201
  };
2185
2202
 
2186
2203
  var rmSubForm = function rmSubForm() {
2187
- var inject = getRuleInject(vm, parent);
2204
+ var inject = _getGroupInject(vm, parent);
2188
2205
 
2189
2206
  if (inject) {
2190
2207
  if (isMore) {
@@ -2202,33 +2219,36 @@
2202
2219
 
2203
2220
  var styleEl = null;
2204
2221
  vue.onBeforeMount(function () {
2205
- var content = '';
2206
- var globalClass = props.option && props.option.globalClass || {};
2207
- Object.keys(globalClass).forEach(function (k) {
2208
- var subCss = '';
2209
- globalClass[k].style && Object.keys(globalClass[k].style).forEach(function (key) {
2210
- subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
2222
+ vue.watchEffect(function () {
2223
+ var content = '';
2224
+ var globalClass = props.option && props.option.globalClass || {};
2225
+ Object.keys(globalClass).forEach(function (k) {
2226
+ var subCss = '';
2227
+ globalClass[k].style && Object.keys(globalClass[k].style).forEach(function (key) {
2228
+ subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
2229
+ });
2230
+
2231
+ if (globalClass[k].content) {
2232
+ subCss += globalClass[k].content + ';';
2233
+ }
2234
+
2235
+ if (subCss) {
2236
+ content += ".".concat(k, "{").concat(subCss, "}");
2237
+ }
2211
2238
  });
2212
2239
 
2213
- if (globalClass[k].content) {
2214
- subCss += globalClass[k].content + ';';
2240
+ if (props.option && props.option.style) {
2241
+ content += props.option.style;
2215
2242
  }
2216
2243
 
2217
- if (subCss) {
2218
- content += ".".concat(k, "{").concat(subCss, "}");
2244
+ if (!styleEl) {
2245
+ styleEl = document.createElement('style');
2246
+ styleEl.type = 'text/css';
2247
+ document.head.appendChild(styleEl);
2219
2248
  }
2220
- });
2221
-
2222
- if (props.option && props.option.style) {
2223
- content += props.option.style;
2224
- }
2225
2249
 
2226
- if (content) {
2227
- styleEl = document.createElement('style');
2228
- styleEl.type = 'text/css';
2229
- styleEl.innerHTML = content;
2230
- document.head.appendChild(styleEl);
2231
- }
2250
+ styleEl.innerHTML = content || '';
2251
+ });
2232
2252
  });
2233
2253
  var emit$topForm = debounce(function () {
2234
2254
  fc.bus.$emit('$loadData.$topForm');
@@ -2274,6 +2294,7 @@
2274
2294
  if (fc.$handle.isBreakWatch() || n.length === data.renderRule.length && n.every(function (v) {
2275
2295
  return data.renderRule.indexOf(v) > -1;
2276
2296
  })) return;
2297
+ fc.$handle.updateAppendData();
2277
2298
  fc.$handle.reloadRule(rule.value);
2278
2299
  vm.setupState.renderRule();
2279
2300
  });
@@ -2299,12 +2320,14 @@
2299
2320
  fapi.setValue(n || {});
2300
2321
  }
2301
2322
  }, {
2302
- deep: true
2323
+ deep: true,
2324
+ flush: 'post'
2303
2325
  });
2304
2326
  vue.watch(function () {
2305
2327
  return props.index;
2306
2328
  }, function () {
2307
2329
  fapi.coverValue({});
2330
+ fc.$handle.updateAppendData();
2308
2331
  vue.nextTick(function () {
2309
2332
  vue.nextTick(function () {
2310
2333
  fapi.clearValidateState();
@@ -2316,8 +2339,12 @@
2316
2339
  return _objectSpread2(_objectSpread2({
2317
2340
  fc: vue.markRaw(fc),
2318
2341
  parent: parent ? vue.markRaw(parent) : parent,
2342
+ top: vue.markRaw(top),
2319
2343
  fapi: vue.markRaw(fapi)
2320
2344
  }, vue.toRefs(data)), {}, {
2345
+ getGroupInject: function getGroupInject() {
2346
+ return _getGroupInject(vm, parent);
2347
+ },
2321
2348
  refresh: function refresh() {
2322
2349
  ++data.unique;
2323
2350
  },
@@ -2423,7 +2450,7 @@
2423
2450
 
2424
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'];
2425
2452
  var arrayAttrs = ['validate', 'children', 'control'];
2426
- var normalAttrs = ['effect'];
2453
+ var normalAttrs = ['effect', 'deep'];
2427
2454
  function attrs() {
2428
2455
  return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
2429
2456
  }
@@ -2439,6 +2466,16 @@
2439
2466
  console.error(e);
2440
2467
  }
2441
2468
 
2469
+ function toCase(str) {
2470
+ var to = str.replace(/(-[a-z])/g, function (v) {
2471
+ return v.replace('-', '').toLocaleUpperCase();
2472
+ });
2473
+ return lower(to);
2474
+ }
2475
+ function lower(str) {
2476
+ return str.replace(str[0], str[0].toLowerCase());
2477
+ }
2478
+
2442
2479
  var PREFIX = '[[FORM-CREATE-PREFIX-';
2443
2480
  var SUFFIX = '-FORM-CREATE-SUFFIX]]';
2444
2481
  var $T = '$FN:';
@@ -2666,6 +2703,10 @@
2666
2703
  var prop = _objectSpread2({}, rule.props || {});
2667
2704
 
2668
2705
  Object.keys(rule.on || {}).forEach(function (k) {
2706
+ if (k.indexOf('-') > 0) {
2707
+ k = toCase(k);
2708
+ }
2709
+
2669
2710
  var name = "on".concat(upper(k));
2670
2711
 
2671
2712
  if (Array.isArray(prop[name])) {
@@ -3009,6 +3050,31 @@
3009
3050
  return allSubForm();
3010
3051
  },
3011
3052
 
3053
+ get siblings() {
3054
+ var inject = h.vm.setupState.getGroupInject();
3055
+
3056
+ if (inject) {
3057
+ var subForm = inject.getSubForm();
3058
+
3059
+ if (Array.isArray(subForm)) {
3060
+ return _toConsumableArray(subForm);
3061
+ }
3062
+ }
3063
+
3064
+ return undefined;
3065
+ },
3066
+
3067
+ get index() {
3068
+ var siblings = api.siblings;
3069
+
3070
+ if (siblings) {
3071
+ var idx = siblings.indexOf(api);
3072
+ return idx > -1 ? idx : undefined;
3073
+ }
3074
+
3075
+ return undefined;
3076
+ },
3077
+
3012
3078
  formData: function formData(fields) {
3013
3079
  return tidyFields(fields).reduce(function (initial, id) {
3014
3080
  var ctx = h.getFieldCtx(id);
@@ -3324,10 +3390,13 @@
3324
3390
  ctx.rule.value = copy(ctx.defaultValue);
3325
3391
  });
3326
3392
  });
3393
+ vue.nextTick(function () {
3394
+ api.clearValidateState();
3395
+ });
3327
3396
  },
3328
3397
  method: function method(id, name) {
3329
3398
  var el = api.el(id);
3330
- if (!el || !el[name]) throw new Error(format('err', "".concat(name, "\u65B9\u6CD5\u4E0D\u5B58\u5728")));
3399
+ if (!el || !el[name]) throw new Error(format('err', "".concat(name, " \u65B9\u6CD5\u4E0D\u5B58\u5728")));
3331
3400
  return function () {
3332
3401
  return el[name].apply(el, arguments);
3333
3402
  };
@@ -3392,6 +3461,11 @@
3392
3461
  findRules(ctx ? ctx.loadChildrenPending() : rule.children);
3393
3462
  return rules;
3394
3463
  },
3464
+ getParentRule: function getParentRule(id) {
3465
+ var flag = _typeof(id) === 'object';
3466
+ var ctx = flag ? byCtx(id) : h.getCtx(id);
3467
+ return ctx.parent.rule;
3468
+ },
3395
3469
  getParentSubRule: function getParentSubRule(id) {
3396
3470
  var flag = _typeof(id) === 'object';
3397
3471
  var ctx = flag ? byCtx(id) : h.getCtx(id);
@@ -3500,8 +3574,8 @@
3500
3574
  getData: function getData(id, def) {
3501
3575
  return h.fc.getLoadData(id, def);
3502
3576
  },
3503
- setData: function setData(id, data) {
3504
- return h.fc.setData(id, data);
3577
+ setData: function setData(id, data, isGlobal) {
3578
+ return h.fc.setData(id, data, isGlobal);
3505
3579
  },
3506
3580
  refreshData: function refreshData(id) {
3507
3581
  return h.fc.refreshData(id);
@@ -3574,16 +3648,6 @@
3574
3648
  });
3575
3649
  }
3576
3650
 
3577
- function toCase(str) {
3578
- var to = str.replace(/(-[a-z])/g, function (v) {
3579
- return v.replace('-', '').toLocaleUpperCase();
3580
- });
3581
- return lower(to);
3582
- }
3583
- function lower(str) {
3584
- return str.replace(str[0], str[0].toLowerCase());
3585
- }
3586
-
3587
3651
  function toString(val) {
3588
3652
  return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
3589
3653
  }
@@ -3742,7 +3806,7 @@
3742
3806
  this.setOptions(ctx);
3743
3807
  this.ctxProp(ctx);
3744
3808
  var prop = ctx.prop;
3745
- prop.preview = !!(prop.preview != null ? prop.preview : this.vm.props.preview !== undefined ? this.vm.props.preview : this.options.preview || false);
3809
+ prop.preview = !!(prop.preview != null ? prop.preview : this.$handle.preview);
3746
3810
  prop.props.formCreateInject = this.injectProp(ctx);
3747
3811
  var cacheFlag = prop.cache !== false;
3748
3812
  var preview = prop.preview;
@@ -3895,7 +3959,10 @@
3895
3959
  id: ctx.id,
3896
3960
  field: ctx.field,
3897
3961
  rule: ctx.rule,
3898
- input: ctx.input
3962
+ input: ctx.input,
3963
+ updateValue: function updateValue(data) {
3964
+ _this6.$handle.onUpdateValue(ctx, data);
3965
+ }
3899
3966
  };
3900
3967
  }
3901
3968
 
@@ -5028,11 +5095,23 @@
5028
5095
  }
5029
5096
  });
5030
5097
  });
5031
- hideLst.length && vue.nextTick(function () {
5032
- hideLst.forEach(function (v) {
5033
- return v();
5034
- });
5035
- });
5098
+
5099
+ if (hideLst.length) {
5100
+ if (this.loading) {
5101
+ hideLst.length && this.bus.$once('load-end', function () {
5102
+ hideLst.forEach(function (v) {
5103
+ return v();
5104
+ });
5105
+ });
5106
+ } else {
5107
+ hideLst.length && vue.nextTick(function () {
5108
+ hideLst.forEach(function (v) {
5109
+ return v();
5110
+ });
5111
+ });
5112
+ }
5113
+ }
5114
+
5036
5115
  this.vm.emit('control', ctx.origin, this.api);
5037
5116
  this.effect(ctx, 'control');
5038
5117
  return flag;
@@ -5211,7 +5290,10 @@
5211
5290
  this.syncValue();
5212
5291
  },
5213
5292
  appendValue: function appendValue(rule) {
5214
- if (!rule.field || !hasProperty(this.appendData, rule.field)) return;
5293
+ if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
5294
+ return;
5295
+ }
5296
+
5215
5297
  rule.value = this.appendData[rule.field];
5216
5298
  delete this.appendData[rule.field];
5217
5299
  },
@@ -5498,121 +5580,135 @@
5498
5580
  }
5499
5581
 
5500
5582
  this.bus.$once('load-end', function () {
5501
- var computed = ctx.rule.computed;
5583
+ var computedRule = ctx.rule.computed;
5502
5584
 
5503
- if (!computed) {
5585
+ if (!computedRule) {
5504
5586
  return;
5505
5587
  }
5506
5588
 
5507
- if (_typeof(computed) !== 'object') {
5508
- computed = {
5509
- value: computed
5589
+ if (_typeof(computedRule) !== 'object') {
5590
+ computedRule = {
5591
+ value: computedRule
5510
5592
  };
5511
5593
  }
5512
5594
 
5513
- Object.keys(computed).forEach(function (k) {
5514
- ctx.watch.push(vue.watch(function () {
5515
- var item = computed[k];
5595
+ Object.keys(computedRule).forEach(function (k) {
5596
+ var computedValue = vue.computed(function () {
5597
+ var item = computedRule[k];
5516
5598
  if (!item) return undefined;
5517
- var fn;
5599
+ return _this.compute(ctx, item);
5600
+ });
5518
5601
 
5519
- if (_typeof(item) === 'object') {
5520
- var group = ctx.getParentGroup();
5602
+ var callback = function callback(n) {
5603
+ if (k === 'value') {
5604
+ _this.onInput(ctx, n);
5605
+ } else if (k[0] === '$') {
5606
+ _this.api.setEffect(ctx.id, k, n);
5607
+ } else {
5608
+ deepSet(ctx.rule, k, n);
5609
+ }
5610
+ };
5521
5611
 
5522
- var checkCondition = function checkCondition(item) {
5523
- item = Array.isArray(item) ? {
5524
- mode: 'AND',
5525
- group: item
5526
- } : item;
5612
+ if (k === 'value' ? [undefined, null, ''].indexOf(ctx.rule.value) > -1 : computedValue.value !== deepGet(ctx.rule, k)) {
5613
+ callback(computedValue.value);
5614
+ }
5527
5615
 
5528
- if (!is.trueArray(item.group)) {
5529
- return true;
5530
- }
5616
+ ctx.watch.push(vue.watch(computedValue, function (n) {
5617
+ setTimeout(function () {
5618
+ callback(n);
5619
+ });
5620
+ }));
5621
+ });
5622
+ });
5623
+ this.watchEffect(ctx);
5624
+ },
5625
+ compute: function compute(ctx, item) {
5626
+ var _this2 = this;
5531
5627
 
5532
- var or = item.mode === 'OR';
5533
- var valid = true;
5628
+ var fn;
5534
5629
 
5535
- for (var i = 0; i < item.group.length; i++) {
5536
- var one = item.group[i];
5537
- var flag = void 0;
5630
+ if (_typeof(item) === 'object') {
5631
+ var group = ctx.getParentGroup();
5538
5632
 
5539
- if (one.mode) {
5540
- flag = checkCondition(one);
5541
- } else if (!condition[one.condition]) {
5542
- flag = false;
5543
- } else {
5544
- flag = new Function('_$', '_$val', '$form', '_group', "with($form){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] || {} : {});
5545
- }
5633
+ var checkCondition = function checkCondition(item) {
5634
+ item = Array.isArray(item) ? {
5635
+ mode: 'AND',
5636
+ group: item
5637
+ } : item;
5546
5638
 
5547
- if (or && flag) {
5548
- return true;
5549
- }
5639
+ if (!is.trueArray(item.group)) {
5640
+ return true;
5641
+ }
5550
5642
 
5551
- if (!or) {
5552
- valid = valid && flag;
5553
- }
5554
- }
5643
+ var or = item.mode === 'OR';
5644
+ var valid = true;
5555
5645
 
5556
- return or ? false : valid;
5557
- };
5646
+ for (var i = 0; i < item.group.length; i++) {
5647
+ var one = item.group[i];
5648
+ var flag = void 0;
5558
5649
 
5559
- return checkCondition(item);
5560
- } else if (is.Function(item)) {
5561
- fn = function fn() {
5562
- return item(_this.api.form, _this.api);
5563
- };
5650
+ if (one.mode) {
5651
+ flag = checkCondition(one);
5652
+ } else if (!condition[one.condition]) {
5653
+ flag = false;
5564
5654
  } else {
5565
- var _group = ctx.getParentGroup();
5655
+ flag = new Function('$condition', '$val', '$form', '$group', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(one.field, ", ").concat(one.compare ? one.compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {});
5656
+ }
5566
5657
 
5567
- fn = function fn() {
5568
- return new Function('_formulas', '$form', '_group', '$rule', '$api', "with($form){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);
5569
- };
5658
+ if (or && flag) {
5659
+ return true;
5570
5660
  }
5571
5661
 
5572
- return invoke(fn, undefined);
5573
- }, function (n) {
5574
- setTimeout(function () {
5575
- if (k === 'value') {
5576
- _this.onInput(ctx, n);
5577
- } else if (k[0] === '$') {
5578
- _this.api.setEffect(ctx.id, k, n);
5579
- } else {
5580
- deepSet(ctx.rule, k, n);
5581
- }
5582
- });
5583
- }, {
5584
- immediate: k === 'value' ? [undefined, null, ''].indexOf(ctx.rule.value) > -1 : true
5585
- }));
5586
- });
5587
- });
5588
- this.watchEffect(ctx);
5662
+ if (!or) {
5663
+ valid = valid && flag;
5664
+ }
5665
+ }
5666
+
5667
+ return or ? false : valid;
5668
+ };
5669
+
5670
+ var val = checkCondition(item);
5671
+ return item.invert === true ? !val : val;
5672
+ } else if (is.Function(item)) {
5673
+ fn = function fn() {
5674
+ return item(_this2.api.form, _this2.api);
5675
+ };
5676
+ } else {
5677
+ var _group = ctx.getParentGroup();
5678
+
5679
+ fn = function fn() {
5680
+ return new Function('$formulas', '$form', '$group', '$rule', '$api', "with($form){with(this){with($group){with($formulas){ return ".concat(item, " }}}}")).call(_this2.api.form, _this2.fc.formulas, _this2.api.top.form, _group ? _this2.subRuleData[_group.id] || {} : {}, ctx.rule, _this2.api);
5681
+ };
5682
+ }
5683
+
5684
+ return invoke(fn, undefined);
5589
5685
  },
5590
5686
  updateChildren: function updateChildren(ctx, n, o) {
5591
- var _this2 = this;
5687
+ var _this3 = this;
5592
5688
 
5593
5689
  this.deferSyncValue(function () {
5594
5690
  o && o.forEach(function (child) {
5595
5691
  if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && child.__fc__.parent === ctx) {
5596
- _this2.rmCtx(child.__fc__);
5692
+ _this3.rmCtx(child.__fc__);
5597
5693
  }
5598
5694
  });
5599
5695
 
5600
5696
  if (is.trueArray(n)) {
5601
- _this2.loadChildren(n, ctx);
5697
+ _this3.loadChildren(n, ctx);
5602
5698
 
5603
- _this2.bus.$emit('update', _this2.api);
5699
+ _this3.bus.$emit('update', _this3.api);
5604
5700
  }
5605
5701
  });
5606
5702
  },
5607
5703
  rmSub: function rmSub(sub) {
5608
- var _this3 = this;
5704
+ var _this4 = this;
5609
5705
 
5610
5706
  is.trueArray(sub) && sub.forEach(function (r) {
5611
- r && r.__fc__ && _this3.rmCtx(r.__fc__);
5707
+ r && r.__fc__ && _this4.rmCtx(r.__fc__);
5612
5708
  });
5613
5709
  },
5614
5710
  rmCtx: function rmCtx(ctx) {
5615
- var _this4 = this;
5711
+ var _this5 = this;
5616
5712
 
5617
5713
  if (ctx.deleted) return;
5618
5714
  var id = ctx.id,
@@ -5641,19 +5737,19 @@
5641
5737
  }
5642
5738
 
5643
5739
  this.deferSyncValue(function () {
5644
- if (!_this4.reloading) {
5740
+ if (!_this5.reloading) {
5645
5741
  if (ctx.parser.loadChildren !== false) {
5646
5742
  var children = ctx.getPending('children', ctx.rule.children);
5647
5743
 
5648
5744
  if (is.trueArray(children)) {
5649
5745
  children.forEach(function (h) {
5650
- return h.__fc__ && _this4.rmCtx(h.__fc__);
5746
+ return h.__fc__ && _this5.rmCtx(h.__fc__);
5651
5747
  });
5652
5748
  }
5653
5749
  }
5654
5750
 
5655
- if (ctx.root === _this4.rules) {
5656
- _this4.vm.setupState.renderRule();
5751
+ if (ctx.root === _this5.rules) {
5752
+ _this5.vm.setupState.renderRule();
5657
5753
  }
5658
5754
  }
5659
5755
  }, input);
@@ -5890,6 +5986,9 @@
5890
5986
  },
5891
5987
  bus: function bus() {
5892
5988
  return fc.bus;
5989
+ },
5990
+ preview: function preview() {
5991
+ return fc.vm.props.preview != null ? fc.vm.props.preview : this.options.preview || false;
5893
5992
  }
5894
5993
  });
5895
5994
  extend(this, {
@@ -5937,7 +6036,7 @@
5937
6036
  });
5938
6037
  },
5939
6038
  init: function init() {
5940
- this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.formData || {}), this.fc.vm.props.modelValue || {}), this.appendData);
6039
+ this.updateAppendData();
5941
6040
  this.useProvider();
5942
6041
  this.usePage();
5943
6042
  this.loadRule();
@@ -5946,6 +6045,9 @@
5946
6045
 
5947
6046
  this.lifecycle('created');
5948
6047
  },
6048
+ updateAppendData: function updateAppendData() {
6049
+ this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.formData || {}), this.fc.vm.props.modelValue || {}), this.appendData);
6050
+ },
5949
6051
  isBreakWatch: function isBreakWatch() {
5950
6052
  return this.loading || this.noWatchFn || this.reloading;
5951
6053
  },
@@ -6226,13 +6328,21 @@
6226
6328
  var componentValidate = {
6227
6329
  name: 'componentValidate',
6228
6330
  load: function load(attr, rule, api) {
6229
- var method = attr.getValue();
6331
+ var options = attr.getValue();
6230
6332
 
6231
- if (!method) {
6333
+ if (!options || options.method === false) {
6232
6334
  attr.clearProp();
6233
6335
  api.clearValidateState([rule.field]);
6234
6336
  } else {
6235
- attr.getProp().validate = [{
6337
+ if (!is.Object(options)) {
6338
+ options = {
6339
+ method: options
6340
+ };
6341
+ }
6342
+
6343
+ var method = options.method;
6344
+ delete options.method;
6345
+ attr.getProp().validate = [_objectSpread2(_objectSpread2({}, options), {}, {
6236
6346
  validator: function validator() {
6237
6347
  var ctx = byCtx(rule);
6238
6348
 
@@ -6241,14 +6351,14 @@
6241
6351
  args[_key] = arguments[_key];
6242
6352
  }
6243
6353
 
6244
- return api.exec.apply(api, [ctx.id, method === true ? 'formCreateValidate' : method].concat(args, [{
6354
+ return api.exec.apply(api, [ctx.id, is.String(method) ? method : 'formCreateValidate'].concat(args, [{
6245
6355
  attr: attr,
6246
6356
  rule: rule,
6247
6357
  api: api
6248
6358
  }]));
6249
6359
  }
6250
6360
  }
6251
- }];
6361
+ })];
6252
6362
  }
6253
6363
  },
6254
6364
  watch: function watch() {
@@ -6579,7 +6689,7 @@
6579
6689
 
6580
6690
  function register() {
6581
6691
  var data = nameProp.apply(void 0, arguments);
6582
- if (data.id && data.prop) providers[data.id] = _objectSpread2(_objectSpread2({}, data.prop), {}, {
6692
+ if (data.id && data.prop) providers[data.id] = is.Function(data.prop) ? data.prop : _objectSpread2(_objectSpread2({}, data.prop), {}, {
6583
6693
  name: data.id
6584
6694
  });
6585
6695
  }
@@ -6725,8 +6835,8 @@
6725
6835
  }
6726
6836
  }
6727
6837
 
6728
- function setData(id, data) {
6729
- loadData[id] = data;
6838
+ function _setData(id, data) {
6839
+ deepSet(loadData, id, data);
6730
6840
  refreshData(id);
6731
6841
  }
6732
6842
 
@@ -6742,7 +6852,8 @@
6742
6852
  };
6743
6853
 
6744
6854
  callback._driver = true;
6745
- setData(id, callback);
6855
+
6856
+ _setData(id, callback);
6746
6857
  }
6747
6858
 
6748
6859
  function getData(id, def) {
@@ -6803,8 +6914,6 @@
6803
6914
  },
6804
6915
  drivers: drivers,
6805
6916
  renderDriver: null,
6806
- setData: setData,
6807
- getData: getData,
6808
6917
  refreshData: refreshData,
6809
6918
  loadData: loadData,
6810
6919
  CreateNode: CreateNode,
@@ -6812,7 +6921,8 @@
6812
6921
  unwatch: [],
6813
6922
  options: vue.ref({}),
6814
6923
  extendApiFn: extendApiFn,
6815
- fetchCache: new WeakMap()
6924
+ fetchCache: new WeakMap(),
6925
+ tmpData: {}
6816
6926
  });
6817
6927
  listener.forEach(function (item) {
6818
6928
  _this.bus.$on(item.name, item.callback);
@@ -6987,6 +7097,8 @@
6987
7097
  unwatch();
6988
7098
 
6989
7099
  _this5.bus.$emit('$loadData.$var.' + key);
7100
+
7101
+ return val;
6990
7102
  }
6991
7103
 
6992
7104
  val = invoke(function () {
@@ -6998,6 +7110,14 @@
6998
7110
  }
6999
7111
  }
7000
7112
  },
7113
+ setData: function setData(id, data, isGlobal) {
7114
+ if (!isGlobal) {
7115
+ deepSet(this.vm.setupState.top.setupState.fc.tmpData, id, data);
7116
+ this.bus.$emit('$loadData.' + id);
7117
+ } else {
7118
+ _setData(id, data);
7119
+ }
7120
+ },
7001
7121
  getLoadData: function getLoadData(id, def) {
7002
7122
  var val = null;
7003
7123
 
@@ -7018,11 +7138,12 @@
7018
7138
  val = this.globalVarDriver(split.join('.'));
7019
7139
  split = [];
7020
7140
  } else {
7021
- val = getData(id, def);
7141
+ var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
7142
+ val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(key);
7022
7143
  split = [];
7023
7144
  }
7024
7145
 
7025
- if (split.length) {
7146
+ if (val && split.length) {
7026
7147
  val = deepGet(val, split);
7027
7148
  }
7028
7149
  }
@@ -7158,6 +7279,7 @@
7158
7279
  listener.forEach(function (item) {
7159
7280
  _this7.bus.$off(item.name, item.callback);
7160
7281
  });
7282
+ this.tmpData = {};
7161
7283
  this.unwatch.forEach(function (fn) {
7162
7284
  return fn();
7163
7285
  });
@@ -7180,7 +7302,7 @@
7180
7302
  extendApi: extendApi,
7181
7303
  getData: getData,
7182
7304
  setDataDriver: setDataDriver,
7183
- setData: setData,
7305
+ setData: _setData,
7184
7306
  removeData: removeData,
7185
7307
  refreshData: refreshData,
7186
7308
  maker: maker,
@@ -7598,7 +7720,7 @@
7598
7720
  e.preventDefault();
7599
7721
  }
7600
7722
  },
7601
- "class": [form.className, form["class"], 'form-create', this.options.preview ? 'is-preview' : ''],
7723
+ "class": [form.className, form["class"], 'form-create', this.$handle.preview ? 'is-preview' : ''],
7602
7724
  style: form.style,
7603
7725
  type: 'form'
7604
7726
  };
@@ -7618,7 +7740,7 @@
7618
7740
  render: function render(children) {
7619
7741
  var _this2 = this;
7620
7742
 
7621
- if (children.slotLen() && !this.options.preview) {
7743
+ if (children.slotLen() && !this.$handle.preview) {
7622
7744
  children.setSlot(undefined, function () {
7623
7745
  return _this2.makeFormBtn();
7624
7746
  });
@@ -7632,11 +7754,12 @@
7632
7754
  var rule = ctx.prop;
7633
7755
  var uni = "".concat(this.key).concat(ctx.key);
7634
7756
  var col = rule.col;
7635
- var isTitle = this.isTitle(rule);
7757
+ var isTitle = this.isTitle(rule) && rule.wrap.title !== false;
7636
7758
  var labelWidth = !col.labelWidth && !isTitle ? 0 : col.labelWidth;
7637
7759
  var _this$rule$props = this.rule.props,
7638
7760
  inline = _this$rule$props.inline,
7639
7761
  _col = _this$rule$props.col;
7762
+ delete rule.wrap.title;
7640
7763
  var item = isFalse(rule.wrap.show) ? children : this.$r(mergeProps([rule.wrap, {
7641
7764
  props: _objectSpread2(_objectSpread2({
7642
7765
  labelWidth: labelWidth === void 0 ? labelWidth : toString(labelWidth),
@@ -8160,7 +8283,7 @@
8160
8283
  function elmFormCreate() {
8161
8284
  return FormCreateFactory({
8162
8285
  ui: 'element-ui',
8163
- version: '3.2.7',
8286
+ version: '3.2.9',
8164
8287
  manager: manager,
8165
8288
  extendApi: extendApi,
8166
8289
  install: install,