@effect-app/vue-components 0.13.3 → 0.14.0
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/OmegaArray.vue.d.ts +2 -1
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +3 -3
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +1 -1
- package/dist/vue-components.es11.js +3 -3
- package/dist/vue-components.es13.js +1 -1
- package/dist/vue-components.es22.js +1 -1
- package/dist/vue-components.es23.js +11 -2
- package/dist/vue-components.es25.js +2 -11
- package/dist/vue-components.es7.js +24 -23
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaArray.vue +8 -3
- package/src/components/OmegaForm/OmegaFormStuff.ts +4 -4
- package/src/components/OmegaForm/OmegaWrapper.vue +1 -1
|
@@ -2,7 +2,8 @@ import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
|
2
2
|
import { type DeepValue, type DeepKeys } from "@tanstack/vue-form";
|
|
3
3
|
declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<From, To>, "type" | "label" | "items" | "options" | "validators"> & {
|
|
5
|
-
|
|
5
|
+
defaultItems?: DeepValue<To, DeepKeys<To>>;
|
|
6
|
+
items?: "please use `defaultItems` instead";
|
|
6
7
|
}) & Partial<{}>> & import("vue").PublicProps;
|
|
7
8
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
8
9
|
attrs: any;
|
|
@@ -98,9 +98,9 @@ export type CreateMeta = {
|
|
|
98
98
|
property: S.AST.AST;
|
|
99
99
|
});
|
|
100
100
|
export declare const createMeta: <T = any>({ meta, parent, property, propertySignatures }: CreateMeta, acc?: Partial<MetaRecord<T>>) => MetaRecord<T> | FieldMeta;
|
|
101
|
-
export declare const duplicateSchema: <From, To>(schema: S.Schema<
|
|
102
|
-
export declare const generateMetaFromSchema: <From, To>(schema: S.Schema<
|
|
103
|
-
schema: S.Schema<
|
|
101
|
+
export declare const duplicateSchema: <From, To>(schema: S.Schema<To, From, never>) => S.extend<S.Schema<To, From, never>, import("effect/Schema").Struct<{}>>;
|
|
102
|
+
export declare const generateMetaFromSchema: <From, To>(schema: S.Schema<To, From, never>) => {
|
|
103
|
+
schema: S.Schema<To, From, never>;
|
|
104
104
|
meta: MetaRecord<To>;
|
|
105
105
|
filterItems?: FilterItems;
|
|
106
106
|
};
|
|
@@ -17,7 +17,7 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
|
|
|
17
17
|
schema?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
form?: undefined;
|
|
20
|
-
schema: S.Schema<
|
|
20
|
+
schema: S.Schema<To, From, never>;
|
|
21
21
|
}))) & Partial<{}>> & 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-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-b227b253]{display:contents}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const o=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(o&&o.call(this),this.shadowRoot){const d=document.createElement("style");d.appendChild(document.createTextNode("fieldset[data-v-b227b253]{display:contents}")),this.shadowRoot.appendChild(d)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
import o from "./vue-components.es13.js";
|
|
3
3
|
|
|
4
4
|
import r from "./vue-components.es15.js";
|
|
5
|
-
const
|
|
5
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b227b253"]]);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
m as default
|
|
8
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as w, computed as f, onBeforeMount as E, watch as j, createElementBlock as v, openBlock as b, withModifiers as F, createElementVNode as M, unref as c, renderSlot as p, createCommentVNode as k, Fragment as V } from "vue";
|
|
2
2
|
import { useStore as g } from "@tanstack/vue-form";
|
|
3
|
-
import { getOmegaStore as B } from "./vue-components.
|
|
3
|
+
import { getOmegaStore as B } from "./vue-components.es23.js";
|
|
4
4
|
import { provideOmegaErrors as C } from "./vue-components.es8.js";
|
|
5
5
|
import { useOmegaForm as I } from "./vue-components.es9.js";
|
|
6
6
|
const $ = ["disabled"], N = /* @__PURE__ */ w({
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
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
|
+
}
|
|
2
11
|
export {
|
|
3
|
-
|
|
12
|
+
c as getOmegaStore
|
|
4
13
|
};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
}
|
|
1
|
+
const o = (n) => typeof n == "function";
|
|
11
2
|
export {
|
|
12
|
-
|
|
3
|
+
o as isFunction
|
|
13
4
|
};
|
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { createMeta as
|
|
3
|
-
const C = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as c, onMounted as M, computed as v, provide as F, createBlock as u, openBlock as s, resolveDynamicComponent as p, withCtx as l, createElementBlock as $, renderSlot as i, Fragment as h, renderList as k, mergeProps as S, normalizeProps as _, guardReactiveProps as A } from "vue";
|
|
2
|
+
import { createMeta as I } from "./vue-components.es10.js";
|
|
3
|
+
const C = /* @__PURE__ */ c({
|
|
4
4
|
inheritAttrs: !1,
|
|
5
5
|
__name: "OmegaArray",
|
|
6
6
|
props: {
|
|
7
7
|
form: {},
|
|
8
8
|
name: {},
|
|
9
|
+
defaultItems: {},
|
|
9
10
|
items: {}
|
|
10
11
|
},
|
|
11
12
|
setup(f) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const r = f, d = r.form.useStore((e) => e.values[r.name]);
|
|
14
|
+
M(() => {
|
|
15
|
+
r.defaultItems && !d.value && r.form.setFieldValue(r.name, r.defaultItems);
|
|
15
16
|
});
|
|
16
|
-
const
|
|
17
|
-
const e =
|
|
17
|
+
const y = v(() => {
|
|
18
|
+
const e = r.form.meta[r.name];
|
|
18
19
|
if (e && e.type === "multiple") {
|
|
19
|
-
const o = e.rest.reduce((t,
|
|
20
|
+
const o = e.rest.reduce((t, a) => a.type._tag === "TypeLiteral" ? {
|
|
20
21
|
...t,
|
|
21
22
|
propertySignatures: [
|
|
22
23
|
...t.propertySignatures || [],
|
|
23
|
-
...
|
|
24
|
+
...a.type.propertySignatures
|
|
24
25
|
]
|
|
25
26
|
} : {
|
|
26
27
|
...t,
|
|
27
|
-
property:
|
|
28
|
-
}, {}),
|
|
28
|
+
property: a.type
|
|
29
|
+
}, {}), n = I({ ...o, meta: e });
|
|
29
30
|
return (t) => {
|
|
30
|
-
if (t.endsWith("]")) return
|
|
31
|
-
const
|
|
32
|
-
return
|
|
31
|
+
if (t.endsWith("]")) return n;
|
|
32
|
+
const a = t.split("]."), m = a[a.length - 1];
|
|
33
|
+
return n[m];
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
return (o) => {
|
|
36
37
|
};
|
|
37
38
|
});
|
|
38
|
-
return F("getMetaFromArray",
|
|
39
|
-
default:
|
|
40
|
-
(s(!0), $(h, null, k(
|
|
39
|
+
return F("getMetaFromArray", y), (e, o) => (s(), u(p(e.form.Field), { name: e.name }, {
|
|
40
|
+
default: l(({ field: n }) => [
|
|
41
|
+
(s(!0), $(h, null, k(n.state.value, (g, t) => (s(), u(p(e.form.Field), {
|
|
41
42
|
key: `${e.name}[${Number(t)}]`,
|
|
42
43
|
name: `${e.name}[${Number(t)}]`
|
|
43
44
|
}, {
|
|
44
|
-
default:
|
|
45
|
-
|
|
46
|
-
field:
|
|
47
|
-
subField:
|
|
45
|
+
default: l(({ field: a, state: m }) => [
|
|
46
|
+
i(e.$slots, "default", S({ ref_for: !0 }, {
|
|
47
|
+
field: n,
|
|
48
|
+
subField: a,
|
|
48
49
|
subState: m,
|
|
49
50
|
index: Number(t)
|
|
50
51
|
}))
|
|
51
52
|
]),
|
|
52
53
|
_: 2
|
|
53
54
|
}, 1032, ["name"]))), 128)),
|
|
54
|
-
|
|
55
|
+
i(e.$slots, "field", _(A({ field: n })))
|
|
55
56
|
]),
|
|
56
57
|
_: 3
|
|
57
58
|
}, 8, ["name"]));
|
package/package.json
CHANGED
|
@@ -33,13 +33,16 @@ import {
|
|
|
33
33
|
createMeta,
|
|
34
34
|
} from "./OmegaFormStuff"
|
|
35
35
|
import { type DeepValue, type DeepKeys } from "@tanstack/vue-form"
|
|
36
|
+
import { S } from "effect-app"
|
|
36
37
|
|
|
37
38
|
const props = defineProps<
|
|
38
39
|
Omit<
|
|
39
40
|
OmegaInputProps<From, To>,
|
|
40
41
|
"validators" | "options" | "label" | "type" | "items"
|
|
41
42
|
> & {
|
|
42
|
-
|
|
43
|
+
defaultItems?: DeepValue<To, DeepKeys<To>>
|
|
44
|
+
// deprecated items, caused bugs in state update, use defaultItems instead. It's not a simple Never, because Volar explodes
|
|
45
|
+
items?: "please use `defaultItems` instead"
|
|
43
46
|
}
|
|
44
47
|
>()
|
|
45
48
|
|
|
@@ -47,9 +50,11 @@ defineOptions({
|
|
|
47
50
|
inheritAttrs: false,
|
|
48
51
|
})
|
|
49
52
|
|
|
53
|
+
const storeItems = props.form.useStore(state => state.values[props.name])
|
|
54
|
+
|
|
50
55
|
onMounted(() => {
|
|
51
|
-
if (props.
|
|
52
|
-
props.form.setFieldValue(props.name
|
|
56
|
+
if (props.defaultItems && !storeItems.value) {
|
|
57
|
+
props.form.setFieldValue(props.name, props.defaultItems)
|
|
53
58
|
}
|
|
54
59
|
})
|
|
55
60
|
|
|
@@ -397,7 +397,7 @@ export const createMeta = <T = any>(
|
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
const flattenMeta = <From, To>(
|
|
400
|
-
schema: S.Schema<
|
|
400
|
+
schema: S.Schema<To, From, never>
|
|
401
401
|
): MetaRecord<To> => {
|
|
402
402
|
const ast = schema.ast
|
|
403
403
|
const result: MetaRecord<To> = {}
|
|
@@ -436,15 +436,15 @@ const flattenMeta = <From, To>(
|
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
export const duplicateSchema = <From, To>(
|
|
439
|
-
schema: S.Schema<
|
|
439
|
+
schema: S.Schema<To, From, never>
|
|
440
440
|
) => {
|
|
441
441
|
return S.extend(schema, S.Struct({}))
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
export const generateMetaFromSchema = <From, To>(
|
|
445
|
-
schema: S.Schema<
|
|
445
|
+
schema: S.Schema<To, From, never>
|
|
446
446
|
): {
|
|
447
|
-
schema: S.Schema<
|
|
447
|
+
schema: S.Schema<To, From, never>
|
|
448
448
|
meta: MetaRecord<To>
|
|
449
449
|
filterItems?: FilterItems
|
|
450
450
|
} => {
|