@piying/view-vue 1.1.7 → 1.1.8

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.
@@ -1,4 +1,5 @@
1
- import { FormBuilder } from '@piying/view-core';
1
+ import { FormBuilder, type _PiResolvedCommonViewFieldConfig } from '@piying/view-core';
2
2
  import type { VueSchemaHandle } from './vue-schema';
3
3
  export declare class VueFormBuilder extends FormBuilder<VueSchemaHandle> {
4
+ afterResolveConfig(rawConfig: VueSchemaHandle, config: _PiResolvedCommonViewFieldConfig): _PiResolvedCommonViewFieldConfig | undefined;
4
5
  }
package/index.js CHANGED
@@ -1,34 +1,37 @@
1
1
  var L = Object.defineProperty;
2
- var U = (n, e, o) => e in n ? L(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o;
3
- var F = (n, e, o) => U(n, typeof e != "symbol" ? e + "" : e, o);
4
- import { inject as B, shallowRef as O, watchEffect as G, defineComponent as j, computed as v, createBlock as y, renderSlot as T, openBlock as i, resolveDynamicComponent as k, mergeProps as I, unref as d, toHandlers as b, withCtx as $, createVNode as J, normalizeProps as M, guardReactiveProps as Q, defineAsyncComponent as X, provide as N, ref as D, watch as H, onUnmounted as Y, createElementBlock as S, createCommentVNode as A, Fragment as P, renderList as Z } from "vue";
2
+ var U = (n, e, t) => e in n ? L(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var F = (n, e, t) => U(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { inject as B, shallowRef as O, watchEffect as G, defineComponent as j, computed as v, createBlock as y, renderSlot as T, openBlock as i, resolveDynamicComponent as k, mergeProps as I, unref as d, toHandlers as b, withCtx as R, createVNode as J, normalizeProps as M, guardReactiveProps as Q, defineAsyncComponent as X, provide as N, ref as $, watch as H, onUnmounted as Y, createElementBlock as D, createCommentVNode as A, Fragment as S, renderList as Z } from "vue";
5
5
  import { CoreSchemaHandle as ee, FormBuilder as te, isFieldControl as oe, createViewControlLink as ne, convert as re } from "@piying/view-core";
6
- import { effect as W, createRootInjector as le, ChangeDetectionSchedulerImpl as ae, ChangeDetectionScheduler as ue, createInjector as se, DestroyRef as ie, untracked as ce } from "static-injector";
6
+ import { effect as W, createRootInjector as le, ChangeDetectionSchedulerImpl as ae, ChangeDetectionScheduler as se, createInjector as ue, DestroyRef as ie, untracked as ce } from "static-injector";
7
7
  import { deepEqual as de } from "fast-equals";
8
- class pe extends ee {
8
+ class fe extends ee {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  F(this, "contents");
12
12
  }
13
13
  }
14
- class fe extends te {
14
+ class pe extends te {
15
+ afterResolveConfig(e, t) {
16
+ return super.afterResolveConfig(e, t);
17
+ }
15
18
  }
16
- const R = Symbol(), me = Symbol();
19
+ const P = Symbol(), me = Symbol();
17
20
  function m(n) {
18
- const e = B(R), o = O(void 0);
21
+ const e = B(P), t = O(void 0);
19
22
  return G((r) => {
20
- o.value = n();
23
+ t.value = n();
21
24
  const l = W(
22
25
  () => {
23
- const t = n();
24
- Object.is(o.value, t) || (o.value = t);
26
+ const o = n();
27
+ Object.is(t.value, o) || (t.value = o);
25
28
  },
26
29
  { injector: e }
27
30
  );
28
31
  r(() => {
29
32
  l.destroy();
30
33
  });
31
- }), o;
34
+ }), t;
32
35
  }
33
36
  const q = /* @__PURE__ */ j({
34
37
  __name: "wrapper",
@@ -36,17 +39,17 @@ const q = /* @__PURE__ */ j({
36
39
  wrappers: {}
37
40
  },
38
41
  setup(n) {
39
- const e = n, o = v(() => e.wrappers.slice(1)), r = v(() => e.wrappers[0]), l = m(() => {
40
- var a, p;
41
- return { ...(a = r.value) == null ? void 0 : a.inputs(), ...(p = r.value) == null ? void 0 : p.attributes() };
42
- }), t = v(() => {
42
+ const e = n, t = v(() => e.wrappers.slice(1)), r = v(() => e.wrappers[0]), l = m(() => {
43
+ var a, f;
44
+ return { ...(a = r.value) == null ? void 0 : a.inputs(), ...(f = r.value) == null ? void 0 : f.attributes() };
45
+ }), o = v(() => {
43
46
  var a;
44
47
  return ((a = r.value) == null ? void 0 : a.outputs) ?? {};
45
48
  });
46
- return (a, p) => r.value ? (i(), y(k(r.value.type), I({ key: 0 }, d(l), b(t.value)), {
47
- default: $(() => [
48
- J(q, M(Q({ wrappers: o.value })), {
49
- default: $(() => [
49
+ return (a, f) => r.value ? (i(), y(k(r.value.type), I({ key: 0 }, d(l), b(o.value)), {
50
+ default: R(() => [
51
+ J(q, M(Q({ wrappers: t.value })), {
52
+ default: R(() => [
50
53
  T(a.$slots, "default")
51
54
  ]),
52
55
  _: 3
@@ -61,45 +64,45 @@ const q = /* @__PURE__ */ j({
61
64
  field: {}
62
65
  },
63
66
  setup(n) {
64
- const e = n, o = B(R), r = m(() => e.field.inputs()), l = m(() => e.field.outputs()), t = m(() => e.field.renderConfig()), a = m(() => e.field.attributes()), p = v(() => ({ ...r.value, fields: e.field.fieldGroup() })), x = v(() => ({ ...r.value, fields: e.field.fieldArray() })), E = m(() => e.field.wrappers()), g = m(() => {
65
- var u, s;
66
- return (s = (u = e.field).fieldGroup) == null ? void 0 : s.call(u);
67
- }), w = m(() => {
68
- var u, s;
69
- return (s = (u = e.field).fieldArray) == null ? void 0 : s.call(u);
67
+ const e = n, t = B(P), r = m(() => e.field.inputs()), l = m(() => e.field.outputs()), o = m(() => e.field.renderConfig()), a = m(() => e.field.attributes()), f = v(() => ({ ...r.value, fields: e.field.fieldGroup() })), x = v(() => ({ ...r.value, fields: e.field.fieldArray() })), E = m(() => e.field.wrappers()), g = m(() => {
68
+ var s, u;
69
+ return (u = (s = e.field).fieldGroup) == null ? void 0 : u.call(s);
70
+ }), C = m(() => {
71
+ var s, u;
72
+ return (u = (s = e.field).fieldArray) == null ? void 0 : u.call(s);
70
73
  }), _ = v(() => ({ ...a.value, ...r.value })), c = v(
71
74
  () => {
72
- var u, s, V;
73
- return typeof ((u = e.field.define) == null ? void 0 : u.type) == "function" ? X((s = e.field.define) == null ? void 0 : s.type) : (V = e.field.define) == null ? void 0 : V.type;
75
+ var s, u, V;
76
+ return typeof ((s = e.field.define) == null ? void 0 : s.type) == "function" ? X((u = e.field.define) == null ? void 0 : u.type) : (V = e.field.define) == null ? void 0 : V.type;
74
77
  }
75
78
  ), h = v(() => e.field);
76
79
  N(me, h);
77
- const C = D(null), K = oe(h.value.form.control);
78
- let f;
80
+ const w = $(null), K = oe(h.value.form.control);
81
+ let p;
79
82
  return H(
80
- C,
81
- (u) => {
82
- f == null || f.forEach((s) => s()), K && u && (f = ne(
83
+ w,
84
+ (s) => {
85
+ p == null || p.forEach((u) => u()), K && s && (p = ne(
83
86
  () => h.value.form.control,
84
- u.cva,
85
- o
87
+ s.cva,
88
+ t
86
89
  ));
87
90
  },
88
91
  { immediate: !0 }
89
92
  ), Y(() => {
90
- f == null || f.forEach((u) => u()), f = [];
91
- }), (u, s) => {
93
+ p == null || p.forEach((s) => s()), p = [];
94
+ }), (s, u) => {
92
95
  var V;
93
- return d(t).hidden ? A("", !0) : (i(), S(P, { key: 0 }, [
96
+ return d(o).hidden ? A("", !0) : (i(), D(S, { key: 0 }, [
94
97
  (V = h.value.define) != null && V.type ? (i(), y(q, {
95
98
  key: 0,
96
99
  wrappers: d(E)
97
100
  }, {
98
- default: $(() => [
99
- d(g) ? (i(), y(k(c.value), I({ key: 0 }, p.value, b(d(l))), null, 16)) : d(w) ? (i(), y(k(c.value), I({ key: 1 }, x.value, b(d(l))), null, 16)) : (i(), S(P, { key: 2 }, [
101
+ default: R(() => [
102
+ d(g) ? (i(), y(k(c.value), I({ key: 0 }, f.value, b(d(l))), null, 16)) : d(C) ? (i(), y(k(c.value), I({ key: 1 }, x.value, b(d(l))), null, 16)) : (i(), D(S, { key: 2 }, [
100
103
  h.value.form.control ? (i(), y(k(c.value), I({ key: 0 }, _.value, b(d(l)), {
101
104
  ref_key: "childRef",
102
- ref: C
105
+ ref: w
103
106
  }), null, 16)) : (i(), y(k(c.value), I({ key: 1 }, _.value, b(d(l))), null, 16))
104
107
  ], 64))
105
108
  ]),
@@ -109,17 +112,17 @@ const q = /* @__PURE__ */ j({
109
112
  };
110
113
  }
111
114
  });
112
- function ve(n, e, o, r) {
115
+ function ve(n, e, t, r) {
113
116
  let l = !0;
114
117
  return W(
115
118
  () => {
116
- const t = e.value$$();
117
- l ? (de(t, n) || r(t), l = !1) : r(t);
119
+ const o = e.value$$();
120
+ l ? (de(o, n) || r(o), l = !1) : r(o);
118
121
  },
119
- { injector: o }
122
+ { injector: t }
120
123
  );
121
124
  }
122
- const Ce = /* @__PURE__ */ j({
125
+ const we = /* @__PURE__ */ j({
123
126
  __name: "piying-view",
124
127
  props: {
125
128
  schema: {},
@@ -128,42 +131,42 @@ const Ce = /* @__PURE__ */ j({
128
131
  },
129
132
  emits: ["update:modelValue"],
130
133
  setup(n, { emit: e }) {
131
- const o = n, r = e, l = le({
134
+ const t = n, r = e, l = le({
132
135
  providers: [
133
136
  {
134
- provide: ue,
137
+ provide: se,
135
138
  useClass: ae
136
139
  }
137
140
  ]
138
141
  });
139
- N(R, l);
140
- const t = O(void 0);
142
+ N(P, l);
143
+ const o = O(void 0);
141
144
  return H(
142
- () => [o.schema, o.options],
143
- ([a, p], x, E) => {
144
- const g = se({ providers: [], parent: l }), w = re(a, {
145
- handle: pe,
146
- builder: fe,
145
+ () => [t.schema, t.options],
146
+ ([a, f], x, E) => {
147
+ const g = ue({ providers: [], parent: l }), C = re(a, {
148
+ handle: fe,
149
+ builder: pe,
147
150
  injector: g,
148
151
  registerOnDestroy: (c) => {
149
152
  g.get(ie).onDestroy(() => {
150
153
  c();
151
154
  });
152
155
  },
153
- ...p
156
+ ...f
154
157
  });
155
- t.value = w;
158
+ o.value = C;
156
159
  let _;
157
- if (w.form.control) {
158
- const c = o.modelValue;
160
+ if (C.form.control) {
161
+ const c = t.modelValue;
159
162
  _ = ve(
160
163
  typeof c < "u" ? c : void 0,
161
- w.form.control,
164
+ C.form.control,
162
165
  g,
163
166
  (h) => {
164
167
  ce(() => {
165
- var C;
166
- (C = w.form.control) != null && C.valueNoError$$() && r("update:modelValue", h);
168
+ var w;
169
+ (w = C.form.control) != null && w.valueNoError$$() && r("update:modelValue", h);
167
170
  });
168
171
  }
169
172
  );
@@ -175,34 +178,34 @@ const Ce = /* @__PURE__ */ j({
175
178
  { immediate: !0 }
176
179
  ), G(() => {
177
180
  var a;
178
- (a = t.value.form.control) == null || a.updateValue(o.modelValue);
179
- }), (a, p) => (i(), y(z, {
180
- field: t.value
181
+ (a = o.value.form.control) == null || a.updateValue(t.modelValue);
182
+ }), (a, f) => (i(), y(z, {
183
+ field: o.value
181
184
  }, null, 8, ["field"]));
182
185
  }
183
186
  });
184
187
  function Ve() {
185
- const n = D(), e = D(!1);
186
- let o, r;
188
+ const n = $(), e = $(!1);
189
+ let t, r;
187
190
  return {
188
191
  cva: {
189
- writeValue(t) {
190
- n.value = t;
192
+ writeValue(o) {
193
+ n.value = o;
191
194
  },
192
- registerOnChange(t) {
193
- o = t;
195
+ registerOnChange(o) {
196
+ t = o;
194
197
  },
195
- registerOnTouched(t) {
196
- r = t;
198
+ registerOnTouched(o) {
199
+ r = o;
197
200
  },
198
- setDisabledState(t) {
199
- e.value = t;
201
+ setDisabledState(o) {
202
+ e.value = o;
200
203
  }
201
204
  },
202
205
  value: n,
203
206
  disabled: e,
204
- valueChange: (t) => {
205
- o(t);
207
+ valueChange: (o) => {
208
+ t(o);
206
209
  },
207
210
  touchedChange: () => {
208
211
  r();
@@ -216,20 +219,20 @@ const ke = /* @__PURE__ */ j({
216
219
  },
217
220
  setup(n) {
218
221
  const e = n;
219
- return (o, r) => (i(!0), S(P, null, Z(e.fields, (l, t) => (i(), y(z, {
220
- key: t,
222
+ return (t, r) => (i(!0), D(S, null, Z(e.fields, (l, o) => (i(), y(z, {
223
+ key: o,
221
224
  field: l
222
225
  }, null, 8, ["field"]))), 128));
223
226
  }
224
227
  });
225
228
  export {
226
- R as InjectorToken,
229
+ P as InjectorToken,
227
230
  me as PI_VIEW_FIELD_TOKEN,
228
231
  z as PiyingFieldTemplate,
229
- Ce as PiyingView,
232
+ we as PiyingView,
230
233
  ke as PiyingViewGroup,
231
- fe as VueFormBuilder,
232
- pe as VueSchemaHandle,
234
+ pe as VueFormBuilder,
235
+ fe as VueSchemaHandle,
233
236
  ve as initListen,
234
237
  m as signalToRef,
235
238
  Ve as useControlValueAccessor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piying/view-vue",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@piying/view-core": "^0.6.22",