@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.
- package/formly/builder.d.ts +2 -1
- package/index.js +86 -83
- package/package.json +1 -1
package/formly/builder.d.ts
CHANGED
|
@@ -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,
|
|
3
|
-
var F = (n, e,
|
|
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
|
|
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
|
|
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
|
|
8
|
+
class fe extends ee {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
F(this, "contents");
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class pe extends te {
|
|
15
|
+
afterResolveConfig(e, t) {
|
|
16
|
+
return super.afterResolveConfig(e, t);
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
|
-
const
|
|
19
|
+
const P = Symbol(), me = Symbol();
|
|
17
20
|
function m(n) {
|
|
18
|
-
const e = B(
|
|
21
|
+
const e = B(P), t = O(void 0);
|
|
19
22
|
return G((r) => {
|
|
20
|
-
|
|
23
|
+
t.value = n();
|
|
21
24
|
const l = W(
|
|
22
25
|
() => {
|
|
23
|
-
const
|
|
24
|
-
Object.is(
|
|
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
|
-
}),
|
|
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,
|
|
40
|
-
var a,
|
|
41
|
-
return { ...(a = r.value) == null ? void 0 : a.inputs(), ...(
|
|
42
|
-
}),
|
|
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,
|
|
47
|
-
default:
|
|
48
|
-
J(q, M(Q({ wrappers:
|
|
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,
|
|
65
|
-
var
|
|
66
|
-
return (
|
|
67
|
-
}),
|
|
68
|
-
var
|
|
69
|
-
return (
|
|
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
|
|
73
|
-
return typeof ((
|
|
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
|
|
78
|
-
let
|
|
80
|
+
const w = $(null), K = oe(h.value.form.control);
|
|
81
|
+
let p;
|
|
79
82
|
return H(
|
|
80
|
-
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
+
w,
|
|
84
|
+
(s) => {
|
|
85
|
+
p == null || p.forEach((u) => u()), K && s && (p = ne(
|
|
83
86
|
() => h.value.form.control,
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
s.cva,
|
|
88
|
+
t
|
|
86
89
|
));
|
|
87
90
|
},
|
|
88
91
|
{ immediate: !0 }
|
|
89
92
|
), Y(() => {
|
|
90
|
-
|
|
91
|
-
}), (
|
|
93
|
+
p == null || p.forEach((s) => s()), p = [];
|
|
94
|
+
}), (s, u) => {
|
|
92
95
|
var V;
|
|
93
|
-
return d(
|
|
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 },
|
|
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:
|
|
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,
|
|
115
|
+
function ve(n, e, t, r) {
|
|
113
116
|
let l = !0;
|
|
114
117
|
return W(
|
|
115
118
|
() => {
|
|
116
|
-
const
|
|
117
|
-
l ? (de(
|
|
119
|
+
const o = e.value$$();
|
|
120
|
+
l ? (de(o, n) || r(o), l = !1) : r(o);
|
|
118
121
|
},
|
|
119
|
-
{ injector:
|
|
122
|
+
{ injector: t }
|
|
120
123
|
);
|
|
121
124
|
}
|
|
122
|
-
const
|
|
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
|
|
134
|
+
const t = n, r = e, l = le({
|
|
132
135
|
providers: [
|
|
133
136
|
{
|
|
134
|
-
provide:
|
|
137
|
+
provide: se,
|
|
135
138
|
useClass: ae
|
|
136
139
|
}
|
|
137
140
|
]
|
|
138
141
|
});
|
|
139
|
-
N(
|
|
140
|
-
const
|
|
142
|
+
N(P, l);
|
|
143
|
+
const o = O(void 0);
|
|
141
144
|
return H(
|
|
142
|
-
() => [
|
|
143
|
-
([a,
|
|
144
|
-
const g =
|
|
145
|
-
handle:
|
|
146
|
-
builder:
|
|
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
|
-
...
|
|
156
|
+
...f
|
|
154
157
|
});
|
|
155
|
-
|
|
158
|
+
o.value = C;
|
|
156
159
|
let _;
|
|
157
|
-
if (
|
|
158
|
-
const c =
|
|
160
|
+
if (C.form.control) {
|
|
161
|
+
const c = t.modelValue;
|
|
159
162
|
_ = ve(
|
|
160
163
|
typeof c < "u" ? c : void 0,
|
|
161
|
-
|
|
164
|
+
C.form.control,
|
|
162
165
|
g,
|
|
163
166
|
(h) => {
|
|
164
167
|
ce(() => {
|
|
165
|
-
var
|
|
166
|
-
(
|
|
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 =
|
|
179
|
-
}), (a,
|
|
180
|
-
field:
|
|
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 =
|
|
186
|
-
let
|
|
188
|
+
const n = $(), e = $(!1);
|
|
189
|
+
let t, r;
|
|
187
190
|
return {
|
|
188
191
|
cva: {
|
|
189
|
-
writeValue(
|
|
190
|
-
n.value =
|
|
192
|
+
writeValue(o) {
|
|
193
|
+
n.value = o;
|
|
191
194
|
},
|
|
192
|
-
registerOnChange(
|
|
193
|
-
|
|
195
|
+
registerOnChange(o) {
|
|
196
|
+
t = o;
|
|
194
197
|
},
|
|
195
|
-
registerOnTouched(
|
|
196
|
-
r =
|
|
198
|
+
registerOnTouched(o) {
|
|
199
|
+
r = o;
|
|
197
200
|
},
|
|
198
|
-
setDisabledState(
|
|
199
|
-
e.value =
|
|
201
|
+
setDisabledState(o) {
|
|
202
|
+
e.value = o;
|
|
200
203
|
}
|
|
201
204
|
},
|
|
202
205
|
value: n,
|
|
203
206
|
disabled: e,
|
|
204
|
-
valueChange: (
|
|
205
|
-
o
|
|
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 (
|
|
220
|
-
key:
|
|
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
|
-
|
|
229
|
+
P as InjectorToken,
|
|
227
230
|
me as PI_VIEW_FIELD_TOKEN,
|
|
228
231
|
z as PiyingFieldTemplate,
|
|
229
|
-
|
|
232
|
+
we as PiyingView,
|
|
230
233
|
ke as PiyingViewGroup,
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
pe as VueFormBuilder,
|
|
235
|
+
fe as VueSchemaHandle,
|
|
233
236
|
ve as initListen,
|
|
234
237
|
m as signalToRef,
|
|
235
238
|
Ve as useControlValueAccessor
|