@harbor-design/proform 1.2.2 → 1.2.4
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 re = Object.defineProperty;
|
|
2
2
|
var ie = (r, e, t) => e in r ? re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var a = (r, e, t) => (ie(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { isRef as N, watch as
|
|
4
|
+
import { isRef as N, watch as P, isReactive as q, nextTick as E, toRaw as R, ref as U, reactive as oe, createVNode as p, mergeProps as O, 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);
|
|
@@ -91,8 +91,8 @@ function C(r) {
|
|
|
91
91
|
return new RegExp(s);
|
|
92
92
|
if (s instanceof Map) {
|
|
93
93
|
const o = /* @__PURE__ */ new Map();
|
|
94
|
-
for (const [n,
|
|
95
|
-
o.set(t(n), t(
|
|
94
|
+
for (const [n, f] of s)
|
|
95
|
+
o.set(t(n), t(f));
|
|
96
96
|
return o;
|
|
97
97
|
}
|
|
98
98
|
if (s instanceof Set) {
|
|
@@ -118,7 +118,7 @@ function C(r) {
|
|
|
118
118
|
}
|
|
119
119
|
return t(r);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function x(r, e) {
|
|
122
122
|
return r.replace(/undefined/g, e);
|
|
123
123
|
}
|
|
124
124
|
class fe {
|
|
@@ -137,7 +137,7 @@ class fe {
|
|
|
137
137
|
}
|
|
138
138
|
submit() {
|
|
139
139
|
var s;
|
|
140
|
-
const e = (s =
|
|
140
|
+
const e = (s = u.getPreset(this.runtimeCore.ui)) == null ? void 0 : s.adapter, t = b.adapters[u.getUI(this.runtimeCore.ui)];
|
|
141
141
|
return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
|
|
142
142
|
}
|
|
143
143
|
hydrate(e) {
|
|
@@ -148,7 +148,7 @@ class fe {
|
|
|
148
148
|
});
|
|
149
149
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
150
150
|
() => {
|
|
151
|
-
N(e) ?
|
|
151
|
+
N(e) ? P(
|
|
152
152
|
() => e.value,
|
|
153
153
|
() => {
|
|
154
154
|
h(this.runtimeCore.model.value, e.value);
|
|
@@ -157,7 +157,7 @@ class fe {
|
|
|
157
157
|
deep: !0,
|
|
158
158
|
immediate: !0
|
|
159
159
|
}
|
|
160
|
-
) : q(e) ?
|
|
160
|
+
) : q(e) ? P(
|
|
161
161
|
() => e,
|
|
162
162
|
() => {
|
|
163
163
|
h(this.runtimeCore.model.value, e);
|
|
@@ -175,7 +175,7 @@ class fe {
|
|
|
175
175
|
}
|
|
176
176
|
share(e) {
|
|
177
177
|
if (N(e)) {
|
|
178
|
-
const t =
|
|
178
|
+
const t = P(
|
|
179
179
|
() => e.value,
|
|
180
180
|
() => {
|
|
181
181
|
h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), E(() => {
|
|
@@ -188,7 +188,7 @@ class fe {
|
|
|
188
188
|
}
|
|
189
189
|
);
|
|
190
190
|
} else if (q(e)) {
|
|
191
|
-
const t =
|
|
191
|
+
const t = P(
|
|
192
192
|
() => e,
|
|
193
193
|
() => {
|
|
194
194
|
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), E(() => {
|
|
@@ -204,7 +204,7 @@ class fe {
|
|
|
204
204
|
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
class
|
|
207
|
+
class L {
|
|
208
208
|
constructor() {
|
|
209
209
|
a(this, "effects", /* @__PURE__ */ new Set());
|
|
210
210
|
}
|
|
@@ -228,16 +228,16 @@ class de {
|
|
|
228
228
|
a(this, "getRuntimeMeta");
|
|
229
229
|
a(this, "stableSchemas", []);
|
|
230
230
|
a(this, "stableModel", {});
|
|
231
|
-
a(this, "schemaPreset",
|
|
232
|
-
a(this, "componentPropsPreset",
|
|
231
|
+
a(this, "schemaPreset", b.schemaPreset);
|
|
232
|
+
a(this, "componentPropsPreset", b.componentPropsPreset);
|
|
233
233
|
a(this, "stableUpdaterProcessProgress");
|
|
234
234
|
a(this, "stableUpdaterTimes", 0);
|
|
235
|
-
a(this, "schemaEffect", new
|
|
236
|
-
a(this, "defaultValueEffect", new
|
|
235
|
+
a(this, "schemaEffect", new L());
|
|
236
|
+
a(this, "defaultValueEffect", new L());
|
|
237
237
|
a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
238
238
|
a(this, "baseDefaultValueFunctionsLength");
|
|
239
239
|
a(this, "isModelInitialized", !0);
|
|
240
|
-
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), P(
|
|
241
241
|
() => this.processedModel.value,
|
|
242
242
|
() => {
|
|
243
243
|
this.schemaEffect.triggerEffects();
|
|
@@ -298,21 +298,21 @@ class de {
|
|
|
298
298
|
// 核心单 schema 处理过程,接收一个对象键值对的数据结构
|
|
299
299
|
parseItem(e, t, s) {
|
|
300
300
|
const i = this, o = Array.from({
|
|
301
|
-
length: Object.keys(e).filter((
|
|
301
|
+
length: Object.keys(e).filter((f) => f !== "children").length
|
|
302
302
|
}).fill(!1);
|
|
303
303
|
this.objectParser({ data: e, index: t, updater: n });
|
|
304
|
-
function n(
|
|
305
|
-
const
|
|
306
|
-
if (l.isUndefined(
|
|
304
|
+
function n(f) {
|
|
305
|
+
const c = f.index, d = f.key, v = f.keyIndex;
|
|
306
|
+
if (l.isUndefined(f.stable))
|
|
307
307
|
return;
|
|
308
|
-
const j = i.parseStable(
|
|
308
|
+
const j = i.parseStable(f.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
|
|
309
309
|
let y = j;
|
|
310
310
|
if (l.isProcessInprogress(y) || (o[v] = !0), s) {
|
|
311
|
-
const m = i.processedSchemas.value[I][g][
|
|
312
|
-
m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[I][g][
|
|
311
|
+
const m = i.processedSchemas.value[I][g][c][d];
|
|
312
|
+
m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[I][g][c][d] = y, i.stableUpdater(o);
|
|
313
313
|
} else {
|
|
314
|
-
const m = i.processedSchemas.value[
|
|
315
|
-
m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[
|
|
314
|
+
const m = i.processedSchemas.value[c][d];
|
|
315
|
+
m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[c][d] = y, i.stableUpdater(o);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -327,19 +327,19 @@ class de {
|
|
|
327
327
|
keyIndex: o
|
|
328
328
|
});
|
|
329
329
|
else {
|
|
330
|
-
const n = (
|
|
330
|
+
const n = (f) => {
|
|
331
331
|
e.updater({
|
|
332
332
|
...e,
|
|
333
333
|
key: i,
|
|
334
334
|
keyIndex: o,
|
|
335
|
-
stable:
|
|
335
|
+
stable: f
|
|
336
336
|
});
|
|
337
337
|
};
|
|
338
338
|
l.isFunction(t[i]) ? i !== "defaultValue" ? this.schemaEffect.trackEffect(
|
|
339
339
|
() => {
|
|
340
340
|
if (i === "component") {
|
|
341
|
-
const
|
|
342
|
-
this.promiseFieldParser(
|
|
341
|
+
const f = t[i](this.getRuntimeMeta());
|
|
342
|
+
this.promiseFieldParser(f, n, !1);
|
|
343
343
|
} else
|
|
344
344
|
this.fieldParser(t[i], n);
|
|
345
345
|
},
|
|
@@ -348,22 +348,22 @@ class de {
|
|
|
348
348
|
}
|
|
349
349
|
) : this.defaultValueEffect.trackEffect(
|
|
350
350
|
() => {
|
|
351
|
-
const
|
|
351
|
+
const f = this.schemaEffect.trackEffect(
|
|
352
352
|
() => {
|
|
353
|
-
/\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (
|
|
354
|
-
if (!
|
|
355
|
-
return n(
|
|
356
|
-
this.defaultValueInprogressMap.set(t[i],
|
|
353
|
+
/\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(t[i], (c) => {
|
|
354
|
+
if (!c)
|
|
355
|
+
return n(c);
|
|
356
|
+
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
357
357
|
this.defaultValueInprogressMap.values()
|
|
358
|
-
).every((d) => !d.includes("undefined")) ? (n(
|
|
359
|
-
|
|
360
|
-
})) : n(
|
|
361
|
-
}) : this.fieldParser(t[i], (
|
|
362
|
-
this.defaultValueInprogressMap.set(t[i],
|
|
358
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), E(() => {
|
|
359
|
+
f();
|
|
360
|
+
})) : n(c);
|
|
361
|
+
}) : this.fieldParser(t[i], (c) => {
|
|
362
|
+
this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
363
363
|
this.defaultValueInprogressMap.values()
|
|
364
|
-
).every((d) => !d.includes("undefined")) ? (n(
|
|
365
|
-
|
|
366
|
-
})) : n(
|
|
364
|
+
).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), E(() => {
|
|
365
|
+
f();
|
|
366
|
+
})) : n(c);
|
|
367
367
|
});
|
|
368
368
|
},
|
|
369
369
|
{
|
|
@@ -380,11 +380,11 @@ class de {
|
|
|
380
380
|
}
|
|
381
381
|
promiseFieldParser(e, t, s) {
|
|
382
382
|
l.isPromise(e) ? e.then((i) => {
|
|
383
|
-
l.isString(i) && (i =
|
|
383
|
+
l.isString(i) && (i = x(i, "")), s && l.isObject(i) && !l.isNativeObject(i) ? this.objectParser({
|
|
384
384
|
data: i,
|
|
385
385
|
updater: t
|
|
386
386
|
}) : t(i);
|
|
387
|
-
}) : (l.isString(e) && (e =
|
|
387
|
+
}) : (l.isString(e) && (e = x(e, "")), s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
388
388
|
data: e,
|
|
389
389
|
updater: t
|
|
390
390
|
}) : t(e));
|
|
@@ -404,7 +404,7 @@ class de {
|
|
|
404
404
|
this.promiseFieldParser(i, t, s);
|
|
405
405
|
}
|
|
406
406
|
else
|
|
407
|
-
N(e) ?
|
|
407
|
+
N(e) ? P(
|
|
408
408
|
() => e.value,
|
|
409
409
|
() => {
|
|
410
410
|
l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
|
|
@@ -416,7 +416,7 @@ class de {
|
|
|
416
416
|
immediate: !0,
|
|
417
417
|
deep: !0
|
|
418
418
|
}
|
|
419
|
-
) : q(e) ?
|
|
419
|
+
) : q(e) ? P(
|
|
420
420
|
() => e,
|
|
421
421
|
() => {
|
|
422
422
|
l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
@@ -448,22 +448,22 @@ class de {
|
|
|
448
448
|
}
|
|
449
449
|
class F {
|
|
450
450
|
static getFormContainer({ ui: e } = {}) {
|
|
451
|
-
return
|
|
451
|
+
return u.presets.uiPresets[e ?? u.presets.ui].container.Form;
|
|
452
452
|
}
|
|
453
453
|
static getFormItemContainer({ ui: e } = {}) {
|
|
454
|
-
return
|
|
454
|
+
return u.presets.uiPresets[e ?? u.presets.ui].container.FormItem;
|
|
455
455
|
}
|
|
456
456
|
static getItemContainer({ ui: e } = {}) {
|
|
457
|
-
return
|
|
457
|
+
return u.presets.uiPresets[e ?? u.presets.ui].container.Item;
|
|
458
458
|
}
|
|
459
459
|
static getGroupContainer({ ui: e } = {}) {
|
|
460
|
-
return
|
|
460
|
+
return u.presets.uiPresets[e ?? u.presets.ui].container.Group;
|
|
461
461
|
}
|
|
462
462
|
static getListContainer({ ui: e } = {}) {
|
|
463
|
-
return
|
|
463
|
+
return u.presets.uiPresets[e ?? u.presets.ui].container.List;
|
|
464
464
|
}
|
|
465
465
|
static getListItemContainer({ ui: e } = {}) {
|
|
466
|
-
return
|
|
466
|
+
return u.presets.uiPresets[e ?? u.presets.ui].container.ListItem;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
class he {
|
|
@@ -472,31 +472,31 @@ class he {
|
|
|
472
472
|
}
|
|
473
473
|
getRuntimeNative() {
|
|
474
474
|
var t;
|
|
475
|
-
return (t =
|
|
475
|
+
return (t = u.presets.uiPresets[this.ui]) == null ? void 0 : t.native;
|
|
476
476
|
}
|
|
477
477
|
getRuntimeField(e) {
|
|
478
478
|
var i;
|
|
479
|
-
const t = (i =
|
|
479
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[u.getUI(this.ui)];
|
|
480
480
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
481
481
|
}
|
|
482
482
|
getRuntimeRequired(e) {
|
|
483
483
|
var i;
|
|
484
|
-
const t = (i =
|
|
484
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[u.getUI(this.ui)];
|
|
485
485
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
486
486
|
}
|
|
487
487
|
getFormModelPropName() {
|
|
488
488
|
var s;
|
|
489
|
-
const e = (s =
|
|
489
|
+
const e = (s = u.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = b.adapters[u.getUI(this.ui)];
|
|
490
490
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
491
491
|
}
|
|
492
492
|
formComponentRenderer(e) {
|
|
493
493
|
var i;
|
|
494
|
-
const t = (i =
|
|
494
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[u.getUI(this.ui)];
|
|
495
495
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
496
496
|
}
|
|
497
497
|
clearValidate(e) {
|
|
498
498
|
var i;
|
|
499
|
-
const t = (i =
|
|
499
|
+
const t = (i = u.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[u.getUI(this.ui)];
|
|
500
500
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
501
501
|
}
|
|
502
502
|
}
|
|
@@ -505,15 +505,15 @@ function pe(r) {
|
|
|
505
505
|
}
|
|
506
506
|
class me {
|
|
507
507
|
constructor(e) {
|
|
508
|
-
a(this, "schemas",
|
|
509
|
-
a(this, "model",
|
|
508
|
+
a(this, "schemas", U([]));
|
|
509
|
+
a(this, "model", U({}));
|
|
510
510
|
a(this, "processorBySchemaType", {
|
|
511
511
|
item: this.runtimeItemProcessor.bind(this),
|
|
512
512
|
group: this.runtimeGroupProcessor.bind(this),
|
|
513
513
|
list: this.runtimeListProcessor.bind(this)
|
|
514
514
|
});
|
|
515
|
-
a(this, "formRef",
|
|
516
|
-
a(this, "hydrateEffect", new
|
|
515
|
+
a(this, "formRef", U(null));
|
|
516
|
+
a(this, "hydrateEffect", new L());
|
|
517
517
|
a(this, "native", oe({}));
|
|
518
518
|
a(this, "grid", {});
|
|
519
519
|
a(this, "runtime", {});
|
|
@@ -524,8 +524,8 @@ class me {
|
|
|
524
524
|
a(this, "shared", {});
|
|
525
525
|
this.setup = e, this.processor = new de(this);
|
|
526
526
|
const t = this.setup(this);
|
|
527
|
-
if (this.ui = t.ui ??
|
|
528
|
-
|
|
527
|
+
if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new he(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), N(t.schemas))
|
|
528
|
+
P(
|
|
529
529
|
// @ts-expect-error
|
|
530
530
|
() => t.schemas.value,
|
|
531
531
|
() => {
|
|
@@ -536,7 +536,7 @@ class me {
|
|
|
536
536
|
}
|
|
537
537
|
);
|
|
538
538
|
else if (q(t.schemas)) {
|
|
539
|
-
const s =
|
|
539
|
+
const s = P(() => t.schemas, () => {
|
|
540
540
|
this.processor.parseSchemas(t.schemas), E(() => {
|
|
541
541
|
s();
|
|
542
542
|
});
|
|
@@ -547,54 +547,59 @@ class me {
|
|
|
547
547
|
this.processor.parseSchemas(t.schemas);
|
|
548
548
|
}
|
|
549
549
|
getRuntimeMeta() {
|
|
550
|
+
const e = R(C(this.model.value));
|
|
551
|
+
let t;
|
|
550
552
|
return {
|
|
551
|
-
model:
|
|
553
|
+
model: e,
|
|
552
554
|
reactiveModel: this.model.value,
|
|
553
555
|
shared: this.shared,
|
|
554
|
-
share
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
556
|
+
// share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
|
|
557
|
+
share: (s) => {
|
|
558
|
+
t && clearTimeout(t), t = setTimeout(() => {
|
|
559
|
+
if (N(s)) {
|
|
560
|
+
const i = P(() => s.value, () => {
|
|
561
|
+
h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), E(() => {
|
|
562
|
+
i();
|
|
563
|
+
});
|
|
564
|
+
}, {
|
|
565
|
+
deep: !0,
|
|
566
|
+
immediate: !0
|
|
559
567
|
});
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
+
} else if (q(s)) {
|
|
569
|
+
const i = P(() => s, () => {
|
|
570
|
+
h(this.shared, s), this.processor.schemaEffect.triggerEffects(), E(() => {
|
|
571
|
+
i();
|
|
572
|
+
});
|
|
573
|
+
}, {
|
|
574
|
+
deep: !0,
|
|
575
|
+
immediate: !0
|
|
568
576
|
});
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
});
|
|
573
|
-
} else
|
|
574
|
-
h(this.shared, t), this.processor.schemaEffect.triggerEffects();
|
|
577
|
+
} else
|
|
578
|
+
h(this.shared, s), this.processor.schemaEffect.triggerEffects();
|
|
579
|
+
}, 0);
|
|
575
580
|
}
|
|
576
581
|
};
|
|
577
582
|
}
|
|
578
583
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
579
|
-
var z, k, $, B, D,
|
|
584
|
+
var z, k, $, B, D, T, G, W, K, H, J, Q, X;
|
|
580
585
|
const o = R(e.component);
|
|
581
586
|
if (!o)
|
|
582
587
|
return;
|
|
583
588
|
h(this.globalNativeFormOverride.props, (k = (z = e.native) == null ? void 0 : z.props) == null ? void 0 : k.Form), h(this.globalNativeFormOverride.slots, (B = ($ = e.native) == null ? void 0 : $.slots) == null ? void 0 : B.Form);
|
|
584
|
-
const n = h(C((
|
|
589
|
+
const n = h(C((T = (D = this.native) == null ? void 0 : D.slots) == null ? void 0 : T.FormItem) ?? {}, (W = (G = e.native) == null ? void 0 : G.slots) == null ? void 0 : W.FormItem), f = {
|
|
585
590
|
display: "grid",
|
|
586
591
|
gridColumn: "1 / -1",
|
|
587
592
|
...e.grid
|
|
588
|
-
},
|
|
593
|
+
}, c = h(C((H = (K = this.native) == null ? void 0 : K.props) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.props) == null ? void 0 : Q.FormItem), d = this.runtimeAdapter.getRuntimeField({
|
|
589
594
|
schema: e,
|
|
590
595
|
parentSchema: i,
|
|
591
596
|
index: t
|
|
592
|
-
}), v = o.name, j = e.componentProps ?? {}, I =
|
|
597
|
+
}), v = o.name, j = e.componentProps ?? {}, I = b.placeholderPresetByComponentName;
|
|
593
598
|
let g = e.placeholder, y = e.show;
|
|
594
599
|
y === void 0 && (y = !0), y || delete s[e.field];
|
|
595
600
|
let m = e.label ?? "";
|
|
596
601
|
const V = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
597
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (m =
|
|
602
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (m = x((X = V == null ? void 0 : V.customizeListItemLabel) == null ? void 0 : X.call(V, e.label ?? "", t + 1), "")), !g) {
|
|
598
603
|
let S = "请输入";
|
|
599
604
|
l.isUndefined(v) ? g = `${S}${m}` : /* @ts-expect-error */ I[v.toLowerCase()] ? (S = // @ts-expect-error
|
|
600
605
|
I[v.toLowerCase()], g = `${S}${m}`) : (Object.keys(I).forEach((Y) => {
|
|
@@ -606,12 +611,12 @@ class me {
|
|
|
606
611
|
label: m
|
|
607
612
|
}), A = F.getItemContainer(this), ee = F.getFormItemContainer(this), te = this, se = e.componentSlots;
|
|
608
613
|
return p("div", {
|
|
609
|
-
style:
|
|
614
|
+
style: f
|
|
610
615
|
}, [p(A, {
|
|
611
616
|
show: y
|
|
612
617
|
}, {
|
|
613
618
|
default() {
|
|
614
|
-
return y && p(ee, O(
|
|
619
|
+
return y && p(ee, O(c, {
|
|
615
620
|
label: `${m ? `${m}:` : ""}`
|
|
616
621
|
}, d, Z), {
|
|
617
622
|
default() {
|
|
@@ -673,9 +678,9 @@ class me {
|
|
|
673
678
|
schema: e
|
|
674
679
|
}, {
|
|
675
680
|
default() {
|
|
676
|
-
return s.model.value[e.field].map((
|
|
681
|
+
return s.model.value[e.field].map((f, c) => p(n, null, {
|
|
677
682
|
default() {
|
|
678
|
-
return e.children.map((d) => s.runtimeItemProcessor(d,
|
|
683
|
+
return e.children.map((d) => s.runtimeItemProcessor(d, c, f, e));
|
|
679
684
|
},
|
|
680
685
|
delete({
|
|
681
686
|
container: d
|
|
@@ -683,16 +688,16 @@ class me {
|
|
|
683
688
|
var j;
|
|
684
689
|
const v = d ?? p("button", null, null);
|
|
685
690
|
return ne(p(v, {
|
|
686
|
-
onClick: () => s.deleteListItem(e,
|
|
691
|
+
onClick: () => s.deleteListItem(e, c)
|
|
687
692
|
}, null), [[le, ((j = s.model.value[e.field]) == null ? void 0 : j.length) > 1]]);
|
|
688
693
|
}
|
|
689
694
|
}));
|
|
690
695
|
},
|
|
691
696
|
add({
|
|
692
|
-
container:
|
|
697
|
+
container: f
|
|
693
698
|
} = {}) {
|
|
694
|
-
const
|
|
695
|
-
return p(
|
|
699
|
+
const c = f ?? p("button", null, [ae("添加")]);
|
|
700
|
+
return p(c, {
|
|
696
701
|
onClick: () => s.addListItem(e)
|
|
697
702
|
}, null);
|
|
698
703
|
}
|
|
@@ -702,14 +707,14 @@ class me {
|
|
|
702
707
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
703
708
|
}
|
|
704
709
|
exec() {
|
|
705
|
-
var
|
|
710
|
+
var f, c, d, v;
|
|
706
711
|
const e = {
|
|
707
712
|
display: "grid",
|
|
708
713
|
gridColumn: "1 / -1",
|
|
709
714
|
gridAutoColumns: "1fr",
|
|
710
715
|
...this.grid
|
|
711
716
|
}, t = this, s = h(
|
|
712
|
-
C((
|
|
717
|
+
C((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {},
|
|
713
718
|
// @ts-expect-error
|
|
714
719
|
this.globalNativeFormOverride.props.Form
|
|
715
720
|
), i = h(
|
|
@@ -731,10 +736,18 @@ class me {
|
|
|
731
736
|
});
|
|
732
737
|
}
|
|
733
738
|
}
|
|
734
|
-
class
|
|
739
|
+
class u {
|
|
740
|
+
static getPreset(e) {
|
|
741
|
+
var t, s, i;
|
|
742
|
+
return (s = (t = this.presets.uiPresets) == null ? void 0 : t[e]) != null && s.extend ? this.presets.uiPresets[(i = this.presets.uiPresets[e]) == null ? void 0 : i.extend] : this.presets.uiPresets[e];
|
|
743
|
+
}
|
|
744
|
+
static getUI(e) {
|
|
745
|
+
var t, s, i;
|
|
746
|
+
return (s = (t = this.presets.uiPresets) == null ? void 0 : t[e]) != null && s.extend ? (i = this.presets.uiPresets[e]) == null ? void 0 : i.extend : e;
|
|
747
|
+
}
|
|
735
748
|
}
|
|
736
|
-
a(
|
|
737
|
-
function
|
|
749
|
+
a(u, "presets");
|
|
750
|
+
function M({
|
|
738
751
|
parentSchema: r,
|
|
739
752
|
schema: e,
|
|
740
753
|
index: t
|
|
@@ -745,7 +758,7 @@ const ye = {
|
|
|
745
758
|
ArcoVue: {
|
|
746
759
|
getRuntimeField(r) {
|
|
747
760
|
return {
|
|
748
|
-
field:
|
|
761
|
+
field: M(r)
|
|
749
762
|
};
|
|
750
763
|
},
|
|
751
764
|
getRuntimeRequired(r) {
|
|
@@ -799,7 +812,7 @@ const ye = {
|
|
|
799
812
|
NutUI: {
|
|
800
813
|
getRuntimeField(r) {
|
|
801
814
|
return {
|
|
802
|
-
prop:
|
|
815
|
+
prop: M(r)
|
|
803
816
|
};
|
|
804
817
|
},
|
|
805
818
|
getRuntimeRequired(r) {
|
|
@@ -859,7 +872,7 @@ const ye = {
|
|
|
859
872
|
NaiveUI: {
|
|
860
873
|
getRuntimeField(r) {
|
|
861
874
|
return {
|
|
862
|
-
path:
|
|
875
|
+
path: M(r)
|
|
863
876
|
};
|
|
864
877
|
},
|
|
865
878
|
getRuntimeRequired(r) {
|
|
@@ -973,9 +986,9 @@ a(w, "schemaPreset", {
|
|
|
973
986
|
}
|
|
974
987
|
}), // 基于基本功能提出基本预设
|
|
975
988
|
a(w, "placeholderPresetByComponentName", w.getPlaceholderPrefixPresetByComponentName());
|
|
976
|
-
let
|
|
977
|
-
const
|
|
978
|
-
...
|
|
989
|
+
let _ = w;
|
|
990
|
+
const b = {
|
|
991
|
+
..._,
|
|
979
992
|
adapters: {
|
|
980
993
|
...ye
|
|
981
994
|
}
|
|
@@ -1003,7 +1016,7 @@ function Ce(r) {
|
|
|
1003
1016
|
];
|
|
1004
1017
|
}
|
|
1005
1018
|
function Ie(r) {
|
|
1006
|
-
|
|
1019
|
+
u.presets = r;
|
|
1007
1020
|
}
|
|
1008
1021
|
function ve(r, e) {
|
|
1009
1022
|
return e === "native" && Object.defineProperty(r, "name", {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { FormPresets } from "../../types";
|
|
1
|
+
import { FormPresets, UIName } from "../../types";
|
|
2
2
|
export default class Context {
|
|
3
3
|
static presets: FormPresets;
|
|
4
|
+
static getPreset(ui: UIName): import("../../types").FormPreset | undefined;
|
|
5
|
+
static getUI(ui: UIName): UIName;
|
|
4
6
|
}
|