@harbor-design/proform 1.1.15 → 1.1.16

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
1
  var ie = Object.defineProperty;
2
2
  var oe = (r, e, t) => e in r ? ie(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var a = (r, e, t) => (oe(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { isRef as x, watch as I, isReactive as k, toRaw as E, nextTick as w, ref as q, reactive as ne, createVNode as p, withDirectives as Z, mergeProps as R, vShow as A, createTextVNode as le, isVNode as ae, defineComponent as ue } from "vue";
4
+ import { isRef as x, watch as I, isReactive as z, toRaw as E, nextTick as w, ref as q, reactive as ne, createVNode as p, withDirectives as Z, mergeProps as R, vShow as A, createTextVNode as le, isVNode as ae, defineComponent as ue } from "vue";
5
5
  class l {
6
6
  static typeChecker(e) {
7
7
  return {}.toString.call(e);
@@ -115,7 +115,7 @@ function g(r) {
115
115
  function N(r, e) {
116
116
  return r.replace(/undefined/g, e);
117
117
  }
118
- class ce {
118
+ class fe {
119
119
  constructor(e) {
120
120
  a(this, "runtimeCore");
121
121
  this.formCustomization = e;
@@ -131,7 +131,7 @@ class ce {
131
131
  }
132
132
  submit() {
133
133
  var s;
134
- const e = (s = f.presets.uiPresets[this.runtimeCore.ui]) == null ? void 0 : s.adapter, t = b.adapters[this.runtimeCore.ui];
134
+ const e = (s = c.presets.uiPresets[this.runtimeCore.ui]) == null ? void 0 : s.adapter, t = b.adapters[this.runtimeCore.ui];
135
135
  return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
136
136
  }
137
137
  hydrate(e) {
@@ -151,7 +151,7 @@ class ce {
151
151
  deep: !0,
152
152
  immediate: !0
153
153
  }
154
- ) : k(e) ? I(
154
+ ) : z(e) ? I(
155
155
  () => e,
156
156
  () => {
157
157
  m(this.runtimeCore.model.value, e);
@@ -179,12 +179,12 @@ class U {
179
179
  Array.from(this.effects).forEach((e) => e());
180
180
  }
181
181
  trackEffect(e, t = {
182
- lazy: !1
182
+ lazy: !0
183
183
  }) {
184
184
  return !t.lazy && e(), this.effects.add(e), () => this.effects.delete(e);
185
185
  }
186
186
  }
187
- class fe {
187
+ class ce {
188
188
  constructor(e) {
189
189
  a(this, "runtimeCore");
190
190
  a(this, "processedSchemas");
@@ -200,6 +200,7 @@ class fe {
200
200
  a(this, "defaultValueEffect", new U());
201
201
  a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
202
202
  a(this, "baseDefaultValueFunctionsLength");
203
+ a(this, "isModelInitialized", !0);
203
204
  this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), I(
204
205
  () => this.processedModel.value,
205
206
  () => {
@@ -264,17 +265,17 @@ class fe {
264
265
  }).fill(!1);
265
266
  this.objectParser({ data: e, index: t, updater: n });
266
267
  function n(u) {
267
- const c = u.index, d = u.key, y = u.keyIndex;
268
+ const f = u.index, d = u.key, y = u.keyIndex;
268
269
  if (l.isUndefined(u.stable))
269
270
  return;
270
271
  const O = i.parseStable(u.stable), C = s == null ? void 0 : s.index, v = s == null ? void 0 : s.key;
271
272
  let P = O;
272
273
  if (l.isProcessInprogress(P) || (o[y] = !0), s) {
273
- let h = i.processedSchemas.value[C][v][c][d];
274
- h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[C][v][c][d] = P, i.stableUpdater(o);
274
+ let h = i.processedSchemas.value[C][v][f][d];
275
+ h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[C][v][f][d] = P, i.stableUpdater(o);
275
276
  } else {
276
- let h = i.processedSchemas.value[c][d];
277
- h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[c][d] = P, i.stableUpdater(o);
277
+ let h = i.processedSchemas.value[f][d];
278
+ h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[f][d] = P, i.stableUpdater(o);
278
279
  }
279
280
  }
280
281
  }
@@ -303,25 +304,30 @@ class fe {
303
304
  this.promiseFieldParser(u, n, !1);
304
305
  } else
305
306
  this.fieldParser(t[i], n);
306
- }) : this.defaultValueEffect.trackEffect(() => {
307
- const u = this.schemaEffect.trackEffect(() => {
308
- /\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (c) => {
309
- if (!c)
310
- return n(c);
311
- this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(this.defaultValueInprogressMap.values()).every(
312
- (d) => !d.includes("undefined")
313
- ) ? (n(c), this.defaultValueEffect.clearEffects(), w(() => {
314
- u();
315
- })) : n(c);
316
- }) : this.fieldParser(t[i], (c) => {
317
- this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(this.defaultValueInprogressMap.values()).every(
318
- (d) => !d.includes("undefined")
319
- ) ? (n(c), this.defaultValueEffect.clearEffects(), w(() => {
320
- u();
321
- })) : n(c);
307
+ }) : this.defaultValueEffect.trackEffect(
308
+ () => {
309
+ const u = this.schemaEffect.trackEffect(() => {
310
+ /\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (f) => {
311
+ if (!f)
312
+ return n(f);
313
+ this.defaultValueInprogressMap.set(t[i], f), !l.isProcessInprogress(f) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
314
+ this.defaultValueInprogressMap.values()
315
+ ).every((d) => !d.includes("undefined")) ? (n(f), this.defaultValueEffect.clearEffects(), w(() => {
316
+ u();
317
+ })) : n(f);
318
+ }) : this.fieldParser(t[i], (f) => {
319
+ this.defaultValueInprogressMap.set(t[i], f), !l.isProcessInprogress(f) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
320
+ this.defaultValueInprogressMap.values()
321
+ ).every((d) => !d.includes("undefined")) ? (n(f), this.defaultValueEffect.clearEffects(), w(() => {
322
+ u();
323
+ })) : n(f);
324
+ });
322
325
  });
323
- });
324
- }) : i === "component" || i === "slots" || i === "runtime" ? this.promiseFieldParser(t[i], n, !1) : this.fieldParser(t[i], n);
326
+ },
327
+ {
328
+ lazy: !1
329
+ }
330
+ ) : i === "component" || i === "slots" || i === "runtime" ? this.promiseFieldParser(t[i], n, !1) : this.fieldParser(t[i], n);
325
331
  }
326
332
  });
327
333
  }
@@ -363,7 +369,7 @@ class fe {
363
369
  immediate: !0,
364
370
  deep: !0
365
371
  }
366
- ) : k(e) ? I(
372
+ ) : z(e) ? I(
367
373
  () => e,
368
374
  () => {
369
375
  l.isUndefined(e) || (s && l.isObject(e) ? this.objectParser({
@@ -390,27 +396,27 @@ class fe {
390
396
  this.createModel(s, t[e.field][0]);
391
397
  })), l.isGroupSchema(e) && e.children.forEach((s) => {
392
398
  this.createModel(s, t);
393
- }), l.isItemSchema(e) && (t[e.field] = e.defaultValue);
399
+ }), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
394
400
  }
395
401
  }
396
402
  class F {
397
403
  static getFormContainer({ ui: e } = {}) {
398
- return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
404
+ return c.presets.uiPresets[e ?? c.presets.ui].container.Form;
399
405
  }
400
406
  static getFormItemContainer({ ui: e } = {}) {
401
- return f.presets.uiPresets[e ?? f.presets.ui].container.FormItem;
407
+ return c.presets.uiPresets[e ?? c.presets.ui].container.FormItem;
402
408
  }
403
409
  static getItemContainer({ ui: e } = {}) {
404
- return f.presets.uiPresets[e ?? f.presets.ui].container.Item;
410
+ return c.presets.uiPresets[e ?? c.presets.ui].container.Item;
405
411
  }
406
412
  static getGroupContainer({ ui: e } = {}) {
407
- return f.presets.uiPresets[e ?? f.presets.ui].container.Group;
413
+ return c.presets.uiPresets[e ?? c.presets.ui].container.Group;
408
414
  }
409
415
  static getListContainer({ ui: e } = {}) {
410
- return f.presets.uiPresets[e ?? f.presets.ui].container.List;
416
+ return c.presets.uiPresets[e ?? c.presets.ui].container.List;
411
417
  }
412
418
  static getListItemContainer({ ui: e } = {}) {
413
- return f.presets.uiPresets[e ?? f.presets.ui].container.ListItem;
419
+ return c.presets.uiPresets[e ?? c.presets.ui].container.ListItem;
414
420
  }
415
421
  }
416
422
  class de {
@@ -419,27 +425,27 @@ class de {
419
425
  }
420
426
  getRuntimeField(e) {
421
427
  var i;
422
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
428
+ const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
423
429
  return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
424
430
  }
425
431
  getRuntimeRequired(e) {
426
432
  var i;
427
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
433
+ const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
428
434
  return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
429
435
  }
430
436
  getFormModelPropName() {
431
437
  var s;
432
- const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = b.adapters[this.ui];
438
+ const e = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = b.adapters[this.ui];
433
439
  return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
434
440
  }
435
441
  formComponentRenderer(e) {
436
442
  var i;
437
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
443
+ const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
438
444
  return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
439
445
  }
440
446
  clearValidate(e) {
441
447
  var i;
442
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
448
+ const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
443
449
  return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
444
450
  }
445
451
  }
@@ -464,9 +470,9 @@ class he {
464
470
  props: {},
465
471
  slots: {}
466
472
  });
