@form-create/element-ui 3.2.26 → 3.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/element-ui v3.2.26
2
+ * @form-create/element-ui v3.2.28
3
3
  * (c) 2018-2025 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -2923,7 +2923,8 @@ function $FormCreate(FormCreate, components, directives) {
2923
2923
  fc.initOptions();
2924
2924
  fapi.refresh();
2925
2925
  }, {
2926
- deep: true
2926
+ deep: true,
2927
+ flush: 'sync'
2927
2928
  });
2928
2929
  watch(function () {
2929
2930
  return _toConsumableArray(rule.value);
@@ -3592,6 +3593,28 @@ function Api(h) {
3592
3593
  return origin ? ctx.origin : ctx.rule;
3593
3594
  }
3594
3595
  },
3596
+ findType: function findType(type, origin) {
3597
+ var rule = undefined;
3598
+ Object.keys(h.ctxs).forEach(function (k) {
3599
+ var ctx = h.ctxs[k];
3600
+
3601
+ if (ctx.rule.type === type) {
3602
+ rule = origin ? ctx.origin : ctx.rule;
3603
+ }
3604
+ });
3605
+ return rule;
3606
+ },
3607
+ findTypes: function findTypes(type, origin) {
3608
+ var rules = [];
3609
+ Object.keys(h.ctxs).forEach(function (k) {
3610
+ var ctx = h.ctxs[k];
3611
+
3612
+ if (ctx.rule.type === type) {
3613
+ rules.push(origin ? ctx.origin : ctx.rule);
3614
+ }
3615
+ });
3616
+ return rules;
3617
+ },
3595
3618
  getRenderRule: function getRenderRule(id) {
3596
3619
  var ctx = h.getCtx(id);
3597
3620
 
@@ -3813,6 +3836,12 @@ function Api(h) {
3813
3836
  }
3814
3837
  });
3815
3838
  },
3839
+ setGlobalData: function setGlobalData(name, value) {
3840
+ api.setData('$globalData.' + name, value);
3841
+ },
3842
+ setGlobalVar: function setGlobalVar(name, value) {
3843
+ api.setData('$var.' + name, value);
3844
+ },
3816
3845
  renderRule: function renderRule(id, onInput, force) {
3817
3846
  var flag = _typeof(id) === 'object';
3818
3847
  var ctx = flag ? byCtx(id) : h.getCtx(id);
@@ -4314,6 +4343,9 @@ function useRender$1(Render) {
4314
4343
  slots: function slots() {
4315
4344
  return _this6.vm.setupState.top.slots;
4316
4345
  },
4346
+ getWrap: function getWrap() {
4347
+ return _this6.vm.refs[ctx.wrapRef];
4348
+ },
4317
4349
  options: [],
4318
4350
  children: [],
4319
4351
  preview: false,
@@ -5662,6 +5694,8 @@ function useInput(Handler) {
5662
5694
  });
5663
5695
  });
5664
5696
  }
5697
+
5698
+ this.$manager.fieldChange(ctx, value, formValue, setFlag);
5665
5699
  },
5666
5700
  onInput: function onInput(ctx, value) {
5667
5701
  var val;
@@ -7303,6 +7337,7 @@ extend(Manager.prototype, {
7303
7337
  getDefaultOptions: function getDefaultOptions() {
7304
7338
  return {};
7305
7339
  },
7340
+ fieldChange: function fieldChange(ctx, value, formValue, setFlag) {},
7306
7341
  render: function render(children) {}
7307
7342
  });
7308
7343
 
@@ -8191,7 +8226,8 @@ function FormCreateFactory(config) {
8191
8226
 
8192
8227
  _this2.$handle.api.refresh();
8193
8228
  }, {
8194
- deep: true
8229
+ deep: true,
8230
+ flush: 'sync'
8195
8231
  }));
8196
8232
  }
8197
8233
 
