@harbor-design/proform 1.1.31 → 1.1.33
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
|
|
4
|
+
import { isRef as q, watch as P, isReactive as N, nextTick as F, toRaw as S, ref as M, 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);
|
|
@@ -66,18 +66,18 @@ class l {
|
|
|
66
66
|
return !!e.__proform_raw_object;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function h(r, ...e) {
|
|
70
70
|
return e.forEach((t) => {
|
|
71
71
|
if (Array.isArray(t))
|
|
72
72
|
Array.isArray(r) || (r = []), t.forEach((s, i) => {
|
|
73
|
-
typeof s == "object" && s !== null ? r[i] =
|
|
73
|
+
typeof s == "object" && s !== null ? r[i] = h(Array.isArray(s) ? [] : {}, s) : r[i] = s;
|
|
74
74
|
});
|
|
75
75
|
else
|
|
76
76
|
for (const s in t)
|
|
77
|
-
t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] =
|
|
77
|
+
t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] = h(r[s] || {}, t[s]) : r[s] = t[s]);
|
|
78
78
|
}), r;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function C(r) {
|
|
81
81
|
const e = /* @__PURE__ */ new WeakMap();
|
|
82
82
|
function t(s) {
|
|
83
83
|
if (s === null || typeof s != "object")
|
|
@@ -115,7 +115,7 @@ function g(r) {
|
|
|
115
115
|
}
|
|
116
116
|
return t(r);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function L(r, e) {
|
|
119
119
|
return r.replace(/undefined/g, e);
|
|
120
120
|
}
|
|
121
121
|
class fe {
|
|
@@ -134,7 +134,7 @@ class fe {
|
|
|
134
134
|
}
|
|
135
135
|
submit() {
|
|
136
136
|
var s;
|
|
137
|
-
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 = v.adapters[this.runtimeCore.ui];
|
|
138
138
|
return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
|
|
139
139
|
}
|
|
140
140
|
hydrate(e) {
|
|
@@ -145,33 +145,63 @@ class fe {
|
|
|
145
145
|
});
|
|
146
146
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
147
147
|
() => {
|
|
148
|
-
|
|
148
|
+
q(e) ? P(
|
|
149
149
|
() => e.value,
|
|
150
150
|
() => {
|
|
151
|
-
|
|
151
|
+
h(this.runtimeCore.model.value, e.value);
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
deep: !0,
|
|
155
155
|
immediate: !0
|
|
156
156
|
}
|
|
157
|
-
) :
|
|
157
|
+
) : N(e) ? P(
|
|
158
158
|
() => e,
|
|
159
159
|
() => {
|
|
160
|
-
|
|
160
|
+
h(this.runtimeCore.model.value, e);
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
deep: !0,
|
|
164
164
|
immediate: !0
|
|
165
165
|
}
|
|
166
|
-
) :
|
|
166
|
+
) : h(this.runtimeCore.model.value, e);
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
169
|
lazy: !0
|
|
170
170
|
}
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
|
+
share(e) {
|
|
174
|
+
if (q(e)) {
|
|
175
|
+
const t = P(
|
|
176
|
+
() => e.value,
|
|
177
|
+
() => {
|
|
178
|
+
h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), F(() => {
|
|
179
|
+
t();
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
deep: !0,
|
|
184
|
+
immediate: !0
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
} else if (N(e)) {
|
|
188
|
+
const t = P(
|
|
189
|
+
() => e,
|
|
190
|
+
() => {
|
|
191
|
+
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), F(() => {
|
|
192
|
+
t();
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
deep: !0,
|
|
197
|
+
immediate: !0
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
} else
|
|
201
|
+
h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
|
|
202
|
+
}
|
|
173
203
|
}
|
|
174
|
-
class
|
|
204
|
+
class _ {
|
|
175
205
|
constructor() {
|
|
176
206
|
a(this, "effects", /* @__PURE__ */ new Set());
|
|
177
207
|
}
|
|
@@ -195,16 +225,16 @@ class de {
|
|
|
195
225
|
a(this, "getRuntimeMeta");
|
|
196
226
|
a(this, "stableSchemas", []);
|
|
197
227
|
a(this, "stableModel", {});
|
|
198
|
-
a(this, "schemaPreset",
|
|
199
|
-
a(this, "componentPropsPreset",
|
|
228
|
+
a(this, "schemaPreset", v.schemaPreset);
|
|
229
|
+
a(this, "componentPropsPreset", v.componentPropsPreset);
|
|
200
230
|
a(this, "stableUpdaterProcessProgress");
|
|
201
231
|
a(this, "stableUpdaterTimes", 0);
|
|
202
|
-
a(this, "schemaEffect", new
|
|
203
|
-
a(this, "defaultValueEffect", new
|
|
232
|
+
a(this, "schemaEffect", new _());
|
|
233
|
+
a(this, "defaultValueEffect", new _());
|
|
204
234
|
a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
205
235
|
a(this, "baseDefaultValueFunctionsLength");
|
|
206
236
|
a(this, "isModelInitialized", !0);
|
|
207
|
-
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e),
|
|
237
|
+
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), P(
|
|
208
238
|
() => this.processedModel.value,
|
|
209
239
|
() => {
|
|
210
240
|
this.schemaEffect.triggerEffects();
|
|
@@ -242,7 +272,7 @@ class de {
|
|
|
242
272
|
// 派生过程,用于外部应用
|
|
243
273
|
parseSchemas(e, t) {
|
|
244
274
|
l.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
245
|
-
|
|
275
|
+
C(e)
|
|
246
276
|
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
|
|
247
277
|
}
|
|
248
278
|
parseStable(e) {
|
|
@@ -256,7 +286,7 @@ class de {
|
|
|
256
286
|
// 对于稳定初始化更新的抽象
|
|
257
287
|
stableUpdater(e = []) {
|
|
258
288
|
if (e.every(Boolean)) {
|
|
259
|
-
const t =
|
|
289
|
+
const t = S(this.processedSchemas.value);
|
|
260
290
|
!l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
261
291
|
length: t.length
|
|
262
292
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
|
|
@@ -272,14 +302,14 @@ class de {
|
|
|
272
302
|
const u = c.index, d = c.key, b = c.keyIndex;
|
|
273
303
|
if (l.isUndefined(c.stable))
|
|
274
304
|
return;
|
|
275
|
-
const V = i.parseStable(c.stable),
|
|
276
|
-
let
|
|
277
|
-
if (l.isProcessInprogress(
|
|
278
|
-
const
|
|
279
|
-
|
|
305
|
+
const V = i.parseStable(c.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
|
|
306
|
+
let y = V;
|
|
307
|
+
if (l.isProcessInprogress(y) || (o[b] = !0), s) {
|
|
308
|
+
const m = i.processedSchemas.value[I][g][u][d];
|
|
309
|
+
m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[I][g][u][d] = y, i.stableUpdater(o);
|
|
280
310
|
} else {
|
|
281
|
-
const
|
|
282
|
-
|
|
311
|
+
const m = i.processedSchemas.value[u][d];
|
|
312
|
+
m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[u][d] = y, i.stableUpdater(o);
|
|
283
313
|
}
|
|
284
314
|
}
|
|
285
315
|
}
|
|
@@ -321,13 +351,13 @@ class de {
|
|
|
321
351
|
return n(u);
|
|
322
352
|
this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
323
353
|
this.defaultValueInprogressMap.values()
|
|
324
|
-
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(),
|
|
354
|
+
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), F(() => {
|
|
325
355
|
c();
|
|
326
356
|
})) : n(u);
|
|
327
357
|
}) : this.fieldParser(t[i], (u) => {
|
|
328
358
|
this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
329
359
|
this.defaultValueInprogressMap.values()
|
|
330
|
-
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(),
|
|
360
|
+
).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), F(() => {
|
|
331
361
|
c();
|
|
332
362
|
})) : n(u);
|
|
333
363
|
});
|
|
@@ -342,11 +372,11 @@ class de {
|
|
|
342
372
|
}
|
|
343
373
|
promiseFieldParser(e, t, s) {
|
|
344
374
|
l.isPromise(e) ? e.then((i) => {
|
|
345
|
-
l.isString(i) && (i =
|
|
375
|
+
l.isString(i) && (i = L(i, "")), s && l.isObject(i) && !l.isNativeObject(i) ? this.objectParser({
|
|
346
376
|
data: i,
|
|
347
377
|
updater: t
|
|
348
378
|
}) : t(i);
|
|
349
|
-
}) : (l.isString(e) && (e =
|
|
379
|
+
}) : (l.isString(e) && (e = L(e, "")), s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
350
380
|
data: e,
|
|
351
381
|
updater: t
|
|
352
382
|
}) : t(e));
|
|
@@ -366,7 +396,7 @@ class de {
|
|
|
366
396
|
this.promiseFieldParser(i, t, s);
|
|
367
397
|
}
|
|
368
398
|
else
|
|
369
|
-
|
|
399
|
+
q(e) ? P(
|
|
370
400
|
() => e.value,
|
|
371
401
|
() => {
|
|
372
402
|
l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
|
|
@@ -378,7 +408,7 @@ class de {
|
|
|
378
408
|
immediate: !0,
|
|
379
409
|
deep: !0
|
|
380
410
|
}
|
|
381
|
-
) :
|
|
411
|
+
) : N(e) ? P(
|
|
382
412
|
() => e,
|
|
383
413
|
() => {
|
|
384
414
|
l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
|
|
@@ -398,7 +428,7 @@ class de {
|
|
|
398
428
|
modelProcessor(e) {
|
|
399
429
|
e.map(
|
|
400
430
|
(t) => this.createModel(t, this.processedModel.value)
|
|
401
|
-
), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel =
|
|
431
|
+
), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel = C(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects());
|
|
402
432
|
}
|
|
403
433
|
createModel(e, t) {
|
|
404
434
|
l.isListSchema(e) && (t[e.field] || (t[e.field] = [{}]), e.children.forEach((s) => {
|
|
@@ -408,7 +438,7 @@ class de {
|
|
|
408
438
|
}), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
|
|
409
439
|
}
|
|
410
440
|
}
|
|
411
|
-
class
|
|
441
|
+
class E {
|
|
412
442
|
static getFormContainer({ ui: e } = {}) {
|
|
413
443
|
return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
|
|
414
444
|
}
|
|
@@ -434,27 +464,27 @@ class pe {
|
|
|
434
464
|
}
|
|
435
465
|
getRuntimeField(e) {
|
|
436
466
|
var i;
|
|
437
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
467
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
|
|
438
468
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
439
469
|
}
|
|
440
470
|
getRuntimeRequired(e) {
|
|
441
471
|
var i;
|
|
442
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
472
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
|
|
443
473
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
444
474
|
}
|
|
445
475
|
getFormModelPropName() {
|
|
446
476
|
var s;
|
|
447
|
-
const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t =
|
|
477
|
+
const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = v.adapters[this.ui];
|
|
448
478
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
449
479
|
}
|
|
450
480
|
formComponentRenderer(e) {
|
|
451
481
|
var i;
|
|
452
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
482
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
|
|
453
483
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
454
484
|
}
|
|
455
485
|
clearValidate(e) {
|
|
456
486
|
var i;
|
|
457
|
-
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
487
|
+
const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
|
|
458
488
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
459
489
|
}
|
|
460
490
|
}
|
|
@@ -463,15 +493,15 @@ function he(r) {
|
|
|
463
493
|
}
|
|
464
494
|
class me {
|
|
465
495
|
constructor(e) {
|
|
466
|
-
a(this, "schemas",
|
|
467
|
-
a(this, "model",
|
|
496
|
+
a(this, "schemas", M([]));
|
|
497
|
+
a(this, "model", M({}));
|
|
468
498
|
a(this, "processorBySchemaType", {
|
|
469
499
|
item: this.runtimeItemProcessor.bind(this),
|
|
470
500
|
group: this.runtimeGroupProcessor.bind(this),
|
|
471
501
|
list: this.runtimeListProcessor.bind(this)
|
|
472
502
|
});
|
|
473
|
-
a(this, "formRef",
|
|
474
|
-
a(this, "hydrateEffect", new
|
|
503
|
+
a(this, "formRef", M(null));
|
|
504
|
+
a(this, "hydrateEffect", new _());
|
|
475
505
|
a(this, "native", oe({}));
|
|
476
506
|
a(this, "grid", {});
|
|
477
507
|
a(this, "runtime", {});
|
|
@@ -479,19 +509,20 @@ class me {
|
|
|
479
509
|
props: {},
|
|
480
510
|
slots: {}
|
|
481
511
|
});
|
|
512
|
+
a(this, "shared", {});
|
|
482
513
|
this.setup = e, this.processor = new de(this);
|
|
483
514
|
const t = this.setup(this);
|
|
484
|
-
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui),
|
|
485
|
-
const s =
|
|
486
|
-
this.processor.parseSchemas(t.schemas.value),
|
|
515
|
+
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), q(t.schemas)) {
|
|
516
|
+
const s = P(() => t.schemas, () => {
|
|
517
|
+
this.processor.parseSchemas(t.schemas.value), F(() => {
|
|
487
518
|
s();
|
|
488
519
|
});
|
|
489
520
|
}, {
|
|
490
521
|
deep: !0
|
|
491
522
|
});
|
|
492
|
-
} else if (
|
|
493
|
-
const s =
|
|
494
|
-
this.processor.parseSchemas(t.schemas),
|
|
523
|
+
} else if (N(t.schemas)) {
|
|
524
|
+
const s = P(() => t.schemas, () => {
|
|
525
|
+
this.processor.parseSchemas(t.schemas), F(() => {
|
|
495
526
|
s();
|
|
496
527
|
});
|
|
497
528
|
}, {
|
|
@@ -502,55 +533,56 @@ class me {
|
|
|
502
533
|
}
|
|
503
534
|
getRuntimeMeta() {
|
|
504
535
|
return {
|
|
505
|
-
model:
|
|
506
|
-
reactiveModel: this.model.value
|
|
536
|
+
model: S(C(this.model.value)),
|
|
537
|
+
reactiveModel: this.model.value,
|
|
538
|
+
shared: this.shared
|
|
507
539
|
};
|
|
508
540
|
}
|
|
509
541
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
510
|
-
var x, z, $, B, D, G, T,
|
|
511
|
-
const o =
|
|
542
|
+
var x, z, $, B, D, G, T, W, K, H, J, Q, X;
|
|
543
|
+
const o = S(e.component);
|
|
512
544
|
if (!o)
|
|
513
545
|
return;
|
|
514
|
-
|
|
515
|
-
const n =
|
|
546
|
+
h(this.globalNativeFormOverride.props, (z = (x = e.native) == null ? void 0 : x.props) == null ? void 0 : z.Form), h(this.globalNativeFormOverride.slots, (B = ($ = e.native) == null ? void 0 : $.slots) == null ? void 0 : B.Form);
|
|
547
|
+
const n = h(C((G = (D = this.native) == null ? void 0 : D.slots) == null ? void 0 : G.FormItem) ?? {}, (W = (T = e.native) == null ? void 0 : T.slots) == null ? void 0 : W.FormItem), c = {
|
|
516
548
|
display: "grid",
|
|
517
549
|
gridColumn: "1 / -1",
|
|
518
550
|
...e.grid
|
|
519
|
-
}, u =
|
|
551
|
+
}, u = 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({
|
|
520
552
|
schema: e,
|
|
521
553
|
parentSchema: i,
|
|
522
554
|
index: t
|
|
523
|
-
}), b = o.name, V = e.componentProps ?? {},
|
|
524
|
-
let
|
|
525
|
-
|
|
526
|
-
let
|
|
555
|
+
}), b = o.name, V = e.componentProps ?? {}, I = v.placeholderPresetByComponentName;
|
|
556
|
+
let g = e.placeholder, y = e.show;
|
|
557
|
+
y === void 0 && (y = !0), y || delete s[e.field];
|
|
558
|
+
let m = e.label ?? "";
|
|
527
559
|
const j = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
528
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(j) && (
|
|
529
|
-
let
|
|
530
|
-
l.isUndefined(b) ?
|
|
531
|
-
|
|
532
|
-
b.toLowerCase().includes(Y.toLowerCase()) && (
|
|
533
|
-
}),
|
|
560
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(j) && (m = L((X = j == null ? void 0 : j.customizeItemLabel) == null ? void 0 : X.call(j, e.label ?? "", t + 1), "")), !g) {
|
|
561
|
+
let R = "请输入";
|
|
562
|
+
l.isUndefined(b) ? g = `${R}${m}` : /* @ts-expect-error */ I[b.toLowerCase()] ? (R = // @ts-expect-error
|
|
563
|
+
I[b.toLowerCase()], g = `${R}${m}`) : (Object.keys(I).forEach((Y) => {
|
|
564
|
+
b.toLowerCase().includes(Y.toLowerCase()) && (R = I[Y]);
|
|
565
|
+
}), g = `${R}${m}`);
|
|
534
566
|
}
|
|
535
567
|
const Z = this.runtimeAdapter.getRuntimeRequired({
|
|
536
568
|
...e,
|
|
537
|
-
label:
|
|
538
|
-
}), A =
|
|
569
|
+
label: m
|
|
570
|
+
}), A = E.getItemContainer(this), ee = E.getFormItemContainer(this), te = this, se = e.componentSlots;
|
|
539
571
|
return p("div", {
|
|
540
572
|
style: c
|
|
541
573
|
}, [p(A, {
|
|
542
|
-
show:
|
|
574
|
+
show: y
|
|
543
575
|
}, {
|
|
544
576
|
default() {
|
|
545
|
-
return
|
|
546
|
-
label: `${
|
|
577
|
+
return y && p(ee, O(u, {
|
|
578
|
+
label: `${m ? `${m}:` : ""}`
|
|
547
579
|
}, d, Z), {
|
|
548
580
|
default() {
|
|
549
581
|
return te.runtimeAdapter.formComponentRenderer({
|
|
550
582
|
Component: o,
|
|
551
583
|
schema: e,
|
|
552
584
|
baseModel: s,
|
|
553
|
-
placeholder:
|
|
585
|
+
placeholder: g,
|
|
554
586
|
componentSlots: se,
|
|
555
587
|
props: V
|
|
556
588
|
});
|
|
@@ -566,7 +598,7 @@ class me {
|
|
|
566
598
|
display: "grid",
|
|
567
599
|
gridColumn: "1 / -1",
|
|
568
600
|
...e.grid
|
|
569
|
-
}, i =
|
|
601
|
+
}, i = E.getGroupContainer(this);
|
|
570
602
|
let o = e.show;
|
|
571
603
|
return o === void 0 && (o = !0), p("div", {
|
|
572
604
|
style: s
|
|
@@ -583,7 +615,7 @@ class me {
|
|
|
583
615
|
code: "0001",
|
|
584
616
|
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
585
617
|
});
|
|
586
|
-
(s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(
|
|
618
|
+
(s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(C(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
|
|
587
619
|
}
|
|
588
620
|
deleteListItem(e, t) {
|
|
589
621
|
this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
|
|
@@ -597,7 +629,7 @@ class me {
|
|
|
597
629
|
s.model.value[e.field] || (s.model.value[e.field] = [{}]);
|
|
598
630
|
let i = e.show;
|
|
599
631
|
i === void 0 && (i = !0);
|
|
600
|
-
const o =
|
|
632
|
+
const o = E.getListContainer(this), n = E.getListItemContainer(this);
|
|
601
633
|
return p("div", {
|
|
602
634
|
style: t
|
|
603
635
|
}, [i && p(o, {
|
|
@@ -639,8 +671,8 @@ class me {
|
|
|
639
671
|
gridColumn: "1 / -1",
|
|
640
672
|
gridAutoColumns: "1fr",
|
|
641
673
|
...this.grid
|
|
642
|
-
}, t = this, s =
|
|
643
|
-
return p(o,
|
|
674
|
+
}, t = this, s = h(C((u = (c = this.native) == null ? void 0 : c.props) == null ? void 0 : u.Form) ?? {}, this.globalNativeFormOverride.props), i = h(C((b = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : b.Form) ?? {}, this.globalNativeFormOverride.slots), o = E.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
675
|
+
return p(o, O(s, {
|
|
644
676
|
ref: this.formRef
|
|
645
677
|
}, {
|
|
646
678
|
[n]: this.model.value
|
|
@@ -657,7 +689,7 @@ class me {
|
|
|
657
689
|
class f {
|
|
658
690
|
}
|
|
659
691
|
a(f, "presets");
|
|
660
|
-
function
|
|
692
|
+
function U({
|
|
661
693
|
parentSchema: r,
|
|
662
694
|
schema: e,
|
|
663
695
|
index: t
|
|
@@ -668,7 +700,7 @@ const ye = {
|
|
|
668
700
|
ArcoVue: {
|
|
669
701
|
getRuntimeField(r) {
|
|
670
702
|
return {
|
|
671
|
-
field:
|
|
703
|
+
field: U(r)
|
|
672
704
|
};
|
|
673
705
|
},
|
|
674
706
|
getRuntimeRequired(r) {
|
|
@@ -702,7 +734,7 @@ const ye = {
|
|
|
702
734
|
componentSlots: i,
|
|
703
735
|
props: o
|
|
704
736
|
}) {
|
|
705
|
-
return p(r,
|
|
737
|
+
return p(r, O({
|
|
706
738
|
modelValue: e[t.field],
|
|
707
739
|
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
708
740
|
placeholder: s
|
|
@@ -712,7 +744,7 @@ const ye = {
|
|
|
712
744
|
},
|
|
713
745
|
validateForm(r) {
|
|
714
746
|
return new Promise((e, t) => {
|
|
715
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
747
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
|
|
716
748
|
});
|
|
717
749
|
},
|
|
718
750
|
clearValidate(r) {
|
|
@@ -722,7 +754,7 @@ const ye = {
|
|
|
722
754
|
NutUI: {
|
|
723
755
|
getRuntimeField(r) {
|
|
724
756
|
return {
|
|
725
|
-
prop:
|
|
757
|
+
prop: U(r)
|
|
726
758
|
};
|
|
727
759
|
},
|
|
728
760
|
getRuntimeRequired(r) {
|
|
@@ -757,7 +789,7 @@ const ye = {
|
|
|
757
789
|
componentSlots: i,
|
|
758
790
|
props: o
|
|
759
791
|
}) {
|
|
760
|
-
return p(r,
|
|
792
|
+
return p(r, O({
|
|
761
793
|
modelValue: e[t.field],
|
|
762
794
|
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
763
795
|
placeholder: s
|
|
@@ -771,7 +803,7 @@ const ye = {
|
|
|
771
803
|
valid: s,
|
|
772
804
|
errors: i
|
|
773
805
|
}) => {
|
|
774
|
-
s ? e(r.cleanFallbackFields(
|
|
806
|
+
s ? e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))) : t(i);
|
|
775
807
|
});
|
|
776
808
|
});
|
|
777
809
|
},
|
|
@@ -782,7 +814,7 @@ const ye = {
|
|
|
782
814
|
NaiveUI: {
|
|
783
815
|
getRuntimeField(r) {
|
|
784
816
|
return {
|
|
785
|
-
path:
|
|
817
|
+
path: U(r)
|
|
786
818
|
};
|
|
787
819
|
},
|
|
788
820
|
getRuntimeRequired(r) {
|
|
@@ -817,7 +849,7 @@ const ye = {
|
|
|
817
849
|
componentSlots: i,
|
|
818
850
|
props: o
|
|
819
851
|
}) {
|
|
820
|
-
return p(r,
|
|
852
|
+
return p(r, O({
|
|
821
853
|
value: e[t.field],
|
|
822
854
|
"onUpdate:value": (n) => e[t.field] = n,
|
|
823
855
|
placeholder: s
|
|
@@ -827,14 +859,14 @@ const ye = {
|
|
|
827
859
|
},
|
|
828
860
|
validateForm(r) {
|
|
829
861
|
return new Promise((e, t) => {
|
|
830
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
862
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
|
|
831
863
|
});
|
|
832
864
|
},
|
|
833
865
|
clearValidate(r) {
|
|
834
866
|
r.formRef.value.restoreValidation();
|
|
835
867
|
}
|
|
836
868
|
}
|
|
837
|
-
},
|
|
869
|
+
}, w = class w {
|
|
838
870
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
839
871
|
const e = {
|
|
840
872
|
请选择: ["select", "tree"],
|
|
@@ -847,7 +879,7 @@ const ye = {
|
|
|
847
879
|
return t;
|
|
848
880
|
}
|
|
849
881
|
};
|
|
850
|
-
a(
|
|
882
|
+
a(w, "schemaPreset", {
|
|
851
883
|
type: {
|
|
852
884
|
defaultValue: "item"
|
|
853
885
|
},
|
|
@@ -890,15 +922,15 @@ a(S, "schemaPreset", {
|
|
|
890
922
|
grid: {
|
|
891
923
|
default: void 0
|
|
892
924
|
}
|
|
893
|
-
}), a(
|
|
925
|
+
}), a(w, "componentPropsPreset", {
|
|
894
926
|
options: {
|
|
895
927
|
defaultValue: []
|
|
896
928
|
}
|
|
897
929
|
}), // 基于基本功能提出基本预设
|
|
898
|
-
a(
|
|
899
|
-
let
|
|
900
|
-
const
|
|
901
|
-
...
|
|
930
|
+
a(w, "placeholderPresetByComponentName", w.getPlaceholderPrefixPresetByComponentName());
|
|
931
|
+
let k = w;
|
|
932
|
+
const v = {
|
|
933
|
+
...k,
|
|
902
934
|
adapters: {
|
|
903
935
|
...ye
|
|
904
936
|
}
|
|
@@ -920,7 +952,8 @@ function Ce(r) {
|
|
|
920
952
|
e.setup.bind(e),
|
|
921
953
|
{
|
|
922
954
|
submit: e.submit.bind(e),
|
|
923
|
-
hydrate: e.hydrate.bind(e)
|
|
955
|
+
hydrate: e.hydrate.bind(e),
|
|
956
|
+
share: e.share.bind(e)
|
|
924
957
|
}
|
|
925
958
|
];
|
|
926
959
|
}
|
|
@@ -20,10 +20,12 @@ export default class RuntimeCore {
|
|
|
20
20
|
};
|
|
21
21
|
ui: string;
|
|
22
22
|
runtimeAdapter: RuntimeAdpter;
|
|
23
|
+
shared: AnyObject;
|
|
23
24
|
constructor(setup: Setup);
|
|
24
25
|
getRuntimeMeta(): {
|
|
25
26
|
model: AnyObject;
|
|
26
27
|
reactiveModel: AnyObject;
|
|
28
|
+
shared: AnyObject;
|
|
27
29
|
};
|
|
28
30
|
runtimeItemProcessor(schema: ItemSchema, index?: number, baseModel?: AnyObject, parentSchema?: ListSchema): JSX.Element | undefined;
|
|
29
31
|
runtimeGroupProcessor(schema: GroupSchema): JSX.Element;
|
|
@@ -88,6 +88,7 @@ export type Schema = ItemSchema | GroupSchema | ListSchema;
|
|
|
88
88
|
export interface runtimeMeta {
|
|
89
89
|
model: AnyObject;
|
|
90
90
|
reactiveModel: AnyObject;
|
|
91
|
+
shared: AnyObject;
|
|
91
92
|
}
|
|
92
93
|
export type ProFormProxyRule<T> = T | ((runtimeMeta: runtimeMeta) => T) | ((runtimeMeta: runtimeMeta) => Promise<T>);
|
|
93
94
|
export type ProFormProxy<T> = {
|