@harbor-design/proform 1.2.7 → 1.2.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
@@ -305,8 +305,8 @@ class ve {
305
305
  const c = f.index, d = f.key, y = f.keyIndex;
306
306
  if (l.isUndefined(f.stable))
307
307
  return;
308
- const j = i.parseStable(f.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
309
- let v = j;
308
+ const F = i.parseStable(f.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
309
+ let v = F;
310
310
  if (l.isProcessInprogress(v) || (o[y] = !0), s) {
311
311
  const m = i.processedSchemas.value[I][g][c][d];
312
312
  m && l.isObject(m) && d !== "component" && (v = h(m, v)), i.processedSchemas.value[I][g][c][d] = v, i.stableUpdater(o);
@@ -446,7 +446,7 @@ class ve {
446
446
  }), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
447
447
  }
448
448
  }
449
- class F {
449
+ class V {
450
450
  static getFormContainer({ ui: e } = {}) {
451
451
  return u.presets.uiPresets[e ?? u.presets.ui].container.Form;
452
452
  }
@@ -518,8 +518,14 @@ class be {
518
518
  a(this, "grid", {});
519
519
  a(this, "runtime", {});
520
520
  a(this, "globalNativeFormOverride", se({
521
- props: {},
522
- slots: {}
521
+ props: {
522
+ Form: {},
523
+ FormItem: {}
524
+ },
525
+ slots: {
526
+ Form: {},
527
+ FormItem: {}
528
+ }
523
529
  }));
524
530
  a(this, "shared", {});
525
531
  this.setup = e, this.processor = new ve(this);
@@ -585,15 +591,7 @@ class be {
585
591
  const o = R(e.component);
586
592
  if (!o)
587
593
  return;
588
- (k = (z = e.native) == null ? void 0 : z.props) != null && k.Form && h(
589
- // @ts-expect-error
590
- this.globalNativeFormOverride.props.Form,
591
- (B = ($ = e.native) == null ? void 0 : $.props) == null ? void 0 : B.Form
592
- ), (T = (D = e.native) == null ? void 0 : D.slots) != null && T.Form && h(
593
- // @ts-expect-error
594
- this.globalNativeFormOverride.slots.Form,
595
- (W = (G = e.native) == null ? void 0 : G.slots) == null ? void 0 : W.Form
596
- );
594
+ (k = (z = e.native) == null ? void 0 : z.props) != null && k.Form && h(this.globalNativeFormOverride.props.Form, (B = ($ = e.native) == null ? void 0 : $.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);
597
595
  const n = h(C((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 = {
598
596
  display: "grid",
599
597
  gridColumn: "1 / -1",
@@ -602,12 +600,12 @@ class be {
602
600
  schema: e,
603
601
  parentSchema: i,
604
602
  index: t
605
- }), y = o.name, j = e.componentProps ?? {}, I = b.placeholderPresetByComponentName;
603
+ }), y = o.name, F = e.componentProps ?? {}, I = b.placeholderPresetByComponentName;
606
604
  let g = e.placeholder, v = e.show;
607
605
  v === void 0 && (v = !0);
608
606
  let m = e.label ?? "";
609
- const V = (i == null ? void 0 : i.runtime) ?? this.runtime;
610
- if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (m = x((ee = V == null ? void 0 : V.customizeListItemLabel) == null ? void 0 : ee.call(V, e.label ?? "", t + 1), "")), !g) {
607
+ const j = (i == null ? void 0 : i.runtime) ?? this.runtime;
608
+ if (!l.isUndefined(t) && !l.isObjectEmpty(j) && (m = x((ee = j == null ? void 0 : j.customizeListItemLabel) == null ? void 0 : ee.call(j, e.label ?? "", t + 1), "")), !g) {
611
609
  let S = "请输入";
612
610
  l.isUndefined(y) ? g = `${S}${m}` : /* @ts-expect-error */ I[y.toLowerCase()] ? (S = // @ts-expect-error
613
611
  I[y.toLowerCase()], g = `${S}${m}`) : (Object.keys(I).forEach((te) => {
@@ -617,7 +615,7 @@ class be {
617
615
  const re = this.runtimeAdapter.getRuntimeRequired({
618
616
  ...e,
619
617
  label: m
620
- }), ie = F.getItemContainer(this), oe = F.getFormItemContainer(this), ne = this, le = e.componentSlots;
618
+ }), ie = V.getItemContainer(this), oe = V.getFormItemContainer(this), ne = this, le = e.componentSlots;
621
619
  return p("div", {
622
620
  style: f
623
621
  }, [p(ie, {
@@ -634,7 +632,7 @@ class be {
634
632
  baseModel: s,
635
633
  placeholder: g,
636
634
  componentSlots: le,
637
- props: j
635
+ props: F
638
636
  });
639
637
  },
640
638
  ...n
@@ -648,7 +646,7 @@ class be {
648
646
  display: "grid",
649
647
  gridColumn: "1 / -1",
650
648
  ...e.grid
651
- }, i = F.getGroupContainer(this);
649
+ }, i = V.getGroupContainer(this);
652
650
  let o = e.show;
653
651
  return o === void 0 && (o = !0), p("div", {
654
652
  style: s
@@ -679,7 +677,7 @@ class be {
679
677
  s.model.value[e.field] || (s.model.value[e.field] = [{}]);
680
678
  let i = e.show;
681
679
  i === void 0 && (i = !0);
682
- const o = F.getListContainer(this), n = F.getListItemContainer(this);
680
+ const o = V.getListContainer(this), n = V.getListItemContainer(this);
683
681
  return p("div", {
684
682
  style: t
685
683
  }, [i && p(o, {
@@ -693,11 +691,11 @@ class be {
693
691
  delete({
694
692
  container: d
695
693
  } = {}) {
696
- var j;
694
+ var F;
697
695
  const y = d ?? p("button", null, null);
698
696
  return ce(p(y, {
699
697
  onClick: () => s.deleteListItem(e, c)
700
- }, null), [[fe, ((j = s.model.value[e.field]) == null ? void 0 : j.length) > 1]]);
698
+ }, null), [[fe, ((F = s.model.value[e.field]) == null ? void 0 : F.length) > 1]]);
701
699
  }
702
700
  }));
703
701
  },
@@ -721,15 +719,7 @@ class be {
721
719
  gridColumn: "1 / -1",
722
720
  gridAutoColumns: "1fr",
723
721
  ...this.grid
724
- }, t = this, s = h(
725
- C((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {},
726
- // @ts-expect-error
727
- this.globalNativeFormOverride.props.Form
728
- ), i = h(
729
- C((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {},
730
- // @ts-expect-error
731
- this.globalNativeFormOverride.slots.Form
732
- ), o = F.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
722
+ }, t = this, s = h(C((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props.Form), i = h(C((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}, this.globalNativeFormOverride.slots.Form), o = V.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
733
723
  return p(o, O(s, {
734
724
  ref: this.formRef
735
725
  }, {
@@ -1000,7 +990,7 @@ const b = {
1000
990
  adapters: {
1001
991
  ...ge
1002
992
  }
1003
- }, je = /* @__PURE__ */ pe({
993
+ }, Fe = /* @__PURE__ */ pe({
1004
994
  props: {
1005
995
  setup: {
1006
996
  type: Function,
@@ -1012,7 +1002,7 @@ const b = {
1012
1002
  return () => e.exec();
1013
1003
  }
1014
1004
  });
1015
- function Ve(r) {
1005
+ function je(r) {
1016
1006
  const e = new me(r);
1017
1007
  return [
1018
1008
  e.setup.bind(e),
@@ -1023,7 +1013,7 @@ function Ve(r) {
1023
1013
  }
1024
1014
  ];
1025
1015
  }
1026
- function Fe(r) {
1016
+ function Ve(r) {
1027
1017
  u.presets = r;
1028
1018
  }
1029
1019
  function Ce(r, e) {
@@ -1039,10 +1029,10 @@ function Re(r) {
1039
1029
  return r.__proform_raw_object = !0, r;
1040
1030
  }
1041
1031
  export {
1042
- je as ProForm,
1032
+ Fe as ProForm,
1043
1033
  we as markNativeFunction,
1044
1034
  Re as markNativeObject,
1045
- Ve as useForm,
1046
- Fe as useFormPresetConfigurer,
1035
+ je as useForm,
1036
+ Ve as useFormPresetConfigurer,
1047
1037
  Ce as useModifiers
1048
1038
  };
@@ -1,8 +1,8 @@
1
- import { AnyObject, runtimeMeta } from "../types";
1
+ import { AnyObject, RuntimeMeta } from "../types";
2
2
  type Modifier = "native";
3
3
  type FunctionNative = (args: {
4
4
  rawArgs: any[];
5
- } & runtimeMeta) => any;
5
+ } & RuntimeMeta) => any;
6
6
  export declare function useModifiers(functionNative: FunctionNative, modifier: Modifier): FunctionNative;
7
7
  export declare function markNativeFunction(functionNative: FunctionNative): FunctionNative;
8
8
  export declare function markNativeObject(objectNative: AnyObject): AnyObject;
@@ -15,8 +15,14 @@ export default class RuntimeCore {
15
15
  grid: {};
16
16
  runtime: Runtime;
17
17
  globalNativeFormOverride: {
18
- props: {};
19
- slots: {};
18
+ props: {
19
+ Form: {};
20
+ FormItem: {};
21
+ };
22
+ slots: {
23
+ Form: {};
24
+ FormItem: {};
25
+ };
20
26
  };
21
27
  ui: string;
22
28
  runtimeAdapter: RuntimeAdpter;
@@ -85,13 +85,13 @@ export interface ListSchema {
85
85
  show?: boolean;
86
86
  }
87
87
  export type Schema = ItemSchema | GroupSchema | ListSchema;
88
- export interface runtimeMeta {
88
+ export interface RuntimeMeta {
89
89
  model: AnyObject;
90
90
  reactiveModel: AnyObject;
91
91
  shared: AnyObject;
92
92
  share: (data: AnyObject) => any;
93
93
  }
94
- export type ProFormProxyRule<T> = T | ((runtimeMeta: runtimeMeta) => T) | ((runtimeMeta: runtimeMeta) => Promise<T>);
94
+ export type ProFormProxyRule<T> = T | ((runtimeMeta: RuntimeMeta) => T) | ((runtimeMeta: RuntimeMeta) => Promise<T>);
95
95
  export type ProFormProxy<T> = {
96
96
  [K in keyof T]: ProFormProxyRule<T[K]>;
97
97
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",