@sfxcode/formkit-primevue 3.3.1 → 3.3.3
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/LICENSE +21 -0
- package/README.md +138 -13
- package/components.d.ts +1 -0
- package/dist/components/FormKitDataDebug.d.vue.ts +24 -0
- package/dist/components/FormKitDataDebug.vue +23 -0
- package/dist/components/FormKitDataDebug.vue.d.ts +24 -0
- package/dist/components/FormKitDataEdit.d.vue.ts +180 -0
- package/dist/components/FormKitDataEdit.vue +126 -0
- package/dist/components/FormKitDataEdit.vue.d.ts +180 -0
- package/dist/components/FormKitDataView.d.vue.ts +73 -0
- package/dist/components/FormKitDataView.vue +58 -0
- package/dist/components/FormKitDataView.vue.d.ts +73 -0
- package/dist/components/FormKitIcon.d.vue.ts +39 -0
- package/dist/components/FormKitIcon.vue +25 -0
- package/dist/components/FormKitIcon.vue.d.ts +39 -0
- package/dist/components/FormKitPrefix.d.vue.ts +7 -0
- package/dist/components/FormKitPrefix.vue +11 -0
- package/dist/components/FormKitPrefix.vue.d.ts +7 -0
- package/dist/components/FormKitSuffix.d.vue.ts +7 -0
- package/dist/components/FormKitSuffix.vue +11 -0
- package/dist/components/FormKitSuffix.vue.d.ts +7 -0
- package/dist/components/PrimeAutoComplete.d.vue.ts +31 -0
- package/dist/components/PrimeAutoComplete.vue +140 -0
- package/dist/components/PrimeAutoComplete.vue.d.ts +31 -0
- package/dist/components/PrimeCascadeSelect.d.vue.ts +28 -0
- package/dist/components/PrimeCascadeSelect.vue +62 -0
- package/dist/components/PrimeCascadeSelect.vue.d.ts +28 -0
- package/dist/components/PrimeCheckbox.d.vue.ts +27 -0
- package/dist/components/PrimeCheckbox.vue +71 -0
- package/dist/components/PrimeCheckbox.vue.d.ts +27 -0
- package/dist/components/PrimeColorPicker.d.vue.ts +24 -0
- package/dist/components/PrimeColorPicker.vue +48 -0
- package/dist/components/PrimeColorPicker.vue.d.ts +24 -0
- package/dist/components/PrimeDatePicker.d.vue.ts +63 -0
- package/dist/components/PrimeDatePicker.vue +153 -0
- package/dist/components/PrimeDatePicker.vue.d.ts +63 -0
- package/dist/components/PrimeInputMask.d.vue.ts +28 -0
- package/dist/components/PrimeInputMask.vue +88 -0
- package/dist/components/PrimeInputMask.vue.d.ts +28 -0
- package/dist/components/PrimeInputNumber.d.vue.ts +36 -0
- package/dist/components/PrimeInputNumber.vue +110 -0
- package/dist/components/PrimeInputNumber.vue.d.ts +36 -0
- package/dist/components/PrimeInputOtp.d.vue.ts +26 -0
- package/dist/components/PrimeInputOtp.vue +59 -0
- package/dist/components/PrimeInputOtp.vue.d.ts +26 -0
- package/dist/components/PrimeInputText.d.vue.ts +24 -0
- package/dist/components/PrimeInputText.vue +80 -0
- package/dist/components/PrimeInputText.vue.d.ts +24 -0
- package/dist/components/PrimeKnob.d.vue.ts +31 -0
- package/dist/components/PrimeKnob.vue +75 -0
- package/dist/components/PrimeKnob.vue.d.ts +31 -0
- package/dist/components/PrimeListbox.d.vue.ts +42 -0
- package/dist/components/PrimeListbox.vue +86 -0
- package/dist/components/PrimeListbox.vue.d.ts +42 -0
- package/dist/components/PrimeMultiSelect.d.vue.ts +53 -0
- package/dist/components/PrimeMultiSelect.vue +115 -0
- package/dist/components/PrimeMultiSelect.vue.d.ts +53 -0
- package/dist/components/PrimeOutputBoolean.d.vue.ts +16 -0
- package/dist/components/PrimeOutputBoolean.vue +41 -0
- package/dist/components/PrimeOutputBoolean.vue.d.ts +16 -0
- package/dist/components/PrimeOutputDate.d.vue.ts +16 -0
- package/dist/components/PrimeOutputDate.vue +51 -0
- package/dist/components/PrimeOutputDate.vue.d.ts +16 -0
- package/dist/components/PrimeOutputDuration.d.vue.ts +16 -0
- package/dist/components/PrimeOutputDuration.vue +32 -0
- package/dist/components/PrimeOutputDuration.vue.d.ts +16 -0
- package/dist/components/PrimeOutputLink.d.vue.ts +16 -0
- package/dist/components/PrimeOutputLink.vue +50 -0
- package/dist/components/PrimeOutputLink.vue.d.ts +16 -0
- package/dist/components/PrimeOutputList.d.vue.ts +19 -0
- package/dist/components/PrimeOutputList.vue +75 -0
- package/dist/components/PrimeOutputList.vue.d.ts +19 -0
- package/dist/components/PrimeOutputNumber.d.vue.ts +16 -0
- package/dist/components/PrimeOutputNumber.vue +59 -0
- package/dist/components/PrimeOutputNumber.vue.d.ts +16 -0
- package/dist/components/PrimeOutputReference.d.vue.ts +16 -0
- package/dist/components/PrimeOutputReference.vue +62 -0
- package/dist/components/PrimeOutputReference.vue.d.ts +16 -0
- package/dist/components/PrimeOutputText.d.vue.ts +22 -0
- package/dist/components/PrimeOutputText.vue +72 -0
- package/dist/components/PrimeOutputText.vue.d.ts +22 -0
- package/dist/components/PrimePassword.d.vue.ts +33 -0
- package/dist/components/PrimePassword.vue +73 -0
- package/dist/components/PrimePassword.vue.d.ts +33 -0
- package/dist/components/PrimeRadioButton.d.vue.ts +28 -0
- package/dist/components/PrimeRadioButton.vue +58 -0
- package/dist/components/PrimeRadioButton.vue.d.ts +28 -0
- package/dist/components/PrimeRating.d.vue.ts +24 -0
- package/dist/components/PrimeRating.vue +55 -0
- package/dist/components/PrimeRating.vue.d.ts +24 -0
- package/dist/components/PrimeSelect.d.vue.ts +50 -0
- package/dist/components/PrimeSelect.vue +113 -0
- package/dist/components/PrimeSelect.vue.d.ts +50 -0
- package/dist/components/PrimeSelectButton.d.vue.ts +28 -0
- package/dist/components/PrimeSelectButton.vue +64 -0
- package/dist/components/PrimeSelectButton.vue.d.ts +28 -0
- package/dist/components/PrimeSlider.d.vue.ts +26 -0
- package/dist/components/PrimeSlider.vue +60 -0
- package/dist/components/PrimeSlider.vue.d.ts +26 -0
- package/dist/components/PrimeTextarea.d.vue.ts +25 -0
- package/dist/components/PrimeTextarea.vue +53 -0
- package/dist/components/PrimeTextarea.vue.d.ts +25 -0
- package/dist/components/PrimeToggleButton.d.vue.ts +26 -0
- package/dist/components/PrimeToggleButton.vue +60 -0
- package/dist/components/PrimeToggleButton.vue.d.ts +26 -0
- package/dist/components/PrimeToggleSwitch.d.vue.ts +23 -0
- package/dist/components/PrimeToggleSwitch.vue +57 -0
- package/dist/components/PrimeToggleSwitch.vue.d.ts +23 -0
- package/dist/components/PrimeTreeSelect.d.vue.ts +32 -0
- package/dist/components/PrimeTreeSelect.vue +71 -0
- package/dist/components/PrimeTreeSelect.vue.d.ts +32 -0
- package/dist/components/index.d.ts +24 -2
- package/dist/components/index.js +167 -4
- package/dist/components/index.mjs +48 -0
- package/dist/composables/index.d.ts +9 -2
- package/dist/composables/index.js +61 -2
- package/dist/composables/index.mjs +18 -0
- package/dist/composables/useFormKitInput.d.ts +11 -0
- package/dist/composables/useFormKitInput.js +58 -0
- package/dist/composables/useFormKitInput.mjs +45 -0
- package/dist/composables/useFormKitRepeater.d.ts +15 -0
- package/dist/composables/useFormKitRepeater.js +74 -0
- package/dist/composables/useFormKitRepeater.mjs +54 -0
- package/dist/composables/useFormKitSchema.d.ts +36 -0
- package/dist/composables/useFormKitSchema.js +83 -0
- package/dist/composables/useFormKitSchema.mjs +58 -0
- package/dist/composables/useFormKitSection.d.ts +7 -0
- package/dist/composables/useFormKitSection.js +31 -0
- package/dist/composables/useFormKitSection.mjs +19 -0
- package/dist/composables/useInputEditor.d.ts +8 -0
- package/dist/composables/useInputEditor.js +148 -0
- package/dist/composables/useInputEditor.mjs +143 -0
- package/dist/composables/useInputEditorSchema.d.ts +163 -0
- package/dist/composables/useInputEditorSchema.js +313 -0
- package/dist/composables/useInputEditorSchema.mjs +315 -0
- package/dist/composables/useOutputDuration.d.ts +4 -0
- package/dist/composables/useOutputDuration.js +40 -0
- package/dist/composables/useOutputDuration.mjs +35 -0
- package/dist/composables/usePrimeInputs.d.ts +3 -0
- package/dist/composables/usePrimeInputs.js +62 -0
- package/dist/composables/usePrimeInputs.mjs +53 -0
- package/dist/definitions/index.d.ts +32 -37
- package/dist/definitions/index.js +42 -4
- package/dist/definitions/index.mjs +68 -0
- package/dist/definitions/input.d.ts +47 -0
- package/dist/definitions/input.js +142 -0
- package/dist/definitions/input.mjs +135 -0
- package/dist/definitions/output.d.ts +9 -0
- package/dist/definitions/output.js +46 -0
- package/dist/definitions/output.mjs +39 -0
- package/dist/index.d.ts +143 -146
- package/dist/index.js +62 -5
- package/dist/index.mjs +14 -0
- package/dist/plugins/index.d.ts +3 -7
- package/dist/plugins/index.js +57 -45
- package/dist/plugins/index.mjs +55 -0
- package/dist/sass/formkit-primevue.scss +101 -99
- package/package.json +115 -30
- package/dist/PrimeTreeSelect-Dksx7tL-.js +0 -1881
- package/dist/components-HJnJ39cU.js +0 -255
- package/dist/composables-CZ6f1QYe.js +0 -820
- package/dist/definitions-BHwWaom7.js +0 -1196
- package/dist/index-Ch3MtT1C.d.ts +0 -266
- package/dist/index-EJ8M51RO.d.ts +0 -917
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 sfxcode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,23 +1,148 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Formkit - Primevue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
PrimeVue based [FormKit Inputs](https://sfxcode.github.io/formkit-primevue/guide/inputs.html) for using [FormKit](https://formkit.com/) with the [PrimeVue UI Framework](https://primevue.org/#/).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Main focus of this project is to provide configuration based forms with validation.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
In addition, you can use the same pattern for **data output** from **schema** using [PrimeOutputs](https://sfxcode.github.io/formkit-primevue/guide/outputs.html).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
## PrimeVue Versions
|
|
10
|
+
|
|
11
|
+
Actual PrimeVue Version of the main branch is *4.x.*
|
|
12
|
+
|
|
13
|
+
PrimeVue 3 is in the prime3 branch, but future development will only focus on PrimeVue 4
|
|
14
|
+
|
|
15
|
+
## Build
|
|
16
|
+
|
|
17
|
+
[](https://github.com/sfxcode/formkit-primevue/actions/workflows/deploy.yml)
|
|
18
|
+
|
|
19
|
+
[](https://app.netlify.com/sites/formkit-primevue/deploys)
|
|
20
|
+
|
|
21
|
+
## Docs
|
|
22
|
+
|
|
23
|
+
[Docs](https://sfxcode.github.io/formkit-primevue/)
|
|
24
|
+
|
|
25
|
+
[Demo/Playground](https://formkit-primevue.netlify.app/)
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
12
28
|
|
|
13
|
-
|
|
29
|
+
### Configuration
|
|
14
30
|
|
|
15
|
-
|
|
16
|
-
|
|
31
|
+
Add *formkit.config.ts*
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { defaultConfig, plugin } from '@formkit/vue'
|
|
35
|
+
import { primeInputs } from '@sfxcode/formkit-primevue'
|
|
36
|
+
|
|
37
|
+
app.use(plugin, defaultConfig({
|
|
38
|
+
locales: { de, en },
|
|
39
|
+
// Define the active locale
|
|
40
|
+
locale: 'en',
|
|
41
|
+
inputs: primeInputs,
|
|
42
|
+
}))
|
|
17
43
|
```
|
|
18
44
|
|
|
19
|
-
|
|
45
|
+
or if using also the output part
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { defaultConfig, plugin } from '@formkit/vue'
|
|
49
|
+
import { primeInputs, primeOutputs } from '@sfxcode/formkit-primevue'
|
|
20
50
|
|
|
21
|
-
|
|
22
|
-
|
|
51
|
+
app.use(plugin, defaultConfig({
|
|
52
|
+
locales: { de, en },
|
|
53
|
+
// Define the active locale
|
|
54
|
+
locale: 'en',
|
|
55
|
+
inputs: { ...primeInputs, ...primeOutputs },
|
|
56
|
+
}))
|
|
23
57
|
```
|
|
58
|
+
|
|
59
|
+
Important: output elements depends on vue-i18n to style numbers, dates, ...
|
|
60
|
+
|
|
61
|
+
### Nuxt
|
|
62
|
+
|
|
63
|
+
[FormKit-PrimeVue-Nuxt](https://github.com/sfxcode/formkit-primevue-nuxt) module available.
|
|
64
|
+
|
|
65
|
+
Features:
|
|
66
|
+
|
|
67
|
+
- add PrimeVue Nuxt Module
|
|
68
|
+
- add FormKit Nuxt Module
|
|
69
|
+
- add i18n Nuxt Module
|
|
70
|
+
- Default Configuration for FormKit (with PrimeVue components) is provided (can be disabled if needed)
|
|
71
|
+
- AutoImport of PrimeVue Form Components
|
|
72
|
+
- PrimeIcons are loaded by Default
|
|
73
|
+
- FormKit Styling of this package is loaded by default
|
|
74
|
+
- AutoImport of Composables
|
|
75
|
+
- AutoImport of Components
|
|
76
|
+
|
|
77
|
+
## Limitations
|
|
78
|
+
|
|
79
|
+
Prefixing of the PrimeVue component names is not supported.
|
|
80
|
+
|
|
81
|
+
### Schema Helper Functions
|
|
82
|
+
|
|
83
|
+
[useFormKitSchema](https://github.com/sfxcode/formkit-primevue/blob/main/src/composables/useFormKitSchema.ts) provide functions to simplify the usage of elements, components, lists, ...
|
|
84
|
+
|
|
85
|
+
[useInputEditorSchema](https://github.com/sfxcode/formkit-primevue/blob/main/src/composables/useInputEditorSchema.ts) provide functions for a component schema generation builder
|
|
86
|
+
|
|
87
|
+
### Basic Styling
|
|
88
|
+
|
|
89
|
+
Basic styling is provided with the [formkit-primevue.scss](https://github.com/sfxcode/formkit-primevue/blob/main/src/sass/formkit-primevue.scss) file or the corresponding css file in the package.
|
|
90
|
+
|
|
91
|
+
Features:
|
|
92
|
+
|
|
93
|
+
- Width of all text and dropdown elements is set to 100%
|
|
94
|
+
- Error Color by variable (--formkit-error-color)
|
|
95
|
+
- Some margins, font sizes ...
|
|
96
|
+
|
|
97
|
+
You can use it or take it as base for your own styling.
|
|
98
|
+
|
|
99
|
+
### Extended Styling
|
|
100
|
+
|
|
101
|
+
- Styling outerClas, innerClass .... is provided by FormKit
|
|
102
|
+
- All inputs, outputs are wrapped in a div with a **p-formkit** class
|
|
103
|
+
- Most of the Prime Input Components have access to class / styles attributes
|
|
104
|
+
- PT and PTOptions are available ([https://primevue.org/passthrough/](https://primevue.org/passthrough/))
|
|
105
|
+
- [Styling](https://formkit-primevue.netlify.app/styling/base) and [PT](https://formkit-primevue.netlify.app/styling/passThrough) demo available
|
|
106
|
+
- [Grid](https://formkit-primevue.netlify.app/styling/grid) Demo of the provided grid styling (col-[1-12])
|
|
107
|
+
|
|
108
|
+
### Samples
|
|
109
|
+
|
|
110
|
+
Some samples for common tasks are available
|
|
111
|
+
|
|
112
|
+
- [Repeater](https://formkit-primevue.netlify.app/samples/repeater) Use Repeater composable for using repeating values in your schema
|
|
113
|
+
- [Input Editor](https://formkit-primevue.netlify.app/samples/inputEditor) Edit FormKit schema on the based on a provided composable
|
|
114
|
+
- [Form Editor](https://formkit-primevue.netlify.app/samples/formEditor) Basic demo as starter to create Forms visually
|
|
115
|
+
|
|
116
|
+
## Showcases
|
|
117
|
+
|
|
118
|
+
[Demo Application](https://formkit-primevue.netlify.app/)
|
|
119
|
+
|
|
120
|
+
[Nuxt 3 PrimeVue Starter](https://github.com/sfxcode/nuxt3-primevue-starter) and [Vite PrimeVue Starter](https://github.com/sfxcode/vite-primevue-starter) with Formkit support available.
|
|
121
|
+
|
|
122
|
+
## Supported Inputs for PrimeVue 4
|
|
123
|
+
|
|
124
|
+
- AutoComplete
|
|
125
|
+
- CascadeSelect
|
|
126
|
+
- Checkbox
|
|
127
|
+
- ColorPicker
|
|
128
|
+
- DatePicker
|
|
129
|
+
- Editor (HTML Editor - if you register the editor component, make sure to import quill)
|
|
130
|
+
- InputMask
|
|
131
|
+
- InputNumber
|
|
132
|
+
- InputOtp
|
|
133
|
+
- InputText
|
|
134
|
+
- Knob
|
|
135
|
+
- Listbox
|
|
136
|
+
- MultiSelect
|
|
137
|
+
- Password
|
|
138
|
+
- RadioButton
|
|
139
|
+
- Rating
|
|
140
|
+
- Select
|
|
141
|
+
- SelectButton
|
|
142
|
+
- Slider
|
|
143
|
+
- Textarea
|
|
144
|
+
- ToggleButton
|
|
145
|
+
- ToggleSwitch
|
|
146
|
+
- TreeSelect
|
|
147
|
+
|
|
148
|
+

|
package/components.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/components'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
data: {
|
|
3
|
+
type: ObjectConstructor;
|
|
4
|
+
default: null;
|
|
5
|
+
};
|
|
6
|
+
header: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
|
+
data: {
|
|
12
|
+
type: ObjectConstructor;
|
|
13
|
+
default: null;
|
|
14
|
+
};
|
|
15
|
+
header: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
}>> & Readonly<{}>, {
|
|
20
|
+
data: Record<string, any>;
|
|
21
|
+
header: string;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
defineProps({
|
|
3
|
+
data: {
|
|
4
|
+
type: Object,
|
|
5
|
+
default: null,
|
|
6
|
+
},
|
|
7
|
+
header: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: 'Debug',
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<Fieldset class="p-formkit-data-debug" :legend="header" :toggleable="true" :collapsed="true">
|
|
16
|
+
<pre v-if="data">{{ data }}</pre>
|
|
17
|
+
<span v-else>No Data available</span>
|
|
18
|
+
</Fieldset>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<style scoped>
|
|
22
|
+
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
data: {
|
|
3
|
+
type: ObjectConstructor;
|
|
4
|
+
default: null;
|
|
5
|
+
};
|
|
6
|
+
header: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
|
+
data: {
|
|
12
|
+
type: ObjectConstructor;
|
|
13
|
+
default: null;
|
|
14
|
+
};
|
|
15
|
+
header: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
}>> & Readonly<{}>, {
|
|
20
|
+
data: Record<string, any>;
|
|
21
|
+
header: string;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
declare var __VLS_16: {}, __VLS_29: {}, __VLS_37: {};
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
default?: (props: typeof __VLS_16) => any;
|
|
6
|
+
} & {
|
|
7
|
+
messages?: (props: typeof __VLS_29) => any;
|
|
8
|
+
} & {
|
|
9
|
+
submit?: (props: typeof __VLS_37) => any;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
id: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
data: {
|
|
17
|
+
type: ObjectConstructor;
|
|
18
|
+
default: null;
|
|
19
|
+
};
|
|
20
|
+
schema: {
|
|
21
|
+
type: PropType<FormKitSchemaDefinition>;
|
|
22
|
+
default: null;
|
|
23
|
+
};
|
|
24
|
+
formClass: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
actionsClass: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
submitSeverity: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
submitClass: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
submitLabel: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
default: string;
|
|
43
|
+
};
|
|
44
|
+
submitIcon: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
showReset: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
resetSeverity: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
resetLabel: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
resetClass: {
|
|
61
|
+
type: StringConstructor;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
resetIcon: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
debugData: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
debugSchema: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
76
|
+
modelValue: {
|
|
77
|
+
type: PropType<any>;
|
|
78
|
+
};
|
|
79
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
80
|
+
onReset: (...args: any[]) => void;
|
|
81
|
+
dataSaved: (...args: any[]) => void;
|
|
82
|
+
"update:modelValue": (value: any) => void;
|
|
83
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
84
|
+
id: {
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
default: string;
|
|
87
|
+
};
|
|
88
|
+
data: {
|
|
89
|
+
type: ObjectConstructor;
|
|
90
|
+
default: null;
|
|
91
|
+
};
|
|
92
|
+
schema: {
|
|
93
|
+
type: PropType<FormKitSchemaDefinition>;
|
|
94
|
+
default: null;
|
|
95
|
+
};
|
|
96
|
+
formClass: {
|
|
97
|
+
type: StringConstructor;
|
|
98
|
+
default: string;
|
|
99
|
+
};
|
|
100
|
+
actionsClass: {
|
|
101
|
+
type: StringConstructor;
|
|
102
|
+
default: string;
|
|
103
|
+
};
|
|
104
|
+
submitSeverity: {
|
|
105
|
+
type: StringConstructor;
|
|
106
|
+
default: string;
|
|
107
|
+
};
|
|
108
|
+
submitClass: {
|
|
109
|
+
type: StringConstructor;
|
|
110
|
+
default: string;
|
|
111
|
+
};
|
|
112
|
+
submitLabel: {
|
|
113
|
+
type: StringConstructor;
|
|
114
|
+
default: string;
|
|
115
|
+
};
|
|
116
|
+
submitIcon: {
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
default: string;
|
|
119
|
+
};
|
|
120
|
+
showReset: {
|
|
121
|
+
type: BooleanConstructor;
|
|
122
|
+
default: boolean;
|
|
123
|
+
};
|
|
124
|
+
resetSeverity: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
default: string;
|
|
127
|
+
};
|
|
128
|
+
resetLabel: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
default: string;
|
|
131
|
+
};
|
|
132
|
+
resetClass: {
|
|
133
|
+
type: StringConstructor;
|
|
134
|
+
default: string;
|
|
135
|
+
};
|
|
136
|
+
resetIcon: {
|
|
137
|
+
type: StringConstructor;
|
|
138
|
+
default: string;
|
|
139
|
+
};
|
|
140
|
+
debugData: {
|
|
141
|
+
type: BooleanConstructor;
|
|
142
|
+
default: boolean;
|
|
143
|
+
};
|
|
144
|
+
debugSchema: {
|
|
145
|
+
type: BooleanConstructor;
|
|
146
|
+
default: boolean;
|
|
147
|
+
};
|
|
148
|
+
modelValue: {
|
|
149
|
+
type: PropType<any>;
|
|
150
|
+
};
|
|
151
|
+
}>> & Readonly<{
|
|
152
|
+
onOnReset?: ((...args: any[]) => any) | undefined;
|
|
153
|
+
onDataSaved?: ((...args: any[]) => any) | undefined;
|
|
154
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
155
|
+
}>, {
|
|
156
|
+
data: Record<string, any>;
|
|
157
|
+
id: string;
|
|
158
|
+
schema: FormKitSchemaDefinition;
|
|
159
|
+
formClass: string;
|
|
160
|
+
actionsClass: string;
|
|
161
|
+
submitSeverity: string;
|
|
162
|
+
submitClass: string;
|
|
163
|
+
submitLabel: string;
|
|
164
|
+
submitIcon: string;
|
|
165
|
+
showReset: boolean;
|
|
166
|
+
resetSeverity: string;
|
|
167
|
+
resetLabel: string;
|
|
168
|
+
resetClass: string;
|
|
169
|
+
resetIcon: string;
|
|
170
|
+
debugData: boolean;
|
|
171
|
+
debugSchema: boolean;
|
|
172
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
173
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
174
|
+
declare const _default: typeof __VLS_export;
|
|
175
|
+
export default _default;
|
|
176
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
177
|
+
new (): {
|
|
178
|
+
$slots: S;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { FormKitSchemaDefinition } from '@formkit/core'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
4
|
+
import { reset } from '@formkit/core'
|
|
5
|
+
import { FormKit, FormKitMessages, FormKitSchema } from '@formkit/vue'
|
|
6
|
+
import { ref } from 'vue'
|
|
7
|
+
import FormKitDataDebug from './FormKitDataDebug.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
id: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: 'formkit_form',
|
|
13
|
+
},
|
|
14
|
+
data: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: null,
|
|
17
|
+
},
|
|
18
|
+
schema: {
|
|
19
|
+
type: Object as PropType<FormKitSchemaDefinition>,
|
|
20
|
+
default: null,
|
|
21
|
+
},
|
|
22
|
+
formClass: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: '',
|
|
25
|
+
},
|
|
26
|
+
actionsClass: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
submitSeverity: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: '',
|
|
33
|
+
},
|
|
34
|
+
submitClass: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: '',
|
|
37
|
+
},
|
|
38
|
+
submitLabel: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'Save',
|
|
41
|
+
},
|
|
42
|
+
submitIcon: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
showReset: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
resetSeverity: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'danger',
|
|
53
|
+
},
|
|
54
|
+
resetLabel: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: 'Reset',
|
|
57
|
+
},
|
|
58
|
+
resetClass: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: '',
|
|
61
|
+
},
|
|
62
|
+
resetIcon: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
debugData: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
70
|
+
debugSchema: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
const emit = defineEmits(['dataSaved', 'onReset'])
|
|
76
|
+
|
|
77
|
+
const formData = defineModel<any>()
|
|
78
|
+
|
|
79
|
+
if (props.data) {
|
|
80
|
+
formData.value = props.data
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const formSchema = ref(props.schema)
|
|
84
|
+
|
|
85
|
+
function handleSave() {
|
|
86
|
+
emit('dataSaved', formData.value)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function handleReset() {
|
|
90
|
+
reset(props.id)
|
|
91
|
+
emit('onReset')
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<template>
|
|
96
|
+
<FormKit
|
|
97
|
+
:id="id"
|
|
98
|
+
v-model="formData"
|
|
99
|
+
:actions-class="actionsClass"
|
|
100
|
+
:form-class="`p-formkit-data-edit ${formClass}`"
|
|
101
|
+
type="form"
|
|
102
|
+
@submit="handleSave"
|
|
103
|
+
>
|
|
104
|
+
<template #default>
|
|
105
|
+
<FormKitSchema v-if="formSchema" :schema="formSchema" :data="formData" />
|
|
106
|
+
<slot />
|
|
107
|
+
<FormKitDataDebug v-if="debugData" :data="formData" header="Debug Mode - Data" />
|
|
108
|
+
<FormKitDataDebug v-if="debugSchema" :data="formSchema as object" header="Debug Mode - Schema" />
|
|
109
|
+
</template>
|
|
110
|
+
<template #messages>
|
|
111
|
+
<slot name="messages">
|
|
112
|
+
<FormKitMessages class="p-formkit-data-edit-messages" />
|
|
113
|
+
</slot>
|
|
114
|
+
</template>
|
|
115
|
+
<template #submit>
|
|
116
|
+
<slot name="submit">
|
|
117
|
+
<Button :icon="submitIcon" type="submit" :label="submitLabel" :class="submitClass" :severity="submitSeverity" @submit="handleSave" />
|
|
118
|
+
<Button v-if="showReset" type="reset" :icon="resetIcon" :label="resetLabel" :class="resetClass" :severity="resetSeverity" @click="handleReset" />
|
|
119
|
+
</slot>
|
|
120
|
+
</template>
|
|
121
|
+
</FormKit>
|
|
122
|
+
</template>
|
|
123
|
+
|
|
124
|
+
<style scoped>
|
|
125
|
+
|
|
126
|
+
</style>
|