@form-create/element-ui 3.1.29 → 3.1.30

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.1.29
2
+ * @form-create/element-ui v3.1.30
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -261,7 +261,6 @@
261
261
  delete props.value;
262
262
  delete props.label;
263
263
  return vue.createVNode(Type, vue.mergeProps(props, {
264
- "label": value,
265
264
  "value": value,
266
265
  "key": name + index + '-' + value
267
266
  }), {
@@ -1008,7 +1007,6 @@
1008
1007
  delete props.value;
1009
1008
  delete props.label;
1010
1009
  return vue.createVNode(Type, vue.mergeProps(props, {
1011
- "label": value,
1012
1010
  "value": value,
1013
1011
  "key": name + index + '-' + value
1014
1012
  }), {
@@ -1967,6 +1965,142 @@
1967
1965
 
1968
1966
  var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script];
1969
1967
 
1968
+ function toString(val) {
1969
+ return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
1970
+ }
1971
+
1972
+ function toLine(name) {
1973
+ var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
1974
+ if (line.indexOf('-') === 0) line = line.substr(1);
1975
+ return line;
1976
+ }
1977
+ function upper(str) {
1978
+ return str.replace(str[0], str[0].toLocaleUpperCase());
1979
+ }
1980
+
1981
+ function format(type, msg, rule) {
1982
+ return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
1983
+ }
1984
+ function err(msg, rule) {
1985
+ console.error(format('err', msg, rule));
1986
+ }
1987
+ function logError(e) {
1988
+ err(e.toString());
1989
+ console.error(e);
1990
+ }
1991
+
1992
+ var PREFIX = '[[FORM-CREATE-PREFIX-';
1993
+ var SUFFIX = '-FORM-CREATE-SUFFIX]]';
1994
+ var $T = '$FN:';
1995
+ var $TX = '$FNX:';
1996
+ var $ON = '$GLOBAL:';
1997
+ var FUNCTION = 'function';
1998
+ function toJson(obj, space) {
1999
+ return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
2000
+ if (val && val._isVue === true) return undefined;
2001
+
2002
+ if (_typeof(val) !== FUNCTION) {
2003
+ return val;
2004
+ }
2005
+
2006
+ if (val.__json) {
2007
+ return val.__json;
2008
+ }
2009
+
2010
+ if (val.__origin) val = val.__origin;
2011
+ if (val.__emit) return undefined;
2012
+ return PREFIX + val + SUFFIX;
2013
+ }, space);
2014
+ }
2015
+
2016
+ function makeFn(fn) {
2017
+ return new Function('return ' + fn)();
2018
+ }
2019
+
2020
+ function parseFn(fn, mode) {
2021
+ if (fn && is.String(fn) && fn.length > 4) {
2022
+ var v = fn.trim();
2023
+ var flag = false;
2024
+
2025
+ try {
2026
+ if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
2027
+ v = v.replace(SUFFIX, '').replace(PREFIX, '');
2028
+ flag = true;
2029
+ } else if (v.indexOf($T) === 0) {
2030
+ v = v.replace($T, '');
2031
+ flag = true;
2032
+ } else if (v.indexOf($ON) === 0) {
2033
+ var name = v.replace($ON, '');
2034
+
2035
+ v = function v() {
2036
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2037
+ args[_key] = arguments[_key];
2038
+ }
2039
+
2040
+ var callback = args[0].api.getGlobalEvent(name);
2041
+
2042
+ if (callback) {
2043
+ return callback.call.apply(callback, [this].concat(args));
2044
+ }
2045
+
2046
+ return undefined;
2047
+ };
2048
+
2049
+ v.__json = fn;
2050
+ v.__inject = true;
2051
+ return v;
2052
+ } else if (v.indexOf($TX) === 0) {
2053
+ v = makeFn('function($inject){' + v.replace($TX, '') + '}');
2054
+ v.__json = fn;
2055
+ v.__inject = true;
2056
+ return v;
2057
+ } else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
2058
+ flag = true;
2059
+ }
2060
+
2061
+ if (!flag) return fn;
2062
+ var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
2063
+ val.__json = fn;
2064
+ return val;
2065
+ } catch (e) {
2066
+ err("\u89E3\u6790\u5931\u8D25:".concat(v, "\n\nerr: ").concat(e));
2067
+ return undefined;
2068
+ }
2069
+ }
2070
+
2071
+ return fn;
2072
+ }
2073
+ function parseJson(json, mode) {
2074
+ return JSON.parse(json, function (k, v) {
2075
+ if (is.Undef(v) || !v.indexOf) return v;
2076
+ return parseFn(v, mode);
2077
+ });
2078
+ }
2079
+
2080
+ var id$2 = 0;
2081
+ function uniqueId() {
2082
+ var num = 370 + ++id$2;
2083
+ return 'F' + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now())).toString(36) + num.toString(36) + 'c';
2084
+ }
2085
+
2086
+ function deepSet(data, idx, val) {
2087
+ var _data = data,
2088
+ to;
2089
+ (idx || '').split('.').forEach(function (v) {
2090
+ if (to) {
2091
+ if (!_data[to] || _typeof(_data[to]) != 'object') {
2092
+ _data[to] = {};
2093
+ }
2094
+
2095
+ _data = _data[to];
2096
+ }
2097
+
2098
+ to = v;
2099
+ });
2100
+ _data[to] = val;
2101
+ return _data;
2102
+ }
2103
+
1970
2104
  var NAME$1 = 'FormCreate';
