@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
|
|
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
|
|
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 =
|
|
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
|
-
) :
|
|
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: !
|
|
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
|
|
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
|
|
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][
|
|
274
|
-
h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[C][v][
|
|
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[
|
|
277
|
-
h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[
|
|
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
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
this.
|
|
318
|
-
(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
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
|
-
) :
|
|
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
|
|
404
|
+
return c.presets.uiPresets[e ?? c.presets.ui].container.Form;
|
|
399
405
|
}
|
|
400
406
|
static getFormItemContainer({ ui: e } = {}) {
|
|
401
|
-
return
|
|
407
|
+
return c.presets.uiPresets[e ?? c.presets.ui].container.FormItem;
|
|
402
408
|
}
|
|
403
409
|
static getItemContainer({ ui: e } = {}) {
|
|
404
|
-
return
|
|
410
|
+
return c.presets.uiPresets[e ?? c.presets.ui].container.Item;
|
|
405
411
|
}
|
|
406
412
|
static getGroupContainer({ ui: e } = {}) {
|
|
407
|
-
return
|
|
413
|
+
return c.presets.uiPresets[e ?? c.presets.ui].container.Group;
|
|
408
414
|
}
|
|
409
415
|
static getListContainer({ ui: e } = {}) {
|
|
410
|
-
return
|
|
416
|
+
return c.presets.uiPresets[e ?? c.presets.ui].container.List;
|
|
411
417
|
}
|
|
412
418
|
static getListItemContainer({ ui: e } = {}) {
|
|
413
|
-
return
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
473
|
+
this.setup = e, this.processor = new ce(this);
|
|
468
474
|
const t = this.setup(this);
|
|
469
|
-
if (this.ui = t.ui ??
|
|
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 (
|
|
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
|
|
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, ($ = (
|
|
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
|
-
},
|
|
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(
|
|
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((
|
|
593
|
+
return e.children.map((f) => s.runtimeItemProcessor(f, u, n, e));
|
|
588
594
|
},
|
|
589
595
|
delete({
|
|
590
|
-
container:
|
|
596
|
+
container: f
|
|
591
597
|
} = {}) {
|
|
592
598
|
var y;
|
|
593
|
-
let d =
|
|
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,
|
|
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((
|
|
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
|
|
641
|
+
class c {
|
|
636
642
|
}
|
|
637
|
-
a(
|
|
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
|
|
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
|
-
|
|
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[];
|