@effect-app/vue-components 0.18.15 → 0.18.16
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/vue-components.es20.js +1 -1
- package/dist/vue-components.es22.js +1 -1
- package/dist/vue-components.es23.js +1 -1
- package/dist/vue-components.es24.js +41 -89
- package/dist/vue-components.es25.js +90 -11
- package/dist/vue-components.es26.js +11 -42
- package/dist/vue-components.es27.js +1 -1
- package/dist/vue-components.es7.js +1 -1
- package/dist/vue-components.es9.js +38 -41
- package/package.json +2 -2
- package/src/components/OmegaForm/useOmegaForm.ts +3 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as F, getCurrentInstance as B, computed as v, onBeforeMount as C, watch as g, createElementBlock as O, openBlock as S, withModifiers as I, createElementVNode as L, unref as m, renderSlot as d, createCommentVNode as V, Fragment as k } from "vue";
|
|
2
2
|
import { useStore as h } from "@tanstack/vue-form";
|
|
3
|
-
import { getOmegaStore as $ } from "./vue-components.
|
|
3
|
+
import { getOmegaStore as $ } from "./vue-components.es26.js";
|
|
4
4
|
import { provideOmegaErrors as A } from "./vue-components.es8.js";
|
|
5
5
|
import { useOmegaForm as K } from "./vue-components.es9.js";
|
|
6
6
|
const _ = ["disabled"], D = /* @__PURE__ */ F({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Exit as c, Runtime as s } from "effect";
|
|
2
|
-
import { dual as n, isFunction as m } from "./vue-components.
|
|
2
|
+
import { dual as n, isFunction as m } from "./vue-components.es24.js";
|
|
3
3
|
const i = Symbol.for("clone-trait"), u = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
|
|
4
4
|
n(2, (e, t) => u(e, { ...e, ...m(t) ? t(e) : t }));
|
|
5
5
|
const b = (e) => new Promise((t, r) => e.addObserver((o) => {
|
|
@@ -1,92 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(E.value || V === "onChange") && (s.value = !0);
|
|
40
|
-
});
|
|
41
|
-
const u = () => {
|
|
42
|
-
s.value = !0;
|
|
43
|
-
};
|
|
44
|
-
d(() => {
|
|
45
|
-
n.value && u();
|
|
46
|
-
});
|
|
47
|
-
const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
|
|
48
|
-
f(
|
|
49
|
-
() => r.value.meta.errors,
|
|
50
|
-
() => {
|
|
51
|
-
r.value.meta.errors.length ? h({
|
|
52
|
-
inputId: l,
|
|
53
|
-
errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
54
|
-
label: e.label
|
|
55
|
-
}) : b(l);
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
const i = a(() => ({
|
|
59
|
-
id: l,
|
|
60
|
-
required: e.meta?.required,
|
|
61
|
-
minLength: e.meta?.type === "string" && e.meta?.minLength,
|
|
62
|
-
maxLength: e.meta?.type === "string" && e.meta?.maxLength,
|
|
63
|
-
max: e.meta?.type === "number" && e.meta?.maximum,
|
|
64
|
-
min: e.meta?.type === "number" && e.meta?.minimum,
|
|
65
|
-
name: e.field.name,
|
|
66
|
-
modelValue: e.field.state.value,
|
|
67
|
-
errorMessages: p.value,
|
|
68
|
-
error: !!p.value.length,
|
|
69
|
-
field: e.field,
|
|
70
|
-
setRealDirty: u,
|
|
71
|
-
type: m.value,
|
|
72
|
-
label: `${e.label}${e.meta?.required ? " *" : ""}`,
|
|
73
|
-
options: e.options
|
|
74
|
-
}));
|
|
75
|
-
return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
|
|
76
|
-
_("div", {
|
|
77
|
-
class: q(t.$attrs.class),
|
|
78
|
-
onFocusout: u
|
|
79
|
-
}, [
|
|
80
|
-
F(v) ? (S(), L(D, T({
|
|
81
|
-
key: 0,
|
|
82
|
-
"input-props": i.value
|
|
83
|
-
}, t.$attrs, {
|
|
84
|
-
"vuetify-value": i.value.field.state.value
|
|
85
|
-
}), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
|
|
86
|
-
], 34)
|
|
87
|
-
]);
|
|
1
|
+
const f = (c) => typeof c == "function", a = function(c, r) {
|
|
2
|
+
switch (c) {
|
|
3
|
+
case 0:
|
|
4
|
+
case 1:
|
|
5
|
+
throw new RangeError(`Invalid arity ${c}`);
|
|
6
|
+
case 2:
|
|
7
|
+
return function(n, t) {
|
|
8
|
+
return arguments.length >= 2 ? r(n, t) : function(e) {
|
|
9
|
+
return r(e, n);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
case 3:
|
|
13
|
+
return function(n, t, e) {
|
|
14
|
+
return arguments.length >= 3 ? r(n, t, e) : function(u) {
|
|
15
|
+
return r(u, n, t);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
case 4:
|
|
19
|
+
return function(n, t, e, u) {
|
|
20
|
+
return arguments.length >= 4 ? r(n, t, e, u) : function(i) {
|
|
21
|
+
return r(i, n, t, e);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
case 5:
|
|
25
|
+
return function(n, t, e, u, i) {
|
|
26
|
+
return arguments.length >= 5 ? r(n, t, e, u, i) : function(s) {
|
|
27
|
+
return r(s, n, t, e, u);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
default:
|
|
31
|
+
return function() {
|
|
32
|
+
if (arguments.length >= c)
|
|
33
|
+
return r.apply(this, arguments);
|
|
34
|
+
const n = arguments;
|
|
35
|
+
return function(t) {
|
|
36
|
+
return r(t, ...n);
|
|
37
|
+
};
|
|
38
|
+
};
|
|
88
39
|
}
|
|
89
|
-
}
|
|
40
|
+
};
|
|
90
41
|
export {
|
|
91
|
-
|
|
42
|
+
a as dual,
|
|
43
|
+
f as isFunction
|
|
92
44
|
};
|
|
@@ -1,13 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
import { computed as f } from "vue";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
|
|
3
|
+
import { useStore as z } from "@tanstack/vue-form";
|
|
4
|
+
import { useOmegaErrors as A } from "./vue-components.es8.js";
|
|
5
|
+
import D from "./vue-components.es28.js";
|
|
6
|
+
|
|
7
|
+
const J = /* @__PURE__ */ w({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "OmegaInternalInput",
|
|
10
|
+
props: {
|
|
11
|
+
field: {},
|
|
12
|
+
meta: {},
|
|
13
|
+
label: {},
|
|
14
|
+
options: {},
|
|
15
|
+
type: {},
|
|
16
|
+
validators: {}
|
|
17
|
+
},
|
|
18
|
+
setup(c) {
|
|
19
|
+
const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
|
|
20
|
+
() => (
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
r.value.meta.errors.map((t) => t?.message).filter(Boolean)
|
|
23
|
+
)
|
|
24
|
+
), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
|
|
25
|
+
f(
|
|
26
|
+
() => !!n.value,
|
|
27
|
+
() => {
|
|
28
|
+
y(n.value) && e.meta?.type !== "boolean" && N(() => {
|
|
29
|
+
o.setValue(
|
|
30
|
+
e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
), d(() => {
|
|
35
|
+
!n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
|
|
36
|
+
});
|
|
37
|
+
const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
|
|
38
|
+
k(() => {
|
|
39
|
+
(E.value || V === "onChange") && (s.value = !0);
|
|
40
|
+
});
|
|
41
|
+
const u = () => {
|
|
42
|
+
s.value = !0;
|
|
43
|
+
};
|
|
44
|
+
d(() => {
|
|
45
|
+
n.value && u();
|
|
46
|
+
});
|
|
47
|
+
const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
|
|
48
|
+
f(
|
|
49
|
+
() => r.value.meta.errors,
|
|
50
|
+
() => {
|
|
51
|
+
r.value.meta.errors.length ? h({
|
|
52
|
+
inputId: l,
|
|
53
|
+
errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
54
|
+
label: e.label
|
|
55
|
+
}) : b(l);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
const i = a(() => ({
|
|
59
|
+
id: l,
|
|
60
|
+
required: e.meta?.required,
|
|
61
|
+
minLength: e.meta?.type === "string" && e.meta?.minLength,
|
|
62
|
+
maxLength: e.meta?.type === "string" && e.meta?.maxLength,
|
|
63
|
+
max: e.meta?.type === "number" && e.meta?.maximum,
|
|
64
|
+
min: e.meta?.type === "number" && e.meta?.minimum,
|
|
65
|
+
name: e.field.name,
|
|
66
|
+
modelValue: e.field.state.value,
|
|
67
|
+
errorMessages: p.value,
|
|
68
|
+
error: !!p.value.length,
|
|
69
|
+
field: e.field,
|
|
70
|
+
setRealDirty: u,
|
|
71
|
+
type: m.value,
|
|
72
|
+
label: `${e.label}${e.meta?.required ? " *" : ""}`,
|
|
73
|
+
options: e.options
|
|
74
|
+
}));
|
|
75
|
+
return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
|
|
76
|
+
_("div", {
|
|
77
|
+
class: q(t.$attrs.class),
|
|
78
|
+
onFocusout: u
|
|
79
|
+
}, [
|
|
80
|
+
F(v) ? (S(), L(D, T({
|
|
81
|
+
key: 0,
|
|
82
|
+
"input-props": i.value
|
|
83
|
+
}, t.$attrs, {
|
|
84
|
+
"vuetify-value": i.value.field.state.value
|
|
85
|
+
}), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
|
|
86
|
+
], 34)
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
11
90
|
export {
|
|
12
|
-
|
|
91
|
+
J as default
|
|
13
92
|
};
|
|
@@ -1,44 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
case 3:
|
|
13
|
-
return function(n, t, e) {
|
|
14
|
-
return arguments.length >= 3 ? r(n, t, e) : function(u) {
|
|
15
|
-
return r(u, n, t);
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
case 4:
|
|
19
|
-
return function(n, t, e, u) {
|
|
20
|
-
return arguments.length >= 4 ? r(n, t, e, u) : function(i) {
|
|
21
|
-
return r(i, n, t, e);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
case 5:
|
|
25
|
-
return function(n, t, e, u, i) {
|
|
26
|
-
return arguments.length >= 5 ? r(n, t, e, u, i) : function(s) {
|
|
27
|
-
return r(s, n, t, e, u);
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
default:
|
|
31
|
-
return function() {
|
|
32
|
-
if (arguments.length >= c)
|
|
33
|
-
return r.apply(this, arguments);
|
|
34
|
-
const n = arguments;
|
|
35
|
-
return function(t) {
|
|
36
|
-
return r(t, ...n);
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
};
|
|
1
|
+
import { useStore as u } from "@tanstack/vue-form";
|
|
2
|
+
import { computed as f } from "vue";
|
|
3
|
+
function c(o, t) {
|
|
4
|
+
return f(() => t ? u(o.store, (n) => {
|
|
5
|
+
const r = {};
|
|
6
|
+
for (const e of t)
|
|
7
|
+
r[e] = n[e];
|
|
8
|
+
return r;
|
|
9
|
+
}).value : {});
|
|
10
|
+
}
|
|
41
11
|
export {
|
|
42
|
-
|
|
43
|
-
f as isFunction
|
|
12
|
+
c as getOmegaStore
|
|
44
13
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as d, inject as f, computed as r, createBlock as n, openBlock as m, resolveDynamicComponent as c, withCtx as l, createCommentVNode as v, mergeProps as y, renderSlot as g, normalizeProps as h, guardReactiveProps as b } from "vue";
|
|
2
2
|
import { generateInputStandardSchemaFromFieldMeta as C } from "./vue-components.es10.js";
|
|
3
|
-
import F from "./vue-components.
|
|
3
|
+
import F from "./vue-components.es25.js";
|
|
4
4
|
const P = /* @__PURE__ */ d({
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "OmegaInput",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useForm as U } from "@tanstack/vue-form";
|
|
2
|
-
import { S as F, Fiber as p, Effect as o } from "effect-app";
|
|
3
|
-
import { runtimeFiberAsPromise as
|
|
4
|
-
import { isObject as
|
|
5
|
-
import { computed as b, onUnmounted as
|
|
6
|
-
import
|
|
7
|
-
import { generateMetaFromSchema as
|
|
8
|
-
const
|
|
2
|
+
import { S as F, Fiber as p, Effect as o, Option as O } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as I } from "./vue-components.es22.js";
|
|
4
|
+
import { isObject as R } from "./vue-components.es23.js";
|
|
5
|
+
import { computed as b, onUnmounted as A, onMounted as M, onBeforeUnmount as N, provide as D } from "vue";
|
|
6
|
+
import J from "./vue-components.es6.js";
|
|
7
|
+
import { generateMetaFromSchema as K } from "./vue-components.es10.js";
|
|
8
|
+
const q = Symbol("OmegaForm"), G = (f, s, a) => {
|
|
9
9
|
if (!f) throw new Error("Schema is required");
|
|
10
|
-
const g = F.standardSchemaV1(f), { filterItems: V, meta: u } =
|
|
10
|
+
const g = F.standardSchemaV1(f), { filterItems: V, meta: u } = K(f), l = b(() => {
|
|
11
11
|
if (a?.persistency?.id)
|
|
12
12
|
return a.persistency.id;
|
|
13
13
|
const e = window.location.pathname, r = Object.keys(u);
|
|
@@ -20,19 +20,19 @@ const K = Symbol("OmegaForm"), z = (f, i, a) => {
|
|
|
20
20
|
};
|
|
21
21
|
function S(e, r) {
|
|
22
22
|
for (const t in r)
|
|
23
|
-
r[t] &&
|
|
23
|
+
r[t] && R(r[t]) ? (e[t] || (e[t] = {}), S(e[t], r[t])) : e[t] = r[t];
|
|
24
24
|
return e;
|
|
25
25
|
}
|
|
26
26
|
const P = b(() => {
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
27
|
+
if (s?.defaultValues && !a?.persistency?.overrideDefaultValues)
|
|
28
|
+
return s?.defaultValues;
|
|
29
29
|
let e;
|
|
30
30
|
const r = a?.persistency;
|
|
31
31
|
if (!r?.policies || r.policies.length === 0) return {};
|
|
32
32
|
if (r.policies.includes("querystring"))
|
|
33
33
|
try {
|
|
34
|
-
const
|
|
35
|
-
E(),
|
|
34
|
+
const i = new URLSearchParams(window.location.search).get(l.value);
|
|
35
|
+
E(), i && (e = JSON.parse(i));
|
|
36
36
|
} catch (t) {
|
|
37
37
|
console.error(t);
|
|
38
38
|
}
|
|
@@ -43,38 +43,38 @@ const K = Symbol("OmegaForm"), z = (f, i, a) => {
|
|
|
43
43
|
const t = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
44
44
|
if (t)
|
|
45
45
|
try {
|
|
46
|
-
const
|
|
46
|
+
const i = JSON.parse(
|
|
47
47
|
t.getItem(l.value) || "{}"
|
|
48
48
|
);
|
|
49
|
-
t.removeItem(l.value), e =
|
|
50
|
-
} catch (
|
|
51
|
-
console.error(
|
|
49
|
+
t.removeItem(l.value), e = i;
|
|
50
|
+
} catch (i) {
|
|
51
|
+
console.error(i);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
if (e ??= {},
|
|
54
|
+
if (e ??= {}, s?.defaultValues == null)
|
|
55
55
|
return e;
|
|
56
56
|
{
|
|
57
|
-
const t =
|
|
57
|
+
const t = s?.defaultValues;
|
|
58
58
|
return S(t, e);
|
|
59
59
|
}
|
|
60
60
|
}), c = U({
|
|
61
|
-
...
|
|
61
|
+
...s,
|
|
62
62
|
validators: {
|
|
63
63
|
onSubmit: g,
|
|
64
|
-
...
|
|
64
|
+
...s?.validators || {}
|
|
65
65
|
},
|
|
66
|
-
onSubmit:
|
|
67
|
-
const
|
|
66
|
+
onSubmit: s?.onSubmit ? ({ formApi: e, meta: r, value: t }) => {
|
|
67
|
+
const i = s.onSubmit({
|
|
68
68
|
formApi: e,
|
|
69
69
|
meta: r,
|
|
70
70
|
value: t
|
|
71
71
|
});
|
|
72
|
-
return p.isFiber(
|
|
73
|
-
|
|
72
|
+
return p.isFiber(i) && p.isRuntimeFiber(i) ? I(i) : o.isEffect(i) ? o.runPromise(
|
|
73
|
+
i.pipe(
|
|
74
74
|
r?.currentSpan ? o.withParentSpan(r.currentSpan) : (n) => n,
|
|
75
75
|
o.flatMap((n) => p.join(n))
|
|
76
76
|
)
|
|
77
|
-
) :
|
|
77
|
+
) : i;
|
|
78
78
|
} : void 0,
|
|
79
79
|
defaultValues: P.value
|
|
80
80
|
}), j = () => {
|
|
@@ -82,8 +82,8 @@ const K = Symbol("OmegaForm"), z = (f, i, a) => {
|
|
|
82
82
|
c.setFieldValue(e, void 0);
|
|
83
83
|
});
|
|
84
84
|
}, w = (e) => e.reduce((r, t) => {
|
|
85
|
-
const
|
|
86
|
-
return
|
|
85
|
+
const i = t.split(".");
|
|
86
|
+
return i.reduce((n, d, L) => (L === i.length - 1 ? n[d] = c.getFieldValue(t) : n[d] = n[d] ?? {}, n[d]), r), r;
|
|
87
87
|
}, {}), h = (e) => {
|
|
88
88
|
if (e) {
|
|
89
89
|
if (Array.isArray(e.keys))
|
|
@@ -107,13 +107,13 @@ const K = Symbol("OmegaForm"), z = (f, i, a) => {
|
|
|
107
107
|
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
108
108
|
const r = h(e), t = new URLSearchParams(window.location.search);
|
|
109
109
|
t.set(l.value, JSON.stringify(r));
|
|
110
|
-
const
|
|
111
|
-
|
|
110
|
+
const i = new URL(window.location.href);
|
|
111
|
+
i.search = t.toString(), window.history.replaceState({}, "", i.toString());
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
|
|
114
|
+
A(m), M(() => {
|
|
115
115
|
window.addEventListener("beforeunload", m), window.addEventListener("blur", y);
|
|
116
|
-
}),
|
|
116
|
+
}), N(() => {
|
|
117
117
|
window.removeEventListener("beforeunload", m), window.removeEventListener("blur", y);
|
|
118
118
|
});
|
|
119
119
|
const v = Object.assign(c, {
|
|
@@ -122,21 +122,18 @@ const K = Symbol("OmegaForm"), z = (f, i, a) => {
|
|
|
122
122
|
clear: j,
|
|
123
123
|
/** @experimental */
|
|
124
124
|
handleSubmitEffect: (e) => o.currentSpan.pipe(
|
|
125
|
-
o.
|
|
125
|
+
o.option,
|
|
126
126
|
o.flatMap(
|
|
127
|
-
(r) => (
|
|
128
|
-
// TODO: fix type of handleSubmit, TSubmitMeta is somehow async validator :D
|
|
129
|
-
o.promise(() => c.handleSubmit({ currentSpan: r, ...e }))
|
|
130
|
-
)
|
|
127
|
+
(r) => o.promise(() => c.handleSubmit(O.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
131
128
|
)
|
|
132
129
|
)
|
|
133
130
|
});
|
|
134
|
-
return
|
|
135
|
-
Input:
|
|
131
|
+
return D(q, v), Object.assign(v, {
|
|
132
|
+
Input: J,
|
|
136
133
|
Field: c.Field
|
|
137
134
|
});
|
|
138
135
|
};
|
|
139
136
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
q as OmegaFormKey,
|
|
138
|
+
G as useOmegaForm
|
|
142
139
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.16",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
6
|
"@tanstack/vue-form": "1.2.4",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"highlight.js": "^11.11.1",
|
|
55
55
|
"vue3-highlightjs": "^1.0.5",
|
|
56
|
-
"@effect-app/vue": "2.55.
|
|
56
|
+
"@effect-app/vue": "2.55.8",
|
|
57
57
|
"effect-app": "3.3.4"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
|
|
4
4
|
import { type DeepKeys, type FormAsyncValidateOrFn, type FormValidateOrFn, type StandardSchemaV1, useForm } from "@tanstack/vue-form"
|
|
5
|
-
import { Effect, Fiber, S } from "effect-app"
|
|
5
|
+
import { Effect, Fiber, Option, S } from "effect-app"
|
|
6
6
|
import { runtimeFiberAsPromise } from "effect-app/utils"
|
|
7
7
|
import { isObject } from "effect/Predicate"
|
|
8
8
|
import { computed, type InjectionKey, onBeforeUnmount, onMounted, onUnmounted, provide } from "vue"
|
|
@@ -326,11 +326,10 @@ export const useOmegaForm = <
|
|
|
326
326
|
/** @experimental */
|
|
327
327
|
handleSubmitEffect: (meta?: Record<string, any>) =>
|
|
328
328
|
Effect.currentSpan.pipe(
|
|
329
|
-
Effect.
|
|
329
|
+
Effect.option,
|
|
330
330
|
Effect
|
|
331
331
|
.flatMap((span) =>
|
|
332
|
-
|
|
333
|
-
Effect.promise(() => form.handleSubmit({ currentSpan: span, ...meta }))
|
|
332
|
+
Effect.promise(() => form.handleSubmit(Option.isSome(span) ? { currentSpan: span.value, ...meta } : meta))
|
|
334
333
|
)
|
|
335
334
|
)
|
|
336
335
|
})
|