@effect-app/vue-components 1.8.7 → 1.8.9
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/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +0 -1
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +1 -2
- package/dist/vue-components.es12.js +7 -7
- package/dist/vue-components.es18.js +1 -1
- package/dist/vue-components.es19.js +1 -1
- package/dist/vue-components.es32.js +1 -1
- package/dist/vue-components.es34.js +23 -4
- package/dist/vue-components.es35.js +5 -11
- package/dist/vue-components.es36.js +18 -20
- package/dist/vue-components.es37.js +30 -5
- package/dist/vue-components.es38.js +17 -16
- package/dist/vue-components.es39.js +7 -25
- package/dist/vue-components.es40.js +5 -22
- package/dist/vue-components.es41.js +19 -12
- package/dist/vue-components.es42.js +9 -5
- package/dist/vue-components.es43.js +31 -19
- package/dist/vue-components.es44.js +48 -9
- package/dist/vue-components.es45.js +20 -25
- package/dist/vue-components.es46.js +4 -48
- package/dist/vue-components.es47.js +11 -26
- package/dist/vue-components.es48.js +1 -1
- package/dist/vue-components.es50.js +1 -1
- package/dist/vue-components.es52.js +3 -3
- package/dist/vue-components.es53.js +1 -1
- package/dist/vue-components.es7.js +95 -118
- package/dist/vue-components.es9.js +110 -124
- package/package.json +3 -3
- package/src/components/OmegaForm/OmegaFormStuff.ts +2 -21
- package/src/components/OmegaForm/useOmegaForm.ts +2 -45
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DiagComponentLogger as m } from "./vue-components.es49.js";
|
|
2
2
|
import { createLogLevelDiagLogger as y } from "./vue-components.es50.js";
|
|
3
|
-
import { DiagLogLevel as d } from "./vue-components.
|
|
3
|
+
import { DiagLogLevel as d } from "./vue-components.es35.js";
|
|
4
4
|
import { unregisterGlobal as p, getGlobal as v, registerGlobal as w } from "./vue-components.es51.js";
|
|
5
5
|
var b = function(i, n) {
|
|
6
6
|
var r = typeof Symbol == "function" && i[Symbol.iterator];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createContextKey as o } from "./vue-components.
|
|
2
|
-
import { NonRecordingSpan as a } from "./vue-components.
|
|
3
|
-
import { ContextAPI as u } from "./vue-components.
|
|
1
|
+
import { createContextKey as o } from "./vue-components.es34.js";
|
|
2
|
+
import { NonRecordingSpan as a } from "./vue-components.es43.js";
|
|
3
|
+
import { ContextAPI as u } from "./vue-components.es44.js";
|
|
4
4
|
var n = o("OpenTelemetry Context Key SPAN");
|
|
5
5
|
function r(e) {
|
|
6
6
|
return e.getValue(n) || void 0;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import { Data as
|
|
3
|
-
import { runtimeFiberAsPromise as
|
|
4
|
-
import { isObject as
|
|
5
|
-
import { computed as
|
|
6
|
-
import { usePreventClose as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { generateMetaFromSchema as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { trace as
|
|
14
|
-
import { context as
|
|
15
|
-
class
|
|
1
|
+
import { useForm as J } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as q, S as U, Effect as a, Fiber as y, Option as K, Array as L } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as k } from "./vue-components.es12.js";
|
|
4
|
+
import { isObject as B } from "./vue-components.es13.js";
|
|
5
|
+
import { computed as O, onUnmounted as M, onMounted as G, onBeforeUnmount as T, ref as W, watch as z, h as A } from "vue";
|
|
6
|
+
import { usePreventClose as Q } from "./vue-components.es8.js";
|
|
7
|
+
import X from "./vue-components.es14.js";
|
|
8
|
+
import Y from "./vue-components.es15.js";
|
|
9
|
+
import Z from "./vue-components.es16.js";
|
|
10
|
+
import { generateMetaFromSchema as C } from "./vue-components.es9.js";
|
|
11
|
+
import ee from "./vue-components.es5.js";
|
|
12
|
+
import re from "./vue-components.es17.js";
|
|
13
|
+
import { trace as $ } from "./vue-components.es18.js";
|
|
14
|
+
import { context as b } from "./vue-components.es19.js";
|
|
15
|
+
class te extends q.TaggedError("FormErrors") {
|
|
16
16
|
}
|
|
17
|
-
const p = (c) => function(
|
|
17
|
+
const p = (c) => function(n) {
|
|
18
18
|
return {
|
|
19
19
|
render() {
|
|
20
|
-
return
|
|
20
|
+
return A(n, {
|
|
21
21
|
form: c,
|
|
22
22
|
...this.$attrs
|
|
23
23
|
}, this.$slots);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
},
|
|
26
|
+
}, se = (c) => function(n) {
|
|
27
27
|
return {
|
|
28
28
|
setup() {
|
|
29
29
|
return {
|
|
@@ -31,41 +31,41 @@ const p = (c) => function(i) {
|
|
|
31
31
|
};
|
|
32
32
|
},
|
|
33
33
|
render({ fieldMap: h, form: S }) {
|
|
34
|
-
return
|
|
34
|
+
return A(n, {
|
|
35
35
|
form: S,
|
|
36
36
|
fieldMap: h,
|
|
37
37
|
...this.$attrs
|
|
38
38
|
}, this.$slots);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
},
|
|
41
|
+
}, ve = (c, o, n) => {
|
|
42
42
|
if (!c) throw new Error("Schema is required");
|
|
43
|
-
const h =
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
46
|
-
const e = window.location.pathname, r = Object.keys(
|
|
43
|
+
const h = U.standardSchemaV1(c), S = U.decode(c), { meta: f } = C(c), d = O(() => {
|
|
44
|
+
if (n?.persistency?.id)
|
|
45
|
+
return n.persistency.id;
|
|
46
|
+
const e = window.location.pathname, r = Object.keys(f);
|
|
47
47
|
return `${e}-${r.join("-")}`;
|
|
48
|
-
}),
|
|
48
|
+
}), N = () => {
|
|
49
49
|
const e = new URLSearchParams(window.location.search);
|
|
50
|
-
e.delete(
|
|
50
|
+
e.delete(d.value);
|
|
51
51
|
const r = new URL(window.location.href);
|
|
52
52
|
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
53
53
|
};
|
|
54
|
-
function
|
|
54
|
+
function E(e, r) {
|
|
55
55
|
for (const t in r)
|
|
56
|
-
r[t] &&
|
|
56
|
+
r[t] && B(r[t]) ? (e[t] || (e[t] = {}), E(e[t], r[t])) : e[t] = r[t];
|
|
57
57
|
return e;
|
|
58
58
|
}
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
59
|
+
const _ = O(() => {
|
|
60
|
+
if (o?.defaultValues && !n?.persistency?.overrideDefaultValues)
|
|
61
|
+
return o?.defaultValues;
|
|
62
62
|
let e;
|
|
63
|
-
const r =
|
|
63
|
+
const r = n?.persistency;
|
|
64
64
|
if (!r?.policies || r.policies.length === 0) return {};
|
|
65
65
|
if (r.policies.includes("querystring"))
|
|
66
66
|
try {
|
|
67
|
-
const s = new URLSearchParams(window.location.search).get(
|
|
68
|
-
|
|
67
|
+
const s = new URLSearchParams(window.location.search).get(d.value);
|
|
68
|
+
N(), s && (e = JSON.parse(s));
|
|
69
69
|
} catch (t) {
|
|
70
70
|
console.error(t);
|
|
71
71
|
}
|
|
@@ -77,137 +77,114 @@ const p = (c) => function(i) {
|
|
|
77
77
|
if (t)
|
|
78
78
|
try {
|
|
79
79
|
const s = JSON.parse(
|
|
80
|
-
t.getItem(
|
|
80
|
+
t.getItem(d.value) || "{}"
|
|
81
81
|
);
|
|
82
|
-
t.removeItem(
|
|
82
|
+
t.removeItem(d.value), e = s;
|
|
83
83
|
} catch (s) {
|
|
84
84
|
console.error(s);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
if (e ??= {},
|
|
87
|
+
if (e ??= {}, o?.defaultValues == null)
|
|
88
88
|
return e;
|
|
89
89
|
{
|
|
90
|
-
const t =
|
|
91
|
-
return
|
|
90
|
+
const t = o?.defaultValues;
|
|
91
|
+
return E(t, e);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
94
|
-
...
|
|
93
|
+
}), D = (e, r) => e ? b.with($.setSpan(b.active(), e), r) : r(), l = J({
|
|
94
|
+
...o,
|
|
95
95
|
validators: {
|
|
96
96
|
onSubmit: h,
|
|
97
|
-
...
|
|
97
|
+
...o?.validators || {}
|
|
98
98
|
},
|
|
99
|
-
onSubmit:
|
|
100
|
-
const s = await
|
|
99
|
+
onSubmit: o?.onSubmit ? ({ formApi: e, meta: r, value: t }) => D(r?.currentSpan, async () => {
|
|
100
|
+
const s = await a.runPromise(S(t)), i = o.onSubmit({
|
|
101
101
|
formApi: e,
|
|
102
102
|
meta: r,
|
|
103
103
|
value: s
|
|
104
104
|
});
|
|
105
|
-
return
|
|
106
|
-
|
|
105
|
+
return y.isFiber(i) && y.isRuntimeFiber(i) ? await k(i) : a.isEffect(i) ? await a.runPromise(
|
|
106
|
+
i.pipe(
|
|
107
107
|
// meta?.currentSpan
|
|
108
108
|
// ? Effect.withParentSpan(meta.currentSpan)
|
|
109
109
|
// : (_) => _,
|
|
110
|
-
|
|
110
|
+
a.flatMap((m) => y.join(m))
|
|
111
111
|
)
|
|
112
|
-
) :
|
|
112
|
+
) : i;
|
|
113
113
|
}) : void 0,
|
|
114
|
-
defaultValues:
|
|
115
|
-
}),
|
|
116
|
-
Object.keys(
|
|
117
|
-
|
|
114
|
+
defaultValues: _.value
|
|
115
|
+
}), I = () => {
|
|
116
|
+
Object.keys(f).forEach((e) => {
|
|
117
|
+
l.setFieldValue(e, void 0);
|
|
118
118
|
});
|
|
119
|
-
},
|
|
119
|
+
}, g = (e) => e.reduce((r, t) => {
|
|
120
120
|
const s = t.split(".");
|
|
121
|
-
return s.reduce((
|
|
121
|
+
return s.reduce((i, m, H) => (H === s.length - 1 ? i[m] = l.getFieldValue(t) : i[m] = i[m] ?? {}, i[m]), r), r;
|
|
122
122
|
}, {}), F = (e) => {
|
|
123
123
|
if (e) {
|
|
124
|
-
if (
|
|
125
|
-
return
|
|
126
|
-
if (
|
|
127
|
-
const r = Object.keys(
|
|
128
|
-
return
|
|
124
|
+
if (L.isArray(e.keys))
|
|
125
|
+
return g(e.keys);
|
|
126
|
+
if (L.isArray(e.banKeys)) {
|
|
127
|
+
const r = Object.keys(f).filter((t) => e.banKeys?.includes(t));
|
|
128
|
+
return g(r);
|
|
129
129
|
}
|
|
130
|
-
return
|
|
130
|
+
return l.store.state.values;
|
|
131
131
|
}
|
|
132
|
-
},
|
|
133
|
-
const e =
|
|
132
|
+
}, w = () => {
|
|
133
|
+
const e = n?.persistency;
|
|
134
134
|
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
135
135
|
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
136
136
|
if (!r) return;
|
|
137
137
|
const t = F(e);
|
|
138
|
-
return r.setItem(
|
|
138
|
+
return r.setItem(d.value, JSON.stringify(t));
|
|
139
139
|
}
|
|
140
140
|
}, V = () => {
|
|
141
|
-
const e =
|
|
141
|
+
const e = n?.persistency;
|
|
142
142
|
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
143
143
|
const r = F(e), t = new URLSearchParams(window.location.search);
|
|
144
|
-
t.set(
|
|
144
|
+
t.set(d.value, JSON.stringify(r));
|
|
145
145
|
const s = new URL(window.location.href);
|
|
146
146
|
s.search = t.toString(), window.history.replaceState({}, "", s.toString());
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
-
|
|
150
|
-
window.addEventListener("beforeunload",
|
|
151
|
-
}),
|
|
152
|
-
window.removeEventListener("beforeunload",
|
|
149
|
+
M(w), G(() => {
|
|
150
|
+
window.addEventListener("beforeunload", w), window.addEventListener("blur", V);
|
|
151
|
+
}), T(() => {
|
|
152
|
+
window.removeEventListener("beforeunload", w), window.removeEventListener("blur", V);
|
|
153
153
|
});
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
(r) =>
|
|
154
|
+
const P = (e) => a.currentSpan.pipe(
|
|
155
|
+
a.option,
|
|
156
|
+
a.flatMap(
|
|
157
|
+
(r) => a.promise(() => l.handleSubmit(K.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
158
158
|
)
|
|
159
|
-
),
|
|
160
|
-
const r =
|
|
159
|
+
), R = (e) => e?.checkErrors ? P(e?.meta).pipe(a.flatMap(a.fnUntraced(function* () {
|
|
160
|
+
const r = l.getAllErrors();
|
|
161
161
|
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
162
|
-
return yield* new
|
|
163
|
-
}))) :
|
|
164
|
-
i18nNamespace:
|
|
165
|
-
meta:
|
|
166
|
-
|
|
167
|
-
clear: H,
|
|
162
|
+
return yield* new te({ form: r.form, fields: r.fields });
|
|
163
|
+
}))) : P(e?.meta), x = l.handleSubmit, v = W(/* @__PURE__ */ new Map()), u = Object.assign(l, {
|
|
164
|
+
i18nNamespace: n?.i18nNamespace,
|
|
165
|
+
meta: f,
|
|
166
|
+
clear: I,
|
|
168
167
|
handleSubmit: (e) => {
|
|
169
|
-
const r =
|
|
170
|
-
return
|
|
168
|
+
const r = $.getSpan(b.active());
|
|
169
|
+
return x({ currentSpan: r, ...e });
|
|
171
170
|
},
|
|
172
171
|
// /** @experimental */
|
|
173
|
-
handleSubmitEffect:
|
|
172
|
+
handleSubmitEffect: R,
|
|
174
173
|
registerField: (e) => {
|
|
175
|
-
|
|
174
|
+
z(e, (r) => v.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), M(() => v.value.delete(e.value.name));
|
|
176
175
|
}
|
|
177
|
-
}),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
()
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
).some((s) => s === e.message) && e.items.forEach((s) => {
|
|
187
|
-
const n = o.getFieldMeta(s);
|
|
188
|
-
n && o.setFieldMeta(s, {
|
|
189
|
-
...n,
|
|
190
|
-
errorMap: {
|
|
191
|
-
onSubmit: [
|
|
192
|
-
{ path: [s], message: e.message }
|
|
193
|
-
]
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}), {}) : {} : {};
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
const P = { form: o, fieldMap: w };
|
|
200
|
-
return i?.ignorePreventCloseEvents || Y(() => o.useStore((e) => e.isDirty)), Object.assign(o, {
|
|
201
|
-
errorContext: P,
|
|
202
|
-
Form: p(o)(se),
|
|
203
|
-
Input: p(o)(i?.input ?? te),
|
|
204
|
-
Field: u.Field,
|
|
205
|
-
Errors: ie(P)(ee),
|
|
206
|
-
Array: p(o)(Z),
|
|
207
|
-
AutoGen: p(o)(C)
|
|
176
|
+
}), j = { form: u, fieldMap: v };
|
|
177
|
+
return n?.ignorePreventCloseEvents || Q(() => u.useStore((e) => e.isDirty)), Object.assign(u, {
|
|
178
|
+
errorContext: j,
|
|
179
|
+
Form: p(u)(re),
|
|
180
|
+
Input: p(u)(n?.input ?? ee),
|
|
181
|
+
Field: l.Field,
|
|
182
|
+
Errors: se(j)(Z),
|
|
183
|
+
Array: p(u)(X),
|
|
184
|
+
AutoGen: p(u)(Y)
|
|
208
185
|
});
|
|
209
186
|
};
|
|
210
187
|
export {
|
|
211
|
-
|
|
212
|
-
|
|
188
|
+
te as FormErrors,
|
|
189
|
+
ve as useOmegaForm
|
|
213
190
|
};
|