@harbor-design/proform 1.2.18 → 1.2.19
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
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (r, e, t) => (
|
|
4
|
-
import {
|
|
1
|
+
var ue = Object.defineProperty;
|
|
2
|
+
var ce = (r, e, t) => e in r ? ue(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
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 v, isReactive as M, toRaw as S, reactive as re, 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")
|
|
@@ -124,7 +124,7 @@ function x(r, e) {
|
|
|
124
124
|
class be {
|
|
125
125
|
constructor(e) {
|
|
126
126
|
a(this, "runtimeCore");
|
|
127
|
-
a(this, "
|
|
127
|
+
a(this, "readonlyReactiveModel", N({}));
|
|
128
128
|
this.formCustomization = e;
|
|
129
129
|
}
|
|
130
130
|
// happy path, 后续可以完善更多的 fallback 处理,fallback 处理是为了不卡住异步时的首次渲染做的优化
|
|
@@ -134,52 +134,49 @@ class be {
|
|
|
134
134
|
})), e;
|
|
135
135
|
}
|
|
136
136
|
setup(e) {
|
|
137
|
-
return this.runtimeCore = e, this.
|
|
137
|
+
return this.runtimeCore = e, this.readonlyReactiveModel.value = se(e.model.value), Object.assign(this.runtimeCore.native, this.formCustomization.native), Object.assign(this.runtimeCore.grid, this.formCustomization.grid), Object.assign(this.runtimeCore.runtime, this.formCustomization.runtime), this.formCustomization.ui && (this.runtimeCore.ui = this.formCustomization.ui), this.formCustomization;
|
|
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) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
lazy: !1
|
|
174
|
-
}
|
|
175
|
-
);
|
|
145
|
+
P(() => {
|
|
146
|
+
this.runtimeCore.hydrateEffect.trackEffect(
|
|
147
|
+
() => {
|
|
148
|
+
q(e) ? v(
|
|
149
|
+
() => e.value,
|
|
150
|
+
() => {
|
|
151
|
+
h(this.runtimeCore.model.value, e.value);
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
deep: !0,
|
|
155
|
+
immediate: !0
|
|
156
|
+
}
|
|
157
|
+
) : M(e) ? v(
|
|
158
|
+
() => e,
|
|
159
|
+
() => {
|
|
160
|
+
h(this.runtimeCore.model.value, e);
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
deep: !0,
|
|
164
|
+
immediate: !0
|
|
165
|
+
}
|
|
166
|
+
) : h(this.runtimeCore.model.value, e);
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
lazy: !1
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
});
|
|
176
173
|
}
|
|
177
174
|
share(e) {
|
|
178
175
|
if (q(e)) {
|
|
179
176
|
const t = v(
|
|
180
177
|
() => e.value,
|
|
181
178
|
() => {
|
|
182
|
-
h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(),
|
|
179
|
+
h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), P(() => {
|
|
183
180
|
t();
|
|
184
181
|
});
|
|
185
182
|
},
|
|
@@ -192,7 +189,7 @@ class be {
|
|
|
192
189
|
const t = v(
|
|
193
190
|
() => e,
|
|
194
191
|
() => {
|
|
195
|
-
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(),
|
|
192
|
+
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), P(() => {
|
|
196
193
|
t();
|
|
197
194
|
});
|
|
198
195
|
},
|
|
@@ -205,13 +202,13 @@ class be {
|
|
|
205
202
|
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
|
|
206
203
|
}
|
|
207
204
|
subscribeModel(e) {
|
|
208
|
-
|
|
205
|
+
P(() => {
|
|
209
206
|
const t = v(
|
|
210
|
-
() => this.
|
|
207
|
+
() => this.readonlyReactiveModel.value,
|
|
211
208
|
(s) => {
|
|
212
209
|
e(s, {
|
|
213
210
|
stopSubscribe() {
|
|
214
|
-
|
|
211
|
+
P(() => {
|
|
215
212
|
t();
|
|
216
213
|
});
|
|
217
214
|
}
|
|
@@ -226,9 +223,9 @@ class be {
|
|
|
226
223
|
}
|
|
227
224
|
resetModel() {
|
|
228
225
|
var e;
|
|
229
|
-
(e = this.runtimeCore) != null && e.model.value && (this.runtimeCore.model.value =
|
|
226
|
+
(e = this.runtimeCore) != null && e.model.value && (this.runtimeCore.model.value = g(
|
|
230
227
|
this.runtimeCore.processor.stableModel
|
|
231
|
-
));
|
|
228
|
+
), this.readonlyReactiveModel.value = se(this.runtimeCore.model.value));
|
|
232
229
|
}
|
|
233
230
|
}
|
|
234
231
|
class L {
|
|
@@ -255,8 +252,8 @@ class ve {
|
|
|
255
252
|
a(this, "getRuntimeMeta");
|
|
256
253
|
a(this, "stableSchemas", []);
|
|
257
254
|
a(this, "stableModel", {});
|
|
258
|
-
a(this, "schemaPreset",
|
|
259
|
-
a(this, "componentPropsPreset",
|
|
255
|
+
a(this, "schemaPreset", C.schemaPreset);
|
|
256
|
+
a(this, "componentPropsPreset", C.componentPropsPreset);
|
|
260
257
|
a(this, "stableUpdaterProcessProgress");
|
|
261
258
|
a(this, "stableUpdaterTimes", 0);
|
|
262
259
|
a(this, "schemaEffect", new L());
|
|
@@ -302,7 +299,7 @@ class ve {
|
|
|
302
299
|
// 派生过程,用于外部应用
|
|
303
300
|
parseSchemas(e, t) {
|
|
304
301
|
l.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
305
|
-
|
|
302
|
+
g(e)
|
|
306
303
|
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
|
|
307
304
|
}
|
|
308
305
|
parseStable(e) {
|
|
@@ -316,7 +313,7 @@ class ve {
|
|
|
316
313
|
// 对于稳定初始化更新的抽象
|
|
317
314
|
stableUpdater(e = []) {
|
|
318
315
|
if (e.every(Boolean)) {
|
|
319
|
-
const t =
|
|
316
|
+
const t = S(this.processedSchemas.value);
|
|
320
317
|
!l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
321
318
|
length: t.length
|
|
322
319
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
|
|
@@ -382,13 +379,13 @@ class ve {
|
|
|
382
379
|
return n(c);
|
|
383
380
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
384
381
|
this.defaultValueInprogressMap.values()
|
|
385
|
-
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(),
|
|
382
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), P(() => {
|
|
386
383
|
f();
|
|
387
384
|
})) : n(c);
|
|
388
385
|
}) : this.fieldParser(t[i], (c) => {
|
|
389
386
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
390
387
|
this.defaultValueInprogressMap.values()
|
|
391
|
-
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(),
|
|
388
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), P(() => {
|
|
392
389
|
f();
|
|
393
390
|
})) : n(c);
|
|
394
391
|
});
|
|
@@ -463,7 +460,7 @@ class ve {
|
|
|
463
460
|
modelProcessor(e) {
|
|
464
461
|
e.map(
|
|
465
462
|
(t) => this.createModel(t, this.processedModel.value)
|
|
466
|
-
), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel =
|
|
463
|
+
), 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());
|
|
467
464
|
}
|
|
468
465
|
createModel(e, t) {
|
|
469
466
|
l.isListSchema(e) && (t[e.field] || (t[e.field] = [{}]), e.children.forEach((s) => {
|
|
@@ -473,7 +470,7 @@ class ve {
|
|
|
473
470
|
}), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
|
|
474
471
|
}
|
|
475
472
|
}
|
|
476
|
-
class
|
|
473
|
+
class j {
|
|
477
474
|
static getFormContainer({ ui: e } = {}) {
|
|
478
475
|
return u.presets.uiPresets[e ?? u.presets.ui].container.Form;
|
|
479
476
|
}
|
|
@@ -503,27 +500,27 @@ class ye {
|
|
|
503
500
|
}
|
|
504
501
|
getRuntimeField(e) {
|
|
505
502
|
var i;
|
|
506
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
503
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = C.adapters[u.getUI(this.ui)];
|
|
507
504
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
508
505
|
}
|
|
509
506
|
getRuntimeRequired(e) {
|
|
510
507
|
var i;
|
|
511
|
-
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)];
|
|
512
509
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
513
510
|
}
|
|
514
511
|
getFormModelPropName() {
|
|
515
512
|
var s;
|
|
516
|
-
const e = (s = u.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t =
|
|
513
|
+
const e = (s = u.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = C.adapters[u.getUI(this.ui)];
|
|
517
514
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
518
515
|
}
|
|
519
516
|
formComponentRenderer(e) {
|
|
520
517
|
var i;
|
|
521
|
-
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
518
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = C.adapters[u.getUI(this.ui)];
|
|
522
519
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
523
520
|
}
|
|
524
521
|
clearValidate(e) {
|
|
525
522
|
var i;
|
|
526
|
-
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)];
|
|
527
524
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
528
525
|
}
|
|
529
526
|
}
|
|
@@ -541,10 +538,10 @@ class ge {
|
|
|
541
538
|
});
|
|
542
539
|
a(this, "formRef", N(null));
|
|
543
540
|
a(this, "hydrateEffect", new L());
|
|
544
|
-
a(this, "native",
|
|
541
|
+
a(this, "native", re({}));
|
|
545
542
|
a(this, "grid", {});
|
|
546
543
|
a(this, "runtime", {});
|
|
547
|
-
a(this, "globalNativeFormOverride",
|
|
544
|
+
a(this, "globalNativeFormOverride", re({
|
|
548
545
|
props: {
|
|
549
546
|
Form: {},
|
|
550
547
|
FormItem: {}
|
|
@@ -570,7 +567,7 @@ class ge {
|
|
|
570
567
|
);
|
|
571
568
|
else if (M(t.schemas)) {
|
|
572
569
|
const s = v(() => t.schemas, () => {
|
|
573
|
-
this.processor.parseSchemas(t.schemas),
|
|
570
|
+
this.processor.parseSchemas(t.schemas), P(() => {
|
|
574
571
|
s();
|
|
575
572
|
});
|
|
576
573
|
}, {
|
|
@@ -580,7 +577,7 @@ class ge {
|
|
|
580
577
|
this.processor.parseSchemas(t.schemas);
|
|
581
578
|
}
|
|
582
579
|
getRuntimeMeta() {
|
|
583
|
-
const e =
|
|
580
|
+
const e = S(g(this.model.value));
|
|
584
581
|
let t;
|
|
585
582
|
return {
|
|
586
583
|
model: e,
|
|
@@ -591,7 +588,7 @@ class ge {
|
|
|
591
588
|
t && clearTimeout(t), t = setTimeout(() => {
|
|
592
589
|
if (q(s)) {
|
|
593
590
|
const i = v(() => s.value, () => {
|
|
594
|
-
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(),
|
|
591
|
+
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), P(() => {
|
|
595
592
|
i();
|
|
596
593
|
});
|
|
597
594
|
}, {
|
|
@@ -600,7 +597,7 @@ class ge {
|
|
|
600
597
|
});
|
|
601
598
|
} else if (M(s)) {
|
|
602
599
|
const i = v(() => s, () => {
|
|
603
|
-
h(this.shared, s), this.processor.schemaEffect.triggerEffects(),
|
|
600
|
+
h(this.shared, s), this.processor.schemaEffect.triggerEffects(), P(() => {
|
|
604
601
|
i();
|
|
605
602
|
});
|
|
606
603
|
}, {
|
|
@@ -615,50 +612,50 @@ class ge {
|
|
|
615
612
|
}
|
|
616
613
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
617
614
|
var _, z, k, B, D, T, G, W, K, H, J, Q, X, Y, Z, A, ee;
|
|
618
|
-
const o =
|
|
615
|
+
const o = S(e.component);
|
|
619
616
|
if (!o)
|
|
620
617
|
return;
|
|
621
618
|
(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);
|
|
622
|
-
const n = h(
|
|
619
|
+
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 = {
|
|
623
620
|
display: "grid",
|
|
624
621
|
gridColumn: "1 / -1",
|
|
625
622
|
...e.grid
|
|
626
|
-
}, c = h(
|
|
623
|
+
}, 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({
|
|
627
624
|
schema: e,
|
|
628
625
|
parentSchema: i,
|
|
629
626
|
index: t
|
|
630
|
-
}), y = o.name, F = e.componentProps ?? {}, E =
|
|
627
|
+
}), y = o.name, F = e.componentProps ?? {}, E = C.placeholderPresetByComponentName;
|
|
631
628
|
let I = e.placeholder, b = e.show;
|
|
632
629
|
b === void 0 && (b = !0);
|
|
633
630
|
let m = e.label ?? "";
|
|
634
|
-
const
|
|
635
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(
|
|
636
|
-
let
|
|
637
|
-
l.isUndefined(y) ? I = `${
|
|
638
|
-
E[y.toLowerCase()], I = `${
|
|
639
|
-
y.toLowerCase().includes(te.toLowerCase()) && (
|
|
640
|
-
}), I = `${
|
|
631
|
+
const V = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
632
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (m = x((ee = V == null ? void 0 : V.customizeListItemLabel) == null ? void 0 : ee.call(V, e.label ?? "", t + 1), "")), !I) {
|
|
633
|
+
let w = "请输入";
|
|
634
|
+
l.isUndefined(y) ? I = `${w}${m}` : /* @ts-expect-error */ E[y.toLowerCase()] ? (w = // @ts-expect-error
|
|
635
|
+
E[y.toLowerCase()], I = `${w}${m}`) : (Object.keys(E).forEach((te) => {
|
|
636
|
+
y.toLowerCase().includes(te.toLowerCase()) && (w = E[te]);
|
|
637
|
+
}), I = `${w}${m}`);
|
|
641
638
|
}
|
|
642
|
-
const
|
|
639
|
+
const ie = this.runtimeAdapter.getRuntimeRequired({
|
|
643
640
|
...e,
|
|
644
641
|
label: m
|
|
645
|
-
}),
|
|
642
|
+
}), oe = j.getItemContainer(this), ne = j.getFormItemContainer(this), le = this, ae = e.componentSlots;
|
|
646
643
|
return p("div", {
|
|
647
644
|
style: f
|
|
648
|
-
}, [p(
|
|
645
|
+
}, [p(oe, {
|
|
649
646
|
show: b
|
|
650
647
|
}, {
|
|
651
648
|
default() {
|
|
652
|
-
return b && p(
|
|
649
|
+
return b && p(ne, O(c, {
|
|
653
650
|
label: `${m ? `${m}:` : ""}`
|
|
654
|
-
}, d,
|
|
651
|
+
}, d, ie), {
|
|
655
652
|
default() {
|
|
656
|
-
return
|
|
653
|
+
return le.runtimeAdapter.formComponentRenderer({
|
|
657
654
|
Component: o,
|
|
658
655
|
schema: e,
|
|
659
656
|
baseModel: s,
|
|
660
657
|
placeholder: I,
|
|
661
|
-
componentSlots:
|
|
658
|
+
componentSlots: ae,
|
|
662
659
|
props: F
|
|
663
660
|
});
|
|
664
661
|
},
|
|
@@ -673,7 +670,7 @@ class ge {
|
|
|
673
670
|
display: "grid",
|
|
674
671
|
gridColumn: "1 / -1",
|
|
675
672
|
...e.grid
|
|
676
|
-
}, i =
|
|
673
|
+
}, i = j.getGroupContainer(this);
|
|
677
674
|
let o = e.show;
|
|
678
675
|
return o === void 0 && (o = !0), p("div", {
|
|
679
676
|
style: s
|
|
@@ -690,7 +687,7 @@ class ge {
|
|
|
690
687
|
code: "0001",
|
|
691
688
|
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
692
689
|
});
|
|
693
|
-
(s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(
|
|
690
|
+
(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);
|
|
694
691
|
}
|
|
695
692
|
deleteListItem(e, t) {
|
|
696
693
|
this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
|
|
@@ -704,7 +701,7 @@ class ge {
|
|
|
704
701
|
s.model.value[e.field] || (s.model.value[e.field] = [{}]);
|
|
705
702
|
let i = e.show;
|
|
706
703
|
i === void 0 && (i = !0);
|
|
707
|
-
const o =
|
|
704
|
+
const o = j.getListContainer(this), n = j.getListItemContainer(this);
|
|
708
705
|
return p("div", {
|
|
709
706
|
style: t
|
|
710
707
|
}, [i && p(o, {
|
|
@@ -746,7 +743,7 @@ class ge {
|
|
|
746
743
|
gridColumn: "1 / -1",
|
|
747
744
|
gridAutoColumns: "1fr",
|
|
748
745
|
...this.grid
|
|
749
|
-
}, t = this, s = h(this.globalNativeFormOverride.props.Form,
|
|
746
|
+
}, t = this, s = h(this.globalNativeFormOverride.props.Form, g((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}), i = h(this.globalNativeFormOverride.slots.Form, g((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}), o = j.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
750
747
|
return p(o, O(s, {
|
|
751
748
|
ref: this.formRef
|
|
752
749
|
}, {
|
|
@@ -833,7 +830,7 @@ const Ce = {
|
|
|
833
830
|
},
|
|
834
831
|
validateForm(r) {
|
|
835
832
|
return new Promise((e, t) => {
|
|
836
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
833
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
|
|
837
834
|
});
|
|
838
835
|
},
|
|
839
836
|
clearValidate(r) {
|
|
@@ -898,7 +895,7 @@ const Ce = {
|
|
|
898
895
|
valid: s,
|
|
899
896
|
errors: i
|
|
900
897
|
}) => {
|
|
901
|
-
s ? e(r.cleanFallbackFields(
|
|
898
|
+
s ? e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))) : t(i);
|
|
902
899
|
});
|
|
903
900
|
});
|
|
904
901
|
},
|
|
@@ -962,14 +959,14 @@ const Ce = {
|
|
|
962
959
|
},
|
|
963
960
|
validateForm(r) {
|
|
964
961
|
return new Promise((e, t) => {
|
|
965
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
962
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
|
|
966
963
|
});
|
|
967
964
|
},
|
|
968
965
|
clearValidate(r) {
|
|
969
966
|
r.formRef.value.restoreValidation();
|
|
970
967
|
}
|
|
971
968
|
}
|
|
972
|
-
},
|
|
969
|
+
}, R = class R {
|
|
973
970
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
974
971
|
const e = {
|
|
975
972
|
请选择: ["select", "tree"],
|
|
@@ -982,7 +979,7 @@ const Ce = {
|
|
|
982
979
|
return t;
|
|
983
980
|
}
|
|
984
981
|
};
|
|
985
|
-
a(
|
|
982
|
+
a(R, "schemaPreset", {
|
|
986
983
|
type: {
|
|
987
984
|
defaultValue: "item"
|
|
988
985
|
},
|
|
@@ -1025,19 +1022,19 @@ a(S, "schemaPreset", {
|
|
|
1025
1022
|
grid: {
|
|
1026
1023
|
default: void 0
|
|
1027
1024
|
}
|
|
1028
|
-
}), a(
|
|
1025
|
+
}), a(R, "componentPropsPreset", {
|
|
1029
1026
|
options: {
|
|
1030
1027
|
defaultValue: []
|
|
1031
1028
|
}
|
|
1032
1029
|
}), // 基于基本功能提出基本预设
|
|
1033
|
-
a(
|
|
1034
|
-
let $ =
|
|
1035
|
-
const
|
|
1030
|
+
a(R, "placeholderPresetByComponentName", R.getPlaceholderPrefixPresetByComponentName());
|
|
1031
|
+
let $ = R;
|
|
1032
|
+
const C = {
|
|
1036
1033
|
...$,
|
|
1037
1034
|
adapters: {
|
|
1038
1035
|
...Ce
|
|
1039
1036
|
}
|
|
1040
|
-
},
|
|
1037
|
+
}, Ve = /* @__PURE__ */ me({
|
|
1041
1038
|
props: {
|
|
1042
1039
|
setup: {
|
|
1043
1040
|
type: Function,
|
|
@@ -1049,7 +1046,7 @@ const g = {
|
|
|
1049
1046
|
return () => e.exec();
|
|
1050
1047
|
}
|
|
1051
1048
|
});
|
|
1052
|
-
function
|
|
1049
|
+
function je(r) {
|
|
1053
1050
|
const e = new be(r);
|
|
1054
1051
|
return [
|
|
1055
1052
|
e.setup.bind(e),
|
|
@@ -1062,7 +1059,7 @@ function Ve(r) {
|
|
|
1062
1059
|
}
|
|
1063
1060
|
];
|
|
1064
1061
|
}
|
|
1065
|
-
function
|
|
1062
|
+
function Re(r) {
|
|
1066
1063
|
u.presets = r;
|
|
1067
1064
|
}
|
|
1068
1065
|
function Ie(r, e) {
|
|
@@ -1071,17 +1068,17 @@ function Ie(r, e) {
|
|
|
1071
1068
|
writable: !0
|
|
1072
1069
|
}), r;
|
|
1073
1070
|
}
|
|
1074
|
-
function
|
|
1071
|
+
function Se(r) {
|
|
1075
1072
|
return Ie(r, "native");
|
|
1076
1073
|
}
|
|
1077
|
-
function
|
|
1074
|
+
function we(r) {
|
|
1078
1075
|
return r.__proform_raw_object = !0, r;
|
|
1079
1076
|
}
|
|
1080
1077
|
export {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1078
|
+
Ve as ProForm,
|
|
1079
|
+
Se as markNativeFunction,
|
|
1080
|
+
we as markNativeObject,
|
|
1081
|
+
je as useForm,
|
|
1082
|
+
Re as useFormPresetConfigurer,
|
|
1086
1083
|
Ie as useModifiers
|
|
1087
1084
|
};
|
|
@@ -3,12 +3,12 @@ import { RuntimeCore } from "../index";
|
|
|
3
3
|
export default class FormCustomizer {
|
|
4
4
|
formCustomization: FormCustomization;
|
|
5
5
|
runtimeCore: RuntimeCore;
|
|
6
|
-
|
|
6
|
+
readonlyReactiveModel: import("vue").Ref<{}>;
|
|
7
7
|
private cleanFallbackFields;
|
|
8
8
|
constructor(formCustomization: FormCustomization);
|
|
9
9
|
setup(_runtimeCore: RuntimeCore): FormCustomization;
|
|
10
10
|
submit(): Promise<AnyObject>;
|
|
11
|
-
hydrate(data: AnyObject):
|
|
11
|
+
hydrate(data: AnyObject): void;
|
|
12
12
|
share(data: AnyObject): void;
|
|
13
13
|
subscribeModel(callback: AnyFunction): void;
|
|
14
14
|
resetModel(): void;
|