@harbor-design/proform 1.1.30 → 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 x, watch as I, isReactive as z, toRaw as w, 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);
@@ -62,19 +62,22 @@ class l {
62
62
  }
63
63
  return !1;
64
64
  }
65
+ static isNativeObject(e) {
66
+ return !!e.__proform_raw_object;
67
+ }
65
68
  }
66
- function y(r, ...e) {
69
+ function h(r, ...e) {
67
70
  return e.forEach((t) => {
68
71
  if (Array.isArray(t))
69
72
  Array.isArray(r) || (r = []), t.forEach((s, i) => {
70
- 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;
71
74
  });
72
75
  else
73
76
  for (const s in t)
74
- 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]);
75
78
  }), r;
76
79
  }
77
- function g(r) {
80
+ function C(r) {
78
81
  const e = /* @__PURE__ */ new WeakMap();
79
82
  function t(s) {
80
83
  if (s === null || typeof s != "object")
@@ -112,7 +115,7 @@ function g(r) {
112
115
  }
113
116
  return t(r);
114
117
  }
115
- function U(r, e) {
118
+ function L(r, e) {
116
119
  return r.replace(/undefined/g, e);
117
120
  }
118
121
  class fe {
@@ -131,7 +134,7 @@ class fe {
131
134
  }
132
135
  submit() {
133
136
  var s;
134
- const e = (s = f.presets.uiPresets[this.runtimeCore.ui]) == null ? void 0 : s.adapter, t = b.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];
135
138
  return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
136
139
  }
137
140
  hydrate(e) {
@@ -142,33 +145,54 @@ class fe {
142
145
  });
143
146
  this.runtimeCore.hydrateEffect.trackEffect(
144
147
  () => {
145
- x(e) ? I(
148
+ O(e) ? P(
146
149
  () => e.value,
147
150
  () => {
148
- y(this.runtimeCore.model.value, e.value);
151
+ h(this.runtimeCore.model.value, e.value);
149
152
  },
150
153
  {
151
154
  deep: !0,
152
155
  immediate: !0
153
156
  }
154
- ) : z(e) ? I(
157
+ ) : q(e) ? P(
155
158
  () => e,
156
159
  () => {
157
- y(this.runtimeCore.model.value, e);
160
+ h(this.runtimeCore.model.value, e);
158
161
  },
159
162
  {
160
163
  deep: !0,
161
164
  immediate: !0
162
165
  }
163
- ) : y(this.runtimeCore.model.value, e);
166
+ ) : h(this.runtimeCore.model.value, e);
164
167
  },
165
168
  {
166
169
  lazy: !0
167
170
  }
168
171
  );
169
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
+ }
170
194
  }
171
- class N {
195
+ class _ {
172
196
  constructor() {
173
197
  a(this, "effects", /* @__PURE__ */ new Set());
174
198
  }
@@ -192,16 +216,16 @@ class de {
192
216
  a(this, "getRuntimeMeta");
193
217
  a(this, "stableSchemas", []);
194
218
  a(this, "stableModel", {});
195
- a(this, "schemaPreset", b.schemaPreset);
196
- a(this, "componentPropsPreset", b.componentPropsPreset);
219
+ a(this, "schemaPreset", v.schemaPreset);
220
+ a(this, "componentPropsPreset", v.componentPropsPreset);
197
221
  a(this, "stableUpdaterProcessProgress");
198
222
  a(this, "stableUpdaterTimes", 0);
199
- a(this, "schemaEffect", new N());
200
- a(this, "defaultValueEffect", new N());
223
+ a(this, "schemaEffect", new _());
224
+ a(this, "defaultValueEffect", new _());
201
225
  a(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
202
226
  a(this, "baseDefaultValueFunctionsLength");
203
227
  a(this, "isModelInitialized", !0);
204
- 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(
205
229
  () => this.processedModel.value,
206
230
  () => {
207
231
  this.schemaEffect.triggerEffects();
@@ -239,7 +263,7 @@ class de {
239
263
  // 派生过程,用于外部应用
240
264
  parseSchemas(e, t) {
241
265
  l.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
242
- g(e)
266
+ C(e)
243
267
  ), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
244
268
  }
245
269
  parseStable(e) {
@@ -253,7 +277,7 @@ class de {
253
277
  // 对于稳定初始化更新的抽象
254
278
  stableUpdater(e = []) {
255
279
  if (e.every(Boolean)) {
256
- const t = w(this.processedSchemas.value);
280
+ const t = S(this.processedSchemas.value);
257
281
  !l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
258
282
  length: t.length
259
283
  }).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
@@ -266,17 +290,17 @@ class de {
266
290
  }).fill(!1);
267
291
  this.objectParser({ data: e, index: t, updater: n });
268
292
  function n(c) {
269
- const u = c.index, d = c.key, P = c.keyIndex;
293
+ const u = c.index, d = c.key, b = c.keyIndex;
270
294
  if (l.isUndefined(c.stable))
271
295
  return;
272
- const V = i.parseStable(c.stable), C = s == null ? void 0 : s.index, v = s == null ? void 0 : s.key;
273
- let m = V;
274
- if (l.isProcessInprogress(m) || (o[P] = !0), s) {
275
- const h = i.processedSchemas.value[C][v][u][d];
276
- 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);
277
301
  } else {
278
- const h = i.processedSchemas.value[u][d];
279
- 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);
280
304
  }
281
305
  }
282
306
  }
@@ -318,13 +342,13 @@ class de {
318
342
  return n(u);
319
343
  this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
320
344
  this.defaultValueInprogressMap.values()
321
- ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
345
+ ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), N(() => {
322
346
  c();
323
347
  })) : n(u);
324
348
  }) : this.fieldParser(t[i], (u) => {
325
349
  this.defaultValueInprogressMap.set(t[i], u), !l.isProcessInprogress(u) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
326
350
  this.defaultValueInprogressMap.values()
327
- ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), O(() => {
351
+ ).every((d) => !d.includes("undefined")) ? (n(u), this.defaultValueEffect.clearEffects(), N(() => {
328
352
  c();
329
353
  })) : n(u);
330
354
  });
@@ -339,11 +363,11 @@ class de {
339
363
  }
340
364
  promiseFieldParser(e, t, s) {
341
365
  l.isPromise(e) ? e.then((i) => {
342
- l.isString(i) && (i = U(i, "")), s && l.isObject(i) ? this.objectParser({
366
+ l.isString(i) && (i = L(i, "")), s && l.isObject(i) && !l.isNativeObject(i) ? this.objectParser({
343
367
  data: i,
344
368
  updater: t
345
369
  }) : t(i);
346
- }) : (l.isString(e) && (e = U(e, "")), s && l.isObject(e) ? this.objectParser({
370
+ }) : (l.isString(e) && (e = L(e, "")), s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
347
371
  data: e,
348
372
  updater: t
349
373
  }) : t(e));
@@ -363,10 +387,10 @@ class de {
363
387
  this.promiseFieldParser(i, t, s);
364
388
  }
365
389
  else
366
- x(e) ? I(
390
+ O(e) ? P(
367
391
  () => e.value,
368
392
  () => {
369
- l.isUndefined(e.value) || (s && l.isObject(e.value) ? this.objectParser({
393
+ l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
370
394
  data: e.value,
371
395
  updater: t
372
396
  }) : t(e.value));
@@ -375,10 +399,10 @@ class de {
375
399
  immediate: !0,
376
400
  deep: !0
377
401
  }
378
- ) : z(e) ? I(
402
+ ) : q(e) ? P(
379
403
  () => e,
380
404
  () => {
381
- l.isUndefined(e) || (s && l.isObject(e) ? this.objectParser({
405
+ l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
382
406
  data: e,
383
407
  updater: t
384
408
  }) : t(e));
@@ -387,7 +411,7 @@ class de {
387
411
  immediate: !0,
388
412
  deep: !0
389
413
  }
390
- ) : s && l.isObject(e) ? this.objectParser({
414
+ ) : s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
391
415
  data: e,
392
416
  updater: t
393
417
  }) : t(e);
@@ -395,7 +419,7 @@ class de {
395
419
  modelProcessor(e) {
396
420
  e.map(
397
421
  (t) => this.createModel(t, this.processedModel.value)
398
- ), 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());
399
423
  }
400
424
  createModel(e, t) {
401
425
  l.isListSchema(e) && (t[e.field] || (t[e.field] = [{}]), e.children.forEach((s) => {
@@ -405,7 +429,7 @@ class de {
405
429
  }), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
406
430
  }
407
431
  }
408
- class S {
432
+ class E {
409
433
  static getFormContainer({ ui: e } = {}) {
410
434
  return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
411
435
  }
@@ -431,27 +455,27 @@ class pe {
431
455
  }
432
456
  getRuntimeField(e) {
433
457
  var i;
434
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
458
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
435
459
  return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
436
460
  }
437
461
  getRuntimeRequired(e) {
438
462
  var i;
439
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
463
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
440
464
  return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
441
465
  }
442
466
  getFormModelPropName() {
443
467
  var s;
444
- const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = b.adapters[this.ui];
468
+ const e = (s = f.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = v.adapters[this.ui];
445
469
  return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
446
470
  }
447
471
  formComponentRenderer(e) {
448
472
  var i;
449
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
473
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
450
474
  return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
451
475
  }
452
476
  clearValidate(e) {
453
477
  var i;
454
- const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = b.adapters[this.ui];
478
+ const t = (i = f.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = v.adapters[this.ui];
455
479
  return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
456
480
  }
457
481
  }
@@ -460,15 +484,15 @@ function he(r) {
460
484
  }
461
485
  class me {
462
486
  constructor(e) {
463
- a(this, "schemas", q([]));
464
- a(this, "model", q({}));
487
+ a(this, "schemas", M([]));
488
+ a(this, "model", M({}));
465
489
  a(this, "processorBySchemaType", {
466
490
  item: this.runtimeItemProcessor.bind(this),
467
491
  group: this.runtimeGroupProcessor.bind(this),
468
492
  list: this.runtimeListProcessor.bind(this)
469
493
  });
470
- a(this, "formRef", q(null));
471
- a(this, "hydrateEffect", new N());
494
+ a(this, "formRef", M(null));
495
+ a(this, "hydrateEffect", new _());
472
496
  a(this, "native", oe({}));
473
497
  a(this, "grid", {});
474
498
  a(this, "runtime", {});
@@ -476,19 +500,20 @@ class me {
476
500
  props: {},
477
501
  slots: {}
478
502
  });
503
+ a(this, "shared", {});
479
504
  this.setup = e, this.processor = new de(this);
480
505
  const t = this.setup(this);
481
- if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), x(t.schemas)) {
482
- const s = I(() => t.schemas, () => {
483
- 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(() => {
484
509
  s();
485
510
  });
486
511
  }, {
487
512
  deep: !0
488
513
  });
489
- } else if (z(t.schemas)) {
490
- const s = I(() => t.schemas, () => {
491
- 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(() => {
492
517
  s();
493
518
  });
494
519
  }, {
@@ -499,55 +524,56 @@ class me {
499
524
  }
500
525
  getRuntimeMeta() {
501
526
  return {
502
- model: w(g(this.model.value)),
503
- reactiveModel: this.model.value
527
+ model: S(C(this.model.value)),
528
+ reactiveModel: this.model.value,
529
+ shared: this.shared
504
530
  };
505
531
  }
506
532
  runtimeItemProcessor(e, t, s = this.model.value, i) {
507
- var k, $, _, B, D, G, T, K, W, H, J, Q, X;
508
- const o = w(e.component);
533
+ var x, z, $, B, D, G, T, K, W, H, J, Q, X;
534
+ const o = S(e.component);
509
535
  if (!o)
510
536
  return;
511
- y(this.globalNativeFormOverride.props, ($ = (k = e.native) == null ? void 0 : k.props) == null ? void 0 : $.Form), y(this.globalNativeFormOverride.slots, (B = (_ = e.native) == null ? void 0 : _.slots) == null ? void 0 : B.Form);
512
- 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 = {
513
539
  display: "grid",
514
540
  gridColumn: "1 / -1",
515
541
  ...e.grid
516
- }, 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({
517
543
  schema: e,
518
544
  parentSchema: i,
519
545
  index: t
520
- }), P = o.name, V = e.componentProps ?? {}, C = b.placeholderPresetByComponentName;
521
- let v = e.placeholder, m = e.show;
522
- m === void 0 && (m = !0), m || delete s[e.field];
523
- let h = e.label ?? "";
524
- const F = (i == null ? void 0 : i.runtime) ?? this.runtime;
525
- if (!l.isUndefined(t) && !l.isObjectEmpty(F) && (h = U((X = F == null ? void 0 : F.customizeItemLabel) == null ? void 0 : X.call(F, e.label ?? "", t + 1), "")), !v) {
526
- let E = "请输入";
527
- l.isUndefined(P) ? v = `${E}${h}` : /* @ts-expect-error */ C[P.toLowerCase()] ? (E = // @ts-expect-error
528
- C[P.toLowerCase()], v = `${E}${h}`) : (Object.keys(C).forEach((Y) => {
529
- P.toLowerCase().includes(Y.toLowerCase()) && (E = C[Y]);
530
- }), v = `${E}${h}`);
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 ?? "";
550
+ const j = (i == null ? void 0 : i.runtime) ?? this.runtime;
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}`);
531
557
  }
532
558
  const Z = this.runtimeAdapter.getRuntimeRequired({
533
559
  ...e,
534
- label: h
535
- }), A = S.getItemContainer(this), ee = S.getFormItemContainer(this), te = this, se = e.componentSlots;
560
+ label: m
561
+ }), A = E.getItemContainer(this), ee = E.getFormItemContainer(this), te = this, se = e.componentSlots;
536
562
  return p("div", {
537
563
  style: c
538
564
  }, [p(A, {
539
- show: m
565
+ show: y
540
566
  }, {
541
567
  default() {
542
- return m && p(ee, R(u, {
543
- label: `${h ? `${h}:` : ""}`
568
+ return y && p(ee, R(u, {
569
+ label: `${m ? `${m}:` : ""}`
544
570
  }, d, Z), {
545
571
  default() {
546
572
  return te.runtimeAdapter.formComponentRenderer({
547
573
  Component: o,
548
574
  schema: e,
549
575
  baseModel: s,
550
- placeholder: v,
576
+ placeholder: g,
551
577
  componentSlots: se,
552
578
  props: V
553
579
  });
@@ -563,7 +589,7 @@ class me {
563
589
  display: "grid",
564
590
  gridColumn: "1 / -1",
565
591
  ...e.grid
566
- }, i = S.getGroupContainer(this);
592
+ }, i = E.getGroupContainer(this);
567
593
  let o = e.show;
568
594
  return o === void 0 && (o = !0), p("div", {
569
595
  style: s
@@ -580,7 +606,7 @@ class me {
580
606
  code: "0001",
581
607
  message: "异步默认值数据正在处理中,请您耐心等待... "
582
608
  });
583
- (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);
584
610
  }
585
611
  deleteListItem(e, t) {
586
612
  this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
@@ -594,7 +620,7 @@ class me {
594
620
  s.model.value[e.field] || (s.model.value[e.field] = [{}]);
595
621
  let i = e.show;
596
622
  i === void 0 && (i = !0);
597
- const o = S.getListContainer(this), n = S.getListItemContainer(this);
623
+ const o = E.getListContainer(this), n = E.getListItemContainer(this);
598
624
  return p("div", {
599
625
  style: t
600
626
  }, [i && p(o, {
@@ -609,8 +635,8 @@ class me {
609
635
  container: d
610
636
  } = {}) {
611
637
  var V;
612
- const P = d ?? p("button", null, null);
613
- return ne(p(P, {
638
+ const b = d ?? p("button", null, null);
639
+ return ne(p(b, {
614
640
  onClick: () => s.deleteListItem(e, u)
615
641
  }, null), [[le, ((V = s.model.value[e.field]) == null ? void 0 : V.length) > 1]]);
616
642
  }
@@ -630,13 +656,13 @@ class me {
630
656
  return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
631
657
  }
632
658
  exec() {
633
- var c, u, d, P;
659
+ var c, u, d, b;
634
660
  const e = {
635
661
  display: "grid",
636
662
  gridColumn: "1 / -1",
637
663
  gridAutoColumns: "1fr",
638
664
  ...this.grid
639
- }, t = this, s = y(g((u = (c = this.native) == null ? void 0 : c.props) == null ? void 0 : u.Form) ?? {}, this.globalNativeFormOverride.props), i = y(g((P = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : P.Form) ?? {}, this.globalNativeFormOverride.slots), o = S.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();
640
666
  return p(o, R(s, {
641
667
  ref: this.formRef
642
668
  }, {
@@ -654,7 +680,7 @@ class me {
654
680
  class f {
655
681
  }
656
682
  a(f, "presets");
657
- function M({
683
+ function U({
658
684
  parentSchema: r,
659
685
  schema: e,
660
686
  index: t
@@ -665,7 +691,7 @@ const ye = {
665
691
  ArcoVue: {
666
692
  getRuntimeField(r) {
667
693
  return {
668
- field: M(r)
694
+ field: U(r)
669
695
  };
670
696
  },
671
697
  getRuntimeRequired(r) {
@@ -709,7 +735,7 @@ const ye = {
709
735
  },
710
736
  validateForm(r) {
711
737
  return new Promise((e, t) => {
712
- r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(w(r.runtimeCore.processor.processedModel.value))));
738
+ r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
713
739
  });
714
740
  },
715
741
  clearValidate(r) {
@@ -719,7 +745,7 @@ const ye = {
719
745
  NutUI: {
720
746
  getRuntimeField(r) {
721
747
  return {
722
- prop: M(r)
748
+ prop: U(r)
723
749
  };
724
750
  },
725
751
  getRuntimeRequired(r) {
@@ -768,7 +794,7 @@ const ye = {
768
794
  valid: s,
769
795
  errors: i
770
796
  }) => {
771
- s ? e(r.cleanFallbackFields(w(r.runtimeCore.processor.processedModel.value))) : t(i);
797
+ s ? e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))) : t(i);
772
798
  });
773
799
  });
774
800
  },
@@ -779,7 +805,7 @@ const ye = {
779
805
  NaiveUI: {
780
806
  getRuntimeField(r) {
781
807
  return {
782
- path: M(r)
808
+ path: U(r)
783
809
  };
784
810
  },
785
811
  getRuntimeRequired(r) {
@@ -824,14 +850,14 @@ const ye = {
824
850
  },
825
851
  validateForm(r) {
826
852
  return new Promise((e, t) => {
827
- r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(w(r.runtimeCore.processor.processedModel.value))));
853
+ r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(S(r.runtimeCore.processor.processedModel.value))));
828
854
  });
829
855
  },
830
856
  clearValidate(r) {
831
857
  r.formRef.value.restoreValidation();
832
858
  }
833
859
  }
834
- }, j = class j {
860
+ }, w = class w {
835
861
  static getPlaceholderPrefixPresetByComponentName() {
836
862
  const e = {
837
863
  请选择: ["select", "tree"],
@@ -844,7 +870,7 @@ const ye = {
844
870
  return t;
845
871
  }
846
872
  };
847
- a(j, "schemaPreset", {
873
+ a(w, "schemaPreset", {
848
874
  type: {
849
875
  defaultValue: "item"
850
876
  },
@@ -887,15 +913,15 @@ a(j, "schemaPreset", {
887
913
  grid: {
888
914
  default: void 0
889
915
  }
890
- }), a(j, "componentPropsPreset", {
916
+ }), a(w, "componentPropsPreset", {
891
917
  options: {
892
918
  defaultValue: []
893
919
  }
894
920
  }), // 基于基本功能提出基本预设
895
- a(j, "placeholderPresetByComponentName", j.getPlaceholderPrefixPresetByComponentName());
896
- let L = j;
897
- const b = {
898
- ...L,
921
+ a(w, "placeholderPresetByComponentName", w.getPlaceholderPrefixPresetByComponentName());
922
+ let k = w;
923
+ const v = {
924
+ ...k,
899
925
  adapters: {
900
926
  ...ye
901
927
  }
@@ -917,26 +943,31 @@ function Ce(r) {
917
943
  e.setup.bind(e),
918
944
  {
919
945
  submit: e.submit.bind(e),
920
- hydrate: e.hydrate.bind(e)
946
+ hydrate: e.hydrate.bind(e),
947
+ share: e.share.bind(e)
921
948
  }
922
949
  ];
923
950
  }
924
951
  function Ie(r) {
925
952
  f.presets = r;
926
953
  }
927
- function Pe(r, e) {
954
+ function be(r, e) {
928
955
  return e === "native" && Object.defineProperty(r, "name", {
929
956
  value: `__proform_raw_${r.name}`,
930
957
  writable: !0
931
958
  }), r;
932
959
  }
933
960
  function Ve(r) {
934
- return Pe(r, "native");
961
+ return be(r, "native");
962
+ }
963
+ function je(r) {
964
+ return r.__proform_raw_object = !0, r;
935
965
  }
936
966
  export {
937
967
  ge as ProForm,
938
968
  Ve as markNativeFunction,
969
+ je as markNativeObject,
939
970
  Ce as useForm,
940
971
  Ie as useFormPresetConfigurer,
941
- Pe as useModifiers
972
+ be as useModifiers
942
973
  };
@@ -1,6 +1,5 @@
1
1
  export { default as ProForm } from "./src/form/index";
2
2
  export { useForm } from "./src/interactions/useForm";
3
3
  export { useFormPresetConfigurer } from "./src/interactions/useFormPresetConfigurer";
4
- export { useModifiers } from "./src/interactions/useModifiers";
5
- export { markNativeFunction } from "./src/interactions/useModifiers";
4
+ export { useModifiers, markNativeFunction, markNativeObject, } from "./src/interactions/useModifiers";
6
5
  export * from "./src/types/index";
@@ -1,8 +1,9 @@
1
- import { runtimeMeta } from "../types";
1
+ import { AnyObject, runtimeMeta } from "../types";
2
2
  type Modifier = "native";
3
3
  type FunctionNative = (args: {
4
4
  rawArgs: any[];
5
5
  } & runtimeMeta) => any;
6
6
  export declare function useModifiers(functionNative: FunctionNative, modifier: Modifier): FunctionNative;
7
7
  export declare function markNativeFunction(functionNative: FunctionNative): FunctionNative;
8
+ export declare function markNativeObject(objectNative: AnyObject): AnyObject;
8
9
  export {};
@@ -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
  ];
@@ -14,4 +14,5 @@ export default class IS {
14
14
  static isGroupSchema(data: any): data is GroupSchema;
15
15
  static isItemSchema(data: any): data is ItemSchema;
16
16
  static isProcessInprogress(data: any): boolean;
17
+ static isNativeObject(object: AnyObject): boolean;
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",