@effect-app/vue-components 0.18.4 → 0.18.6
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.
|
@@ -13,11 +13,11 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
|
|
|
13
13
|
form?: undefined;
|
|
14
14
|
schema: S.Schema<To, From, never>;
|
|
15
15
|
}) & ({
|
|
16
|
-
isLoading: undefined;
|
|
17
|
-
onSubmit?: FormProps<From, To>["onSubmit"];
|
|
18
|
-
} | {
|
|
19
16
|
isLoading: boolean;
|
|
20
17
|
onSubmit: (data: To) => void;
|
|
18
|
+
} | {
|
|
19
|
+
isLoading?: undefined;
|
|
20
|
+
onSubmit?: FormProps<From, To>["onSubmit"];
|
|
21
21
|
}))) & {}> & import("vue").PublicProps;
|
|
22
22
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
23
23
|
attrs: any;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-
|
|
2
|
-
import
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-63452e71]{display:contents}fieldset[disabled][data-v-63452e71]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-63452e71]{display:contents}fieldset[disabled][data-v-63452e71]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import o from "./vue-components.es20.js";
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
const e = /* @__PURE__ */ o
|
|
4
|
+
import r from "./vue-components.es17.js";
|
|
5
|
+
const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-63452e71"]]);
|
|
6
6
|
export {
|
|
7
7
|
e as default
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useStore as
|
|
3
|
-
import { getOmegaStore as
|
|
4
|
-
import { provideOmegaErrors as
|
|
5
|
-
import { useOmegaForm as
|
|
6
|
-
const
|
|
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
|
+
import { useStore as h } from "@tanstack/vue-form";
|
|
3
|
+
import { getOmegaStore as $ } from "./vue-components.es26.js";
|
|
4
|
+
import { provideOmegaErrors as A } from "./vue-components.es8.js";
|
|
5
|
+
import { useOmegaForm as K } from "./vue-components.es9.js";
|
|
6
|
+
const _ = ["disabled"], D = /* @__PURE__ */ F({
|
|
7
7
|
__name: "OmegaWrapper",
|
|
8
8
|
props: {
|
|
9
9
|
omegaConfig: {},
|
|
@@ -22,21 +22,21 @@ const K = ["disabled"], W = /* @__PURE__ */ M({
|
|
|
22
22
|
isLoading: { type: Boolean, default: void 0 },
|
|
23
23
|
onSubmit: {}
|
|
24
24
|
},
|
|
25
|
-
setup(
|
|
26
|
-
const o =
|
|
27
|
-
|
|
28
|
-
const n =
|
|
25
|
+
setup(y) {
|
|
26
|
+
const o = y, w = B(), E = ({ value: e }) => new Promise((r) => {
|
|
27
|
+
w.emit("submit", e);
|
|
28
|
+
const n = g(() => o.isLoading, (t) => {
|
|
29
29
|
t || (r(), n.stop());
|
|
30
30
|
});
|
|
31
|
-
}), u = o.form || !o.schema ? void 0 :
|
|
31
|
+
}), u = typeof o.isLoading < "u" ? E : typeof o.onSubmit < "u" ? o.onSubmit : void 0, l = o.form || !o.schema ? void 0 : K(
|
|
32
32
|
o.schema,
|
|
33
33
|
{
|
|
34
34
|
...o,
|
|
35
|
-
onSubmit:
|
|
35
|
+
onSubmit: u
|
|
36
36
|
},
|
|
37
37
|
o.omegaConfig
|
|
38
|
-
), s =
|
|
39
|
-
|
|
38
|
+
), s = v(() => o.form ?? l);
|
|
39
|
+
C(() => {
|
|
40
40
|
if (!o.form) return;
|
|
41
41
|
const e = Object.keys(o.form.options || {}), r = /* @__PURE__ */ new Set([
|
|
42
42
|
"omegaConfig",
|
|
@@ -47,7 +47,7 @@ const K = ["disabled"], W = /* @__PURE__ */ M({
|
|
|
47
47
|
"schema"
|
|
48
48
|
]), n = Object.fromEntries(
|
|
49
49
|
Object.entries(o).filter(
|
|
50
|
-
([a,
|
|
50
|
+
([a, c]) => a === "isLoading" ? !1 : !r.has(a) && c !== void 0
|
|
51
51
|
)
|
|
52
52
|
), t = Object.keys(n), i = e.filter(
|
|
53
53
|
(a) => t.includes(a) && n[a] !== void 0
|
|
@@ -60,31 +60,31 @@ ${i.join(
|
|
|
60
60
|
)}.
|
|
61
61
|
Props will overwrite existing form options. This might indicate a configuration issue.`
|
|
62
62
|
);
|
|
63
|
-
const
|
|
63
|
+
const b = {
|
|
64
64
|
...s.value.options,
|
|
65
65
|
...n
|
|
66
66
|
};
|
|
67
|
-
s.value.options = Object.fromEntries(
|
|
67
|
+
u && (b.onSubmit = u), s.value.options = Object.fromEntries(
|
|
68
68
|
// TODO
|
|
69
|
-
Object.entries(
|
|
70
|
-
([a,
|
|
69
|
+
Object.entries(b).filter(
|
|
70
|
+
([a, c]) => c !== void 0
|
|
71
71
|
)
|
|
72
72
|
);
|
|
73
73
|
});
|
|
74
|
-
const
|
|
74
|
+
const j = h(
|
|
75
75
|
s.value.store,
|
|
76
76
|
(e) => e.isSubmitting
|
|
77
|
-
),
|
|
77
|
+
), p = $(
|
|
78
78
|
s.value,
|
|
79
79
|
o.subscribe
|
|
80
|
-
),
|
|
80
|
+
), M = h(
|
|
81
81
|
s.value.store,
|
|
82
82
|
(e) => e.submissionAttempts
|
|
83
|
-
),
|
|
84
|
-
return
|
|
85
|
-
() => [s.value.filterItems,
|
|
83
|
+
), f = v(() => s.value.useStore((e) => e.errors));
|
|
84
|
+
return g(
|
|
85
|
+
() => [s.value.filterItems, f.value.value],
|
|
86
86
|
() => {
|
|
87
|
-
const e = s.value.filterItems, r =
|
|
87
|
+
const e = s.value.filterItems, r = f.value.value;
|
|
88
88
|
return e ? r ? (Object.values(r).filter(
|
|
89
89
|
(t) => !!t
|
|
90
90
|
).flatMap(
|
|
@@ -101,23 +101,23 @@ Props will overwrite existing form options. This might indicate a configuration
|
|
|
101
101
|
});
|
|
102
102
|
}), {}) : {} : {};
|
|
103
103
|
}
|
|
104
|
-
),
|
|
104
|
+
), A(M, f.value, o.showErrorsOn), (e, r) => (S(), O("form", {
|
|
105
105
|
novalidate: "",
|
|
106
|
-
onSubmit: r[0] || (r[0] =
|
|
106
|
+
onSubmit: r[0] || (r[0] = I((n) => s.value.handleSubmit(), ["prevent", "stop"]))
|
|
107
107
|
}, [
|
|
108
|
-
|
|
109
|
-
o.form ? (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
], 64)) : m(
|
|
108
|
+
L("fieldset", { disabled: m(j) }, [
|
|
109
|
+
o.form ? (S(), O(k, { key: 0 }, [
|
|
110
|
+
d(e.$slots, "externalForm", { subscribedValues: m(p) }, void 0, !0),
|
|
111
|
+
d(e.$slots, "default", {}, void 0, !0)
|
|
112
|
+
], 64)) : m(l) ? d(e.$slots, "internalForm", {
|
|
113
113
|
key: 1,
|
|
114
|
-
form: m(
|
|
115
|
-
subscribedValues: m(
|
|
116
|
-
}, void 0, !0) :
|
|
117
|
-
], 8,
|
|
114
|
+
form: m(l),
|
|
115
|
+
subscribedValues: m(p)
|
|
116
|
+
}, void 0, !0) : V("", !0)
|
|
117
|
+
], 8, _)
|
|
118
118
|
], 32));
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
export {
|
|
122
|
-
|
|
122
|
+
D as default
|
|
123
123
|
};
|
package/package.json
CHANGED
|
@@ -91,14 +91,14 @@ type OmegaWrapperProps =
|
|
|
91
91
|
}
|
|
92
92
|
)
|
|
93
93
|
& (
|
|
94
|
-
| {
|
|
95
|
-
isLoading: undefined
|
|
96
|
-
onSubmit?: FormProps<From, To>["onSubmit"]
|
|
97
|
-
}
|
|
98
94
|
| {
|
|
99
95
|
isLoading: boolean
|
|
100
96
|
onSubmit: (data: To) => void
|
|
101
97
|
}
|
|
98
|
+
| {
|
|
99
|
+
isLoading?: undefined
|
|
100
|
+
onSubmit?: FormProps<From, To>["onSubmit"]
|
|
101
|
+
}
|
|
102
102
|
)
|
|
103
103
|
|
|
104
104
|
const props = withDefaults(defineProps<OmegaWrapperProps>(), {
|
|
@@ -122,15 +122,19 @@ const eventOnSubmit: FormProps<From, To>["onSubmit"] = ({ value }) =>
|
|
|
122
122
|
})
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
+
const onSubmit = typeof props.isLoading !== "undefined"
|
|
126
|
+
? eventOnSubmit
|
|
127
|
+
: typeof props.onSubmit !== "undefined"
|
|
128
|
+
? props.onSubmit
|
|
129
|
+
: undefined
|
|
130
|
+
|
|
125
131
|
const localForm = props.form || !props.schema
|
|
126
132
|
? undefined
|
|
127
133
|
: useOmegaForm<From, To>(
|
|
128
134
|
props.schema,
|
|
129
135
|
{
|
|
130
136
|
...props,
|
|
131
|
-
onSubmit
|
|
132
|
-
? eventOnSubmit
|
|
133
|
-
: props.onSubmit
|
|
137
|
+
onSubmit
|
|
134
138
|
},
|
|
135
139
|
props.omegaConfig
|
|
136
140
|
)
|
|
@@ -184,6 +188,7 @@ onBeforeMount(() => {
|
|
|
184
188
|
...formToUse.value.options,
|
|
185
189
|
...filteredProps
|
|
186
190
|
}
|
|
191
|
+
if (onSubmit) mergedOptions.onSubmit = onSubmit
|
|
187
192
|
|
|
188
193
|
formToUse.value.options = Object.fromEntries(
|
|
189
194
|
// TODO
|