@effect-app/vue-components 0.5.0 → 0.6.2
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/OmegaAutoGen.vue.d.ts +30 -0
- package/dist/types/components/OmegaForm/index.d.ts +3 -7
- package/dist/vue-components.es.js +24 -27
- package/dist/vue-components.es10.js +6 -23
- package/dist/vue-components.es11.js +3 -3
- package/dist/vue-components.es15.js +1 -1
- package/dist/vue-components.es17.js +2 -5
- package/dist/vue-components.es18.js +5 -32
- package/dist/vue-components.es19.js +32 -2
- package/dist/vue-components.es2.js +16 -19
- package/dist/vue-components.es20.js +2 -2
- package/dist/vue-components.es21.js +2 -98
- package/dist/vue-components.es22.js +98 -11
- package/dist/vue-components.es23.js +11 -2
- package/dist/vue-components.es24.js +2 -115
- package/dist/vue-components.es25.js +117 -0
- package/dist/{vue-components.es26.js → vue-components.es27.js} +1 -1
- package/dist/vue-components.es3.js +3 -3
- package/dist/vue-components.es4.js +2 -2
- package/dist/vue-components.es5.js +78 -36
- package/dist/vue-components.es6.js +34 -131
- package/dist/vue-components.es7.js +128 -211
- package/dist/vue-components.es8.js +216 -6
- package/dist/vue-components.es9.js +4 -4
- package/package.json +9 -3
- package/src/components/OmegaForm/OmegaAutoGen.vue +110 -0
- package/src/components/OmegaForm/OmegaWrapper.vue +1 -1
- package/src/components/OmegaForm/index.ts +3 -21
- package/src/env.d.ts +0 -8
- package/src/stories/OmegaForm/Clearable.vue +0 -20
- package/src/stories/OmegaForm/ComplexForm.vue +0 -87
- package/src/stories/OmegaForm/EmailForm.vue +0 -48
- package/src/stories/OmegaForm/Meta.vue +0 -47
- package/src/stories/OmegaForm/OneHundredWaysToWriteAForm.vue +0 -188
- package/src/stories/OmegaForm/PersistencyForm.vue +0 -58
- package/src/stories/OmegaForm/SimpleForm.vue +0 -30
- package/src/stories/OmegaForm/SimpleFormVuetifyDefault.vue +0 -15
- package/src/stories/OmegaForm/SumExample.vue +0 -37
- package/src/stories/OmegaForm/form.Input.vue +0 -98
- package/src/stories/OmegaForm.stories.ts +0 -114
- package/src/stories/README.md +0 -29
- package/src/stories/tsconfig.json +0 -4
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<OmegaForm :form="addForm">
|
|
3
|
-
<OmegaInput label="first" :form="addForm" name="first" />
|
|
4
|
-
<div>+</div>
|
|
5
|
-
<OmegaInput label="second" :form="addForm" name="second" />
|
|
6
|
-
</OmegaForm>
|
|
7
|
-
|
|
8
|
-
<!-- Technically you can do this only with a subscribe but only inside OmegaForm Context -->
|
|
9
|
-
<div>
|
|
10
|
-
<div>Sum: {{ sum }}</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { S } from "effect-app"
|
|
16
|
-
import { OmegaForm, OmegaInput, useOmegaForm } from "../../components/OmegaForm"
|
|
17
|
-
import { ref, watch } from "vue"
|
|
18
|
-
|
|
19
|
-
const sum = ref(0)
|
|
20
|
-
const AddSchema = S.Struct({
|
|
21
|
-
first: S.Number,
|
|
22
|
-
second: S.Number,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const addForm = useOmegaForm(AddSchema, {
|
|
26
|
-
defaultValues: {
|
|
27
|
-
first: 0,
|
|
28
|
-
second: 0,
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const values = addForm.useStore(({ values }) => values)
|
|
33
|
-
|
|
34
|
-
watch(values, ({ first, second }) => {
|
|
35
|
-
sum.value = first + second
|
|
36
|
-
})
|
|
37
|
-
</script>
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<OmegaForm
|
|
3
|
-
:schema="S.Struct({ myString: S.String })"
|
|
4
|
-
:on-submit="console.log"
|
|
5
|
-
>
|
|
6
|
-
<template #internalForm="{ form }">
|
|
7
|
-
<component :is="form.Input" label="myString" name="myString">
|
|
8
|
-
<template #default="{ field }">
|
|
9
|
-
<div>
|
|
10
|
-
<input v-model="field.state.value" />
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
</component>
|
|
14
|
-
</template>
|
|
15
|
-
</OmegaForm>
|
|
16
|
-
<OmegaForm :form="exampleForm">
|
|
17
|
-
<exampleForm.Input label="aString" name="aString">
|
|
18
|
-
<template #default="{ field }">
|
|
19
|
-
<div>
|
|
20
|
-
<input v-model="field.state.value" />
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
</exampleForm.Input>
|
|
24
|
-
<exampleForm.Input label="aStringMin2" name="aStringMin2" />
|
|
25
|
-
<exampleForm.Input label="aStringMin2Max4" name="aStringMin2Max4" />
|
|
26
|
-
<exampleForm.Input
|
|
27
|
-
label="aStringMin2Max3Nullable"
|
|
28
|
-
name="aStringMin2Max3Nullable"
|
|
29
|
-
/>
|
|
30
|
-
<exampleForm.Input label="aNumber" name="aNumber" />
|
|
31
|
-
<exampleForm.Input label="aNumberMin2" name="aNumberMin2" />
|
|
32
|
-
<exampleForm.Input label="aNumberMin2Max" name="aNumberMin2Max" />
|
|
33
|
-
<exampleForm.Input
|
|
34
|
-
label="aNumberMin2Max4Nullable"
|
|
35
|
-
name="aNumberMin2Max4Nullable"
|
|
36
|
-
/>
|
|
37
|
-
<exampleForm.Input
|
|
38
|
-
label="aSelect"
|
|
39
|
-
name="aSelect"
|
|
40
|
-
:options="[
|
|
41
|
-
{ title: 'a', value: 'a' },
|
|
42
|
-
{ title: 'b', value: 'b' },
|
|
43
|
-
{ title: 'c', value: 'c' },
|
|
44
|
-
]"
|
|
45
|
-
/>
|
|
46
|
-
<button>Submit</button>
|
|
47
|
-
<button type="reset" @click.prevent="exampleForm.clear()">Clear</button>
|
|
48
|
-
<button type="button" @click="exampleForm.reset()">Reset</button>
|
|
49
|
-
</OmegaForm>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<script setup lang="ts">
|
|
53
|
-
import { S } from "effect-app"
|
|
54
|
-
import { OmegaForm, useOmegaForm } from "../../components/OmegaForm"
|
|
55
|
-
|
|
56
|
-
const schema = S.Struct({
|
|
57
|
-
aString: S.String,
|
|
58
|
-
aStringMin2: S.String.pipe(S.minLength(2)),
|
|
59
|
-
aStringMin2Max4: S.String.pipe(S.minLength(2)).pipe(S.maxLength(4)),
|
|
60
|
-
aStringMin2Max3Nullable: S.UndefinedOr(
|
|
61
|
-
S.String.pipe(S.minLength(2)).pipe(S.maxLength(3)),
|
|
62
|
-
),
|
|
63
|
-
aNumber: S.Number,
|
|
64
|
-
aNumberMin2: S.Number.pipe(S.greaterThan(2)),
|
|
65
|
-
aNumberMin2Max: S.Number.pipe(S.greaterThan(2)).pipe(S.lessThan(4)),
|
|
66
|
-
aNumberMin2Max4Nullable: S.NullOr(S.Number.pipe(S.between(2, 4))),
|
|
67
|
-
aSelect: S.Union(S.Literal("a"), S.Literal("b"), S.Literal("c")),
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
const exampleForm = useOmegaForm(
|
|
71
|
-
schema,
|
|
72
|
-
{
|
|
73
|
-
onSubmit: ({
|
|
74
|
-
value,
|
|
75
|
-
}: {
|
|
76
|
-
value: {
|
|
77
|
-
aString: string
|
|
78
|
-
aStringMin2: string
|
|
79
|
-
aStringMin2Max4: string
|
|
80
|
-
aStringMin2Max3Nullable?: string
|
|
81
|
-
aNumber: number
|
|
82
|
-
aNumberMin2: number
|
|
83
|
-
aNumberMin2Max: number
|
|
84
|
-
aNumberMin2Max4Nullable: number | null
|
|
85
|
-
aSelect: "a" | "b" | "c"
|
|
86
|
-
}
|
|
87
|
-
}) => {
|
|
88
|
-
console.log(value)
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
persistency: {
|
|
93
|
-
policies: ["local"],
|
|
94
|
-
overrideDefaultValues: true,
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
)
|
|
98
|
-
</script>
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
2
|
-
import { OmegaForm } from "../components/OmegaForm"
|
|
3
|
-
import { provideIntl } from "../utils"
|
|
4
|
-
import { type makeIntl } from "@effect-app/vue"
|
|
5
|
-
import { ref } from "vue"
|
|
6
|
-
import SimpleForm from "./OmegaForm/SimpleForm.vue"
|
|
7
|
-
import EmailForm from "./OmegaForm/EmailForm.vue"
|
|
8
|
-
import ComplexForm from "./OmegaForm/ComplexForm.vue"
|
|
9
|
-
import SimpleFormVuetifyDefault from "./OmegaForm/SimpleFormVuetifyDefault.vue"
|
|
10
|
-
import SumExample from "./OmegaForm/SumExample.vue"
|
|
11
|
-
import PersistencyForm from "./OmegaForm/PersistencyForm.vue"
|
|
12
|
-
import MetaForm from "./OmegaForm/Meta.vue"
|
|
13
|
-
import FormInput from "./OmegaForm/form.Input.vue"
|
|
14
|
-
import OneHundredWaysToWriteAForm from "./OmegaForm/OneHundredWaysToWriteAForm.vue"
|
|
15
|
-
import Clearable from "./OmegaForm/Clearable.vue"
|
|
16
|
-
|
|
17
|
-
const mockIntl = {
|
|
18
|
-
locale: ref("en"),
|
|
19
|
-
trans: (id: string) => id,
|
|
20
|
-
intl: ref({ formatMessage: (msg: { id: string }) => msg.id }),
|
|
21
|
-
} as unknown as ReturnType<ReturnType<typeof makeIntl<string>>["useIntl"]>
|
|
22
|
-
|
|
23
|
-
const meta: Meta<typeof OmegaForm> = {
|
|
24
|
-
title: "Components/OmegaForm",
|
|
25
|
-
component: OmegaForm,
|
|
26
|
-
argTypes: {
|
|
27
|
-
schema: { control: "object" },
|
|
28
|
-
onSubmit: { action: "submitted" },
|
|
29
|
-
defaultValues: { control: "object" },
|
|
30
|
-
},
|
|
31
|
-
decorators: [
|
|
32
|
-
story => ({
|
|
33
|
-
components: { story },
|
|
34
|
-
setup() {
|
|
35
|
-
provideIntl(mockIntl)
|
|
36
|
-
return {}
|
|
37
|
-
},
|
|
38
|
-
template: "<story />",
|
|
39
|
-
}),
|
|
40
|
-
],
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default meta
|
|
44
|
-
type Story = StoryObj<typeof meta>
|
|
45
|
-
|
|
46
|
-
export const AnHundredWayToWriteAFormStory: Story = {
|
|
47
|
-
render: () => ({
|
|
48
|
-
components: { OneHundredWaysToWriteAForm },
|
|
49
|
-
template: "<OneHundredWaysToWriteAForm />",
|
|
50
|
-
}),
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const SimpleFormStory: Story = {
|
|
54
|
-
render: () => ({
|
|
55
|
-
components: { SimpleForm },
|
|
56
|
-
template: "<SimpleForm />",
|
|
57
|
-
}),
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const EmailFormStory: Story = {
|
|
61
|
-
render: () => ({
|
|
62
|
-
components: { EmailForm },
|
|
63
|
-
template: "<EmailForm />",
|
|
64
|
-
}),
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const ComplexFormStory: Story = {
|
|
68
|
-
render: () => ({
|
|
69
|
-
components: { ComplexForm },
|
|
70
|
-
template: "<ComplexForm />",
|
|
71
|
-
}),
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const SimpleFormVuetifyDefaultStory: Story = {
|
|
75
|
-
render: () => ({
|
|
76
|
-
components: { SimpleFormVuetifyDefault },
|
|
77
|
-
template: "<SimpleFormVuetifyDefault />",
|
|
78
|
-
}),
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export const SumExampleStory: Story = {
|
|
82
|
-
render: () => ({
|
|
83
|
-
components: { SumExample },
|
|
84
|
-
template: "<SumExample />",
|
|
85
|
-
}),
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export const PersistencyFormStory: Story = {
|
|
89
|
-
render: () => ({
|
|
90
|
-
components: { PersistencyForm },
|
|
91
|
-
template: "<PersistencyForm />",
|
|
92
|
-
}),
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export const MetaStory: Story = {
|
|
96
|
-
render: () => ({
|
|
97
|
-
components: { MetaForm },
|
|
98
|
-
template: "<MetaForm />",
|
|
99
|
-
}),
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export const FormInputStory: Story = {
|
|
103
|
-
render: () => ({
|
|
104
|
-
components: { FormInput },
|
|
105
|
-
template: "<FormInput />",
|
|
106
|
-
}),
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export const ClearableStory: Story = {
|
|
110
|
-
render: () => ({
|
|
111
|
-
components: { Clearable },
|
|
112
|
-
template: "<Clearable />",
|
|
113
|
-
}),
|
|
114
|
-
}
|
package/src/stories/README.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Storybook Stories
|
|
2
|
-
|
|
3
|
-
This folder contains all the Storybook stories for the Vue Components package. Each story file corresponds to a component and demonstrates its various use cases and configurations.
|
|
4
|
-
|
|
5
|
-
## Structure
|
|
6
|
-
|
|
7
|
-
- Each story file is named after the component it's documenting (e.g., `OmegaForm.stories.ts`)
|
|
8
|
-
- Stories are organized by component type and functionality
|
|
9
|
-
- Each story includes proper TypeScript typing and documentation
|
|
10
|
-
|
|
11
|
-
## Running Stories
|
|
12
|
-
|
|
13
|
-
To run the Storybook:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pnpm storybook
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This will start Storybook on port 6006, and you can view your components at http://localhost:6006.
|
|
20
|
-
|
|
21
|
-
## Adding New Stories
|
|
22
|
-
|
|
23
|
-
When adding a new story:
|
|
24
|
-
|
|
25
|
-
1. Create a new file in this folder with the naming pattern `ComponentName.stories.ts`
|
|
26
|
-
2. Import the component and any dependencies
|
|
27
|
-
3. Define the meta object with component information
|
|
28
|
-
4. Create story objects that demonstrate different use cases
|
|
29
|
-
5. Use proper TypeScript typing for all parameters
|