1971
2105
 
1972
2106
  var getRuleInject = function getRuleInject(vm, parent) {
@@ -2004,7 +2138,10 @@
2004
2138
  },
2005
2139
  extendOption: Boolean,
2006
2140
  modelValue: Object,
2007
- disabled: Boolean,
2141
+ disabled: {
2142
+ type: Boolean,
2143
+ "default": undefined
2144
+ },
2008
2145
  api: Object,
2009
2146
  name: String,
2010
2147
  subForm: {
@@ -2013,7 +2150,7 @@
2013
2150
  },
2014
2151
  inFor: Boolean
2015
2152
  },
2016
- emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail'],
2153
+ emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
2017
2154
  render: function render() {
2018
2155
  return this.fc.render();
2019
2156
  },
@@ -2076,10 +2213,37 @@
2076
2213
  }
2077
2214
  };
2078
2215
 
2216
+ var styleEl = null;
2217
+ vue.onBeforeMount(function () {
2218
+ var content = '';
2219
+ var globalClass = props.option && props.option.globalClass || {};
2220
+ Object.keys(globalClass).forEach(function (k) {
2221
+ var subCss = '';
2222
+ globalClass[k].style && Object.keys(globalClass[k].style).forEach(function (key) {
2223
+ subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
2224
+ });
2225
+
2226
+ if (globalClass[k].content) {
2227
+ subCss += globalClass[k].content + ';';
2228
+ }
2229
+
2230
+ if (subCss) {
2231
+ content += ".".concat(k, "{").concat(subCss, "}");
2232
+ }
2233
+ });
2234
+
2235
+ if (content) {
2236
+ styleEl = document.createElement('style');
2237
+ styleEl.type = 'text/css';
2238
+ styleEl.innerHTML = content;
2239
+ document.head.appendChild(styleEl);
2240
+ }
2241
+ });
2079
2242
  vue.onMounted(function () {
2080
2243
  fc.mounted();
2081
2244
  });
2082
2245
  vue.onBeforeUnmount(function () {
2246
+ styleEl && document.head.removeChild(styleEl);
2083
2247
  rmSubForm();
2084
2248
  data.destroyed = true;
2085
2249
  fc.unmount();
@@ -2109,17 +2273,17 @@
2109
2273
  }, {
2110
2274
  deep: true
2111
2275
  });
2276
+ vue.watch(function () {
2277
+ return props.disabled;
2278
+ }, function () {
2279
+ fapi.refresh();
2280
+ });
2112
2281
  vue.watch(modelValue, function (n) {
2113
2282
  if (JSON.stringify(n || {}) === data.updateValue) return;
2114
2283
  fapi.config.forceCoverValue ? fapi.coverValue(n || {}) : fapi.setValue(n || {});
2115
2284
  }, {
2116
2285
  deep: true
2117
2286
  });
2118
- vue.watch(function () {
2119
- return props.disabled;
2120
- }, function (n) {
2121
- fapi.disabled(!!n);
2122
- });
2123
2287
  return _objectSpread2(_objectSpread2({
2124
2288
  fc: vue.markRaw(fc),
2125
2289
  parent: parent ? vue.markRaw(parent) : parent,
@@ -2133,16 +2297,21 @@
2133
2297
  },
2134
2298
  updateValue: function updateValue(value) {
2135
2299
  if (data.destroyed) return;
2136
- data.updateValue = JSON.stringify(value);
2300
+ var json = JSON.stringify(value);
2301
+
2302
+ if (data.updateValue === json) {
2303
+ return;
2304
+ }
2305
+
2306
+ data.updateValue = json;
2137
2307
  vm.emit('update:modelValue', value);
2138
2308
  }
2139
2309
  });
2140
2310
  },
2141
2311
  created: function created() {
2142
2312
  var vm = vue.getCurrentInstance();
2143
- vm.setupState.fc.init();
2144
2313
  vm.emit('update:api', vm.setupState.fapi);
2145
- vm.props.disabled && vm.setupState.fapi.disabled(true);
2314
+ vm.setupState.fc.init();
2146
2315
  }
2147
2316
  });
2148
2317
  }
@@ -2223,114 +2392,6 @@
2223
2392
  return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
