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