@harbor-design/proform 1.3.7 → 1.3.9

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,7 +1,7 @@
1
- var Ue = Object.defineProperty;
2
- var ze = (t, e, r) => e in t ? Ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
1
+ var Te = Object.defineProperty;
2
+ var ze = (t, e, r) => e in t ? Te(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
3
  var u = (t, e, r) => (ze(t, typeof e != "symbol" ? e + "" : e, r), r);
4
- import { ref as z, readonly as _e, nextTick as P, isRef as T, watch as _, isReactive as q, toRaw as F, reactive as Pe, createVNode as g, mergeProps as N, withDirectives as Le, vShow as De, createTextVNode as Ge, isVNode as We, defineComponent as Be } from "vue";
4
+ import { ref as z, readonly as _e, nextTick as P, isRef as q, watch as _, isReactive as U, toRaw as F, reactive as Pe, createVNode as g, mergeProps as N, withDirectives as Le, vShow as De, createTextVNode as Ge, isVNode as We, defineComponent as Be } from "vue";
5
5
  class o {
6
6
  static typeChecker(e) {
7
7
  return {}.toString.call(e);
@@ -145,7 +145,7 @@ class ke {
145
145
  P(() => {
146
146
  this.runtimeCore.hydrateEffect.trackEffect(
147
147
  () => {
148
- T(e) ? _(
148
+ q(e) ? _(
149
149
  () => e.value,
150
150
  () => {
151
151
  h(this.runtimeCore.model.value, e.value);
@@ -154,7 +154,7 @@ class ke {
154
154
  deep: !0,
155
155
  immediate: !0
156
156
  }
157
- ) : q(e) ? _(
157
+ ) : U(e) ? _(
158
158
  () => e,
159
159
  () => {
160
160
  h(this.runtimeCore.model.value, e);
@@ -173,7 +173,7 @@ class ke {
173
173
  }
174
174
  share(e) {
175
175
  P(() => {
176
- if (T(e)) {
176
+ if (q(e)) {
177
177
  const r = _(
178
178
  () => e.value,
179
179
  () => {
@@ -186,7 +186,7 @@ class ke {
186
186
  immediate: !0
187
187
  }
188
188
  );
189
- } else if (q(e)) {
189
+ } else if (U(e)) {
190
190
  const r = _(
191
191
  () => e,
192
192
  () => {
@@ -247,7 +247,7 @@ class X {
247
247
  return !r.lazy && e(), r.identifier ? this.identifierMap.get(r.identifier) || (this.effects.add(e), this.identifierMap.set(r.identifier, !0)) : this.effects.add(e), () => this.effects.delete(e);
248
248
  }
249
249
  }
250
- var He = typeof global == "object" && global && global.Object === Object && global, Ke = typeof self == "object" && self && self.Object === Object && self, Z = He || Ke || Function("return this")(), x = Z.Symbol, je = Object.prototype, Xe = je.hasOwnProperty, Ye = je.toString, V = x ? x.toStringTag : void 0;
250
+ var He = typeof global == "object" && global && global.Object === Object && global, Ke = typeof self == "object" && self && self.Object === Object && self, Z = He || Ke || Function("return this")(), x = Z.Symbol, Me = Object.prototype, Xe = Me.hasOwnProperty, Ye = Me.toString, V = x ? x.toStringTag : void 0;
251
251
  function Ze(t) {
252
252
  var e = Xe.call(t, V), r = t[V];
253
253
  try {
@@ -263,7 +263,7 @@ function Ae(t) {
263
263
  return Qe.call(t);
264
264
  }
265
265
  var et = "[object Null]", tt = "[object Undefined]", Ce = x ? x.toStringTag : void 0;
266
- function Ee(t) {
266
+ function je(t) {
267
267
  return t == null ? t === void 0 ? tt : et : Ce && Ce in Object(t) ? Ze(t) : Ae(t);
268
268
  }
269
269
  function rt(t) {
@@ -271,7 +271,7 @@ function rt(t) {
271
271
  }
272
272
  var st = "[object Symbol]";
273
273
  function J(t) {
274
- return typeof t == "symbol" || rt(t) && Ee(t) == st;
274
+ return typeof t == "symbol" || rt(t) && je(t) == st;
275
275
  }
276
276
  function it(t, e) {
277
277
  for (var r = -1, s = t == null ? 0 : t.length, i = Array(s); ++r < s; )
@@ -297,7 +297,7 @@ var ot = "[object AsyncFunction]", at = "[object Function]", lt = "[object Gener
297
297
  function ct(t) {
298
298
  if (!G(t))
299
299
  return !1;
300
- var e = Ee(t);
300
+ var e = je(t);
301
301
  return e == at || e == lt || e == ot || e == ut;
302
302
  }
303
303
  var k = Z["__core-js_shared__"], Oe = function() {
@@ -337,19 +337,19 @@ function A(t, e) {
337
337
  var r = It(t, e);
338
338
  return Ct(r) ? r : void 0;
339
339
  }
340
- var Me = function() {
340
+ var Ee = function() {
341
341
  try {
342
342
  var t = A(Object, "defineProperty");
343
343
  return t({}, "", {}), t;
344
344
  } catch {
345
345
  }
346
346
  }(), St = 9007199254740991, Ot = /^(?:0|[1-9]\d*)$/;
347
- function Mt(t, e) {
347
+ function Et(t, e) {
348
348
  var r = typeof t;
349
349
  return e = e ?? St, !!e && (r == "number" || r != "symbol" && Ot.test(t)) && t > -1 && t % 1 == 0 && t < e;
350
350
  }
351
- function jt(t, e, r) {
352
- e == "__proto__" && Me ? Me(t, e, {
351
+ function Mt(t, e, r) {
352
+ e == "__proto__" && Ee ? Ee(t, e, {
353
353
  configurable: !0,
354
354
  enumerable: !0,
355
355
  value: r,
@@ -359,10 +359,10 @@ function jt(t, e, r) {
359
359
  function Fe(t, e) {
360
360
  return t === e || t !== t && e !== e;
361
361
  }
362
- var Et = Object.prototype, wt = Et.hasOwnProperty;
362
+ var jt = Object.prototype, wt = jt.hasOwnProperty;
363
363
  function Ft(t, e, r) {
364
364
  var s = t[e];
365
- (!(wt.call(t, e) && Fe(s, r)) || r === void 0 && !(e in t)) && jt(t, e, r);
365
+ (!(wt.call(t, e) && Fe(s, r)) || r === void 0 && !(e in t)) && Mt(t, e, r);
366
366
  }
367
367
  var xt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Rt = /^\w*$/;
368
368
  function $t(t, e) {
@@ -371,45 +371,45 @@ function $t(t, e) {
371
371
  var r = typeof t;
372
372
  return r == "number" || r == "symbol" || r == "boolean" || t == null || J(t) ? !0 : Rt.test(t) || !xt.test(t) || e != null && t in Object(e);
373
373
  }
374
- var U = A(Object, "create");
374
+ var T = A(Object, "create");
375
375
  function Vt() {
376
- this.__data__ = U ? U(null) : {}, this.size = 0;
376
+ this.__data__ = T ? T(null) : {}, this.size = 0;
377
377
  }
378
378
  function Nt(t) {
379
379
  var e = this.has(t) && delete this.__data__[t];
380
380
  return this.size -= e ? 1 : 0, e;
381
381
  }
382
- var Tt = "__lodash_hash_undefined__", qt = Object.prototype, Ut = qt.hasOwnProperty;
382
+ var qt = "__lodash_hash_undefined__", Ut = Object.prototype, Tt = Ut.hasOwnProperty;
383
383
  function zt(t) {
384
384
  var e = this.__data__;
385
- if (U) {
385
+ if (T) {
386
386
  var r = e[t];
387
- return r === Tt ? void 0 : r;
387
+ return r === qt ? void 0 : r;
388
388
  }
389
- return Ut.call(e, t) ? e[t] : void 0;
389
+ return Tt.call(e, t) ? e[t] : void 0;
390
390
  }
391
391
  var Lt = Object.prototype, Dt = Lt.hasOwnProperty;
392
392
  function Gt(t) {
393
393
  var e = this.__data__;
394
- return U ? e[t] !== void 0 : Dt.call(e, t);
394
+ return T ? e[t] !== void 0 : Dt.call(e, t);
395
395
  }
396
396
  var Wt = "__lodash_hash_undefined__";
397
397
  function Bt(t, e) {
398
398
  var r = this.__data__;
399
- return this.size += this.has(t) ? 0 : 1, r[t] = U && e === void 0 ? Wt : e, this;
399
+ return this.size += this.has(t) ? 0 : 1, r[t] = T && e === void 0 ? Wt : e, this;
400
400
  }
401
- function M(t) {
401
+ function E(t) {
402
402
  var e = -1, r = t == null ? 0 : t.length;
403
403
  for (this.clear(); ++e < r; ) {
404
404
  var s = t[e];
405
405
  this.set(s[0], s[1]);
406
406
  }
407
407
  }
408
- M.prototype.clear = Vt;
409
- M.prototype.delete = Nt;
410
- M.prototype.get = zt;
411
- M.prototype.has = Gt;
412
- M.prototype.set = Bt;
408
+ E.prototype.clear = Vt;
409
+ E.prototype.delete = Nt;
410
+ E.prototype.get = zt;
411
+ E.prototype.has = Gt;
412
+ E.prototype.set = Bt;
413
413
  function kt() {
414
414
  this.__data__ = [], this.size = 0;
415
415
  }
@@ -453,9 +453,9 @@ R.prototype.set = Jt;
453
453
  var Qt = A(Z, "Map");
454
454
  function At() {
455
455
  this.size = 0, this.__data__ = {
456
- hash: new M(),
456
+ hash: new E(),
457
457
  map: new (Qt || R)(),
458
- string: new M()
458
+ string: new E()
459
459
  };
460
460
  }
461
461
  function er(t) {
@@ -480,18 +480,18 @@ function ir(t, e) {
480
480
  var r = B(this, t), s = r.size;
481
481
  return r.set(t, e), this.size += r.size == s ? 0 : 1, this;
482
482
  }
483
- function j(t) {
483
+ function M(t) {
484
484
  var e = -1, r = t == null ? 0 : t.length;
485
485
  for (this.clear(); ++e < r; ) {
486
486
  var s = t[e];
487
487
  this.set(s[0], s[1]);
488
488
  }
489
489
  }
490
- j.prototype.clear = At;
491
- j.prototype.delete = tr;
492
- j.prototype.get = rr;
493
- j.prototype.has = sr;
494
- j.prototype.set = ir;
490
+ M.prototype.clear = At;
491
+ M.prototype.delete = tr;
492
+ M.prototype.get = rr;
493
+ M.prototype.has = sr;
494
+ M.prototype.set = ir;
495
495
  var nr = "Expected a function";
496
496
  function ee(t, e) {
497
497
  if (typeof t != "function" || e != null && typeof e != "function")
@@ -503,9 +503,9 @@ function ee(t, e) {
503
503
  var a = t.apply(this, s);
504
504
  return r.cache = n.set(i, a) || n, a;
505
505
  };
506
- return r.cache = new (ee.Cache || j)(), r;
506
+ return r.cache = new (ee.Cache || M)(), r;
507
507
  }
508
- ee.Cache = j;
508
+ ee.Cache = M;
509
509
  var or = 500;
510
510
  function ar(t) {
511
511
  var e = ee(t, function(s) {
@@ -552,7 +552,7 @@ function hr(t, e, r, s) {
552
552
  return t;
553
553
  if (i != a) {
554
554
  var p = l[c];
555
- d = s ? s(p, c, l) : void 0, d === void 0 && (d = G(p) ? p : Mt(e[i + 1]) ? [] : {});
555
+ d = s ? s(p, c, l) : void 0, d === void 0 && (d = G(p) ? p : Et(e[i + 1]) ? [] : {});
556
556
  }
557
557
  Ft(l, c, d), l = l[c];
558
558
  }
@@ -578,14 +578,11 @@ class mr {
578
578
  u(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
579
579
  u(this, "baseDefaultValueFunctionsLength");
580
580
  u(this, "isModelInitialized", !0);
581
- u(this, "modelTriggerTimer");
582
581
  u(this, "reactiveWatchMap", /* @__PURE__ */ new Map());
583
582
  this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), _(
584
583
  () => this.processedModel.value,
585
584
  () => {
586
- this.modelTriggerTimer && clearTimeout(this.modelTriggerTimer), this.modelTriggerTimer = setTimeout(() => {
587
- this.schemaEffect.triggerEffects();
588
- }, 0);
585
+ this.schemaEffect.triggerEffects();
589
586
  },
590
587
  {
591
588
  deep: !0
@@ -792,7 +789,7 @@ class mr {
792
789
  e.name.startsWith("__proform_onetime_") && (e.__proform_cached_result = n), this.promiseFieldParser(n, r, i, s);
793
790
  }
794
791
  else
795
- T(e) ? _(
792
+ q(e) ? _(
796
793
  () => e.value,
797
794
  () => {
798
795
  o.isUndefined(e.value) || (i && o.isObject(e.value) && !o.isNativeObject(e.value) ? this.objectParser({
@@ -806,7 +803,7 @@ class mr {
806
803
  immediate: !0,
807
804
  deep: !0
808
805
  }
809
- ) : q(e) ? _(
806
+ ) : U(e) ? _(
810
807
  () => e,
811
808
  () => {
812
809
  this.reactiveWatchMap.get(e) || (this.reactiveWatchMap.set(e, !0), !o.isArrayEmpty(e) && !o.isObjectEmpty(e) && (o.isUndefined(e) || (i && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
@@ -852,7 +849,7 @@ class mr {
852
849
  }
853
850
  }
854
851
  }
855
- class E {
852
+ class j {
856
853
  static getFormContainer({ ui: e } = {}) {
857
854
  return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
858
855
  }
@@ -936,19 +933,21 @@ class br {
936
933
  u(this, "shared", {});
937
934
  this.setup = e, this.processor = new mr(this);
938
935
  const r = this.setup(this);
939
- this.ui = r.ui ?? f.presets.ui, this.runtimeAdapter = new gr(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), T(r.schemas) ? _(
936
+ this.ui = r.ui ?? f.presets.ui, this.runtimeAdapter = new gr(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), q(r.schemas) ? _(
940
937
  // @ts-expect-error
941
938
  () => r.schemas.value,
942
939
  () => {
943
940
  this.processor.schemaEffect.clearEffects(), this.processor.processedSchemas.value = [], this.processor.processedModel.value = {}, this.processor.stableModel = {}, this.processor.parseSchemas(r.schemas.value);
944
941
  },
945
942
  {
946
- deep: !0
943
+ deep: !0,
944
+ immediate: !0
947
945
  }
948
- ) : q(r.schemas) ? _(() => r.schemas, () => {
946
+ ) : U(r.schemas) ? _(() => r.schemas, () => {
949
947
  this.processor.schemaEffect.clearEffects(), this.processor.processedSchemas.value = [], this.processor.processedModel.value = {}, this.processor.stableModel = {}, this.processor.parseSchemas(r.schemas);
950
948
  }, {
951
- deep: !0
949
+ deep: !0,
950
+ immediate: !0
952
951
  }) : this.processor.parseSchemas(r.schemas);
953
952
  }
954
953
  getRuntimeMeta() {
@@ -958,18 +957,18 @@ class br {
958
957
  shared: this.shared,
959
958
  // share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
960
959
  share: (r) => {
961
- if (T(r)) {
960
+ if (q(r)) {
962
961
  const s = _(() => r.value, () => {
963
- h(this.shared, r.value), P(() => {
962
+ h(this.shared, r.value), this.processor.schemaEffect.triggerEffects(), P(() => {
964
963
  s();
965
964
  });
966
965
  }, {
967
966
  deep: !0,
968
967
  immediate: !0
969
968
  });
970
- } else if (q(r)) {
969
+ } else if (U(r)) {
971
970
  const s = _(() => r, () => {
972
- h(this.shared, r), P(() => {
971
+ h(this.shared, r), this.processor.schemaEffect.triggerEffects(), P(() => {
973
972
  s();
974
973
  });
975
974
  }, {
@@ -977,7 +976,7 @@ class br {
977
976
  immediate: !0
978
977
  });
979
978
  } else
980
- h(this.shared, r);
979
+ h(this.shared, r), this.processor.schemaEffect.triggerEffects();
981
980
  }
982
981
  };
983
982
  }
@@ -1009,7 +1008,7 @@ class br {
1009
1008
  const $e = this.runtimeAdapter.getRuntimeRequired({
1010
1009
  ...e,
1011
1010
  label: y
1012
- }), Ve = E.getItemContainer(this), Ne = E.getFormItemContainer(this), Te = this, qe = e.componentSlots;
1011
+ }), Ve = j.getItemContainer(this), Ne = j.getFormItemContainer(this), qe = this, Ue = e.componentSlots;
1013
1012
  return g("div", {
1014
1013
  style: l
1015
1014
  }, [g(Ve, {
@@ -1020,12 +1019,12 @@ class br {
1020
1019
  label: `${y ? `${y}:` : ""}`
1021
1020
  }, d, $e), {
1022
1021
  default() {
1023
- return Te.runtimeAdapter.formComponentRenderer({
1022
+ return qe.runtimeAdapter.formComponentRenderer({
1024
1023
  Component: n,
1025
1024
  schema: e,
1026
1025
  baseModel: s,
1027
1026
  placeholder: S,
1028
- componentSlots: qe,
1027
+ componentSlots: Ue,
1029
1028
  props: m
1030
1029
  });
1031
1030
  },
@@ -1040,7 +1039,7 @@ class br {
1040
1039
  display: "grid",
1041
1040
  gridColumn: "1 / -1",
1042
1041
  ...e.grid
1043
- }, i = E.getGroupContainer(this);
1042
+ }, i = j.getGroupContainer(this);
1044
1043
  let n = e.show;
1045
1044
  return n === void 0 && (n = !0), g("div", {
1046
1045
  style: s
@@ -1052,7 +1051,7 @@ class br {
1052
1051
  }
1053
1052
  addListItem(e) {
1054
1053
  var r, s;
1055
- if (!((r = this.processor.stableModel[e.field]) != null && r[0]))
1054
+ if (console.log("this", this.processor.stableModel), !((r = this.processor.stableModel[e.field]) != null && r[0]))
1056
1055
  return Promise.reject({
1057
1056
  code: "0001",
1058
1057
  message: "异步默认值数据正在处理中,请您耐心等待... "
@@ -1071,7 +1070,7 @@ class br {
1071
1070
  s.model.value[e.field] || (s.model.value[e.field] = [{}]);
1072
1071
  let i = e.show;
1073
1072
  i === void 0 && (i = !0);
1074
- const n = E.getListContainer(this), a = E.getListItemContainer(this);
1073
+ const n = j.getListContainer(this), a = j.getListItemContainer(this);
1075
1074
  return g("div", {
1076
1075
  style: r
1077
1076
  }, [i && g(n, {
@@ -1113,7 +1112,7 @@ class br {
1113
1112
  gridColumn: "1 / -1",
1114
1113
  gridAutoColumns: "1fr",
1115
1114
  ...this.grid
1116
- }, r = this, s = h(this.globalNativeFormOverride.props.Form, C((c = (l = this.native) == null ? void 0 : l.props) == null ? void 0 : c.Form) ?? {}), i = h(this.globalNativeFormOverride.slots.Form, C((p = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : p.Form) ?? {}), n = E.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
1115
+ }, r = this, s = h(this.globalNativeFormOverride.props.Form, C((c = (l = this.native) == null ? void 0 : l.props) == null ? void 0 : c.Form) ?? {}), i = h(this.globalNativeFormOverride.slots.Form, C((p = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : p.Form) ?? {}), n = j.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
1117
1116
  return g(n, N(s, {
1118
1117
  ref: this.formRef
1119
1118
  }, {
@@ -1471,13 +1470,13 @@ function te(t, e) {
1471
1470
  function Or(t) {
1472
1471
  return te(t, "native");
1473
1472
  }
1474
- function Mr(t) {
1473
+ function Er(t) {
1475
1474
  return t.__proform_raw_object = !0, t;
1476
1475
  }
1477
- function jr(t) {
1476
+ function Mr(t) {
1478
1477
  return te(t, "onetime");
1479
1478
  }
1480
- function Er(t) {
1479
+ function jr(t) {
1481
1480
  function e() {
1482
1481
  return t;
1483
1482
  }
@@ -1489,9 +1488,9 @@ function Er(t) {
1489
1488
  export {
1490
1489
  Cr as ProForm,
1491
1490
  Or as markNativeFunction,
1492
- Mr as markNativeObject,
1493
- jr as markOnetimeFunction,
1494
- Er as markStructuredPathParsing,
1491
+ Er as markNativeObject,
1492
+ Mr as markOnetimeFunction,
1493
+ jr as markStructuredPathParsing,
1495
1494
  Ir as useForm,
1496
1495
  Sr as useFormPresetConfigurer,
1497
1496
  te as useModifiers
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Ref } from "vue";
3
2
  import { AnyObject, Schema, ProxyedSchema, AnyFunction, ObjectParserRoot } from "../../types";
4
3
  import { RuntimeCore } from "..";
@@ -23,7 +22,6 @@ export default class Processor {
23
22
  defaultValueInprogressMap: Map<any, any>;
24
23
  baseDefaultValueFunctionsLength: number;
25
24
  isModelInitialized: boolean;
26
- modelTriggerTimer: NodeJS.Timeout;
27
25
  reactiveWatchMap: Map<any, any>;
28
26
  constructor(runtimeCore: RuntimeCore);
29
27
  parse<T extends object = any>(data: T[], parentMeta?: AnyObject): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",