2224
2393
  }
2225
2394
 
2226
- function format(type, msg, rule) {
2227
- return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
2228
- }
2229
- function err(msg, rule) {
2230
- console.error(format('err', msg, rule));
2231
- }
2232
- function logError(e) {
2233
- err(e.toString());
2234
- console.error(e);
2235
- }
2236
-
2237
- function toLine(name) {
2238
- var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
2239
- if (line.indexOf('-') === 0) line = line.substr(1);
2240
- return line;
2241
- }
2242
- function upper(str) {
2243
- return str.replace(str[0], str[0].toLocaleUpperCase());
2244
- }
2245
-
2246
- var PREFIX = '[[FORM-CREATE-PREFIX-';
2247
- var SUFFIX = '-FORM-CREATE-SUFFIX]]';
2248
- var $T = '$FN:';
2249
- var $TX = '$FNX:';
2250
- var $ON = '$GLOBAL:';
2251
- var FUNCTION = 'function';
2252
- function toJson(obj, space) {
2253
- return JSON.stringify(deepExtend([], obj, true), function (key, val) {
2254
- if (val && val._isVue === true) return undefined;
2255
-
2256
- if (_typeof(val) !== FUNCTION) {
2257
- return val;
2258
- }
2259
-
2260
- if (val.__json) {
2261
- return val.__json;
2262
- }
2263
-
2264
- if (val.__origin) val = val.__origin;
2265
- if (val.__emit) return undefined;
2266
- return PREFIX + val + SUFFIX;
2267
- }, space);
2268
- }
2269
-
2270
- function makeFn(fn) {
2271
- return new Function('return ' + fn)();
2272
- }
2273
-
2274
- function parseFn(fn, mode) {
2275
- if (fn && is.String(fn) && fn.length > 4) {
2276
- var v = fn.trim();
2277
- var flag = false;
2278
-
2279
- try {
2280
- if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
2281
- v = v.replace(SUFFIX, '').replace(PREFIX, '');
2282
- flag = true;
2283
- } else if (v.indexOf($T) === 0) {
2284
- v = v.replace($T, '');
2285
- flag = true;
2286
- } else if (v.indexOf($ON) === 0) {
2287
- var name = v.replace($ON, '');
2288
-
2289
- v = function v() {
2290
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2291
- args[_key] = arguments[_key];
2292
- }
2293
-
2294
- var callback = args[0].api.getGlobalEvent(name);
2295
-
2296
- if (callback) {
2297
- return callback.call.apply(callback, [this].concat(args));
2298
- }
2299
-
2300
- return undefined;
2301
- };
2302
-
2303
- v.__json = fn;
2304
- v.__inject = true;
2305
- return v;
2306
- } else if (v.indexOf($TX) === 0) {
2307
- v = makeFn('function($inject){' + v.replace($TX, '') + '}');
2308
- v.__json = fn;
2309
- v.__inject = true;
2310
- return v;
2311
- } else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
2312
- flag = true;
2313
- }
2314
-
2315
- if (!flag) return fn;
2316
- var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
2317
- val.__json = fn;
2318
- return val;
2319
- } catch (e) {
2320
- err("\u89E3\u6790\u5931\u8D25:".concat(v, "\n\nerr: ").concat(e));
2321
- return undefined;
2322
- }
2323
- }
2324
-
2325
- return fn;
2326
- }
2327
- function parseJson(json, mode) {
2328
- return JSON.parse(json, function (k, v) {
2329
- if (is.Undef(v) || !v.indexOf) return v;
2330
- return parseFn(v, mode);
2331
- });
2332
- }
2333
-
2334
2395
  function enumerable(value, writable) {
2335
2396
  return {
2336
2397
  value: value,
@@ -2980,6 +3041,23 @@
2980
3041
  return origin ? ctx.origin : ctx.rule;
2981
3042
  }
2982
3043
  },
3044
+ getRenderRule: function getRenderRule(id) {
3045
+ var ctx = h.getCtx(id);
3046
+
3047
+ if (ctx) {
3048
+ return ctx.prop;
3049
+ }
3050
+ },
3051
+ getRefRule: function getRefRule(id) {
3052
+ var ctxs = h.getCtxs(id);
3053
+
3054
+ if (ctxs) {
3055
+ var rules = ctxs.map(function (ctx) {
3056
+ return ctx.rule;
3057
+ });
3058
+ return rules.length === 1 ? rules[0] : rules;
3059
+ }
3060
+ },
2983
3061
  setEffect: function setEffect(id, attr, value) {
2984
3062
  var ctx = h.getCtx(id);
2985
3063
 
@@ -3142,7 +3220,7 @@
3142
3220
  }
3143
3221
 
