@form-create/element-ui 2.5.8 → 2.5.12

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 v2.5.8
2
+ * @form-create/element-ui v2.5.12
3
3
  * (c) 2018-2021 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -255,17 +255,9 @@
255
255
  var Checkbox = {
256
256
  name: NAME,
257
257
  props: {
258
- formCreateRule: {
258
+ formCreateInject: {
259
259
  type: Object,
260
- "default": function _default() {
261
- return {};
262
- }
263
- },
264
- formCreateOptions: {
265
- type: Array,
266
- "default": function _default() {
267
- return [];
268
- }
260
+ required: true
269
261
  },
270
262
  value: {
271
263
  type: Array,
@@ -285,9 +277,15 @@
285
277
  trueValue: []
286
278
  };
287
279
  },
280
+ computed: {
281
+ options: function options() {
282
+ var opt = this.formCreateInject.options;
283
+ return Array.isArray(opt) ? opt : [];
284
+ }
285
+ },
288
286
  methods: {
289
287
  onInput: function onInput(n) {
290
- this.$emit('input', this.formCreateOptions.filter(function (opt) {
288
+ this.$emit('input', this.options.filter(function (opt) {
291
289
  return n.indexOf(opt.label) !== -1;
292
290
  }).map(function (opt) {
293
291
  return opt.value;
@@ -298,7 +296,7 @@
298
296
  update: function update() {
299
297
  var _this = this;
300
298
 
301
- this.trueValue = this.value ? this.formCreateOptions.filter(function (opt) {
299
+ this.trueValue = this.value ? this.options.filter(function (opt) {
302
300
  return _this.value.indexOf(opt.value) !== -1;
303
301
  }).map(function (option) {
304
302
  return option.label;
@@ -312,14 +310,14 @@
312
310
  var _this2 = this;
313
311
 
314
312
  var h = arguments[0];
315
- return h("ElCheckboxGroup", helper([{}, this.formCreateRule, {
313
+ return h("ElCheckboxGroup", helper([{}, this.formCreateInject.prop, {
316
314
  "attrs": {
317
315
  "value": this.trueValue
318
316
  },
319
317
  "on": {
320
318
  "input": this.onInput
321
319
  }
322
- }]), [this.formCreateOptions.map(function (opt, index) {
320
+ }]), [this.options.map(function (opt, index) {
323
321
  var props = _objectSpread2({}, opt);
324
322
 
325
323
  var Type = _this2.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
@@ -372,7 +370,10 @@
372
370
  var Frame = {
373
371
  name: NAME$1,
374
372
  props: {
375
- formCreateField: String,
373
+ formCreateInject: {
374
+ type: Object,
375
+ required: true
376
+ },
376
377
  type: {
377
378
  type: String,
378
379
  "default": 'input'
@@ -584,7 +585,7 @@
584
585
  }, _toConsumableArray(children));
585
586
  },
586
587
  valid: function valid(f) {
587
- var field = this.formCreateField || this.field;
588
+ var field = this.formCreateInject.field || this.field;
588
589
 
589
590
  if (field && f !== field) {
590
591
  throw new Error('[frame]无效的字段值');
@@ -682,10 +683,6 @@
682
683
  })]);
683
684
  },
684
685
  handleClick: function handleClick(src) {
685
- if (this.disabled) {
686
- return;
687
- }
688
-
689
686
  return this.onHandle(src);
690
687
  },
691
688
  handleRemove: function handleRemove(src) {
@@ -856,17 +853,9 @@
856
853
  var Radio = {
857
854
  name: NAME$2,
858
855
  props: {
859
- formCreateRule: {
856
+ formCreateInject: {
860
857
  type: Object,
861
- "default": function _default() {
862
- return {};
863
- }
864
- },
865
- formCreateOptions: {
866
- type: Array,
867
- "default": function _default() {
868
- return [];
869
- }
858
+ required: true
870
859
  },
871
860
  value: {},
872
861
  type: String
@@ -881,9 +870,15 @@
881
870
  trueValue: []
882
871
  };
883
872
  },
873
+ computed: {
874
+ options: function options() {
875
+ var opt = this.formCreateInject.options;
876
+ return Array.isArray(opt) ? opt : [];
877
+ }
878
+ },
884
879
  methods: {
885
880
  onInput: function onInput(n) {
886
- this.$emit('input', this.formCreateOptions.filter(function (opt) {
881
+ this.$emit('input', this.options.filter(function (opt) {
887
882
  return opt.label === n;
888
883
  }).reduce(function (initial, opt) {
889
884
  return opt.value;
@@ -892,7 +887,7 @@
892
887
  update: function update() {
893
888
  var _this = this;
894
889
 
895
- this.trueValue = this.formCreateOptions.filter(function (opt) {
890
+ this.trueValue = this.options.filter(function (opt) {
896
891
  return opt.value === _this.value;
897
892
  }).reduce(function (initial, opt) {
898
893
  return opt.label;
@@ -906,14 +901,14 @@
906
901
  var _this2 = this;
907
902
 
908
903
  var h = arguments[0];
909
- return h("ElRadioGroup", helper([{}, this.formCreateRule, {
904
+ return h("ElRadioGroup", helper([{}, this.formCreateInject.prop, {
910
905
  "attrs": {
911
906
  "value": this.trueValue
912
907
  },
913
908
  "on": {
914
909
  "input": this.onInput
915
910
  }
916
- }]), [this.formCreateOptions.map(function (opt, index) {
911
+ }]), [this.options.map(function (opt, index) {
917
912
  var props = _objectSpread2({}, opt);
918
913
 
919
914
  var Type = _this2.type === 'button' ? 'ElRadioButton' : 'ElRadio';
@@ -954,15 +949,14 @@
954
949
  name: NAME$3,
955
950
  functional: true,
956
951
  props: {
957
- formCreateOptions: {
958
- type: Array,
959
- "default": function _default() {
960
- return [];
961
- }
952
+ formCreateInject: {
953
+ type: Object,
954
+ required: true
962
955
  }
963
956
  },
964
957
  render: function render(h, ctx) {
965
- return h("ElSelect", helper([{}, ctx.data]), [ctx.props.formCreateOptions.map(function (props, index) {
958
+ var options = ctx.props.formCreateInject.options;
959
+ return h("ElSelect", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
966
960
  var slot = props.slot;
967
961
  return h("ElOption", {
968
962
  "props": _objectSpread2({}, props),
@@ -987,13 +981,9 @@
987
981
  }
988
982
  },
989
983
  props: {
990
- formCreateRule: {
984
+ formCreateInject: {
991
985
  type: Object,
992
- "default": function _default() {
993
- return {
994
- props: {}
995
- };
996
- }
986
+ required: true
997
987
  },
998
988
  type: {
999
989
  type: String,
@@ -1042,10 +1032,10 @@
1042
1032
  var _this = this;
1043
1033
 
1044
1034
  var h = arguments[0];
1045
- return h("ElTree", helper([{}, this.formCreateRule, {
1035
+ return h("ElTree", helper([{}, this.formCreateInject.prop, {
1046
1036
  "ref": "tree",
1047
1037
  "on": {
1048
- "check-change": function checkChange() {
1038
+ "check": function check() {
1049
1039
  return _this.updateValue();
1050
1040
  },
1051
1041
  "node-click": function nodeClick() {
@@ -1056,7 +1046,6 @@
1056
1046
  },
1057
1047
  mounted: function mounted() {
1058
1048
  this.setValue();
1059
- this.updateValue();
1060
1049
  }
1061
1050
  };
1062
1051
 
@@ -1079,13 +1068,9 @@
1079
1068
  var Upload = {
1080
1069
  name: NAME$5,
1081
1070
  props: {
1082
- formCreateRule: {
1071
+ formCreateInject: {
1083
1072
  type: Object,
1084
- "default": function _default() {
1085
- return {
1086
- props: {}
1087
- };
1088
- }
1073
+ required: true
1089
1074
  },
1090
1075
  onHandle: {
1091
1076
  type: Function,
@@ -1124,11 +1109,11 @@
1124
1109
  };
1125
1110
  },
1126
1111
  created: function created() {
1127
- if (this.formCreateRule.props.showFileList === undefined) {
1128
- this.formCreateRule.props.showFileList = false;
1112
+ if (this.formCreateInject.prop.props.showFileList === undefined) {
1113
+ this.formCreateInject.prop.props.showFileList = false;
1129
1114
  }
1130
1115
 
1131
- this.formCreateRule.props.fileList = toArray(this.value).map(parseFile);
1116
+ this.formCreateInject.prop.props.fileList = toArray(this.value).map(parseFile);
1132
1117
  },
1133
1118
  watch: {
1134
1119
  value: function value(n) {
@@ -1150,7 +1135,7 @@
1150
1135
  return unique;
1151
1136
  },
1152
1137
  isDisabled: function isDisabled() {
1153
- return this.formCreateRule.props.disabled === true;
1138
+ return this.formCreateInject.prop.props.disabled === true;
1154
1139
  },
1155
1140
  onRemove: function onRemove(file) {
1156
1141
  if (this.isDisabled()) {
@@ -1160,10 +1145,6 @@
1160
1145
  this.$refs.upload.handleRemove(file);
1161
1146
  },
1162
1147
  handleClick: function handleClick(file) {
1163
- if (this.isDisabled()) {
1164
- return;
1165
- }
1166
-
1167
1148
  this.onHandle(file);
1168
1149
  },
1169
1150
  makeItem: function makeItem(file, index) {
@@ -1255,7 +1236,7 @@
1255
1236
  makeUpload: function makeUpload() {
1256
1237
  var h = this.$createElement;
1257
1238
  var isShow = !this.limit || this.limit > this.uploadList.length;
1258
- return h("ElUpload", helper([{}, this.formCreateRule, {
1239
+ return h("ElUpload", helper([{}, this.formCreateInject.prop, {
1259
1240
  "ref": "upload",
1260
1241
  "style": {
1261
1242
  display: 'inline-block'
@@ -1285,16 +1266,16 @@
1285
1266
  var h = arguments[0];
1286
1267
 
1287
1268
  if (this.$refs.upload) {
1288
- if (this.formCreateRule.props.showFileList === undefined) {
1289
- this.formCreateRule.props.showFileList = this.$refs.upload.showFileList;
1269
+ if (this.formCreateInject.prop.props.showFileList === undefined) {
1270
+ this.formCreateInject.prop.props.showFileList = this.$refs.upload.showFileList;
1290
1271
  }
1291
1272
 
1292
- this.formCreateRule.props.fileList = this.$refs.upload.fileList;
1273
+ this.formCreateInject.prop.props.fileList = this.$refs.upload.fileList;
1293
1274
  }
1294
1275
 
1295
1276
  return h("div", {
1296
1277
  "class": '_fc-upload'
1297
- }, [[this.formCreateRule.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], h("el-dialog", {
1278
+ }, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], h("el-dialog", {
1298
1279
  "attrs": {
1299
1280
  "appendToBody": true,
1300
1281
  "modal": this.previewMask,
@@ -1335,7 +1316,10 @@
1335
1316
  rules: Array,
1336
1317
  expand: Number,
1337
1318
  options: Object,
1338
- formCreate: Object,
1319
+ formCreateInject: {
1320
+ type: Object,
1321
+ required: true
1322
+ },
1339
1323
  button: {
1340
1324
  type: Boolean,
1341
1325
  "default": true
@@ -1379,7 +1363,8 @@
1379
1363
  return {
1380
1364
  len: 0,
1381
1365
  cacheRule: {},
1382
- cacheValue: {}
1366
+ cacheValue: {},
1367
+ type: undefined
1383
1368
  };
1384
1369
  },
1385
1370
  computed: {
@@ -1493,7 +1478,7 @@
1493
1478
  addRule: function addRule(i, emit) {
1494
1479
  var _this3 = this;
1495
1480
 
1496
- var rule = this.$formCreate.copyRules(this.formRule);
1481
+ var rule = this.formCreateInject.form.copyRules(this.formRule);
1497
1482
  var options = this.options ? _objectSpread2({}, this.options) : {
1498
1483
  submitBtn: false,
1499
1484
  resetBtn: false
@@ -1526,7 +1511,7 @@
1526
1511
  subForm: function subForm() {
1527
1512
  var _this5 = this;
1528
1513
 
1529
- this.$emit('fc.sub-form', Object.keys(this.cacheRule).map(function (k) {
1514
+ this.formCreateInject.subForm(Object.keys(this.cacheRule).map(function (k) {
1530
1515
  return _this5.cacheRule[k].$f;
1531
1516
  }));
1532
1517
  },
@@ -1551,7 +1536,7 @@
1551
1536
  this.addRule(i, true);
1552
1537
  },
1553
1538
  del: function del(index, key) {
1554
- if (this.disabled || false === this.onBeforeRemove(this.value)) {
1539
+ if (this.disabled || false === this.onBeforeRemove(this.value, index)) {
1555
1540
  return;
1556
1541
  }
1557
1542
 
@@ -1620,6 +1605,7 @@
1620
1605
  }
1621
1606
  },
1622
1607
  created: function created() {
1608
+ this.type = this.formCreateInject.form.$form();
1623
1609
  var d = (this.expand || 0) - this.value.length;
1624
1610
 
1625
1611
  if (d > 0) {
@@ -1636,6 +1622,7 @@
1636
1622
  var h = arguments[0];
1637
1623
  var keys = Object.keys(this.cacheRule);
1638
1624
  var button = this.button;
1625
+ var Type = this.type;
1639
1626
  return keys.length === 0 ? this.$scopedSlots["default"] ? this.$scopedSlots["default"]({
1640
1627
  vm: this,
1641
1628
  add: this.add
@@ -1663,7 +1650,7 @@
1663
1650
  "attrs": {
1664
1651
  "span": button ? 20 : 24
1665
1652
  }
1666
- }, [h("ElFormItem", [h("FormCreate", helper([{
1653
+ }, [h("ElFormItem", [h(Type, helper([{
1667
1654
  "key": key
1668
1655
  }, {
1669
1656
  "on": {
@@ -1704,7 +1691,10 @@
1704
1691
  props: {
1705
1692
  rule: Array,
1706
1693
  options: Object,
1707
- formCreate: Object,
1694
+ formCreateInject: {
1695
+ type: Object,
1696
+ required: true
1697
+ },
1708
1698
  value: {
1709
1699
  type: Object,
1710
1700
  "default": function _default() {
@@ -1714,17 +1704,22 @@
1714
1704
  disabled: {
1715
1705
  type: Boolean,
1716
1706
  "default": false
1707
+ },
1708
+ syncDisabled: {
1709
+ type: Boolean,
1710
+ "default": true
1717
1711
  }
1718
1712
  },
1719
1713
  data: function data() {
1720
1714
  return {
1721
1715
  cacheRule: {},
1722
- cacheValue: {}
1716
+ cacheValue: {},
1717
+ type: undefined
1723
1718
  };
1724
1719
  },
1725
1720
  watch: {
1726
1721
  disabled: function disabled(n) {
1727
- this.cacheRule.$f.disabled(n);
1722
+ this.syncDisabled && this.cacheRule.$f.disabled(n);
1728
1723
  },
1729
1724
  value: function value(n) {
1730
1725
  this.setValue(n);
@@ -1763,13 +1758,13 @@
1763
1758
  this.cacheRule.$f = $f;
1764
1759
  this.subForm();
1765
1760
  this.$nextTick(function () {
1766
- $f.disabled(_this.disabled);
1761
+ _this.syncDisabled && $f.disabled(_this.disabled);
1767
1762
 
1768
1763
  _this.$emit('itemMounted', $f);
1769
1764
  });
1770
1765
  },
1771
1766
  subForm: function subForm() {
1772
- this.$emit('fc.sub-form', this.cacheRule.$f);
1767
+ this.formCreateInject.subForm(this.cacheRule.$f);
1773
1768
  },
1774
1769
  emitEvent: function emitEvent(name) {
1775
1770
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -1781,13 +1776,15 @@
1781
1776
  },
1782
1777
  created: function created() {
1783
1778
  this.addRule();
1779
+ this.type = this.formCreateInject.form.$form();
1784
1780
  },
1785
1781
  render: function render() {
1786
1782
  var h = arguments[0];
1787
1783
  var _this$cacheRule = this.cacheRule,
1788
1784
  rule = _this$cacheRule.rule,
1789
1785
  options = _this$cacheRule.options;
1790
- return h("FormCreate", helper([{}, {
1786
+ var Type = this.type;
1787
+ return h(Type, helper([{}, {
1791
1788
  "on": {
1792
1789
  'update:value': this.formData,
1793
1790
  'emit-event': this.emitEvent,
@@ -1868,6 +1865,7 @@
1868
1865
  isShow: true,
1869
1866
  unique: 1,
1870
1867
  renderRule: _toConsumableArray(this.rule || []),
1868
+ ctxInject: {},
1871
1869
  updateValue: ''
1872
1870
  };
1873
1871
  },
@@ -1918,10 +1916,8 @@
1918
1916
 
1919
1917
  var _this$$options$propsD = this.$options.propsData,
1920
1918
  rule = _this$$options$propsD.rule,
1921
- option = _this$$options$propsD.option,
1922
- value = _this$$options$propsD.value;
1919
+ option = _this$$options$propsD.option;
1923
1920
  this.formCreate = new FormCreate(this, rule, option);
1924
- extend(this.formCreate.options.formData, value || {});
1925
1921
  Object.keys(this.formCreate.prop).forEach(function (k) {
1926
1922
  extend(_this2.$options[k], _this2.formCreate.prop[k]);
1927
1923
  });
@@ -2000,7 +1996,7 @@
2000
1996
 
2001
1997
  var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'nativeEmit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key'];
2002
1998
  var arrayAttrs = ['validate', 'children', 'control'];
2003
- var normalAttrs = ['effect'];
1999
+ var normalAttrs = ['effect', 'deep'];
2004
2000
  function attrs() {
2005
2001
  return [].concat(keyAttrs, _toConsumableArray(normalMerge$1), _toConsumableArray(toArrayMerge$1), _toConsumableArray(functionalMerge$1), arrayAttrs, normalAttrs);
2006
2002
  }
@@ -2033,6 +2029,12 @@
2033
2029
  }
2034
2030
 
2035
2031
  origin[key] = deepExtend(origin[key], clone, mode);
2032
+ } else if (is.Undef(clone)) {
2033
+ $set(origin, key, clone);
2034
+ } else if (clone.__json !== undefined) {
2035
+ $set(origin, key, clone.__json);
2036
+ } else if (clone.__origin !== undefined) {
2037
+ $set(origin, key, clone.__origin);
2036
2038
  } else {
2037
2039
  $set(origin, key, clone);
2038
2040
  }
@@ -2066,6 +2068,7 @@
2066
2068
  var PREFIX = '[[FORM-CREATE-PREFIX-';
2067
2069
  var SUFFIX = '-FORM-CREATE-SUFFIX]]';
2068
2070
  var $T = '$FN:';
2071
+ var $TX = '$FNX:';
2069
2072
  var FUNCTION = 'function';
2070
2073
  function toJson(obj, space) {
2071
2074
  return JSON.stringify(deepExtend([], obj, true), function (key, val) {
@@ -2075,7 +2078,11 @@
2075
2078
  return val;
2076
2079
  }
2077
2080
 
2078
- if (val.__inject) val = val.__origin;
2081
+ if (hasProperty(val, '__json')) {
2082
+ return val.__json;
2083
+ }
2084
+
2085
+ if (val.__origin) val = val.__origin;
2079
2086
  if (val.__emit) return undefined;
2080
2087
  return PREFIX + val + SUFFIX;
2081
2088
  }, space);
@@ -2086,26 +2093,32 @@
2086
2093
  }
2087
2094
 
2088
2095
  function parseFn(fn, mode) {
2089
- if (fn && is.String(fn)) {
2096
+ if (fn && is.String(fn) && fn.length > 4) {
2090
2097
  var v = fn.trim();
2091
2098
  var flag = false;
2092
2099
 
2093
- if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
2094
- v = v.replace(SUFFIX, '').replace(PREFIX, '');
2095
- flag = true;
2096
- } else if (v.indexOf($T) === 0) {
2097
- v = v.replace($T, '');
2098
- flag = true;
2099
- } else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
2100
- flag = true;
2101
- }
2102
-
2103
- if (!flag) return fn;
2104
-
2105
2100
  try {
2106
- return makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
2101
+ if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
2102
+ v = v.replace(SUFFIX, '').replace(PREFIX, '');
2103
+ flag = true;
2104
+ } else if (v.indexOf($T) === 0) {
2105
+ v = v.replace($T, '');
2106
+ flag = true;
2107
+ } else if (v.indexOf($TX) === 0) {
2108
+ v = makeFn('function($inject){' + v.replace($TX, '') + '}');
2109
+ v.__json = fn;
2110
+ v.__inject = true;
2111
+ return v;
2112
+ } else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
2113
+ flag = true;
2114
+ }
2115
+
2116
+ if (!flag) return fn;
2117
+ var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
2118
+ val.__json = fn;
2119
+ return val;
2107
2120
  } catch (e) {
2108
- err("\u89E3\u6790\u5931\u8D25:".concat(v));
2121
+ err("\u89E3\u6790\u5931\u8D25:".concat(v, "\n\nerr: ").concat(e));
2109
2122
  return undefined;
2110
2123
  }
2111
2124
  }
@@ -2118,6 +2131,7 @@
2118
2131
  return parseFn(v, mode);
2119
2132
  });
2120
2133
  }
2134
+
2121
2135
  function enumerable(value, writable) {
2122
2136
  return {
2123
2137
  value: value,
@@ -2195,7 +2209,7 @@
2195
2209
  to;
2196
2210
  (idx || '').split('.').forEach(function (v) {
2197
2211
  if (to) {
2198
- if (!_data[to]) {
2212
+ if (!_data[to] || _typeof(_data[to]) != 'object') {
2199
2213
  _data[to] = {};
2200
2214
  }
2201
2215
 
@@ -2293,13 +2307,6 @@
2293
2307
  return deepCopy(value);
2294
2308
  }
2295
2309
 
2296
- function byRules(ctxs, origin) {
2297
- return Object.keys(ctxs).reduce(function (initial, key) {
2298
- initial[key] = origin ? ctxs[key].origin : ctxs[key].rule;
2299
- return initial;
2300
- }, {});
2301
- }
2302
-
2303
2310
  function Api(h) {
2304
2311
  function tidyFields(fields) {
2305
2312
  if (is.Undef(fields)) fields = h.fields();else if (!Array.isArray(fields)) fields = [fields];
@@ -2308,10 +2315,10 @@
2308
2315
 
2309
2316
  function props(fields, key, val) {
2310
2317
  tidyFields(fields).forEach(function (field) {
2311
- var ctx = h.getCtx(field);
2312
- if (!ctx) return;
2313
- $set(ctx.rule, key, val);
2314
- h.$render.clearCache(ctx);
2318
+ h.getCtxs(field).forEach(function (ctx) {
2319
+ $set(ctx.rule, key, val);
2320
+ h.$render.clearCache(ctx);
2321
+ });
2315
2322
  });
2316
2323
  }
2317
2324
 
@@ -2357,23 +2364,26 @@
2357
2364
 
2358
2365
  formData: function formData(fields) {
2359
2366
  return tidyFields(fields).reduce(function (initial, id) {
2360
- var ctx = h.fieldCtx[id];
2367
+ var ctx = h.getFieldCtx(id);
2361
2368
  if (!ctx) return initial;
2362
2369
  initial[ctx.field] = copy(ctx.rule.value);
2363
2370
  return initial;
2364
- }, {});
2371
+ }, copy(h.appendData));
2365
2372
  },
2366
2373
  getValue: function getValue(field) {
2367
- var ctx = h.fieldCtx[field];
2374
+ var ctx = h.getFieldCtx(field);
2368
2375
  if (!ctx) return;
2369
2376
  return copy(ctx.rule.value);
2370
2377
  },
2371
2378
  coverValue: function coverValue(formData) {
2372
2379
  h.deferSyncValue(function () {
2373
- Object.keys(h.fieldCtx).forEach(function (key) {
2374
- var ctx = h.fieldCtx[key];
2375
- if (!ctx) return h.appendData[key] = formData[key];
2376
- ctx.rule.value = hasProperty(formData, key) ? formData[key] : undefined;
2380
+ api.fields().forEach(function (key) {
2381
+ var ctxs = h.fieldCtx[key];
2382
+ if (!ctxs) return h.appendData[key] = formData[key];
2383
+ var flag = hasProperty(formData, key);
2384
+ ctxs.forEach(function (ctx) {
2385
+ ctx.rule.value = flag ? formData[key] : undefined;
2386
+ });
2377
2387
  });
2378
2388
  });
2379
2389
  },
@@ -2382,17 +2392,22 @@
2382
2392
  if (arguments.length >= 2) formData = _defineProperty({}, field, arguments[1]);
2383
2393
  h.deferSyncValue(function () {
2384
2394
  Object.keys(formData).forEach(function (key) {
2385
- var ctx = h.fieldCtx[key];
2386
- if (!ctx) return h.appendData[key] = formData[key];
2387
- ctx.rule.value = formData[key];
2395
+ var ctxs = h.fieldCtx[key];
2396
+ if (!ctxs) return h.appendData[key] = formData[key];
2397
+ ctxs.forEach(function (ctx) {
2398
+ ctx.rule.value = formData[key];
2399
+ });
2388
2400
  });
2389
2401
  });
2390
2402
  },
2391
2403
  removeField: function removeField(field) {
2392
2404
  var ctx = h.getCtx(field);
2393
- if (!ctx) return;
2394
- ctx.rm();
2395
- return ctx.origin;
2405
+ h.deferSyncValue(function () {
2406
+ h.getCtxs(field).forEach(function (ctx) {
2407
+ ctx.rm();
2408
+ });
2409
+ }, true);
2410
+ return ctx ? ctx.origin : undefined;
2396
2411
  },
2397
2412
  removeRule: function removeRule(rule) {
2398
2413
  var ctx = rule && byCtx(rule);
@@ -2408,10 +2423,8 @@
2408
2423
  return h.fields();
2409
2424
  },
2410
2425
  append: function append(rule, after, child) {
2411
- var fields = Object.keys(h.fieldCtx),
2412
- index = h.sort.length - 1,
2426
+ var index = h.sort.length - 1,
2413
2427
  rules;
2414
- if (rule.field && fields.indexOf(rule.field) > -1) return err("".concat(rule.field, " \u5B57\u6BB5\u5DF2\u5B58\u5728"), rule);
2415
2428
  var ctx = h.getCtx(after);
2416
2429
 
2417
2430
  if (ctx) {
@@ -2427,10 +2440,8 @@
2427
2440
  rules.splice(index + 1, 0, rule);
2428
2441
  },
2429
2442
  prepend: function prepend(rule, after, child) {
2430
- var fields = Object.keys(h.fieldCtx),
2431
- index = 0,
2443
+ var index = 0,
2432
2444
  rules;
2433
- if (rule.field && fields.indexOf(rule.field) > -1) return err("".concat(rule.field, " \u5B57\u6BB5\u5DF2\u5B58\u5728"), rule);
2434
2445
  var ctx = h.getCtx(after);
2435
2446
 
2436
2447
  if (ctx) {
@@ -2464,17 +2475,27 @@
2464
2475
  },
2465
2476
  disabled: function disabled(_disabled, fields) {
2466
2477
  tidyFields(fields).forEach(function (field) {
2467
- var ctx = h.fieldCtx[field];
2468
- if (!ctx) return;
2469
- $set(ctx.rule.props, 'disabled', !!_disabled);
2478
+ h.getCtxs(field).forEach(function (ctx) {
2479
+ $set(ctx.rule.props, 'disabled', !!_disabled);
2480
+ });
2470
2481
  });
2471
2482
  h.refresh();
2472
2483
  },
2473
2484
  model: function model(origin) {
2474
- return byRules(h.fieldCtx, origin);
2485
+ return h.fields().reduce(function (initial, key) {
2486
+ var ctx = h.fieldCtx[key][0];
2487
+ initial[key] = origin ? ctx.origin : ctx.rule;
2488
+ return initial;
2489
+ }, {});
2475
2490
  },
2476
2491
  component: function component(origin) {
2477
- return byRules(h.nameCtx, origin);
2492
+ return Object.keys(h.nameCtx).reduce(function (initial, key) {
2493
+ var ctx = h.nameCtx[key].map(function (ctx) {
2494
+ return origin ? ctx.origin : ctx.rule;
2495
+ });
2496
+ initial[key] = ctx.length === 1 ? ctx[0] : ctx;
2497
+ return initial;
2498
+ }, {});
2478
2499
  },
2479
2500
  bind: function bind() {
2480
2501
  return api.form;
@@ -2492,25 +2513,39 @@
2492
2513
  });
2493
2514
  },
2494
2515
  sync: function sync(field) {
2495
- var ctx = is.Object(field) ? byCtx(field) : h.getCtx(field);
2516
+ if (Array.isArray(field)) {
2517
+ field.forEach(function (v) {
2518
+ return api.sync(v);
2519
+ });
2520
+ return;
2521
+ }
2496
2522
 
2497
- if (ctx && !ctx.deleted) {
2498
- var subForm = h.subForm[field];
2523
+ var ctxs = is.Object(field) ? byCtx(field) : h.getCtxs(field);
2499
2524
 
2500
- if (subForm) {
2501
- if (Array.isArray(subForm)) {
2502
- subForm.forEach(function (form) {
2503
- form.refresh();
2504
- });
2505
- } else if (subForm) {
2506
- subForm.refresh();
2507
- }
2508
- } //ctx.updateKey(true);
2525
+ if (!ctxs) {
2526
+ return;
2527
+ }
2509
2528
 
2529
+ ctxs = Array.isArray(ctxs) ? ctxs : [ctxs];
2530
+ ctxs.forEach(function (ctx) {
2531
+ if (!ctx.deleted) {
2532
+ var subForm = h.subForm[ctx.id];
2533
+
2534
+ if (subForm) {
2535
+ if (Array.isArray(subForm)) {
2536
+ subForm.forEach(function (form) {
2537
+ form.refresh();
2538
+ });
2539
+ } else if (subForm) {
2540
+ subForm.refresh();
2541
+ }
2542
+ } //ctx.updateKey(true);
2510
2543
 
2511
- h.$render.clearCache(ctx);
2512
- h.refresh();
2513
- }
2544
+
2545
+ h.$render.clearCache(ctx);
2546
+ }
2547
+ });
2548
+ h.refresh();
2514
2549
  },
2515
2550
  refresh: function refresh() {
2516
2551
  allSubForm().forEach(function (sub) {
@@ -2533,8 +2568,9 @@
2533
2568
  h.changeStatus = false;
2534
2569
  },
2535
2570
  updateRule: function updateRule(id, rule) {
2536
- var r = api.getRule(id);
2537
- r && extend(r, rule);
2571
+ h.getCtxs(id).forEach(function (ctx) {
2572
+ extend(ctx.rule, rule);
2573
+ });
2538
2574
  },
2539
2575
  updateRules: function updateRules(rules) {
2540
2576
  Object.keys(rules).forEach(function (id) {
@@ -2542,8 +2578,9 @@
2542
2578
  });
2543
2579
  },
2544
2580
  mergeRule: function mergeRule$1(id, rule) {
2545
- var ctx = h.getCtx(id);
2546
- ctx && mergeRule(ctx.rule, rule);
2581
+ h.getCtxs(id).forEach(function (ctx) {
2582
+ mergeRule(ctx.rule, rule);
2583
+ });
2547
2584
  },
2548
2585
  mergeRules: function mergeRules(rules) {
2549
2586
  Object.keys(rules).forEach(function (id) {
@@ -2576,13 +2613,12 @@
2576
2613
  api.refresh();
2577
2614
  },
2578
2615
  resetFields: function resetFields(fields) {
2579
- var ctxs = h.fieldCtx;
2580
2616
  tidyFields(fields).forEach(function (field) {
2581
- var ctx = ctxs[field];
2582
- if (!ctx) return;
2583
- h.$render.clearCache(ctx);
2584
- ctx.rule.value = copy(ctx.defaultValue);
2585
- h.refreshControl(ctx);
2617
+ h.getCtxs(field).forEach(function (ctx) {
2618
+ h.$render.clearCache(ctx);
2619
+ ctx.rule.value = copy(ctx.defaultValue);
2620
+ h.refreshControl(ctx);
2621
+ });
2586
2622
  });
2587
2623
  },
2588
2624
  method: function method(id, name) {
@@ -2622,7 +2658,8 @@
2622
2658
  el && el.$emit && el.$emit('close-modal');
2623
2659
  },
2624
2660
  getSubForm: function getSubForm(field) {
2625
- return h.subForm[field];
2661
+ var ctx = h.getCtx(field);
2662
+ return ctx ? h.subForm[ctx.id] : undefined;
2626
2663
  },
2627
2664
  nextTick: function nextTick(fn) {
2628
2665
  h.bus.$once('next-tick', fn);
@@ -2670,7 +2707,8 @@
2670
2707
  this.cache[ctx.id] = {
2671
2708
  vnode: vnode,
2672
2709
  use: false,
2673
- parent: parent
2710
+ parent: parent,
2711
+ slot: ctx.rule.slot
2674
2712
  };
2675
2713
  },
2676
2714
  getCache: function getCache(ctx) {
@@ -2691,46 +2729,20 @@
2691
2729
  return str.replace(str[0], str[0].toLowerCase());
2692
2730
  }
2693
2731
 
2694
- function setTempProps(vm, ctx, api) {
2695
- if (!vm.$props) return;
2696
- var prop = ctx.prop;
2697
- var keys = Object.keys(vm.$props);
2698
- var inject = injectProp(ctx, api);
2699
- var injectKeys = Object.keys(inject);
2700
- keys.forEach(function (key) {
2701
- if (hasProperty(prop.props, key)) vm.$props[key] = prop.props[key];else if (injectKeys.indexOf(key) > -1) vm.$props[key] = inject[key];
2702
- });
2703
- var key = vm.$options.model && vm.$options.model.prop || 'value';
2704
-
2705
- if (keys.indexOf(key) > -1) {
2706
- vm.$props[key] = prop.value;
2707
- }
2708
- }
2709
-
2710
- function injectProp(ctx, api) {
2711
- return {
2712
- formCreate: api,
2713
- formCreateField: ctx.field,
2714
- formCreateOptions: ctx.prop.options,
2715
- formCreateRule: function () {
2716
- var temp = _objectSpread2({}, ctx.prop);
2717
-
2718
- return temp.on = temp.on ? _objectSpread2({}, temp.on) : {}, temp;
2719
- }()
2720
- };
2721
- }
2722
-
2723
2732
  function useRender(Render) {
2724
2733
  extend(Render.prototype, {
2725
2734
  initRender: function initRender() {
2726
- this.renderList = {};
2735
+ this.tempList = {};
2727
2736
  this.clearOrgChildren();
2728
2737
  },
2729
2738
  initOrgChildren: function initOrgChildren() {
2730
2739
  var ctxs = this.$handle.ctxs;
2731
2740
  this.orgChildren = Object.keys(ctxs).reduce(function (initial, id) {
2732
- var children = ctxs[id].rule.children;
2733
- initial[id] = is.trueArray(children) ? _toConsumableArray(children) : [];
2741
+ if (ctxs[id].parser.loadChildren !== false) {
2742
+ var children = ctxs[id].rule.children;
2743
+ initial[id] = is.trueArray(children) ? _toConsumableArray(children) : [];
2744
+ }
2745
+
2734
2746
  return initial;
2735
2747
  }, {});
2736
2748
  },
@@ -2746,19 +2758,47 @@
2746
2758
 
2747
2759
  this.$h = this.vm.$createElement;
2748
2760
  this.$manager.beforeRender();
2749
- var vn = this.sort.map(function (id) {
2750
- return _this.renderCtx(_this.$handle.ctxs[id]);
2761
+ var vn;
2762
+
2763
+ var make = function make() {
2764
+ return _this.renderList();
2765
+ };
2766
+
2767
+ make.renderSlot = function (slot) {
2768
+ return _this.renderList(slot);
2769
+ };
2770
+
2771
+ make.renderName = function (name) {
2772
+ return _this.renderId(name);
2773
+ };
2774
+
2775
+ make.renderField = function (field) {
2776
+ return _this.renderId(field, 'field');
2777
+ };
2778
+
2779
+ if (this.vm.$scopedSlots.container) {
2780
+ vn = [this.vm.$scopedSlots.container(make)];
2781
+ } else {
2782
+ vn = make();
2783
+ }
2784
+
2785
+ return this.$manager.render(vn);
2786
+ },
2787
+ renderList: function renderList(slot) {
2788
+ var _this2 = this;
2789
+
2790
+ return this.sort.map(function (id) {
2791
+ return slot ? _this2.renderSlot(_this2.$handle.ctxs[id], slot) : _this2.renderCtx(_this2.$handle.ctxs[id]);
2751
2792
  }).filter(function (val) {
2752
2793
  return val !== undefined;
2753
2794
  });
2754
- return this.$manager.render(vn);
2755
2795
  },
2756
2796
  makeVm: function makeVm(rule) {
2757
- var _this2 = this;
2797
+ var _this3 = this;
2758
2798
 
2759
2799
  var vm = rule.vm;
2760
2800
  if (!vm) return new _vue();else if (is.Function(vm)) return invoke(function () {
2761
- return vm(_this2.$handle.getInjectData(rule));
2801
+ return rule.vm(_this3.$handle.getInjectData(rule));
2762
2802
  });else if (!vm._isVue) return new _vue(vm);
2763
2803
  return vm;
2764
2804
  },
@@ -2774,8 +2814,31 @@
2774
2814
  deepSet(ctx.prop, ctx.prop.optionsTo, ctx.prop.options);
2775
2815
  }
2776
2816
  },
2817
+ deepSet: function deepSet$1(ctx) {
2818
+ var deep = ctx.rule.deep;
2819
+ deep && Object.keys(deep).sort(function (a, b) {
2820
+ return a.length < b.length ? -1 : 1;
2821
+ }).forEach(function (str) {
2822
+ deepSet(ctx.prop, str, deep[str]);
2823
+ });
2824
+ },
2825
+ setTempProps: function setTempProps(vm, ctx) {
2826
+ if (!vm.$props) return;
2827
+ var prop = ctx.prop;
2828
+ var keys = Object.keys(vm.$props);
2829
+ var inject = this.injectProp(ctx);
2830
+ var injectKeys = Object.keys(inject);
2831
+ keys.forEach(function (key) {
2832
+ if (hasProperty(prop.props, key)) vm.$props[key] = prop.props[key];else if (injectKeys.indexOf(key) > -1) vm.$props[key] = inject[key];
2833
+ });
2834
+ var key = vm.$options.model && vm.$options.model.prop || 'value';
2835
+
2836
+ if (keys.indexOf(key) > -1) {
2837
+ vm.$props[key] = prop.value;
2838
+ }
2839
+ },
2777
2840
  renderTemp: function renderTemp(ctx) {
2778
- var _this3 = this;
2841
+ var _this4 = this;
2779
2842
 
2780
2843
  if (!_vue.compile) {
2781
2844
  tip('当前使用的Vue构建版本不支持compile,无法使用template功能');
@@ -2786,7 +2849,7 @@
2786
2849
  var id = ctx.id,
2787
2850
  key = ctx.key;
2788
2851
 
2789
- if (!this.renderList[id]) {
2852
+ if (!this.tempList[id]) {
2790
2853
  if (!ctx.el) {
2791
2854
  ctx.el = this.makeVm(rule);
2792
2855
  this.vm.$nextTick(function () {
@@ -2796,18 +2859,18 @@
2796
2859
 
2797
2860
  var _vm = ctx.el;
2798
2861
  if (ctx.input) _vm.$on(_vm.$options.model && _vm.$options.model.event || 'input', function (value) {
2799
- _this3.onInput(ctx, value);
2862
+ _this4.onInput(ctx, value);
2800
2863
  });
2801
- this.renderList[id] = {
2864
+ this.tempList[id] = {
2802
2865
  vm: _vm,
2803
2866
  template: _vue.compile(rule.template)
2804
2867
  };
2805
2868
  }
2806
2869
 
2807
- var _this$renderList$id = this.renderList[id],
2808
- vm = _this$renderList$id.vm,
2809
- template = _this$renderList$id.template;
2810
- setTempProps(vm, ctx, this.$handle.api);
2870
+ var _this$tempList$id = this.tempList[id],
2871
+ vm = _this$tempList$id.vm,
2872
+ template = _this$tempList$id.template;
2873
+ this.setTempProps(vm, ctx);
2811
2874
  var vn = template.render.call(vm);
2812
2875
  if (is.Undef(vn.data)) vn.data = {};
2813
2876
  vn.key = key;
@@ -2815,20 +2878,35 @@
2815
2878
  vn.data.key = key;
2816
2879
  return vn;
2817
2880
  },
2881
+ parseSide: function parseSide(side) {
2882
+ return is.Object(side) ? mergeRule({}, side) : side;
2883
+ },
2818
2884
  renderSides: function renderSides(vn, ctx, temp) {
2819
2885
  var prop = ctx[temp ? 'rule' : 'prop'];
2820
- return [this.renderRule(prop.prefix), vn, this.renderRule(prop.suffix)];
2886
+ return [this.renderRule(this.parseSide(prop.prefix)), vn, this.renderRule(this.parseSide(prop.suffix))];
2887
+ },
2888
+ renderSlot: function renderSlot(ctx, slot) {
2889
+ return ctx.rule.slot === slot ? this.renderCtx(ctx) : undefined;
2890
+ },
2891
+ renderId: function renderId(name, type) {
2892
+ var _this5 = this;
2893
+
2894
+ var ctxs = this.$handle[type === 'field' ? 'fieldCtx' : 'nameCtx'][name];
2895
+ return ctxs ? ctxs.map(function (ctx) {
2896
+ return _this5.renderCtx(ctx, ctx.parent);
2897
+ }) : undefined;
2821
2898
  },
2822
2899
  renderCtx: function renderCtx(ctx, parent) {
2823
2900
  if (ctx.type === 'hidden') return;
2901
+ var rule = ctx.rule;
2824
2902
 
2825
- if (!this.cache[ctx.id]) {
2903
+ if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2826
2904
  var vn;
2827
2905
  var cacheFlag = true;
2828
2906
  var _type = ctx.trueType;
2829
- var none = !(is.Undef(ctx.rule.display) || !!ctx.rule.display);
2907
+ var none = !(is.Undef(rule.display) || !!rule.display);
2830
2908
 
2831
- if (_type === 'template' && !ctx.rule.template) {
2909
+ if (_type === 'template' && !rule.template) {
2832
2910
  vn = this.renderSides(this.renderChildren(ctx), ctx, true);
2833
2911
 
2834
2912
  if (none) {
@@ -2842,9 +2920,11 @@
2842
2920
  ctx.initProp();
2843
2921
  this.mergeGlobal(ctx);
2844
2922
  this.$manager.tidyRule(ctx);
2923
+ this.deepSet(ctx);
2845
2924
  this.setOptions(ctx);
2846
2925
  this.ctxProp(ctx);
2847
2926
  var prop = ctx.prop;
2927
+ prop.props.formCreateInject = this.injectProp(ctx);
2848
2928
 
2849
2929
  if (prop.hidden) {
2850
2930
  this.setCache(ctx, undefined, parent);
@@ -2855,7 +2935,27 @@
2855
2935
  vn = this.renderTemp(ctx);
2856
2936
  cacheFlag = false;
2857
2937
  } else {
2858
- vn = ctx.parser.render(this.renderChildren(ctx), ctx);
2938
+ var children = [];
2939
+
2940
+ if (ctx.parser.renderChildren) {
2941
+ children = ctx.parser.renderChildren(ctx);
2942
+ } else if (ctx.parser.loadChildren !== false) {
2943
+ children = this.renderChildren(ctx);
2944
+ }
2945
+
2946
+ var slot = 'type-' + toLine(ctx.type);
2947
+
2948
+ if (this.vm.$scopedSlots[slot]) {
2949
+ vn = this.vm.$scopedSlots[slot]({
2950
+ rule: rule,
2951
+ prop: prop,
2952
+ children: children,
2953
+ api: this.$handle.api,
2954
+ model: prop.model || {}
2955
+ });
2956
+ } else {
2957
+ vn = ctx.parser.render(children, ctx);
2958
+ }
2859
2959
  }
2860
2960
 
2861
2961
  vn = this.renderSides(vn, ctx);
@@ -2881,13 +2981,13 @@
2881
2981
  return this.getCache(ctx);
2882
2982
  },
2883
2983
  display: function display(vn) {
2884
- var _this4 = this;
2984
+ var _this6 = this;
2885
2985
 
2886
2986
  if (Array.isArray(vn)) {
2887
2987
  var data = [];
2888
2988
  vn.forEach(function (v) {
2889
- if (Array.isArray(v)) return _this4.display(v);
2890
- if (_this4.none(v)) data.push(v);
2989
+ if (Array.isArray(v)) return _this6.display(v);
2990
+ if (_this6.none(v)) data.push(v);
2891
2991
  });
2892
2992
  return data;
2893
2993
  } else {
@@ -2915,8 +3015,36 @@
2915
3015
  key: ctx.key
2916
3016
  }, [vn]);
2917
3017
  },
3018
+ injectProp: function injectProp(ctx) {
3019
+ var _this7 = this;
3020
+
3021
+ if (!this.vm.ctxInject[ctx.id]) {
3022
+ $set(this.vm.ctxInject, ctx.id, {});
3023
+ }
3024
+
3025
+ var inject = this.vm.ctxInject[ctx.id];
3026
+ extend(inject, {
3027
+ api: this.$handle.api,
3028
+ form: this.fc.create,
3029
+ subForm: function subForm(_subForm) {
3030
+ _this7.$handle.addSubForm(ctx, _subForm);
3031
+ },
3032
+ field: ctx.field,
3033
+ options: ctx.prop.options,
3034
+ children: ctx.rule.children,
3035
+ rule: ctx.rule,
3036
+ prop: function () {
3037
+ var temp = _objectSpread2({}, ctx.prop);
3038
+
3039
+ temp.on = temp.on ? _objectSpread2({}, temp.on) : {};
3040
+ delete temp.model;
3041
+ return temp;
3042
+ }()
3043
+ });
3044
+ return inject;
3045
+ },
2918
3046
  ctxProp: function ctxProp(ctx, custom) {
2919
- var _this5 = this;
3047
+ var _this8 = this;
2920
3048
 
2921
3049
  var ref = ctx.ref,
2922
3050
  key = ctx.key,
@@ -2924,29 +3052,28 @@
2924
3052
  this.$manager.mergeProp(ctx, custom);
2925
3053
  ctx.parser.mergeProp(ctx, custom);
2926
3054
  var props = [{
2927
- props: injectProp(ctx, this.$handle.api),
2928
3055
  ref: ref,
2929
3056
  key: rule.key || "".concat(key, "fc"),
2930
- slot: undefined
3057
+ slot: undefined,
3058
+ on: {
3059
+ 'hook:mounted': function hookMounted() {
3060
+ _this8.onMounted(ctx);
3061
+ },
3062
+ 'fc.sub-form': function fcSubForm(subForm) {
3063
+ _this8.$handle.addSubForm(ctx, subForm);
3064
+ }
3065
+ }
2931
3066
  }];
2932
3067
 
2933
- if (!custom) {
3068
+ if (!custom && ctx.input) {
2934
3069
  props.push({
2935
- on: {
2936
- 'hook:mounted': function hookMounted() {
2937
- _this5.onMounted(ctx);
2938
- },
2939
- 'fc.sub-form': function fcSubForm(subForm) {
2940
- _this5.$handle.addSubForm(ctx, subForm);
2941
- }
2942
- },
2943
- model: ctx.input ? {
3070
+ model: {
2944
3071
  value: this.$handle.getFormData(ctx),
2945
3072
  callback: function callback(value) {
2946
- _this5.onInput(ctx, value);
3073
+ _this8.onInput(ctx, value);
2947
3074
  },
2948
- expression: "formData.".concat(ctx.field)
2949
- } : undefined
3075
+ expression: "formData.".concat(ctx.id)
3076
+ }
2950
3077
  });
2951
3078
  }
2952
3079
 
@@ -2955,6 +3082,11 @@
2955
3082
  },
2956
3083
  onMounted: function onMounted(ctx) {
2957
3084
  ctx.el = this.vm.$refs[ctx.ref];
3085
+
3086
+ if (ctx.el) {
3087
+ (ctx.el.$el || ctx.el).__rule__ = ctx.rule;
3088
+ }
3089
+
2958
3090
  ctx.parser.mounted(ctx);
2959
3091
  this.$handle.effect(ctx, 'mounted');
2960
3092
  },
@@ -2962,13 +3094,13 @@
2962
3094
  this.$handle.onInput(ctx, value);
2963
3095
  },
2964
3096
  renderChildren: function renderChildren(ctx) {
2965
- var _this6 = this;
3097
+ var _this9 = this;
2966
3098
 
2967
3099
  var children = ctx.rule.children,
2968
3100
  orgChildren = this.orgChildren[ctx.id];
2969
3101
 
2970
3102
  var isRm = function isRm(child) {
2971
- return !is.String(child) && child.__fc__ && !_this6.$handle.ctxs[child.__fc__.id];
3103
+ return !is.String(child) && child.__fc__ && !_this9.$handle.ctxs[child.__fc__.id];
2972
3104
  };
2973
3105
 
2974
3106
  if (!is.trueArray(children) && orgChildren) {
@@ -2977,7 +3109,7 @@
2977
3109
  if (!child) return;
2978
3110
 
2979
3111
  if (isRm(child)) {
2980
- _this6.$handle.rmCtx(child.__fc__);
3112
+ _this9.$handle.rmCtx(child.__fc__);
2981
3113
  }
2982
3114
  });
2983
3115
  });
@@ -2990,7 +3122,7 @@
2990
3122
  if (!child) return;
2991
3123
 
2992
3124
  if (children.indexOf(child) === -1 && isRm(child)) {
2993
- _this6.$handle.rmCtx(child.__fc__);
3125
+ _this9.$handle.rmCtx(child.__fc__);
2994
3126
  }
2995
3127
  });
2996
3128
  });
@@ -2999,14 +3131,14 @@
2999
3131
  if (is.String(child)) return child;
3000
3132
 
3001
3133
  if (child.__fc__) {
3002
- return _this6.renderCtx(child.__fc__, ctx);
3134
+ return _this9.renderCtx(child.__fc__, ctx);
3003
3135
  }
3004
3136
 
3005
- if (!_this6.$handle.isRepeatRule(child.__origin__ || child) && child.type) {
3006
- _this6.vm.$nextTick(function () {
3007
- _this6.$handle.loadChildren(children, ctx);
3137
+ if (child.type) {
3138
+ _this9.vm.$nextTick(function () {
3139
+ _this9.$handle.loadChildren(children, ctx);
3008
3140
 
3009
- _this6.$handle.refresh();
3141
+ _this9.$handle.refresh();
3010
3142
  });
3011
3143
  }
3012
3144
  });
@@ -3018,7 +3150,7 @@
3018
3150
  return this.vNode.make(lower(ctx.originType), prop, children);
3019
3151
  },
3020
3152
  renderRule: function renderRule(rule, children, origin) {
3021
- var _this7 = this;
3153
+ var _this10 = this;
3022
3154
 
3023
3155
  if (!rule) return undefined;
3024
3156
  if (is.String(rule)) return rule;
@@ -3041,7 +3173,7 @@
3041
3173
 
3042
3174
  if (is.trueArray(rule.children)) {
3043
3175
  data.push(rule.children.map(function (v) {
3044
- return _this7.renderRule(v);
3176
+ return _this10.renderRule(v);
3045
3177
  }));
3046
3178
  }
3047
3179
 
@@ -3075,15 +3207,33 @@
3075
3207
  function useInject(Handler) {
3076
3208
  extend(Handler.prototype, {
3077
3209
  parseInjectEvent: function parseInjectEvent(rule, on) {
3210
+ var inject = rule.inject || this.options.injectEvent;
3211
+ return this.parseEventLst(rule, on, inject);
3212
+ },
3213
+ parseEventLst: function parseEventLst(rule, data, inject, deep) {
3078
3214
  var _this = this;
3079
3215
 
3080
- if (rule.inject === false) return;
3081
- var inject = rule.inject || this.options.injectEvent;
3082
- if (is.Undef(inject)) return;
3083
- Object.keys(on).forEach(function (k) {
3084
- if (is.Function(on[k])) on[k] = _this.inject(rule, on[k], inject);
3216
+ Object.keys(data).forEach(function (k) {
3217
+ var fn = _this.parseEvent(rule, data[k], inject, deep);
3218
+
3219
+ if (fn) {
3220
+ data[k] = fn;
3221
+ }
3085
3222
  });
3086
- return on;
3223
+ return data;
3224
+ },
3225
+ parseEvent: function parseEvent(rule, fn, inject, deep) {
3226
+ if (is.Function(fn) && (inject !== false && !is.Undef(inject) || fn.__inject)) {
3227
+ return this.inject(rule, fn, inject);
3228
+ } else if (!deep && Array.isArray(fn) && fn[0] && (is.String(fn[0]) || is.Function(fn[0]))) {
3229
+ return this.parseEventLst(rule, fn, inject, true);
3230
+ } else if (is.String(fn)) {
3231
+ var val = parseFn(fn);
3232
+
3233
+ if (val && fn !== val) {
3234
+ return val.__inject ? this.parseEvent(rule, val, inject, true) : val;
3235
+ }
3236
+ }
3087
3237
  },
3088
3238
  parseEmit: function parseEmit(ctx, on) {
3089
3239
  var _this2 = this;
@@ -3145,6 +3295,7 @@
3145
3295
  option = _this$vm$$options$pro.option,
3146
3296
  rule = _this$vm$$options$pro.rule;
3147
3297
  return {
3298
+ api: this.api,
3148
3299
  $f: this.api,
3149
3300
  rule: rule,
3150
3301
  self: self.__origin__,
@@ -3153,7 +3304,7 @@
3153
3304
  };
3154
3305
  },
3155
3306
  inject: function inject(self, _fn, _inject2) {
3156
- if (_fn.__inject) {
3307
+ if (_fn.__origin) {
3157
3308
  if (this.watching && !this.loading) return _fn;
3158
3309
  _fn = _fn.__origin;
3159
3310
  }
@@ -3161,16 +3312,19 @@
3161
3312
  var h = this;
3162
3313
 
3163
3314
  var fn = function fn() {
3315
+ var data = h.getInjectData(self, _inject2);
3316
+
3164
3317
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3165
3318
  args[_key2] = arguments[_key2];
3166
3319
  }
3167
3320
 
3168
- args.unshift(h.getInjectData(self, _inject2));
3321
+ data.args = [].concat(args);
3322
+ args.unshift(data);
3169
3323
  return _fn.apply(this, args);
3170
3324
  };
3171
3325
 
3172
- fn.__inject = true;
3173
3326
  fn.__origin = _fn;
3327
+ fn.__json = _fn.__json;
3174
3328
  return fn;
3175
3329
  }
3176
3330
  });
@@ -3315,7 +3469,10 @@
3315
3469
  initProp: function initProp() {
3316
3470
  var _this = this;
3317
3471
 
3318
- this.prop = mergeProps([this.rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3472
+ var rule = _objectSpread2({}, this.rule);
3473
+
3474
+ delete rule.children;
3475
+ this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3319
3476
  return _this.payload[k];
3320
3477
  })), [this.computed]));
3321
3478
  },
@@ -3362,7 +3519,7 @@
3362
3519
  },
3363
3520
  rmCtrl: function rmCtrl() {
3364
3521
  this.ctrlRule.forEach(function (ctrl) {
3365
- return ctrl.__fc__.rm();
3522
+ return ctrl.__fc__ && ctrl.__fc__.rm();
3366
3523
  });
3367
3524
  this.ctrlRule = [];
3368
3525
  },
@@ -3375,7 +3532,7 @@
3375
3532
  if (index > -1) {
3376
3533
  _this2.root.splice(index, 1);
3377
3534
 
3378
- _this2.$handle.refresh();
3535
+ _this2.$handle && _this2.$handle.refresh();
3379
3536
  }
3380
3537
  };
3381
3538
 
@@ -3396,7 +3553,7 @@
3396
3553
  extend(_this2, {
3397
3554
  root: []
3398
3555
  });
3399
- });
3556
+ }, _this2.input);
3400
3557
  });
3401
3558
  },
3402
3559
  update: function update(handle, init) {
@@ -3434,23 +3591,39 @@
3434
3591
  __origin__: enumerable(_rule, true)
3435
3592
  });
3436
3593
  fullRule(rule);
3437
- if (rule.field && hasProperty(this.options.formData || {}, rule.field)) rule.value = this.options.formData[rule.field];
3594
+ this.appendValue(rule);
3438
3595
  rule.options = Array.isArray(rule.options) ? rule.options : [];
3439
- ['on', 'props', 'nativeOn'].forEach(function (k) {
3440
- var v = rule[k];
3596
+ [rule, rule['prefix'], rule['suffix']].forEach(function (item) {
3597
+ if (!item) {
3598
+ return;
3599
+ }
3441
3600
 
3442
- if (v) {
3443
- Object.keys(v).forEach(function (n) {
3444
- v[n] = parseFn(v[n]);
3445
- });
3601
+ _this2.loadFn(item, rule);
3602
+ });
3603
+ this.loadCtrl(rule);
3604
+
3605
+ if (rule.update) {
3606
+ rule.update = parseFn(rule.update);
3607
+ }
3446
3608
 
3447
- _this2.parseInjectEvent(rule, v);
3609
+ return rule;
3610
+ },
3611
+ loadFn: function loadFn(item, rule) {
3612
+ var _this3 = this;
3613
+
3614
+ ['on', 'props', 'nativeOn', 'deep'].forEach(function (k) {
3615
+ item[k] && _this3.parseInjectEvent(rule, item[k]);
3616
+ });
3617
+ },
3618
+ loadCtrl: function loadCtrl(rule) {
3619
+ rule.control && rule.control.forEach(function (ctrl) {
3620
+ if (ctrl.handle) {
3621
+ ctrl.handle = parseFn(ctrl.handle);
3448
3622
  }
3449
3623
  });
3450
- return rule;
3451
3624
  },
3452
3625
  syncProp: function syncProp(ctx) {
3453
- var _this3 = this;
3626
+ var _this4 = this;
3454
3627
 
3455
3628
  var rule = ctx.rule;
3456
3629
  is.trueArray(rule.sync) && mergeProps([{
@@ -3458,18 +3631,15 @@
3458
3631
  pre["update:".concat(prop)] = function (val) {
3459
3632
  rule.props[prop] = val;
3460
3633
 
3461
- _this3.vm.$emit('sync', prop, val, rule, _this3.fapi);
3634
+ _this4.vm.$emit('sync', prop, val, rule, _this4.fapi);
3462
3635
  };
3463
3636
 
3464
3637
  return pre;
3465
3638
  }, {})
3466
3639
  }], ctx.computed);
3467
3640
  },
3468
- isRepeatRule: function isRepeatRule(rule) {
3469
- return this.repeatRule.indexOf(rule) > -1;
3470
- },
3471
3641
  loadRule: function loadRule() {
3472
- var _this4 = this;
3642
+ var _this5 = this;
3473
3643
 
3474
3644
  // console.warn('%c load', 'color:blue');
3475
3645
  this.cycleLoad = false;
@@ -3480,23 +3650,23 @@
3480
3650
  }
3481
3651
 
3482
3652
  this.deferSyncValue(function () {
3483
- _this4._loadRule(_this4.rules);
3653
+ _this5._loadRule(_this5.rules);
3484
3654
 
3485
- _this4.loading = false;
3655
+ _this5.loading = false;
3486
3656
 
3487
- if (_this4.cycleLoad && _this4.pageEnd) {
3488
- return _this4.loadRule();
3657
+ if (_this5.cycleLoad && _this5.pageEnd) {
3658
+ return _this5.loadRule();
3489
3659
  }
3490
3660
 
3491
- if (_this4.pageEnd) {
3492
- _this4.bus.$emit('load-end');
3661
+ if (_this5.pageEnd) {
3662
+ _this5.bus.$emit('load-end');
3493
3663
  }
3494
3664
 
3495
- _this4.vm._renderRule();
3665
+ _this5.vm._renderRule();
3496
3666
 
3497
- _this4.$render.initOrgChildren();
3667
+ _this5.$render.initOrgChildren();
3498
3668
 
3499
- _this4.syncForm();
3669
+ _this5.syncForm();
3500
3670
  });
3501
3671
  },
3502
3672
  loadChildren: function loadChildren(children, parent) {
@@ -3518,7 +3688,7 @@
3518
3688
  this.$render.clearCache(parent);
3519
3689
  },
3520
3690
  _loadRule: function _loadRule(rules, parent) {
3521
- var _this5 = this;
3691
+ var _this6 = this;
3522
3692
 
3523
3693
  var preIndex = function preIndex(i) {
3524
3694
  var pre = rules[i - 1];
@@ -3527,45 +3697,48 @@
3527
3697
  return i > 0 ? preIndex(i - 1) : -1;
3528
3698
  }
3529
3699
 
3530
- var index = _this5.sort.indexOf(pre.__fc__.id);
3700
+ var index = _this6.sort.indexOf(pre.__fc__.id);
3531
3701
 
3532
3702
  return index > -1 ? index : preIndex(i - 1);
3533
3703
  };
3534
3704
 
3535
3705
  var loadChildren = function loadChildren(children, parent) {
3536
3706
  if (is.trueArray(children)) {
3537
- _this5._loadRule(children, parent);
3707
+ _this6._loadRule(children, parent);
3538
3708
  }
3539
3709
  };
3540
3710
 
3541
- var initEvent = function initEvent(rule) {
3542
- return _this5.ruleEffect(rule, 'init');
3543
- };
3544
-
3545
3711
  rules.map(function (_rule, index) {
3546
3712
  if (parent && (is.String(_rule) || is.Undef(_rule))) return;
3547
- if (!_this5.pageEnd && !parent && index >= _this5.first) return;
3713
+ if (!_this6.pageEnd && !parent && index >= _this6.first) return;
3548
3714
  if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
3549
3715
 
3550
- if (_rule.__fc__ && _rule.__fc__.root === rules && _this5.ctxs[_rule.__fc__.id]) {
3716
+ if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
3551
3717
  loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
3552
3718
  return _rule.__fc__;
3553
3719
  }
3554
3720
 
3555
3721
  var rule = getRule(_rule);
3556
- if (!_rule.__fc__) initEvent(rule);
3557
3722
 
3558
- if (rule.field && _this5.fieldCtx[rule.field] && _this5.fieldCtx[rule.field] !== _rule.__fc__) {
3559
- _this5.repeatRule.push(_rule);
3723
+ var isRepeat = function isRepeat() {
3724
+ return !!(rule.field && _this6.fieldCtx[rule.field] && _this6.fieldCtx[rule.field][0] !== _rule.__fc__);
3725
+ };
3726
+
3727
+ _this6.ruleEffect(rule, 'init', {
3728
+ repeat: isRepeat()
3729
+ });
3560
3730
 
3561
- return err("".concat(rule.field, " \u5B57\u6BB5\u5DF2\u5B58\u5728"), _rule);
3731
+ if (isRepeat()) {
3732
+ _this6.vm.$emit('repeat-field', _rule, _this6.api);
3562
3733
  }
3563
3734
 
3564
3735
  var ctx;
3736
+ var isCopy = false;
3737
+ var isInit = !!_rule.__fc__;
3565
3738
 
3566
- if (_rule.__fc__) {
3739
+ if (isInit) {
3567
3740
  ctx = _rule.__fc__;
3568
- var check = !ctx.check(_this5);
3741
+ var check = !ctx.check(_this6);
3569
3742
 
3570
3743
  if (ctx.deleted) {
3571
3744
  if (check) {
@@ -3573,7 +3746,7 @@
3573
3746
  return;
3574
3747
  }
3575
3748
 
3576
- ctx.update(_this5);
3749
+ ctx.update(_this6);
3577
3750
  }
3578
3751
  } else {
3579
3752
  if (check) {
@@ -3582,44 +3755,47 @@
3582
3755
  }
3583
3756
 
3584
3757
  rules[index] = _rule = _rule._clone ? _rule._clone() : copyRule(_rule);
3585
- initEvent(getRule(_rule));
3586
3758
  ctx = null;
3759
+ isCopy = true;
3587
3760
  }
3588
3761
  }
3589
3762
  }
3590
3763
 
3591
3764
  if (!ctx) {
3592
- ctx = new RuleContext(_this5, _this5.parseRule(_rule));
3765
+ ctx = new RuleContext(_this6, _this6.parseRule(_rule));
3766
+
3767
+ _this6.bindParser(ctx);
3768
+ } else {
3769
+ if (ctx.originType !== ctx.rule.type) {
3770
+ ctx.updateType();
3593
3771
 
3594
- _this5.bindParser(ctx);
3595
- } else if (ctx.originType !== ctx.rule.type) {
3596
- ctx.updateType();
3772
+ _this6.bindParser(ctx);
3773
+ }
3597
3774
 
3598
- _this5.bindParser(ctx);
3775
+ _this6.appendValue(ctx.rule);
3599
3776
  }
3600
3777
 
3601
- _this5.appendValue(ctx.rule);
3602
-
3603
3778
  [false, true].forEach(function (b) {
3604
- return _this5.parseEmit(ctx, b);
3779
+ return _this6.parseEmit(ctx, b);
3605
3780
  });
3606
3781
 
3607
- _this5.syncProp(ctx);
3782
+ _this6.syncProp(ctx);
3608
3783
 
3609
3784
  ctx.parent = parent || null;
3610
3785
  ctx.root = rules;
3611
3786
 
3612
- _this5.setCtx(ctx);
3787
+ _this6.setCtx(ctx);
3613
3788
 
3614
- loadChildren(ctx.rule.children, ctx);
3789
+ !isCopy && !isInit && _this6.effect(ctx, 'load');
3790
+ ctx.parser.loadChildren === false || loadChildren(ctx.rule.children, ctx);
3615
3791
 
3616
3792
  if (!parent) {
3617
3793
  var _preIndex = preIndex(index);
3618
3794
 
3619
3795
  if (_preIndex > -1 || !index) {
3620
- _this5.sort.splice(_preIndex + 1, 0, ctx.id);
3796
+ _this6.sort.splice(_preIndex + 1, 0, ctx.id);
3621
3797
  } else {
3622
- _this5.sort.push(ctx.id);
3798
+ _this6.sort.push(ctx.id);
3623
3799
  }
3624
3800
  }
3625
3801
 
@@ -3629,16 +3805,16 @@
3629
3805
  ctx.updated = true;
3630
3806
 
3631
3807
  if (is.Function(r.update)) {
3632
- _this5.bus.$once('load-end', function () {
3633
- _this5.refreshUpdate(ctx, r.value);
3808
+ _this6.bus.$once('load-end', function () {
3809
+ _this6.refreshUpdate(ctx, r.value);
3634
3810
  });
3635
3811
  }
3636
3812
 
3637
- _this5.effect(ctx, 'loaded');
3813
+ _this6.effect(ctx, 'loaded');
3638
3814
  }
3639
3815
 
3640
- if (ctx.input) Object.defineProperty(r, 'value', _this5.valueHandle(ctx));
3641
- if (_this5.refreshControl(ctx)) _this5.cycleLoad = true;
3816
+ if (ctx.input) Object.defineProperty(r, 'value', _this6.valueHandle(ctx));
3817
+ if (_this6.refreshControl(ctx)) _this6.cycleLoad = true;
3642
3818
  return ctx;
3643
3819
  });
3644
3820
  },
@@ -3646,7 +3822,7 @@
3646
3822
  return ctx.input && ctx.rule.control && this.useCtrl(ctx);
3647
3823
  },
3648
3824
  useCtrl: function useCtrl(ctx) {
3649
- var _this6 = this;
3825
+ var _this7 = this;
3650
3826
 
3651
3827
  var controls = getCtrl(ctx),
3652
3828
  validate = [],
@@ -3659,14 +3835,17 @@
3659
3835
  return val === control.value;
3660
3836
  };
3661
3837
 
3838
+ if (!is.trueArray(control.rule)) return "continue";
3839
+
3662
3840
  var data = _objectSpread2(_objectSpread2({}, control), {}, {
3663
3841
  valid: invoke(function () {
3664
3842
  return handleFn(ctx.rule.value, api);
3665
3843
  }),
3666
- ctrl: findCtrl(ctx, control.rule)
3844
+ ctrl: findCtrl(ctx, control.rule),
3845
+ isHidden: is.String(control.rule[0])
3667
3846
  });
3668
3847
 
3669
- if (data.valid && data.ctrl || !data.valid && !data.ctrl) return "continue";
3848
+ if (data.valid && data.ctrl || !data.valid && !data.ctrl && !data.isHidden) return "continue";
3670
3849
  validate.push(data);
3671
3850
  };
3672
3851
 
@@ -3678,39 +3857,56 @@
3678
3857
 
3679
3858
  if (!validate.length) return false;
3680
3859
  var flag = false;
3681
- validate.reverse().forEach(function (_ref) {
3682
- var valid = _ref.valid,
3683
- rule = _ref.rule,
3684
- prepend = _ref.prepend,
3685
- append = _ref.append,
3686
- child = _ref.child,
3687
- ctrl = _ref.ctrl;
3860
+ this.deferSyncValue(function () {
3861
+ validate.reverse().forEach(function (_ref) {
3862
+ var isHidden = _ref.isHidden,
3863
+ valid = _ref.valid,
3864
+ rule = _ref.rule,
3865
+ prepend = _ref.prepend,
3866
+ append = _ref.append,
3867
+ child = _ref.child,
3868
+ ctrl = _ref.ctrl;
3869
+
3870
+ if (isHidden) {
3871
+ valid ? ctx.ctrlRule.push({
3872
+ __ctrl: true,
3873
+ children: rule,
3874
+ valid: valid
3875
+ }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
3876
+
3877
+ _this7.vm.$nextTick(function () {
3878
+ _this7.api.hidden(!valid, rule);
3879
+ });
3688
3880
 
3689
- if (valid) {
3690
- flag = true;
3691
- var ruleCon = {
3692
- type: 'fcFragment',
3693
- "native": true,
3694
- __ctrl: true,
3695
- children: rule
3696
- };
3697
- ctx.ctrlRule.push(ruleCon);
3698
-
3699
- _this6.bus.$once('load-start', function () {
3700
- // this.cycleLoad = true;
3701
- if (prepend) {
3702
- api.prepend(ruleCon, prepend, child);
3703
- } else if (append || child) {
3704
- api.append(ruleCon, append || ctx.id, child);
3705
- } else {
3706
- ctx.root.splice(ctx.root.indexOf(ctx.origin) + 1, 0, ruleCon);
3707
- }
3708
- });
3709
- } else {
3710
- ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
3711
- var ctrlCtx = byCtx(ctrl);
3712
- ctrlCtx && ctrlCtx.rm();
3713
- }
3881
+ return;
3882
+ }
3883
+
3884
+ if (valid) {
3885
+ flag = true;
3886
+ var ruleCon = {
3887
+ type: 'fcFragment',
3888
+ "native": true,
3889
+ __ctrl: true,
3890
+ children: rule
3891
+ };
3892
+ ctx.ctrlRule.push(ruleCon);
3893
+
3894
+ _this7.bus.$once('load-start', function () {
3895
+ // this.cycleLoad = true;
3896
+ if (prepend) {
3897
+ api.prepend(ruleCon, prepend, child);
3898
+ } else if (append || child) {
3899
+ api.append(ruleCon, append || ctx.id, child);
3900
+ } else {
3901
+ ctx.root.splice(ctx.root.indexOf(ctx.origin) + 1, 0, ruleCon);
3902
+ }
3903
+ });
3904
+ } else {
3905
+ ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
3906
+ var ctrlCtx = byCtx(ctrl);
3907
+ ctrlCtx && ctrlCtx.rm();
3908
+ }
3909
+ });
3714
3910
  });
3715
3911
  this.vm.$emit('control', ctx.origin, this.api);
3716
3912
  this.effect(ctx, 'control');
@@ -3720,7 +3916,7 @@
3720
3916
  return this._reloadRule(rules);
3721
3917
  },
3722
3918
  _reloadRule: function _reloadRule(rules) {
3723
- var _this7 = this;
3919
+ var _this8 = this;
3724
3920
 
3725
3921
  // console.warn('%c reload', 'color:red');
3726
3922
  if (!rules) rules = this.rules;
@@ -3733,12 +3929,12 @@
3733
3929
  this.fc.rules = rules;
3734
3930
  this.bus.$once('load-end', function () {
3735
3931
  Object.keys(ctxs).filter(function (id) {
3736
- return _this7.ctxs[id] === undefined;
3932
+ return _this8.ctxs[id] === undefined;
3737
3933
  }).forEach(function (id) {
3738
- return _this7.rmCtx(ctxs[id]);
3934
+ return _this8.rmCtx(ctxs[id]);
3739
3935
  });
3740
3936
 
3741
- _this7.$render.clearCacheAll();
3937
+ _this8.$render.clearCacheAll();
3742
3938
  });
3743
3939
  this.reloading = true;
3744
3940
  this.loadRule();
@@ -3807,18 +4003,19 @@
3807
4003
  }
3808
4004
  },
3809
4005
  setFormData: function setFormData(ctx, value) {
3810
- $set(this.formData, ctx.field, value);
4006
+ $set(this.formData, ctx.id, value);
3811
4007
  },
3812
4008
  getFormData: function getFormData(ctx) {
3813
- return this.formData[ctx.field];
4009
+ return this.formData[ctx.id];
3814
4010
  },
3815
4011
  validate: function validate() {
3816
4012
  var _this = this;
3817
4013
 
3818
4014
  toEmpty(this.vm.validate);
3819
- Object.keys(this.fieldCtx).forEach(function (id) {
3820
- var ctx = _this.fieldCtx[id];
3821
- _this.vm.validate[ctx.field] = toArray(ctx.rule.validate);
4015
+ this.fields().forEach(function (id) {
4016
+ _this.fieldCtx[id].forEach(function (ctx) {
4017
+ _this.vm.validate[ctx.id] = toArray(ctx.rule.validate);
4018
+ });
3822
4019
  });
3823
4020
  return this.vm.validate;
3824
4021
  },
@@ -3826,15 +4023,27 @@
3826
4023
  var _this2 = this;
3827
4024
 
3828
4025
  toEmpty(this.form);
3829
- Object.defineProperties(this.form, Object.keys(this.formData).reduce(function (initial, field) {
3830
- var ctx = _this2.getCtx(field);
4026
+ Object.defineProperties(this.form, this.fields().reduce(function (initial, field) {
4027
+ var ctx = _this2.getFieldCtx(field);
3831
4028
 
3832
4029
  var handle = _this2.valueHandle(ctx);
3833
4030
 
3834
4031
  handle.configurable = true;
3835
4032
  initial[field] = handle;
3836
4033
  return initial;
3837
- }, {}));
4034
+ }, Object.keys(this.appendData).reduce(function (initial, field) {
4035
+ initial[field] = {
4036
+ enumerable: true,
4037
+ configurable: true,
4038
+ get: function get() {
4039
+ return _this2.appendData[field];
4040
+ },
4041
+ set: function set(val) {
4042
+ _this2.appendData[field] = val;
4043
+ }
4044
+ };
4045
+ return initial;
4046
+ }, {})));
3838
4047
  this.syncValue();
3839
4048
  },
3840
4049
  valueHandle: function valueHandle(ctx) {
@@ -3858,13 +4067,19 @@
3858
4067
  delete this.appendData[rule.field];
3859
4068
  },
3860
4069
  addSubForm: function addSubForm(ctx, subForm) {
3861
- this.subForm[ctx.field] = subForm;
4070
+ if (ctx.input) {
4071
+ this.subForm[ctx.id] = subForm;
4072
+ }
3862
4073
  },
3863
- deferSyncValue: function deferSyncValue(fn) {
4074
+ deferSyncValue: function deferSyncValue(fn, sync) {
3864
4075
  if (!this.deferSyncFn) {
3865
4076
  this.deferSyncFn = fn;
3866
4077
  }
3867
4078
 
4079
+ if (!this.deferSyncFn.sync) {
4080
+ this.deferSyncFn.sync = sync;
4081
+ }
4082
+
3868
4083
  invoke(fn);
3869
4084
 
3870
4085
  if (this.deferSyncFn === fn) {
@@ -3891,11 +4106,9 @@
3891
4106
  refreshUpdate: function refreshUpdate(ctx, val) {
3892
4107
  var _this4 = this;
3893
4108
 
3894
- var fn = ctx.rule.update;
3895
-
3896
- if (is.Function(fn)) {
4109
+ if (is.Function(ctx.rule.update)) {
3897
4110
  var state = invoke(function () {
3898
- return fn(val, ctx.origin, _this4.api);
4111
+ return ctx.rule.update(val, ctx.origin, _this4.api);
3899
4112
  });
3900
4113
  if (state === undefined) return;
3901
4114
  ctx.rule.hidden = state === true;
@@ -3931,7 +4144,7 @@
3931
4144
  });
3932
4145
  },
3933
4146
  fields: function fields() {
3934
- return Object.keys(this.formData);
4147
+ return Object.keys(this.fieldCtx);
3935
4148
  }
3936
4149
  });
3937
4150
  }
@@ -3942,49 +4155,6 @@
3942
4155
  });
3943
4156
  }
3944
4157
 
3945
- function useHelper(rules) {
3946
- if (!Array.isArray(rules) || rules.findField) return;
3947
- Object.defineProperties(rules, {
3948
- findField: enumerable(findField),
3949
- findName: enumerable(findName),
3950
- setValue: enumerable(setValue)
3951
- });
3952
- }
3953
-
3954
- function find(field, name, origin) {
3955
- if (!this.length) return;
3956
- var children = [];
3957
-
3958
- for (var i = 0; i < this.length; i++) {
3959
- if (!is.Object(this[i])) continue;
3960
- var rule = getRule(this[i]);
3961
- if (rule[name] === field) return origin ? rule : this[i];
3962
- if (is.trueArray(rule.children)) children = children.concat(rule.children);
3963
- is.trueArray(rule.control) && rule.control.forEach(function (r) {
3964
- children = children.concat(r.rule);
3965
- });
3966
- }
3967
-
3968
- return find.call(children, field, name, origin);
3969
- }
3970
-
3971
- function findField(field) {
3972
- return find.call(this, field, 'field');
3973
- }
3974
-
3975
- function findName(field) {
3976
- return find.call(this, field, 'name');
3977
- }
3978
-
3979
- function setValue(formData) {
3980
- var _this = this;
3981
-
3982
- Object.keys(formData).forEach(function (field) {
3983
- var rule = find.call(_this, field, 'field', true);
3984
- if (rule) rule.value = formData[field];
3985
- });
3986
- }
3987
-
3988
4158
  var BaseParser = {
3989
4159
  init: function init(ctx) {},
3990
4160
  toFormValue: function toFormValue(value, ctx) {
@@ -4003,7 +4173,37 @@
4003
4173
  function useContext(Handler) {
4004
4174
  extend(Handler.prototype, {
4005
4175
  getCtx: function getCtx(id) {
4006
- return this.fieldCtx[id] || this.nameCtx[id] || this.ctxs[id];
4176
+ return this.getFieldCtx(id) || this.getNameCtx(id)[0] || this.ctxs[id];
4177
+ },
4178
+ getCtxs: function getCtxs(id) {
4179
+ return this.fieldCtx[id] || this.nameCtx[id] || (this.ctxs[id] ? [this.ctxs[id]] : []);
4180
+ },
4181
+ setIdCtx: function setIdCtx(ctx, key, type) {
4182
+ var field = "".concat(type, "Ctx");
4183
+
4184
+ if (!this[field][key]) {
4185
+ this[field][key] = [ctx];
4186
+ } else {
4187
+ this[field][key].push(ctx);
4188
+ }
4189
+ },
4190
+ rmIdCtx: function rmIdCtx(ctx, key, type) {
4191
+ var field = "".concat(type, "Ctx");
4192
+ var lst = this[field][key];
4193
+ if (!lst) return false;
4194
+ var flag = lst.splice(lst.indexOf(ctx) >>> 0, 1).length > 0;
4195
+
4196
+ if (!lst.length) {
4197
+ delete this[field][key];
4198
+ }
4199
+
4200
+ return flag;
4201
+ },
4202
+ getFieldCtx: function getFieldCtx(field) {
4203
+ return (this.fieldCtx[field] || [])[0];
4204
+ },
4205
+ getNameCtx: function getNameCtx(name) {
4206
+ return this.nameCtx[name] || [];
4007
4207
  },
4008
4208
  setCtx: function setCtx(ctx) {
4009
4209
  var id = ctx.id,
@@ -4011,9 +4211,9 @@
4011
4211
  name = ctx.name,
4012
4212
  rule = ctx.rule;
4013
4213
  this.ctxs[id] = ctx;
4014
- if (name) $set(this.nameCtx, name, ctx);
4214
+ name && this.setIdCtx(ctx, name, 'name');
4015
4215
  if (!ctx.input) return;
4016
- this.fieldCtx[field] = ctx;
4216
+ this.setIdCtx(ctx, field, 'field');
4017
4217
  this.setFormData(ctx, ctx.parser.toFormValue(rule.value, ctx));
4018
4218
 
4019
4219
  if (this.isMounted && !this.reloading) {
@@ -4047,7 +4247,7 @@
4047
4247
  var _this = this;
4048
4248
 
4049
4249
  var vm = this.vm;
4050
- var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo'];
4250
+ var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4051
4251
  Object.keys(ctx.rule).filter(function (k) {
4052
4252
  return none.indexOf(k) === -1;
4053
4253
  }).forEach(function (key) {
@@ -4056,6 +4256,15 @@
4056
4256
  return ctx.rule[key];
4057
4257
  }, function (n, o) {
4058
4258
  if (_this.loading || _this.noWatchFn || _this.reloading) return;
4259
+
4260
+ if (flag && ctx.parser.loadChildren === false) {
4261
+ _this.$render.clearCache(ctx);
4262
+
4263
+ _this.nextRefresh();
4264
+
4265
+ return;
4266
+ }
4267
+
4059
4268
  _this.watching = true; // if (key === 'hidden')
4060
4269
  // ctx.updateKey(true);
4061
4270
  // else
@@ -4063,13 +4272,13 @@
4063
4272
  if (key === 'link') {
4064
4273
  ctx.link();
4065
4274
  return;
4066
- } else if (['props', 'on', 'nativeOn'].indexOf(key) > -1) {
4275
+ } else if (['props', 'on', 'nativeOn', 'deep'].indexOf(key) > -1) {
4067
4276
  _this.parseInjectEvent(ctx.rule, n || {});
4068
4277
 
4069
4278
  if (key === 'props' && ctx.input) {
4070
4279
  _this.setFormData(ctx, ctx.parser.toFormValue(ctx.rule.value, ctx));
4071
4280
  }
4072
- } else if (['emit', 'nativeEmit'].indexOf(key) > -1) _this.parseEmit(ctx, key === 'emit');else if (key === 'type') {
4281
+ } else if (['emit', 'nativeEmit'].indexOf(key) > -1) _this.parseEmit(ctx, key === 'emit');else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
4073
4282
  ctx.updateType();
4074
4283
 
4075
4284
  _this.bindParser(ctx);
@@ -4110,6 +4319,7 @@
4110
4319
  if (ctx.deleted) return;
4111
4320
  var id = ctx.id,
4112
4321
  field = ctx.field,
4322
+ input = ctx.input,
4113
4323
  name = ctx.name;
4114
4324
 
4115
4325
  if (ctx.input) {
@@ -4120,41 +4330,29 @@
4120
4330
  }
4121
4331
 
4122
4332
  $del(this.ctxs, id);
4123
- $del(this.$render.renderList, id);
4333
+ $del(this.$render.tempList, id);
4124
4334
  $del(this.$render.orgChildren, id);
4335
+ $del(this.vm.ctxInject, id);
4336
+ $del(this.formData, id);
4337
+ $del(this.subForm, id);
4125
4338
  $del(ctx, 'cacheValue');
4126
- var f = this.fieldCtx[field];
4127
-
4128
- if (field && (!f || f === ctx)) {
4129
- $del(this.formData, field);
4130
- $del(this.form, field);
4131
- $del(this.fieldCtx, field);
4132
- $del(this.subForm, field);
4133
- this.vm.$nextTick(function () {
4134
- return _this3.vm.$emit('removeField', field, ctx.rule, _this3.api);
4135
- });
4136
- }
4137
-
4138
- if (name && this.nameCtx[name] === ctx) {
4139
- $del(this.nameCtx, name);
4140
- }
4141
-
4142
- if (!this.reloading) {
4143
- this.deferSyncValue(function () {
4144
- if (is.trueArray(ctx.rule.children)) {
4145
- ctx.rule.children.forEach(function (h) {
4146
- return h.__fc__ && _this3.rmCtx(h.__fc__);
4147
- });
4339
+ input && this.rmIdCtx(ctx, field, 'field');
4340
+ name && this.rmIdCtx(ctx, name, 'name');
4341
+ this.deferSyncValue(function () {
4342
+ if (!_this3.reloading) {
4343
+ if (ctx.parser.loadChildren !== false) {
4344
+ if (is.trueArray(ctx.rule.children)) {
4345
+ ctx.rule.children.forEach(function (h) {
4346
+ return h.__fc__ && _this3.rmCtx(h.__fc__);
4347
+ });
4348
+ }
4148
4349
  }
4149
4350
 
4150
- _this3.syncValue();
4151
- });
4152
-
4153
- if (ctx.root === this.rules) {
4154
- this.vm._renderRule();
4351
+ if (ctx.root === _this3.rules) {
4352
+ _this3.vm._renderRule();
4353
+ }
4155
4354
  }
4156
- }
4157
-
4355
+ }, input);
4158
4356
  var index = this.sort.indexOf(id);
4159
4357
 
4160
4358
  if (index > -1) {
@@ -4164,9 +4362,8 @@
4164
4362
  this.$render.clearCache(ctx);
4165
4363
  ctx["delete"]();
4166
4364
  this.effect(ctx, 'deleted');
4167
- this.vm.$nextTick(function () {
4168
- return _this3.vm.$emit('removeRule', ctx.rule, _this3.api);
4169
- });
4365
+ input && !this.fieldCtx[field] && this.vm.$emit('removeField', field, ctx.rule, this.api);
4366
+ ctx.rule.__ctrl || this.vm.$emit('removeRule', ctx.rule, this.api);
4170
4367
  return ctx;
4171
4368
  }
4172
4369
  });
@@ -4245,6 +4442,13 @@
4245
4442
  }));
4246
4443
  });
4247
4444
  },
4445
+ ruleEffect: function ruleEffect(rule, event, append) {
4446
+ this.emitEffect({
4447
+ rule: rule,
4448
+ input: !!rule.field,
4449
+ type: this.getType(rule.type)
4450
+ }, event, append);
4451
+ },
4248
4452
  effect: function effect(ctx, event, custom) {
4249
4453
  this.emitEffect({
4250
4454
  rule: ctx.rule,
@@ -4254,17 +4458,10 @@
4254
4458
  custom: custom
4255
4459
  }, event);
4256
4460
  },
4257
- ruleEffect: function ruleEffect(rule, event) {
4258
- this.emitEffect({
4259
- rule: rule,
4260
- input: !!rule.field,
4261
- type: this.getType(rule.type)
4262
- }, event);
4263
- },
4264
4461
  getEffect: function getEffect(rule, name) {
4265
4462
  if (hasProperty(rule, 'effect') && hasProperty(rule.effect, name)) return rule.effect[name];else return undefined;
4266
4463
  },
4267
- emitEffect: function emitEffect(_ref, event) {
4464
+ emitEffect: function emitEffect(_ref, event, append) {
4268
4465
  var _this4 = this;
4269
4466
 
4270
4467
  var ctx = _ref.ctx,
@@ -4288,12 +4485,12 @@
4288
4485
  return;
4289
4486
  }
4290
4487
 
4291
- var data = {
4488
+ var data = _objectSpread2({
4292
4489
  value: effect[attr],
4293
4490
  getValue: function getValue() {
4294
4491
  return _this4.getEffect(rule, attr);
4295
4492
  }
4296
- };
4493
+ }, append || {});
4297
4494
 
4298
4495
  if (ctx) {
4299
4496
  data.getProp = function () {
@@ -4370,16 +4567,15 @@
4370
4567
  extend(Handler.prototype, {
4371
4568
  initData: function initData(rules) {
4372
4569
  extend(this, {
4373
- fieldCtx: {},
4374
4570
  ctxs: {},
4571
+ fieldCtx: {},
4375
4572
  nameCtx: {},
4376
4573
  sort: [],
4377
- rules: rules,
4378
- repeatRule: []
4574
+ rules: rules
4379
4575
  });
4380
- useHelper(rules);
4381
4576
  },
4382
4577
  init: function init() {
4578
+ this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.fc.options.formData || {}), this.vm.value || {}), this.appendData);
4383
4579
  this.useProvider();
4384
4580
  this.usePage();
4385
4581
  this.loadRule();
@@ -4473,8 +4669,9 @@
4473
4669
  var fragment = {
4474
4670
  name: NAME$9,
4475
4671
  functional: true,
4672
+ props: ['vnode'],
4476
4673
  render: function render(h, ctx) {
4477
- return ctx.children;
4674
+ return ctx.props.vnode ? ctx.props.vnode : ctx.children;
4478
4675
  }
4479
4676
  };
4480
4677
 
@@ -4806,6 +5003,10 @@
4806
5003
 
4807
5004
  function $form() {
4808
5005
  return _vue.extend($FormCreate(FormCreate));
5006
+ }
5007
+
5008
+ function $vnode() {
5009
+ return _vue.extend(fragment);
4809
5010
  } //todo 检查回调函数作用域
4810
5011
 
4811
5012
 
@@ -4824,9 +5025,14 @@
4824
5025
  return _this.api();
4825
5026
  }
4826
5027
 
5028
+ function factory() {
5029
+ return FormCreateFactory(config);
5030
+ }
5031
+
4827
5032
  function FormCreate(vm, rules, options) {
4828
5033
  extend(this, {
4829
5034
  vm: vm,
5035
+ create: create,
4830
5036
  manager: createManager(config.manager),
4831
5037
  parsers: parsers,
4832
5038
  providers: providers,
@@ -4943,8 +5149,10 @@
4943
5149
  component: component,
4944
5150
  directive: directive,
4945
5151
  register: register,
5152
+ $vnode: $vnode,
4946
5153
  parser: parser,
4947
5154
  use: use,
5155
+ factory: factory,
4948
5156
  componentAlias: componentAlias,
4949
5157
  copyRule: copyRule,
4950
5158
  copyRules: copyRules,
@@ -4995,6 +5203,7 @@
4995
5203
  useAttr($formCreate);
4996
5204
  Vue.prototype.$formCreate = $formCreate;
4997
5205
  Vue.component('FormCreate', $form());
5206
+ Vue.component('FcFragment', $vnode());
4998
5207
  }
4999
5208
  });
5000
5209
  }
@@ -5343,10 +5552,10 @@
5343
5552
  _col = _this$rule$props.col;
5344
5553
  var item = isFalse(rule.wrap.show) ? children : this.$r(mergeProps([rule.wrap, {
5345
5554
  props: _objectSpread2(_objectSpread2({
5346
- label: rule.title.title,
5347
- labelWidth: labelWidth === void 0 ? labelWidth : toString(labelWidth)
5555
+ labelWidth: labelWidth === void 0 ? labelWidth : toString(labelWidth),
5556
+ label: isTitle ? rule.title.title : undefined
5348
5557
  }, rule.wrap || {}), {}, {
5349
- prop: ctx.field,
5558
+ prop: ctx.id,
5350
5559
  rules: rule.validate
5351
5560
  }),
5352
5561
  "class": rule.className,
@@ -5357,6 +5566,7 @@
5357
5566
  return inline === true || isFalse(_col) || isFalse(col.show) ? item : this.makeCol(rule, uni, [item]);
5358
5567
  },
5359
5568
  isTitle: function isTitle(rule) {
5569
+ if (this.options.form.title === false) return false;
5360
5570
  var title = rule.title;
5361
5571
  return !(!title.title && !title["native"] || isFalse(title.show));
5362
5572
  },
@@ -5366,7 +5576,8 @@
5366
5576
  var titleProp = rule.title;
5367
5577
  var infoProp = rule.info;
5368
5578
  var isTip = isTooltip(infoProp);
5369
- var children = [titleProp.title];
5579
+ var form = this.options.form;
5580
+ var children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
5370
5581
 
5371
5582
  var titleFn = function titleFn(pop) {
5372
5583
  return _this.$r(mergeProps([titleProp, {
@@ -5572,7 +5783,7 @@
5572
5783
  return maker;
5573
5784
  }
5574
5785
 
5575
- var css_248z$2 = ".form-create .form-create .el-form-item {\n margin-bottom: 22px;\n}\n\n.form-create .form-create .el-form-item .el-form-item {\n margin-bottom: 0px;\n}\n";
5786
+ var css_248z$2 = ".form-create .form-create .el-form-item {\n margin-bottom: 22px;\n}\n\n.form-create .form-create .el-form-item .el-form-item {\n margin-bottom: 0px;\n}\n\n.form-create{\n transform: rotateZ(0);\n}\n";
5576
5787
  styleInject(css_248z$2);
5577
5788
 
5578
5789
  function tidyBtnProp(btn, def) {
@@ -5601,7 +5812,7 @@
5601
5812
  flag = args;
5602
5813
  }
5603
5814
 
5604
- callback.apply(void 0, _toConsumableArray(flag));
5815
+ callback && callback.apply(void 0, _toConsumableArray(flag));
5605
5816
  });
5606
5817
  };
5607
5818
 
@@ -5634,13 +5845,14 @@
5634
5845
  }
5635
5846
  },
5636
5847
  validateField: function validateField(field, callback) {
5637
- if (!h.fieldCtx[field]) return;
5638
- var sub = h.subForm[field];
5848
+ var ctx = h.getFieldCtx(field);
5849
+ if (!ctx) return;
5850
+ var sub = h.subForm[ctx.id];
5639
5851
  var len = 0;
5640
5852
  var flag;
5641
5853
 
5642
5854
  var validate = function validate() {
5643
- h.$manager.validateField(field, function () {
5855
+ h.$manager.validateField(ctx.id, function () {
5644
5856
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
5645
5857
  args[_key3] = arguments[_key3];
5646
5858
  }
@@ -5648,10 +5860,10 @@
5648
5860
  if (args[0]) {
5649
5861
  flag = args;
5650
5862
  } else if (flag) {
5651
- return callback('子表单验证未通过', flag[1]);
5863
+ return callback && callback('子表单验证未通过', flag[1]);
5652
5864
  }
5653
5865
 
5654
- callback.apply(void 0, _toConsumableArray(flag || args));
5866
+ callback && callback.apply(void 0, _toConsumableArray(flag || args));
5655
5867
  });
5656
5868
  };
5657
5869
 
@@ -5690,23 +5902,25 @@
5690
5902
  var clearSub = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5691
5903
  api.helper.tidyFields(fields).forEach(function (field) {
5692
5904
  if (clearSub) _this.clearSubValidateState(field);
5693
- var ctx = h.fieldCtx[field];
5694
- if (!ctx) return;
5695
- h.$manager.clearValidateState(ctx);
5905
+ h.getCtxs(field).forEach(function (ctx) {
5906
+ h.$manager.clearValidateState(ctx);
5907
+ });
5696
5908
  });
5697
5909
  },
5698
5910
  clearSubValidateState: function clearSubValidateState(fields) {
5699
5911
  api.helper.tidyFields(fields).forEach(function (field) {
5700
- var subForm = h.subForm[field];
5701
- if (!subForm) return;
5912
+ h.getCtxs(field).forEach(function (ctx) {
5913
+ var subForm = h.subForm[ctx.id];
5914
+ if (!subForm) return;
5702
5915
 
5703
- if (Array.isArray(subForm)) {
5704
- subForm.forEach(function (form) {
5705
- form.clearValidateState();
5706
- });
5707
- } else if (subForm) {
5708
- subForm.clearValidateState();
5709
- }
5916
+ if (Array.isArray(subForm)) {
5917
+ subForm.forEach(function (form) {
5918
+ form.clearValidateState();
5919
+ });
5920
+ } else if (subForm) {
5921
+ subForm.clearValidateState();
5922
+ }
5923
+ });
5710
5924
  });
5711
5925
  },
5712
5926
  btn: {
@@ -5809,7 +6023,7 @@
5809
6023
  function elmFormCreate() {
5810
6024
  return FormCreateFactory({
5811
6025
  ui: "".concat("element-ui"),
5812
- version: "".concat("2.5.8"),
6026
+ version: "".concat("2.5.12"),
5813
6027
  manager: manager,
5814
6028
  extendApi: extendApi,
5815
6029
  install: install,