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