@harbor-design/proform 1.4.3 → 1.4.4

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.
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  var ze = Object.defineProperty;
2
2
  var Le = (r, e, t) => e in r ? ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var l = (r, e, t) => (Le(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { ref as L, readonly as Ie, nextTick as C, isRef as U, watch as E, isReactive as T, watchEffect as D, toRaw as x, reactive as W, createVNode as m, mergeProps as $, withDirectives as He, vShow as De, createTextVNode as Ge, isVNode as Be, defineComponent as Ke } from "vue";
5
- var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, A = We || Xe || Function("return this")(), R = A.Symbol, Fe = Object.prototype, Ye = Fe.hasOwnProperty, Ze = Fe.toString, N = R ? R.toStringTag : void 0;
4
+ import { ref as L, readonly as Ie, nextTick as C, isRef as U, watch as E, isReactive as T, watchEffect as D, toRaw as R, reactive as W, createVNode as m, mergeProps as N, withDirectives as He, vShow as De, createTextVNode as Ge, isVNode as Be, defineComponent as Ke } from "vue";
5
+ var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, A = We || Xe || Function("return this")(), $ = A.Symbol, Fe = Object.prototype, Ye = Fe.hasOwnProperty, Ze = Fe.toString, q = $ ? $.toStringTag : void 0;
6
6
  function Je(r) {
7
- var e = Ye.call(r, N), t = r[N];
7
+ var e = Ye.call(r, q), t = r[q];
8
8
  try {
9
- r[N] = void 0;
9
+ r[q] = void 0;
10
10
  var i = !0;
11
11
  } catch {
12
12
  }
13
13
  var s = Ze.call(r);
14
- return i && (e ? r[N] = t : delete r[N]), s;
14
+ return i && (e ? r[q] = t : delete r[q]), s;
15
15
  }
16
16
  var Qe = Object.prototype, Ae = Qe.toString;
17
17
  function ke(r) {
18
18
  return Ae.call(r);
19
19
  }
20
- var et = "[object Null]", tt = "[object Undefined]", Ce = R ? R.toStringTag : void 0;
20
+ var et = "[object Null]", tt = "[object Undefined]", Ce = $ ? $.toStringTag : void 0;
21
21
  function je(r) {
22
22
  return r == null ? r === void 0 ? tt : et : Ce && Ce in Object(r) ? Je(r) : ke(r);
23
23
  }
@@ -33,12 +33,12 @@ function st(r, e) {
33
33
  s[t] = e(r[t], t, r);
34
34
  return s;
35
35
  }
36
- var ee = Array.isArray, nt = 1 / 0, Se = R ? R.prototype : void 0, Oe = Se ? Se.toString : void 0;
37
- function Me(r) {
36
+ var ee = Array.isArray, nt = 1 / 0, Se = $ ? $.prototype : void 0, Oe = Se ? Se.toString : void 0;
37
+ function xe(r) {
38
38
  if (typeof r == "string")
39
39
  return r;
40
40
  if (ee(r))
41
- return st(r, Me) + "";
41
+ return st(r, xe) + "";
42
42
  if (k(r))
43
43
  return Oe ? Oe.call(r) : "";
44
44
  var e = r + "";
@@ -62,11 +62,11 @@ var X = A["__core-js_shared__"], Ee = function() {
62
62
  function ct(r) {
63
63
  return !!Ee && Ee in r;
64
64
  }
65
- var dt = Function.prototype, pt = dt.toString;
66
- function ht(r) {
65
+ var dt = Function.prototype, ht = dt.toString;
66
+ function pt(r) {
67
67
  if (r != null) {
68
68
  try {
69
- return pt.call(r);
69
+ return ht.call(r);
70
70
  } catch {
71
71
  }
72
72
  try {
@@ -83,7 +83,7 @@ function It(r) {
83
83
  if (!G(r) || ct(r))
84
84
  return !1;
85
85
  var e = ft(r) ? Pt : gt;
86
- return e.test(ht(r));
86
+ return e.test(pt(r));
87
87
  }
88
88
  function Ct(r, e) {
89
89
  return r == null ? void 0 : r[e];
@@ -111,35 +111,35 @@ function wt(r, e, t) {
111
111
  writable: !0
112
112
  }) : r[e] = t;
113
113
  }
114
- function xe(r, e) {
114
+ function Re(r, e) {
115
115
  return r === e || r !== r && e !== e;
116
116
  }
117
117
  var Ft = Object.prototype, jt = Ft.hasOwnProperty;
118
- function Mt(r, e, t) {
118
+ function xt(r, e, t) {
119
119
  var i = r[e];
120
- (!(jt.call(r, e) && xe(i, t)) || t === void 0 && !(e in r)) && wt(r, e, t);
120
+ (!(jt.call(r, e) && Re(i, t)) || t === void 0 && !(e in r)) && wt(r, e, t);
121
121
  }
122
- var xt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Rt = /^\w*$/;
123
- function Vt(r, e) {
122
+ var Rt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/;
123
+ function Mt(r, e) {
124
124
  if (ee(r))
125
125
  return !1;
126
126
  var t = typeof r;
127
- return t == "number" || t == "symbol" || t == "boolean" || r == null || k(r) ? !0 : Rt.test(r) || !xt.test(r) || e != null && r in Object(e);
127
+ return t == "number" || t == "symbol" || t == "boolean" || r == null || k(r) ? !0 : $t.test(r) || !Rt.test(r) || e != null && r in Object(e);
128
128
  }
129
129
  var z = te(Object, "create");
130
- function qt() {
130
+ function Vt() {
131
131
  this.__data__ = z ? z(null) : {}, this.size = 0;
132
132
  }
133
- function Nt(r) {
133
+ function qt(r) {
134
134
  var e = this.has(r) && delete this.__data__[r];
135
135
  return this.size -= e ? 1 : 0, e;
136
136
  }
137
- var $t = "__lodash_hash_undefined__", Ut = Object.prototype, Tt = Ut.hasOwnProperty;
137
+ var Nt = "__lodash_hash_undefined__", Ut = Object.prototype, Tt = Ut.hasOwnProperty;
138
138
  function zt(r) {
139
139
  var e = this.__data__;
140
140
  if (z) {
141
141
  var t = e[r];
142
- return t === $t ? void 0 : t;
142
+ return t === Nt ? void 0 : t;
143
143
  }
144
144
  return Tt.call(e, r) ? e[r] : void 0;
145
145
  }
@@ -160,8 +160,8 @@ function w(r) {
160
160
  this.set(i[0], i[1]);
161
161
  }
162
162
  }
163
- w.prototype.clear = qt;
164
- w.prototype.delete = Nt;
163
+ w.prototype.clear = Vt;
164
+ w.prototype.delete = qt;
165
165
  w.prototype.get = zt;
166
166
  w.prototype.has = Dt;
167
167
  w.prototype.set = Bt;
@@ -170,7 +170,7 @@ function Kt() {
170
170
  }
171
171
  function B(r, e) {
172
172
  for (var t = r.length; t--; )
173
- if (xe(r[t][0], e))
173
+ if (Re(r[t][0], e))
174
174
  return t;
175
175
  return -1;
176
176
  }
@@ -193,23 +193,23 @@ function Qt(r, e) {
193
193
  var t = this.__data__, i = B(t, r);
194
194
  return i < 0 ? (++this.size, t.push([r, e])) : t[i][1] = e, this;
195
195
  }
196
- function V(r) {
196
+ function M(r) {
197
197
  var e = -1, t = r == null ? 0 : r.length;
198
198
  for (this.clear(); ++e < t; ) {
199
199
  var i = r[e];
200
200
  this.set(i[0], i[1]);
201
201
  }
202
202
  }
203
- V.prototype.clear = Kt;
204
- V.prototype.delete = Yt;
205
- V.prototype.get = Zt;
206
- V.prototype.has = Jt;
207
- V.prototype.set = Qt;
203
+ M.prototype.clear = Kt;
204
+ M.prototype.delete = Yt;
205
+ M.prototype.get = Zt;
206
+ M.prototype.has = Jt;
207
+ M.prototype.set = Qt;
208
208
  var At = te(A, "Map");
209
209
  function kt() {
210
210
  this.size = 0, this.__data__ = {
211
211
  hash: new w(),
212
- map: new (At || V)(),
212
+ map: new (At || M)(),
213
213
  string: new w()
214
214
  };
215
215
  }
@@ -275,46 +275,46 @@ var lr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=
275
275
  }), e;
276
276
  });
277
277
  function cr(r) {
278
- return r == null ? "" : Me(r);
278
+ return r == null ? "" : xe(r);
279
279
  }
280
- function Re(r, e) {
281
- return ee(r) ? r : Vt(r, e) ? [r] : fr(cr(r));
280
+ function $e(r, e) {
281
+ return ee(r) ? r : Mt(r, e) ? [r] : fr(cr(r));
282
282
  }
283
283
  var dr = 1 / 0;
284
- function Ve(r) {
284
+ function Me(r) {
285
285
  if (typeof r == "string" || k(r))
286
286
  return r;
287
287
  var e = r + "";
288
288
  return e == "0" && 1 / r == -dr ? "-0" : e;
289
289
  }
290
- function pr(r, e) {
291
- e = Re(e, r);
290
+ function hr(r, e) {
291
+ e = $e(e, r);
292
292
  for (var t = 0, i = e.length; r != null && t < i; )
293
- r = r[Ve(e[t++])];
293
+ r = r[Me(e[t++])];
294
294
  return t && t == i ? r : void 0;
295
295
  }
296
296
  function H(r, e, t) {
297
- var i = r == null ? void 0 : pr(r, e);
297
+ var i = r == null ? void 0 : hr(r, e);
298
298
  return i === void 0 ? t : i;
299
299
  }
300
- function hr(r, e, t, i) {
300
+ function pr(r, e, t, i) {
301
301
  if (!G(r))
302
302
  return r;
303
- e = Re(e, r);
303
+ e = $e(e, r);
304
304
  for (var s = -1, n = e.length, a = n - 1, u = r; u != null && ++s < n; ) {
305
- var f = Ve(e[s]), d = t;
305
+ var f = Me(e[s]), c = t;
306
306
  if (f === "__proto__" || f === "constructor" || f === "prototype")
307
307
  return r;
308
308
  if (s != a) {
309
- var p = u[f];
310
- d = i ? i(p, f, u) : void 0, d === void 0 && (d = G(p) ? p : Et(e[s + 1]) ? [] : {});
309
+ var h = u[f];
310
+ c = i ? i(h, f, u) : void 0, c === void 0 && (c = G(h) ? h : Et(e[s + 1]) ? [] : {});
311
311
  }
312
- Mt(u, f, d), u = u[f];
312
+ xt(u, f, c), u = u[f];
313
313
  }
314
314
  return r;
315
315
  }
316
316
  function _(r, e, t) {
317
- return r == null ? r : hr(r, e, t);
317
+ return r == null ? r : pr(r, e, t);
318
318
  }
319
319
  class o {
320
320
  static typeChecker(e) {
@@ -364,6 +364,8 @@ class o {
364
364
  return !1;
365
365
  if (this.isObjectEmpty(e))
366
366
  return !0;
367
+ if (e.__proform_raw_object)
368
+ return !1;
367
369
  for (const t in e) {
368
370
  if (t === "componentProps")
369
371
  return !1;
@@ -452,7 +454,7 @@ class mr {
452
454
  }
453
455
  submit() {
454
456
  var i;
455
- const e = (i = c.getPreset(this.runtimeCore.ui)) == null ? void 0 : i.adapter, t = I.adapters[c.getUI(this.runtimeCore.ui)];
457
+ const e = (i = d.getPreset(this.runtimeCore.ui)) == null ? void 0 : i.adapter, t = I.adapters[d.getUI(this.runtimeCore.ui)];
456
458
  return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
457
459
  }
458
460
  hydrate(e) {
@@ -560,6 +562,7 @@ class gr {
560
562
  l(this, "baseDefaultValueFunctionsLength");
561
563
  l(this, "isModelInitialized", !0);
562
564
  l(this, "schemaEffectHistory", /* @__PURE__ */ new Map());
565
+ l(this, "stableUpdaterHistory", /* @__PURE__ */ new Map());
563
566
  this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), E(
564
567
  () => this.processedModel.value,
565
568
  () => {
@@ -610,12 +613,17 @@ class gr {
610
613
  return t;
611
614
  }
612
615
  // 对于稳定初始化更新的抽象
613
- stableUpdater(e = []) {
616
+ stableUpdater(e = [], t, i, s, n) {
614
617
  if (e.every(Boolean)) {
615
- const t = x(this.processedSchemas.value);
616
- !o.isProcessInprogress(t) && o.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
617
- length: t.length
618
- }).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
618
+ const a = R(this.processedSchemas.value);
619
+ !o.isProcessInprogress(a) && o.isObjectEmpty(this.stableModel), !this.stableUpdaterHistory.get(
620
+ `${t == null ? void 0 : t.key}parentIndex:${t == null ? void 0 : t.index}childIndex:${i}${s}${n}`
621
+ ) && (this.stableUpdaterHistory.set(
622
+ `${t == null ? void 0 : t.key}parentIndex:${t == null ? void 0 : t.index}childIndex:${i}${s}${n}`,
623
+ !0
624
+ ), this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
625
+ length: a.length
626
+ }).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(a));
619
627
  }
620
628
  }
621
629
  // 核心单 schema 处理过程,接收一个对象键值对的数据结构
@@ -625,17 +633,29 @@ class gr {
625
633
  }).fill(!1);
626
634
  this.objectParser({ data: e, index: t, updater: a, parentMeta: i });
627
635
  function a(u) {
628
- const f = u.index, d = u.key, p = u.keyIndex;
636
+ const f = u.index, c = u.key, h = u.keyIndex;
629
637
  if (o.isUndefined(u.stable))
630
638
  return;
631
- const h = s.parseStable(u.stable), b = i == null ? void 0 : i.index, S = i == null ? void 0 : i.key;
632
- let y = h;
633
- if (o.isProcessInprogress(y) || (n[p] = !0), i) {
634
- const g = s.processedSchemas.value[b][S][f][d];
635
- g && o.isObject(g) && d !== "component" && (y = v(g, y)), s.processedSchemas.value[b][S][f][d] = y, s.stableUpdater(n);
639
+ const p = s.parseStable(u.stable), b = i == null ? void 0 : i.index, S = i == null ? void 0 : i.key;
640
+ let y = p;
641
+ if (o.isProcessInprogress(y) || (n[h] = !0), i) {
642
+ const g = s.processedSchemas.value[b][S][f][c];
643
+ g && o.isObject(g) && c !== "component" && (y = v(g, y)), s.processedSchemas.value[b][S][f][c] = y, s.stableUpdater(
644
+ n,
645
+ i,
646
+ t,
647
+ c,
648
+ f
649
+ );
636
650
  } else {
637
- const g = s.processedSchemas.value[f][d];
638
- g && o.isObject(g) && d !== "component" && (y = v(g, y)), s.processedSchemas.value[f][d] = y, s.stableUpdater(n);
651
+ const g = s.processedSchemas.value[f][c];
652
+ g && o.isObject(g) && c !== "component" && (y = v(g, y)), s.processedSchemas.value[f][c] = y, s.stableUpdater(
653
+ n,
654
+ i,
655
+ t,
656
+ c,
657
+ f
658
+ );
639
659
  }
640
660
  }
641
661
  }
@@ -651,19 +671,19 @@ class gr {
651
671
  keyIndex: n
652
672
  });
653
673
  else {
654
- const f = (d) => {
674
+ const f = (c) => {
655
675
  e.updater({
656
676
  ...e,
657
677
  key: s,
658
678
  keyIndex: n,
659
- stable: d
679
+ stable: c
660
680
  });
661
681
  };
662
682
  o.isFunction(t[s]) ? s !== "defaultValue" ? this.schemaEffect.trackEffect(
663
683
  () => {
664
684
  if (s === "component") {
665
- const d = t[s](this.getRuntimeMeta());
666
- this.promiseFieldParser(d, f, !1, {
685
+ const c = t[s](this.getRuntimeMeta());
686
+ this.promiseFieldParser(c, f, !1, {
667
687
  rootIndex: e.index,
668
688
  parentMeta: e.parentMeta
669
689
  });
@@ -679,21 +699,21 @@ class gr {
679
699
  }
680
700
  ) : this.defaultValueEffect.trackEffect(
681
701
  () => {
682
- const d = this.schemaEffect.trackEffect(
702
+ const c = this.schemaEffect.trackEffect(
683
703
  () => {
684
704
  /\{\s*model\s*\}/.test(t[s].toString()) ? this.fieldParser(
685
705
  t[s],
686
- (p) => {
687
- if (!p)
688
- return f(p);
689
- this.defaultValueInprogressMap.set(t[s], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
706
+ (h) => {
707
+ if (!h)
708
+ return f(h);
709
+ this.defaultValueInprogressMap.set(t[s], h), !o.isProcessInprogress(h) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
690
710
  this.defaultValueInprogressMap.values()
691
- ).every((h) => {
711
+ ).every((p) => {
692
712
  var b;
693
- return !((b = h == null ? void 0 : h.includes) != null && b.call(h, "undefined"));
694
- }) ? (f(p), this.defaultValueEffect.clearEffects(), C(() => {
695
- d();
696
- })) : f(p);
713
+ return !((b = p == null ? void 0 : p.includes) != null && b.call(p, "undefined"));
714
+ }) ? (f(h), this.defaultValueEffect.clearEffects(), C(() => {
715
+ c();
716
+ })) : f(h);
697
717
  },
698
718
  {
699
719
  rootIndex: e.index,
@@ -701,15 +721,15 @@ class gr {
701
721
  }
702
722
  ) : this.fieldParser(
703
723
  t[s],
704
- (p) => {
705
- this.defaultValueInprogressMap.set(t[s], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
724
+ (h) => {
725
+ this.defaultValueInprogressMap.set(t[s], h), !o.isProcessInprogress(h) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
706
726
  this.defaultValueInprogressMap.values()
707
- ).every((h) => {
727
+ ).every((p) => {
708
728
  var b;
709
- return !((b = h == null ? void 0 : h.includes) != null && b.call(h, "undefined"));
710
- }) ? (f(p), this.defaultValueEffect.clearEffects(), C(() => {
711
- d();
712
- })) : f(p);
729
+ return !((b = p == null ? void 0 : p.includes) != null && b.call(p, "undefined"));
730
+ }) ? (f(h), this.defaultValueEffect.clearEffects(), C(() => {
731
+ c();
732
+ })) : f(h);
713
733
  },
714
734
  {
715
735
  rootIndex: e.index,
@@ -806,9 +826,9 @@ class gr {
806
826
  }) : t(e);
807
827
  }
808
828
  modelProcessor(e) {
809
- e.map(
810
- (t) => this.createModel(t, this.processedModel.value)
811
- ), o.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && C(() => {
829
+ e.map((t) => {
830
+ this.createModel(t, this.processedModel.value);
831
+ }), o.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && C(() => {
812
832
  this.stableModel = P(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects();
813
833
  });
814
834
  }
@@ -837,22 +857,22 @@ class gr {
837
857
  }
838
858
  class j {
839
859
  static getFormContainer({ ui: e } = {}) {
840
- return c.presets.uiPresets[e ?? c.presets.ui].container.Form;
860
+ return d.presets.uiPresets[e ?? d.presets.ui].container.Form;
841
861
  }
842
862
  static getFormItemContainer({ ui: e } = {}) {
843
- return c.presets.uiPresets[e ?? c.presets.ui].container.FormItem;
863
+ return d.presets.uiPresets[e ?? d.presets.ui].container.FormItem;
844
864
  }
845
865
  static getItemContainer({ ui: e } = {}) {
846
- return c.presets.uiPresets[e ?? c.presets.ui].container.Item;
866
+ return d.presets.uiPresets[e ?? d.presets.ui].container.Item;
847
867
  }
848
868
  static getGroupContainer({ ui: e } = {}) {
849
- return c.presets.uiPresets[e ?? c.presets.ui].container.Group;
869
+ return d.presets.uiPresets[e ?? d.presets.ui].container.Group;
850
870
  }
851
871
  static getListContainer({ ui: e } = {}) {
852
- return c.presets.uiPresets[e ?? c.presets.ui].container.List;
872
+ return d.presets.uiPresets[e ?? d.presets.ui].container.List;
853
873
  }
854
874
  static getListItemContainer({ ui: e } = {}) {
855
- return c.presets.uiPresets[e ?? c.presets.ui].container.ListItem;
875
+ return d.presets.uiPresets[e ?? d.presets.ui].container.ListItem;
856
876
  }
857
877
  }
858
878
  class vr {
@@ -861,31 +881,31 @@ class vr {
861
881
  }
862
882
  getRuntimeNative() {
863
883
  var t;
864
- return (t = c.presets.uiPresets[this.ui]) == null ? void 0 : t.native;
884
+ return (t = d.presets.uiPresets[this.ui]) == null ? void 0 : t.native;
865
885
  }
866
886
  getRuntimeField(e) {
867
887
  var s;
868
- const t = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
888
+ const t = (s = d.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[d.getUI(this.ui)];
869
889
  return (t == null ? void 0 : t.getRuntimeField(e)) ?? (i == null ? void 0 : i.getRuntimeField(e));
870
890
  }
871
891
  getRuntimeRequired(e) {
872
892
  var s;
873
- const t = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
893
+ const t = (s = d.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[d.getUI(this.ui)];
874
894
  return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (i == null ? void 0 : i.getRuntimeRequired(e));
875
895
  }
876
896
  getFormModelPropName() {
877
897
  var i;
878
- const e = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, t = I.adapters[c.getUI(this.ui)];
898
+ const e = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, t = I.adapters[d.getUI(this.ui)];
879
899
  return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
880
900
  }
881
901
  formComponentRenderer(e) {
882
902
  var s;
883
- const t = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
903
+ const t = (s = d.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[d.getUI(this.ui)];
884
904
  return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (i == null ? void 0 : i.formComponentRenderer(e));
885
905
  }
886
906
  clearValidate(e) {
887
907
  var s;
888
- const t = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
908
+ const t = (s = d.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[d.getUI(this.ui)];
889
909
  return (t == null ? void 0 : t.clearValidate(e)) ?? (i == null ? void 0 : i.clearValidate(e));
890
910
  }
891
911
  }
@@ -920,7 +940,7 @@ class yr {
920
940
  l(this, "shareHistory", /* @__PURE__ */ new Map());
921
941
  this.setup = e, this.processor = new gr(this);
922
942
  const t = this.setup(this);
923
- this.ui = t.ui ?? c.presets.ui, this.runtimeAdapter = new vr(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), U(t.schemas) ? E(
943
+ this.ui = t.ui ?? d.presets.ui, this.runtimeAdapter = new vr(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), U(t.schemas) ? E(
924
944
  // @ts-expect-error
925
945
  () => t.schemas.value,
926
946
  () => {
@@ -937,7 +957,7 @@ class yr {
937
957
  }
938
958
  getRuntimeMeta() {
939
959
  return {
940
- model: x(P(this.model.value)),
960
+ model: R(P(this.model.value)),
941
961
  reactiveModel: this.model.value,
942
962
  shared: this.shared,
943
963
  // share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
@@ -955,43 +975,43 @@ class yr {
955
975
  };
956
976
  }
957
977
  runtimeItemProcessor(e, t, i = this.model.value, s) {
958
- var se, ne, oe, ae, le, ue, fe, ce, de, pe, he, me, ge, ve, be, ye, _e;
959
- const n = x(e.component);
978
+ var se, ne, oe, ae, le, ue, fe, ce, de, he, pe, me, ge, ve, be, ye, _e;
979
+ const n = R(e.component);
960
980
  if (!n)
961
981
  return;
962
982
  (ne = (se = e.native) == null ? void 0 : se.props) != null && ne.Form && v(this.globalNativeFormOverride.props.Form, (ae = (oe = e.native) == null ? void 0 : oe.props) == null ? void 0 : ae.Form), (ue = (le = e.native) == null ? void 0 : le.slots) != null && ue.Form && v(this.globalNativeFormOverride.slots.Form, (ce = (fe = e.native) == null ? void 0 : fe.slots) == null ? void 0 : ce.Form);
963
- const a = v(P((pe = (de = this.native) == null ? void 0 : de.slots) == null ? void 0 : pe.FormItem) ?? {}, (me = (he = e.native) == null ? void 0 : he.slots) == null ? void 0 : me.FormItem), u = {
983
+ const a = v(P((he = (de = this.native) == null ? void 0 : de.slots) == null ? void 0 : he.FormItem) ?? {}, (me = (pe = e.native) == null ? void 0 : pe.slots) == null ? void 0 : me.FormItem), u = {
964
984
  display: "grid",
965
985
  gridColumn: "1 / -1",
966
986
  ...e.grid
967
- }, f = v(P((ve = (ge = this.native) == null ? void 0 : ge.props) == null ? void 0 : ve.FormItem) ?? {}, (ye = (be = e.native) == null ? void 0 : be.props) == null ? void 0 : ye.FormItem), d = this.runtimeAdapter.getRuntimeField({
987
+ }, f = v(P((ve = (ge = this.native) == null ? void 0 : ge.props) == null ? void 0 : ve.FormItem) ?? {}, (ye = (be = e.native) == null ? void 0 : be.props) == null ? void 0 : ye.FormItem), c = this.runtimeAdapter.getRuntimeField({
968
988
  schema: e,
969
989
  parentSchema: s,
970
990
  index: t
971
- }), p = n.name, h = e.componentProps ?? {}, b = I.placeholderPresetByComponentName;
991
+ }), h = n.name, p = e.componentProps ?? {}, b = I.placeholderPresetByComponentName;
972
992
  let S = e.placeholder, y = e.show;
973
993
  y === void 0 && (y = !0);
974
994
  let g = e.label ?? "", O;
975
995
  if (e.runtime ? O = e.runtime : O = (s == null ? void 0 : s.runtime) ?? this.runtime, !o.isUndefined(t) && !o.isObjectEmpty(O) && (g = Z((_e = O == null ? void 0 : O.customizeListItemLabel) == null ? void 0 : _e.call(O, e.label ?? "", t + 1), "")), !S) {
976
- let q = "请输入";
977
- o.isUndefined(p) ? S = `${q}${g}` : /* @ts-expect-error */ b[p.toLowerCase()] ? (q = // @ts-expect-error
978
- b[p.toLowerCase()], S = `${q}${g}`) : (Object.keys(b).forEach((Pe) => {
979
- p.toLowerCase().includes(Pe.toLowerCase()) && (q = b[Pe]);
980
- }), S = `${q}${g}`);
996
+ let V = "请输入";
997
+ o.isUndefined(h) ? S = `${V}${g}` : /* @ts-expect-error */ b[h.toLowerCase()] ? (V = // @ts-expect-error
998
+ b[h.toLowerCase()], S = `${V}${g}`) : (Object.keys(b).forEach((Pe) => {
999
+ h.toLowerCase().includes(Pe.toLowerCase()) && (V = b[Pe]);
1000
+ }), S = `${V}${g}`);
981
1001
  }
982
- const qe = this.runtimeAdapter.getRuntimeRequired({
1002
+ const Ve = this.runtimeAdapter.getRuntimeRequired({
983
1003
  ...e,
984
1004
  label: g
985
- }), Ne = j.getItemContainer(this), $e = j.getFormItemContainer(this), Ue = this, Te = e.componentSlots;
1005
+ }), qe = j.getItemContainer(this), Ne = j.getFormItemContainer(this), Ue = this, Te = e.componentSlots;
986
1006
  return m("div", {
987
1007
  style: u
988
- }, [m(Ne, {
1008
+ }, [m(qe, {
989
1009
  show: y
990
1010
  }, {
991
1011
  default() {
992
- return y && m($e, $(f, {
1012
+ return y && m(Ne, N(f, {
993
1013
  label: `${g ? `${g}:` : ""}`
994
- }, d, qe), {
1014
+ }, c, Ve), {
995
1015
  default() {
996
1016
  return Ue.runtimeAdapter.formComponentRenderer({
997
1017
  Component: n,
@@ -999,7 +1019,7 @@ class yr {
999
1019
  baseModel: i,
1000
1020
  placeholder: S,
1001
1021
  componentSlots: Te,
1002
- props: h
1022
+ props: p
1003
1023
  });
1004
1024
  },
1005
1025
  ...a
@@ -1048,16 +1068,16 @@ class yr {
1048
1068
  default() {
1049
1069
  return i.model.value[e.field].map((u, f) => m(a, null, {
1050
1070
  default() {
1051
- return e.children.map((d) => i.runtimeItemProcessor(d, f, u, e));
1071
+ return e.children.map((c) => i.runtimeItemProcessor(c, f, u, e));
1052
1072
  },
1053
1073
  delete({
1054
- container: d
1074
+ container: c
1055
1075
  } = {}) {
1056
- var h;
1057
- const p = d ?? m("button", null, null);
1058
- return He(m(p, {
1076
+ var p;
1077
+ const h = c ?? m("button", null, null);
1078
+ return He(m(h, {
1059
1079
  onClick: () => i.deleteListItem(e, f)
1060
- }, null), [[De, ((h = i.model.value[e.field]) == null ? void 0 : h.length) > 1]]);
1080
+ }, null), [[De, ((p = i.model.value[e.field]) == null ? void 0 : p.length) > 1]]);
1061
1081
  }
1062
1082
  }));
1063
1083
  },
@@ -1075,14 +1095,14 @@ class yr {
1075
1095
  return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
1076
1096
  }
1077
1097
  exec() {
1078
- var u, f, d, p;
1098
+ var u, f, c, h;
1079
1099
  const e = {
1080
1100
  display: "grid",
1081
1101
  gridColumn: "1 / -1",
1082
1102
  gridAutoColumns: "1fr",
1083
1103
  ...this.grid
1084
- }, t = this, i = v(this.globalNativeFormOverride.props.Form, P((f = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : f.Form) ?? {}), s = v(this.globalNativeFormOverride.slots.Form, P((p = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : p.Form) ?? {}), n = j.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
1085
- return m(n, $(i, {
1104
+ }, t = this, i = v(this.globalNativeFormOverride.props.Form, P((f = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : f.Form) ?? {}), s = v(this.globalNativeFormOverride.slots.Form, P((h = (c = this.native) == null ? void 0 : c.slots) == null ? void 0 : h.Form) ?? {}), n = j.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
1105
+ return m(n, N(i, {
1086
1106
  ref: this.formRef
1087
1107
  }, {
1088
1108
  [a]: this.model.value
@@ -1096,7 +1116,7 @@ class yr {
1096
1116
  });
1097
1117
  }
1098
1118
  }
1099
- class c {
1119
+ class d {
1100
1120
  static getPreset(e) {
1101
1121
  var t, i, s;
1102
1122
  return (i = (t = this.presets.uiPresets) == null ? void 0 : t[e]) != null && i.extend ? this.presets.uiPresets[(s = this.presets.uiPresets[e]) == null ? void 0 : s.extend] : this.presets.uiPresets[e];
@@ -1106,7 +1126,7 @@ class c {
1106
1126
  return (i = (t = this.presets.uiPresets) == null ? void 0 : t[e]) != null && i.extend ? (s = this.presets.uiPresets[e]) == null ? void 0 : s.extend : e;
1107
1127
  }
1108
1128
  }
1109
- l(c, "presets");
1129
+ l(d, "presets");
1110
1130
  function Y({
1111
1131
  parentSchema: r,
1112
1132
  schema: e,
@@ -1161,7 +1181,7 @@ const _r = {
1161
1181
  props: n
1162
1182
  }) {
1163
1183
  let a;
1164
- return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, $({
1184
+ return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, N({
1165
1185
  modelValue: a,
1166
1186
  "onUpdate:modelValue": (u) => {
1167
1187
  o.isFunction(t.field) ? _(e, t.field(), u) : e[t.field] = u;
@@ -1173,7 +1193,7 @@ const _r = {
1173
1193
  },
1174
1194
  validateForm(r) {
1175
1195
  return new Promise((e, t) => {
1176
- r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(x(r.runtimeCore.processor.processedModel.value))));
1196
+ r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(R(r.runtimeCore.processor.processedModel.value))));
1177
1197
  });
1178
1198
  },
1179
1199
  clearValidate(r) {
@@ -1228,7 +1248,7 @@ const _r = {
1228
1248
  props: n
1229
1249
  }) {
1230
1250
  let a;
1231
- return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, $({
1251
+ return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, N({
1232
1252
  modelValue: a,
1233
1253
  "onUpdate:modelValue": (u) => {
1234
1254
  o.isFunction(t.field) ? _(e, t.field(), u) : e[t.field] = u;
@@ -1244,7 +1264,7 @@ const _r = {
1244
1264
  valid: i,
1245
1265
  errors: s
1246
1266
  }) => {
1247
- i ? e(r.cleanFallbackFields(x(r.runtimeCore.processor.processedModel.value))) : t(s);
1267
+ i ? e(r.cleanFallbackFields(R(r.runtimeCore.processor.processedModel.value))) : t(s);
1248
1268
  });
1249
1269
  });
1250
1270
  },
@@ -1302,7 +1322,7 @@ const _r = {
1302
1322
  props: n
1303
1323
  }) {
1304
1324
  let a;
1305
- return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, $({
1325
+ return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, N({
1306
1326
  value: a,
1307
1327
  "onUpdate:value": (u) => {
1308
1328
  o.isFunction(t.field) ? _(e, t.field(), u) : e[t.field] = u;
@@ -1314,7 +1334,7 @@ const _r = {
1314
1334
  },
1315
1335
  validateForm(r) {
1316
1336
  return new Promise((e, t) => {
1317
- r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(x(r.runtimeCore.processor.processedModel.value))));
1337
+ r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(R(r.runtimeCore.processor.processedModel.value))));
1318
1338
  });
1319
1339
  },
1320
1340
  clearValidate(r) {
@@ -1322,7 +1342,7 @@ const _r = {
1322
1342
  (t = (e = r.formRef.value) == null ? void 0 : e.restoreValidation) == null || t.call(e);
1323
1343
  }
1324
1344
  }
1325
- }, M = class M {
1345
+ }, x = class x {
1326
1346
  static getPlaceholderPrefixPresetByComponentName() {
1327
1347
  const e = {
1328
1348
  请选择: ["select", "tree"],
@@ -1335,7 +1355,7 @@ const _r = {
1335
1355
  return t;
1336
1356
  }
1337
1357
  };
1338
- l(M, "schemaPreset", {
1358
+ l(x, "schemaPreset", {
1339
1359
  type: {
1340
1360
  defaultValue: "item"
1341
1361
  },
@@ -1381,13 +1401,13 @@ l(M, "schemaPreset", {
1381
1401
  runtime: {
1382
1402
  default: void 0
1383
1403
  }
1384
- }), l(M, "componentPropsPreset", {
1404
+ }), l(x, "componentPropsPreset", {
1385
1405
  options: {
1386
1406
  defaultValue: []
1387
1407
  }
1388
1408
  }), // 基于基本功能提出基本预设
1389
- l(M, "placeholderPresetByComponentName", M.getPlaceholderPrefixPresetByComponentName());
1390
- let Q = M;
1409
+ l(x, "placeholderPresetByComponentName", x.getPlaceholderPrefixPresetByComponentName());
1410
+ let Q = x;
1391
1411
  const I = {
1392
1412
  ...Q,
1393
1413
  adapters: {
@@ -1419,7 +1439,7 @@ function Sr(r) {
1419
1439
  ];
1420
1440
  }
1421
1441
  function Or(r) {
1422
- c.presets = r;
1442
+ d.presets = r;
1423
1443
  }
1424
1444
  function ie(r, e) {
1425
1445
  return e === "native" && Object.defineProperty(r, "name", {
@@ -23,13 +23,14 @@ export default class Processor {
23
23
  baseDefaultValueFunctionsLength: number;
24
24
  isModelInitialized: boolean;
25
25
  schemaEffectHistory: Map<any, any>;
26
+ stableUpdaterHistory: Map<any, any>;
26
27
  constructor(runtimeCore: RuntimeCore);
27
28
  parse<T extends object = any>(data: T[], parentMeta?: AnyObject): void;
28
29
  initSchemas(schemas: AnyObject[]): AnyObject[];
29
30
  countFunctionDefaultValues(input: AnyObject): number;
30
31
  parseSchemas(schemas: ProxyedSchema[], parentMeta?: AnyObject): void;
31
32
  parseStable(stable: AnyObject): AnyObject;
32
- stableUpdater(parseProcess?: boolean[]): void;
33
+ stableUpdater(parseProcess?: boolean[], parentMeta?: AnyObject, index?: number, key?: string, keyIndex?: number): void;
33
34
  parseItem(data: AnyObject, index: number, parentMeta?: AnyObject): void;
34
35
  objectParser(root: ObjectParserRoot): void;
35
36
  promiseFieldParser(rootField: any, updater: AnyFunction, deepProcess: boolean, meta: AnyObject): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",