@harbor-design/proform 1.1.29 → 1.1.31
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 { isRef as
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var ie = (r, e, t) => e in r ? re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var a = (r, e, t) => (ie(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { isRef as _, watch as I, isReactive as k, toRaw as F, nextTick as O, ref as q, reactive as oe, createVNode as p, mergeProps as R, withDirectives as ne, vShow as le, createTextVNode as ae, isVNode as ue, defineComponent as ce } from "vue";
|
|
5
5
|
class l {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -62,6 +62,9 @@ class l {
|
|
|
62
62
|
}
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
|
+
static isNativeObject(e) {
|
|
66
|
+
return !!e.__proform_raw_object;
|
|
67
|
+
}
|
|
65
68
|
}
|
|
66
69
|
function y(r, ...e) {
|
|
67
70
|
return e.forEach((t) => {
|
|
@@ -112,7 +115,7 @@ function g(r) {
|
|
|
112
115
|
}
|
|
113
116
|
return t(r);
|
|
114
117
|
}
|
|
115
|
-
function
|
|
118
|
+
function M(r, e) {
|
|
116
119
|
return r.replace(/undefined/g, e);
|
|
117
120
|
}
|
|
118
121
|
class fe {
|
|
@@ -131,7 +134,7 @@ class fe {
|
|
|
131
134
|
}
|
|
132
135
|
submit() {
|
|
133
136
|
var s;
|
|
134
|
-
const e = (s = f.presets.uiPresets[this.runtimeCore.ui]) == null ? void 0 : s.adapter, t =
|
|
137
|
+
const e = (s = f.presets.uiPresets[this.runtimeCore.ui]) == null ? void 0 : s.adapter, t = P.adapters[this.runtimeCore.ui];
|
|
135
138
|
return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
|
|
136
139
|
}
|
|
137
140
|
hydrate(e) {
|
|
@@ -142,7 +145,7 @@ class fe {
|
|
|
142
145
|
});
|
|
143
146
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
144
147
|
() => {
|
|
145
|
-
|
|
148
|
+
_(e) ? I(
|
|
146
149
|
() => e.value,
|
|
147
150
|
() => {
|
|
148
151
|
y(this.runtimeCore.model.value, e.value);
|
|
@@ -151,7 +154,7 @@ class fe {
|
|
|
151
154
|
deep: !0,
|
|
152
155
|
immediate: !0
|
|
153
156
|
}
|
|
154
|
-
) :
|
|
157
|
+
) : k(e) ? I(
|
|
155
158
|
() => e,
|
|
156
159
|
() => {
|
|
157
160
|
y(this.runtimeCore.model.value, e);
|
|
@@ -168,7 +171,7 @@ class fe {
|
|
|
168
171
|
);
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
|
-
class
|
|
174
|
+
class U {
|
|
172
175
|
constructor() {
|
|
173
176
|
a(this, "effects", /* @__PURE__ */ new Set());
|
|
174
177
|
}
|
|
@@ -192,12 +195,12 @@ class de {
|
|
|
192
195
|
a(this, "getRuntimeMeta");
|
|
193
196
|
a(this, "stableSchemas", []);
|
|
194
197
|
a(this, "stableModel", {});
|
|
195
|
-
a(this, "schemaPreset",
|
|
196
|
-
a(this, "componentPropsPreset",
|
|
198
|
+
a(this, "schemaPreset", P.schemaPreset);
|
|
199
|
+
a(this, "componentPropsPreset", P.componentPropsPreset);
|
|
197
200
|
a(this, "stableUpdaterProcessProgress");
|
|
198
201
|
a(this, "stableUpdaterTimes", 0);
|
|
199
|
-
a(this, "schemaEffect", new
|
|
200
|
-
a(this, "defaultValueEffect", new
|
|
202
|
+
a(this, "schemaEffect", new U());
|
|
203
|
+
a(this, "defaultValueEffect", new U());
|
|
201
204
|
a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
202
205
|
a(this, "baseDefaultValueFunctionsLength");
|
|
203
206
|
a(this, "isModelInitialized", !0);
|
|
@@ -253,7 +256,7 @@ class de {
|
|
|
253
256
|
// 对于稳定初始化更新的抽象
|
|
254
257
|
stableUpdater(e = []) {
|
|
255
258
|
if (e.every(Boolean)) {
|
|
256
|
-
const t =
|
|
259
|
+
const t = F(this.processedSchemas.value);
|
|
257
260
|
!l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
258
261
|
length: t.length
|
|
259
262
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
|
|
@@ -266,12 +269,12 @@ class de {
|
|
|
266
269
|
}).fill(!1);
|
|
267
270
|
this.objectParser({ data: e, index: t, updater: n });
|
|
268
271
|
function n(c) {
|
|
269
|
-
const u = c.index, d = c.key,
|
|
272
|
+
const u = c.index, d = c.key, b = c.keyIndex;
|
|
270
273
|
if (l.isUndefined(c.stable))
|
|
271
274
|
return;
|
|
272
275
|
const V = i.parseStable(c.stable), C = s == null ? void 0 : s.index, v = s == null ? void 0 : s.key;
|
|
273
276
|
let m = V;
|
|
274
|
-
if (l.isProcessInprogress(m) || (o[
|
|
277
|
+
if (l.isProcessInprogress(m) || (o[b] = !0), s) {
|
|
275
278
|
const h = i.processedSchemas.value[C][v][u][d];
|
|
276
279
|
h && l.isObject(h) && d !== "component" && (m = y(h, m)), i.processedSchemas.value[C][v][u][d] = m, i.stableUpdater(o);
|
|
277
280
|
} else {
|
|
@@ -318,13 +321,13 @@ class de {
|
|
|
318
321
|
return n(u);
|
|
319
322
|
this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
320
323
|
this.defaultValueInprogressMap.values()
|
|
321
|
-
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(),
|
|
324
|
+
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
|
|
322
325
|
c();
|
|
323
326
|
})) : n(u);
|
|
324
327
|
}) : this.fieldParser(t[i], (u) => {
|
|
325
328
|
this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
326
329
|
this.defaultValueInprogressMap.values()
|
|
327
|
-
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(),
|
|
330
|
+
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
|
|
328
331
|
c();
|
|
329
332
|
})) : n(u);
|
|
330
333
|
});
|
|
@@ -339,11 +342,11 @@ class de {
|
|
|
339
342
|
}
|
|
340
343
|
promiseFieldParser(e, t, s) {
|
|
341
344
|
l.isPromise(e) ? e.then((i) => {
|
|
342
|
-
l.isString(i) && (i =
|
|
345
|
+
l.isString(i) && (i = M(i, "")), s && l.isObject(i) && !l.isNativeObject(i) ? this.objectParser({
|
|
343
346
|
data: i,
|
|
344
347
|
updater: t
|
|
345
348
|
}) : t(i);
|
|
346
|
-
}) : (l.isString(e) && (e =
|
|
349
|
+
}) : (l.isString(e) && (e = M(e, "")), s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
347
350
|
data: e,
|
|
348
351
|
updater: t
|
|
349
352
|
}) : t(e));
|
|
@@ -363,10 +366,10 @@ class de {
|
|
|
363
366
|
this.promiseFieldParser(i, t, s);
|
|
364
367
|
}
|
|
365
368
|
else
|
|
366
|
-
|
|
369
|
+
_(e) ? I(
|
|
367
370
|
() => e.value,
|
|
368
371
|
() => {
|
|
369
|
-
l.isUndefined(e.value) || (s && l.isObject(e.value) ? this.objectParser({
|
|
372
|
+
l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
|
|
370
373
|
data: e.value,
|
|
371
374
|
updater: t
|
|
372
375
|
}) : t(e.value));
|
|
@@ -375,10 +378,10 @@ class de {
|
|
|
375
378
|
immediate: !0,
|
|
376
379
|
deep: !0
|
|
377
380
|
}
|
|
378
|
-
) :
|
|
381
|
+
) : k(e) ? I(
|
|
379
382
|
() => e,
|
|
380
383
|
() => {
|
|
381
|
-
l.isUndefined(e) || (s && l.isObject(e) ? this.objectParser({
|
|
384
|
+
l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
382
385
|
data: e,
|
|
383
386
|
updater: t
|
|
384
387
|
}) : t(e));
|
|
@@ -387,7 +390,7 @@ class de {
|
|
|
387
390
|
immediate: !0,
|
|
388
391
|
deep: !0
|
|
389
392
|
}
|
|
390
|
-
) : s && l.isObject(e) ? this.objectParser({
|
|
393
|
+
) : s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
391
394
|
data: e,
|
|
392
395
|
updater: t
|
|
393
396
|
}) : t(e);
|
|
@@ -405,7 +408,7 @@ class de {
|
|
|
405
408
|
}), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
|
|
406
409
|
}
|
|
407
410
|
}
|
|
408
|
-
class
|
|
411
|
+
class w {
|
|
409
412
|
static getFormContainer({ ui: e } = {}) {
|
|
410
413
|
return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
|
|
411
414
|
}
|
|
@@ -431,27 +434,27 @@ class pe {
|
|
|
431
434
|
}
|
|
432
435
|
getRuntimeField(e) {
|
|
433
436
|
var i;
|
|
434
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
437
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
|
|
435
438
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
436
439
|
}
|
|
437
440
|
getRuntimeRequired(e) {
|
|
438
441
|
var i;
|
|
439
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
442
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
|
|
440
443
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
441
444
|
}
|
|
442
445
|
getFormModelPropName() {
|
|
443
446
|
var s;
|
|
444
|
-
const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t =
|
|
447
|
+
const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = P.adapters[this.ui];
|
|
445
448
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
446
449
|
}
|
|
447
450
|
formComponentRenderer(e) {
|
|
448
451
|
var i;
|
|
449
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
452
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
|
|
450
453
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
451
454
|
}
|
|
452
455
|
clearValidate(e) {
|
|
453
456
|
var i;
|
|
454
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
457
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
|
|
455
458
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
456
459
|
}
|
|
457
460
|
}
|
|
@@ -460,16 +463,16 @@ function he(r) {
|
|
|
460
463
|
}
|
|
461
464
|
class me {
|
|
462
465
|
constructor(e) {
|
|
463
|
-
a(this, "schemas",
|
|
464
|
-
a(this, "model",
|
|
466
|
+
a(this, "schemas", q([]));
|
|
467
|
+
a(this, "model", q({}));
|
|
465
468
|
a(this, "processorBySchemaType", {
|
|
466
469
|
item: this.runtimeItemProcessor.bind(this),
|
|
467
470
|
group: this.runtimeGroupProcessor.bind(this),
|
|
468
471
|
list: this.runtimeListProcessor.bind(this)
|
|
469
472
|
});
|
|
470
|
-
a(this, "formRef",
|
|
471
|
-
a(this, "hydrateEffect", new
|
|
472
|
-
a(this, "native",
|
|
473
|
+
a(this, "formRef", q(null));
|
|
474
|
+
a(this, "hydrateEffect", new U());
|
|
475
|
+
a(this, "native", oe({}));
|
|
473
476
|
a(this, "grid", {});
|
|
474
477
|
a(this, "runtime", {});
|
|
475
478
|
a(this, "globalNativeFormOverride", {
|
|
@@ -478,17 +481,17 @@ class me {
|
|
|
478
481
|
});
|
|
479
482
|
this.setup = e, this.processor = new de(this);
|
|
480
483
|
const t = this.setup(this);
|
|
481
|
-
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui),
|
|
484
|
+
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), _(t.schemas)) {
|
|
482
485
|
const s = I(() => t.schemas, () => {
|
|
483
|
-
this.processor.parseSchemas(t.schemas.value),
|
|
486
|
+
this.processor.parseSchemas(t.schemas.value), O(() => {
|
|
484
487
|
s();
|
|
485
488
|
});
|
|
486
489
|
}, {
|
|
487
490
|
deep: !0
|
|
488
491
|
});
|
|
489
|
-
} else if (
|
|
492
|
+
} else if (k(t.schemas)) {
|
|
490
493
|
const s = I(() => t.schemas, () => {
|
|
491
|
-
this.processor.parseSchemas(t.schemas),
|
|
494
|
+
this.processor.parseSchemas(t.schemas), O(() => {
|
|
492
495
|
s();
|
|
493
496
|
});
|
|
494
497
|
}, {
|
|
@@ -499,61 +502,61 @@ class me {
|
|
|
499
502
|
}
|
|
500
503
|
getRuntimeMeta() {
|
|
501
504
|
return {
|
|
502
|
-
model:
|
|
505
|
+
model: F(g(this.model.value)),
|
|
503
506
|
reactiveModel: this.model.value
|
|
504
507
|
};
|
|
505
508
|
}
|
|
506
509
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
507
|
-
var
|
|
508
|
-
const o =
|
|
510
|
+
var x, z, $, B, D, G, T, K, W, H, J, Q, X;
|
|
511
|
+
const o = F(e.component);
|
|
509
512
|
if (!o)
|
|
510
513
|
return;
|
|
511
|
-
y(this.globalNativeFormOverride.props, (
|
|
512
|
-
const n = y(g((
|
|
514
|
+
y(this.globalNativeFormOverride.props, (z = (x = e.native) == null ? void 0 : x.props) == null ? void 0 : z.Form), y(this.globalNativeFormOverride.slots, (B = ($ = e.native) == null ? void 0 : $.slots) == null ? void 0 : B.Form);
|
|
515
|
+
const n = y(g((G = (D = this.native) == null ? void 0 : D.slots) == null ? void 0 : G.FormItem) ?? {}, (K = (T = e.native) == null ? void 0 : T.slots) == null ? void 0 : K.FormItem), c = {
|
|
513
516
|
display: "grid",
|
|
514
517
|
gridColumn: "1 / -1",
|
|
515
518
|
...e.grid
|
|
516
|
-
}, u = y(g((
|
|
519
|
+
}, u = y(g((H = (W = this.native) == null ? void 0 : W.props) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.props) == null ? void 0 : Q.FormItem), d = this.runtimeAdapter.getRuntimeField({
|
|
517
520
|
schema: e,
|
|
518
521
|
parentSchema: i,
|
|
519
522
|
index: t
|
|
520
|
-
}),
|
|
523
|
+
}), b = o.name, V = e.componentProps ?? {}, C = P.placeholderPresetByComponentName;
|
|
521
524
|
let v = e.placeholder, m = e.show;
|
|
522
525
|
m === void 0 && (m = !0), m || delete s[e.field];
|
|
523
526
|
let h = e.label ?? "";
|
|
524
|
-
const
|
|
525
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(
|
|
527
|
+
const j = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
528
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(j) && (h = M((X = j == null ? void 0 : j.customizeItemLabel) == null ? void 0 : X.call(j, e.label ?? "", t + 1), "")), !v) {
|
|
526
529
|
let E = "请输入";
|
|
527
|
-
l.isUndefined(
|
|
528
|
-
C[
|
|
529
|
-
|
|
530
|
+
l.isUndefined(b) ? v = `${E}${h}` : /* @ts-expect-error */ C[b.toLowerCase()] ? (E = // @ts-expect-error
|
|
531
|
+
C[b.toLowerCase()], v = `${E}${h}`) : (Object.keys(C).forEach((Y) => {
|
|
532
|
+
b.toLowerCase().includes(Y.toLowerCase()) && (E = C[Y]);
|
|
530
533
|
}), v = `${E}${h}`);
|
|
531
534
|
}
|
|
532
|
-
const
|
|
535
|
+
const Z = this.runtimeAdapter.getRuntimeRequired({
|
|
533
536
|
...e,
|
|
534
537
|
label: h
|
|
535
|
-
}),
|
|
538
|
+
}), A = w.getItemContainer(this), ee = w.getFormItemContainer(this), te = this, se = e.componentSlots;
|
|
536
539
|
return p("div", {
|
|
537
540
|
style: c
|
|
538
|
-
}, [p(
|
|
541
|
+
}, [p(A, {
|
|
539
542
|
show: m
|
|
540
543
|
}, {
|
|
541
544
|
default() {
|
|
542
|
-
return
|
|
545
|
+
return m && p(ee, R(u, {
|
|
543
546
|
label: `${h ? `${h}:` : ""}`
|
|
544
|
-
}, d,
|
|
547
|
+
}, d, Z), {
|
|
545
548
|
default() {
|
|
546
|
-
return
|
|
549
|
+
return te.runtimeAdapter.formComponentRenderer({
|
|
547
550
|
Component: o,
|
|
548
551
|
schema: e,
|
|
549
552
|
baseModel: s,
|
|
550
553
|
placeholder: v,
|
|
551
|
-
componentSlots:
|
|
554
|
+
componentSlots: se,
|
|
552
555
|
props: V
|
|
553
556
|
});
|
|
554
557
|
},
|
|
555
558
|
...n
|
|
556
|
-
})
|
|
559
|
+
});
|
|
557
560
|
}
|
|
558
561
|
})]);
|
|
559
562
|
}
|
|
@@ -563,15 +566,15 @@ class me {
|
|
|
563
566
|
display: "grid",
|
|
564
567
|
gridColumn: "1 / -1",
|
|
565
568
|
...e.grid
|
|
566
|
-
}, i =
|
|
569
|
+
}, i = w.getGroupContainer(this);
|
|
567
570
|
let o = e.show;
|
|
568
571
|
return o === void 0 && (o = !0), p("div", {
|
|
569
572
|
style: s
|
|
570
|
-
}, [
|
|
573
|
+
}, [o && p(i, {
|
|
571
574
|
schema: e
|
|
572
575
|
}, he(t = e.children.map((n) => this.runtimeItemProcessor(n))) ? t : {
|
|
573
576
|
default: () => [t]
|
|
574
|
-
})
|
|
577
|
+
})]);
|
|
575
578
|
}
|
|
576
579
|
addListItem(e) {
|
|
577
580
|
var t, s;
|
|
@@ -594,10 +597,10 @@ class me {
|
|
|
594
597
|
s.model.value[e.field] || (s.model.value[e.field] = [{}]);
|
|
595
598
|
let i = e.show;
|
|
596
599
|
i === void 0 && (i = !0);
|
|
597
|
-
const o =
|
|
600
|
+
const o = w.getListContainer(this), n = w.getListItemContainer(this);
|
|
598
601
|
return p("div", {
|
|
599
602
|
style: t
|
|
600
|
-
}, [
|
|
603
|
+
}, [i && p(o, {
|
|
601
604
|
schema: e
|
|
602
605
|
}, {
|
|
603
606
|
default() {
|
|
@@ -609,10 +612,10 @@ class me {
|
|
|
609
612
|
container: d
|
|
610
613
|
} = {}) {
|
|
611
614
|
var V;
|
|
612
|
-
const
|
|
613
|
-
return
|
|
615
|
+
const b = d ?? p("button", null, null);
|
|
616
|
+
return ne(p(b, {
|
|
614
617
|
onClick: () => s.deleteListItem(e, u)
|
|
615
|
-
}, null), [[
|
|
618
|
+
}, null), [[le, ((V = s.model.value[e.field]) == null ? void 0 : V.length) > 1]]);
|
|
616
619
|
}
|
|
617
620
|
}));
|
|
618
621
|
},
|
|
@@ -624,19 +627,19 @@ class me {
|
|
|
624
627
|
onClick: () => s.addListItem(e)
|
|
625
628
|
}, null);
|
|
626
629
|
}
|
|
627
|
-
})
|
|
630
|
+
})]);
|
|
628
631
|
}
|
|
629
632
|
runtimeProcessor(e) {
|
|
630
633
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
631
634
|
}
|
|
632
635
|
exec() {
|
|
633
|
-
var c, u, d,
|
|
636
|
+
var c, u, d, b;
|
|
634
637
|
const e = {
|
|
635
638
|
display: "grid",
|
|
636
639
|
gridColumn: "1 / -1",
|
|
637
640
|
gridAutoColumns: "1fr",
|
|
638
641
|
...this.grid
|
|
639
|
-
}, t = this, s = y(g((u = (c = this.native) == null ? void 0 : c.props) == null ? void 0 : u.Form) ?? {}, this.globalNativeFormOverride.props), i = y(g((
|
|
642
|
+
}, t = this, s = y(g((u = (c = this.native) == null ? void 0 : c.props) == null ? void 0 : u.Form) ?? {}, this.globalNativeFormOverride.props), i = y(g((b = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : b.Form) ?? {}, this.globalNativeFormOverride.slots), o = w.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
640
643
|
return p(o, R(s, {
|
|
641
644
|
ref: this.formRef
|
|
642
645
|
}, {
|
|
@@ -709,7 +712,7 @@ const ye = {
|
|
|
709
712
|
},
|
|
710
713
|
validateForm(r) {
|
|
711
714
|
return new Promise((e, t) => {
|
|
712
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
715
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(F(r.runtimeCore.processor.processedModel.value))));
|
|
713
716
|
});
|
|
714
717
|
},
|
|
715
718
|
clearValidate(r) {
|
|
@@ -768,7 +771,7 @@ const ye = {
|
|
|
768
771
|
valid: s,
|
|
769
772
|
errors: i
|
|
770
773
|
}) => {
|
|
771
|
-
s ? e(r.cleanFallbackFields(
|
|
774
|
+
s ? e(r.cleanFallbackFields(F(r.runtimeCore.processor.processedModel.value))) : t(i);
|
|
772
775
|
});
|
|
773
776
|
});
|
|
774
777
|
},
|
|
@@ -824,14 +827,14 @@ const ye = {
|
|
|
824
827
|
},
|
|
825
828
|
validateForm(r) {
|
|
826
829
|
return new Promise((e, t) => {
|
|
827
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
830
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(F(r.runtimeCore.processor.processedModel.value))));
|
|
828
831
|
});
|
|
829
832
|
},
|
|
830
833
|
clearValidate(r) {
|
|
831
834
|
r.formRef.value.restoreValidation();
|
|
832
835
|
}
|
|
833
836
|
}
|
|
834
|
-
},
|
|
837
|
+
}, S = class S {
|
|
835
838
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
836
839
|
const e = {
|
|
837
840
|
请选择: ["select", "tree"],
|
|
@@ -844,7 +847,7 @@ const ye = {
|
|
|
844
847
|
return t;
|
|
845
848
|
}
|
|
846
849
|
};
|
|
847
|
-
a(
|
|
850
|
+
a(S, "schemaPreset", {
|
|
848
851
|
type: {
|
|
849
852
|
defaultValue: "item"
|
|
850
853
|
},
|
|
@@ -887,15 +890,15 @@ a(j, "schemaPreset", {
|
|
|
887
890
|
grid: {
|
|
888
891
|
default: void 0
|
|
889
892
|
}
|
|
890
|
-
}), a(
|
|
893
|
+
}), a(S, "componentPropsPreset", {
|
|
891
894
|
options: {
|
|
892
895
|
defaultValue: []
|
|
893
896
|
}
|
|
894
897
|
}), // 基于基本功能提出基本预设
|
|
895
|
-
a(
|
|
896
|
-
let
|
|
897
|
-
const
|
|
898
|
-
...
|
|
898
|
+
a(S, "placeholderPresetByComponentName", S.getPlaceholderPrefixPresetByComponentName());
|
|
899
|
+
let L = S;
|
|
900
|
+
const P = {
|
|
901
|
+
...L,
|
|
899
902
|
adapters: {
|
|
900
903
|
...ye
|
|
901
904
|
}
|
|
@@ -924,19 +927,23 @@ function Ce(r) {
|
|
|
924
927
|
function Ie(r) {
|
|
925
928
|
f.presets = r;
|
|
926
929
|
}
|
|
927
|
-
function
|
|
930
|
+
function be(r, e) {
|
|
928
931
|
return e === "native" && Object.defineProperty(r, "name", {
|
|
929
932
|
value: `__proform_raw_${r.name}`,
|
|
930
933
|
writable: !0
|
|
931
934
|
}), r;
|
|
932
935
|
}
|
|
933
936
|
function Ve(r) {
|
|
934
|
-
return
|
|
937
|
+
return be(r, "native");
|
|
938
|
+
}
|
|
939
|
+
function je(r) {
|
|
940
|
+
return r.__proform_raw_object = !0, r;
|
|
935
941
|
}
|
|
936
942
|
export {
|
|
937
943
|
ge as ProForm,
|
|
938
944
|
Ve as markNativeFunction,
|
|
945
|
+
je as markNativeObject,
|
|
939
946
|
Ce as useForm,
|
|
940
947
|
Ie as useFormPresetConfigurer,
|
|
941
|
-
|
|
948
|
+
be as useModifiers
|
|
942
949
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as ProForm } from "./src/form/index";
|
|
2
2
|
export { useForm } from "./src/interactions/useForm";
|
|
3
3
|
export { useFormPresetConfigurer } from "./src/interactions/useFormPresetConfigurer";
|
|
4
|
-
export { useModifiers } from "./src/interactions/useModifiers";
|
|
5
|
-
export { markNativeFunction } from "./src/interactions/useModifiers";
|
|
4
|
+
export { useModifiers, markNativeFunction, markNativeObject, } from "./src/interactions/useModifiers";
|
|
6
5
|
export * from "./src/types/index";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { runtimeMeta } from "../types";
|
|
1
|
+
import { AnyObject, runtimeMeta } from "../types";
|
|
2
2
|
type Modifier = "native";
|
|
3
3
|
type FunctionNative = (args: {
|
|
4
4
|
rawArgs: any[];
|
|
5
5
|
} & runtimeMeta) => any;
|
|
6
6
|
export declare function useModifiers(functionNative: FunctionNative, modifier: Modifier): FunctionNative;
|
|
7
7
|
export declare function markNativeFunction(functionNative: FunctionNative): FunctionNative;
|
|
8
|
+
export declare function markNativeObject(objectNative: AnyObject): AnyObject;
|
|
8
9
|
export {};
|