@harbor-design/proform 1.2.12 → 1.2.14

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 ae = Object.defineProperty;
2
2
  var ue = (r, e, t) => e in r ? ae(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var a = (r, e, t) => (ue(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { isRef as w, watch as v, isReactive as S, nextTick as E, toRaw as O, ref as N, reactive as se, createVNode as p, mergeProps as q, withDirectives as ce, vShow as fe, createTextVNode as de, isVNode as he, defineComponent as pe } from "vue";
4
+ import { readonly as ce, isRef as q, watch as v, isReactive as N, nextTick as g, toRaw as w, ref as M, reactive as se, createVNode as p, mergeProps as O, withDirectives as fe, vShow as de, createTextVNode as he, isVNode as pe, defineComponent as me } from "vue";
5
5
  class l {
6
6
  static typeChecker(e) {
7
7
  return {}.toString.call(e);
@@ -69,18 +69,18 @@ class l {
69
69
  return !!e.__proform_raw_object;
70
70
  }
71
71
  }
72
- function d(r, ...e) {
72
+ function h(r, ...e) {
73
73
  return e.forEach((t) => {
74
74
  if (Array.isArray(t))
75
75
  Array.isArray(r) || (r = []), t.forEach((s, i) => {
76
- typeof s == "object" && s !== null ? r[i] = d(Array.isArray(s) ? [] : {}, s) : r[i] = s;
76
+ typeof s == "object" && s !== null ? r[i] = h(Array.isArray(s) ? [] : {}, s) : r[i] = s;
77
77
  });
78
78
  else
79
79
  for (const s in t)
80
- t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] = d(r[s] || {}, t[s]) : r[s] = t[s]);
80
+ t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] = h(r[s] || {}, t[s]) : r[s] = t[s]);
81
81
  }), r;
82
82
  }
83
- function C(r) {
83
+ function I(r) {
84
84
  const e = /* @__PURE__ */ new WeakMap();
85
85
  function t(s) {
86
86
  if (s === null || typeof s != "object")
@@ -121,7 +121,7 @@ function C(r) {
121
121
  function x(r, e) {
122
122
  return r.replace(/undefined/g, e);
123
123
  }
124
- class me {
124
+ class be {
125
125
  constructor(e) {
126
126
  a(this, "runtimeCore");
127
127
  a(this, "reactiveModel");
@@ -134,7 +134,7 @@ class me {
134
134
  })), e;
135
135
  }
136
136
  setup(e) {
137
- return this.runtimeCore = e, this.reactiveModel = e.model.value, Object.assign(this.runtimeCore.native, this.formCustomization.native), Object.assign(this.runtimeCore.grid, this.formCustomization.grid), Object.assign(this.runtimeCore.runtime, this.formCustomization.runtime), this.formCustomization.ui && (this.runtimeCore.ui = this.formCustomization.ui), this.formCustomization;
137
+ return this.runtimeCore = e, this.reactiveModel = ce(e.model.value), Object.assign(this.runtimeCore.native, this.formCustomization.native), Object.assign(this.runtimeCore.grid, this.formCustomization.grid), Object.assign(this.runtimeCore.runtime, this.formCustomization.runtime), this.formCustomization.ui && (this.runtimeCore.ui = this.formCustomization.ui), this.formCustomization;
138
138
  }
139
139
  submit() {
140
140
  var s;
@@ -149,25 +149,25 @@ class me {
149
149
  });
150
150
  this.runtimeCore.hydrateEffect.trackEffect(
151
151
  () => {
152
- w(e) ? v(
152
+ q(e) ? v(
153
153
  () => e.value,
154
154
  () => {
155
- d(this.runtimeCore.model.value, e.value);
155
+ h(this.runtimeCore.model.value, e.value);
156
156
  },
157
157
  {
158
158
  deep: !0,
159
159
  immediate: !0
160
160
  }
161
- ) : S(e) ? v(
161
+ ) : N(e) ? v(
162
162
  () => e,
163
163
  () => {
164
- d(this.runtimeCore.model.value, e);
164
+ h(this.runtimeCore.model.value, e);
165
165
  },
166
166
  {
167
167
  deep: !0,
168
168
  immediate: !0
169
169
  }
170
- ) : d(this.runtimeCore.model.value, e);
170
+ ) : h(this.runtimeCore.model.value, e);
171
171
  },
172
172
  {
173
173
  lazy: !1
@@ -175,11 +175,11 @@ class me {
175
175
  );
176
176
  }
177
177
  share(e) {
178
- if (w(e)) {
178
+ if (q(e)) {
179
179
  const t = v(
180
180
  () => e.value,
181
181
  () => {
182
- d(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), E(() => {
182
+ h(this.runtimeCore.shared, e.value), this.runtimeCore.processor.schemaEffect.triggerEffects(), g(() => {
183
183
  t();
184
184
  });
185
185
  },
@@ -188,11 +188,11 @@ class me {
188
188
  immediate: !0
189
189
  }
190
190
  );
191
- } else if (S(e)) {
191
+ } else if (N(e)) {
192
192
  const t = v(
193
193
  () => e,
194
194
  () => {
195
- d(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), E(() => {
195
+ h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects(), g(() => {
196
196
  t();
197
197
  });
198
198
  },
@@ -202,42 +202,27 @@ class me {
202
202
  }
203
203
  );
204
204
  } else
205
- d(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
206
- }
207
- getReactiveModel() {
208
- return this.reactiveModel || console.error(
209
- "调用 getReactiveModel 受限:理论上 model 需要在 useForm 的下一个 tick 使用,可在 nextTick 及部分合适的框架钩子中使用该函数"
210
- ), this.reactiveModel;
205
+ h(this.runtimeCore.shared, e), this.runtimeCore.processor.schemaEffect.triggerEffects();
211
206
  }
212
- setReactiveModel(e) {
213
- return this.reactiveModel || console.error(
214
- "调用 getReactiveModel 受限:理论上 model 需要在 useForm 的下一个 tick 使用,可在 nextTick 及部分合适的框架钩子中使用该函数"
215
- ), this.runtimeCore.hydrateEffect.trackEffect(
216
- () => {
217
- w(e) ? v(
218
- () => e.value,
219
- () => {
220
- d(this.runtimeCore.model.value, e.value);
221
- },
222
- {
223
- deep: !0,
224
- immediate: !0
225
- }
226
- ) : S(e) ? v(
227
- () => e,
228
- () => {
229
- d(this.runtimeCore.model.value, e);
230
- },
231
- {
232
- deep: !0,
233
- immediate: !0
234
- }
235
- ) : d(this.runtimeCore.model.value, e);
236
- },
237
- {
238
- lazy: !1
239
- }
240
- ), this.reactiveModel;
207
+ subscribeModel(e) {
208
+ g(() => {
209
+ const t = v(
210
+ () => this.reactiveModel,
211
+ (s) => {
212
+ e(s, {
213
+ stopSubscribe() {
214
+ g(() => {
215
+ t();
216
+ });
217
+ }
218
+ });
219
+ },
220
+ {
221
+ immediate: !0,
222
+ deep: !0
223
+ }
224
+ );
225
+ });
241
226
  }
242
227
  }
243
228
  class L {
@@ -311,7 +296,7 @@ class ve {
311
296
  // 派生过程,用于外部应用
312
297
  parseSchemas(e, t) {
313
298
  l.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
314
- C(e)
299
+ I(e)
315
300
  ), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
316
301
  }
317
302
  parseStable(e) {
@@ -325,7 +310,7 @@ class ve {
325
310
  // 对于稳定初始化更新的抽象
326
311
  stableUpdater(e = []) {
327
312
  if (e.every(Boolean)) {
328
- const t = O(this.processedSchemas.value);
313
+ const t = w(this.processedSchemas.value);
329
314
  !l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
330
315
  length: t.length
331
316
  }).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
@@ -338,17 +323,17 @@ class ve {
338
323
  }).fill(!1);
339
324
  this.objectParser({ data: e, index: t, updater: n });
340
325
  function n(f) {
341
- const c = f.index, h = f.key, y = f.keyIndex;
326
+ const c = f.index, d = f.key, y = f.keyIndex;
342
327
  if (l.isUndefined(f.stable))
343
328
  return;
344
- const F = i.parseStable(f.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
329
+ const F = i.parseStable(f.stable), E = s == null ? void 0 : s.index, C = s == null ? void 0 : s.key;
345
330
  let b = F;
346
331
  if (l.isProcessInprogress(b) || (o[y] = !0), s) {
347
- const m = i.processedSchemas.value[I][g][c][h];
348
- m && l.isObject(m) && h !== "component" && (b = d(m, b)), i.processedSchemas.value[I][g][c][h] = b, i.stableUpdater(o);
332
+ const m = i.processedSchemas.value[E][C][c][d];
333
+ m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[E][C][c][d] = b, i.stableUpdater(o);
349
334
  } else {
350
- const m = i.processedSchemas.value[c][h];
351
- m && l.isObject(m) && h !== "component" && (b = d(m, b)), i.processedSchemas.value[c][h] = b, i.stableUpdater(o);
335
+ const m = i.processedSchemas.value[c][d];
336
+ m && l.isObject(m) && d !== "component" && (b = h(m, b)), i.processedSchemas.value[c][d] = b, i.stableUpdater(o);
352
337
  }
353
338
  }
354
339
  }
@@ -391,13 +376,13 @@ class ve {
391
376
  return n(c);
392
377
  this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
393
378
  this.defaultValueInprogressMap.values()
394
- ).every((h) => !h.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), E(() => {
379
+ ).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), g(() => {
395
380
  f();
396
381
  })) : n(c);
397
382
  }) : this.fieldParser(t[i], (c) => {
398
383
  this.defaultValueInprogressMap.set(t[i], c), !l.isProcessInprogress(c) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
399
384
  this.defaultValueInprogressMap.values()
400
- ).every((h) => !h.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), E(() => {
385
+ ).every((d) => !d.includes("undefined")) ? (n(c), this.defaultValueEffect.clearEffects(), g(() => {
401
386
  f();
402
387
  })) : n(c);
403
388
  });
@@ -440,7 +425,7 @@ class ve {
440
425
  this.promiseFieldParser(i, t, s);
441
426
  }
442
427
  else
443
- w(e) ? v(
428
+ q(e) ? v(
444
429
  () => e.value,
445
430
  () => {
446
431
  l.isUndefined(e.value) || (s && l.isObject(e.value) && !l.isNativeObject(e.value) ? this.objectParser({
@@ -452,7 +437,7 @@ class ve {
452
437
  immediate: !0,
453
438
  deep: !0
454
439
  }
455
- ) : S(e) ? v(
440
+ ) : N(e) ? v(
456
441
  () => e,
457
442
  () => {
458
443
  l.isUndefined(e) || (s && l.isObject(e) && !l.isNativeObject(e) ? this.objectParser({
@@ -472,7 +457,7 @@ class ve {
472
457
  modelProcessor(e) {
473
458
  e.map(
474
459
  (t) => this.createModel(t, this.processedModel.value)
475
- ), 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());
460
+ ), l.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel = I(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects());
476
461
  }
477
462
  createModel(e, t) {
478
463
  l.isListSchema(e) && (t[e.field] || (t[e.field] = [{}]), e.children.forEach((s) => {
@@ -482,7 +467,7 @@ class ve {
482
467
  }), l.isItemSchema(e) && ("defaultValue" in e ? t[e.field] = e.defaultValue : t[e.field] || (t[e.field] = void 0));
483
468
  }
484
469
  }
485
- class j {
470
+ class V {
486
471
  static getFormContainer({ ui: e } = {}) {
487
472
  return u.presets.uiPresets[e ?? u.presets.ui].container.Form;
488
473
  }
@@ -502,7 +487,7 @@ class j {
502
487
  return u.presets.uiPresets[e ?? u.presets.ui].container.ListItem;
503
488
  }
504
489
  }
505
- class be {
490
+ class ye {
506
491
  constructor(e) {
507
492
  this.ui = e;
508
493
  }
@@ -536,19 +521,19 @@ class be {
536
521
  return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
537
522
  }
538
523
  }
539
- function ye(r) {
540
- return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !he(r);
524
+ function Pe(r) {
525
+ return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !pe(r);
541
526
  }
542
- class Pe {
527
+ class ge {
543
528
  constructor(e) {
544
- a(this, "schemas", N([]));
545
- a(this, "model", N({}));
529
+ a(this, "schemas", M([]));
530
+ a(this, "model", M({}));
546
531
  a(this, "processorBySchemaType", {
547
532
  item: this.runtimeItemProcessor.bind(this),
548
533
  group: this.runtimeGroupProcessor.bind(this),
549
534
  list: this.runtimeListProcessor.bind(this)
550
535
  });
551
- a(this, "formRef", N(null));
536
+ a(this, "formRef", M(null));
552
537
  a(this, "hydrateEffect", new L());
553
538
  a(this, "native", se({}));
554
539
  a(this, "grid", {});
@@ -566,7 +551,7 @@ class Pe {
566
551
  a(this, "shared", {});
567
552
  this.setup = e, this.processor = new ve(this);
568
553
  const t = this.setup(this);
569
- if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new be(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), w(t.schemas))
554
+ if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new ye(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), q(t.schemas))
570
555
  v(
571
556
  // @ts-expect-error
572
557
  () => t.schemas.value,
@@ -577,9 +562,9 @@ class Pe {
577
562
  deep: !0
578
563
  }
579
564
  );
580
- else if (S(t.schemas)) {
565
+ else if (N(t.schemas)) {
581
566
  const s = v(() => t.schemas, () => {
582
- this.processor.parseSchemas(t.schemas), E(() => {
567
+ this.processor.parseSchemas(t.schemas), g(() => {
583
568
  s();
584
569
  });
585
570
  }, {
@@ -589,7 +574,7 @@ class Pe {
589
574
  this.processor.parseSchemas(t.schemas);
590
575
  }
591
576
  getRuntimeMeta() {
592
- const e = O(C(this.model.value));
577
+ const e = w(I(this.model.value));
593
578
  let t;
594
579
  return {
595
580
  model: e,
@@ -598,18 +583,18 @@ class Pe {
598
583
  // share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
599
584
  share: (s) => {
600
585
  t && clearTimeout(t), t = setTimeout(() => {
601
- if (w(s)) {
586
+ if (q(s)) {
602
587
  const i = v(() => s.value, () => {
603
- d(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), E(() => {
588
+ h(this.shared, s.value), this.processor.schemaEffect.triggerEffects(), g(() => {
604
589
  i();
605
590
  });
606
591
  }, {
607
592
  deep: !0,
608
593
  immediate: !0
609
594
  });
610
- } else if (S(s)) {
595
+ } else if (N(s)) {
611
596
  const i = v(() => s, () => {
612
- d(this.shared, s), this.processor.schemaEffect.triggerEffects(), E(() => {
597
+ h(this.shared, s), this.processor.schemaEffect.triggerEffects(), g(() => {
613
598
  i();
614
599
  });
615
600
  }, {
@@ -617,56 +602,56 @@ class Pe {
617
602
  immediate: !0
618
603
  });
619
604
  } else
620
- d(this.shared, s), this.processor.schemaEffect.triggerEffects();
605
+ h(this.shared, s), this.processor.schemaEffect.triggerEffects();
621
606
  }, 0);
622
607
  }
623
608
  };
624
609
  }
625
610
  runtimeItemProcessor(e, t, s = this.model.value, i) {
626
- var $, _, z, T, B, D, G, W, K, H, J, Q, X, Y, Z, A, ee;
627
- const o = O(e.component);
611
+ var _, z, k, B, D, T, G, W, K, H, J, Q, X, Y, Z, A, ee;
612
+ const o = w(e.component);
628
613
  if (!o)
629
614
  return;
630
- (_ = ($ = e.native) == null ? void 0 : $.props) != null && _.Form && d(this.globalNativeFormOverride.props.Form, (T = (z = e.native) == null ? void 0 : z.props) == null ? void 0 : T.Form), (D = (B = e.native) == null ? void 0 : B.slots) != null && D.Form && d(this.globalNativeFormOverride.slots.Form, (W = (G = e.native) == null ? void 0 : G.slots) == null ? void 0 : W.Form);
631
- const n = d(C((H = (K = this.native) == null ? void 0 : K.slots) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.slots) == null ? void 0 : Q.FormItem), f = {
615
+ (z = (_ = e.native) == null ? void 0 : _.props) != null && z.Form && h(this.globalNativeFormOverride.props.Form, (B = (k = e.native) == null ? void 0 : k.props) == null ? void 0 : B.Form), (T = (D = e.native) == null ? void 0 : D.slots) != null && T.Form && h(this.globalNativeFormOverride.slots.Form, (W = (G = e.native) == null ? void 0 : G.slots) == null ? void 0 : W.Form);
616
+ const n = h(I((H = (K = this.native) == null ? void 0 : K.slots) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.slots) == null ? void 0 : Q.FormItem), f = {
632
617
  display: "grid",
633
618
  gridColumn: "1 / -1",
634
619
  ...e.grid
635
- }, c = d(C((Y = (X = this.native) == null ? void 0 : X.props) == null ? void 0 : Y.FormItem) ?? {}, (A = (Z = e.native) == null ? void 0 : Z.props) == null ? void 0 : A.FormItem), h = this.runtimeAdapter.getRuntimeField({
620
+ }, c = h(I((Y = (X = this.native) == null ? void 0 : X.props) == null ? void 0 : Y.FormItem) ?? {}, (A = (Z = e.native) == null ? void 0 : Z.props) == null ? void 0 : A.FormItem), d = this.runtimeAdapter.getRuntimeField({
636
621
  schema: e,
637
622
  parentSchema: i,
638
623
  index: t
639
- }), y = o.name, F = e.componentProps ?? {}, I = P.placeholderPresetByComponentName;
640
- let g = e.placeholder, b = e.show;
624
+ }), y = o.name, F = e.componentProps ?? {}, E = P.placeholderPresetByComponentName;
625
+ let C = e.placeholder, b = e.show;
641
626
  b === void 0 && (b = !0);
642
627
  let m = e.label ?? "";
643
- const R = (i == null ? void 0 : i.runtime) ?? this.runtime;
644
- if (!l.isUndefined(t) && !l.isObjectEmpty(R) && (m = x((ee = R == null ? void 0 : R.customizeListItemLabel) == null ? void 0 : ee.call(R, e.label ?? "", t + 1), "")), !g) {
645
- let M = "请输入";
646
- l.isUndefined(y) ? g = `${M}${m}` : /* @ts-expect-error */ I[y.toLowerCase()] ? (M = // @ts-expect-error
647
- I[y.toLowerCase()], g = `${M}${m}`) : (Object.keys(I).forEach((te) => {
648
- y.toLowerCase().includes(te.toLowerCase()) && (M = I[te]);
649
- }), g = `${M}${m}`);
628
+ const j = (i == null ? void 0 : i.runtime) ?? this.runtime;
629
+ if (!l.isUndefined(t) && !l.isObjectEmpty(j) && (m = x((ee = j == null ? void 0 : j.customizeListItemLabel) == null ? void 0 : ee.call(j, e.label ?? "", t + 1), "")), !C) {
630
+ let R = "请输入";
631
+ l.isUndefined(y) ? C = `${R}${m}` : /* @ts-expect-error */ E[y.toLowerCase()] ? (R = // @ts-expect-error
632
+ E[y.toLowerCase()], C = `${R}${m}`) : (Object.keys(E).forEach((te) => {
633
+ y.toLowerCase().includes(te.toLowerCase()) && (R = E[te]);
634
+ }), C = `${R}${m}`);
650
635
  }
651
636
  const re = this.runtimeAdapter.getRuntimeRequired({
652
637
  ...e,
653
638
  label: m
654
- }), ie = j.getItemContainer(this), oe = j.getFormItemContainer(this), ne = this, le = e.componentSlots;
639
+ }), ie = V.getItemContainer(this), oe = V.getFormItemContainer(this), ne = this, le = e.componentSlots;
655
640
  return p("div", {
656
641
  style: f
657
642
  }, [p(ie, {
658
643
  show: b
659
644
  }, {
660
645
  default() {
661
- return b && p(oe, q(c, {
646
+ return b && p(oe, O(c, {
662
647
  label: `${m ? `${m}:` : ""}`
663
- }, h, re), {
648
+ }, d, re), {
664
649
  default() {
665
650
  return ne.runtimeAdapter.formComponentRenderer({
666
651
  Component: o,
667
652
  schema: e,
668
653
  baseModel: s,
669
- placeholder: g,
654
+ placeholder: C,
670
655
  componentSlots: le,
671
656
  props: F
672
657
  });
@@ -682,13 +667,13 @@ class Pe {
682
667
  display: "grid",
683
668
  gridColumn: "1 / -1",
684
669
  ...e.grid
685
- }, i = j.getGroupContainer(this);
670
+ }, i = V.getGroupContainer(this);
686
671
  let o = e.show;
687
672
  return o === void 0 && (o = !0), p("div", {
688
673
  style: s
689
674
  }, [o && p(i, {
690
675
  schema: e
691
- }, ye(t = e.children.map((n) => this.runtimeItemProcessor(n))) ? t : {
676
+ }, Pe(t = e.children.map((n) => this.runtimeItemProcessor(n))) ? t : {
692
677
  default: () => [t]
693
678
  })]);
694
679
  }
@@ -699,7 +684,7 @@ class Pe {
699
684
  code: "0001",
700
685
  message: "异步默认值数据正在处理中,请您耐心等待... "
701
686
  });
702
- (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);
687
+ (s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(I(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
703
688
  }
704
689
  deleteListItem(e, t) {
705
690
  this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
@@ -713,7 +698,7 @@ class Pe {
713
698
  s.model.value[e.field] || (s.model.value[e.field] = [{}]);
714
699
  let i = e.show;
715
700
  i === void 0 && (i = !0);
716
- const o = j.getListContainer(this), n = j.getListItemContainer(this);
701
+ const o = V.getListContainer(this), n = V.getListItemContainer(this);
717
702
  return p("div", {
718
703
  style: t
719
704
  }, [i && p(o, {
@@ -722,23 +707,23 @@ class Pe {
722
707
  default() {
723
708
  return s.model.value[e.field].map((f, c) => p(n, null, {
724
709
  default() {
725
- return e.children.map((h) => s.runtimeItemProcessor(h, c, f, e));
710
+ return e.children.map((d) => s.runtimeItemProcessor(d, c, f, e));
726
711
  },
727
712
  delete({
728
- container: h
713
+ container: d
729
714
  } = {}) {
730
715
  var F;
731
- const y = h ?? p("button", null, null);
732
- return ce(p(y, {
716
+ const y = d ?? p("button", null, null);
717
+ return fe(p(y, {
733
718
  onClick: () => s.deleteListItem(e, c)
734
- }, null), [[fe, ((F = s.model.value[e.field]) == null ? void 0 : F.length) > 1]]);
719
+ }, null), [[de, ((F = s.model.value[e.field]) == null ? void 0 : F.length) > 1]]);
735
720
  }
736
721
  }));
737
722
  },
738
723
  add({
739
724
  container: f
740
725
  } = {}) {
741
- const c = f ?? p("button", null, [de("添加")]);
726
+ const c = f ?? p("button", null, [he("添加")]);
742
727
  return p(c, {
743
728
  onClick: () => s.addListItem(e)
744
729
  }, null);
@@ -749,14 +734,14 @@ class Pe {
749
734
  return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
750
735
  }
751
736
  exec() {
752
- var f, c, h, y;
737
+ var f, c, d, y;
753
738
  const e = {
754
739
  display: "grid",
755
740
  gridColumn: "1 / -1",
756
741
  gridAutoColumns: "1fr",
757
742
  ...this.grid
758
- }, t = this, s = d(C((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props.Form), i = d(C((y = (h = this.native) == null ? void 0 : h.slots) == null ? void 0 : y.Form) ?? {}, this.globalNativeFormOverride.slots.Form), o = j.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
759
- return p(o, q(s, {
743
+ }, t = this, s = h(I((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props.Form), i = h(I((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}, this.globalNativeFormOverride.slots.Form), o = V.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
744
+ return p(o, O(s, {
760
745
  ref: this.formRef
761
746
  }, {
762
747
  [n]: this.model.value
@@ -788,7 +773,7 @@ function U({
788
773
  }) {
789
774
  return r ? `${r.field}.${t}.${e.field}` : e.field;
790
775
  }
791
- const ge = {
776
+ const Ce = {
792
777
  ArcoVue: {
793
778
  getRuntimeField(r) {
794
779
  return {
@@ -832,7 +817,7 @@ const ge = {
832
817
  componentSlots: i,
833
818
  props: o
834
819
  }) {
835
- return p(r, q({
820
+ return p(r, O({
836
821
  modelValue: e[t.field],
837
822
  "onUpdate:modelValue": (n) => e[t.field] = n,
838
823
  placeholder: s
@@ -842,7 +827,7 @@ const ge = {
842
827
  },
843
828
  validateForm(r) {
844
829
  return new Promise((e, t) => {
845
- r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(O(r.runtimeCore.processor.processedModel.value))));
830
+ r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(w(r.runtimeCore.processor.processedModel.value))));
846
831
  });
847
832
  },
848
833
  clearValidate(r) {
@@ -893,7 +878,7 @@ const ge = {
893
878
  componentSlots: i,
894
879
  props: o
895
880
  }) {
896
- return p(r, q({
881
+ return p(r, O({
897
882
  modelValue: e[t.field],
898
883
  "onUpdate:modelValue": (n) => e[t.field] = n,
899
884
  placeholder: s
@@ -907,7 +892,7 @@ const ge = {
907
892
  valid: s,
908
893
  errors: i
909
894
  }) => {
910
- s ? e(r.cleanFallbackFields(O(r.runtimeCore.processor.processedModel.value))) : t(i);
895
+ s ? e(r.cleanFallbackFields(w(r.runtimeCore.processor.processedModel.value))) : t(i);
911
896
  });
912
897
  });
913
898
  },
@@ -961,7 +946,7 @@ const ge = {
961
946
  componentSlots: i,
962
947
  props: o
963
948
  }) {
964
- return p(r, q({
949
+ return p(r, O({
965
950
  value: e[t.field],
966
951
  "onUpdate:value": (n) => e[t.field] = n,
967
952
  placeholder: s
@@ -971,14 +956,14 @@ const ge = {
971
956
  },
972
957
  validateForm(r) {
973
958
  return new Promise((e, t) => {
974
- r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(O(r.runtimeCore.processor.processedModel.value))));
959
+ r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(w(r.runtimeCore.processor.processedModel.value))));
975
960
  });
976
961
  },
977
962
  clearValidate(r) {
978
963
  r.formRef.value.restoreValidation();
979
964
  }
980
965
  }
981
- }, V = class V {
966
+ }, S = class S {
982
967
  static getPlaceholderPrefixPresetByComponentName() {
983
968
  const e = {
984
969
  请选择: ["select", "tree"],
@@ -991,7 +976,7 @@ const ge = {
991
976
  return t;
992
977
  }
993
978
  };
994
- a(V, "schemaPreset", {
979
+ a(S, "schemaPreset", {
995
980
  type: {
996
981
  defaultValue: "item"
997
982
  },
@@ -1034,19 +1019,19 @@ a(V, "schemaPreset", {
1034
1019
  grid: {
1035
1020
  default: void 0
1036
1021
  }
1037
- }), a(V, "componentPropsPreset", {
1022
+ }), a(S, "componentPropsPreset", {
1038
1023
  options: {
1039
1024
  defaultValue: []
1040
1025
  }
1041
1026
  }), // 基于基本功能提出基本预设
1042
- a(V, "placeholderPresetByComponentName", V.getPlaceholderPrefixPresetByComponentName());
1043
- let k = V;
1027
+ a(S, "placeholderPresetByComponentName", S.getPlaceholderPrefixPresetByComponentName());
1028
+ let $ = S;
1044
1029
  const P = {
1045
- ...k,
1030
+ ...$,
1046
1031
  adapters: {
1047
- ...ge
1032
+ ...Ce
1048
1033
  }
1049
- }, Fe = /* @__PURE__ */ pe({
1034
+ }, je = /* @__PURE__ */ me({
1050
1035
  props: {
1051
1036
  setup: {
1052
1037
  type: Function,
@@ -1054,43 +1039,42 @@ const P = {
1054
1039
  }
1055
1040
  },
1056
1041
  setup(r) {
1057
- const e = new Pe(r.setup);
1042
+ const e = new ge(r.setup);
1058
1043
  return () => e.exec();
1059
1044
  }
1060
1045
  });
1061
- function Re(r) {
1062
- const e = new me(r);
1046
+ function Ve(r) {
1047
+ const e = new be(r);
1063
1048
  return [
1064
1049
  e.setup.bind(e),
1065
1050
  {
1066
1051
  submit: e.submit.bind(e),
1067
1052
  hydrate: e.hydrate.bind(e),
1068
1053
  share: e.share.bind(e),
1069
- getReactiveModel: e.getReactiveModel.bind(e),
1070
- setReactiveModel: e.setReactiveModel.bind(e)
1054
+ subscribeModel: e.subscribeModel.bind(e)
1071
1055
  }
1072
1056
  ];
1073
1057
  }
1074
- function je(r) {
1058
+ function Se(r) {
1075
1059
  u.presets = r;
1076
1060
  }
1077
- function Ce(r, e) {
1061
+ function Ie(r, e) {
1078
1062
  return e === "native" && Object.defineProperty(r, "name", {
1079
1063
  value: `__proform_raw_${r.name}`,
1080
1064
  writable: !0
1081
1065
  }), r;
1082
1066
  }
1083
- function Ve(r) {
1084
- return Ce(r, "native");
1085
- }
1086
1067
  function we(r) {
1068
+ return Ie(r, "native");
1069
+ }
1070
+ function Re(r) {
1087
1071
  return r.__proform_raw_object = !0, r;
1088
1072
  }
1089
1073
  export {
1090
- Fe as ProForm,
1091
- Ve as markNativeFunction,
1092
- we as markNativeObject,
1093
- Re as useForm,
1094
- je as useFormPresetConfigurer,
1095
- Ce as useModifiers
1074
+ je as ProForm,
1075
+ we as markNativeFunction,
1076
+ Re as markNativeObject,
1077
+ Ve as useForm,
1078
+ Se as useFormPresetConfigurer,
1079
+ Ie as useModifiers
1096
1080
  };
@@ -1,4 +1,4 @@
1
- import { AnyObject, FormCustomization } from "../../types";
1
+ import { AnyFunction, AnyObject, FormCustomization } from "../../types";
2
2
  import { RuntimeCore } from "../index";
3
3
  export default class FormCustomizer {
4
4
  formCustomization: FormCustomization;
@@ -10,6 +10,5 @@ export default class FormCustomizer {
10
10
  submit(): Promise<AnyObject>;
11
11
  hydrate(data: AnyObject): Promise<never> | undefined;
12
12
  share(data: AnyObject): void;
13
- getReactiveModel(): AnyObject;
14
- setReactiveModel(data: AnyObject): AnyObject;
13
+ subscribeModel(callback: AnyFunction): void;
15
14
  }
@@ -1,13 +1,17 @@
1
1
  import { AnyObject } from "../types";
2
2
  import type { RuntimeCore } from "../services";
3
+ import { WatchStopHandle } from "vue";
3
4
  export type Setup = (runtimeCore: RuntimeCore) => any;
5
+ export type SubscribeUtils = {
6
+ stopSubscribe: WatchStopHandle;
7
+ };
8
+ export type SubscribeCallback = (value: any, utils: SubscribeUtils) => any;
4
9
  export type UseForm = [
5
10
  Setup,
6
11
  {
7
12
  submit: () => Promise<AnyObject>;
8
13
  hydrate: (data: AnyObject) => any;
9
14
  share: (data: AnyObject) => any;
10
- getReactiveModel: () => AnyObject;
11
- setReactiveModel: (data: AnyObject) => AnyObject;
15
+ subscribeModel: (callback: SubscribeCallback) => any;
12
16
  }
13
17
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",