@harbor-design/proform 1.1.20 → 1.1.22
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 x, watch as I, isReactive as
|
|
1
|
+
var oe = Object.defineProperty;
|
|
2
|
+
var ne = (r, e, t) => e in r ? oe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var a = (r, e, t) => (ne(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { isRef as x, watch as I, isReactive as k, toRaw as j, nextTick as w, ref as q, reactive as le, createVNode as p, withDirectives as Z, mergeProps as R, vShow as A, 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);
|
|
@@ -112,7 +112,7 @@ function g(r) {
|
|
|
112
112
|
}
|
|
113
113
|
return t(r);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function U(r, e) {
|
|
116
116
|
return r.replace(/undefined/g, e);
|
|
117
117
|
}
|
|
118
118
|
class fe {
|
|
@@ -131,7 +131,7 @@ class fe {
|
|
|
131
131
|
}
|
|
132
132
|
submit() {
|
|
133
133
|
var s;
|
|
134
|
-
const e = (s =
|
|
134
|
+
const e = (s = f.presets.uiPresets[this.runtimeCore.ui]) == null ? void 0 : s.adapter, t = b.adapters[this.runtimeCore.ui];
|
|
135
135
|
return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
|
|
136
136
|
}
|
|
137
137
|
hydrate(e) {
|
|
@@ -151,7 +151,7 @@ class fe {
|
|
|
151
151
|
deep: !0,
|
|
152
152
|
immediate: !0
|
|
153
153
|
}
|
|
154
|
-
) :
|
|
154
|
+
) : k(e) ? I(
|
|
155
155
|
() => e,
|
|
156
156
|
() => {
|
|
157
157
|
m(this.runtimeCore.model.value, e);
|
|
@@ -168,7 +168,7 @@ class fe {
|
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
class
|
|
171
|
+
class N {
|
|
172
172
|
constructor() {
|
|
173
173
|
a(this, "effects", /* @__PURE__ */ new Set());
|
|
174
174
|
}
|
|
@@ -184,7 +184,7 @@ class U {
|
|
|
184
184
|
return !t.lazy && e(), this.effects.add(e), () => this.effects.delete(e);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
class
|
|
187
|
+
class de {
|
|
188
188
|
constructor(e) {
|
|
189
189
|
a(this, "runtimeCore");
|
|
190
190
|
a(this, "processedSchemas");
|
|
@@ -196,8 +196,8 @@ class ce {
|
|
|
196
196
|
a(this, "componentPropsPreset", b.componentPropsPreset);
|
|
197
197
|
a(this, "stableUpdaterProcessProgress");
|
|
198
198
|
a(this, "stableUpdaterTimes", 0);
|
|
199
|
-
a(this, "schemaEffect", new
|
|
200
|
-
a(this, "defaultValueEffect", new
|
|
199
|
+
a(this, "schemaEffect", new N());
|
|
200
|
+
a(this, "defaultValueEffect", new N());
|
|
201
201
|
a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
202
202
|
a(this, "baseDefaultValueFunctionsLength");
|
|
203
203
|
a(this, "isModelInitialized", !0);
|
|
@@ -252,7 +252,7 @@ class ce {
|
|
|
252
252
|
// 对于稳定初始化更新的抽象
|
|
253
253
|
stableUpdater(e = []) {
|
|
254
254
|
if (e.every(Boolean)) {
|
|
255
|
-
const t =
|
|
255
|
+
const t = j(this.processedSchemas.value);
|
|
256
256
|
!l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
257
257
|
length: t.length
|
|
258
258
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
|
|
@@ -265,17 +265,17 @@ class ce {
|
|
|
265
265
|
}).fill(!1);
|
|
266
266
|
this.objectParser({ data: e, index: t, updater: n });
|
|
267
267
|
function n(u) {
|
|
268
|
-
const
|
|
268
|
+
const c = u.index, d = u.key, y = u.keyIndex;
|
|
269
269
|
if (l.isUndefined(u.stable))
|
|
270
270
|
return;
|
|
271
271
|
const O = i.parseStable(u.stable), C = s == null ? void 0 : s.index, v = s == null ? void 0 : s.key;
|
|
272
272
|
let P = O;
|
|
273
273
|
if (l.isProcessInprogress(P) || (o[y] = !0), s) {
|
|
274
|
-
let h = i.processedSchemas.value[C][v][
|
|
275
|
-
h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[C][v][
|
|
274
|
+
let h = i.processedSchemas.value[C][v][c][d];
|
|
275
|
+
h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[C][v][c][d] = P, i.stableUpdater(o);
|
|
276
276
|
} else {
|
|
277
|
-
let h = i.processedSchemas.value[
|
|
278
|
-
h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[
|
|
277
|
+
let h = i.processedSchemas.value[c][d];
|
|
278
|
+
h && l.isObject(h) && d !== "component" && (P = m(h, P)), i.processedSchemas.value[c][d] = P, i.stableUpdater(o);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -307,20 +307,20 @@ class ce {
|
|
|
307
307
|
}) : this.defaultValueEffect.trackEffect(
|
|
308
308
|
() => {
|
|
309
309
|
const u = this.schemaEffect.trackEffect(() => {
|
|
310
|
-
/\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (
|
|
311
|
-
if (!
|
|
312
|
-
return n(
|
|
313
|
-
this.defaultValueInprogressMap.set(t[i],
|
|
310
|
+
/\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (c) => {
|
|
311
|
+
if (!c)
|
|
312
|
+
return n(c);
|
|
313
|
+
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
314
314
|
this.defaultValueInprogressMap.values()
|
|
315
|
-
).every((d) => !d.includes("undefined")) ? (n(
|
|
315
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), w(() => {
|
|
316
316
|
u();
|
|
317
|
-
})) : n(
|
|
318
|
-
}) : this.fieldParser(t[i], (
|
|
319
|
-
this.defaultValueInprogressMap.set(t[i],
|
|
317
|
+
})) : n(c);
|
|
318
|
+
}) : this.fieldParser(t[i], (c) => {
|
|
319
|
+
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
320
320
|
this.defaultValueInprogressMap.values()
|
|
321
|
-
).every((d) => !d.includes("undefined")) ? (n(
|
|
321
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), w(() => {
|
|
322
322
|
u();
|
|
323
|
-
})) : n(
|
|
323
|
+
})) : n(c);
|
|
324
324
|
});
|
|
325
325
|
});
|
|
326
326
|
},
|
|
@@ -333,11 +333,11 @@ class ce {
|
|
|
333
333
|
}
|
|
334
334
|
promiseFieldParser(e, t, s) {
|
|
335
335
|
l.isPromise(e) ? e.then((i) => {
|
|
336
|
-
l.isString(i) && (i =
|
|
336
|
+
l.isString(i) && (i = U(i, "")), s && l.isObject(i) ? this.objectParser({
|
|
337
337
|
data: i,
|
|
338
338
|
updater: t
|
|
339
339
|
}) : t(i);
|
|
340
|
-
}) : (l.isString(e) && (e =
|
|
340
|
+
}) : (l.isString(e) && (e = U(e, "")), s && l.isObject(e) ? this.objectParser({
|
|
341
341
|
data: e,
|
|
342
342
|
updater: t
|
|
343
343
|
}) : t(e));
|
|
@@ -369,7 +369,7 @@ class ce {
|
|
|
369
369
|
immediate: !0,
|
|
370
370
|
deep: !0
|
|
371
371
|
}
|
|
372
|
-
) :
|
|
372
|
+
) : k(e) ? I(
|
|
373
373
|
() => e,
|
|
374
374
|
() => {
|
|
375
375
|
l.isUndefined(e) || (s && l.isObject(e) ? this.objectParser({
|
|
@@ -401,58 +401,58 @@ class ce {
|
|
|
401
401
|
}
|
|
402
402
|
class F {
|
|
403
403
|
static getFormContainer({ ui: e } = {}) {
|
|
404
|
-
return
|
|
404
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
|
|
405
405
|
}
|
|
406
406
|
static getFormItemContainer({ ui: e } = {}) {
|
|
407
|
-
return
|
|
407
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.FormItem;
|
|
408
408
|
}
|
|
409
409
|
static getItemContainer({ ui: e } = {}) {
|
|
410
|
-
return
|
|
410
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.Item;
|
|
411
411
|
}
|
|
412
412
|
static getGroupContainer({ ui: e } = {}) {
|
|
413
|
-
return
|
|
413
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.Group;
|
|
414
414
|
}
|
|
415
415
|
static getListContainer({ ui: e } = {}) {
|
|
416
|
-
return
|
|
416
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.List;
|
|
417
417
|
}
|
|
418
418
|
static getListItemContainer({ ui: e } = {}) {
|
|
419
|
-
return
|
|
419
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.ListItem;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
class
|
|
422
|
+
class pe {
|
|
423
423
|
constructor(e) {
|
|
424
424
|
this.ui = e;
|
|
425
425
|
}
|
|
426
426
|
getRuntimeField(e) {
|
|
427
427
|
var i;
|
|
428
|
-
const t = (i =
|
|
428
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
|
|
429
429
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
430
430
|
}
|
|
431
431
|
getRuntimeRequired(e) {
|
|
432
432
|
var i;
|
|
433
|
-
const t = (i =
|
|
433
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
|
|
434
434
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
435
435
|
}
|
|
436
436
|
getFormModelPropName() {
|
|
437
437
|
var s;
|
|
438
|
-
const e = (s =
|
|
438
|
+
const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = b.adapters[this.ui];
|
|
439
439
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
440
440
|
}
|
|
441
441
|
formComponentRenderer(e) {
|
|
442
442
|
var i;
|
|
443
|
-
const t = (i =
|
|
443
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
|
|
444
444
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
445
445
|
}
|
|
446
446
|
clearValidate(e) {
|
|
447
447
|
var i;
|
|
448
|
-
const t = (i =
|
|
448
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
|
|
449
449
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
function
|
|
453
|
-
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !
|
|
452
|
+
function he(r) {
|
|
453
|
+
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !ue(r);
|
|
454
454
|
}
|
|
455
|
-
class
|
|
455
|
+
class me {
|
|
456
456
|
constructor(e) {
|
|
457
457
|
a(this, "schemas", q([]));
|
|
458
458
|
a(this, "model", q({}));
|
|
@@ -462,17 +462,17 @@ class he {
|
|
|
462
462
|
list: this.runtimeListProcessor.bind(this)
|
|
463
463
|
});
|
|
464
464
|
a(this, "formRef", q(null));
|
|
465
|
-
a(this, "hydrateEffect", new
|
|
466
|
-
a(this, "native",
|
|
465
|
+
a(this, "hydrateEffect", new N());
|
|
466
|
+
a(this, "native", le({}));
|
|
467
467
|
a(this, "grid", {});
|
|
468
468
|
a(this, "runtime", {});
|
|
469
469
|
a(this, "globalNativeFormOverride", {
|
|
470
470
|
props: {},
|
|
471
471
|
slots: {}
|
|
472
472
|
});
|
|
473
|
-
this.setup = e, this.processor = new
|
|
473
|
+
this.setup = e, this.processor = new de(this);
|
|
474
474
|
const t = this.setup(this);
|
|
475
|
-
if (this.ui = t.ui ??
|
|
475
|
+
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), x(t.schemas)) {
|
|
476
476
|
const s = I(() => t.schemas, () => {
|
|
477
477
|
this.processor.parseSchemas(t.schemas.value), w(() => {
|
|
478
478
|
s();
|
|
@@ -480,7 +480,7 @@ class he {
|
|
|
480
480
|
}, {
|
|
481
481
|
deep: !0
|
|
482
482
|
});
|
|
483
|
-
} else if (
|
|
483
|
+
} else if (k(t.schemas)) {
|
|
484
484
|
const s = I(() => t.schemas, () => {
|
|
485
485
|
this.processor.parseSchemas(t.schemas), w(() => {
|
|
486
486
|
s();
|
|
@@ -493,21 +493,21 @@ class he {
|
|
|
493
493
|
}
|
|
494
494
|
getRuntimeMeta() {
|
|
495
495
|
return {
|
|
496
|
-
model:
|
|
496
|
+
model: j(g(this.model.value)),
|
|
497
497
|
reactiveModel: this.model.value
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
500
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
501
|
-
var
|
|
502
|
-
const o =
|
|
501
|
+
var z, $, _, B, D, G, T, K, W, H, J, Q, X;
|
|
502
|
+
const o = j(e.component);
|
|
503
503
|
if (!o)
|
|
504
504
|
return;
|
|
505
|
-
m(this.globalNativeFormOverride.props, ($ = (
|
|
505
|
+
m(this.globalNativeFormOverride.props, ($ = (z = e.native) == null ? void 0 : z.props) == null ? void 0 : $.Form), m(this.globalNativeFormOverride.slots, (B = (_ = e.native) == null ? void 0 : _.slots) == null ? void 0 : B.Form);
|
|
506
506
|
const n = m(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), u = {
|
|
507
507
|
display: "grid",
|
|
508
508
|
gridColumn: "1 / -1",
|
|
509
509
|
...e.grid
|
|
510
|
-
},
|
|
510
|
+
}, c = m(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({
|
|
511
511
|
schema: e,
|
|
512
512
|
parentSchema: i,
|
|
513
513
|
index: t
|
|
@@ -516,22 +516,22 @@ class he {
|
|
|
516
516
|
P === void 0 && (P = !0), P || delete s[e.field];
|
|
517
517
|
let h = e.label;
|
|
518
518
|
const V = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
519
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (h =
|
|
520
|
-
let
|
|
521
|
-
l.isUndefined(y) ? v = `${
|
|
522
|
-
C[y.toLowerCase()], v = `${
|
|
523
|
-
y.toLowerCase().includes(Y.toLowerCase()) && (
|
|
524
|
-
}), v = `${
|
|
519
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (h = U((X = V == null ? void 0 : V.customizeItemLabel) == null ? void 0 : X.call(V, e.label ?? "", t + 1), "")), !v) {
|
|
520
|
+
let E = "请输入";
|
|
521
|
+
l.isUndefined(y) ? v = `${E}${h}` : /* @ts-expect-error */ C[y.toLowerCase()] ? (E = // @ts-expect-error
|
|
522
|
+
C[y.toLowerCase()], v = `${E}${h}`) : (Object.keys(C).forEach((Y) => {
|
|
523
|
+
y.toLowerCase().includes(Y.toLowerCase()) && (E = C[Y]);
|
|
524
|
+
}), v = `${E}${h}`);
|
|
525
525
|
}
|
|
526
526
|
const ee = this.runtimeAdapter.getRuntimeRequired({
|
|
527
527
|
...e,
|
|
528
528
|
label: h
|
|
529
|
-
}), te = F.getItemContainer(this), se = F.getFormItemContainer(this), re = this;
|
|
529
|
+
}), te = F.getItemContainer(this), se = F.getFormItemContainer(this), re = this, ie = e.componentSlots;
|
|
530
530
|
return p("div", {
|
|
531
531
|
style: u
|
|
532
532
|
}, [p(te, null, {
|
|
533
533
|
default() {
|
|
534
|
-
return Z(p(se, R(
|
|
534
|
+
return Z(p(se, R(c, {
|
|
535
535
|
label: `${h}:`
|
|
536
536
|
}, d, ee), {
|
|
537
537
|
default() {
|
|
@@ -540,6 +540,7 @@ class he {
|
|
|
540
540
|
schema: e,
|
|
541
541
|
baseModel: s,
|
|
542
542
|
placeholder: v,
|
|
543
|
+
componentSlots: ie,
|
|
543
544
|
props: O
|
|
544
545
|
});
|
|
545
546
|
},
|
|
@@ -559,7 +560,7 @@ class he {
|
|
|
559
560
|
style: s
|
|
560
561
|
}, [p(i, {
|
|
561
562
|
schema: e
|
|
562
|
-
},
|
|
563
|
+
}, he(t = e.children.map((o) => this.runtimeItemProcessor(o))) ? t : {
|
|
563
564
|
default: () => [t]
|
|
564
565
|
})]);
|
|
565
566
|
}
|
|
@@ -591,13 +592,13 @@ class he {
|
|
|
591
592
|
default() {
|
|
592
593
|
return s.model.value[e.field].map((n, u) => p(o, null, {
|
|
593
594
|
default() {
|
|
594
|
-
return e.children.map((
|
|
595
|
+
return e.children.map((c) => s.runtimeItemProcessor(c, u, n, e));
|
|
595
596
|
},
|
|
596
597
|
delete({
|
|
597
|
-
container:
|
|
598
|
+
container: c
|
|
598
599
|
} = {}) {
|
|
599
600
|
var y;
|
|
600
|
-
let d =
|
|
601
|
+
let d = c ?? p("button", null, null);
|
|
601
602
|
return Z(p(d, {
|
|
602
603
|
onClick: () => s.deleteListItem(e, u)
|
|
603
604
|
}, null), [[A, ((y = s.model.value[e.field]) == null ? void 0 : y.length) > 1]]);
|
|
@@ -607,7 +608,7 @@ class he {
|
|
|
607
608
|
add({
|
|
608
609
|
container: n
|
|
609
610
|
} = {}) {
|
|
610
|
-
let u = n ?? p("button", null, [
|
|
611
|
+
let u = n ?? p("button", null, [ae("添加")]);
|
|
611
612
|
return p(u, {
|
|
612
613
|
onClick: () => s.addListItem(e)
|
|
613
614
|
}, null);
|
|
@@ -618,13 +619,13 @@ class he {
|
|
|
618
619
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
619
620
|
}
|
|
620
621
|
exec() {
|
|
621
|
-
var u,
|
|
622
|
+
var u, c, d, y;
|
|
622
623
|
const e = {
|
|
623
624
|
display: "grid",
|
|
624
625
|
gridColumn: "1 / -1",
|
|
625
626
|
gridAutoColumns: "1fr",
|
|
626
627
|
...this.grid
|
|
627
|
-
}, t = this, s = m(g((
|
|
628
|
+
}, t = this, s = m(g((c = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props), i = m(g((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}, this.globalNativeFormOverride.slots), o = F.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
628
629
|
return p(o, R(s, {
|
|
629
630
|
ref: this.formRef
|
|
630
631
|
}, {
|
|
@@ -639,9 +640,9 @@ class he {
|
|
|
639
640
|
});
|
|
640
641
|
}
|
|
641
642
|
}
|
|
642
|
-
class
|
|
643
|
+
class f {
|
|
643
644
|
}
|
|
644
|
-
a(
|
|
645
|
+
a(f, "presets");
|
|
645
646
|
function M({
|
|
646
647
|
parentSchema: r,
|
|
647
648
|
schema: e,
|
|
@@ -649,7 +650,7 @@ function M({
|
|
|
649
650
|
}) {
|
|
650
651
|
return r ? `${r.field}.${t}.${e.field}` : e.field;
|
|
651
652
|
}
|
|
652
|
-
const
|
|
653
|
+
const ye = {
|
|
653
654
|
ArcoVue: {
|
|
654
655
|
getRuntimeField(r) {
|
|
655
656
|
return {
|
|
@@ -684,17 +685,20 @@ const me = {
|
|
|
684
685
|
baseModel: e,
|
|
685
686
|
schema: t,
|
|
686
687
|
placeholder: s,
|
|
687
|
-
|
|
688
|
+
componentSlots: i,
|
|
689
|
+
props: o
|
|
688
690
|
}) {
|
|
689
691
|
return p(r, R({
|
|
690
692
|
modelValue: e[t.field],
|
|
691
|
-
"onUpdate:modelValue": (
|
|
693
|
+
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
692
694
|
placeholder: s
|
|
693
|
-
},
|
|
695
|
+
}, o), {
|
|
696
|
+
...i
|
|
697
|
+
});
|
|
694
698
|
},
|
|
695
699
|
validateForm(r) {
|
|
696
700
|
return new Promise((e, t) => {
|
|
697
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
701
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(j(r.runtimeCore.processor.processedModel.value))));
|
|
698
702
|
});
|
|
699
703
|
},
|
|
700
704
|
clearValidate(r) {
|
|
@@ -736,13 +740,16 @@ const me = {
|
|
|
736
740
|
baseModel: e,
|
|
737
741
|
schema: t,
|
|
738
742
|
placeholder: s,
|
|
739
|
-
|
|
743
|
+
componentSlots: i,
|
|
744
|
+
props: o
|
|
740
745
|
}) {
|
|
741
746
|
return p(r, R({
|
|
742
747
|
modelValue: e[t.field],
|
|
743
|
-
"onUpdate:modelValue": (
|
|
748
|
+
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
744
749
|
placeholder: s
|
|
745
|
-
},
|
|
750
|
+
}, o), {
|
|
751
|
+
...i
|
|
752
|
+
});
|
|
746
753
|
},
|
|
747
754
|
validateForm(r) {
|
|
748
755
|
return new Promise((e, t) => {
|
|
@@ -750,7 +757,7 @@ const me = {
|
|
|
750
757
|
valid: s,
|
|
751
758
|
errors: i
|
|
752
759
|
}) => {
|
|
753
|
-
s ? e(r.cleanFallbackFields(
|
|
760
|
+
s ? e(r.cleanFallbackFields(j(r.runtimeCore.processor.processedModel.value))) : t(i);
|
|
754
761
|
});
|
|
755
762
|
});
|
|
756
763
|
},
|
|
@@ -793,24 +800,27 @@ const me = {
|
|
|
793
800
|
baseModel: e,
|
|
794
801
|
schema: t,
|
|
795
802
|
placeholder: s,
|
|
796
|
-
|
|
803
|
+
componentSlots: i,
|
|
804
|
+
props: o
|
|
797
805
|
}) {
|
|
798
806
|
return p(r, R({
|
|
799
807
|
value: e[t.field],
|
|
800
|
-
"onUpdate:value": (
|
|
808
|
+
"onUpdate:value": (n) => e[t.field] = n,
|
|
801
809
|
placeholder: s
|
|
802
|
-
},
|
|
810
|
+
}, o), {
|
|
811
|
+
...i
|
|
812
|
+
});
|
|
803
813
|
},
|
|
804
814
|
validateForm(r) {
|
|
805
815
|
return new Promise((e, t) => {
|
|
806
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
816
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(j(r.runtimeCore.processor.processedModel.value))));
|
|
807
817
|
});
|
|
808
818
|
},
|
|
809
819
|
clearValidate(r) {
|
|
810
820
|
r.formRef.value.restoreValidation();
|
|
811
821
|
}
|
|
812
822
|
}
|
|
813
|
-
},
|
|
823
|
+
}, S = class S {
|
|
814
824
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
815
825
|
const e = {
|
|
816
826
|
请选择: ["select", "tree"],
|
|
@@ -823,7 +833,7 @@ const me = {
|
|
|
823
833
|
return t;
|
|
824
834
|
}
|
|
825
835
|
};
|
|
826
|
-
a(
|
|
836
|
+
a(S, "schemaPreset", {
|
|
827
837
|
type: {
|
|
828
838
|
defaultValue: "item"
|
|
829
839
|
},
|
|
@@ -833,6 +843,9 @@ a(j, "schemaPreset", {
|
|
|
833
843
|
componentProps: {
|
|
834
844
|
defaultValue: void 0
|
|
835
845
|
},
|
|
846
|
+
componentSlots: {
|
|
847
|
+
defaultValue: void 0
|
|
848
|
+
},
|
|
836
849
|
defaultValue: {
|
|
837
850
|
defaultValue: void 0
|
|
838
851
|
},
|
|
@@ -863,19 +876,19 @@ a(j, "schemaPreset", {
|
|
|
863
876
|
grid: {
|
|
864
877
|
default: void 0
|
|
865
878
|
}
|
|
866
|
-
}), a(
|
|
879
|
+
}), a(S, "componentPropsPreset", {
|
|
867
880
|
options: {
|
|
868
881
|
defaultValue: []
|
|
869
882
|
}
|
|
870
883
|
}), // 基于基本功能提出基本预设
|
|
871
|
-
a(
|
|
872
|
-
let L =
|
|
884
|
+
a(S, "placeholderPresetByComponentName", S.getPlaceholderPrefixPresetByComponentName());
|
|
885
|
+
let L = S;
|
|
873
886
|
const b = {
|
|
874
887
|
...L,
|
|
875
888
|
adapters: {
|
|
876
|
-
...
|
|
889
|
+
...ye
|
|
877
890
|
}
|
|
878
|
-
},
|
|
891
|
+
}, ge = /* @__PURE__ */ ce({
|
|
879
892
|
props: {
|
|
880
893
|
setup: {
|
|
881
894
|
type: Function,
|
|
@@ -883,11 +896,11 @@ const b = {
|
|
|
883
896
|
}
|
|
884
897
|
},
|
|
885
898
|
setup(r) {
|
|
886
|
-
const e = new
|
|
899
|
+
const e = new me(r.setup);
|
|
887
900
|
return () => e.exec();
|
|
888
901
|
}
|
|
889
902
|
});
|
|
890
|
-
function
|
|
903
|
+
function Ce(r) {
|
|
891
904
|
const e = new fe(r);
|
|
892
905
|
return [
|
|
893
906
|
e.setup.bind(e),
|
|
@@ -897,18 +910,22 @@ function ve(r) {
|
|
|
897
910
|
}
|
|
898
911
|
];
|
|
899
912
|
}
|
|
900
|
-
function
|
|
901
|
-
|
|
913
|
+
function Ie(r) {
|
|
914
|
+
f.presets = r;
|
|
902
915
|
}
|
|
903
|
-
function
|
|
904
|
-
return e === "
|
|
916
|
+
function Pe(r, e) {
|
|
917
|
+
return e === "native" && Object.defineProperty(r, "name", {
|
|
905
918
|
value: `__proform_raw_${r.name}`,
|
|
906
919
|
writable: !0
|
|
907
920
|
}), r;
|
|
908
921
|
}
|
|
922
|
+
function Ve(r) {
|
|
923
|
+
return Pe(r, "native");
|
|
924
|
+
}
|
|
909
925
|
export {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
926
|
+
ge as ProForm,
|
|
927
|
+
Ve as markNativeFunction,
|
|
928
|
+
Ce as useForm,
|
|
929
|
+
Ie as useFormPresetConfigurer,
|
|
930
|
+
Pe as useModifiers
|
|
914
931
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ 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
4
|
export { useModifiers } from "./src/interactions/useModifiers";
|
|
5
|
+
export { markNativeFunction } from "./src/interactions/useModifiers";
|
|
5
6
|
export * from "./src/types/index";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { runtimeMeta } from "../types";
|
|
2
|
-
type Modifier = "
|
|
3
|
-
|
|
4
|
-
rawArgs: any[];
|
|
5
|
-
} & runtimeMeta) => any, modifier: Modifier): (args: {
|
|
2
|
+
type Modifier = "native";
|
|
3
|
+
type FunctionNative = (args: {
|
|
6
4
|
rawArgs: any[];
|
|
7
5
|
} & runtimeMeta) => any;
|
|
6
|
+
export declare function useModifiers(functionNative: FunctionNative, modifier: Modifier): FunctionNative;
|
|
7
|
+
export declare function markNativeFunction(functionNative: FunctionNative): FunctionNative;
|
|
8
8
|
export {};
|