@harbor-design/proform 1.2.14 → 1.2.15
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 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
|
|
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) {
|
|
@@ -158,7 +158,7 @@ class be {
|
|
|
158
158
|
deep: !0,
|
|
159
159
|
immediate: !0
|
|
160
160
|
}
|
|
161
|
-
) :
|
|
161
|
+
) : M(e) ? v(
|
|
162
162
|
() => e,
|
|
163
163
|
() => {
|
|
164
164
|
h(this.runtimeCore.model.value, 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
|
},
|
|
@@ -188,11 +188,11 @@ class be {
|
|
|
188
188
|
immediate: !0
|
|
189
189
|
}
|
|
190
190
|
);
|
|
191
|
-
} else if (
|
|
191
|
+
} else if (M(e)) {
|
|
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
|
}
|
|
@@ -224,6 +224,11 @@ class be {
|
|
|
224
224
|
);
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
|
+
resetModel() {
|
|
228
|
+
this.runtimeCore.model.value = P(
|
|
229
|
+
this.runtimeCore.processor.stableModel
|
|
230
|
+
);
|
|
231
|
+
}
|
|
227
232
|
}
|
|
228
233
|
class L {
|
|
229
234
|
constructor() {
|
|
@@ -249,8 +254,8 @@ class ve {
|
|
|
249
254
|
a(this, "getRuntimeMeta");
|
|
250
255
|
a(this, "stableSchemas", []);
|
|
251
256
|
a(this, "stableModel", {});
|
|
252
|
-
a(this, "schemaPreset",
|
|
253
|
-
a(this, "componentPropsPreset",
|
|
257
|
+
a(this, "schemaPreset", g.schemaPreset);
|
|
258
|
+
a(this, "componentPropsPreset", g.componentPropsPreset);
|
|
254
259
|
a(this, "stableUpdaterProcessProgress");
|
|
255
260
|
a(this, "stableUpdaterTimes", 0);
|
|
256
261
|
a(this, "schemaEffect", new L());
|
|
@@ -296,7 +301,7 @@ class ve {
|
|
|
296
301
|
// 派生过程,用于外部应用
|
|
297
302
|
parseSchemas(e, t) {
|
|
298
303
|
l.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
299
|
-
|
|
304
|
+
P(e)
|
|
300
305
|
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
|
|
301
306
|
}
|
|
302
307
|
parseStable(e) {
|
|
@@ -326,11 +331,11 @@ class ve {
|
|
|
326
331
|
const c = f.index, d = f.key, y = f.keyIndex;
|
|
327
332
|
if (l.isUndefined(f.stable))
|
|
328
333
|
return;
|
|
329
|
-
const F = i.parseStable(f.stable), E = s == null ? void 0 : s.index,
|
|
334
|
+
const F = i.parseStable(f.stable), E = s == null ? void 0 : s.index, I = s == null ? void 0 : s.key;
|
|
330
335
|
let b = F;
|
|
331
336
|
if (l.isProcessInprogress(b) || (o[y] = !0), s) {
|
|
332
|
-
const m = i.processedSchemas.value[E][
|
|
333
|
-
m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[E][
|
|
337
|
+
const m = i.processedSchemas.value[E][I][c][d];
|
|
338
|
+
m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[E][I][c][d] = b, i.stableUpdater(o);
|
|
334
339
|
} else {
|
|
335
340
|
const m = i.processedSchemas.value[c][d];
|
|
336
341
|
m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[c][d] = b, i.stableUpdater(o);
|
|
@@ -376,13 +381,13 @@ class ve {
|
|
|
376
381
|
return n(c);
|
|
377
382
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
378
383
|
this.defaultValueInprogressMap.values()
|
|
379
|
-
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(),
|
|
384
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), C(() => {
|
|
380
385
|
f();
|
|
381
386
|
})) : n(c);
|
|
382
387
|
}) : this.fieldParser(t[i], (c) => {
|
|
383
388
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
384
389
|
this.defaultValueInprogressMap.values()
|
|
385
|
-
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(),
|
|
390
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), C(() => {
|
|
386
391
|
f();
|
|
387
392
|
})) : n(c);
|
|
388
393
|
});
|
|
@@ -437,7 +442,7 @@ class ve {
|
|
|
437
442
|
immediate: !0,
|
|
438
443
|
deep: !0
|
|
439
444
|
}
|
|
440
|
-
) :
|
|
445
|
+
) : M(e) ? v(
|
|
441
446
|
() => e,
|
|
442
447
|
() => {
|
|
443
448
|
l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
@@ -457,7 +462,7 @@ class ve {
|
|
|
457
462
|
modelProcessor(e) {
|
|
458
463
|
e.map(
|
|
459
464
|
(t) => this.createModel(t, this.processedModel.value)
|
|
460
|
-
), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel =
|
|
465
|
+
), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (console.log("done once"), this.stableModel = P(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects());
|
|
461
466
|
}
|
|
462
467
|
createModel(e, t) {
|
|
463
468
|
l.isListSchema(e) && (t[e.field] || (t[e.field] = [{}]), e.children.forEach((s) => {
|
|
@@ -497,27 +502,27 @@ class ye {
|
|
|
497
502
|
}
|
|
498
503
|
getRuntimeField(e) {
|
|
499
504
|
var i;
|
|
500
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
505
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = g.adapters[u.getUI(this.ui)];
|
|
501
506
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
502
507
|
}
|
|
503
508
|
getRuntimeRequired(e) {
|
|
504
509
|
var i;
|
|
505
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
510
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = g.adapters[u.getUI(this.ui)];
|
|
506
511
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
507
512
|
}
|
|
508
513
|
getFormModelPropName() {
|
|
509
514
|
var s;
|
|
510
|
-
const e = (s = u.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t =
|
|
515
|
+
const e = (s = u.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = g.adapters[u.getUI(this.ui)];
|
|
511
516
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
512
517
|
}
|
|
513
518
|
formComponentRenderer(e) {
|
|
514
519
|
var i;
|
|
515
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
520
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = g.adapters[u.getUI(this.ui)];
|
|
516
521
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
517
522
|
}
|
|
518
523
|
clearValidate(e) {
|
|
519
524
|
var i;
|
|
520
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
525
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = g.adapters[u.getUI(this.ui)];
|
|
521
526
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
522
527
|
}
|
|
523
528
|
}
|
|
@@ -526,14 +531,14 @@ function Pe(r) {
|
|
|
526
531
|
}
|
|
527
532
|
class ge {
|
|
528
533
|
constructor(e) {
|
|
529
|
-
a(this, "schemas",
|
|
530
|
-
a(this, "model",
|
|
534
|
+
a(this, "schemas", N([]));
|
|
535
|
+
a(this, "model", N({}));
|
|
531
536
|
a(this, "processorBySchemaType", {
|
|
532
537
|
item: this.runtimeItemProcessor.bind(this),
|
|
533
538
|
group: this.runtimeGroupProcessor.bind(this),
|
|
534
539
|
list: this.runtimeListProcessor.bind(this)
|
|
535
540
|
});
|
|
536
|
-
a(this, "formRef",
|
|
541
|
+
a(this, "formRef", N(null));
|
|
537
542
|
a(this, "hydrateEffect", new L());
|
|
538
543
|
a(this, "native", se({}));
|
|
539
544
|
a(this, "grid", {});
|
|
@@ -562,9 +567,9 @@ class ge {
|
|
|
562
567
|
deep: !0
|
|
563
568
|
}
|
|
564
569
|
);
|
|
565
|
-
else if (
|
|
570
|
+
else if (M(t.schemas)) {
|
|
566
571
|
const s = v(() => t.schemas, () => {
|
|
567
|
-
this.processor.parseSchemas(t.schemas),
|
|
572
|
+
this.processor.parseSchemas(t.schemas), C(() => {
|
|
568
573
|
s();
|
|
569
574
|
});
|
|
570
575
|
}, {
|
|
@@ -574,7 +579,7 @@ class ge {
|
|
|
574
579
|
this.processor.parseSchemas(t.schemas);
|
|
575
580
|
}
|
|
576
581
|
getRuntimeMeta() {
|
|
577
|
-
const e = w(
|
|
582
|
+
const e = w(P(this.model.value));
|
|
578
583
|
let t;
|
|
579
584
|
return {
|
|
580
585
|
model: e,
|
|
@@ -585,16 +590,16 @@ class ge {
|
|
|
585
590
|
t && clearTimeout(t), t = setTimeout(() => {
|
|
586
591
|
if (q(s)) {
|
|
587
592
|
const i = v(() => s.value, () => {
|
|
588
|
-
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(),
|
|
593
|
+
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), C(() => {
|
|
589
594
|
i();
|
|
590
595
|
});
|
|
591
596
|
}, {
|
|
592
597
|
deep: !0,
|
|
593
598
|
immediate: !0
|
|
594
599
|
});
|
|
595
|
-
} else if (
|
|
600
|
+
} else if (M(s)) {
|
|
596
601
|
const i = v(() => s, () => {
|
|
597
|
-
h(this.shared, s), this.processor.schemaEffect.triggerEffects(),
|
|
602
|
+
h(this.shared, s), this.processor.schemaEffect.triggerEffects(), C(() => {
|
|
598
603
|
i();
|
|
599
604
|
});
|
|
600
605
|
}, {
|
|
@@ -613,25 +618,25 @@ class ge {
|
|
|
613
618
|
if (!o)
|
|
614
619
|
return;
|
|
615
620
|
(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);
|
|
616
|
-
const n = h(
|
|
621
|
+
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 = {
|
|
617
622
|
display: "grid",
|
|
618
623
|
gridColumn: "1 / -1",
|
|
619
624
|
...e.grid
|
|
620
|
-
}, c = h(
|
|
625
|
+
}, 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({
|
|
621
626
|
schema: e,
|
|
622
627
|
parentSchema: i,
|
|
623
628
|
index: t
|
|
624
|
-
}), y = o.name, F = e.componentProps ?? {}, E =
|
|
625
|
-
let
|
|
629
|
+
}), y = o.name, F = e.componentProps ?? {}, E = g.placeholderPresetByComponentName;
|
|
630
|
+
let I = e.placeholder, b = e.show;
|
|
626
631
|
b === void 0 && (b = !0);
|
|
627
632
|
let m = e.label ?? "";
|
|
628
633
|
const j = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
629
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(j) && (m = x((ee = j == null ? void 0 : j.customizeListItemLabel) == null ? void 0 : ee.call(j, e.label ?? "", t + 1), "")), !
|
|
634
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(j) && (m = x((ee = j == null ? void 0 : j.customizeListItemLabel) == null ? void 0 : ee.call(j, e.label ?? "", t + 1), "")), !I) {
|
|
630
635
|
let R = "请输入";
|
|
631
|
-
l.isUndefined(y) ?
|
|
632
|
-
E[y.toLowerCase()],
|
|
636
|
+
l.isUndefined(y) ? I = `${R}${m}` : /* @ts-expect-error */ E[y.toLowerCase()] ? (R = // @ts-expect-error
|
|
637
|
+
E[y.toLowerCase()], I = `${R}${m}`) : (Object.keys(E).forEach((te) => {
|
|
633
638
|
y.toLowerCase().includes(te.toLowerCase()) && (R = E[te]);
|
|
634
|
-
}),
|
|
639
|
+
}), I = `${R}${m}`);
|
|
635
640
|
}
|
|
636
641
|
const re = this.runtimeAdapter.getRuntimeRequired({
|
|
637
642
|
...e,
|
|
@@ -651,7 +656,7 @@ class ge {
|
|
|
651
656
|
Component: o,
|
|
652
657
|
schema: e,
|
|
653
658
|
baseModel: s,
|
|
654
|
-
placeholder:
|
|
659
|
+
placeholder: I,
|
|
655
660
|
componentSlots: le,
|
|
656
661
|
props: F
|
|
657
662
|
});
|
|
@@ -684,7 +689,7 @@ class ge {
|
|
|
684
689
|
code: "0001",
|
|
685
690
|
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
686
691
|
});
|
|
687
|
-
(s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(
|
|
692
|
+
(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);
|
|
688
693
|
}
|
|
689
694
|
deleteListItem(e, t) {
|
|
690
695
|
this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
|
|
@@ -740,7 +745,7 @@ class ge {
|
|
|
740
745
|
gridColumn: "1 / -1",
|
|
741
746
|
gridAutoColumns: "1fr",
|
|
742
747
|
...this.grid
|
|
743
|
-
}, t = this, s = h(
|
|
748
|
+
}, 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();
|
|
744
749
|
return p(o, O(s, {
|
|
745
750
|
ref: this.formRef
|
|
746
751
|
}, {
|
|
@@ -1026,7 +1031,7 @@ a(S, "schemaPreset", {
|
|
|
1026
1031
|
}), // 基于基本功能提出基本预设
|
|
1027
1032
|
a(S, "placeholderPresetByComponentName", S.getPlaceholderPrefixPresetByComponentName());
|
|
1028
1033
|
let $ = S;
|
|
1029
|
-
const
|
|
1034
|
+
const g = {
|
|
1030
1035
|
...$,
|
|
1031
1036
|
adapters: {
|
|
1032
1037
|
...Ce
|
|
@@ -1051,7 +1056,8 @@ function Ve(r) {
|
|
|
1051
1056
|
submit: e.submit.bind(e),
|
|
1052
1057
|
hydrate: e.hydrate.bind(e),
|
|
1053
1058
|
share: e.share.bind(e),
|
|
1054
|
-
subscribeModel: e.subscribeModel.bind(e)
|
|
1059
|
+
subscribeModel: e.subscribeModel.bind(e),
|
|
1060
|
+
resetModel: e.resetModel.bind(e)
|
|
1055
1061
|
}
|
|
1056
1062
|
];
|
|
1057
1063
|
}
|