@harbor-design/proform 1.2.12 → 1.2.13
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 { isRef as
|
|
4
|
+
import { isRef as q, watch as y, isReactive as N, nextTick as E, toRaw as R, ref as U, reactive as se, createVNode as p, mergeProps as O, withDirectives as ce, vShow as fe, createTextVNode as de, isVNode as he, defineComponent as pe } from "vue";
|
|
5
5
|
class l {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -69,15 +69,15 @@ class l {
|
|
|
69
69
|
return !!e.__proform_raw_object;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function h(r, ...e) {
|
|
73
73
|
return e.forEach((t) => {
|
|
74
74
|
if (Array.isArray(t))
|
|
75
75
|
Array.isArray(r) || (r = []), t.forEach((s, i) => {
|
|
76
|
-
typeof s == "object" && s !== null ? r[i] =
|
|
76
|
+
typeof s == "object" && s !== null ? r[i] = h(Array.isArray(s) ? [] : {}, s) : r[i] = s;
|
|
77
77
|
});
|
|
78
78
|
else
|
|
79
79
|
for (const s in t)
|
|
80
|
-
t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] =
|
|
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
83
|
function C(r) {
|
|
@@ -124,7 +124,6 @@ function x(r, e) {
|
|
|
124
124
|
class me {
|
|
125
125
|
constructor(e) {
|
|
126
126
|
a(this, "runtimeCore");
|
|
127
|
-
a(this, "reactiveModel");
|
|
128
127
|
this.formCustomization = e;
|
|
129
128
|
}
|
|
130
129
|
// happy path, 后续可以完善更多的 fallback 处理,fallback 处理是为了不卡住异步时的首次渲染做的优化
|
|
@@ -134,7 +133,7 @@ class me {
|
|
|
134
133
|
})), e;
|
|
135
134
|
}
|
|
136
135
|
setup(e) {
|
|
137
|
-
return this.runtimeCore = e,
|
|
136
|
+
return this.runtimeCore = e, 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
137
|
}
|
|
139
138
|
submit() {
|
|
140
139
|
var s;
|
|
@@ -149,25 +148,25 @@ class me {
|
|
|
149
148
|
});
|
|
150
149
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
151
150
|
() => {
|
|
152
|
-
|
|
151
|
+
q(e) ? y(
|
|
153
152
|
() => e.value,
|
|
154
153
|
() => {
|
|
155
|
-
|
|
154
|
+
h(this.runtimeCore.model.value, e.value);
|
|
156
155
|
},
|
|
157
156
|
{
|
|
158
157
|
deep: !0,
|
|
159
158
|
immediate: !0
|
|
160
159
|
}
|
|
161
|
-
) :
|
|
160
|
+
) : N(e) ? y(
|
|
162
161
|
() => e,
|
|
163
162
|
() => {
|
|
164
|
-
|
|
163
|
+
h(this.runtimeCore.model.value, e);
|
|
165
164
|
},
|
|
166
165
|
{
|
|
167
166
|
deep: !0,
|
|
168
167
|
immediate: !0
|
|
169
168
|
}
|
|
170
|
-
) :
|
|
169
|
+
) : h(this.runtimeCore.model.value, e);
|
|
171
170
|
},
|
|
172
171
|
{
|
|
173
172
|
lazy: !1
|
|
@@ -175,11 +174,11 @@ class me {
|
|
|
175
174
|
);
|
|
176
175
|
}
|
|
177
176
|
share(e) {
|
|
178
|
-
if (
|
|
179
|
-
const t =
|
|
177
|
+
if (q(e)) {
|
|
178
|
+
const t = y(
|
|
180
179
|
() => e.value,
|
|
181
180
|
() => {
|
|
182
|
-
|
|
181
|
+
h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), E(() => {
|
|
183
182
|
t();
|
|
184
183
|
});
|
|
185
184
|
},
|
|
@@ -188,11 +187,11 @@ class me {
|
|
|
188
187
|
immediate: !0
|
|
189
188
|
}
|
|
190
189
|
);
|
|
191
|
-
} else if (
|
|
192
|
-
const t =
|
|
190
|
+
} else if (N(e)) {
|
|
191
|
+
const t = y(
|
|
193
192
|
() => e,
|
|
194
193
|
() => {
|
|
195
|
-
|
|
194
|
+
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), E(() => {
|
|
196
195
|
t();
|
|
197
196
|
});
|
|
198
197
|
},
|
|
@@ -202,42 +201,7 @@ class me {
|
|
|
202
201
|
}
|
|
203
202
|
);
|
|
204
203
|
} else
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
getReactiveModel() {
|
|
208
|
-
return this.reactiveModel || console.error(
|
|
209
|
-
"调用 getReactiveModel 受限:理论上 model 需要在 useForm 的下一个 tick 使用,可在 nextTick 及部分合适的框架钩子中使用该函数"
|
|
210
|
-
), this.reactiveModel;
|
|
211
|
-
}
|
|
212
|
-
setReactiveModel(e) {
|
|
213
|
-
return this.reactiveModel || console.error(
|
|
214
|
-
"调用 getReactiveModel 受限:理论上 model 需要在 useForm 的下一个 tick 使用,可在 nextTick 及部分合适的框架钩子中使用该函数"
|
|
215
|
-
), this.runtimeCore.hydrateEffect.trackEffect(
|
|
216
|
-
() => {
|
|
217
|
-
w(e) ? v(
|
|
218
|
-
() => e.value,
|
|
219
|
-
() => {
|
|
220
|
-
d(this.runtimeCore.model.value, e.value);
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
deep: !0,
|
|
224
|
-
immediate: !0
|
|
225
|
-
}
|
|
226
|
-
) : S(e) ? v(
|
|
227
|
-
() => e,
|
|
228
|
-
() => {
|
|
229
|
-
d(this.runtimeCore.model.value, e);
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
deep: !0,
|
|
233
|
-
immediate: !0
|
|
234
|
-
}
|
|
235
|
-
) : d(this.runtimeCore.model.value, e);
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
lazy: !1
|
|
239
|
-
}
|
|
240
|
-
), this.reactiveModel;
|
|
204
|
+
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
|
|
241
205
|
}
|
|
242
206
|
}
|
|
243
207
|
class L {
|
|
@@ -256,7 +220,7 @@ class L {
|
|
|
256
220
|
return !t.lazy && e(), this.effects.add(e), () => this.effects.delete(e);
|
|
257
221
|
}
|
|
258
222
|
}
|
|
259
|
-
class
|
|
223
|
+
class be {
|
|
260
224
|
constructor(e) {
|
|
261
225
|
a(this, "runtimeCore");
|
|
262
226
|
a(this, "processedSchemas");
|
|
@@ -273,7 +237,7 @@ class ve {
|
|
|
273
237
|
a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
274
238
|
a(this, "baseDefaultValueFunctionsLength");
|
|
275
239
|
a(this, "isModelInitialized", !0);
|
|
276
|
-
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e),
|
|
240
|
+
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), y(
|
|
277
241
|
() => this.processedModel.value,
|
|
278
242
|
() => {
|
|
279
243
|
this.schemaEffect.triggerEffects();
|
|
@@ -325,7 +289,7 @@ class ve {
|
|
|
325
289
|
// 对于稳定初始化更新的抽象
|
|
326
290
|
stableUpdater(e = []) {
|
|
327
291
|
if (e.every(Boolean)) {
|
|
328
|
-
const t =
|
|
292
|
+
const t = R(this.processedSchemas.value);
|
|
329
293
|
!l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
330
294
|
length: t.length
|
|
331
295
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
|
|
@@ -338,17 +302,17 @@ class ve {
|
|
|
338
302
|
}).fill(!1);
|
|
339
303
|
this.objectParser({ data: e, index: t, updater: n });
|
|
340
304
|
function n(f) {
|
|
341
|
-
const c = f.index,
|
|
305
|
+
const c = f.index, d = f.key, v = f.keyIndex;
|
|
342
306
|
if (l.isUndefined(f.stable))
|
|
343
307
|
return;
|
|
344
308
|
const F = i.parseStable(f.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
|
|
345
309
|
let b = F;
|
|
346
|
-
if (l.isProcessInprogress(b) || (o[
|
|
347
|
-
const m = i.processedSchemas.value[I][g][c][
|
|
348
|
-
m && l.isObject(m) &&
|
|
310
|
+
if (l.isProcessInprogress(b) || (o[v] = !0), s) {
|
|
311
|
+
const m = i.processedSchemas.value[I][g][c][d];
|
|
312
|
+
m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[I][g][c][d] = b, i.stableUpdater(o);
|
|
349
313
|
} else {
|
|
350
|
-
const m = i.processedSchemas.value[c][
|
|
351
|
-
m && l.isObject(m) &&
|
|
314
|
+
const m = i.processedSchemas.value[c][d];
|
|
315
|
+
m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[c][d] = b, i.stableUpdater(o);
|
|
352
316
|
}
|
|
353
317
|
}
|
|
354
318
|
}
|
|
@@ -391,13 +355,13 @@ class ve {
|
|
|
391
355
|
return n(c);
|
|
392
356
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
393
357
|
this.defaultValueInprogressMap.values()
|
|
394
|
-
).every((
|
|
358
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), E(() => {
|
|
395
359
|
f();
|
|
396
360
|
})) : n(c);
|
|
397
361
|
}) : this.fieldParser(t[i], (c) => {
|
|
398
362
|
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
399
363
|
this.defaultValueInprogressMap.values()
|
|
400
|
-
).every((
|
|
364
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), E(() => {
|
|
401
365
|
f();
|
|
402
366
|
})) : n(c);
|
|
403
367
|
});
|
|
@@ -440,7 +404,7 @@ class ve {
|
|
|
440
404
|
this.promiseFieldParser(i, t, s);
|
|
441
405
|
}
|
|
442
406
|
else
|
|
443
|
-
|
|
407
|
+
q(e) ? y(
|
|
444
408
|
() => e.value,
|
|
445
409
|
() => {
|
|
446
410
|
l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
|
|
@@ -452,7 +416,7 @@ class ve {
|
|
|
452
416
|
immediate: !0,
|
|
453
417
|
deep: !0
|
|
454
418
|
}
|
|
455
|
-
) :
|
|
419
|
+
) : N(e) ? y(
|
|
456
420
|
() => e,
|
|
457
421
|
() => {
|
|
458
422
|
l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
@@ -482,7 +446,7 @@ class ve {
|
|
|
482
446
|
}), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
|
|
483
447
|
}
|
|
484
448
|
}
|
|
485
|
-
class
|
|
449
|
+
class V {
|
|
486
450
|
static getFormContainer({ ui: e } = {}) {
|
|
487
451
|
return u.presets.uiPresets[e ?? u.presets.ui].container.Form;
|
|
488
452
|
}
|
|
@@ -502,7 +466,7 @@ class j {
|
|
|
502
466
|
return u.presets.uiPresets[e ?? u.presets.ui].container.ListItem;
|
|
503
467
|
}
|
|
504
468
|
}
|
|
505
|
-
class
|
|
469
|
+
class ve {
|
|
506
470
|
constructor(e) {
|
|
507
471
|
this.ui = e;
|
|
508
472
|
}
|
|
@@ -541,14 +505,14 @@ function ye(r) {
|
|
|
541
505
|
}
|
|
542
506
|
class Pe {
|
|
543
507
|
constructor(e) {
|
|
544
|
-
a(this, "schemas",
|
|
545
|
-
a(this, "model",
|
|
508
|
+
a(this, "schemas", U([]));
|
|
509
|
+
a(this, "model", U({}));
|
|
546
510
|
a(this, "processorBySchemaType", {
|
|
547
511
|
item: this.runtimeItemProcessor.bind(this),
|
|
548
512
|
group: this.runtimeGroupProcessor.bind(this),
|
|
549
513
|
list: this.runtimeListProcessor.bind(this)
|
|
550
514
|
});
|
|
551
|
-
a(this, "formRef",
|
|
515
|
+
a(this, "formRef", U(null));
|
|
552
516
|
a(this, "hydrateEffect", new L());
|
|
553
517
|
a(this, "native", se({}));
|
|
554
518
|
a(this, "grid", {});
|
|
@@ -564,10 +528,10 @@ class Pe {
|
|
|
564
528
|
}
|
|
565
529
|
}));
|
|
566
530
|
a(this, "shared", {});
|
|
567
|
-
this.setup = e, this.processor = new
|
|
531
|
+
this.setup = e, this.processor = new be(this);
|
|
568
532
|
const t = this.setup(this);
|
|
569
|
-
if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new
|
|
570
|
-
|
|
533
|
+
if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new ve(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), q(t.schemas))
|
|
534
|
+
y(
|
|
571
535
|
// @ts-expect-error
|
|
572
536
|
() => t.schemas.value,
|
|
573
537
|
() => {
|
|
@@ -577,8 +541,8 @@ class Pe {
|
|
|
577
541
|
deep: !0
|
|
578
542
|
}
|
|
579
543
|
);
|
|
580
|
-
else if (
|
|
581
|
-
const s =
|
|
544
|
+
else if (N(t.schemas)) {
|
|
545
|
+
const s = y(() => t.schemas, () => {
|
|
582
546
|
this.processor.parseSchemas(t.schemas), E(() => {
|
|
583
547
|
s();
|
|
584
548
|
});
|
|
@@ -589,7 +553,7 @@ class Pe {
|
|
|
589
553
|
this.processor.parseSchemas(t.schemas);
|
|
590
554
|
}
|
|
591
555
|
getRuntimeMeta() {
|
|
592
|
-
const e =
|
|
556
|
+
const e = R(C(this.model.value));
|
|
593
557
|
let t;
|
|
594
558
|
return {
|
|
595
559
|
model: e,
|
|
@@ -598,18 +562,18 @@ class Pe {
|
|
|
598
562
|
// share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
|
|
599
563
|
share: (s) => {
|
|
600
564
|
t && clearTimeout(t), t = setTimeout(() => {
|
|
601
|
-
if (
|
|
602
|
-
const i =
|
|
603
|
-
|
|
565
|
+
if (q(s)) {
|
|
566
|
+
const i = y(() => s.value, () => {
|
|
567
|
+
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), E(() => {
|
|
604
568
|
i();
|
|
605
569
|
});
|
|
606
570
|
}, {
|
|
607
571
|
deep: !0,
|
|
608
572
|
immediate: !0
|
|
609
573
|
});
|
|
610
|
-
} else if (
|
|
611
|
-
const i =
|
|
612
|
-
|
|
574
|
+
} else if (N(s)) {
|
|
575
|
+
const i = y(() => s, () => {
|
|
576
|
+
h(this.shared, s), this.processor.schemaEffect.triggerEffects(), E(() => {
|
|
613
577
|
i();
|
|
614
578
|
});
|
|
615
579
|
}, {
|
|
@@ -617,50 +581,50 @@ class Pe {
|
|
|
617
581
|
immediate: !0
|
|
618
582
|
});
|
|
619
583
|
} else
|
|
620
|
-
|
|
584
|
+
h(this.shared, s), this.processor.schemaEffect.triggerEffects();
|
|
621
585
|
}, 0);
|
|
622
586
|
}
|
|
623
587
|
};
|
|
624
588
|
}
|
|
625
589
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
626
|
-
var $,
|
|
627
|
-
const o =
|
|
590
|
+
var $, z, k, B, D, T, G, W, K, H, J, Q, X, Y, Z, A, ee;
|
|
591
|
+
const o = R(e.component);
|
|
628
592
|
if (!o)
|
|
629
593
|
return;
|
|
630
|
-
(
|
|
631
|
-
const n =
|
|
594
|
+
(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);
|
|
595
|
+
const n = h(C((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 = {
|
|
632
596
|
display: "grid",
|
|
633
597
|
gridColumn: "1 / -1",
|
|
634
598
|
...e.grid
|
|
635
|
-
}, c =
|
|
599
|
+
}, c = h(C((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({
|
|
636
600
|
schema: e,
|
|
637
601
|
parentSchema: i,
|
|
638
602
|
index: t
|
|
639
|
-
}),
|
|
603
|
+
}), v = o.name, F = e.componentProps ?? {}, I = P.placeholderPresetByComponentName;
|
|
640
604
|
let g = e.placeholder, b = e.show;
|
|
641
605
|
b === void 0 && (b = !0);
|
|
642
606
|
let m = e.label ?? "";
|
|
643
|
-
const
|
|
644
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(
|
|
645
|
-
let
|
|
646
|
-
l.isUndefined(
|
|
647
|
-
I[
|
|
648
|
-
|
|
649
|
-
}), g = `${
|
|
607
|
+
const j = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
608
|
+
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), "")), !g) {
|
|
609
|
+
let S = "请输入";
|
|
610
|
+
l.isUndefined(v) ? g = `${S}${m}` : /* @ts-expect-error */ I[v.toLowerCase()] ? (S = // @ts-expect-error
|
|
611
|
+
I[v.toLowerCase()], g = `${S}${m}`) : (Object.keys(I).forEach((te) => {
|
|
612
|
+
v.toLowerCase().includes(te.toLowerCase()) && (S = I[te]);
|
|
613
|
+
}), g = `${S}${m}`);
|
|
650
614
|
}
|
|
651
615
|
const re = this.runtimeAdapter.getRuntimeRequired({
|
|
652
616
|
...e,
|
|
653
617
|
label: m
|
|
654
|
-
}), ie =
|
|
618
|
+
}), ie = V.getItemContainer(this), oe = V.getFormItemContainer(this), ne = this, le = e.componentSlots;
|
|
655
619
|
return p("div", {
|
|
656
620
|
style: f
|
|
657
621
|
}, [p(ie, {
|
|
658
622
|
show: b
|
|
659
623
|
}, {
|
|
660
624
|
default() {
|
|
661
|
-
return b && p(oe,
|
|
625
|
+
return b && p(oe, O(c, {
|
|
662
626
|
label: `${m ? `${m}:` : ""}`
|
|
663
|
-
},
|
|
627
|
+
}, d, re), {
|
|
664
628
|
default() {
|
|
665
629
|
return ne.runtimeAdapter.formComponentRenderer({
|
|
666
630
|
Component: o,
|
|
@@ -682,7 +646,7 @@ class Pe {
|
|
|
682
646
|
display: "grid",
|
|
683
647
|
gridColumn: "1 / -1",
|
|
684
648
|
...e.grid
|
|
685
|
-
}, i =
|
|
649
|
+
}, i = V.getGroupContainer(this);
|
|
686
650
|
let o = e.show;
|
|
687
651
|
return o === void 0 && (o = !0), p("div", {
|
|
688
652
|
style: s
|
|
@@ -713,7 +677,7 @@ class Pe {
|
|
|
713
677
|
s.model.value[e.field] || (s.model.value[e.field] = [{}]);
|
|
714
678
|
let i = e.show;
|
|
715
679
|
i === void 0 && (i = !0);
|
|
716
|
-
const o =
|
|
680
|
+
const o = V.getListContainer(this), n = V.getListItemContainer(this);
|
|
717
681
|
return p("div", {
|
|
718
682
|
style: t
|
|
719
683
|
}, [i && p(o, {
|
|
@@ -722,14 +686,14 @@ class Pe {
|
|
|
722
686
|
default() {
|
|
723
687
|
return s.model.value[e.field].map((f, c) => p(n, null, {
|
|
724
688
|
default() {
|
|
725
|
-
return e.children.map((
|
|
689
|
+
return e.children.map((d) => s.runtimeItemProcessor(d, c, f, e));
|
|
726
690
|
},
|
|
727
691
|
delete({
|
|
728
|
-
container:
|
|
692
|
+
container: d
|
|
729
693
|
} = {}) {
|
|
730
694
|
var F;
|
|
731
|
-
const
|
|
732
|
-
return ce(p(
|
|
695
|
+
const v = d ?? p("button", null, null);
|
|
696
|
+
return ce(p(v, {
|
|
733
697
|
onClick: () => s.deleteListItem(e, c)
|
|
734
698
|
}, null), [[fe, ((F = s.model.value[e.field]) == null ? void 0 : F.length) > 1]]);
|
|
735
699
|
}
|
|
@@ -749,14 +713,14 @@ class Pe {
|
|
|
749
713
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
750
714
|
}
|
|
751
715
|
exec() {
|
|
752
|
-
var f, c,
|
|
716
|
+
var f, c, d, v;
|
|
753
717
|
const e = {
|
|
754
718
|
display: "grid",
|
|
755
719
|
gridColumn: "1 / -1",
|
|
756
720
|
gridAutoColumns: "1fr",
|
|
757
721
|
...this.grid
|
|
758
|
-
}, t = this, s =
|
|
759
|
-
return p(o,
|
|
722
|
+
}, t = this, s = h(C((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props.Form), i = h(C((v = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : v.Form) ?? {}, this.globalNativeFormOverride.slots.Form), o = V.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
723
|
+
return p(o, O(s, {
|
|
760
724
|
ref: this.formRef
|
|
761
725
|
}, {
|
|
762
726
|
[n]: this.model.value
|
|
@@ -781,7 +745,7 @@ class u {
|
|
|
781
745
|
}
|
|
782
746
|
}
|
|
783
747
|
a(u, "presets");
|
|
784
|
-
function
|
|
748
|
+
function M({
|
|
785
749
|
parentSchema: r,
|
|
786
750
|
schema: e,
|
|
787
751
|
index: t
|
|
@@ -792,7 +756,7 @@ const ge = {
|
|
|
792
756
|
ArcoVue: {
|
|
793
757
|
getRuntimeField(r) {
|
|
794
758
|
return {
|
|
795
|
-
field:
|
|
759
|
+
field: M(r)
|
|
796
760
|
};
|
|
797
761
|
},
|
|
798
762
|
getRuntimeRequired(r) {
|
|
@@ -832,7 +796,7 @@ const ge = {
|
|
|
832
796
|
componentSlots: i,
|
|
833
797
|
props: o
|
|
834
798
|
}) {
|
|
835
|
-
return p(r,
|
|
799
|
+
return p(r, O({
|
|
836
800
|
modelValue: e[t.field],
|
|
837
801
|
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
838
802
|
placeholder: s
|
|
@@ -842,7 +806,7 @@ const ge = {
|
|
|
842
806
|
},
|
|
843
807
|
validateForm(r) {
|
|
844
808
|
return new Promise((e, t) => {
|
|
845
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
809
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(R(r.runtimeCore.processor.processedModel.value))));
|
|
846
810
|
});
|
|
847
811
|
},
|
|
848
812
|
clearValidate(r) {
|
|
@@ -852,7 +816,7 @@ const ge = {
|
|
|
852
816
|
NutUI: {
|
|
853
817
|
getRuntimeField(r) {
|
|
854
818
|
return {
|
|
855
|
-
prop:
|
|
819
|
+
prop: M(r)
|
|
856
820
|
};
|
|
857
821
|
},
|
|
858
822
|
getRuntimeRequired(r) {
|
|
@@ -893,7 +857,7 @@ const ge = {
|
|
|
893
857
|
componentSlots: i,
|
|
894
858
|
props: o
|
|
895
859
|
}) {
|
|
896
|
-
return p(r,
|
|
860
|
+
return p(r, O({
|
|
897
861
|
modelValue: e[t.field],
|
|
898
862
|
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
899
863
|
placeholder: s
|
|
@@ -907,7 +871,7 @@ const ge = {
|
|
|
907
871
|
valid: s,
|
|
908
872
|
errors: i
|
|
909
873
|
}) => {
|
|
910
|
-
s ? e(r.cleanFallbackFields(
|
|
874
|
+
s ? e(r.cleanFallbackFields(R(r.runtimeCore.processor.processedModel.value))) : t(i);
|
|
911
875
|
});
|
|
912
876
|
});
|
|
913
877
|
},
|
|
@@ -918,7 +882,7 @@ const ge = {
|
|
|
918
882
|
NaiveUI: {
|
|
919
883
|
getRuntimeField(r) {
|
|
920
884
|
return {
|
|
921
|
-
path:
|
|
885
|
+
path: M(r)
|
|
922
886
|
};
|
|
923
887
|
},
|
|
924
888
|
getRuntimeRequired(r) {
|
|
@@ -961,7 +925,7 @@ const ge = {
|
|
|
961
925
|
componentSlots: i,
|
|
962
926
|
props: o
|
|
963
927
|
}) {
|
|
964
|
-
return p(r,
|
|
928
|
+
return p(r, O({
|
|
965
929
|
value: e[t.field],
|
|
966
930
|
"onUpdate:value": (n) => e[t.field] = n,
|
|
967
931
|
placeholder: s
|
|
@@ -971,14 +935,14 @@ const ge = {
|
|
|
971
935
|
},
|
|
972
936
|
validateForm(r) {
|
|
973
937
|
return new Promise((e, t) => {
|
|
974
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
938
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(R(r.runtimeCore.processor.processedModel.value))));
|
|
975
939
|
});
|
|
976
940
|
},
|
|
977
941
|
clearValidate(r) {
|
|
978
942
|
r.formRef.value.restoreValidation();
|
|
979
943
|
}
|
|
980
944
|
}
|
|
981
|
-
},
|
|
945
|
+
}, w = class w {
|
|
982
946
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
983
947
|
const e = {
|
|
984
948
|
请选择: ["select", "tree"],
|
|
@@ -991,7 +955,7 @@ const ge = {
|
|
|
991
955
|
return t;
|
|
992
956
|
}
|
|
993
957
|
};
|
|
994
|
-
a(
|
|
958
|
+
a(w, "schemaPreset", {
|
|
995
959
|
type: {
|
|
996
960
|
defaultValue: "item"
|
|
997
961
|
},
|
|
@@ -1034,15 +998,15 @@ a(V, "schemaPreset", {
|
|
|
1034
998
|
grid: {
|
|
1035
999
|
default: void 0
|
|
1036
1000
|
}
|
|
1037
|
-
}), a(
|
|
1001
|
+
}), a(w, "componentPropsPreset", {
|
|
1038
1002
|
options: {
|
|
1039
1003
|
defaultValue: []
|
|
1040
1004
|
}
|
|
1041
1005
|
}), // 基于基本功能提出基本预设
|
|
1042
|
-
a(
|
|
1043
|
-
let
|
|
1006
|
+
a(w, "placeholderPresetByComponentName", w.getPlaceholderPrefixPresetByComponentName());
|
|
1007
|
+
let _ = w;
|
|
1044
1008
|
const P = {
|
|
1045
|
-
...
|
|
1009
|
+
..._,
|
|
1046
1010
|
adapters: {
|
|
1047
1011
|
...ge
|
|
1048
1012
|
}
|
|
@@ -1058,20 +1022,18 @@ const P = {
|
|
|
1058
1022
|
return () => e.exec();
|
|
1059
1023
|
}
|
|
1060
1024
|
});
|
|
1061
|
-
function
|
|
1025
|
+
function je(r) {
|
|
1062
1026
|
const e = new me(r);
|
|
1063
1027
|
return [
|
|
1064
1028
|
e.setup.bind(e),
|
|
1065
1029
|
{
|
|
1066
1030
|
submit: e.submit.bind(e),
|
|
1067
1031
|
hydrate: e.hydrate.bind(e),
|
|
1068
|
-
share: e.share.bind(e)
|
|
1069
|
-
getReactiveModel: e.getReactiveModel.bind(e),
|
|
1070
|
-
setReactiveModel: e.setReactiveModel.bind(e)
|
|
1032
|
+
share: e.share.bind(e)
|
|
1071
1033
|
}
|
|
1072
1034
|
];
|
|
1073
1035
|
}
|
|
1074
|
-
function
|
|
1036
|
+
function Ve(r) {
|
|
1075
1037
|
u.presets = r;
|
|
1076
1038
|
}
|
|
1077
1039
|
function Ce(r, e) {
|
|
@@ -1080,17 +1042,17 @@ function Ce(r, e) {
|
|
|
1080
1042
|
writable: !0
|
|
1081
1043
|
}), r;
|
|
1082
1044
|
}
|
|
1083
|
-
function
|
|
1045
|
+
function we(r) {
|
|
1084
1046
|
return Ce(r, "native");
|
|
1085
1047
|
}
|
|
1086
|
-
function
|
|
1048
|
+
function Re(r) {
|
|
1087
1049
|
return r.__proform_raw_object = !0, r;
|
|
1088
1050
|
}
|
|
1089
1051
|
export {
|
|
1090
1052
|
Fe as ProForm,
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1053
|
+
we as markNativeFunction,
|
|
1054
|
+
Re as markNativeObject,
|
|
1055
|
+
je as useForm,
|
|
1056
|
+
Ve as useFormPresetConfigurer,
|
|
1095
1057
|
Ce as useModifiers
|
|
1096
1058
|
};
|
|
@@ -3,13 +3,10 @@ import { RuntimeCore } from "../index";
|
|
|
3
3
|
export default class FormCustomizer {
|
|
4
4
|
formCustomization: FormCustomization;
|
|
5
5
|
runtimeCore: RuntimeCore;
|
|
6
|
-
reactiveModel: AnyObject;
|
|
7
6
|
private cleanFallbackFields;
|
|
8
7
|
constructor(formCustomization: FormCustomization);
|
|
9
8
|
setup(_runtimeCore: RuntimeCore): FormCustomization;
|
|
10
9
|
submit(): Promise<AnyObject>;
|
|
11
10
|
hydrate(data: AnyObject): Promise<never> | undefined;
|
|
12
11
|
share(data: AnyObject): void;
|
|
13
|
-
getReactiveModel(): AnyObject;
|
|
14
|
-
setReactiveModel(data: AnyObject): AnyObject;
|
|
15
12
|
}
|