@harbor-design/proform 1.2.15 → 1.2.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 +34 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ae = Object.defineProperty;
|
|
2
2
|
var ue = (r, e, t) => e in r ? ae(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var a = (r, e, t) => (ue(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { readonly as ce, isRef as q, watch as v, isReactive as M, nextTick as
|
|
4
|
+
import { readonly as ce, isRef as q, watch as v, isReactive as M, nextTick as P, toRaw as w, ref as N, reactive as se, createVNode as p, 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);
|
|
@@ -80,7 +80,7 @@ function h(r, ...e) {
|
|
|
80
80
|
t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] = h(r[s] || {}, t[s]) : r[s] = t[s]);
|
|
81
81
|
}), r;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function g(r) {
|
|
84
84
|
const e = /* @__PURE__ */ new WeakMap();
|
|
85
85
|
function t(s) {
|
|
86
86
|
if (s === null || typeof s != "object")
|
|
@@ -138,7 +138,7 @@ class be {
|
|
|
138
138
|
}
|
|
139
139
|
submit() {
|
|
140
140
|
var s;
|
|
141
|
-
const e = (s = u.getPreset(this.runtimeCore.ui)) == null ? void 0 : s.adapter, t =
|
|
141
|
+
const e = (s = u.getPreset(this.runtimeCore.ui)) == null ? void 0 : s.adapter, t = C.adapters[u.getUI(this.runtimeCore.ui)];
|
|
142
142
|
return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
|
|
143
143
|
}
|
|
144
144
|
hydrate(e) {
|
|
@@ -179,7 +179,7 @@ class be {
|
|
|
179
179
|
const t = v(
|
|
180
180
|
() => e.value,
|
|
181
181
|
() => {
|
|
182
|
-
h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(),
|
|
182
|
+
h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), P(() => {
|
|
183
183
|
t();
|
|
184
184
|
});
|
|
185
185
|
},
|
|
@@ -192,7 +192,7 @@ class be {
|
|
|
192
192
|
const t = v(
|
|
193
193
|
() => e,
|
|
194
194
|
() => {
|
|
195
|
-
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(),
|
|
195
|
+
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), P(() => {
|
|
196
196
|
t();
|
|
197
197
|
});
|
|
198
198
|
},
|
|
@@ -205,13 +205,13 @@ class be {
|
|
|
205
205
|
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
|
|
206
206
|
}
|
|
207
207
|
subscribeModel(e) {
|
|
208
|
-
|
|
208
|
+
P(() => {
|
|
209
209
|
const t = v(
|
|
210
210
|
() => this.reactiveModel,
|
|
211
211
|
(s) => {
|
|
212
212
|
e(s, {
|
|
213
213
|
stopSubscribe() {
|
|
214
|
-
|
|
214
|
+
P(() => {
|
|
215
215
|
t();
|
|
216
216
|
});
|
|
217
217
|
}
|
|
@@ -225,9 +225,12 @@ class be {
|
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
resetModel() {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
P(() => {
|
|
229
|
+
var e;
|
|
230
|
+
(e = this.runtimeCore) != null && e.model.value && (this.runtimeCore.model.value = g(
|
|
231
|
+
this.runtimeCore.processor.stableModel
|
|
232
|
+
));
|
|
233
|
+
});
|
|
231
234
|
}
|
|
232
235
|
}
|
|
233
236
|
class L {
|
|
@@ -254,8 +257,8 @@ class ve {
|
|
|
254
257
|
a(this, "getRuntimeMeta");
|
|
255
258
|
a(this, "stableSchemas", []);
|
|
256
259
|
a(this, "stableModel", {});
|
|
257
|
-
a(this, "schemaPreset",
|
|
258
|
-
a(this, "componentPropsPreset",
|
|
260
|
+
a(this, "schemaPreset", C.schemaPreset);
|
|
261
|
+
a(this, "componentPropsPreset", C.componentPropsPreset);
|
|
259
262
|
a(this, "stableUpdaterProcessProgress");
|
|
260
263
|
a(this, "stableUpdaterTimes", 0);
|
|
261
264
|
a(this, "schemaEffect", new L());
|
|
@@ -301,7 +304,7 @@ class ve {
|
|
|
301
304
|
// 派生过程,用于外部应用
|
|
302
305
|
parseSchemas(e, t) {
|
|
303
306
|
l.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
304
|
-
|
|
307
|
+
g(e)
|
|
305
308
|
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
|
|
306
309
|
}
|
|
307
310
|
parseStable(e) {
|
|
@@ -381,13 +384,13 @@ class ve {
|
|
|
381
384
|
return n(c);
|
|
382
385
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
383
386
|
this.defaultValueInprogressMap.values()
|
|
384
|
-
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(),
|
|
387
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), P(() => {
|
|
385
388
|
f();
|
|
386
389
|
})) : n(c);
|
|
387
390
|
}) : this.fieldParser(t[i], (c) => {
|
|
388
391
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
389
392
|
this.defaultValueInprogressMap.values()
|
|
390
|
-
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(),
|
|
393
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), P(() => {
|
|
391
394
|
f();
|
|
392
395
|
})) : n(c);
|
|
393
396
|
});
|
|
@@ -462,7 +465,7 @@ class ve {
|
|
|
462
465
|
modelProcessor(e) {
|
|
463
466
|
e.map(
|
|
464
467
|
(t) => this.createModel(t, this.processedModel.value)
|
|
465
|
-
), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (
|
|
468
|
+
), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel = g(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects());
|
|
466
469
|
}
|
|
467
470
|
createModel(e, t) {
|
|
468
471
|
l.isListSchema(e) && (t[e.field] || (t[e.field] = [{}]), e.children.forEach((s) => {
|
|
@@ -502,27 +505,27 @@ class ye {
|
|
|
502
505
|
}
|
|
503
506
|
getRuntimeField(e) {
|
|
504
507
|
var i;
|
|
505
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
508
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = C.adapters[u.getUI(this.ui)];
|
|
506
509
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
507
510
|
}
|
|
508
511
|
getRuntimeRequired(e) {
|
|
509
512
|
var i;
|
|
510
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
513
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = C.adapters[u.getUI(this.ui)];
|
|
511
514
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
512
515
|
}
|
|
513
516
|
getFormModelPropName() {
|
|
514
517
|
var s;
|
|
515
|
-
const e = (s = u.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t =
|
|
518
|
+
const e = (s = u.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = C.adapters[u.getUI(this.ui)];
|
|
516
519
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
517
520
|
}
|
|
518
521
|
formComponentRenderer(e) {
|
|
519
522
|
var i;
|
|
520
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
523
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = C.adapters[u.getUI(this.ui)];
|
|
521
524
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
522
525
|
}
|
|
523
526
|
clearValidate(e) {
|
|
524
527
|
var i;
|
|
525
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
528
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = C.adapters[u.getUI(this.ui)];
|
|
526
529
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
527
530
|
}
|
|
528
531
|
}
|
|
@@ -569,7 +572,7 @@ class ge {
|
|
|
569
572
|
);
|
|
570
573
|
else if (M(t.schemas)) {
|
|
571
574
|
const s = v(() => t.schemas, () => {
|
|
572
|
-
this.processor.parseSchemas(t.schemas),
|
|
575
|
+
this.processor.parseSchemas(t.schemas), P(() => {
|
|
573
576
|
s();
|
|
574
577
|
});
|
|
575
578
|
}, {
|
|
@@ -579,7 +582,7 @@ class ge {
|
|
|
579
582
|
this.processor.parseSchemas(t.schemas);
|
|
580
583
|
}
|
|
581
584
|
getRuntimeMeta() {
|
|
582
|
-
const e = w(
|
|
585
|
+
const e = w(g(this.model.value));
|
|
583
586
|
let t;
|
|
584
587
|
return {
|
|
585
588
|
model: e,
|
|
@@ -590,7 +593,7 @@ class ge {
|
|
|
590
593
|
t && clearTimeout(t), t = setTimeout(() => {
|
|
591
594
|
if (q(s)) {
|
|
592
595
|
const i = v(() => s.value, () => {
|
|
593
|
-
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(),
|
|
596
|
+
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), P(() => {
|
|
594
597
|
i();
|
|
595
598
|
});
|
|
596
599
|
}, {
|
|
@@ -599,7 +602,7 @@ class ge {
|
|
|
599
602
|
});
|
|
600
603
|
} else if (M(s)) {
|
|
601
604
|
const i = v(() => s, () => {
|
|
602
|
-
h(this.shared, s), this.processor.schemaEffect.triggerEffects(),
|
|
605
|
+
h(this.shared, s), this.processor.schemaEffect.triggerEffects(), P(() => {
|
|
603
606
|
i();
|
|
604
607
|
});
|
|
605
608
|
}, {
|
|
@@ -618,15 +621,15 @@ class ge {
|
|
|
618
621
|
if (!o)
|
|
619
622
|
return;
|
|
620
623
|
(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);
|
|
621
|
-
const n = h(
|
|
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), f = {
|
|
622
625
|
display: "grid",
|
|
623
626
|
gridColumn: "1 / -1",
|
|
624
627
|
...e.grid
|
|
625
|
-
}, c = h(
|
|
628
|
+
}, c = 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), d = this.runtimeAdapter.getRuntimeField({
|
|
626
629
|
schema: e,
|
|
627
630
|
parentSchema: i,
|
|
628
631
|
index: t
|
|
629
|
-
}), y = o.name, F = e.componentProps ?? {}, E =
|
|
632
|
+
}), y = o.name, F = e.componentProps ?? {}, E = C.placeholderPresetByComponentName;
|
|
630
633
|
let I = e.placeholder, b = e.show;
|
|
631
634
|
b === void 0 && (b = !0);
|
|
632
635
|
let m = e.label ?? "";
|
|
@@ -689,7 +692,7 @@ class ge {
|
|
|
689
692
|
code: "0001",
|
|
690
693
|
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
691
694
|
});
|
|
692
|
-
(s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(
|
|
695
|
+
(s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(g(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
|
|
693
696
|
}
|
|
694
697
|
deleteListItem(e, t) {
|
|
695
698
|
this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
|
|
@@ -745,7 +748,7 @@ class ge {
|
|
|
745
748
|
gridColumn: "1 / -1",
|
|
746
749
|
gridAutoColumns: "1fr",
|
|
747
750
|
...this.grid
|
|
748
|
-
}, t = this, s = h(
|
|
751
|
+
}, t = this, s = h(g((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props.Form), i = h(g((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();
|
|
749
752
|
return p(o, O(s, {
|
|
750
753
|
ref: this.formRef
|
|
751
754
|
}, {
|
|
@@ -1031,7 +1034,7 @@ a(S, "schemaPreset", {
|
|
|
1031
1034
|
}), // 基于基本功能提出基本预设
|
|
1032
1035
|
a(S, "placeholderPresetByComponentName", S.getPlaceholderPrefixPresetByComponentName());
|
|
1033
1036
|
let $ = S;
|
|
1034
|
-
const
|
|
1037
|
+
const C = {
|
|
1035
1038
|
...$,
|
|
1036
1039
|
adapters: {
|
|
1037
1040
|
...Ce
|