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