3144
3222
  if (config.type === 'fetch') {
3145
- asyncFetch(config).then(function (res) {
3223
+ api.fetch(config).then(function (res) {
3146
3224
  resolve({
3147
3225
  res: res,
3148
3226
  config: config
@@ -3173,12 +3251,21 @@
3173
3251
 
3174
3252
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
3175
3253
  },
3254
+ bus: h.bus,
3255
+ fetch: function fetch(opt) {
3256
+ h.options.beforeFetch && invoke(function () {
3257
+ return h.options.beforeFetch(opt, {
3258
+ api: api
3259
+ });
3260
+ });
3261
+ return asyncFetch(opt);
3262
+ },
3176
3263
  helper: {
3177
3264
  tidyFields: tidyFields,
3178
3265
  props: props
3179
3266
  }
3180
3267
  };
3181
- ['on', 'once', 'off', 'set'].forEach(function (n) {
3268
+ ['on', 'once', 'off'].forEach(function (n) {
3182
3269
  api[n] = function () {
3183
3270
  var _h$bus;
3184
3271
 
@@ -3200,6 +3287,10 @@
3200
3287
  }
3201
3288
 
3202
3289
  if (!this.cache[ctx.id]) {
3290
+ if (ctx.parent) {
3291
+ this.clearCache(ctx.parent);
3292
+ }
3293
+
3203
3294
  return;
3204
3295
  }
3205
3296
 
@@ -3207,6 +3298,10 @@
3207
3298
  this.$handle.refresh();
3208
3299
  }
3209
3300
 
3301
+ if (this.cache[ctx.id].parent) {
3302
+ this.clearCache(this.cache[ctx.id].parent);
3303
+ }
3304
+
3210
3305
  this.cache[ctx.id] = null;
3211
3306
  },
3212
3307
  clearCacheAll: function clearCacheAll() {
@@ -3243,34 +3338,6 @@
3243
3338
  return str.replace(str[0], str[0].toLowerCase());
3244
3339
  }
3245
3340
 
3246
- function toString(val) {
3247
- return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
3248
- }
3249
-
3250
- var id$2 = 0;
3251
- function uniqueId() {
3252
- var num = 370 + ++id$2;
3253
- return 'F' + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now())).toString(36) + num.toString(36) + 'c';
3254
- }
3255
-
3256
- function deepSet(data, idx, val) {
3257
- var _data = data,
3258
- to;
3259
- (idx || '').split('.').forEach(function (v) {
3260
- if (to) {
3261
- if (!_data[to] || _typeof(_data[to]) != 'object') {
3262
- _data[to] = {};
3263
- }
3264
-
3265
- _data = _data[to];
3266
- }
3267
-
3268
- to = v;
3269
- });
3270
- _data[to] = val;
3271
- return _data;
3272
- }
3273
-
3274
3341
  function useRender$1(Render) {
3275
3342
  extend(Render.prototype, {
3276
3343
  initRender: function initRender() {
@@ -3472,8 +3539,8 @@
3472
3539
  }
3473
3540
  }
3474
3541
 
3475
- cacheFlag && !Object.keys(children).length && _this4.setCache(ctx, function () {
3476
- return _vn;
3542
+ cacheFlag && _this4.setCache(ctx, function () {
3543
+ return _this4.stable(_vn);
3477
3544
  }, parent);
3478
3545
  return _vn;
3479
3546
  };
@@ -3506,12 +3573,25 @@
3506
3573
  if (Array.isArray(vn.props["class"])) {
3507
3574
  vn.props["class"].push('fc-none');
3508
3575
  } else {
3509
- vn.props["class"] = [vn.props["class"], 'fc-none'];
3576
+ vn.props["class"] = vn.props["class"] ? [vn.props["class"], 'fc-none'] : 'fc-none';
3510
3577
  }
3511
3578
 
3512
3579
  return vn;
3513
3580
  }
3514
3581
  },
3582
+ stable: function stable(vn) {
3583
+ var _this5 = this;
3584
+
3585
+ var list = Array.isArray(vn) ? vn : [vn];
3586
+ list.forEach(function (v) {
3587
+ if (v && v.__v_isVNode && v.children && _typeof(v.children) === 'object') {
3588
+ v.children.$stable = true;
3589
+
3590
+ _this5.stable(v.children);
3591
+ }
3592
+ });
3593
+ return vn;
3594
+ },
3515
3595
  getModelField: function getModelField(ctx) {
3516
3596
  return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.type]] || this.fc.modelFields[ctx.type] || this.fc.modelFields[ctx.originType] || 'modelValue';
3517
3597
  },
@@ -3519,7 +3599,7 @@
3519
3599
  return ctx.type === 'fragment' || ctx.type === 'template';
3520
3600
  },
3521
3601
  injectProp: function injectProp(ctx) {
3522
- var _this5 = this;
3602
+ var _this6 = this;
3523
3603
 
3524
3604
  var state = this.vm.setupState;
3525
3605
 
@@ -3528,10 +3608,10 @@
3528
3608
  api: this.$handle.api,
3529
3609
  form: this.fc.create,
3530
3610
  subForm: function subForm(_subForm) {
3531
- _this5.$handle.addSubForm(ctx, _subForm);
3611
+ _this6.$handle.addSubForm(ctx, _subForm);
3532
3612
  },
3533
3613
  getSubForm: function getSubForm() {
3534
- return _this5.$handle.subForm[ctx.id];
3614
+ return _this6.$handle.subForm[ctx.id];
3535
3615
  },
3536
3616
  options: [],
3537
3617
  children: [],
@@ -3551,14 +3631,14 @@
3551
3631
  });
3552
3632
  return inject;
3553
3633
  },
3554
- ctxProp: function ctxProp(ctx, custom) {
3555
- var _this6 = this;
3634
+ ctxProp: function ctxProp(ctx) {
3635
+ var _this7 = this;
3556
3636
 
3557
3637
  var ref = ctx.ref,
3558
3638
  key = ctx.key,
3559
3639
  rule = ctx.rule;
3560
- this.$manager.mergeProp(ctx, custom);
3561
- ctx.parser.mergeProp(ctx, custom);
3640
+ this.$manager.mergeProp(ctx);
3641
+ ctx.parser.mergeProp(ctx);
3562
3642
  var props = [{
3563
3643
  ref: ref,
3564
3644
  key: rule.key || "".concat(key, "fc"),
@@ -3567,7 +3647,7 @@
3567
3647
  vnodeMounted: function vnodeMounted(vn) {
3568
3648
  vn.el.__rule__ = ctx.rule;
3569
3649
 
3570
- _this6.onMounted(ctx, vn.el);
3650
+ _this7.onMounted(ctx, vn.el);
3571
3651
  },
3572
3652
  'fc.el': function fcEl(el) {
3573
3653
  ctx.exportEl = el;
@@ -3579,17 +3659,21 @@
3579
3659
  }
3580
3660
  }];
3581
3661
 
3582
- if (!custom && ctx.input) {
3662
+ if (ctx.input) {
3663
+ if (this.vm.props.disabled !== undefined) {
3664
+ ctx.prop.props.disabled = !!this.vm.props.disabled;
3665
+ }
3666
+
3583
3667
  var field = this.getModelField(ctx);
3584
3668
  var model = {
3585
3669
  callback: function callback(value) {
3586
- _this6.onInput(ctx, value);
3670
+ _this7.onInput(ctx, value);
3587
3671
  },
3588
3672
  value: this.$handle.getFormData(ctx)
3589
3673
  };
3590
3674
  props.push({
3591
3675
  on: _objectSpread2(_defineProperty({}, "update:".concat(field), model.callback), ctx.prop.modelEmit ? _defineProperty({}, ctx.prop.modelEmit, function () {
3592
- return _this6.onEmitInput(ctx);
3676
+ return _this7.onEmitInput(ctx);
3593
3677
  }) : {}),
3594
3678
  props: _defineProperty({}, field, model.value)
3595
3679
  });
@@ -3616,7 +3700,7 @@
3616
3700
  this.$handle.setValue(ctx, ctx.parser.toValue(ctx.modelValue, ctx), ctx.modelValue);
3617
3701
  },
3618
3702
  renderChildren: function renderChildren(children, ctx) {
3619
- var _this7 = this;
3703
+ var _this8 = this;
3620
3704
 
3621
3705
  if (!is.trueArray(children)) return {};
3622
3706
  var slotBag = makeSlotBag();
@@ -3625,14 +3709,14 @@
3625
3709
  if (is.String(child)) return slotBag.setSlot(null, child);
3626
3710
 
3627
3711
  if (child.__fc__) {
3628
- return _this7.renderSlot(slotBag, child.__fc__, ctx);
3712
+ return _this8.renderSlot(slotBag, child.__fc__, ctx);
3629
3713
  }
3630
3714
 
3631
3715
  if (child.type) {
3632
3716
  vue.nextTick(function () {
3633
- _this7.$handle.loadChildren(children, ctx);
3717
+ _this8.$handle.loadChildren(children, ctx);
3634
3718
 
3635
- _this7.$handle.refresh();
3719
+ _this8.$handle.refresh();
3636
3720
  });
3637
3721
  }
3638
3722
  });
@@ -3646,7 +3730,7 @@
3646
3730
  return this.vNode.make(lower(ctx.originType), prop, children);
3647
3731
  },
3648
3732
  renderRule: function renderRule(rule, children, origin) {
3649
- var _this8 = this;
3733
+ var _this9 = this;
3650
3734
 
3651
3735
  if (!rule) return undefined;
3652
3736
  if (is.String(rule)) return rule;
@@ -3670,7 +3754,7 @@
3670
3754
  if (is.trueArray(rule.children)) {
3671
3755
  rule.children.forEach(function (v) {
3672
3756
  v && slotBag.setSlot(v === null || v === void 0 ? void 0 : v.slot, function () {
3673
- return _this8.renderRule(v);
3757
+ return _this9.renderRule(v);
3674
3758
  });
3675
3759
  });
3676
3760
  }
@@ -3751,23 +3835,27 @@
3751
3835
  var emit = rule.emit || [];
3752
3836
 
3753
3837
  if (is.trueArray(emit)) {
3754
- var emitKey = emitPrefix || field || name;
3755
-
3756
- if (emitKey) {
3757
- emit.forEach(function (eventName) {
3758
- if (!eventName) return;
3759
- var eventInject;
3760
-
3761
- if (is.Object(eventName)) {
3762
- eventInject = eventName.inject;
3763
- eventName = eventName.name;
3764
- }
3838
+ emit.forEach(function (eventName) {
3839
+ if (!eventName) return;
3840
+ var eventInject;
3841
+ var emitKey = emitPrefix || field || name;
3842
+
3843
+ if (is.Object(eventName)) {
3844
+ eventInject = eventName.inject;
3845
+ eventName = eventName.name;
3846
+ emitKey = eventName.prefix || emitKey;
3847
+ }
3765
3848
 
3849
+ if (emitKey) {
3766
3850
  var fieldKey = toLine("".concat(emitKey, "-").concat(eventName));
3767
3851
 
3768
3852
  var fn = function fn() {
3769
3853
  var _this2$vm, _this2$vm2, _this2$bus;
3770
3854
 
3855
+ if (_this2.vm.emitsOptions) {
3856
+ _this2.vm.emitsOptions[fieldKey] = null;
3857
+ }
3858
+
3771
3859
  for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
3772
3860
  arg[_key] = arguments[_key];
3773
3861
  }
@@ -3788,8 +3876,8 @@
3788
3876
 
3789
3877
  event[eventName] = is.Undef(_inject) ? fn : _this2.inject(rule, fn, _inject);
3790
3878
  }
3791
- });
3792
- }
3879
+ }
3880
+ });
3793
3881
  }
3794
3882
 
3795
3883
  ctx.computed.on = event;
@@ -4104,6 +4192,20 @@
4104
4192
  initNone: function initNone() {
4105
4193
  this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
4106
4194
  },
4195
+ injectValidate: function injectValidate() {
4196
+ var _this4 = this;
4197
+
4198
+ return toArray(this.prop.validate).map(function (item) {
4199
+ return _objectSpread2(_objectSpread2({}, item), {}, {
4200
+ inject: {
4201
+ id: _this4.id,
4202
+ field: _this4.field,
4203
+ rule: _this4.rule,
4204
+ api: _this4.$handle.api
4205
+ }
4206
+ });
4207
+ });
4208
+ },
4107
4209
  check: function check(handle) {
4108
4210
  return this.vm === handle.vm;
4109
4211
  },
@@ -4160,15 +4262,15 @@
4160
4262
  this.ctrlRule = [];
4161
4263
  },
4162
4264
  rm: function rm() {
4163
- var _this4 = this;
4265
+ var _this5 = this;
4164
4266
 
4165
4267
  var _rm = function _rm() {
4166
- var index = _this4.root.indexOf(_this4.origin);
4268
+ var index = _this5.root.indexOf(_this5.origin);
4167
4269
 
4168
4270
  if (index > -1) {
4169
- _this4.root.splice(index, 1);
4271
+ _this5.root.splice(index, 1);
4170
4272
 
4171
- _this4.$handle && _this4.$handle.refresh();
4273
+ _this5.$handle && _this5.$handle.refresh();
4172
4274
  }
4173
4275
  };
4174
4276
 
@@ -4179,17 +4281,17 @@
4179
4281
  }
4180
4282
 
4181
4283
  this.$handle.noWatch(function () {
4182
- _this4.$handle.deferSyncValue(function () {
4183
- _this4.rmCtrl();
4284
+ _this5.$handle.deferSyncValue(function () {
4285
+ _this5.rmCtrl();
4184
4286
 
4185
4287
  _rm();
4186
4288
 
4187
- _this4.$handle.rmCtx(_this4);
4289
+ _this5.$handle.rmCtx(_this5);
4188
4290
 
4189
- extend(_this4, {
4291
+ extend(_this5, {
4190
4292
  root: []
4191
4293
  });
4192
- }, _this4.input);
4294
+ }, _this5.input);
4193
4295
  });
4194
4296
  },
4195
4297
  update: function update(handle, init) {
@@ -4729,6 +4831,11 @@
4729
4831
  this.valueChange(ctx, value);
4730
4832
  this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
4731
4833
  this.effect(ctx, 'value');
4834
+ this.emitEvent('change', ctx.field, value, {
4835
+ rule: ctx.origin,
4836
+ api: this.api,
4837
+ setFlag: setFlag || false
4838
+ });
4732
4839
  },
4733
4840
  onInput: function onInput(ctx, value) {
4734
4841
  var val;
@@ -4820,13 +4927,14 @@
4820
4927
  isQuote: function isQuote(ctx, value) {
4821
4928
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
4822
4929
  },
4823
- refreshUpdate: function refreshUpdate(ctx, val, origin) {
4930
+ refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
4824
4931
  var _this2 = this;
4825
4932
 
4826
4933
  if (is.Function(ctx.rule.update)) {
4827
4934
  var state = invoke(function () {
4828
4935
  return ctx.rule.update(val, ctx.origin, _this2.api, {
4829
- origin: origin || 'change'
4936
+ origin: origin || 'change',
4937
+ linkField: field
4830
4938
  });
4831
4939
  });
4832
4940
  if (state === undefined) return;
@@ -4837,7 +4945,7 @@
4837
4945
  this.refreshRule(ctx, val);
4838
4946
  this.bus.$emit('change-' + ctx.field, val);
4839
4947
  },
4840
- refreshRule: function refreshRule(ctx, val, origin) {
4948
+ refreshRule: function refreshRule(ctx, val, origin, field) {
4841
4949
  if (this.refreshControl(ctx)) {
4842
4950
  this.$render.clearCacheAll();
4843
4951
  this.loadRule();
@@ -4845,7 +4953,7 @@
4845
4953
  this.refresh();
4846
4954
  }
4847
4955
 
4848
- this.refreshUpdate(ctx, val, origin);
4956
+ this.refreshUpdate(ctx, val, origin, field);
4849
4957
  },
4850
4958
  appendLink: function appendLink(ctx) {
4851
4959
  var _this3 = this;
@@ -4853,7 +4961,7 @@
4853
4961
  var link = ctx.rule.link;
4854
4962
  is.trueArray(link) && link.forEach(function (field) {
4855
4963
  var fn = function fn() {
4856
- return _this3.refreshRule(ctx, ctx.rule.value, 'link');
4964
+ return _this3.refreshRule(ctx, ctx.rule.value, 'link', field);
4857
4965
  };
4858
4966
 
4859
4967
  _this3.bus.$on('change-' + field, fn);
@@ -5002,7 +5110,11 @@
5002
5110
  if (key === 'props' && ctx.input) {
5003
5111
  _this.setFormData(ctx, ctx.parser.toFormValue(ctx.rule.value, ctx));
5004
5112
  }
5005
- } else if (key === 'emit') _this.parseEmit(ctx);else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
5113
+ } else if (key === 'emit') {
5114
+ _this.parseEmit(ctx);
5115
+ } else if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
5116
+ _this.$render.clearCacheAll();
5117
+ } else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
5006
5118
  ctx.updateType();
5007
5119
 
5008
5120
  _this.bindParser(ctx);
@@ -5040,47 +5152,55 @@
5040
5152
  _this.setValue(ctx, val.value, formValue, true);
5041
5153
  }
5042
5154
  }));
5043
- this.bus.$once('load-end', function () {
5044
- var computed = ctx.rule.computed;
5155
+ }
5045
5156
 
5046
- if (!computed) {
5047
- return;
5048
- }
5157
+ this.bus.$once('load-end', function () {
5158
+ var computed = ctx.rule.computed;
5049
5159
 
5050
- if (_typeof(computed) !== 'object') {
5051
- computed = {
5052
- value: computed
5053
- };
5054
- }
5160
+ if (!computed) {
5161
+ return;
5162
+ }
5055
5163
 
5056
- Object.keys(computed).forEach(function (k) {
5057
- ctx.watch.push(vue.watch(function () {
5058
- var item = computed[k];
5059
- if (!item) return undefined;
5060
- var fn;
5164
+ if (_typeof(computed) !== 'object') {
5165
+ computed = {
5166
+ value: computed
5167
+ };
5168
+ }
5061
5169
 
5062
- if (is.Function(item)) {
5063
- fn = function fn() {
5064
- return item(_this.api.form, _this.api);
5065
- };
5066
- } else {
5067
- var group = ctx.getParentGroup();
5170
+ Object.keys(computed).forEach(function (k) {
5171
+ ctx.watch.push(vue.watch(function () {
5172
+ var item = computed[k];
5173
+ if (!item) return undefined;
5174
+ var fn;
5068
5175
 
5069
- fn = function fn() {
5070
- return new Function('formulas', 'top', 'group', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {});
5071
- };
5072
- }
5176
+ if (is.Function(item)) {
5177
+ fn = function fn() {
5178
+ return item(_this.api.form, _this.api);
5179
+ };
5180
+ } else {
5181
+ var group = ctx.getParentGroup();
5073
5182
 
5074
- return invoke(fn, undefined);
5075
- }, function (n) {
5076
- deepSet(ctx.rule, k, n);
5077
- }, {
5078
- immediate: true
5079
- }));
5080
- });
5081
- });
5082
- }
5183
+ fn = function fn() {
5184
+ return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {}, ctx.rule, _this.api);
5185
+ };
5186
+ }
5083
5187
 
5188
+ return invoke(fn, undefined);
5189
+ }, function (n) {
5190
+ setTimeout(function () {
5191
+ if (k === 'value') {
5192
+ _this.onInput(ctx, n);
5193
+ } else if (k[0] === '$') {
5194
+ _this.api.setEffect(ctx.id, k, n);
5195
+ } else {
5196
+ deepSet(ctx.rule, k, n);
5197
+ }
5198
+ });
5199
+ }, {
5200
+ immediate: true
5201
+ }));
5202
+ });
5203
+ });
5084
5204
  this.watchEffect(ctx);
