@piying/view-vue 1.1.13 → 1.1.15
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/index.js +73 -73
- package/package.json +25 -25
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var U = (o, e, n) => e in o ?
|
|
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
3
|
var F = (o, e, n) => U(o, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { inject as
|
|
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
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
|
|
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
7
|
import { deepEqual as de } from "fast-equals";
|
|
8
8
|
class pe extends ee {
|
|
9
9
|
constructor() {
|
|
@@ -13,12 +13,12 @@ class pe extends ee {
|
|
|
13
13
|
}
|
|
14
14
|
class fe extends te {
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const x = Symbol(), me = Symbol();
|
|
17
17
|
function m(o) {
|
|
18
|
-
const e =
|
|
19
|
-
return
|
|
18
|
+
const e = O(x), n = A(void 0);
|
|
19
|
+
return L((r) => {
|
|
20
20
|
n.value = o();
|
|
21
|
-
const l =
|
|
21
|
+
const l = H(
|
|
22
22
|
() => {
|
|
23
23
|
const t = o();
|
|
24
24
|
Object.is(n.value, t) || (n.value = t);
|
|
@@ -30,23 +30,23 @@ function m(o) {
|
|
|
30
30
|
});
|
|
31
31
|
}), n;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const W = /* @__PURE__ */ $({
|
|
34
34
|
__name: "wrapper",
|
|
35
35
|
props: {
|
|
36
36
|
wrappers: {}
|
|
37
37
|
},
|
|
38
38
|
setup(o) {
|
|
39
39
|
const e = o, n = v(() => e.wrappers.slice(1)), r = v(() => e.wrappers[0]), l = m(() => {
|
|
40
|
-
var a,
|
|
41
|
-
return { ...(a = r.value) == null ? void 0 : a.inputs(), ...(
|
|
40
|
+
var a, u;
|
|
41
|
+
return { ...(a = r.value) == null ? void 0 : a.inputs(), ...(u = r.value) == null ? void 0 : u.attributes() };
|
|
42
42
|
}), t = v(() => {
|
|
43
43
|
var a;
|
|
44
44
|
return ((a = r.value) == null ? void 0 : a.outputs) ?? {};
|
|
45
45
|
});
|
|
46
|
-
return (a,
|
|
47
|
-
default:
|
|
48
|
-
J(
|
|
49
|
-
default:
|
|
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
50
|
T(a.$slots, "default")
|
|
51
51
|
]),
|
|
52
52
|
_: 3
|
|
@@ -55,32 +55,32 @@ const q = /* @__PURE__ */ j({
|
|
|
55
55
|
_: 3
|
|
56
56
|
}, 16)) : T(a.$slots, "default", { key: 1 });
|
|
57
57
|
}
|
|
58
|
-
}),
|
|
58
|
+
}), q = /* @__PURE__ */ $({
|
|
59
59
|
__name: "field-template",
|
|
60
60
|
props: {
|
|
61
61
|
field: {}
|
|
62
62
|
},
|
|
63
63
|
setup(o) {
|
|
64
|
-
const e = o, n =
|
|
65
|
-
var s,
|
|
66
|
-
return (
|
|
67
|
-
}),
|
|
68
|
-
var s,
|
|
69
|
-
return (
|
|
70
|
-
}),
|
|
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(
|
|
71
71
|
() => {
|
|
72
|
-
var s,
|
|
73
|
-
return typeof ((s = e.field.define) == null ? void 0 : s.type) == "function" ? X((
|
|
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;
|
|
74
74
|
}
|
|
75
|
-
),
|
|
76
|
-
N(me,
|
|
77
|
-
const C =
|
|
75
|
+
), _ = v(() => e.field);
|
|
76
|
+
N(me, _);
|
|
77
|
+
const C = E(null), z = oe(_.value.form.control);
|
|
78
78
|
let f;
|
|
79
|
-
return
|
|
80
|
-
[C,
|
|
81
|
-
([s,
|
|
82
|
-
f == null || f(),
|
|
83
|
-
() =>
|
|
79
|
+
return G(
|
|
80
|
+
[C, _],
|
|
81
|
+
([s, i]) => {
|
|
82
|
+
f == null || f(), z && s && (f = ne(
|
|
83
|
+
() => i.form.control,
|
|
84
84
|
s.cva,
|
|
85
85
|
n
|
|
86
86
|
));
|
|
@@ -88,30 +88,30 @@ const q = /* @__PURE__ */ j({
|
|
|
88
88
|
{ immediate: !0 }
|
|
89
89
|
), Y(() => {
|
|
90
90
|
f == null || f(), f = void 0;
|
|
91
|
-
}), (s,
|
|
91
|
+
}), (s, i) => {
|
|
92
92
|
var V;
|
|
93
|
-
return
|
|
94
|
-
(V =
|
|
93
|
+
return p(t).hidden ? B("", !0) : (c(), P(R, { key: 0 }, [
|
|
94
|
+
(V = _.value.define) != null && V.type ? (c(), y(W, {
|
|
95
95
|
key: 0,
|
|
96
|
-
wrappers:
|
|
96
|
+
wrappers: p(w)
|
|
97
97
|
}, {
|
|
98
|
-
default:
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
default: S(() => [
|
|
99
|
+
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 }, [
|
|
100
|
+
_.value.form.control ? (c(), y(k(d.value), I({ key: 0 }, u.value, b(p(l)), {
|
|
101
101
|
ref_key: "childRef",
|
|
102
102
|
ref: C
|
|
103
|
-
}), null, 16)) : (
|
|
103
|
+
}), null, 16)) : (c(), y(k(d.value), I({ key: 1 }, u.value, b(p(l))), null, 16))
|
|
104
104
|
], 64))
|
|
105
105
|
]),
|
|
106
106
|
_: 1
|
|
107
|
-
}, 8, ["wrappers"])) :
|
|
107
|
+
}, 8, ["wrappers"])) : B("", !0)
|
|
108
108
|
], 64));
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
function ve(o, e, n, r) {
|
|
113
113
|
let l = !0;
|
|
114
|
-
return
|
|
114
|
+
return H(
|
|
115
115
|
() => {
|
|
116
116
|
const t = e.value$$();
|
|
117
117
|
l ? (de(t, o) || r(t), l = !1) : r(t);
|
|
@@ -119,7 +119,7 @@ function ve(o, e, n, r) {
|
|
|
119
119
|
{ injector: n }
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
|
-
const Ce = /* @__PURE__ */
|
|
122
|
+
const Ce = /* @__PURE__ */ $({
|
|
123
123
|
__name: "piying-view",
|
|
124
124
|
props: {
|
|
125
125
|
schema: {},
|
|
@@ -136,53 +136,53 @@ const Ce = /* @__PURE__ */ j({
|
|
|
136
136
|
}
|
|
137
137
|
]
|
|
138
138
|
});
|
|
139
|
-
N(
|
|
140
|
-
const t =
|
|
141
|
-
return
|
|
139
|
+
N(x, l);
|
|
140
|
+
const t = A(void 0);
|
|
141
|
+
return G(
|
|
142
142
|
() => [n.schema, n.options],
|
|
143
|
-
([a,
|
|
144
|
-
const
|
|
143
|
+
([a, u], D, j) => {
|
|
144
|
+
const h = ue({ providers: [], parent: l }), g = re(a, {
|
|
145
145
|
handle: pe,
|
|
146
146
|
builder: fe,
|
|
147
|
-
injector:
|
|
148
|
-
registerOnDestroy: (
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
injector: h,
|
|
148
|
+
registerOnDestroy: (d) => {
|
|
149
|
+
h.get(ie).onDestroy(() => {
|
|
150
|
+
d();
|
|
151
151
|
});
|
|
152
152
|
},
|
|
153
|
-
...
|
|
153
|
+
...u
|
|
154
154
|
});
|
|
155
|
-
t.value =
|
|
156
|
-
let
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
typeof
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
(
|
|
155
|
+
t.value = g;
|
|
156
|
+
let w;
|
|
157
|
+
if (g.form.control) {
|
|
158
|
+
const d = n.modelValue;
|
|
159
|
+
w = ve(
|
|
160
|
+
typeof d < "u" ? d : void 0,
|
|
161
|
+
g.form.control,
|
|
162
|
+
h,
|
|
163
|
+
(_) => {
|
|
164
164
|
ce(() => {
|
|
165
165
|
var C;
|
|
166
|
-
(C =
|
|
166
|
+
(C = g.form.control) != null && C.valueNoError$$() && r("update:modelValue", _);
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
j(() => {
|
|
172
|
+
h.destroy(), w == null || w.destroy();
|
|
173
173
|
});
|
|
174
174
|
},
|
|
175
175
|
{ immediate: !0 }
|
|
176
|
-
),
|
|
176
|
+
), L(() => {
|
|
177
177
|
var a;
|
|
178
178
|
(a = t.value.form.control) == null || a.updateValue(n.modelValue);
|
|
179
|
-
}), (a,
|
|
179
|
+
}), (a, u) => (c(), y(q, {
|
|
180
180
|
field: t.value
|
|
181
181
|
}, null, 8, ["field"]));
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
function Ve() {
|
|
185
|
-
const o =
|
|
185
|
+
const o = E(), e = E(!1);
|
|
186
186
|
let n, r;
|
|
187
187
|
return {
|
|
188
188
|
cva: {
|
|
@@ -209,23 +209,23 @@ function Ve() {
|
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
const ke = /* @__PURE__ */
|
|
212
|
+
const ke = /* @__PURE__ */ $({
|
|
213
213
|
__name: "group",
|
|
214
214
|
props: {
|
|
215
215
|
fields: {}
|
|
216
216
|
},
|
|
217
217
|
setup(o) {
|
|
218
218
|
const e = o;
|
|
219
|
-
return (n, r) => (
|
|
219
|
+
return (n, r) => (c(!0), P(R, null, Z(e.fields, (l, t) => (c(), y(q, {
|
|
220
220
|
key: t,
|
|
221
221
|
field: l
|
|
222
222
|
}, null, 8, ["field"]))), 128));
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
export {
|
|
226
|
-
|
|
226
|
+
x as InjectorToken,
|
|
227
227
|
me as PI_VIEW_FIELD_TOKEN,
|
|
228
|
-
|
|
228
|
+
q as PiyingFieldTemplate,
|
|
229
229
|
Ce as PiyingView,
|
|
230
230
|
ke as PiyingViewGroup,
|
|
231
231
|
fe as VueFormBuilder,
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@piying/view-vue",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"dependencies": {
|
|
6
|
-
"@piying/view-core": "^0.6.27",
|
|
7
|
-
"fast-equals": "^5.2.2",
|
|
8
|
-
"rfdc": "^1.4.1",
|
|
9
|
-
"static-injector": "^6.1.2"
|
|
10
|
-
},
|
|
11
|
-
"sideEffects": false,
|
|
12
|
-
"peerDependencies": {
|
|
13
|
-
"vue": "^3.4.21"
|
|
14
|
-
},
|
|
15
|
-
"module": "index.js",
|
|
16
|
-
"typings": "index.d.ts",
|
|
17
|
-
"exports": {
|
|
18
|
-
"./package.json": {
|
|
19
|
-
"default": "./package.json"
|
|
20
|
-
},
|
|
21
|
-
".": {
|
|
22
|
-
"types": "./index.d.ts",
|
|
23
|
-
"default": "./index.js"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@piying/view-vue",
|
|
3
|
+
"version": "1.1.15",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@piying/view-core": "^0.6.27",
|
|
7
|
+
"fast-equals": "^5.2.2",
|
|
8
|
+
"rfdc": "^1.4.1",
|
|
9
|
+
"static-injector": "^6.1.2"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"vue": "^3.4.21"
|
|
14
|
+
},
|
|
15
|
+
"module": "index.js",
|
|
16
|
+
"typings": "index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": {
|
|
19
|
+
"default": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
|
+
"default": "./index.js"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
26
|
}
|