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