5085
5205
  },
5086
5206
  updateChildren: function updateChildren(ctx, n, o) {
@@ -5187,13 +5307,26 @@
5187
5307
  }
5188
5308
  },
5189
5309
  lifecycle: function lifecycle(name) {
5190
- var _this2 = this;
5191
-
5192
- var fn = this.options[name];
5193
- is.Function(fn) && invoke(function () {
5194
- return fn(_this2.api);
5195
- });
5196
5310
  this.vm.emit(name, this.api);
5311
+ this.emitEvent(name, this.api);
5312
+ },
5313
+ emitEvent: function emitEvent(name) {
5314
+ var _this$bus;
5315
+
5316
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5317
+ args[_key - 1] = arguments[_key];
5318
+ }
5319
+
5320
+ var _fn = this.options[name] || this.options[toCase('on-' + name)];
5321
+
5322
+ if (_fn) {
5323
+ var fn = parseFn(_fn);
5324
+ is.Function(fn) && invoke(function () {
5325
+ return fn.apply(void 0, args);
5326
+ });
5327
+ }
5328
+
5329
+ (_this$bus = this.bus).$emit.apply(_this$bus, [name].concat(args));
5197
5330
  }
5198
5331
  });
5199
5332
  }
@@ -5420,6 +5553,8 @@
5420
5553
  this.loadRule();
