@form-create/element-ui 3.1.29 → 3.1.31

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,10 +1,10 @@
1
1
  /*!
2
- * @form-create/element-ui v3.1.29
2
+ * @form-create/element-ui v3.1.31
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
6
6
  */
7
- import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, watch, reactive, getCurrentInstance, provide, inject, toRefs, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
7
+ import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, watch, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
8
8
 
9
9
  function ownKeys(object, enumerableOnly) {
10
10
  var keys = Object.keys(object);
@@ -257,7 +257,7 @@ var Checkbox = defineComponent({
257
257
  delete props.value;
258
258
  delete props.label;
259
259
  return createVNode(Type, mergeProps$1(props, {
260
- "label": value,
260
+ "label": label,
261
261
  "value": value,
262
262
  "key": name + index + '-' + value
263
263
  }), {
@@ -1004,7 +1004,7 @@ var Radio = defineComponent({
1004
1004
  delete props.value;
1005
1005
  delete props.label;
1006
1006
  return createVNode(Type, mergeProps$1(props, {
1007
- "label": value,
1007
+ "label": label,
1008
1008
  "value": value,
1009
1009
  "key": name + index + '-' + value
1010
1010
  }), {
@@ -1963,6 +1963,142 @@ script.render = render;
1963
1963
 
1964
1964
  var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script];
1965
1965
 
1966
+ function toString(val) {
1967
+ return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
1968
+ }
1969
+
1970
+ function toLine(name) {
1971
+ var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
1972
+ if (line.indexOf('-') === 0) line = line.substr(1);
1973
+ return line;
1974
+ }
1975
+ function upper(str) {
1976
+ return str.replace(str[0], str[0].toLocaleUpperCase());
1977
+ }
1978
+
1979
+ function format(type, msg, rule) {
1980
+ return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
1981
+ }
1982
+ function err(msg, rule) {
1983
+ console.error(format('err', msg, rule));
1984
+ }
1985
+ function logError(e) {
1986
+ err(e.toString());
1987
+ console.error(e);
1988
+ }
1989
+
1990
+ var PREFIX = '[[FORM-CREATE-PREFIX-';
1991
+ var SUFFIX = '-FORM-CREATE-SUFFIX]]';
1992
+ var $T = '$FN:';
1993
+ var $TX = '$FNX:';
1994
+ var $ON = '$GLOBAL:';
1995
+ var FUNCTION = 'function';
1996
+ function toJson(obj, space) {
1997
+ return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
1998
+ if (val && val._isVue === true) return undefined;
1999
+
2000
+ if (_typeof(val) !== FUNCTION) {
2001
+ return val;
2002
+ }
2003
+
2004
+ if (val.__json) {
2005
+ return val.__json;
2006
+ }
2007
+
2008
+ if (val.__origin) val = val.__origin;
2009
+ if (val.__emit) return undefined;
2010
+ return PREFIX + val + SUFFIX;
2011
+ }, space);
2012
+ }
2013
+
2014
+ function makeFn(fn) {
2015
+ return new Function('return ' + fn)();
2016
+ }
2017
+
2018
+ function parseFn(fn, mode) {
2019
+ if (fn && is.String(fn) && fn.length > 4) {
2020
+ var v = fn.trim();
2021
+ var flag = false;
2022
+
2023
+ try {
2024
+ if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
2025
+ v = v.replace(SUFFIX, '').replace(PREFIX, '');
2026
+ flag = true;
2027
+ } else if (v.indexOf($T) === 0) {
2028
+ v = v.replace($T, '');
2029
+ flag = true;
2030
+ } else if (v.indexOf($ON) === 0) {
2031
+ var name = v.replace($ON, '');
2032
+
2033
+ v = function v() {
2034
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2035
+ args[_key] = arguments[_key];
2036
+ }
2037
+
2038
+ var callback = args[0].api.getGlobalEvent(name);
2039
+
2040
+ if (callback) {
2041
+ return callback.call.apply(callback, [this].concat(args));
2042
+ }
2043
+
2044
+ return undefined;
2045
+ };
2046
+
2047
+ v.__json = fn;
2048
+ v.__inject = true;
2049
+ return v;
2050
+ } else if (v.indexOf($TX) === 0) {
2051
+ v = makeFn('function($inject){' + v.replace($TX, '') + '}');
2052
+ v.__json = fn;
2053
+ v.__inject = true;
2054
+ return v;
2055
+ } else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
2056
+ flag = true;
2057
+ }
2058
+
2059
+ if (!flag) return fn;
2060
+ var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
2061
+ val.__json = fn;
2062
+ return val;
2063
+ } catch (e) {
2064
+ err("\u89E3\u6790\u5931\u8D25:".concat(v, "\n\nerr: ").concat(e));
2065
+ return undefined;
2066
+ }
2067
+ }
2068
+
2069
+ return fn;
2070
+ }
2071
+ function parseJson(json, mode) {
2072
+ return JSON.parse(json, function (k, v) {
2073
+ if (is.Undef(v) || !v.indexOf) return v;
2074
+ return parseFn(v, mode);
2075
+ });
2076
+ }
2077
+
2078
+ var id$2 = 0;
2079
+ function uniqueId() {
2080
+ var num = 370 + ++id$2;
2081
+ return 'F' + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now())).toString(36) + num.toString(36) + 'c';
2082
+ }
2083
+
2084
+ function deepSet(data, idx, val) {
2085
+ var _data = data,
2086
+ to;
2087
+ (idx || '').split('.').forEach(function (v) {
2088
+ if (to) {
2089
+ if (!_data[to] || _typeof(_data[to]) != 'object') {
2090
+ _data[to] = {};
2091
+ }
2092
+
2093
+ _data = _data[to];
2094
+ }
2095
+
2096
+ to = v;
2097
+ });
2098
+ _data[to] = val;
2099
+ return _data;
2100
+ }
2101
+
1966
2102
  var NAME$1 = 'FormCreate';
1967
2103
 
1968
2104
  var getRuleInject = function getRuleInject(vm, parent) {
@@ -2000,7 +2136,10 @@ function $FormCreate(FormCreate, components, directives) {
2000
2136
  },
2001
2137
  extendOption: Boolean,
2002
2138
  modelValue: Object,
2003
- disabled: Boolean,
2139
+ disabled: {
2140
+ type: Boolean,
2141
+ "default": undefined
2142
+ },
2004
2143
  api: Object,
2005
2144
  name: String,
2006
2145
  subForm: {
@@ -2009,7 +2148,7 @@ function $FormCreate(FormCreate, components, directives) {
2009
2148
  },
2010
2149
  inFor: Boolean
2011
2150
  },
2012
- 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'],
2151
+ 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'],
2013
2152
  render: function render() {
2014
2153
  return this.fc.render();
2015
2154
  },
@@ -2072,10 +2211,37 @@ function $FormCreate(FormCreate, components, directives) {
2072
2211
  }
2073
2212
  };
2074
2213
 
2214
+ var styleEl = null;
2215
+ onBeforeMount(function () {
2216
+ var content = '';
2217
+ var globalClass = props.option && props.option.globalClass || {};
2218
+ Object.keys(globalClass).forEach(function (k) {
2219
+ var subCss = '';
2220
+ globalClass[k].style && Object.keys(globalClass[k].style).forEach(function (key) {
2221
+ subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
2222
+ });
2223
+
2224
+ if (globalClass[k].content) {
2225
+ subCss += globalClass[k].content + ';';
2226
+ }
2227
+
2228
+ if (subCss) {
2229
+ content += ".".concat(k, "{").concat(subCss, "}");
2230
+ }
2231
+ });
2232
+
2233
+ if (content) {
2234
+ styleEl = document.createElement('style');
2235
+ styleEl.type = 'text/css';
2236
+ styleEl.innerHTML = content;
2237
+ document.head.appendChild(styleEl);
2238
+ }
2239
+ });
2075
2240
  onMounted(function () {
2076
2241
  fc.mounted();
2077
2242
  });
2078
2243
  onBeforeUnmount(function () {
2244
+ styleEl && document.head.removeChild(styleEl);
2079
2245
  rmSubForm();
2080
2246
  data.destroyed = true;
2081
2247
  fc.unmount();
@@ -2105,17 +2271,17 @@ function $FormCreate(FormCreate, components, directives) {
2105
2271
  }, {
2106
2272
  deep: true
2107
2273
  });
2274
+ watch(function () {
2275
+ return props.disabled;
2276
+ }, function () {
2277
+ fapi.refresh();
2278
+ });
2108
2279
  watch(modelValue, function (n) {
2109
2280
  if (JSON.stringify(n || {}) === data.updateValue) return;
2110
2281
  fapi.config.forceCoverValue ? fapi.coverValue(n || {}) : fapi.setValue(n || {});
2111
2282
  }, {
2112
2283
  deep: true
2113
2284
  });
2114
- watch(function () {
2115
- return props.disabled;
2116
- }, function (n) {
2117
- fapi.disabled(!!n);
2118
- });
2119
2285
  return _objectSpread2(_objectSpread2({
2120
2286
  fc: markRaw(fc),
2121
2287
  parent: parent ? markRaw(parent) : parent,
@@ -2129,16 +2295,21 @@ function $FormCreate(FormCreate, components, directives) {
2129
2295
  },
2130
2296
  updateValue: function updateValue(value) {
2131
2297
  if (data.destroyed) return;
2132
- data.updateValue = JSON.stringify(value);
2298
+ var json = JSON.stringify(value);
2299
+
2300
+ if (data.updateValue === json) {
2301
+ return;
2302
+ }
2303
+
2304
+ data.updateValue = json;
2133
2305
  vm.emit('update:modelValue', value);
2134
2306
  }
2135
2307
  });
2136
2308
  },
2137
2309
  created: function created() {
2138
2310
  var vm = getCurrentInstance();
2139
- vm.setupState.fc.init();
2140
2311
  vm.emit('update:api', vm.setupState.fapi);
2141
- vm.props.disabled && vm.setupState.fapi.disabled(true);
2312
+ vm.setupState.fc.init();
2142
2313
  }
2143
2314
  });
