@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.
- package/dist/index.js +88 -82
- 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
|
|
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,
|
|
95
|
-
o.set(t(n), t(
|
|
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) ?
|
|
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) ?
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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),
|
|
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((
|
|
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(
|
|
331
|
-
const
|
|
332
|
-
if (l.isUndefined(
|
|
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(
|
|
335
|
-
let
|
|
336
|
-
if (l.isProcessInprogress(
|
|
337
|
-
const
|
|
338
|
-
|
|
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
|
|
341
|
-
|
|
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 = (
|
|
356
|
+
const n = (d) => {
|
|
357
357
|
e.updater({
|
|
358
358
|
...e,
|
|
359
359
|
key: i,
|
|
360
360
|
keyIndex: o,
|
|
361
|
-
stable:
|
|
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
|
|
368
|
-
this.promiseFieldParser(
|
|
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
|
|
377
|
+
const d = this.schemaEffect.trackEffect(
|
|
378
378
|
() => {
|
|
379
|
-
/\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (
|
|
380
|
-
if (!
|
|
381
|
-
return n(
|
|
382
|
-
this.defaultValueInprogressMap.set(t[i],
|
|
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((
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
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((
|
|
391
|
-
|
|
392
|
-
|
|
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) ?
|
|
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) ?
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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),
|
|
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
|
-
},
|
|
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
|
-
}),
|
|
633
|
-
let I = e.placeholder,
|
|
634
|
-
|
|
635
|
-
let
|
|
636
|
-
if (e.runtime ? E = e.runtime : E = (i == null ? void 0 : i.runtime) ?? this.runtime, !l.isUndefined(t) && !l.isObjectEmpty(E) && (
|
|
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(
|
|
639
|
-
F[
|
|
640
|
-
|
|
641
|
-
}), I = `${w}${
|
|
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:
|
|
651
|
+
label: b
|
|
646
652
|
}), oe = j.getItemContainer(this), ne = j.getFormItemContainer(this), le = this, ae = e.componentSlots;
|
|
647
|
-
return
|
|
648
|
-
style:
|
|
649
|
-
}, [
|
|
650
|
-
show:
|
|
653
|
+
return m("div", {
|
|
654
|
+
style: d
|
|
655
|
+
}, [m(oe, {
|
|
656
|
+
show: v
|
|
651
657
|
}, {
|
|
652
658
|
default() {
|
|
653
|
-
return
|
|
654
|
-
label: `${
|
|
655
|
-
},
|
|
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),
|
|
685
|
+
return o === void 0 && (o = !0), m("div", {
|
|
680
686
|
style: s
|
|
681
|
-
}, [o &&
|
|
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
|
|
715
|
+
return m("div", {
|
|
710
716
|
style: t
|
|
711
|
-
}, [i &&
|
|
717
|
+
}, [i && m(o, {
|
|
712
718
|
schema: e
|
|
713
719
|
}, {
|
|
714
720
|
default() {
|
|
715
|
-
return s.model.value[e.field].map((
|
|
721
|
+
return s.model.value[e.field].map((d, f) => m(n, null, {
|
|
716
722
|
default() {
|
|
717
|
-
return e.children.map((
|
|
723
|
+
return e.children.map((c) => s.runtimeItemProcessor(c, f, d, e));
|
|
718
724
|
},
|
|
719
725
|
delete({
|
|
720
|
-
container:
|
|
726
|
+
container: c
|
|
721
727
|
} = {}) {
|
|
722
728
|
var V;
|
|
723
|
-
const
|
|
724
|
-
return fe(p
|
|
725
|
-
onClick: () => s.deleteListItem(e,
|
|
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:
|
|
737
|
+
container: d
|
|
732
738
|
} = {}) {
|
|
733
|
-
const
|
|
734
|
-
return
|
|
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,
|
|
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((
|
|
751
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
962
|
+
return m(r, O({
|
|
957
963
|
value: e[t.field],
|
|
958
964
|
"onUpdate:value": (n) => e[t.field] = n,
|
|
959
965
|
placeholder: s
|