5421
5554
 
5422
5555
  this.$manager.__init();
5556
+
5557
+ this.lifecycle('created');
5423
5558
  },
5424
5559
  isBreakWatch: function isBreakWatch() {
5425
5560
  return this.loading || this.noWatchFn || this.reloading;
@@ -6174,7 +6309,7 @@
6174
6309
  },
6175
6310
  mergeOptions: function mergeOptions(target, opt, parent) {
6176
6311
  opt = deepCopy(opt);
6177
- parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el'].forEach(function (n) {
6312
+ parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach(function (n) {
6178
6313
  delete opt[n];
6179
6314
  });
6180
6315
 
@@ -6562,8 +6697,8 @@
6562
6697
  var form = _this.form();
6563
6698
 
6564
6699
  if (form) {
6565
- form.validateField(field, function (res) {
6566
- res ? reject(res) : resolve(null);
6700
+ form.validateField(field, function (res, err) {
6701
+ err ? reject(err) : resolve(res);
6567
6702
  });
6568
6703
  } else {
6569
6704
  resolve();
@@ -6667,7 +6802,7 @@
6667
6802
  label: isTitle ? rule.title.title : undefined
6668
6803
  }, tidyRule(rule.wrap || {})), {}, {
6669
6804
  prop: ctx.id,
6670
- rules: rule.validate
6805
+ rules: ctx.injectValidate()
6671
6806
  }),
6672
6807
  "class": rule.className,
6673
6808
  key: "".concat(uni, "fi"),
@@ -6929,7 +7064,7 @@
6929
7064
  return maker;
6930
7065
  }
6931
7066
 
6932
- var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .fc-clock{display:none!important}";
7067
+ var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .fc-clock{display:none!important}.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before{content:\"\"!important}";
6933
7068
  styleInject(css_248z);
6934
7069
 
6935
7070
  function tidyBtnProp(btn, def) {
@@ -7112,6 +7247,7 @@
7112
7247
 
7113
7248
  if (val.required === false) {
7114
7249
  inject.clearProp();
7250
+ api.clearValidateState([rule.field]);
7115
7251
  } else {
7116
7252
  var validate = _objectSpread2({
7117
7253
  required: true,
@@ -7182,7 +7318,7 @@
7182
7318
  function elmFormCreate() {
7183
7319
  return FormCreateFactory({
7184
7320
  ui: 'element-ui',
7185
- version: '3.1.29',
7321
+ version: '3.1.30',
7186
7322
  manager: manager,
7187
7323
  extendApi: extendApi,
7188
7324
  install: install,