@harbor-design/proform 1.1.31 → 1.1.32

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 _, 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";
4
+ import { isRef as O, watch as P, isReactive as q, toRaw as S, nextTick as N, ref as M, 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);
@@ -66,18 +66,18 @@ class l {
66
66
  return !!e.__proform_raw_object;
67
67
  }
68
68
  }
69
- function y(r, ...e) {
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] = y(Array.isArray(s) ? [] : {}, s) : r[i] = s;
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] = y(r[s] || {}, t[s]) : r[s] = t[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 g(r) {
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 M(r, e) {
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 = P.adapters[this.runtimeCore.ui];
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,54 @@ class fe {
145
145
  });
146
146
  this.runtimeCore.hydrateEffect.trackEffect(
147
147
  () => {
148
- _(e) ? I(
148
+ O(e) ? P(
149
149
  () => e.value,
150
150
  () => {
151
- y(this.runtimeCore.model.value, e.value);
151
+ h(this.runtimeCore.model.value, e.value);
152
152
  },
153
153
  {
154
154
  deep: !0,
155
155
  immediate: !0
156
156
  }
157
- ) : k(e) ? I(
157
+ ) : q(e) ? P(
158
158
  () => e,
159
159
  () => {
160
- y(this.runtimeCore.model.value, e);
160
+ h(this.runtimeCore.model.value, e);
161
161
  },
162
162
  {
163
163
  deep: !0,
164
164
  immediate: !0
165
165
  }
166
- ) : y(this.runtimeCore.model.value, e);
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
+ O(e) ? P(
175
+ () => e.value,
176
+ () => {
177
+ h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects();
178
+ },
179
+ {
180
+ deep: !0,
181
+ immediate: !0
182
+ }
183
+ ) : q(e) ? P(
184
+ () => e,
185
+ () => {
186
+ h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
187
+ },
188
+ {
189
+ deep: !0,
190
+ immediate: !0
191
+ }
192
+ ) : (h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects());
193
+ }
173
194
  }
174
- class U {
195
+ class _ {
175
196
  constructor() {
176
197
  a(this, "effects", /* @__PURE__ */ new Set());
177
198
  }
@@ -195,16 +216,16 @@ class de {
195
216
  a(this, "getRuntimeMeta");
196
217
  a(this, "stableSchemas", []);
197
218
  a(this, "stableModel", {});
198
- a(this, "schemaPreset", P.schemaPreset);
199
- a(this, "componentPropsPreset", P.componentPropsPreset);
219
+ a(this, "schemaPreset", v.schemaPreset);
220
+ a(this, "componentPropsPreset", v.componentPropsPreset);
200
221
  a(this, "stableUpdaterProcessProgress");
201
222
  a(this, "stableUpdaterTimes", 0);
202
- a(this, "schemaEffect", new U());
203
- a(this, "defaultValueEffect", new U());
223
+ a(this, "schemaEffect", new _());
224
+ a(this, "defaultValueEffect", new _());
204
225
  a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
205
226
  a(this, "baseDefaultValueFunctionsLength");
206
227
  a(this, "isModelInitialized", !0);
207
- this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), I(
228
+ this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), P(
208
229
  () => this.processedModel.value,
209
230
  () => {
210
231
  this.schemaEffect.triggerEffects();
@@ -242,7 +263,7 @@ class de {
242
263
  // 派生过程,用于外部应用
243
264
  parseSchemas(e, t) {
244
265
  l.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
245
- g(e)
266
+ C(e)
246
267
  ), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
247
268
  }
248
269
  parseStable(e) {
@@ -256,7 +277,7 @@ class de {
256
277
  // 对于稳定初始化更新的抽象
257
278
  stableUpdater(e = []) {
258
279
  if (e.every(Boolean)) {
259
- const t = F(this.processedSchemas.value);
280
+ const t = S(this.processedSchemas.value);
260
281
  !l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
261
282
  length: t.length
262
283
  }).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
@@ -272,14 +293,14 @@ class de {
272
293
  const u = c.index, d = c.key, b = c.keyIndex;
273
294
  if (l.isUndefined(c.stable))
274
295
  return;
275
- const V = i.parseStable(c.stable), C = s == null ? void 0 : s.index, v = s == null ? void 0 : s.key;
276
- let m = V;
277
- if (l.isProcessInprogress(m) || (o[b] = !0), s) {
278
- const h = i.processedSchemas.value[C][v][u][d];
279
- h && l.isObject(h) && d !== "component" && (m = y(h, m)), i.processedSchemas.value[C][v][u][d] = m, i.stableUpdater(o);
296
+ const V = i.parseStable(c.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
297
+ let y = V;
298
+ if (l.isProcessInprogress(y) || (o[b] = !0), s) {
299
+ const m = i.processedSchemas.value[I][g][u][d];
300
+ m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[I][g][u][d] = y, i.stableUpdater(o);
280
301
  } else {
281
- const h = i.processedSchemas.value[u][d];
282
- h && l.isObject(h) && d !== "component" && (m = y(h, m)), i.processedSchemas.value[u][d] = m, i.stableUpdater(o);
302
+ const m = i.processedSchemas.value[u][d];
303
+ m && l.isObject(m) && d !== "component" && (y = h(m, y)), i.processedSchemas.value[u][d] = y, i.stableUpdater(o);
283
304
  }
284
305
  }
285
306
  }
@@ -321,13 +342,13 @@ class de {
321
342
  return n(u);
322
343
  this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
323
344
  this.defaultValueInprogressMap.values()
324
- ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
345
+ ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), N(() => {
325
346
  c();
326
347
  })) : n(u);
327
348
  }) : this.fieldParser(t[i], (u) => {
328
349
  this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
329
350
  this.defaultValueInprogressMap.values()
330
- ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
351
+ ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), N(() => {
331
352
  c();
332
353
  })) : n(u);
333
354
  });
@@ -342,11 +363,11 @@ class de {
342
363
  }
343
364
  promiseFieldParser(e, t, s) {
344
365
  l.isPromise(e) ? e.then((i) => {
345
- l.isString(i) && (i = M(i, "")), s && l.isObject(i) && !l.isNativeObject(i) ? this.objectParser({
366
+ l.isString(i) && (i = L(i, "")), s && l.isObject(i) && !l.isNativeObject(i) ? this.objectParser({
346
367
  data: i,
347
368
  updater: t
348
369
  }) : t(i);
349
- }) : (l.isString(e) && (e = M(e, "")), s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
370
+ }) : (l.isString(e) && (e = L(e, "")), s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
350
371
  data: e,
351
372
  updater: t
352
373
  }) : t(e));
@@ -366,7 +387,7 @@ class de {
366
387
  this.promiseFieldParser(i, t, s);
367
388
  }
368
389
  else
369
- _(e) ? I(
390
+ O(e) ? P(
370
391
  () => e.value,
371
392
  () => {
372
393
  l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
@@ -378,7 +399,7 @@ class de {
378
399
  immediate: !0,
379
400
  deep: !0
380
401
  }
381
- ) : k(e) ? I(
402
+ ) : q(e) ? P(
382
403
  () => e,
383
404
  () => {
384
405
  l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
@@ -398,7 +419,7 @@ class de {
398
419
  modelProcessor(e) {
399
420
  e.map(
400
421
  (t) => this.createModel(t, this.processedModel.value)
401
- ), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel = g(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects());
422
+ ), 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
423
  }
403
424
  createModel(e, t) {
404
425
  l.isListSchema(e) && (t[e.field] || (t[e.field] = [{}]), e.children.forEach((s) => {
@@ -408,7 +429,7 @@ class de {
408
429
  }), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
409
430
  }
410
431
  }
411
- class w {
432
+ class E {
412
433
  static getFormContainer({ ui: e } = {}) {
413
434
  return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
414
435
  }
@@ -434,27 +455,27 @@ class pe {
434
455
  }
435
456
  getRuntimeField(e) {
436
457
  var i;
437
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
458
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
438
459
  return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
439
460
  }
440
461
  getRuntimeRequired(e) {
441
462
  var i;
442
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
463
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
443
464
  return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
444
465
  }
445
466
  getFormModelPropName() {
446
467
  var s;
447
- const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = P.adapters[this.ui];
468
+ const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = v.adapters[this.ui];
448
469
  return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
449
470
  }
450
471
  formComponentRenderer(e) {
451
472
  var i;
452
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
473
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
453
474
  return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
454
475
  }
455
476
  clearValidate(e) {
456
477
  var i;
457
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[this.ui];
478
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
458
479
  return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
459
480
  }
460
481
  }
@@ -463,15 +484,15 @@ function he(r) {
463
484
  }
464
485
  class me {
465
486
  constructor(e) {
466
- a(this, "schemas", q([]));
467
- a(this, "model", q({}));
487
+ a(this, "schemas", M([]));
488
+ a(this, "model", M({}));
468
489
  a(this, "processorBySchemaType", {
469
490
  item: this.runtimeItemProcessor.bind(this),
470
491
  group: this.runtimeGroupProcessor.bind(this),
471
492
  list: this.runtimeListProcessor.bind(this)
472
493
  });
473
- a(this, "formRef", q(null));
474
- a(this, "hydrateEffect", new U());
494
+ a(this, "formRef", M(null));
495
+ a(this, "hydrateEffect", new _());
475
496
  a(this, "native", oe({}));
476
497
  a(this, "grid", {});
477
498
  a(this, "runtime", {});
@@ -479,19 +500,20 @@ class me {
479
500
  props: {},
480
501
  slots: {}
481
502
  });
503
+ a(this, "shared", {});
482
504
  this.setup = e, this.processor = new de(this);
483
505
  const t = this.setup(this);
484
- if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), _(t.schemas)) {
485
- const s = I(() => t.schemas, () => {
486
- this.processor.parseSchemas(t.schemas.value), O(() => {
506
+ if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), O(t.schemas)) {
507
+ const s = P(() => t.schemas, () => {
508
+ this.processor.parseSchemas(t.schemas.value), N(() => {
487
509
  s();
488
510
  });
489
511
  }, {
490
512
  deep: !0
491
513
  });
492
- } else if (k(t.schemas)) {
493
- const s = I(() => t.schemas, () => {
494
- this.processor.parseSchemas(t.schemas), O(() => {
514
+ } else if (q(t.schemas)) {
515
+ const s = P(() => t.schemas, () => {
516
+ this.processor.parseSchemas(t.schemas), N(() => {
495
517
  s();
496
518
  });
497
519
  }, {
@@ -502,55 +524,56 @@ class me {
502
524
  }
503
525
  getRuntimeMeta() {
504
526
  return {
505
- model: F(g(this.model.value)),
506
- reactiveModel: this.model.value
527
+ model: S(C(this.model.value)),
528
+ reactiveModel: this.model.value,
529
+ shared: this.shared
507
530
  };
508
531
  }
509
532
  runtimeItemProcessor(e, t, s = this.model.value, i) {
510
533
  var x, z, $, B, D, G, T, K, W, H, J, Q, X;
511
- const o = F(e.component);
534
+ const o = S(e.component);
512
535
  if (!o)
513
536
  return;
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 = {
537
+ 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);
538
+ const n = h(C((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 = {
516
539
  display: "grid",
517
540
  gridColumn: "1 / -1",
518
541
  ...e.grid
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({
542
+ }, u = h(C((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({
520
543
  schema: e,
521
544
  parentSchema: i,
522
545
  index: t
523
- }), b = o.name, V = e.componentProps ?? {}, C = P.placeholderPresetByComponentName;
524
- let v = e.placeholder, m = e.show;
525
- m === void 0 && (m = !0), m || delete s[e.field];
526
- let h = e.label ?? "";
546
+ }), b = o.name, V = e.componentProps ?? {}, I = v.placeholderPresetByComponentName;
547
+ let g = e.placeholder, y = e.show;
548
+ y === void 0 && (y = !0), y || delete s[e.field];
549
+ let m = e.label ?? "";
527
550
  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) {
529
- let E = "请输入";
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]);
533
- }), v = `${E}${h}`);
551
+ 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) {
552
+ let F = "请输入";
553
+ l.isUndefined(b) ? g = `${F}${m}` : /* @ts-expect-error */ I[b.toLowerCase()] ? (F = // @ts-expect-error
554
+ I[b.toLowerCase()], g = `${F}${m}`) : (Object.keys(I).forEach((Y) => {
555
+ b.toLowerCase().includes(Y.toLowerCase()) && (F = I[Y]);
556
+ }), g = `${F}${m}`);
534
557
  }
535
558
  const Z = this.runtimeAdapter.getRuntimeRequired({
536
559
  ...e,
537
- label: h
538
- }), A = w.getItemContainer(this), ee = w.getFormItemContainer(this), te = this, se = e.componentSlots;
560
+ label: m
561
+ }), A = E.getItemContainer(this), ee = E.getFormItemContainer(this), te = this, se = e.componentSlots;
539
562
  return p("div", {
540
563
  style: c
541
564
  }, [p(A, {
542
- show: m
565
+ show: y
543
566
  }, {
544
567
  default() {
545
- return m && p(ee, R(u, {
546
- label: `${h ? `${h}:` : ""}`
568
+ return y && p(ee, R(u, {
569
+ label: `${m ? `${m}:` : ""}`
547
570
  }, d, Z), {
548
571
  default() {
549
572
  return te.runtimeAdapter.formComponentRenderer({
550
573
  Component: o,
551
574
  schema: e,
552
575
  baseModel: s,
553
- placeholder: v,
576
+ placeholder: g,
554
577
  componentSlots: se,
555
578
  props: V
556
579
  });
@@ -566,7 +589,7 @@ class me {
566
589
  display: "grid",
567
590
  gridColumn: "1 / -1",
568
591
  ...e.grid
569
- }, i = w.getGroupContainer(this);
592
+ }, i = E.getGroupContainer(this);
570
593
  let o = e.show;
571
594
  return o === void 0 && (o = !0), p("div", {
572
595
  style: s
@@ -583,7 +606,7 @@ class me {
583
606
  code: "0001",
584
607
  message: "异步默认值数据正在处理中,请您耐心等待... "
585
608
  });
586
- (s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(g(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
609
+ (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
610
  }
588
611
  deleteListItem(e, t) {
589
612
  this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
@@ -597,7 +620,7 @@ class me {
597
620
  s.model.value[e.field] || (s.model.value[e.field] = [{}]);
598
621
  let i = e.show;
599
622
  i === void 0 && (i = !0);
600
- const o = w.getListContainer(this), n = w.getListItemContainer(this);
623
+ const o = E.getListContainer(this), n = E.getListItemContainer(this);
601
624
  return p("div", {
602
625
  style: t
603
626
  }, [i && p(o, {
@@ -639,7 +662,7 @@ class me {
639
662
  gridColumn: "1 / -1",
640
663
  gridAutoColumns: "1fr",
641
664
  ...this.grid
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();
665
+ }, 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();
643
666
  return p(o, R(s, {
644
667
  ref: this.formRef
645
668
  }, {
@@ -657,7 +680,7 @@ class me {
657
680
  class f {
658
681
  }
659
682
  a(f, "presets");
660
- function N({
683
+ function U({
661
684
  parentSchema: r,
662
685
  schema: e,
663
686
  index: t
@@ -668,7 +691,7 @@ const ye = {
668
691
  ArcoVue: {
669
692
  getRuntimeField(r) {
670
693
  return {
671
- field: N(r)
694
+ field: U(r)
672
695
  };
673
696
  },
674
697
  getRuntimeRequired(r) {
@@ -712,7 +735,7 @@ const ye = {
712
735
  },
713
736
  validateForm(r) {
714
737
  return new Promise((e, t) => {
715
- r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(F(r.runtimeCore.processor.processedModel.value))));
738
+ r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
716
739
  });
717
740
  },
718
741
  clearValidate(r) {
@@ -722,7 +745,7 @@ const ye = {
722
745
  NutUI: {
723
746
  getRuntimeField(r) {
724
747
  return {
725
- prop: N(r)
748
+ prop: U(r)
726
749
  };
727
750
  },
728
751
  getRuntimeRequired(r) {
@@ -771,7 +794,7 @@ const ye = {
771
794
  valid: s,
772
795
  errors: i
773
796
  }) => {
774
- s ? e(r.cleanFallbackFields(F(r.runtimeCore.processor.processedModel.value))) : t(i);
797
+ s ? e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))) : t(i);
775
798
  });
776
799
  });
777
800
  },
@@ -782,7 +805,7 @@ const ye = {
782
805
  NaiveUI: {
783
806
  getRuntimeField(r) {
784
807
  return {
785
- path: N(r)
808
+ path: U(r)
786
809
  };
787
810
  },
788
811
  getRuntimeRequired(r) {
@@ -827,14 +850,14 @@ const ye = {
827
850
  },
828
851
  validateForm(r) {
829
852
  return new Promise((e, t) => {
830
- r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(F(r.runtimeCore.processor.processedModel.value))));
853
+ r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
831
854
  });
832
855
  },
833
856
  clearValidate(r) {
834
857
  r.formRef.value.restoreValidation();
835
858
  }
836
859
  }
837
- }, S = class S {
860
+ }, w = class w {
838
861
  static getPlaceholderPrefixPresetByComponentName() {
839
862
  const e = {
840
863
  请选择: ["select", "tree"],
@@ -847,7 +870,7 @@ const ye = {
847
870
  return t;
848
871
  }
849
872
  };
850
- a(S, "schemaPreset", {
873
+ a(w, "schemaPreset", {
851
874
  type: {
852
875
  defaultValue: "item"
853
876
  },
@@ -890,15 +913,15 @@ a(S, "schemaPreset", {
890
913
  grid: {
891
914
  default: void 0
892
915
  }
893
- }), a(S, "componentPropsPreset", {
916
+ }), a(w, "componentPropsPreset", {
894
917
  options: {
895
918
  defaultValue: []
896
919
  }
897
920
  }), // 基于基本功能提出基本预设
898
- a(S, "placeholderPresetByComponentName", S.getPlaceholderPrefixPresetByComponentName());
899
- let L = S;
900
- const P = {
901
- ...L,
921
+ a(w, "placeholderPresetByComponentName", w.getPlaceholderPrefixPresetByComponentName());
922
+ let k = w;
923
+ const v = {
924
+ ...k,
902
925
  adapters: {
903
926
  ...ye
904
927
  }
@@ -920,7 +943,8 @@ function Ce(r) {
920
943
  e.setup.bind(e),
921
944
  {
922
945
  submit: e.submit.bind(e),
923
- hydrate: e.hydrate.bind(e)
946
+ hydrate: e.hydrate.bind(e),
947
+ share: e.share.bind(e)
924
948
  }
925
949
  ];
926
950
  }
@@ -8,4 +8,5 @@ export default class FormCustomizer {
8
8
  setup(_runtimeCore: RuntimeCore): FormCustomization;
9
9
  submit(): Promise<AnyObject>;
10
10
  hydrate(data: AnyObject): Promise<never> | undefined;
11
+ share(data: AnyObject): void;
11
12
  }
@@ -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> = {
@@ -6,5 +6,6 @@ export type UseForm = [
6
6
  {
7
7
  submit: () => Promise<AnyObject>;
8
8
  hydrate: (data: AnyObject) => any;
9
+ share: (data: AnyObject) => any;
9
10
  }
10
11
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.1.31",
3
+ "version": "1.1.32",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",