467
- this.setup = e, this.processor = new fe(this);
473
+ this.setup = e, this.processor = new ce(this);
468
474
  const t = this.setup(this);
469
- if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new de(this.ui), x(t.schemas)) {
475
+ if (this.ui = t.ui ?? c.presets.ui, this.runtimeAdapter = new de(this.ui), x(t.schemas)) {
470
476
  const s = I(() => t.schemas, () => {
471
477
  this.processor.parseSchemas(t.schemas.value), w(() => {
472
478
  s();
@@ -474,7 +480,7 @@ class he {
474
480
  }, {
475
481
  deep: !0
476
482
  });
477
- } else if (k(t.schemas)) {
483
+ } else if (z(t.schemas)) {
478
484
  const s = I(() => t.schemas, () => {
479
485
  this.processor.parseSchemas(t.schemas), w(() => {
480
486
  s();
@@ -491,16 +497,16 @@ class he {
491
497
  };
492
498
  }
493
499
  runtimeItemProcessor(e, t, s = this.model.value, i) {
494
- var z, $, _, B, D, G, T, K, W, H, J, Q, X;
500
+ var k, $, _, B, D, G, T, K, W, H, J, Q, X;
495
501
  const o = E(e.component);
496
502
  if (!o)
497
503
  return;
498
- m(this.globalNativeFormOverride.props, ($ = (z = e.native) == null ? void 0 : z.props) == null ? void 0 : $.Form), m(this.globalNativeFormOverride.slots, (B = (_ = e.native) == null ? void 0 : _.slots) == null ? void 0 : B.Form);
504
+ m(this.globalNativeFormOverride.props, ($ = (k = e.native) == null ? void 0 : k.props) == null ? void 0 : $.Form), m(this.globalNativeFormOverride.slots, (B = (_ = e.native) == null ? void 0 : _.slots) == null ? void 0 : B.Form);
499
505
  const n = m(g((G = (D = this.native) == null ? void 0 : D.slots) == null ? void 0 : G.FormItem) ?? {}, (K = (T = e.native) == null ? void 0 : T.slots) == null ? void 0 : K.FormItem), u = {
500
506
  display: "grid",
501
507
  gridColumn: "1 / -1",
502
508
  ...e.grid
503
- }, c = m(g((H = (W = this.native) == null ? void 0 : W.props) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.props) == null ? void 0 : Q.FormItem), d = this.runtimeAdapter.getRuntimeField({
509
+ }, f = m(g((H = (W = this.native) == null ? void 0 : W.props) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.props) == null ? void 0 : Q.FormItem), d = this.runtimeAdapter.getRuntimeField({
504
510
  schema: e,
505
511
  parentSchema: i,
506
512
  index: t
@@ -524,7 +530,7 @@ class he {
524
530
  style: u
525
531
  }, [p(te, null, {
526
532
  default() {
527
- return Z(p(se, R(c, {
533
+ return Z(p(se, R(f, {
528
534
  label: `${h}:`
529
535
  }, d, ee), {
530
536
  default() {
@@ -584,13 +590,13 @@ class he {
584
590
  default() {
585
591
  return s.model.value[e.field].map((n, u) => p(o, null, {
586
592
  default() {
587
- return e.children.map((c) => s.runtimeItemProcessor(c, u, n, e));
593
+ return e.children.map((f) => s.runtimeItemProcessor(f, u, n, e));
588
594
  },
589
595
  delete({
590
- container: c
596
+ container: f
591
597
  } = {}) {
592
598
  var y;
593
- let d = c ?? p("button", null, null);
599
+ let d = f ?? p("button", null, null);
594
600
  return Z(p(d, {
595
601
  onClick: () => s.deleteListItem(e, u)
596
602
  }, null), [[A, ((y = s.model.value[e.field]) == null ? void 0 : y.length) > 1]]);
@@ -611,13 +617,13 @@ class he {
611
617
  return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
612
618
  }
613
619
  exec() {
614
- var u, c, d, y;
620
+ var u, f, d, y;
615
621
  const e = {
616
622
  display: "grid",
617
623
  gridColumn: "1 / -1",
618
624
  gridAutoColumns: "1fr",
619
625
  ...this.grid
620
- }, t = this, s = m(g((c = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props), i = m(g((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}, this.globalNativeFormOverride.slots), o = F.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
626
+ }, t = this, s = m(g((f = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : f.Form) ?? {}, this.globalNativeFormOverride.props), i = m(g((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}, this.globalNativeFormOverride.slots), o = F.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
621
627
  return p(o, R(s, {
622
628
  ref: this.formRef
623
629
  }, {
@@ -632,9 +638,9 @@ class he {
632
638
  });
633
639
  }
634
640
  }
635
- class f {
641
+ class c {
636
642
  }
637
- a(f, "presets");
643
+ a(c, "presets");
638
644
  function M({
639
645
  parentSchema: r,
640
646
  schema: e,
@@ -881,7 +887,7 @@ const b = {
881
887
  }
882
888
  });
883
889
  function ve(r) {
884
- const e = new ce(r);
890
+ const e = new fe(r);
885
891
  return [
886
892
  e.setup.bind(e),
887
893
  {
@@ -891,7 +897,7 @@ function ve(r) {
891
897
  ];
892
898
  }
893
899
  function ge(r) {
894
- f.presets = r;
900
+ c.presets = r;
895
901
  }
896
902
  function Ce(r, e) {
897
903
  return e === "raw" && Object.defineProperty(r, "name", {
@@ -21,6 +21,7 @@ export default class Processor {
21
21
  defaultValueEffect: Effect;
22
22
  defaultValueInprogressMap: Map<any, any>;
23
23
  baseDefaultValueFunctionsLength: number;
24
+ isModelInitialized: boolean;
24
25
  constructor(runtimeCore: RuntimeCore);
25
26
  parse<T extends object = any>(data: T[], parentMeta?: AnyObject): void;
26
27
  initSchemas(schemas: AnyObject[]): AnyObject[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",