@harbor-design/proform 1.1.29 → 1.1.30
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 +52 -52
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (r, e, t) => (
|
|
4
|
-
import { isRef as
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var ie = (r, e, t) => e in r ? re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var a = (r, e, t) => (ie(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { isRef as x, watch as I, isReactive as z, toRaw as w, nextTick as O, ref as q, reactive as oe, createVNode as p, mergeProps as R, withDirectives as ne, vShow as le, createTextVNode as ae, isVNode as ue, defineComponent as ce } from "vue";
|
|
5
5
|
class l {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -112,7 +112,7 @@ function g(r) {
|
|
|
112
112
|
}
|
|
113
113
|
return t(r);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function U(r, e) {
|
|
116
116
|
return r.replace(/undefined/g, e);
|
|
117
117
|
}
|
|
118
118
|
class fe {
|
|
@@ -142,7 +142,7 @@ class fe {
|
|
|
142
142
|
});
|
|
143
143
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
144
144
|
() => {
|
|
145
|
-
|
|
145
|
+
x(e) ? I(
|
|
146
146
|
() => e.value,
|
|
147
147
|
() => {
|
|
148
148
|
y(this.runtimeCore.model.value, e.value);
|
|
@@ -151,7 +151,7 @@ class fe {
|
|
|
151
151
|
deep: !0,
|
|
152
152
|
immediate: !0
|
|
153
153
|
}
|
|
154
|
-
) :
|
|
154
|
+
) : z(e) ? I(
|
|
155
155
|
() => e,
|
|
156
156
|
() => {
|
|
157
157
|
y(this.runtimeCore.model.value, e);
|
|
@@ -168,7 +168,7 @@ class fe {
|
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
class
|
|
171
|
+
class N {
|
|
172
172
|
constructor() {
|
|
173
173
|
a(this, "effects", /* @__PURE__ */ new Set());
|
|
174
174
|
}
|
|
@@ -196,8 +196,8 @@ class de {
|
|
|
196
196
|
a(this, "componentPropsPreset", b.componentPropsPreset);
|
|
197
197
|
a(this, "stableUpdaterProcessProgress");
|
|
198
198
|
a(this, "stableUpdaterTimes", 0);
|
|
199
|
-
a(this, "schemaEffect", new
|
|
200
|
-
a(this, "defaultValueEffect", new
|
|
199
|
+
a(this, "schemaEffect", new N());
|
|
200
|
+
a(this, "defaultValueEffect", new N());
|
|
201
201
|
a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
202
202
|
a(this, "baseDefaultValueFunctionsLength");
|
|
203
203
|
a(this, "isModelInitialized", !0);
|
|
@@ -318,13 +318,13 @@ class de {
|
|
|
318
318
|
return n(u);
|
|
319
319
|
this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
320
320
|
this.defaultValueInprogressMap.values()
|
|
321
|
-
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(),
|
|
321
|
+
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
|
|
322
322
|
c();
|
|
323
323
|
})) : n(u);
|
|
324
324
|
}) : this.fieldParser(t[i], (u) => {
|
|
325
325
|
this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
326
326
|
this.defaultValueInprogressMap.values()
|
|
327
|
-
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(),
|
|
327
|
+
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
|
|
328
328
|
c();
|
|
329
329
|
})) : n(u);
|
|
330
330
|
});
|
|
@@ -339,11 +339,11 @@ class de {
|
|
|
339
339
|
}
|
|
340
340
|
promiseFieldParser(e, t, s) {
|
|
341
341
|
l.isPromise(e) ? e.then((i) => {
|
|
342
|
-
l.isString(i) && (i =
|
|
342
|
+
l.isString(i) && (i = U(i, "")), s && l.isObject(i) ? this.objectParser({
|
|
343
343
|
data: i,
|
|
344
344
|
updater: t
|
|
345
345
|
}) : t(i);
|
|
346
|
-
}) : (l.isString(e) && (e =
|
|
346
|
+
}) : (l.isString(e) && (e = U(e, "")), s && l.isObject(e) ? this.objectParser({
|
|
347
347
|
data: e,
|
|
348
348
|
updater: t
|
|
349
349
|
}) : t(e));
|
|
@@ -363,7 +363,7 @@ class de {
|
|
|
363
363
|
this.promiseFieldParser(i, t, s);
|
|
364
364
|
}
|
|
365
365
|
else
|
|
366
|
-
|
|
366
|
+
x(e) ? I(
|
|
367
367
|
() => e.value,
|
|
368
368
|
() => {
|
|
369
369
|
l.isUndefined(e.value) || (s && l.isObject(e.value) ? this.objectParser({
|
|
@@ -375,7 +375,7 @@ class de {
|
|
|
375
375
|
immediate: !0,
|
|
376
376
|
deep: !0
|
|
377
377
|
}
|
|
378
|
-
) :
|
|
378
|
+
) : z(e) ? I(
|
|
379
379
|
() => e,
|
|
380
380
|
() => {
|
|
381
381
|
l.isUndefined(e) || (s && l.isObject(e) ? this.objectParser({
|
|
@@ -460,16 +460,16 @@ function he(r) {
|
|
|
460
460
|
}
|
|
461
461
|
class me {
|
|
462
462
|
constructor(e) {
|
|
463
|
-
a(this, "schemas",
|
|
464
|
-
a(this, "model",
|
|
463
|
+
a(this, "schemas", q([]));
|
|
464
|
+
a(this, "model", q({}));
|
|
465
465
|
a(this, "processorBySchemaType", {
|
|
466
466
|
item: this.runtimeItemProcessor.bind(this),
|
|
467
467
|
group: this.runtimeGroupProcessor.bind(this),
|
|
468
468
|
list: this.runtimeListProcessor.bind(this)
|
|
469
469
|
});
|
|
470
|
-
a(this, "formRef",
|
|
471
|
-
a(this, "hydrateEffect", new
|
|
472
|
-
a(this, "native",
|
|
470
|
+
a(this, "formRef", q(null));
|
|
471
|
+
a(this, "hydrateEffect", new N());
|
|
472
|
+
a(this, "native", oe({}));
|
|
473
473
|
a(this, "grid", {});
|
|
474
474
|
a(this, "runtime", {});
|
|
475
475
|
a(this, "globalNativeFormOverride", {
|
|
@@ -478,17 +478,17 @@ class me {
|
|
|
478
478
|
});
|
|
479
479
|
this.setup = e, this.processor = new de(this);
|
|
480
480
|
const t = this.setup(this);
|
|
481
|
-
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui),
|
|
481
|
+
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), x(t.schemas)) {
|
|
482
482
|
const s = I(() => t.schemas, () => {
|
|
483
|
-
this.processor.parseSchemas(t.schemas.value),
|
|
483
|
+
this.processor.parseSchemas(t.schemas.value), O(() => {
|
|
484
484
|
s();
|
|
485
485
|
});
|
|
486
486
|
}, {
|
|
487
487
|
deep: !0
|
|
488
488
|
});
|
|
489
|
-
} else if (
|
|
489
|
+
} else if (z(t.schemas)) {
|
|
490
490
|
const s = I(() => t.schemas, () => {
|
|
491
|
-
this.processor.parseSchemas(t.schemas),
|
|
491
|
+
this.processor.parseSchemas(t.schemas), O(() => {
|
|
492
492
|
s();
|
|
493
493
|
});
|
|
494
494
|
}, {
|
|
@@ -504,16 +504,16 @@ class me {
|
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
506
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
507
|
-
var _, B, D, G, T, K, W, H, J, Q, X
|
|
507
|
+
var k, $, _, B, D, G, T, K, W, H, J, Q, X;
|
|
508
508
|
const o = w(e.component);
|
|
509
509
|
if (!o)
|
|
510
510
|
return;
|
|
511
|
-
y(this.globalNativeFormOverride.props, (
|
|
512
|
-
const n = y(g((
|
|
511
|
+
y(this.globalNativeFormOverride.props, ($ = (k = e.native) == null ? void 0 : k.props) == null ? void 0 : $.Form), y(this.globalNativeFormOverride.slots, (B = (_ = e.native) == null ? void 0 : _.slots) == null ? void 0 : B.Form);
|
|
512
|
+
const n = y(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), c = {
|
|
513
513
|
display: "grid",
|
|
514
514
|
gridColumn: "1 / -1",
|
|
515
515
|
...e.grid
|
|
516
|
-
}, u = y(g((
|
|
516
|
+
}, u = y(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({
|
|
517
517
|
schema: e,
|
|
518
518
|
parentSchema: i,
|
|
519
519
|
index: t
|
|
@@ -522,38 +522,38 @@ class me {
|
|
|
522
522
|
m === void 0 && (m = !0), m || delete s[e.field];
|
|
523
523
|
let h = e.label ?? "";
|
|
524
524
|
const F = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
525
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(F) && (h =
|
|
525
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(F) && (h = U((X = F == null ? void 0 : F.customizeItemLabel) == null ? void 0 : X.call(F, e.label ?? "", t + 1), "")), !v) {
|
|
526
526
|
let E = "请输入";
|
|
527
527
|
l.isUndefined(P) ? v = `${E}${h}` : /* @ts-expect-error */ C[P.toLowerCase()] ? (E = // @ts-expect-error
|
|
528
|
-
C[P.toLowerCase()], v = `${E}${h}`) : (Object.keys(C).forEach((
|
|
529
|
-
P.toLowerCase().includes(
|
|
528
|
+
C[P.toLowerCase()], v = `${E}${h}`) : (Object.keys(C).forEach((Y) => {
|
|
529
|
+
P.toLowerCase().includes(Y.toLowerCase()) && (E = C[Y]);
|
|
530
530
|
}), v = `${E}${h}`);
|
|
531
531
|
}
|
|
532
|
-
const
|
|
532
|
+
const Z = this.runtimeAdapter.getRuntimeRequired({
|
|
533
533
|
...e,
|
|
534
534
|
label: h
|
|
535
|
-
}),
|
|
535
|
+
}), A = S.getItemContainer(this), ee = S.getFormItemContainer(this), te = this, se = e.componentSlots;
|
|
536
536
|
return p("div", {
|
|
537
537
|
style: c
|
|
538
|
-
}, [p(
|
|
538
|
+
}, [p(A, {
|
|
539
539
|
show: m
|
|
540
540
|
}, {
|
|
541
541
|
default() {
|
|
542
|
-
return
|
|
542
|
+
return m && p(ee, R(u, {
|
|
543
543
|
label: `${h ? `${h}:` : ""}`
|
|
544
|
-
}, d,
|
|
544
|
+
}, d, Z), {
|
|
545
545
|
default() {
|
|
546
|
-
return
|
|
546
|
+
return te.runtimeAdapter.formComponentRenderer({
|
|
547
547
|
Component: o,
|
|
548
548
|
schema: e,
|
|
549
549
|
baseModel: s,
|
|
550
550
|
placeholder: v,
|
|
551
|
-
componentSlots:
|
|
551
|
+
componentSlots: se,
|
|
552
552
|
props: V
|
|
553
553
|
});
|
|
554
554
|
},
|
|
555
555
|
...n
|
|
556
|
-
})
|
|
556
|
+
});
|
|
557
557
|
}
|
|
558
558
|
})]);
|
|
559
559
|
}
|
|
@@ -567,11 +567,11 @@ class me {
|
|
|
567
567
|
let o = e.show;
|
|
568
568
|
return o === void 0 && (o = !0), p("div", {
|
|
569
569
|
style: s
|
|
570
|
-
}, [
|
|
570
|
+
}, [o && p(i, {
|
|
571
571
|
schema: e
|
|
572
572
|
}, he(t = e.children.map((n) => this.runtimeItemProcessor(n))) ? t : {
|
|
573
573
|
default: () => [t]
|
|
574
|
-
})
|
|
574
|
+
})]);
|
|
575
575
|
}
|
|
576
576
|
addListItem(e) {
|
|
577
577
|
var t, s;
|
|
@@ -597,7 +597,7 @@ class me {
|
|
|
597
597
|
const o = S.getListContainer(this), n = S.getListItemContainer(this);
|
|
598
598
|
return p("div", {
|
|
599
599
|
style: t
|
|
600
|
-
}, [
|
|
600
|
+
}, [i && p(o, {
|
|
601
601
|
schema: e
|
|
602
602
|
}, {
|
|
603
603
|
default() {
|
|
@@ -610,9 +610,9 @@ class me {
|
|
|
610
610
|
} = {}) {
|
|
611
611
|
var V;
|
|
612
612
|
const P = d ?? p("button", null, null);
|
|
613
|
-
return
|
|
613
|
+
return ne(p(P, {
|
|
614
614
|
onClick: () => s.deleteListItem(e, u)
|
|
615
|
-
}, null), [[
|
|
615
|
+
}, null), [[le, ((V = s.model.value[e.field]) == null ? void 0 : V.length) > 1]]);
|
|
616
616
|
}
|
|
617
617
|
}));
|
|
618
618
|
},
|
|
@@ -624,7 +624,7 @@ class me {
|
|
|
624
624
|
onClick: () => s.addListItem(e)
|
|
625
625
|
}, null);
|
|
626
626
|
}
|
|
627
|
-
})
|
|
627
|
+
})]);
|
|
628
628
|
}
|
|
629
629
|
runtimeProcessor(e) {
|
|
630
630
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
@@ -654,7 +654,7 @@ class me {
|
|
|
654
654
|
class f {
|
|
655
655
|
}
|
|
656
656
|
a(f, "presets");
|
|
657
|
-
function
|
|
657
|
+
function M({
|
|
658
658
|
parentSchema: r,
|
|
659
659
|
schema: e,
|
|
660
660
|
index: t
|
|
@@ -665,7 +665,7 @@ const ye = {
|
|
|
665
665
|
ArcoVue: {
|
|
666
666
|
getRuntimeField(r) {
|
|
667
667
|
return {
|
|
668
|
-
field:
|
|
668
|
+
field: M(r)
|
|
669
669
|
};
|
|
670
670
|
},
|
|
671
671
|
getRuntimeRequired(r) {
|
|
@@ -719,7 +719,7 @@ const ye = {
|
|
|
719
719
|
NutUI: {
|
|
720
720
|
getRuntimeField(r) {
|
|
721
721
|
return {
|
|
722
|
-
prop:
|
|
722
|
+
prop: M(r)
|
|
723
723
|
};
|
|
724
724
|
},
|
|
725
725
|
getRuntimeRequired(r) {
|
|
@@ -779,7 +779,7 @@ const ye = {
|
|
|
779
779
|
NaiveUI: {
|
|
780
780
|
getRuntimeField(r) {
|
|
781
781
|
return {
|
|
782
|
-
path:
|
|
782
|
+
path: M(r)
|
|
783
783
|
};
|
|
784
784
|
},
|
|
785
785
|
getRuntimeRequired(r) {
|
|
@@ -893,9 +893,9 @@ a(j, "schemaPreset", {
|
|
|
893
893
|
}
|
|
894
894
|
}), // 基于基本功能提出基本预设
|
|
895
895
|
a(j, "placeholderPresetByComponentName", j.getPlaceholderPrefixPresetByComponentName());
|
|
896
|
-
let
|
|
896
|
+
let L = j;
|
|
897
897
|
const b = {
|
|
898
|
-
...
|
|
898
|
+
...L,
|
|
899
899
|
adapters: {
|
|
900
900
|
...ye
|
|
901
901
|
}
|