2144
2315
  }
@@ -2219,114 +2390,6 @@ function attrs() {
2219
2390
  return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
2220
2391
  }
2221
2392
 
2222
- function format(type, msg, rule) {
2223
- return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
2224
- }
2225
- function err(msg, rule) {
2226
- console.error(format('err', msg, rule));
2227
- }
2228
- function logError(e) {
2229
- err(e.toString());
2230
- console.error(e);
2231
- }
2232
-
2233
- function toLine(name) {
2234
- var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
2235
- if (line.indexOf('-') === 0) line = line.substr(1);
2236
- return line;
2237
- }
2238
- function upper(str) {
2239
- return str.replace(str[0], str[0].toLocaleUpperCase());
2240
- }
2241
-
2242
- var PREFIX = '[[FORM-CREATE-PREFIX-';
2243
- var SUFFIX = '-FORM-CREATE-SUFFIX]]';
2244
- var $T = '$FN:';
2245
- var $TX = '$FNX:';
2246
- var $ON = '$GLOBAL:';
2247
- var FUNCTION = 'function';
2248
- function toJson(obj, space) {
2249
- return JSON.stringify(deepExtend([], obj, true), function (key, val) {
2250
- if (val && val._isVue === true) return undefined;
2251
-
2252
- if (_typeof(val) !== FUNCTION) {
2253
- return val;
2254
- }
2255
-
2256
- if (val.__json) {
2257
- return val.__json;
2258
- }
2259
-
2260
- if (val.__origin) val = val.__origin;
2261
- if (val.__emit) return undefined;
2262
- return PREFIX + val + SUFFIX;
2263
- }, space);
2264
- }
2265
-
2266
- function makeFn(fn) {
2267
- return new Function('return ' + fn)();
2268
- }
2269
-
2270
- function parseFn(fn, mode) {
2271
- if (fn && is.String(fn) && fn.length > 4) {
2272
- var v = fn.trim();
2273
- var flag = false;
2274
-
2275
- try {
2276
- if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
2277
- v = v.replace(SUFFIX, '').replace(PREFIX, '');
2278
- flag = true;
2279
- } else if (v.indexOf($T) === 0) {
2280
- v = v.replace($T, '');
2281
- flag = true;
2282
- } else if (v.indexOf($ON) === 0) {
2283
- var name = v.replace($ON, '');
2284
-
2285
- v = function v() {
2286
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2287
- args[_key] = arguments[_key];
2288
- }
2289
-
2290
- var callback = args[0].api.getGlobalEvent(name);
2291
-
2292
- if (callback) {
2293
- return callback.call.apply(callback, [this].concat(args));
2294
- }
2295
-
2296
- return undefined;
2297
- };
2298
-
2299
- v.__json = fn;
2300
- v.__inject = true;
2301
- return v;
2302
- } else if (v.indexOf($TX) === 0) {
2303
- v = makeFn('function($inject){' + v.replace($TX, '') + '}');
2304
- v.__json = fn;
2305
- v.__inject = true;
2306
- return v;
2307
- } else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
2308
- flag = true;
2309
- }
2310
-
2311
- if (!flag) return fn;
2312
- var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
2313
- val.__json = fn;
2314
- return val;
2315
- } catch (e) {
2316
- err("\u89E3\u6790\u5931\u8D25:".concat(v, "\n\nerr: ").concat(e));
2317
- return undefined;
2318
- }
2319
- }
2320
-
2321
- return fn;
2322
- }
2323
- function parseJson(json, mode) {
2324
- return JSON.parse(json, function (k, v) {
2325
- if (is.Undef(v) || !v.indexOf) return v;
2326
- return parseFn(v, mode);
2327
- });
2328
- }
2329
-
2330
2393
  function enumerable(value, writable) {
2331
2394
  return {
2332
2395
  value: value,
@@ -2976,6 +3039,23 @@ function Api(h) {
2976
3039
  return origin ? ctx.origin : ctx.rule;
2977
3040
  }
2978
3041
  },
3042
+ getRenderRule: function getRenderRule(id) {
3043
+ var ctx = h.getCtx(id);
3044
+
3045
+ if (ctx) {
3046
+ return ctx.prop;
3047
+ }
3048
+ },
3049
+ getRefRule: function getRefRule(id) {
3050
+ var ctxs = h.getCtxs(id);
3051
+
3052
+ if (ctxs) {
3053
+ var rules = ctxs.map(function (ctx) {
3054
+ return ctx.rule;
3055
+ });
3056
+ return rules.length === 1 ? rules[0] : rules;
3057
+ }
3058
+ },
2979
3059
  setEffect: function setEffect(id, attr, value) {
2980
3060
  var ctx = h.getCtx(id);
2981
3061
 
@@ -3138,7 +3218,7 @@ function Api(h) {
3138
3218
  }
3139
3219
 
3140
3220
  if (config.type === 'fetch') {
3141
- asyncFetch(config).then(function (res) {
3221
+ api.fetch(config).then(function (res) {
3142
3222
  resolve({
3143
3223
  res: res,
3144
3224
  config: config
@@ -3169,12 +3249,21 @@ function Api(h) {
3169
3249
 
3170
3250
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
3171
3251
  },
3252
+ bus: h.bus,
3253
+ fetch: function fetch(opt) {
3254
+ h.options.beforeFetch && invoke(function () {
3255
+ return h.options.beforeFetch(opt, {
3256
+ api: api
3257
+ });
3258
+ });
3259
+ return asyncFetch(opt);
3260
+ },
3172
3261
  helper: {
3173
3262
  tidyFields: tidyFields,
3174
3263
  props: props
3175
3264
  }
3176
3265
  };
3177
- ['on', 'once', 'off', 'set'].forEach(function (n) {
3266
+ ['on', 'once', 'off'].forEach(function (n) {
3178
3267
  api[n] = function () {
3179
3268
  var _h$bus;
3180
3269
 
@@ -3196,6 +3285,10 @@ function useCache(Render) {
3196
3285
  }
3197
3286
 
3198
3287
  if (!this.cache[ctx.id]) {
3288
+ if (ctx.parent) {
3289
+ this.clearCache(ctx.parent);
3290
+ }
3291
+
3199
3292
  return;
3200
3293
  }
3201
3294
 
@@ -3203,6 +3296,10 @@ function useCache(Render) {
3203
3296
  this.$handle.refresh();
3204
3297
  }
3205
3298
 
3299
+ if (this.cache[ctx.id].parent) {
3300
+ this.clearCache(this.cache[ctx.id].parent);
3301
+ }
3302
+
3206
3303
  this.cache[ctx.id] = null;
3207
3304
  },
3208
3305
  clearCacheAll: function clearCacheAll() {
@@ -3239,34 +3336,6 @@ function lower(str) {
3239
3336
  return str.replace(str[0], str[0].toLowerCase());
3240
3337
  }
3241
3338
 
3242
- function toString(val) {
3243
- return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
3244
- }
3245
-
3246
- var id$2 = 0;
3247
- function uniqueId() {
3248
- var num = 370 + ++id$2;
3249
- return 'F' + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now())).toString(36) + num.toString(36) + 'c';
3250
- }
3251
-
3252
- function deepSet(data, idx, val) {
3253
- var _data = data,
3254
- to;
3255
- (idx || '').split('.').forEach(function (v) {
3256
- if (to) {
3257
- if (!_data[to] || _typeof(_data[to]) != 'object') {
3258
- _data[to] = {};
3259
- }
3260
-
3261
- _data = _data[to];
3262
- }
3263
-
3264
- to = v;
3265
- });
3266
- _data[to] = val;
3267
- return _data;
3268
- }
3269
-
3270
3339
  function useRender$1(Render) {
3271
3340
  extend(Render.prototype, {
3272
3341
  initRender: function initRender() {
@@ -3468,8 +3537,8 @@ function useRender$1(Render) {
3468
3537
  }
3469
3538
  }
3470
3539
 
3471
- cacheFlag && !Object.keys(children).length && _this4.setCache(ctx, function () {
3472
- return _vn;
3540
+ cacheFlag && _this4.setCache(ctx, function () {
3541
+ return _this4.stable(_vn);
3473
3542
  }, parent);
3474
3543
  return _vn;
3475
3544
  };
@@ -3502,12 +3571,25 @@ function useRender$1(Render) {
3502
3571
  if (Array.isArray(vn.props["class"])) {
3503
3572
  vn.props["class"].push('fc-none');
3504
3573
  } else {
3505
- vn.props["class"] = [vn.props["class"], 'fc-none'];
3574
+ vn.props["class"] = vn.props["class"] ? [vn.props["class"], 'fc-none'] : 'fc-none';
3506
3575
  }
3507
3576
 
3508
3577
  return vn;
3509
3578
  }
3510
3579
  },
3580
+ stable: function stable(vn) {
3581
+ var _this5 = this;
3582
+
3583
+ var list = Array.isArray(vn) ? vn : [vn];
3584
+ list.forEach(function (v) {
3585
+ if (v && v.__v_isVNode && v.children && _typeof(v.children) === 'object') {
3586
+ v.children.$stable = true;
3587
+
3588
+ _this5.stable(v.children);
3589
+ }
3590
+ });
3591
+ return vn;
3592
+ },
3511
3593
  getModelField: function getModelField(ctx) {
3512
3594
  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';
3513
3595
  },
@@ -3515,7 +3597,7 @@ function useRender$1(Render) {
3515
3597
  return ctx.type === 'fragment' || ctx.type === 'template';
3516
3598
  },
3517
3599
  injectProp: function injectProp(ctx) {
3518
- var _this5 = this;
3600
+ var _this6 = this;
3519
3601
 
3520
3602
  var state = this.vm.setupState;
3521
3603
 
@@ -3524,10 +3606,10 @@ function useRender$1(Render) {
3524
3606
  api: this.$handle.api,
3525
3607
  form: this.fc.create,
3526
3608
  subForm: function subForm(_subForm) {
3527
- _this5.$handle.addSubForm(ctx, _subForm);
3609
+ _this6.$handle.addSubForm(ctx, _subForm);
3528
3610
  },
3529
3611
  getSubForm: function getSubForm() {
3530
- return _this5.$handle.subForm[ctx.id];
3612
+ return _this6.$handle.subForm[ctx.id];
3531
3613
  },
3532
3614
  options: [],
3533
3615
  children: [],
@@ -3547,14 +3629,14 @@ function useRender$1(Render) {
3547
3629
  });
3548
3630
  return inject;
3549
3631
  },
3550
- ctxProp: function ctxProp(ctx, custom) {
3551
- var _this6 = this;
3632
+ ctxProp: function ctxProp(ctx) {
3633
+ var _this7 = this;
3552
3634
 
3553
3635
  var ref = ctx.ref,
3554
3636
  key = ctx.key,
3555
3637
  rule = ctx.rule;
3556
- this.$manager.mergeProp(ctx, custom);
3557
- ctx.parser.mergeProp(ctx, custom);
3638
+ this.$manager.mergeProp(ctx);
3639
+ ctx.parser.mergeProp(ctx);
3558
3640
  var props = [{
3559
3641
  ref: ref,
3560
3642
  key: rule.key || "".concat(key, "fc"),
@@ -3563,7 +3645,7 @@ function useRender$1(Render) {
3563
3645
  vnodeMounted: function vnodeMounted(vn) {
3564
3646
  vn.el.__rule__ = ctx.rule;
3565
3647
 
3566
- _this6.onMounted(ctx, vn.el);
3648
+ _this7.onMounted(ctx, vn.el);
3567
3649
  },
3568
3650
  'fc.el': function fcEl(el) {
3569
3651
  ctx.exportEl = el;
@@ -3575,17 +3657,21 @@ function useRender$1(Render) {
3575
3657
  }
3576
3658
  }];
3577
3659
 
3578
- if (!custom && ctx.input) {
3660
+ if (ctx.input) {
3661
+ if (this.vm.props.disabled !== undefined) {
3662
+ ctx.prop.props.disabled = !!this.vm.props.disabled;
3663
+ }
3664
+
3579
3665
  var field = this.getModelField(ctx);
3580
3666
  var model = {
3581
3667
  callback: function callback(value) {
3582
- _this6.onInput(ctx, value);
3668
+ _this7.onInput(ctx, value);
3583
3669
  },
3584
3670
  value: this.$handle.getFormData(ctx)
3585
3671
  };
3586
3672
  props.push({
3587
3673
  on: _objectSpread2(_defineProperty({}, "update:".concat(field), model.callback), ctx.prop.modelEmit ? _defineProperty({}, ctx.prop.modelEmit, function () {
3588
- return _this6.onEmitInput(ctx);
3674
+ return _this7.onEmitInput(ctx);
3589
3675
  }) : {}),
3590
3676
  props: _defineProperty({}, field, model.value)
3591
3677
  });
@@ -3612,7 +3698,7 @@ function useRender$1(Render) {
3612
3698
  this.$handle.setValue(ctx, ctx.parser.toValue(ctx.modelValue, ctx), ctx.modelValue);
3613
3699
  },
3614
3700
  renderChildren: function renderChildren(children, ctx) {
3615
- var _this7 = this;
3701
+ var _this8 = this;
3616
3702
 
3617
3703
  if (!is.trueArray(children)) return {};
3618
3704
  var slotBag = makeSlotBag();
@@ -3621,14 +3707,14 @@ function useRender$1(Render) {
3621
3707
  if (is.String(child)) return slotBag.setSlot(null, child);
3622
3708
 
3623
3709
  if (child.__fc__) {
3624
- return _this7.renderSlot(slotBag, child.__fc__, ctx);
3710
+ return _this8.renderSlot(slotBag, child.__fc__, ctx);
3625
3711
  }
3626
3712
 
3627
3713
  if (child.type) {
3628
3714
  nextTick(function () {
3629
- _this7.$handle.loadChildren(children, ctx);
3715
+ _this8.$handle.loadChildren(children, ctx);
3630
3716
 
3631
- _this7.$handle.refresh();
3717
+ _this8.$handle.refresh();
3632
3718
  });
3633
3719
  }
3634
3720
  });
@@ -3642,7 +3728,7 @@ function useRender$1(Render) {
3642
3728
  return this.vNode.make(lower(ctx.originType), prop, children);
3643
3729
  },
3644
3730
  renderRule: function renderRule(rule, children, origin) {
3645
- var _this8 = this;
3731
+ var _this9 = this;
3646
3732
 
3647
3733
  if (!rule) return undefined;
3648
3734
  if (is.String(rule)) return rule;
@@ -3666,7 +3752,7 @@ function useRender$1(Render) {
3666
3752
  if (is.trueArray(rule.children)) {
3667
3753
  rule.children.forEach(function (v) {
3668
3754
  v && slotBag.setSlot(v === null || v === void 0 ? void 0 : v.slot, function () {
3669
- return _this8.renderRule(v);
3755
+ return _this9.renderRule(v);
3670
3756
  });
3671
3757
  });
3672
3758
  }
@@ -3747,23 +3833,27 @@ function useInject(Handler) {
3747
3833
  var emit = rule.emit || [];
3748
3834
 
3749
3835
  if (is.trueArray(emit)) {
3750
- var emitKey = emitPrefix || field || name;
3751
-
3752
- if (emitKey) {
3753
- emit.forEach(function (eventName) {
3754
- if (!eventName) return;
3755
- var eventInject;
3756
-
3757
- if (is.Object(eventName)) {
3758
- eventInject = eventName.inject;
3759
- eventName = eventName.name;
3760
- }
3836
+ emit.forEach(function (eventName) {
3837
+ if (!eventName) return;
3838
+ var eventInject;
3839
+ var emitKey = emitPrefix || field || name;
3840
+
3841
+ if (is.Object(eventName)) {
3842
+ eventInject = eventName.inject;
3843
+ eventName = eventName.name;
3844
+ emitKey = eventName.prefix || emitKey;
3845
+ }
3761
3846
 
3847
+ if (emitKey) {
3762
3848
  var fieldKey = toLine("".concat(emitKey, "-").concat(eventName));
3763
3849
 
3764
3850
  var fn = function fn() {
3765
3851
  var _this2$vm, _this2$vm2, _this2$bus;
3766
3852
 
3853
+ if (_this2.vm.emitsOptions) {
3854
+ _this2.vm.emitsOptions[fieldKey] = null;
3855
+ }
3856
+
3767
3857
  for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
3768
3858
  arg[_key] = arguments[_key];
3769
3859
  }
@@ -3784,8 +3874,8 @@ function useInject(Handler) {
3784
3874
 
3785
3875
  event[eventName] = is.Undef(_inject) ? fn : _this2.inject(rule, fn, _inject);
3786
3876
  }
3787
- });
3788
- }
3877
+ }
3878
+ });
3789
3879
  }
3790
3880
 
3791
3881
  ctx.computed.on = event;
@@ -4100,6 +4190,20 @@ extend(RuleContext.prototype, {
4100
4190
  initNone: function initNone() {
4101
4191
  this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
4102
4192
  },
4193
+ injectValidate: function injectValidate() {
4194
+ var _this4 = this;
4195
+
4196
+ return toArray(this.prop.validate).map(function (item) {
4197
+ return _objectSpread2(_objectSpread2({}, item), {}, {
4198
+ inject: {
4199
+ id: _this4.id,
4200
+ field: _this4.field,
4201
+ rule: _this4.rule,
4202
+ api: _this4.$handle.api
4203
+ }
4204
+ });
4205
+ });
4206
+ },
4103
4207
  check: function check(handle) {
4104
4208
  return this.vm === handle.vm;
4105
4209
  },
@@ -4156,15 +4260,15 @@ extend(RuleContext.prototype, {
4156
4260
  this.ctrlRule = [];
4157
4261
  },
4158
4262
  rm: function rm() {
4159
- var _this4 = this;
4263
+ var _this5 = this;
4160
4264
 
4161
4265
  var _rm = function _rm() {
4162
- var index = _this4.root.indexOf(_this4.origin);
4266
+ var index = _this5.root.indexOf(_this5.origin);
4163
4267
 
4164
4268
  if (index > -1) {
4165
- _this4.root.splice(index, 1);
4269
+ _this5.root.splice(index, 1);
4166
4270
 
4167
- _this4.$handle && _this4.$handle.refresh();
4271
+ _this5.$handle && _this5.$handle.refresh();
4168
4272
  }
4169
4273
  };
4170
4274
 
@@ -4175,17 +4279,17 @@ extend(RuleContext.prototype, {
4175
4279
  }
4176
4280
 
4177
4281
  this.$handle.noWatch(function () {
4178
- _this4.$handle.deferSyncValue(function () {
4179
- _this4.rmCtrl();
4282
+ _this5.$handle.deferSyncValue(function () {
4283
+ _this5.rmCtrl();
4180
4284
 
4181
4285
  _rm();
4182
4286
 
4183
- _this4.$handle.rmCtx(_this4);
4287
+ _this5.$handle.rmCtx(_this5);
4184
4288
 
4185
- extend(_this4, {
4289
+ extend(_this5, {
4186
4290
  root: []
4187
4291
  });
4188
- }, _this4.input);
4292
+ }, _this5.input);
4189
4293
  });
4190
4294
  },
4191
4295
  update: function update(handle, init) {
@@ -4725,6 +4829,11 @@ function useInput(Handler) {
4725
4829
  this.valueChange(ctx, value);
4726
4830
  this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
4727
4831
  this.effect(ctx, 'value');
4832
+ this.emitEvent('change', ctx.field, value, {
4833
+ rule: ctx.origin,
4834
+ api: this.api,
4835
+ setFlag: setFlag || false
4836
+ });
4728
4837
  },
4729
4838
  onInput: function onInput(ctx, value) {
4730
4839
  var val;
@@ -4816,13 +4925,14 @@ function useInput(Handler) {
4816
4925
  isQuote: function isQuote(ctx, value) {
4817
4926
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
4818
4927
  },
4819
- refreshUpdate: function refreshUpdate(ctx, val, origin) {
4928
+ refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
4820
4929
  var _this2 = this;
4821
4930
 
4822
4931
  if (is.Function(ctx.rule.update)) {
4823
4932
  var state = invoke(function () {
4824
4933
  return ctx.rule.update(val, ctx.origin, _this2.api, {
4825
- origin: origin || 'change'
4934
+ origin: origin || 'change',
4935
+ linkField: field
4826
4936
  });
4827
4937
  });
4828
4938
  if (state === undefined) return;
@@ -4833,7 +4943,7 @@ function useInput(Handler) {
4833
4943
  this.refreshRule(ctx, val);
4834
4944
  this.bus.$emit('change-' + ctx.field, val);
4835
4945
  },
4836
- refreshRule: function refreshRule(ctx, val, origin) {
4946
+ refreshRule: function refreshRule(ctx, val, origin, field) {
4837
4947
  if (this.refreshControl(ctx)) {
4838
4948
  this.$render.clearCacheAll();
4839
4949
  this.loadRule();
@@ -4841,7 +4951,7 @@ function useInput(Handler) {
4841
4951
  this.refresh();
4842
4952
  }
4843
4953
 
4844
- this.refreshUpdate(ctx, val, origin);
4954
+ this.refreshUpdate(ctx, val, origin, field);
4845
4955
  },
4846
4956
  appendLink: function appendLink(ctx) {
4847
4957
  var _this3 = this;
@@ -4849,7 +4959,7 @@ function useInput(Handler) {
4849
4959
  var link = ctx.rule.link;
4850
4960
  is.trueArray(link) && link.forEach(function (field) {
4851
4961
  var fn = function fn() {
4852
- return _this3.refreshRule(ctx, ctx.rule.value, 'link');
4962
+ return _this3.refreshRule(ctx, ctx.rule.value, 'link', field);
4853
4963
  };
4854
4964
 
4855
4965
  _this3.bus.$on('change-' + field, fn);
@@ -4998,7 +5108,11 @@ function useContext(Handler) {
4998
5108
  if (key === 'props' && ctx.input) {
4999
5109
  _this.setFormData(ctx, ctx.parser.toFormValue(ctx.rule.value, ctx));
5000
5110
  }
5001
- } else if (key === 'emit') _this.parseEmit(ctx);else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
5111
+ } else if (key === 'emit') {
5112
+ _this.parseEmit(ctx);
5113
+ } else if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
5114
+ _this.$render.clearCacheAll();
5115
+ } else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
5002
5116
  ctx.updateType();
5003
5117
 
5004
5118
  _this.bindParser(ctx);
@@ -5036,47 +5150,55 @@ function useContext(Handler) {
5036
5150
  _this.setValue(ctx, val.value, formValue, true);
5037
5151
  }
5038
5152
  }));
5039
- this.bus.$once('load-end', function () {
5040
- var computed = ctx.rule.computed;
5153
+ }
5041
5154
 
5042
- if (!computed) {
5043
- return;
5044
- }
5155
+ this.bus.$once('load-end', function () {
5156
+ var computed = ctx.rule.computed;
5045
5157
 
5046
- if (_typeof(computed) !== 'object') {
5047
- computed = {
5048
- value: computed
5049
- };
5050
- }
5158
+ if (!computed) {
5159
+ return;
5160
+ }
5051
5161
 
5052
- Object.keys(computed).forEach(function (k) {
5053
- ctx.watch.push(watch(function () {
5054
- var item = computed[k];
5055
- if (!item) return undefined;
5056
- var fn;
5162
+ if (_typeof(computed) !== 'object') {
5163
+ computed = {
5164
+ value: computed
5165
+ };
5166
+ }
5057
5167
 
5058
- if (is.Function(item)) {
5059
- fn = function fn() {
5060
- return item(_this.api.form, _this.api);
5061
- };
5062
- } else {
5063
- var group = ctx.getParentGroup();
5168
+ Object.keys(computed).forEach(function (k) {
5169
+ ctx.watch.push(watch(function () {
5170
+ var item = computed[k];
5171
+ if (!item) return undefined;
5172
+ var fn;
5064
5173
 
5065
- fn = function fn() {
5066
- 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] || {} : {});
5067
- };
5068
- }
5174
+ if (is.Function(item)) {
5175
+ fn = function fn() {
5176
+ return item(_this.api.form, _this.api);
5177
+ };
5178
+ } else {
5179
+ var group = ctx.getParentGroup();
5069
5180
 
5070
- return invoke(fn, undefined);
5071
- }, function (n) {
5072
- deepSet(ctx.rule, k, n);
5073
- }, {
5074
- immediate: true
5075
- }));
5076
- });
5077
- });
5078
- }
5181
+ fn = function fn() {
5182
+ return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {}, ctx.rule, _this.api);
5183
+ };
5184
+ }
5079
5185
 
5186
+ return invoke(fn, undefined);
5187
+ }, function (n) {
5188
+ setTimeout(function () {
5189
+ if (k === 'value') {
5190
+ _this.onInput(ctx, n);
5191
+ } else if (k[0] === '$') {
5192
+ _this.api.setEffect(ctx.id, k, n);
5193
+ } else {
5194
+ deepSet(ctx.rule, k, n);
5195
+ }
5196
+ });
5197
+ }, {
5198
+ immediate: true
5199
+ }));
5200
+ });
5201
+ });
5080
5202
  this.watchEffect(ctx);
5081
5203
  },
5082
5204
  updateChildren: function updateChildren(ctx, n, o) {
@@ -5183,13 +5305,26 @@ function useLifecycle(Handler) {
5183
5305
  }
5184
5306
  },
5185
5307
  lifecycle: function lifecycle(name) {
5186
- var _this2 = this;
5187
-
5188
- var fn = this.options[name];
5189
- is.Function(fn) && invoke(function () {
5190
- return fn(_this2.api);
5191
- });
5192
5308
  this.vm.emit(name, this.api);
5309
+ this.emitEvent(name, this.api);
5310
+ },
5311
+ emitEvent: function emitEvent(name) {
5312
+ var _this$bus;
5313
+
5314
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5315
+ args[_key - 1] = arguments[_key];
5316
+ }
5317
+
5318
+ var _fn = this.options[name] || this.options[toCase('on-' + name)];
5319
+
5320
+ if (_fn) {
5321
+ var fn = parseFn(_fn);
5322
+ is.Function(fn) && invoke(function () {
5323
+ return fn.apply(void 0, args);
5324
+ });
5325
+ }
5326
+
5327
+ (_this$bus = this.bus).$emit.apply(_this$bus, [name].concat(args));
5193
5328
  }
5194
5329
  });
5195
5330
  }
@@ -5416,6 +5551,8 @@ extend(Handler.prototype, {
5416
5551
  this.loadRule();
5417
5552
 
5418
5553
  this.$manager.__init();
5554
+
5555
+ this.lifecycle('created');
5419
5556
  },
5420
5557
  isBreakWatch: function isBreakWatch() {
5421
5558
  return this.loading || this.noWatchFn || this.reloading;
@@ -6170,7 +6307,7 @@ function FormCreateFactory(config) {
6170
6307
  },
6171
6308
  mergeOptions: function mergeOptions(target, opt, parent) {
6172
6309
  opt = deepCopy(opt);
6173
- parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el'].forEach(function (n) {
6310
+ parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach(function (n) {
6174
6311
  delete opt[n];
6175
6312
  });
6176
6313
 
@@ -6558,8 +6695,8 @@ var manager = {
6558
6695
  var form = _this.form();
6559
6696
 
6560
6697
  if (form) {
6561
- form.validateField(field, function (res) {
6562
- res ? reject(res) : resolve(null);
6698
+ form.validateField(field, function (res, err) {
6699
+ err ? reject(err) : resolve(res);
6563
6700
  });
6564
6701
  } else {
6565
6702
  resolve();
@@ -6663,7 +6800,7 @@ var manager = {
6663
6800
  label: isTitle ? rule.title.title : undefined
6664
6801
  }, tidyRule(rule.wrap || {})), {}, {
6665
6802
  prop: ctx.id,
6666
- rules: rule.validate
6803
+ rules: ctx.injectValidate()
6667
6804
  }),
6668
6805
  "class": rule.className,
6669
6806
  key: "".concat(uni, "fi"),
@@ -6925,7 +7062,7 @@ function useFrame(maker) {
6925
7062
  return maker;
6926
7063
  }
6927
7064
 
6928
- 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}";
7065
+ 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}";
6929
7066
  styleInject(css_248z);
6930
7067
 
6931
7068
  function tidyBtnProp(btn, def) {
@@ -7108,6 +7245,7 @@ var required = {
7108
7245
 
7109
7246
  if (val.required === false) {
7110
7247
  inject.clearProp();
7248
+ api.clearValidateState([rule.field]);
7111
7249
  } else {
7112
7250
  var validate = _objectSpread2({
7113
7251
  required: true,
@@ -7178,7 +7316,7 @@ function install(FormCreate) {
7178
7316
  function elmFormCreate() {
7179
7317
  return FormCreateFactory({
7180
7318
  ui: 'element-ui',
7181
- version: '3.1.29',
7319
+ version: '3.1.31',
7182
7320
  manager: manager,
7183
7321
  extendApi: extendApi,
7184
7322
  install: install,