@piying/view-vue 1.2.2 → 1.3.1

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,15 +1,2 @@
1
- import type { PiResolvedViewFieldConfig } from '../type/group';
2
- type __VLS_Props = {
3
- fields: PiResolvedViewFieldConfig[];
4
- };
5
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}, {}>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
6
2
  export default _default;
7
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
- type __VLS_TypePropsToOption<T> = {
9
- [K in keyof T]-?: {} extends Pick<T, K> ? {
10
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
- } : {
12
- type: import('vue').PropType<T[K]>;
13
- required: true;
14
- };
15
- };
package/index.js CHANGED
@@ -1,24 +1,24 @@
1
- var K = Object.defineProperty;
2
- var U = (o, e, n) => e in o ? K(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 O, shallowRef as A, watchEffect as L, defineComponent as $, computed as v, createBlock as y, renderSlot as T, openBlock as c, resolveDynamicComponent as k, mergeProps as I, unref as p, toHandlers as b, withCtx as S, createVNode as J, normalizeProps as M, guardReactiveProps as Q, defineAsyncComponent as X, provide as N, ref as E, watch as G, onUnmounted as Y, createElementBlock as P, createCommentVNode as B, Fragment as R, renderList as Z } from "vue";
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 H, createRootInjector as le, ChangeDetectionSchedulerImpl as ae, ChangeDetectionScheduler as se, createInjector as ue, DestroyRef as ie, untracked as ce } from "static-injector";
7
- import { deepEqual as de } from "fast-equals";
8
- class pe extends ee {
1
+ var z = Object.defineProperty;
2
+ var G = (o, e, n) => e in o ? z(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
+ var x = (o, e, n) => G(o, typeof e != "symbol" ? e + "" : e, n);
4
+ import { inject as E, shallowRef as B, watchEffect as O, defineComponent as I, computed as g, createBlock as _, renderSlot as F, openBlock as d, resolveDynamicComponent as w, mergeProps as V, unref as m, toHandlers as k, withCtx as j, createVNode as K, normalizeProps as U, guardReactiveProps as J, defineAsyncComponent as M, provide as L, ref as $, watch as N, onUnmounted as Q, createElementBlock as D, createCommentVNode as T, Fragment as S, renderList as X } from "vue";
5
+ import { CoreSchemaHandle as Y, FormBuilder as Z, isFieldControl as ee, createViewControlLink as te, convert as ne } from "@piying/view-core";
6
+ import { effect as H, createRootInjector as oe, ChangeDetectionSchedulerImpl as re, ChangeDetectionScheduler as le, createInjector as ae, DestroyRef as se, untracked as ce } from "static-injector";
7
+ import { deepEqual as ue } from "fast-equals";
8
+ class ie extends Y {
9
9
  constructor() {
10
10
  super(...arguments);
11
- F(this, "contents");
11
+ x(this, "contents");
12
12
  }
13
13
  }
14
- class fe extends te {
14
+ class de extends Z {
15
15
  }
16
- const x = Symbol(), me = Symbol();
17
- function m(o) {
18
- const e = O(x), n = A(void 0);
19
- return L((r) => {
16
+ const P = Symbol(), A = Symbol();
17
+ function v(o) {
18
+ const e = E(P), n = B(void 0);
19
+ return O((r) => {
20
20
  n.value = o();
21
- const l = H(
21
+ const a = H(
22
22
  () => {
23
23
  const t = o();
24
24
  Object.is(n.value, t) || (n.value = t);
@@ -26,96 +26,93 @@ function m(o) {
26
26
  { injector: e }
27
27
  );
28
28
  r(() => {
29
- l.destroy();
29
+ a.destroy();
30
30
  });
31
31
  }), n;
32
32
  }
33
- const W = /* @__PURE__ */ $({
33
+ const W = /* @__PURE__ */ I({
34
34
  __name: "wrapper",
35
35
  props: {
36
36
  wrappers: {}
37
37
  },
38
38
  setup(o) {
39
- const e = o, n = v(() => e.wrappers.slice(1)), r = v(() => e.wrappers[0]), l = m(() => {
40
- var a, u;
41
- return { ...(a = r.value) == null ? void 0 : a.inputs(), ...(u = r.value) == null ? void 0 : u.attributes() };
42
- }), t = v(() => {
43
- var a;
44
- return ((a = r.value) == null ? void 0 : a.outputs) ?? {};
39
+ const e = o, n = g(() => e.wrappers.slice(1)), r = g(() => e.wrappers[0]), a = v(() => {
40
+ var l, c;
41
+ return { ...(l = r.value) == null ? void 0 : l.inputs(), ...(c = r.value) == null ? void 0 : c.attributes() };
42
+ }), t = g(() => {
43
+ var l;
44
+ return ((l = r.value) == null ? void 0 : l.outputs) ?? {};
45
45
  });
46
- return (a, u) => r.value ? (c(), y(k(r.value.type), I({ key: 0 }, p(l), b(t.value)), {
47
- default: S(() => [
48
- J(W, M(Q({ wrappers: n.value })), {
49
- default: S(() => [
50
- T(a.$slots, "default")
46
+ return (l, c) => r.value ? (d(), _(w(r.value.type), V({ key: 0 }, m(a), k(t.value)), {
47
+ default: j(() => [
48
+ K(W, U(J({ wrappers: n.value })), {
49
+ default: j(() => [
50
+ F(l.$slots, "default")
51
51
  ]),
52
52
  _: 3
53
53
  }, 16)
54
54
  ]),
55
55
  _: 3
56
- }, 16)) : T(a.$slots, "default", { key: 1 });
56
+ }, 16)) : F(l.$slots, "default", { key: 1 });
57
57
  }
58
- }), q = /* @__PURE__ */ $({
58
+ }), q = /* @__PURE__ */ I({
59
59
  __name: "field-template",
60
60
  props: {
61
61
  field: {}
62
62
  },
63
63
  setup(o) {
64
- const e = o, n = O(x), r = m(() => e.field.inputs()), l = m(() => e.field.outputs()), t = m(() => e.field.renderConfig()), a = m(() => e.field.attributes()), u = v(() => ({ ...a.value, ...r.value })), D = m(() => {
65
- var s, i;
66
- return (i = (s = e.field).fieldGroup) == null ? void 0 : i.call(s);
67
- }), j = m(() => {
68
- var s, i;
69
- return (i = (s = e.field).fieldArray) == null ? void 0 : i.call(s);
70
- }), h = v(() => ({ ...u.value, fields: D.value })), g = v(() => ({ ...u.value, fields: j.value })), w = m(() => e.field.wrappers()), d = v(
64
+ const e = o, n = E(P), r = v(() => e.field.inputs()), a = v(() => e.field.outputs()), t = v(() => e.field.renderConfig()), l = v(() => e.field.attributes()), c = g(() => ({ ...l.value, ...r.value })), R = v(() => {
65
+ var s, f;
66
+ return (f = (s = e.field).children) == null ? void 0 : f.call(s);
67
+ }), b = v(() => e.field.wrappers()), p = g(
71
68
  () => {
72
- var s, i, V;
73
- return typeof ((s = e.field.define) == null ? void 0 : s.type) == "function" ? X((i = e.field.define) == null ? void 0 : i.type) : (V = e.field.define) == null ? void 0 : V.type;
69
+ var s, f, C;
70
+ return typeof ((s = e.field.define) == null ? void 0 : s.type) == "function" ? M((f = e.field.define) == null ? void 0 : f.type) : (C = e.field.define) == null ? void 0 : C.type;
74
71
  }
75
- ), _ = v(() => e.field);
76
- N(me, _);
77
- const C = E(null), z = oe(_.value.form.control);
78
- let f;
79
- return G(
80
- [C, _],
81
- ([s, i]) => {
82
- f == null || f(), z && s && (f = ne(() => i.form.control, s.cva, n));
72
+ ), u = g(() => e.field);
73
+ L(A, u);
74
+ const y = $(null), h = ee(u.value.form.control);
75
+ let i;
76
+ return N(
77
+ [y, u],
78
+ ([s, f]) => {
79
+ i == null || i(), h && s && (i = te(() => f.form.control, s.cva, n));
83
80
  },
84
81
  { immediate: !0 }
85
- ), Y(() => {
86
- f == null || f(), f = void 0;
87
- }), (s, i) => {
88
- var V;
89
- return p(t).hidden ? B("", !0) : (c(), P(R, { key: 0 }, [
90
- (V = _.value.define) != null && V.type ? (c(), y(W, {
82
+ ), Q(() => {
83
+ i == null || i(), i = void 0;
84
+ }), (s, f) => {
85
+ var C;
86
+ return m(t).hidden ? T("", !0) : (d(), D(S, { key: 0 }, [
87
+ (C = u.value.define) != null && C.type ? (d(), _(W, {
91
88
  key: 0,
92
- wrappers: p(w)
89
+ wrappers: m(b)
93
90
  }, {
94
- default: S(() => [
95
- p(D) ? (c(), y(k(d.value), I({ key: 0 }, h.value, b(p(l))), null, 16)) : p(j) ? (c(), y(k(d.value), I({ key: 1 }, g.value, b(p(l))), null, 16)) : (c(), P(R, { key: 2 }, [
96
- _.value.form.control ? (c(), y(k(d.value), I({ key: 0 }, u.value, b(p(l)), {
91
+ default: j(() => [
92
+ m(R) ? (d(), _(w(p.value), V({ key: 0 }, c.value, k(m(a))), null, 16)) : (d(), D(S, { key: 1 }, [
93
+ u.value.form.control ? (d(), _(w(p.value), V({ key: 0 }, c.value, k(m(a)), {
97
94
  ref_key: "childRef",
98
- ref: C
99
- }), null, 16)) : (c(), y(k(d.value), I({ key: 1 }, u.value, b(p(l))), null, 16))
95
+ ref: y
96
+ }), null, 16)) : (d(), _(w(p.value), V({ key: 1 }, c.value, k(m(a))), null, 16))
100
97
  ], 64))
101
98
  ]),
102
99
  _: 1
103
- }, 8, ["wrappers"])) : B("", !0)
100
+ }, 8, ["wrappers"])) : T("", !0)
104
101
  ], 64));
105
102
  };
106
103
  }
107
104
  });
108
- function ve(o, e, n, r) {
109
- let l = !0;
105
+ function pe(o, e, n, r) {
106
+ let a = !0;
110
107
  return H(
111
108
  () => {
112
109
  const t = e.value$$();
113
- l ? (de(t, o) || r(t), l = !1) : r(t);
110
+ a ? (ue(t, o) || r(t), a = !1) : r(t);
114
111
  },
115
112
  { injector: n }
116
113
  );
117
114
  }
118
- const Ce = /* @__PURE__ */ $({
115
+ const he = /* @__PURE__ */ I({
119
116
  __name: "piying-view",
120
117
  props: {
121
118
  schema: {},
@@ -124,61 +121,61 @@ const Ce = /* @__PURE__ */ $({
124
121
  },
125
122
  emits: ["update:modelValue"],
126
123
  setup(o, { emit: e }) {
127
- const n = o, r = e, l = le({
124
+ const n = o, r = e, a = oe({
128
125
  providers: [
129
126
  {
130
- provide: se,
131
- useClass: ae
127
+ provide: le,
128
+ useClass: re
132
129
  }
133
130
  ]
134
131
  });
135
- N(x, l);
136
- const t = A(void 0);
137
- return G(
132
+ L(P, a);
133
+ const t = B(void 0);
134
+ return N(
138
135
  () => [n.schema, n.options],
139
- ([a, u], D, j) => {
140
- const h = ue({ providers: [], parent: l }), g = re(a, {
141
- handle: pe,
142
- builder: fe,
143
- injector: h,
144
- registerOnDestroy: (d) => {
145
- h.get(ie).onDestroy(() => {
146
- d();
136
+ ([l, c], R, b) => {
137
+ const p = ae({ providers: [], parent: a }), u = ne(l, {
138
+ handle: ie,
139
+ builder: de,
140
+ injector: p,
141
+ registerOnDestroy: (h) => {
142
+ p.get(se).onDestroy(() => {
143
+ h();
147
144
  });
148
145
  },
149
- ...u
146
+ ...c
150
147
  });
151
- t.value = g;
152
- let w;
153
- if (g.form.control) {
154
- const d = n.modelValue;
155
- w = ve(
156
- typeof d < "u" ? d : void 0,
157
- g.form.control,
158
- h,
159
- (_) => {
148
+ t.value = u;
149
+ let y;
150
+ if (u.form.control) {
151
+ const h = n.modelValue;
152
+ y = pe(
153
+ typeof h < "u" ? h : void 0,
154
+ u.form.control,
155
+ p,
156
+ (i) => {
160
157
  ce(() => {
161
- var C;
162
- (C = g.form.control) != null && C.valueNoError$$() && r("update:modelValue", _);
158
+ var s;
159
+ (s = u.form.control) != null && s.valueNoError$$() && r("update:modelValue", i);
163
160
  });
164
161
  }
165
162
  );
166
163
  }
167
- j(() => {
168
- h.destroy(), w == null || w.destroy();
164
+ b(() => {
165
+ p.destroy(), y == null || y.destroy();
169
166
  });
170
167
  },
171
168
  { immediate: !0 }
172
- ), L(() => {
173
- var a;
174
- (a = t.value.form.control) == null || a.updateValue(n.modelValue);
175
- }), (a, u) => (c(), y(q, {
169
+ ), O(() => {
170
+ var l;
171
+ (l = t.value.form.control) == null || l.updateValue(n.modelValue);
172
+ }), (l, c) => (d(), _(q, {
176
173
  field: t.value
177
174
  }, null, 8, ["field"]));
178
175
  }
179
176
  });
180
- function Ve() {
181
- const o = E(), e = E(!1);
177
+ function ge() {
178
+ const o = $(), e = $(!1);
182
179
  let n, r;
183
180
  return {
184
181
  cva: {
@@ -207,28 +204,25 @@ function Ve() {
207
204
  }
208
205
  };
209
206
  }
210
- const ke = /* @__PURE__ */ $({
207
+ const Ce = /* @__PURE__ */ I({
211
208
  __name: "group",
212
- props: {
213
- fields: {}
214
- },
215
209
  setup(o) {
216
- const e = o;
217
- return (n, r) => (c(!0), P(R, null, Z(e.fields, (l, t) => (c(), y(q, {
218
- key: t,
219
- field: l
210
+ const e = E(A), n = v(() => e == null ? void 0 : e.value.children());
211
+ return (r, a) => (d(!0), D(S, null, X(m(n), (t, l) => (d(), _(q, {
212
+ key: l,
213
+ field: t
220
214
  }, null, 8, ["field"]))), 128));
221
215
  }
222
216
  });
223
217
  export {
224
- x as InjectorToken,
225
- me as PI_VIEW_FIELD_TOKEN,
218
+ P as InjectorToken,
219
+ A as PI_VIEW_FIELD_TOKEN,
226
220
  q as PiyingFieldTemplate,
227
- Ce as PiyingView,
228
- ke as PiyingViewGroup,
229
- fe as VueFormBuilder,
230
- pe as VueSchemaHandle,
231
- ve as initListen,
232
- m as signalToRef,
233
- Ve as useControlValueAccessor
221
+ he as PiyingView,
222
+ Ce as PiyingViewGroup,
223
+ de as VueFormBuilder,
224
+ ie as VueSchemaHandle,
225
+ pe as initListen,
226
+ v as signalToRef,
227
+ ge as useControlValueAccessor
234
228
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piying/view-vue",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "description": "Piying view For Vue;Valibot to Component",
5
5
  "type": "module",
6
6
  "homepage": "https://piying-org.github.io/website/docs/client/intro",
@@ -36,7 +36,7 @@
36
36
  ],
37
37
  "license": "MIT",
38
38
  "dependencies": {
39
- "@piying/view-core": "^1.2.2",
39
+ "@piying/view-core": "^1.3.1",
40
40
  "fast-equals": "^5.2.2",
41
41
  "rfdc": "^1.4.1",
42
42
  "static-injector": "^6.1.2"
package/readme.md CHANGED
@@ -1 +1,27 @@
1
- [document](https://piying-org.github.io/website/docs/client/intro)
1
+ <div><a href="https://www.npmjs.com/package/@piying/view-core"><img src="https://img.shields.io/npm/v/@piying/view-core" alt="NPM Version" /></a> <a href="https://coveralls.io/github/piying-org/piying-view?branch=main"><img src="https://coveralls.io/repos/github/piying-org/piying-view/badge.svg" alt="Coverage Status" ></a> <a href=""><img src="https://img.shields.io/badge/License-MIT-teal.svg" alt="MIT License" /></a></div>
2
+
3
+ ## document
4
+
5
+ - https://piying-org.github.io/website/docs/client/intro
6
+
7
+ ## start
8
+
9
+ - npm i
10
+ - npm run create-view-core
11
+
12
+ ## test
13
+
14
+ - npx playwright install
15
+ - npm run test:all
16
+
17
+ ### test Core/Angular
18
+
19
+ - npm run test
20
+
21
+ ### test Vue
22
+
23
+ - npm run test:vue
24
+
25
+ ### test React
26
+
27
+ - npm run test:react