@harbor-design/proform 1.2.23 → 1.2.24

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.
Files changed (2) hide show
  1. package/dist/index.js +88 -82
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var ue = Object.defineProperty;
2
2
  var ce = (r, e, t) => e in r ? ue(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var a = (r, e, t) => (ce(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { ref as N, readonly as se, nextTick as P, isRef as q, watch as v, isReactive as M, toRaw as S, reactive as re, createVNode as p, mergeProps as O, withDirectives as fe, vShow as de, createTextVNode as he, isVNode as pe, defineComponent as me } from "vue";
4
+ import { ref as N, readonly as se, nextTick as P, isRef as q, watch as y, isReactive as M, toRaw as S, reactive as re, createVNode as m, mergeProps as O, withDirectives as fe, vShow as de, createTextVNode as he, isVNode as pe, defineComponent as me } from "vue";
5
5
  class l {
6
6
  static typeChecker(e) {
7
7
  return {}.toString.call(e);
@@ -91,8 +91,8 @@ function g(r) {
91
91
  return new RegExp(s);
92
92
  if (s instanceof Map) {
93
93
  const o = /* @__PURE__ */ new Map();
94
- for (const [n, f] of s)
95
- o.set(t(n), t(f));
94
+ for (const [n, d] of s)
95
+ o.set(t(n), t(d));
96
96
  return o;
97
97
  }
98
98
  if (s instanceof Set) {
@@ -145,7 +145,7 @@ class be {
145
145
  P(() => {
146
146
  this.runtimeCore.hydrateEffect.trackEffect(
147
147
  () => {
148
- q(e) ? v(
148
+ q(e) ? y(
149
149
  () => e.value,
150
150
  () => {
151
151
  h(this.runtimeCore.model.value, e.value);
@@ -154,7 +154,7 @@ class be {
154
154
  deep: !0,
155
155
  immediate: !0
156
156
  }
157
- ) : M(e) ? v(
157
+ ) : M(e) ? y(
158
158
  () => e,
159
159
  () => {
160
160
  h(this.runtimeCore.model.value, e);
@@ -174,7 +174,7 @@ class be {
174
174
  share(e) {
175
175
  P(() => {
176
176
  if (q(e)) {
177
- const t = v(
177
+ const t = y(
178
178
  () => e.value,
179
179
  () => {
180
180
  h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), P(() => {
@@ -187,7 +187,7 @@ class be {
187
187
  }
188
188
  );
189
189
  } else if (M(e)) {
190
- const t = v(
190
+ const t = y(
191
191
  () => e,
192
192
  () => {
193
193
  h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), P(() => {
@@ -205,7 +205,7 @@ class be {
205
205
  }
206
206
  subscribeModel(e) {
207
207
  P(() => {
208
- const t = v(
208
+ const t = y(
209
209
  () => this.readonlyReactiveModel.value,
210
210
  (s) => {
211
211
  e(s, {
@@ -263,7 +263,7 @@ class ve {
263
263
  a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
264
264
  a(this, "baseDefaultValueFunctionsLength");
265
265
  a(this, "isModelInitialized", !0);
266
- this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), v(
266
+ this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), y(
267
267
  () => this.processedModel.value,
268
268
  () => {
269
269
  this.schemaEffect.triggerEffects();
@@ -324,21 +324,21 @@ class ve {
324
324
  // 核心单 schema 处理过程,接收一个对象键值对的数据结构
325
325
  parseItem(e, t, s) {
326
326
  const i = this, o = Array.from({
327
- length: Object.keys(e).filter((f) => f !== "children").length
327
+ length: Object.keys(e).filter((d) => d !== "children").length
328
328
  }).fill(!1);
329
329
  this.objectParser({ data: e, index: t, updater: n });
330
- function n(f) {
331
- const c = f.index, d = f.key, y = f.keyIndex;
332
- if (l.isUndefined(f.stable))
330
+ function n(d) {
331
+ const f = d.index, c = d.key, p = d.keyIndex;
332
+ if (l.isUndefined(d.stable))
333
333
  return;
334
- const V = i.parseStable(f.stable), F = s == null ? void 0 : s.index, I = s == null ? void 0 : s.key;
335
- let b = V;
336
- if (l.isProcessInprogress(b) || (o[y] = !0), s) {
337
- const m = i.processedSchemas.value[F][I][c][d];
338
- m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[F][I][c][d] = b, i.stableUpdater(o);
334
+ const V = i.parseStable(d.stable), F = s == null ? void 0 : s.index, I = s == null ? void 0 : s.key;
335
+ let v = V;
336
+ if (l.isProcessInprogress(v) || (o[p] = !0), s) {
337
+ const b = i.processedSchemas.value[F][I][f][c];
338
+ b && l.isObject(b) && c !== "component" && (v = h(b, v)), i.processedSchemas.value[F][I][f][c] = v, i.stableUpdater(o);
339
339
  } else {
340
- const m = i.processedSchemas.value[c][d];
341
- m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[c][d] = b, i.stableUpdater(o);
340
+ const b = i.processedSchemas.value[f][c];
341
+ b && l.isObject(b) && c !== "component" && (v = h(b, v)), i.processedSchemas.value[f][c] = v, i.stableUpdater(o);
342
342
  }
343
343
  }
344
344
  }
@@ -353,19 +353,19 @@ class ve {
353
353
  keyIndex: o
354
354
  });
355
355
  else {
356
- const n = (f) => {
356
+ const n = (d) => {
357
357
  e.updater({
358
358
  ...e,
359
359
  key: i,
360
360
  keyIndex: o,
361
- stable: f
361
+ stable: d
362
362
  });
363
363
  };
364
364
  l.isFunction(t[i]) ? i !== "defaultValue" ? this.schemaEffect.trackEffect(
365
365
  () => {
366
366
  if (i === "component") {
367
- const f = t[i](this.getRuntimeMeta());
368
- this.promiseFieldParser(f, n, !1);
367
+ const d = t[i](this.getRuntimeMeta());
368
+ this.promiseFieldParser(d, n, !1);
369
369
  } else
370
370
  this.fieldParser(t[i], n);
371
371
  },
@@ -374,22 +374,28 @@ class ve {
374
374
  }
375
375
  ) : this.defaultValueEffect.trackEffect(
376
376
  () => {
377
- const f = this.schemaEffect.trackEffect(
377
+ const d = this.schemaEffect.trackEffect(
378
378
  () => {
379
- /\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (c) => {
380
- if (!c)
381
- return n(c);
382
- this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
379
+ /\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (f) => {
380
+ if (!f)
381
+ return n(f);
382
+ this.defaultValueInprogressMap.set(t[i], f), !l.isProcessInprogress(f) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
383
383
  this.defaultValueInprogressMap.values()
384
- ).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), P(() => {
385
- f();
386
- })) : n(c);
387
- }) : this.fieldParser(t[i], (c) => {
388
- this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
384
+ ).every((c) => {
385
+ var p;
386
+ return !((p = c == null ? void 0 : c.includes) != null && p.call(c, "undefined"));
387
+ }) ? (n(f), this.defaultValueEffect.clearEffects(), P(() => {
388
+ d();
389
+ })) : n(f);
390
+ }) : this.fieldParser(t[i], (f) => {
391
+ this.defaultValueInprogressMap.set(t[i], f), !l.isProcessInprogress(f) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
389
392
  this.defaultValueInprogressMap.values()
390
- ).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), P(() => {
391
- f();
392
- })) : n(c);
393
+ ).every((c) => {
394
+ var p;
395
+ return !((p = c == null ? void 0 : c.includes) != null && p.call(c, "undefined"));
396
+ }) ? (n(f), this.defaultValueEffect.clearEffects(), P(() => {
397
+ d();
398
+ })) : n(f);
393
399
  });
394
400
  },
395
401
  {
@@ -433,7 +439,7 @@ class ve {
433
439
  e.__proform_async_result = i, this.promiseFieldParser(i, t, s);
434
440
  }
435
441
  else
436
- q(e) ? v(
442
+ q(e) ? y(
437
443
  () => e.value,
438
444
  () => {
439
445
  l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
@@ -445,7 +451,7 @@ class ve {
445
451
  immediate: !0,
446
452
  deep: !0
447
453
  }
448
- ) : M(e) ? v(
454
+ ) : M(e) ? y(
449
455
  () => e,
450
456
  () => {
451
457
  l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
@@ -560,7 +566,7 @@ class ge {
560
566
  this.setup = e, this.processor = new ve(this);
561
567
  const t = this.setup(this);
562
568
  if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new ye(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), q(t.schemas))
563
- v(
569
+ y(
564
570
  // @ts-expect-error
565
571
  () => t.schemas.value,
566
572
  () => {
@@ -571,7 +577,7 @@ class ge {
571
577
  }
572
578
  );
573
579
  else if (M(t.schemas)) {
574
- const s = v(() => t.schemas, () => {
580
+ const s = y(() => t.schemas, () => {
575
581
  this.processor.parseSchemas(t.schemas), P(() => {
576
582
  s();
577
583
  });
@@ -592,7 +598,7 @@ class ge {
592
598
  share: (s) => {
593
599
  t && clearTimeout(t), t = setTimeout(() => {
594
600
  if (q(s)) {
595
- const i = v(() => s.value, () => {
601
+ const i = y(() => s.value, () => {
596
602
  h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), P(() => {
597
603
  i();
598
604
  });
@@ -601,7 +607,7 @@ class ge {
601
607
  immediate: !0
602
608
  });
603
609
  } else if (M(s)) {
604
- const i = v(() => s, () => {
610
+ const i = y(() => s, () => {
605
611
  h(this.shared, s), this.processor.schemaEffect.triggerEffects(), P(() => {
606
612
  i();
607
613
  });
@@ -621,38 +627,38 @@ class ge {
621
627
  if (!o)
622
628
  return;
623
629
  (z = ($ = e.native) == null ? void 0 : $.props) != null && z.Form && h(this.globalNativeFormOverride.props.Form, (B = (k = e.native) == null ? void 0 : k.props) == null ? void 0 : B.Form), (T = (D = e.native) == null ? void 0 : D.slots) != null && T.Form && h(this.globalNativeFormOverride.slots.Form, (W = (G = e.native) == null ? void 0 : G.slots) == null ? void 0 : W.Form);
624
- const n = h(g((H = (K = this.native) == null ? void 0 : K.slots) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.slots) == null ? void 0 : Q.FormItem), f = {
630
+ const n = h(g((H = (K = this.native) == null ? void 0 : K.slots) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.slots) == null ? void 0 : Q.FormItem), d = {
625
631
  display: "grid",
626
632
  gridColumn: "1 / -1",
627
633
  ...e.grid
628
- }, c = h(g((Y = (X = this.native) == null ? void 0 : X.props) == null ? void 0 : Y.FormItem) ?? {}, (A = (Z = e.native) == null ? void 0 : Z.props) == null ? void 0 : A.FormItem), d = this.runtimeAdapter.getRuntimeField({
634
+ }, f = h(g((Y = (X = this.native) == null ? void 0 : X.props) == null ? void 0 : Y.FormItem) ?? {}, (A = (Z = e.native) == null ? void 0 : Z.props) == null ? void 0 : A.FormItem), c = this.runtimeAdapter.getRuntimeField({
629
635
  schema: e,
630
636
  parentSchema: i,
631
637
  index: t
632
- }), y = o.name, V = e.componentProps ?? {}, F = C.placeholderPresetByComponentName;
633
- let I = e.placeholder, b = e.show;
634
- b === void 0 && (b = !0);
635
- let m = e.label ?? "", E;
636
- if (e.runtime ? E = e.runtime : E = (i == null ? void 0 : i.runtime) ?? this.runtime, !l.isUndefined(t) && !l.isObjectEmpty(E) && (m = _((ee = E == null ? void 0 : E.customizeListItemLabel) == null ? void 0 : ee.call(E, e.label ?? "", t + 1), "")), !I) {
638
+ }), p = o.name, V = e.componentProps ?? {}, F = C.placeholderPresetByComponentName;
639
+ let I = e.placeholder, v = e.show;
640
+ v === void 0 && (v = !0);
641
+ let b = e.label ?? "", E;
642
+ if (e.runtime ? E = e.runtime : E = (i == null ? void 0 : i.runtime) ?? this.runtime, !l.isUndefined(t) && !l.isObjectEmpty(E) && (b = _((ee = E == null ? void 0 : E.customizeListItemLabel) == null ? void 0 : ee.call(E, e.label ?? "", t + 1), "")), !I) {
637
643
  let w = "请输入";
638
- l.isUndefined(y) ? I = `${w}${m}` : /* @ts-expect-error */ F[y.toLowerCase()] ? (w = // @ts-expect-error
639
- F[y.toLowerCase()], I = `${w}${m}`) : (Object.keys(F).forEach((te) => {
640
- y.toLowerCase().includes(te.toLowerCase()) && (w = F[te]);
641
- }), I = `${w}${m}`);
644
+ l.isUndefined(p) ? I = `${w}${b}` : /* @ts-expect-error */ F[p.toLowerCase()] ? (w = // @ts-expect-error
645
+ F[p.toLowerCase()], I = `${w}${b}`) : (Object.keys(F).forEach((te) => {
646
+ p.toLowerCase().includes(te.toLowerCase()) && (w = F[te]);
647
+ }), I = `${w}${b}`);
642
648
  }
643
649
  const ie = this.runtimeAdapter.getRuntimeRequired({
644
650
  ...e,
645
- label: m
651
+ label: b
646
652
  }), oe = j.getItemContainer(this), ne = j.getFormItemContainer(this), le = this, ae = e.componentSlots;
647
- return p("div", {
648
- style: f
649
- }, [p(oe, {
650
- show: b
653
+ return m("div", {
654
+ style: d
655
+ }, [m(oe, {
656
+ show: v
651
657
  }, {
652
658
  default() {
653
- return b && p(ne, O(c, {
654
- label: `${m ? `${m}:` : ""}`
655
- }, d, ie), {
659
+ return v && m(ne, O(f, {
660
+ label: `${b ? `${b}:` : ""}`
661
+ }, c, ie), {
656
662
  default() {
657
663
  return le.runtimeAdapter.formComponentRenderer({
658
664
  Component: o,
@@ -676,9 +682,9 @@ class ge {
676
682
  ...e.grid
677
683
  }, i = j.getGroupContainer(this);
678
684
  let o = e.show;
679
- return o === void 0 && (o = !0), p("div", {
685
+ return o === void 0 && (o = !0), m("div", {
680
686
  style: s
681
- }, [o && p(i, {
687
+ }, [o && m(i, {
682
688
  schema: e
683
689
  }, Pe(t = e.children.map((n) => this.runtimeItemProcessor(n))) ? t : {
684
690
  default: () => [t]
@@ -706,32 +712,32 @@ class ge {
706
712
  let i = e.show;
707
713
  i === void 0 && (i = !0);
708
714
  const o = j.getListContainer(this), n = j.getListItemContainer(this);
709
- return p("div", {
715
+ return m("div", {
710
716
  style: t
711
- }, [i && p(o, {
717
+ }, [i && m(o, {
712
718
  schema: e
713
719
  }, {
714
720
  default() {
715
- return s.model.value[e.field].map((f, c) => p(n, null, {
721
+ return s.model.value[e.field].map((d, f) => m(n, null, {
716
722
  default() {
717
- return e.children.map((d) => s.runtimeItemProcessor(d, c, f, e));
723
+ return e.children.map((c) => s.runtimeItemProcessor(c, f, d, e));
718
724
  },
719
725
  delete({
720
- container: d
726
+ container: c
721
727
  } = {}) {
722
728
  var V;
723
- const y = d ?? p("button", null, null);
724
- return fe(p(y, {
725
- onClick: () => s.deleteListItem(e, c)
729
+ const p = c ?? m("button", null, null);
730
+ return fe(m(p, {
731
+ onClick: () => s.deleteListItem(e, f)
726
732
  }, null), [[de, ((V = s.model.value[e.field]) == null ? void 0 : V.length) > 1]]);
727
733
  }
728
734
  }));
729
735
  },
730
736
  add({
731
- container: f
737
+ container: d
732
738
  } = {}) {
733
- const c = f ?? p("button", null, [he("添加")]);
734
- return p(c, {
739
+ const f = d ?? m("button", null, [he("添加")]);
740
+ return m(f, {
735
741
  onClick: () => s.addListItem(e)
736
742
  }, null);
737
743
  }
@@ -741,20 +747,20 @@ class ge {
741
747
  return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
742
748
  }
743
749
  exec() {
744
- var f, c, d, y;
750
+ var d, f, c, p;
745
751
  const e = {
746
752
  display: "grid",
747
753
  gridColumn: "1 / -1",
748
754
  gridAutoColumns: "1fr",
749
755
  ...this.grid
750
- }, t = this, s = h(this.globalNativeFormOverride.props.Form, g((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}), i = h(this.globalNativeFormOverride.slots.Form, g((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}), o = j.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
751
- return p(o, O(s, {
756
+ }, t = this, s = h(this.globalNativeFormOverride.props.Form, g((f = (d = this.native) == null ? void 0 : d.props) == null ? void 0 : f.Form) ?? {}), i = h(this.globalNativeFormOverride.slots.Form, g((p = (c = this.native) == null ? void 0 : c.slots) == null ? void 0 : p.Form) ?? {}), o = j.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
757
+ return m(o, O(s, {
752
758
  ref: this.formRef
753
759
  }, {
754
760
  [n]: this.model.value
755
761
  }), {
756
762
  default() {
757
- return p("div", {
763
+ return m("div", {
758
764
  style: e
759
765
  }, [t.runtimeProcessor(t.schemas.value)]);
760
766
  },
@@ -824,7 +830,7 @@ const Ce = {
824
830
  componentSlots: i,
825
831
  props: o
826
832
  }) {
827
- return p(r, O({
833
+ return m(r, O({
828
834
  modelValue: e[t.field],
829
835
  "onUpdate:modelValue": (n) => e[t.field] = n,
830
836
  placeholder: s
@@ -885,7 +891,7 @@ const Ce = {
885
891
  componentSlots: i,
886
892
  props: o
887
893
  }) {
888
- return p(r, O({
894
+ return m(r, O({
889
895
  modelValue: e[t.field],
890
896
  "onUpdate:modelValue": (n) => e[t.field] = n,
891
897
  placeholder: s
@@ -953,7 +959,7 @@ const Ce = {
953
959
  componentSlots: i,
954
960
  props: o
955
961
  }) {
956
- return p(r, O({
962
+ return m(r, O({
957
963
  value: e[t.field],
958
964
  "onUpdate:value": (n) => e[t.field] = n,
959
965
  placeholder: s
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.2.23",
3
+ "version": "1.2.24",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",