@@ -8377,17 +8413,11 @@ function FormCreateFactory(config) {
8377
8413
  var handle = is.Function(option) ? option : parseFn(option.handle);
8378
8414
 
8379
8415
  if (handle) {
8380
- var val;
8381
- var unwatch = this.watchLoadData(function (get, flag) {
8382
- if (flag) {
8383
- _this5.bus.$emit('$loadData.$var.' + key);
8416
+ var val = handle(function () {
8417
+ var _this5$$handle$api;
8384
8418
 
8385
- unwatch();
8386
- } else {
8387
- val = handle(get, _this5.$handle.api);
8388
- }
8389
- });
8390
- this.unwatch.push(unwatch);
8419
+ return (_this5$$handle$api = _this5.$handle.api).getData.apply(_this5$$handle$api, arguments);
8420
+ }, this.$handle.api);
8391
8421
  return deepGet(val, split);
8392
8422
  }
8393
8423
  }
@@ -8406,8 +8436,11 @@ function FormCreateFactory(config) {
8406
8436
  if (id != null) {
8407
8437
  var split = id.split('.');
8408
8438
  var key = split.shift();
8439
+ val = deepGet(this.vm.setupState.top.setupState.fc.tmpData, id);
8409
8440
 
8410
- if (key === '$topForm') {
8441
+ if (val != null) {
8442
+ return val;
8443
+ } else if (key === '$topForm') {
8411
8444
  val = this.$handle.api.top.formData(true);
8412
8445
  } else if (key === '$scopeForm') {
8413
8446
  val = this.$handle.api.scope.formData(true);
@@ -8430,13 +8463,7 @@ function FormCreateFactory(config) {
8430
8463
  } else if (key === '$preview') {
8431
8464
  return this.$handle.preview;
8432
8465
  } else {
8433
- var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
8434
-
8435
- if (!hasProperty(tmpData, key)) {
8436
- tmpData[key] = defValueTag;
8437
- }
8438
-
8439
- val = tmpData[key] !== defValueTag ? deepGet(tmpData, id) : getData(id);
8466
+ val = getData(id);
8440
8467
  split = [];
8441
8468
  }
8442
8469
 
@@ -8995,6 +9022,13 @@ var manager = {
8995
9022
  fItem.clearValidate();
8996
9023
  }
8997
9024
  },
9025
+ fieldChange: function fieldChange(ctx, value, formValue, setFlag) {
9026
+ if (!setFlag) {
9027
+ var _this$vm$refs$ctx$wra, _this$vm$refs$ctx$wra2;
9028
+
9029
+ (_this$vm$refs$ctx$wra = this.vm.refs[ctx.wrapRef]) === null || _this$vm$refs$ctx$wra === void 0 ? void 0 : (_this$vm$refs$ctx$wra2 = _this$vm$refs$ctx$wra.validate('change')) === null || _this$vm$refs$ctx$wra2 === void 0 ? void 0 : _this$vm$refs$ctx$wra2["catch"](function () {});
9030
+ }
9031
+ },
8998
9032
  tidyOptions: function tidyOptions(options) {
8999
9033
  ['submitBtn', 'resetBtn', 'row', 'info', 'wrap', 'col', 'title'].forEach(function (name) {
9000
9034
  tidyBool(options, name);
@@ -9400,6 +9434,9 @@ function extendApi(api, h) {
9400
9434
  h.vm.emit('validate-fail', e, {
9401
9435
  api: api
9402
9436
  });
9437
+ h.emitEvent('validate-fail', e, {
9438
+ api: api
9439
+ });
9403
9440
  });
9404
9441
  });
9405
9442
  },
@@ -9633,7 +9670,7 @@ function install(FormCreate) {
9633
9670
  function elmFormCreate() {
9634
9671
  return FormCreateFactory({
9635
9672
  ui: 'element-ui',
9636
- version: '3.2.26',
9673
+ version: '3.2.28',
9637
9674
  manager: manager,
9638
9675
  extendApi: extendApi,
9639
9676
  install: install,