@form-create/element-ui 3.2.13 → 3.2.15

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.2.13
2
+ * @form-create/element-ui v3.2.15
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, ref, watch, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, createTextVNode, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, watchEffect, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h } from 'vue';
7
+ import { defineComponent, toRef, ref, watch, computed, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, createTextVNode, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, watchEffect, onMounted, onBeforeUnmount, onUpdated, withDirectives, resolveDirective, createApp, h } from 'vue';
8
8
 
9
9
  function ownKeys(object, enumerableOnly) {
10
10
  var keys = Object.keys(object);
@@ -222,12 +222,14 @@ var Checkbox = defineComponent({
222
222
  }
223
223
  },
224
224
  type: String,
225
+ options: Array,
225
226
  input: Boolean,
226
227
  inputValue: String
227
228
  },
228
229
  emits: ['update:modelValue', 'fc.el'],
229
230
  setup: function setup(props, _) {
230
231
  var options = toRef(props.formCreateInject, 'options', []);
232
+ var opt = toRef(props, 'options');
231
233
  var value = toRef(props, 'modelValue');
232
234
  var inputValue = toRef(props, 'inputValue', '');
233
235
  var customValue = ref(inputValue.value);
@@ -258,9 +260,37 @@ var Checkbox = defineComponent({
258
260
  updateCustomValue(n);
259
261
  });
260
262
 
261
- var _options = function _options() {
262
- return Array.isArray(options.value) ? options.value : [];
263
- };
263
+ var _options = computed(function () {
264
+ var arr = options.value || [];
265
+
266
+ if (opt.value) {
267
+ arr = opt.value || [];
268
+ }
269
+
270
+ return Array.isArray(arr) ? arr : [];
271
+ });
272
+
273
+ watch(value, function (n) {
274
+ var value = null;
275
+
276
+ if (!inputValue.value && n != null && Array.isArray(n) && n.length > 0 && input.value) {
277
+ var values = _options.value.map(function (item) {
278
+ return item.value;
279
+ });
280
+
281
+ n.forEach(function (val) {
282
+ if (values.indexOf(val) === -1) {
283
+ value = val;
284
+ }
285
+ });
286
+ }
287
+
288
+ if (value != null) {
289
+ customValue.value = value;
290
+ }
291
+ }, {
292
+ immediate: true
293
+ });
264
294
 
265
295
  var onInput = function onInput(n) {
266
296
  _.emit('update:modelValue', n);
@@ -304,7 +334,7 @@ var Checkbox = defineComponent({
304
334
  "ref": "el"
305
335
  }), _objectSpread2({
306
336
  "default": function _default() {
307
- return [_this.options().map(function (opt, index) {
337
+ return [_this.options.map(function (opt, index) {
308
338
  var props = _objectSpread2({}, opt);
309
339
 
310
340
  var value = props.value;
@@ -1015,6 +1045,7 @@ var Radio = defineComponent({
1015
1045
  type: [String, Number, Boolean],
1016
1046
  "default": ''
1017
1047
  },
1048
+ options: Array,
1018
1049
  type: String,
1019
1050
  input: Boolean,
1020
1051
  inputValue: String
@@ -1022,15 +1053,11 @@ var Radio = defineComponent({
1022
1053
  emits: ['update:modelValue', 'fc.el'],
1023
1054
  setup: function setup(props, _) {
1024
1055
  var options = toRef(props.formCreateInject, 'options', []);
1056
+ var opt = toRef(props, 'options');
1025
1057
  var value = toRef(props, 'modelValue');
1026
1058
  var inputValue = toRef(props, 'inputValue', '');
1027
1059
  var customValue = ref(inputValue.value);
1028
1060
  var input = toRef(props, 'input', false);
1029
-
1030
- var _options = function _options() {
1031
- return Array.isArray(options.value) ? options.value : [];
1032
- };
1033
-
1034
1061
  watch(inputValue, function (n) {
1035
1062
  if (!input.value) {
1036
1063
  customValue.value = n;
@@ -1040,6 +1067,32 @@ var Radio = defineComponent({
1040
1067
  updateCustomValue(n);
1041
1068
  });
1042
1069
 
1070
+ var _options = computed(function () {
1071
+ var arr = options.value || [];
1072
+
1073
+ if (opt.value) {
1074
+ arr = opt.value || [];
1075
+ }
1076
+
1077
+ return Array.isArray(arr) ? arr : [];
1078
+ });
1079
+
1080
+ watch(value, function (n) {
1081
+ var flag = false;
1082
+
1083
+ if (!inputValue.value && n != null && input.value) {
1084
+ flag = _options.value.map(function (item) {
1085
+ return item.value;
1086
+ }).indexOf(n) === -1;
1087
+ }
1088
+
1089
+ if (flag) {
1090
+ customValue.value = n;
1091
+ }
1092
+ }, {
1093
+ immediate: true
1094
+ });
1095
+
1043
1096
  var onInput = function onInput(n) {
1044
1097
  _.emit('update:modelValue', n);
1045
1098
  };
@@ -1093,7 +1146,7 @@ var Radio = defineComponent({
1093
1146
  "ref": "el"
1094
1147
  }), _objectSpread2({
1095
1148
  "default": function _default() {
1096
- return [_this.options().map(function (opt, index) {
1149
+ return [_this.options.map(function (opt, index) {
1097
1150
  var props = _objectSpread2({}, opt);
1098
1151
 
1099
1152
  var value = props.value;
@@ -1361,7 +1414,7 @@ var Upload = defineComponent({
1361
1414
  onPreview: Function,
1362
1415
  modalTitle: String,
1363
1416
  listType: String,
1364
- modelValue: [Array, String]
1417
+ modelValue: [Array, String, Object]
1365
1418
  },
1366
1419
  emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
1367
1420
  data: function data() {
@@ -1437,7 +1490,7 @@ var Upload = defineComponent({
1437
1490
  "ref": "upload"
1438
1491
  }), _objectSpread2({
1439
1492
  "default": function _default() {
1440
- return [(_this$$slots$default = (_this$$slots = _this.$slots)["default"]) !== null && _this$$slots$default !== void 0 && _this$$slots$default.call(_this$$slots) || ['text', 'picture'].indexOf(_this.listType) === -1 ? createVNode(resolveComponent("ElIcon"), null, {
1493
+ return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || (['text', 'picture'].indexOf(_this.listType) === -1 ? createVNode(resolveComponent("ElIcon"), null, {
1441
1494
  "default": function _default() {
1442
1495
  return [createVNode(script$1, null, null)];
1443
1496
  }
@@ -1447,7 +1500,7 @@ var Upload = defineComponent({
1447
1500
  "default": function _default() {
1448
1501
  return [createTextVNode("\u70B9\u51FB\u4E0A\u4F20")];
1449
1502
  }
1450
- })];
1503
+ }))];
1451
1504
  }
1452
1505
  }, getSlot(this.$slots, ['default']))), createVNode(resolveComponent("ElDialog"), {
1453
1506
  "appendToBody": true,
@@ -2146,6 +2199,7 @@ function $FormCreate(FormCreate, components, directives) {
2146
2199
  },
2147
2200
  index: [String, Number],
2148
2201
  api: Object,
2202
+ locale: [String, Object],
2149
2203
  name: String,
2150
2204
  subForm: {
2151
2205
  type: Boolean,
@@ -2389,7 +2443,7 @@ function $FormCreate(FormCreate, components, directives) {
2389
2443
 
2390
2444
  var normalMerge = ['props'];
2391
2445
  var toArrayMerge = ['class', 'style', 'directives'];
2392
- var functionalMerge = ['on'];
2446
+ var functionalMerge = ['on', 'hook'];
2393
2447
 
2394
2448
  var mergeProps = function mergeProps(objects) {
2395
2449
  var initial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -2486,15 +2540,11 @@ function lower(str) {
2486
2540
 
2487
2541
  var PREFIX = '[[FORM-CREATE-PREFIX-';
2488
2542
  var SUFFIX = '-FORM-CREATE-SUFFIX]]';
2489
- var $T = '$FN:';
2490
- var $TX = '$FNX:';
2491
- var $ON = '$GLOBAL:';
2492
- var FUNCTION = 'function';
2493
2543
  function toJson(obj, space) {
2494
2544
  return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
2495
2545
  if (val && val._isVue === true) return undefined;
2496
2546
 
2497
- if (_typeof(val) !== FUNCTION) {
2547
+ if (typeof val !== 'function') {
2498
2548
  return val;
2499
2549
  }
2500
2550
 
@@ -2521,11 +2571,14 @@ function parseFn(fn, mode) {
2521
2571
  if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
2522
2572
  v = v.replace(SUFFIX, '').replace(PREFIX, '');
2523
2573
  flag = true;
2524
- } else if (v.indexOf($T) === 0) {
2525
- v = v.replace($T, '');
2574
+ } else if (v.indexOf('$FN:') === 0) {
2575
+ v = v.substring(4);
2526
2576
  flag = true;
2527
- } else if (v.indexOf($ON) === 0) {
2528
- var name = v.replace($ON, '');
2577
+ } else if (v.indexOf('$EXEC:') === 0) {
2578
+ v = v.substring(6);
2579
+ flag = true;
2580
+ } else if (v.indexOf('$GLOBAL:') === 0) {
2581
+ var name = v.substring(8);
2529
2582
 
2530
2583
  v = function v() {
2531
2584
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -2544,17 +2597,26 @@ function parseFn(fn, mode) {
2544
2597
  v.__json = fn;
2545
2598
  v.__inject = true;
2546
2599
  return v;
2547
- } else if (v.indexOf($TX) === 0) {
2548
- v = makeFn('function($inject){' + v.replace($TX, '') + '}');
2600
+ } else if (v.indexOf('$FNX:') === 0) {
2601
+ v = makeFn('function($inject){' + v.substring(5) + '}');
2549
2602
  v.__json = fn;
2550
2603
  v.__inject = true;
2551
2604
  return v;
2552
- } else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
2605
+ } else if (!mode && v.indexOf('function ') === 0 && v !== 'function ') {
2606
+ flag = true;
2607
+ } else if (!mode && v.indexOf('function(') === 0 && v !== 'function(') {
2553
2608
  flag = true;
2554
2609
  }
2555
2610
 
2556
2611
  if (!flag) return fn;
2557
- var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
2612
+ var val;
2613
+
2614
+ try {
2615
+ val = makeFn(v);
2616
+ } catch (e) {
2617
+ val = makeFn('function ' + v);
2618
+ }
2619
+
2558
2620
  val.__json = fn;
2559
2621
  return val;
2560
2622
  } catch (e) {
@@ -2920,7 +2982,17 @@ function fetch$1(option) {
2920
2982
  }
2921
2983
 
2922
2984
  var xhr = new XMLHttpRequest();
2923
- var action = option.action;
2985
+ var action = option.action || '';
2986
+
2987
+ if (option.query) {
2988
+ var queryString = new URLSearchParams(option.query).toString();
2989
+
2990
+ if (action.includes('?')) {
2991
+ action += "&".concat(queryString);
2992
+ } else {
2993
+ action += "?".concat(queryString);
2994
+ }
2995
+ }
2924
2996
 
2925
2997
  xhr.onerror = function error(e) {
2926
2998
  option.onError(e);
@@ -2961,7 +3033,7 @@ function fetch$1(option) {
2961
3033
  });
2962
3034
  xhr.send(formData);
2963
3035
  }
2964
- function asyncFetch(config, _fetch) {
3036
+ function asyncFetch(config, _fetch, api) {
2965
3037
  return new Promise(function (resolve, reject) {
2966
3038
  (_fetch || fetch$1)(_objectSpread2(_objectSpread2({}, config), {}, {
2967
3039
  onSuccess: function onSuccess(res) {
@@ -2979,7 +3051,7 @@ function asyncFetch(config, _fetch) {
2979
3051
  };
2980
3052
  }
2981
3053
 
2982
- resolve(fn(res));
3054
+ resolve(fn(res, undefined, api));
2983
3055
  },
2984
3056
  onError: function onError(err) {
2985
3057
  reject(err);
@@ -3584,7 +3656,7 @@ function Api(h) {
3584
3656
  opt = deepCopy(opt);
3585
3657
  opt = h.loadFetchVar(opt);
3586
3658
  h.beforeFetch(opt).then(function () {
3587
- return asyncFetch(opt, h.fc.create.fetch).then(function (res) {
3659
+ return asyncFetch(opt, h.fc.create.fetch, api).then(function (res) {
3588
3660
  invoke(function () {
3589
3661
  return opt.onSuccess && opt.onSuccess(res);
3590
3662
  });
@@ -3604,7 +3676,7 @@ function Api(h) {
3604
3676
 
3605
3677
  _opt = h.loadFetchVar(_opt, get);
3606
3678
  h.beforeFetch(_opt).then(function () {
3607
- return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
3679
+ return asyncFetch(_opt, h.fc.create.fetch, api).then(function (res) {
3608
3680
  invoke(function () {
3609
3681
  return _opt.onSuccess && _opt.onSuccess(res);
3610
3682
  });
@@ -3621,12 +3693,25 @@ function Api(h) {
3621
3693
  getData: function getData(id, def) {
3622
3694
  return h.fc.getLoadData(id, def);
3623
3695
  },
3696
+ watchData: function watchData(fn) {
3697
+ return h.fc.watchLoadData(function (get, change) {
3698
+ invoke(function () {
3699
+ return fn(get, change);
3700
+ });
3701
+ });
3702
+ },
3624
3703
  setData: function setData(id, data, isGlobal) {
3625
3704
  return h.fc.setData(id, data, isGlobal);
3626
3705
  },
3627
3706
  refreshData: function refreshData(id) {
3628
3707
  return h.fc.refreshData(id);
3629
3708
  },
3709
+ t: function t(id, params) {
3710
+ return h.fc.t(id, params);
3711
+ },
3712
+ getLocale: function getLocale() {
3713
+ return h.fc.getLocale();
3714
+ },
3630
3715
  helper: {
3631
3716
  tidyFields: tidyFields,
3632
3717
  props: props
@@ -3957,15 +4042,19 @@ function useRender$1(Render) {
3957
4042
  },
3958
4043
  none: function none(vn) {
3959
4044
  if (vn) {
3960
- if (Array.isArray(vn.props["class"])) {
3961
- vn.props["class"].push('fc-none');
3962
- } else {
3963
- vn.props["class"] = vn.props["class"] ? [vn.props["class"], 'fc-none'] : 'fc-none';
3964
- }
3965
-
4045
+ vn.props["class"] = this.mergeClass(vn.props["class"], 'fc-none');
3966
4046
  return vn;
3967
4047
  }
3968
4048
  },
4049
+ mergeClass: function mergeClass(target, value) {
4050
+ if (Array.isArray(target)) {
4051
+ target.push(value);
4052
+ } else {
4053
+ return target ? [target, value] : value;
4054
+ }
4055
+
4056
+ return target;
4057
+ },
3969
4058
  stable: function stable(vn) {
3970
4059
  var _this5 = this;
3971
4060
 
@@ -4065,6 +4154,7 @@ function useRender$1(Render) {
4065
4154
  callback: function callback(value) {
4066
4155
  _this7.onInput(ctx, value);
4067
4156
  },
4157
+ modelField: field,
4068
4158
  value: this.$handle.getFormData(ctx)
4069
4159
  };
4070
4160
  props.push({
@@ -4083,6 +4173,7 @@ function useRender$1(Render) {
4083
4173
  ctx.el = this.vm.refs[ctx.ref] || el;
4084
4174
  ctx.parser.mounted(ctx);
4085
4175
  this.$handle.effect(ctx, 'mounted');
4176
+ this.$handle.targetHook(ctx, 'mounted');
4086
4177
  },
4087
4178
  onInput: function onInput(ctx, value) {
4088
4179
  if (ctx.prop.modelEmit) {
@@ -4289,7 +4380,7 @@ function useInject(Handler) {
4289
4380
  },
4290
4381
  getInjectData: function getInjectData(self, inject) {
4291
4382
  var $api = self.__fc__ && self.__fc__.$api;
4292
- var vm = self.__fc__ && self.__fc__.$handle.vm || this.vm.props;
4383
+ var vm = self.__fc__ && self.__fc__.$handle.vm || this.vm;
4293
4384
  var _vm$props = vm.props,
4294
4385
  option = _vm$props.option,
4295
4386
  rule = _vm$props.rule;
@@ -4465,6 +4556,12 @@ function bind(ctx) {
4465
4556
  Object.defineProperties(ctx.origin, {
4466
4557
  __fc__: enumerable(markRaw(ctx), true)
4467
4558
  });
4559
+
4560
+ if (ctx.rule !== ctx.origin) {
4561
+ Object.defineProperties(ctx.rule, {
4562
+ __fc__: enumerable(markRaw(ctx), true)
4563
+ });
4564
+ }
4468
4565
  }
4469
4566
 
4470
4567
  function RuleContext(handle, rule, defaultValue) {
@@ -4644,43 +4741,17 @@ extend(RuleContext.prototype, {
4644
4741
  var rule = _objectSpread2({}, this.rule);
4645
4742
 
4646
4743
  delete rule.children;
4744
+ delete rule.validate;
4647
4745
  this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
4648
4746
  return _this3.payload[k];
4649
4747
  })), [this.computed]));
4748
+ this.prop.validate = [].concat(_toConsumableArray(this.refRule.__$validate.value || []), _toConsumableArray(this.prop.validate || []));
4650
4749
  },
4651
4750
  initNone: function initNone() {
4652
4751
  this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
4653
4752
  },
4654
4753
  injectValidate: function injectValidate() {
4655
- var _this4 = this;
4656
-
4657
- return toArray(this.prop.validate).map(function (item) {
4658
- if (is.Function(item.validator)) {
4659
- var temp = _objectSpread2({}, item);
4660
-
4661
- var that = _this4;
4662
-
4663
- temp.validator = function () {
4664
- var _item$validator;
4665
-
4666
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4667
- args[_key] = arguments[_key];
4668
- }
4669
-
4670
- return (_item$validator = item.validator).call.apply(_item$validator, [{
4671
- that: this,
4672
- id: that.id,
4673
- field: that.field,
4674
- rule: that.rule,
4675
- api: that.$handle.api
4676
- }].concat(args));
4677
- };
4678
-
4679
- return temp;
4680
- }
4681
-
4682
- return item;
4683
- });
4754
+ return this.prop.validate;
4684
4755
  },
4685
4756
  check: function check(handle) {
4686
4757
  return this.vm === handle.vm;
@@ -4730,15 +4801,15 @@ extend(RuleContext.prototype, {
4730
4801
  this.ctrlRule = [];
4731
4802
  },
4732
4803
  rm: function rm() {
4733
- var _this5 = this;
4804
+ var _this4 = this;
4734
4805
 
4735
4806
  var _rm = function _rm() {
4736
- var index = _this5.root.indexOf(_this5.origin);
4807
+ var index = _this4.root.indexOf(_this4.origin);
4737
4808
 
4738
4809
  if (index > -1) {
4739
- _this5.root.splice(index, 1);
4810
+ _this4.root.splice(index, 1);
4740
4811
 
4741
- _this5.$handle && _this5.$handle.refresh();
4812
+ _this4.$handle && _this4.$handle.refresh();
4742
4813
  }
4743
4814
  };
4744
4815
 
@@ -4749,17 +4820,17 @@ extend(RuleContext.prototype, {
4749
4820
  }
4750
4821
 
4751
4822
  this.$handle.noWatch(function () {
4752
- _this5.$handle.deferSyncValue(function () {
4753
- _this5.rmCtrl();
4823
+ _this4.$handle.deferSyncValue(function () {
4824
+ _this4.rmCtrl();
4754
4825
 
4755
4826
  _rm();
4756
4827
 
4757
- _this5.$handle.rmCtx(_this5);
4828
+ _this4.$handle.rmCtx(_this4);
4758
4829
 
4759
- extend(_this5, {
4830
+ extend(_this4, {
4760
4831
  root: []
4761
4832
  });
4762
- }, _this5.input);
4833
+ }, _this4.input);
4763
4834
  });
4764
4835
  },
4765
4836
  update: function update(handle, init) {
@@ -4997,7 +5068,11 @@ function useLoader(Handler) {
4997
5068
 
4998
5069
  _this6.setCtx(ctx);
4999
5070
 
5000
- !isCopy && !isInit && _this6.effect(ctx, 'load');
5071
+ if (!isCopy && !isInit) {
5072
+ _this6.effect(ctx, 'load');
5073
+
5074
+ _this6.targetHook(ctx, 'load');
5075
+ }
5001
5076
 
5002
5077
  _this6.effect(ctx, 'created');
5003
5078
 
@@ -5249,6 +5324,9 @@ function useInput(Handler) {
5249
5324
  this.valueChange(ctx, value);
5250
5325
  this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
5251
5326
  this.effect(ctx, 'value');
5327
+ this.targetHook(ctx, 'value', {
5328
+ value: value
5329
+ });
5252
5330
  this.emitEvent('change', ctx.field, value, {
5253
5331
  rule: ctx.origin,
5254
5332
  api: this.api,
@@ -5594,9 +5672,22 @@ function useContext(Handler) {
5594
5672
  }
5595
5673
 
5596
5674
  _this.watching = true;
5675
+ nextTick(function () {
5676
+ _this.targetHook(ctx, 'watch', {
5677
+ key: key,
5678
+ oldValue: o,
5679
+ newValue: n
5680
+ });
5681
+ });
5597
5682
 
5598
5683
  if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
5599
5684
  _this.$render.clearCacheAll();
5685
+
5686
+ nextTick(function () {
5687
+ _this.targetHook(ctx, 'hidden', {
5688
+ value: n
5689
+ });
5690
+ });
5600
5691
  }
5601
5692
 
5602
5693
  if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && (ctx.rule.ignore === 'hidden' || _this.options.ignoreHiddenFields)) {
@@ -5638,6 +5729,71 @@ function useContext(Handler) {
5638
5729
  sync: flag
5639
5730
  }));
5640
5731
  });
5732
+ ctx.refRule['__$title'] = computed(function () {
5733
+ var title = (_typeof(ctx.rule.title) === 'object' ? ctx.rule.title.title : ctx.rule.title) || '';
5734
+
5735
+ if (title) {
5736
+ var match = title.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
5737
+
5738
+ if (match) {
5739
+ title = _this.api.t(match[1]);
5740
+ }
5741
+ }
5742
+
5743
+ return title;
5744
+ });
5745
+ ctx.refRule['__$info'] = computed(function () {
5746
+ var info = (_typeof(ctx.rule.info) === 'object' ? ctx.rule.info.info : ctx.rule.info) || '';
5747
+
5748
+ if (info) {
5749
+ var match = info.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
5750
+
5751
+ if (match) {
5752
+ info = _this.api.t(match[1]);
5753
+ }
5754
+ }
5755
+
5756
+ return info;
5757
+ });
5758
+ ctx.refRule['__$validate'] = computed(function () {
5759
+ return toArray(ctx.rule.validate).map(function (item) {
5760
+ var temp = _objectSpread2({}, item);
5761
+
5762
+ if (temp.message) {
5763
+ var match = temp.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
5764
+
5765
+ if (match) {
5766
+ temp.message = _this.api.t(match[1], {
5767
+ title: ctx.refRule.__$title.value
5768
+ });
5769
+ }
5770
+ }
5771
+
5772
+ if (is.Function(temp.validator)) {
5773
+ var that = ctx;
5774
+
5775
+ temp.validator = function () {
5776
+ var _item$validator;
5777
+
5778
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5779
+ args[_key] = arguments[_key];
5780
+ }
5781
+
5782
+ return (_item$validator = item.validator).call.apply(_item$validator, [{
5783
+ that: this,
5784
+ id: that.id,
5785
+ field: that.field,
5786
+ rule: that.rule,
5787
+ api: that.$handle.api
5788
+ }].concat(args));
5789
+ };
5790
+
5791
+ return temp;
5792
+ }
5793
+
5794
+ return temp;
5795
+ });
5796
+ });
5641
5797
 
5642
5798
  if (ctx.input) {
5643
5799
  var val = toRef(ctx.rule, 'value');
@@ -5725,25 +5881,42 @@ function useContext(Handler) {
5725
5881
  var or = item.mode === 'OR';
5726
5882
  var valid = true;
5727
5883
 
5728
- for (var i = 0; i < item.group.length; i++) {
5884
+ var _loop = function _loop(i) {
5729
5885
  var one = item.group[i];
5730
5886
  var flag = void 0;
5887
+ var field = one.field;
5888
+
5889
+ if (one.variable) {
5890
+ field = JSON.stringify(_this2.fc.getLoadData(one.variable) || '');
5891
+ }
5731
5892
 
5732
5893
  if (one.mode) {
5733
5894
  flag = checkCondition(one);
5734
5895
  } else if (!condition[one.condition]) {
5735
5896
  flag = false;
5897
+ } else if (is.Function(one.handler)) {
5898
+ flag = invoke(function () {
5899
+ return one.handler(_this2.api, ctx.rule);
5900
+ });
5736
5901
  } else {
5737
- flag = new Function('$condition', '$val', '$form', '$group', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(one.field, ", ").concat(one.compare ? one.compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {});
5902
+ flag = new Function('$condition', '$val', '$form', '$group', '$rule', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(field, ", ").concat(one.compare ? one.compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {}, ctx.rule);
5738
5903
  }
5739
5904
 
5740
5905
  if (or && flag) {
5741
- return true;
5906
+ return {
5907
+ v: true
5908
+ };
5742
5909
  }
5743
5910
 
5744
5911
  if (!or) {
5745
5912
  valid = valid && flag;
5746
5913
  }
5914
+ };
5915
+
5916
+ for (var i = 0; i < item.group.length; i++) {
5917
+ var _ret = _loop(i);
5918
+
5919
+ if (_typeof(_ret) === "object") return _ret.v;
5747
5920
  }
5748
5921
 
5749
5922
  return or ? false : valid;
@@ -5779,8 +5952,8 @@ function useContext(Handler) {
5779
5952
  obj[k] = function () {
5780
5953
  var _that$fc$formulas$k;
5781
5954
 
5782
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5783
- args[_key] = arguments[_key];
5955
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
5956
+ args[_key2] = arguments[_key2];
5784
5957
  }
5785
5958
 
5786
5959
  return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
@@ -5874,6 +6047,7 @@ function useContext(Handler) {
5874
6047
  this.$render.clearCache(ctx);
5875
6048
  ctx["delete"]();
5876
6049
  this.effect(ctx, 'deleted');
6050
+ this.targetHook(ctx, 'deleted');
5877
6051
  input && !this.fieldCtx[field] && this.vm.emit('remove-field', field, ctx.rule, this.api);
5878
6052
  ctx.rule.__ctrl || this.vm.emit('remove-rule', ctx.rule, this.api);
5879
6053
  return ctx;
@@ -5920,6 +6094,25 @@ function useLifecycle(Handler) {
5920
6094
  }
5921
6095
 
5922
6096
  (_this$bus = this.bus).$emit.apply(_this$bus, [name].concat(args));
6097
+ },
6098
+ targetHook: function targetHook(ctx, name, args) {
6099
+ var _ctx$prop,
6100
+ _ctx$prop$hook,
6101
+ _this2 = this;
6102
+
6103
+ var hook = (_ctx$prop = ctx.prop) === null || _ctx$prop === void 0 ? void 0 : (_ctx$prop$hook = _ctx$prop.hook) === null || _ctx$prop$hook === void 0 ? void 0 : _ctx$prop$hook[name];
6104
+
6105
+ if (hook) {
6106
+ hook = Array.isArray(hook) ? hook : [hook];
6107
+ hook.forEach(function (fn) {
6108
+ invoke(function () {
6109
+ return fn(_objectSpread2(_objectSpread2({}, args || {}), {}, {
6110
+ rule: ctx.rule,
6111
+ api: _this2.api
6112
+ }));
6113
+ });
6114
+ });
6115
+ }
5923
6116
  }
5924
6117
  });
5925
6118
  }
@@ -6387,7 +6580,7 @@ var loadData = function loadData(fc) {
6387
6580
  var unwatchs = [];
6388
6581
  attrs.forEach(function (attr) {
6389
6582
  if (attr && (attr.attr || attr.template)) {
6390
- var unwatch = fc.watchLoadData(debounce(function (get) {
6583
+ var fn = function fn(get) {
6391
6584
  var value;
6392
6585
 
6393
6586
  if (attr.template) {
@@ -6413,7 +6606,14 @@ var loadData = function loadData(fc) {
6413
6606
  }
6414
6607
 
6415
6608
  api.sync(rule);
6416
- }, attr.wait || 300));
6609
+ };
6610
+
6611
+ var callback = function callback(get) {
6612
+ return fn(get);
6613
+ };
6614
+
6615
+ var unwatch = fc.watchLoadData(callback);
6616
+ fn = debounce(fn, attr.wait || 300);
6417
6617
 
6418
6618
  if (attr.watch !== false) {
6419
6619
  unwatchs.push(unwatch);
@@ -6429,15 +6629,81 @@ var loadData = function loadData(fc) {
6429
6629
  this._fn[inject.id].forEach(function (un) {
6430
6630
  un();
6431
6631
  });
6632
+
6633
+ delete this._fn[inject.id];
6432
6634
  }
6433
6635
 
6434
6636
  inject.clearProp();
6435
6637
  }
6436
6638
  };
6437
- loadData.watch = loadData.created;
6639
+ loadData.watch = loadData.mounted;
6438
6640
  return loadData;
6439
6641
  };
6440
6642
 
6643
+ var t = function t(fc) {
6644
+ var t = {
6645
+ name: 't',
6646
+ _fn: [],
6647
+ loaded: function loaded(inject, rule, api) {
6648
+ this.deleted(inject);
6649
+ var attrs = inject.getValue() || {};
6650
+ var unwatchs = [];
6651
+ Object.keys(attrs).forEach(function (key) {
6652
+ var attr = attrs[key];
6653
+
6654
+ if (attr) {
6655
+ var isObj = _typeof(attr) === 'object';
6656
+
6657
+ var fn = function fn(get) {
6658
+ var value = fc.t(isObj ? attr.attr : attr, isObj ? attr.params : null, get);
6659
+
6660
+ var _rule = isObj && attr.modify ? rule : inject.getProp();
6661
+
6662
+ if (key === 'child') {
6663
+ if (_rule.children) {
6664
+ _rule.children[0] = value;
6665
+ } else {
6666
+ _rule.children = [value];
6667
+ }
6668
+ } else {
6669
+ deepSet(_rule, key, value);
6670
+ }
6671
+
6672
+ api.sync(rule);
6673
+ };
6674
+
6675
+ var callback = function callback(get) {
6676
+ return fn(get);
6677
+ };
6678
+
6679
+ var unwatch = fc.watchLoadData(callback);
6680
+ fn = debounce(fn, attr.wait || 300);
6681
+
6682
+ if (attr.watch !== false) {
6683
+ unwatchs.push(unwatch);
6684
+ } else {
6685
+ unwatch();
6686
+ }
6687
+ }
6688
+ });
6689
+ this._fn[inject.id] = unwatchs;
6690
+ },
6691
+ deleted: function deleted(inject) {
6692
+ if (this._fn[inject.id]) {
6693
+ this._fn[inject.id].forEach(function (un) {
6694
+ un();
6695
+ });
6696
+
6697
+ delete this._fn[inject.id];
6698
+ }
6699
+
6700
+ inject.clearProp();
6701
+ }
6702
+ };
6703
+ t.watch = t.loaded;
6704
+ return t;
6705
+ };
6706
+
6441
6707
  var componentValidate = {
6442
6708
  name: 'componentValidate',
6443
6709
  load: function load(attr, rule, api) {
@@ -6508,6 +6774,13 @@ var fetch = function fetch(fc) {
6508
6774
  deepSet(inject.getProp(), option.to || 'options', val);
6509
6775
  }
6510
6776
 
6777
+ if (val != null && option && option.key && fc.$handle.options.globalData[option.key]) {
6778
+ fc.fetchCache.set(fc.$handle.options.globalData[option.key], {
6779
+ status: true,
6780
+ data: val
6781
+ });
6782
+ }
6783
+
6511
6784
  api.sync(rule);
6512
6785
  };
6513
6786
 
@@ -6625,6 +6898,8 @@ var fetch = function fetch(fc) {
6625
6898
  deleted: function deleted(inject) {
6626
6899
  if (this._fn[inject.id]) {
6627
6900
  this._fn[inject.id]();
6901
+
6902
+ delete this._fn[inject.id];
6628
6903
  }
6629
6904
 
6630
6905
  inject.clearProp();
@@ -6636,6 +6911,7 @@ var fetch = function fetch(fc) {
6636
6911
  var $provider = {
6637
6912
  fetch: fetch,
6638
6913
  loadData: loadData,
6914
+ t: t,
6639
6915
  componentValidate: componentValidate
6640
6916
  };
6641
6917
 
@@ -7038,7 +7314,7 @@ function FormCreateFactory(config) {
7038
7314
  options: ref({}),
7039
7315
  extendApiFn: extendApiFn,
7040
7316
  fetchCache: new WeakMap(),
7041
- tmpData: {}
7317
+ tmpData: reactive({})
7042
7318
  });
7043
7319
  listener.forEach(function (item) {
7044
7320
  _this.bus.$on(item.name, item.callback);
@@ -7113,6 +7389,26 @@ function FormCreateFactory(config) {
7113
7389
  });
7114
7390
  }
7115
7391
  },
7392
+ t: function t(id, params, get) {
7393
+ var value = get ? get('$t.' + id) : this.globalLanguageDriver(id);
7394
+
7395
+ if (value == null && this.vm.appContext.config.globalProperties.$i18n) {
7396
+ return this.vm.appContext.config.globalProperties.$i18n.t(id, params);
7397
+ }
7398
+
7399
+ if (value == null) {
7400
+ value = '';
7401
+ }
7402
+
7403
+ if (value && params) {
7404
+ Object.keys(params).forEach(function (param) {
7405
+ var regex = new RegExp("{".concat(param, "}"), 'g');
7406
+ value = value.replace(regex, params[param]);
7407
+ });
7408
+ }
7409
+
7410
+ return value;
7411
+ },
7116
7412
  globalDataDriver: function globalDataDriver(id) {
7117
7413
  var _this4 = this;
7118
7414
 
@@ -7196,6 +7492,41 @@ function FormCreateFactory(config) {
7196
7492
  }
7197
7493
  }
7198
7494
  },
7495
+ getLocale: function getLocale() {
7496
+ var locale = this.vm.setupState.top.props.locale;
7497
+
7498
+ if (locale && _typeof(locale) === 'object') {
7499
+ return locale.name;
7500
+ }
7501
+
7502
+ if (typeof locale === 'string') {
7503
+ return locale;
7504
+ }
7505
+
7506
+ if (this.vm.appContext.config.globalProperties.$i18n && this.vm.appContext.config.globalProperties.$i18n.locale) {
7507
+ return this.vm.appContext.config.globalProperties.$i18n.locale;
7508
+ }
7509
+
7510
+ return 'zh-cn';
7511
+ },
7512
+ globalLanguageDriver: function globalLanguageDriver(id) {
7513
+ var locale = this.vm.setupState.top.props.locale;
7514
+ var value = undefined;
7515
+
7516
+ if (locale && _typeof(locale) === 'object') {
7517
+ value = deepGet(locale, id);
7518
+ }
7519
+
7520
+ if (value == null) {
7521
+ var language = this.options.value.language || {};
7522
+
7523
+ var _locale = this.getLocale();
7524
+
7525
+ value = deepGet(language[_locale], id);
7526
+ }
7527
+
7528
+ return value;
7529
+ },
7199
7530
  globalVarDriver: function globalVarDriver(id) {
7200
7531
  var _this5 = this;
7201
7532
 
@@ -7253,6 +7584,12 @@ function FormCreateFactory(config) {
7253
7584
  } else if (key === '$var') {
7254
7585
  val = this.globalVarDriver(split.join('.'));
7255
7586
  split = [];
7587
+ } else if (key === '$locale') {
7588
+ val = this.getLocale();
7589
+ split = [];
7590
+ } else if (key === '$t') {
7591
+ val = this.globalLanguageDriver(split.join('.'));
7592
+ split = [];
7256
7593
  } else {
7257
7594
  var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
7258
7595
  val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(id);
@@ -7282,8 +7619,9 @@ function FormCreateFactory(config) {
7282
7619
  return unwatch[id].val;
7283
7620
  }
7284
7621
 
7285
- var val = _this6.getLoadData(id, def);
7286
-
7622
+ var data = computed(function () {
7623
+ return _this6.getLoadData(id, def);
7624
+ });
7287
7625
  var split = id.split('.');
7288
7626
  var key = split.shift();
7289
7627
  var key2 = split.shift() || '';
@@ -7297,6 +7635,9 @@ function FormCreateFactory(config) {
7297
7635
  run(true);
7298
7636
  }
7299
7637
  }, 0);
7638
+ var un = watch(data, function (n) {
7639
+ callback();
7640
+ });
7300
7641
 
7301
7642
  _this6.bus.$on('$loadData.' + key, callback);
7302
7643
 
@@ -7311,10 +7652,12 @@ function FormCreateFactory(config) {
7311
7652
  if (key2) {
7312
7653
  _this6.bus.$off('$loadData.' + key + '.' + key2, callback);
7313
7654
  }
7655
+
7656
+ un();
7314
7657
  },
7315
- val: val
7658
+ val: data.value
7316
7659
  };
7317
- return val;
7660
+ return data.value;
7318
7661
  };
7319
7662
 
7320
7663
  run(false);
@@ -7352,7 +7695,7 @@ function FormCreateFactory(config) {
7352
7695
  },
7353
7696
  mergeOptions: function mergeOptions(target, opt, parent) {
7354
7697
  opt = deepCopy(opt);
7355
- parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
7698
+ parent && ['page', 'onSubmit', 'onReset', 'onCreated', 'onChange', 'onMounted', 'mounted', 'onReload', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
7356
7699
  delete opt[n];
7357
7700
  });
7358
7701
 
@@ -7686,6 +8029,7 @@ var alias = {
7686
8029
  autoComplete: PRE + '-autocomplete',
7687
8030
  auto: PRE + '-autocomplete',
7688
8031
  group: 'fc-group',
8032
+ array: 'fc-group',
7689
8033
  object: 'fc-sub-form',
7690
8034
  subForm: 'fc-sub-form'
7691
8035
  };
@@ -7804,12 +8148,9 @@ var manager = {
7804
8148
  return prop;
7805
8149
  },
7806
8150
  mergeProp: function mergeProp(ctx) {
7807
- ctx.prop = mergeProps([{
7808
- info: this.options.info || {},
7809
- wrap: this.options.wrap || {},
7810
- col: this.options.col || {},
7811
- title: this.options.title || {}
7812
- }, ctx.prop], {
8151
+ var _this2 = this;
8152
+
8153
+ var def = {
7813
8154
  info: {
7814
8155
  trigger: 'hover',
7815
8156
  placement: 'top-start',
@@ -7820,8 +8161,9 @@ var manager = {
7820
8161
  span: 24
7821
8162
  },
7822
8163
  wrap: {}
7823
- }, {
7824
- normal: ['title', 'info', 'col', 'wrap']
8164
+ };
8165
+ ['info', 'wrap', 'col', 'title'].forEach(function (name) {
8166
+ ctx.prop[name] = mergeProps([_this2.options[name] || {}, ctx.prop[name] || {}], def[name]);
7825
8167
  });
7826
8168
  },
7827
8169
  getDefaultOptions: function getDefaultOptions() {
@@ -7854,18 +8196,18 @@ var manager = {
7854
8196
  });
7855
8197
  },
7856
8198
  render: function render(children) {
7857
- var _this2 = this;
8199
+ var _this3 = this;
7858
8200
 
7859
8201
  if (children.slotLen() && !this.$handle.preview) {
7860
8202
  children.setSlot(undefined, function () {
7861
- return _this2.makeFormBtn();
8203
+ return _this3.makeFormBtn();
7862
8204
  });
7863
8205
  }
7864
8206
 
7865
8207
  return this.$r(this.rule, isFalse(this.options.row.show) ? children.getSlots() : [this.makeRow(children)]);
7866
8208
  },
7867
8209
  makeWrap: function makeWrap(ctx, children) {
7868
- var _this3 = this;
8210
+ var _this4 = this;
7869
8211
 
7870
8212
  var rule = ctx.prop;
7871
8213
  var uni = "".concat(this.key).concat(ctx.key);
@@ -7884,7 +8226,7 @@ var manager = {
7884
8226
  prop: ctx.id,
7885
8227
  rules: ctx.injectValidate()
7886
8228
  }),
7887
- "class": rule.className,
8229
+ "class": this.$render.mergeClass(rule.className, 'fc-form-item'),
7888
8230
  key: "".concat(uni, "fi"),
7889
8231
  ref: ctx.wrapRef,
7890
8232
  type: 'formItem'
@@ -7894,7 +8236,7 @@ var manager = {
7894
8236
  }
7895
8237
  }, isTitle ? {
7896
8238
  label: function label() {
7897
- return _this3.makeInfo(rule, uni, ctx);
8239
+ return _this4.makeInfo(rule, uni, ctx);
7898
8240
  }
7899
8241
  } : {}));
7900
8242
  return inline === true || isFalse(_col) || isFalse(col.show) ? item : this.makeCol(rule, uni, [item]);
@@ -7905,7 +8247,7 @@ var manager = {
7905
8247
  return !(!title.title && !title["native"] || isFalse(title.show));
7906
8248
  },
7907
8249
  makeInfo: function makeInfo(rule, uni, ctx) {
7908
- var _this4 = this;
8250
+ var _this5 = this;
7909
8251
 
7910
8252
  var titleProp = _objectSpread2({}, rule.title);
7911
8253
 
@@ -7915,10 +8257,10 @@ var manager = {
7915
8257
  var form = this.options.form;
7916
8258
  var titleSlot = this.getSlot('title');
7917
8259
  var children = [titleSlot ? titleSlot({
7918
- title: titleProp.title || '',
8260
+ title: ctx.refRule.__$title.value,
7919
8261
  rule: ctx.rule,
7920
8262
  options: this.options
7921
- }) : (titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
8263
+ }) : ctx.refRule.__$title.value + (form.labelSuffix || form['label-suffix'] || '')];
7922
8264
 
7923
8265
  if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
7924
8266
  var prop = {
@@ -7934,17 +8276,17 @@ var manager = {
7934
8276
  var field = 'content';
7935
8277
 
7936
8278
  if (infoProp.info && !hasProperty(prop.props, field)) {
7937
- prop.props[field] = infoProp.info;
8279
+ prop.props[field] = ctx.refRule.__$info.value;
7938
8280
  }
7939
8281
 
7940
8282
  children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
7941
- return _this4.$r({
8283
+ return _this5.$r({
7942
8284
  type: 'ElIcon',
7943
8285
  style: 'top:2px',
7944
8286
  key: "".concat(uni, "i")
7945
8287
  }, {
7946
8288
  "default": function _default() {
7947
- return _this4.$r({
8289
+ return _this5.$r({
7948
8290
  type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
7949
8291
  });
7950
8292
  }
@@ -7955,6 +8297,7 @@ var manager = {
7955
8297
  var _prop = mergeProps([titleProp, {
7956
8298
  props: tidyRule(titleProp),
7957
8299
  key: "".concat(uni, "tit"),
8300
+ "class": 'fc-form-title',
7958
8301
  type: titleProp.type || 'span'
7959
8302
  }]);
7960
8303
 
@@ -7966,7 +8309,7 @@ var manager = {
7966
8309
  makeCol: function makeCol(rule, uni, children) {
7967
8310
  var col = rule.col;
7968
8311
  return this.$r({
7969
- "class": col["class"],
8312
+ "class": this.$render.mergeClass(col["class"], 'fc-form-col'),
7970
8313
  type: 'col',
7971
8314
  props: col || {
7972
8315
  span: 24
@@ -7979,7 +8322,7 @@ var manager = {
7979
8322
  return this.$r({
7980
8323
  type: 'row',
7981
8324
  props: row,
7982
- "class": row["class"],
8325
+ "class": this.$render.mergeClass(row["class"], 'fc-form-row'),
7983
8326
  key: "".concat(this.key, "row")
7984
8327
  }, children);
7985
8328
  },
@@ -8000,10 +8343,12 @@ var manager = {
8000
8343
 
8001
8344
  var item = this.$r({
8002
8345
  type: 'formItem',
8346
+ "class": 'fc-form-item',
8003
8347
  key: "".concat(this.key, "fb")
8004
8348
  }, vn);
8005
8349
  return this.rule.props.inline === true ? item : this.$r({
8006
8350
  type: 'col',
8351
+ "class": 'fc-form-col fc-form-footer',
8007
8352
  props: {
8008
8353
  span: 24
8009
8354
  },
@@ -8011,7 +8356,7 @@ var manager = {
8011
8356
  }, [item]);
8012
8357
  },
8013
8358
  makeResetBtn: function makeResetBtn() {
8014
- var _this5 = this;
8359
+ var _this6 = this;
8015
8360
 
8016
8361
  var resetBtn = _objectSpread2({}, this.options.resetBtn);
8017
8362
 
@@ -8023,21 +8368,21 @@ var manager = {
8023
8368
  return this.$r({
8024
8369
  type: 'button',
8025
8370
  props: resetBtn,
8026
- "class": '_fc-reset-btn',
8371
+ "class": 'fc-reset-btn',
8027
8372
  style: {
8028
8373
  width: resetBtn.width
8029
8374
  },
8030
8375
  on: {
8031
8376
  click: function click() {
8032
- var fApi = _this5.$handle.api;
8033
- _this5.options.resetBtn.click ? _this5.options.resetBtn.click(fApi) : fApi.resetFields();
8377
+ var fApi = _this6.$handle.api;
8378
+ _this6.options.resetBtn.click ? _this6.options.resetBtn.click(fApi) : fApi.resetFields();
8034
8379
  }
8035
8380
  },
8036
8381
  key: "".concat(this.key, "b2")
8037
8382
  }, [innerText]);
8038
8383
  },
8039
8384
  makeSubmitBtn: function makeSubmitBtn() {
8040
- var _this6 = this;
8385
+ var _this7 = this;
8041
8386
 
8042
8387
  var submitBtn = _objectSpread2({}, this.options.submitBtn);
8043
8388
 
@@ -8049,14 +8394,14 @@ var manager = {
8049
8394
  return this.$r({
8050
8395
  type: 'button',
8051
8396
  props: submitBtn,
8052
- "class": '_fc-submit-btn',
8397
+ "class": 'fc-submit-btn',
8053
8398
  style: {
8054
8399
  width: submitBtn.width
8055
8400
  },
8056
8401
  on: {
8057
8402
  click: function click() {
8058
- var fApi = _this6.$handle.api;
8059
- _this6.options.submitBtn.click ? _this6.options.submitBtn.click(fApi) : fApi.submit()["catch"](function () {});
8403
+ var fApi = _this7.$handle.api;
8404
+ _this7.options.submitBtn.click ? _this7.options.submitBtn.click(fApi) : fApi.submit()["catch"](function () {});
8060
8405
  }
8061
8406
  },
8062
8407
  key: "".concat(this.key, "b1")
@@ -8146,7 +8491,7 @@ function useFrame(maker) {
8146
8491
  return maker;
8147
8492
  }
8148
8493
 
8149
- 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 .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,.form-create.is-preview .fc-clock{display:none!important}.fc-wrap-right .el-form-item__label{justify-content:flex-end}.fc-wrap-left .el-form-item__label{justify-content:flex-start}.fc-wrap-top.el-form-item{display:block}.fc-wrap-top.el-form-item .el-form-item__label{display:block;height:auto;line-height:22px;margin-bottom:8px;text-align:left}.el-form--large .fc-wrap-top.el-form-item .el-form-item__label{line-height:22px;margin-bottom:12px}.el-form--default .fc-wrap-top.el-form-item .el-form-item__label{line-height:22px;margin-bottom:8px}.el-form--small .fc-wrap-top.el-form-item .el-form-item__label{line-height:20px;margin-bottom:4px}";
8494
+ 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 .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,.form-create.is-preview .fc-clock{display:none!important}.fc-wrap-right>.el-form-item__label{display:flex;justify-content:flex-end}.fc-wrap-left>.el-form-item__label{display:flex;justify-content:flex-start}.fc-wrap-top.el-form-item{display:block}.fc-wrap-top.el-form-item>.el-form-item__label{display:block;height:auto;line-height:22px;margin-bottom:8px;text-align:left}.el-form--large .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:12px}.el-form--default .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:8px}.el-form--small .fc-wrap-top.el-form-item>.el-form-item__label{line-height:20px;margin-bottom:4px}.fc-form-footer{margin-top:12px}";
8150
8495
  styleInject(css_248z);
8151
8496
 
8152
8497
  function tidyBtnProp(btn, def) {
@@ -8338,8 +8683,15 @@ var required = {
8338
8683
  }, val);
8339
8684
 
8340
8685
  if (!validate.message) {
8341
- var title = rule.title || '';
8342
- validate.message = ((_typeof(title) === 'object' ? title.title : title) || '') + '不能为空';
8686
+ validate.message = rule.__fc__.refRule.__$title.value + (api.getLocale() === 'en' ? ' is required' : '不能为空');
8687
+ } else {
8688
+ var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
8689
+
8690
+ if (match) {
8691
+ validate.message = api.t(match[1], {
8692
+ title: rule.__fc__.refRule.__$title.value
8693
+ });
8694
+ }
8343
8695
  }
8344
8696
 
8345
8697
  inject.getProp().validate = [validate];
@@ -8399,7 +8751,7 @@ function install(FormCreate) {
8399
8751
  function elmFormCreate() {
8400
8752
  return FormCreateFactory({
8401
8753
  ui: 'element-ui',
8402
- version: '3.2.13',
8754
+ version: '3.2.15',
8403
8755
  manager: manager,
8404
8756
  extendApi: extendApi,
8405
8757
  install: install,