@piying/view-vue 1.1.11 → 1.1.13

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.
@@ -3,6 +3,6 @@ export declare function useControlValueAccessor(): {
3
3
  cva: ControlValueAccessor;
4
4
  value: import("vue").Ref<any>;
5
5
  disabled: import("vue").Ref<boolean>;
6
- valueChange: (value: any) => void;
6
+ valueChange: (input: any) => void;
7
7
  touchedChange: () => void;
8
8
  };
package/index.js CHANGED
@@ -1,7 +1,7 @@
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 = (o, e, n) => e in o ? L(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
+ var F = (o, e, n) => U(o, typeof e != "symbol" ? e + "" : e, n);
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 D, createVNode as J, normalizeProps as M, guardReactiveProps as Q, defineAsyncComponent as X, provide as N, ref as S, watch as H, onUnmounted as Y, createElementBlock as E, createCommentVNode as A, Fragment as P, 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
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";
@@ -14,29 +14,29 @@ class pe extends ee {
14
14
  class fe extends te {
15
15
  }
16
16
  const R = Symbol(), me = Symbol();
17
- function m(n) {
18
- const e = B(R), o = O(void 0);
17
+ function m(o) {
18
+ const e = B(R), n = O(void 0);
19
19
  return G((r) => {
20
- o.value = n();
20
+ n.value = o();
21
21
  const l = W(
22
22
  () => {
23
- const t = n();
24
- Object.is(o.value, t) || (o.value = t);
23
+ const t = o();
24
+ Object.is(n.value, t) || (n.value = t);
25
25
  },
26
26
  { injector: e }
27
27
  );
28
28
  r(() => {
29
29
  l.destroy();
30
30
  });
31
- }), o;
31
+ }), n;
32
32
  }
33
33
  const q = /* @__PURE__ */ j({
34
34
  __name: "wrapper",
35
35
  props: {
36
36
  wrappers: {}
37
37
  },
38
- setup(n) {
39
- const e = n, o = v(() => e.wrappers.slice(1)), r = v(() => e.wrappers[0]), l = m(() => {
38
+ setup(o) {
39
+ const e = o, n = v(() => e.wrappers.slice(1)), r = v(() => e.wrappers[0]), l = m(() => {
40
40
  var a, p;
41
41
  return { ...(a = r.value) == null ? void 0 : a.inputs(), ...(p = r.value) == null ? void 0 : p.attributes() };
42
42
  }), t = v(() => {
@@ -44,9 +44,9 @@ const q = /* @__PURE__ */ j({
44
44
  return ((a = r.value) == null ? void 0 : a.outputs) ?? {};
45
45
  });
46
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: $(() => [
47
+ default: D(() => [
48
+ J(q, M(Q({ wrappers: n.value })), {
49
+ default: D(() => [
50
50
  T(a.$slots, "default")
51
51
  ]),
52
52
  _: 3
@@ -60,46 +60,46 @@ const q = /* @__PURE__ */ j({
60
60
  props: {
61
61
  field: {}
62
62
  },
63
- 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()), w = m(() => {
63
+ setup(o) {
64
+ const e = o, n = 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() })), $ = m(() => e.field.wrappers()), g = m(() => {
65
65
  var s, u;
66
66
  return (u = (s = e.field).fieldGroup) == null ? void 0 : u.call(s);
67
- }), C = m(() => {
67
+ }), w = m(() => {
68
68
  var s, u;
69
69
  return (u = (s = e.field).fieldArray) == null ? void 0 : u.call(s);
70
70
  }), _ = v(() => ({ ...a.value, ...r.value })), c = v(
71
71
  () => {
72
- var s, u, g;
73
- return typeof ((s = e.field.define) == null ? void 0 : s.type) == "function" ? X((u = e.field.define) == null ? void 0 : u.type) : (g = e.field.define) == null ? void 0 : g.type;
72
+ var s, u, V;
73
+ 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
74
  }
75
75
  ), h = v(() => e.field);
76
76
  N(me, h);
77
- const V = D(null), K = oe(h.value.form.control);
77
+ const C = S(null), K = oe(h.value.form.control);
78
78
  let f;
79
79
  return H(
80
- [V, h],
80
+ [C, h],
81
81
  ([s, u]) => {
82
- f == null || f.forEach((g) => g()), K && s && (f = ne(
82
+ f == null || f(), K && s && (f = ne(
83
83
  () => u.form.control,
84
84
  s.cva,
85
- o
85
+ n
86
86
  ));
87
87
  },
88
88
  { immediate: !0 }
89
89
  ), Y(() => {
90
- f == null || f.forEach((s) => s()), f = [];
90
+ f == null || f(), f = void 0;
91
91
  }), (s, u) => {
92
- var g;
93
- return d(t).hidden ? A("", !0) : (i(), S(P, { key: 0 }, [
94
- (g = h.value.define) != null && g.type ? (i(), y(q, {
92
+ var V;
93
+ return d(t).hidden ? A("", !0) : (i(), E(P, { key: 0 }, [
94
+ (V = h.value.define) != null && V.type ? (i(), y(q, {
95
95
  key: 0,
96
- wrappers: d(E)
96
+ wrappers: d($)
97
97
  }, {
98
- default: $(() => [
99
- d(w) ? (i(), y(k(c.value), I({ key: 0 }, p.value, b(d(l))), null, 16)) : d(C) ? (i(), y(k(c.value), I({ key: 1 }, x.value, b(d(l))), null, 16)) : (i(), S(P, { key: 2 }, [
98
+ default: D(() => [
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(), E(P, { key: 2 }, [
100
100
  h.value.form.control ? (i(), y(k(c.value), I({ key: 0 }, _.value, b(d(l)), {
101
101
  ref_key: "childRef",
102
- ref: V
102
+ ref: C
103
103
  }), null, 16)) : (i(), y(k(c.value), I({ key: 1 }, _.value, b(d(l))), null, 16))
104
104
  ], 64))
105
105
  ]),
@@ -109,14 +109,14 @@ const q = /* @__PURE__ */ j({
109
109
  };
110
110
  }
111
111
  });
112
- function ve(n, e, o, r) {
112
+ function ve(o, e, n, r) {
113
113
  let l = !0;
114
114
  return W(
115
115
  () => {
116
116
  const t = e.value$$();
117
- l ? (de(t, n) || r(t), l = !1) : r(t);
117
+ l ? (de(t, o) || r(t), l = !1) : r(t);
118
118
  },
119
- { injector: o }
119
+ { injector: n }
120
120
  );
121
121
  }
122
122
  const Ce = /* @__PURE__ */ j({
@@ -127,8 +127,8 @@ const Ce = /* @__PURE__ */ j({
127
127
  options: {}
128
128
  },
129
129
  emits: ["update:modelValue"],
130
- setup(n, { emit: e }) {
131
- const o = n, r = e, l = le({
130
+ setup(o, { emit: e }) {
131
+ const n = o, r = e, l = le({
132
132
  providers: [
133
133
  {
134
134
  provide: se,
@@ -139,58 +139,58 @@ const Ce = /* @__PURE__ */ j({
139
139
  N(R, l);
140
140
  const t = O(void 0);
141
141
  return H(
142
- () => [o.schema, o.options],
143
- ([a, p], x, E) => {
144
- const w = ue({ providers: [], parent: l }), C = re(a, {
142
+ () => [n.schema, n.options],
143
+ ([a, p], x, $) => {
144
+ const g = ue({ providers: [], parent: l }), w = re(a, {
145
145
  handle: pe,
146
146
  builder: fe,
147
- injector: w,
147
+ injector: g,
148
148
  registerOnDestroy: (c) => {
149
- w.get(ie).onDestroy(() => {
149
+ g.get(ie).onDestroy(() => {
150
150
  c();
151
151
  });
152
152
  },
153
153
  ...p
154
154
  });
155
- t.value = C;
155
+ t.value = w;
156
156
  let _;
157
- if (C.form.control) {
158
- const c = o.modelValue;
157
+ if (w.form.control) {
158
+ const c = n.modelValue;
159
159
  _ = ve(
160
160
  typeof c < "u" ? c : void 0,
161
- C.form.control,
162
- w,
161
+ w.form.control,
162
+ g,
163
163
  (h) => {
164
164
  ce(() => {
165
- var V;
166
- (V = C.form.control) != null && V.valueNoError$$() && r("update:modelValue", h);
165
+ var C;
166
+ (C = w.form.control) != null && C.valueNoError$$() && r("update:modelValue", h);
167
167
  });
168
168
  }
169
169
  );
170
170
  }
171
- E(() => {
172
- w.destroy(), _ == null || _.destroy();
171
+ $(() => {
172
+ g.destroy(), _ == null || _.destroy();
173
173
  });
174
174
  },
175
175
  { immediate: !0 }
176
176
  ), G(() => {
177
177
  var a;
178
- (a = t.value.form.control) == null || a.updateValue(o.modelValue);
178
+ (a = t.value.form.control) == null || a.updateValue(n.modelValue);
179
179
  }), (a, p) => (i(), y(z, {
180
180
  field: t.value
181
181
  }, null, 8, ["field"]));
182
182
  }
183
183
  });
184
184
  function Ve() {
185
- const n = D(), e = D(!1);
186
- let o, r;
185
+ const o = S(), e = S(!1);
186
+ let n, r;
187
187
  return {
188
188
  cva: {
189
189
  writeValue(t) {
190
- n.value = t;
190
+ o.value = t;
191
191
  },
192
192
  registerOnChange(t) {
193
- o = t;
193
+ n = t;
194
194
  },
195
195
  registerOnTouched(t) {
196
196
  r = t;
@@ -199,10 +199,10 @@ function Ve() {
199
199
  e.value = t;
200
200
  }
201
201
  },
202
- value: n,
202
+ value: o,
203
203
  disabled: e,
204
204
  valueChange: (t) => {
205
- o(t);
205
+ n(t), o.value = t;
206
206
  },
207
207
  touchedChange: () => {
208
208
  r();
@@ -214,9 +214,9 @@ const ke = /* @__PURE__ */ j({
214
214
  props: {
215
215
  fields: {}
216
216
  },
217
- setup(n) {
218
- const e = n;
219
- return (o, r) => (i(!0), S(P, null, Z(e.fields, (l, t) => (i(), y(z, {
217
+ setup(o) {
218
+ const e = o;
219
+ return (n, r) => (i(!0), E(P, null, Z(e.fields, (l, t) => (i(), y(z, {
220
220
  key: t,
221
221
  field: l
222
222
  }, null, 8, ["field"]))), 128));
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@piying/view-vue",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@piying/view-core": "^0.6.25",
6
+ "@piying/view-core": "^0.6.27",
7
7
  "fast-equals": "^5.2.2",
8
8
  "rfdc": "^1.4.1",
9
9
  "static-injector": "^6.1.2"