@sfxcode/formkit-primevue 3.3.4 → 3.3.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.
Files changed (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -13
  3. package/components.d.ts +1 -0
  4. package/dist/components/FormKitDataDebug.d.vue.ts +24 -0
  5. package/dist/components/FormKitDataDebug.vue +9 -5
  6. package/dist/components/FormKitDataDebug.vue.d.ts +24 -0
  7. package/dist/components/FormKitDataEdit.d.vue.ts +180 -0
  8. package/dist/components/FormKitDataEdit.vue +46 -53
  9. package/dist/components/FormKitDataEdit.vue.d.ts +180 -0
  10. package/dist/components/FormKitDataView.d.vue.ts +73 -0
  11. package/dist/components/FormKitDataView.vue +27 -20
  12. package/dist/components/FormKitDataView.vue.d.ts +73 -0
  13. package/dist/components/FormKitIcon.d.vue.ts +39 -0
  14. package/dist/components/FormKitIcon.vue +13 -6
  15. package/dist/components/FormKitIcon.vue.d.ts +39 -0
  16. package/dist/components/FormKitPrefix.d.vue.ts +7 -0
  17. package/dist/components/FormKitPrefix.vue +3 -3
  18. package/dist/components/FormKitPrefix.vue.d.ts +7 -0
  19. package/dist/components/FormKitSuffix.d.vue.ts +7 -0
  20. package/dist/components/FormKitSuffix.vue +3 -3
  21. package/dist/components/FormKitSuffix.vue.d.ts +7 -0
  22. package/dist/components/PrimeAutoComplete.d.vue.ts +31 -0
  23. package/dist/components/PrimeAutoComplete.vue +86 -41
  24. package/dist/components/PrimeAutoComplete.vue.d.ts +31 -0
  25. package/dist/components/PrimeCascadeSelect.d.vue.ts +28 -0
  26. package/dist/components/PrimeCascadeSelect.vue +26 -7
  27. package/dist/components/PrimeCascadeSelect.vue.d.ts +28 -0
  28. package/dist/components/PrimeCheckbox.d.vue.ts +27 -0
  29. package/dist/components/PrimeCheckbox.vue +29 -9
  30. package/dist/components/PrimeCheckbox.vue.d.ts +27 -0
  31. package/dist/components/PrimeColorPicker.d.vue.ts +24 -0
  32. package/dist/components/PrimeColorPicker.vue +22 -7
  33. package/dist/components/PrimeColorPicker.vue.d.ts +24 -0
  34. package/dist/components/PrimeDatePicker.d.vue.ts +63 -0
  35. package/dist/components/PrimeDatePicker.vue +73 -17
  36. package/dist/components/PrimeDatePicker.vue.d.ts +63 -0
  37. package/dist/components/PrimeInputMask.d.vue.ts +28 -0
  38. package/dist/components/PrimeInputMask.vue +29 -10
  39. package/dist/components/PrimeInputMask.vue.d.ts +28 -0
  40. package/dist/components/PrimeInputNumber.d.vue.ts +36 -0
  41. package/dist/components/PrimeInputNumber.vue +56 -21
  42. package/dist/components/PrimeInputNumber.vue.d.ts +36 -0
  43. package/dist/components/PrimeInputOtp.d.vue.ts +26 -0
  44. package/dist/components/PrimeInputOtp.vue +24 -7
  45. package/dist/components/PrimeInputOtp.vue.d.ts +26 -0
  46. package/dist/components/PrimeInputText.d.vue.ts +24 -0
  47. package/dist/components/PrimeInputText.vue +25 -10
  48. package/dist/components/PrimeInputText.vue.d.ts +24 -0
  49. package/dist/components/PrimeKnob.d.vue.ts +31 -0
  50. package/dist/components/PrimeKnob.vue +37 -12
  51. package/dist/components/PrimeKnob.vue.d.ts +31 -0
  52. package/dist/components/PrimeListbox.d.vue.ts +42 -0
  53. package/dist/components/PrimeListbox.vue +39 -7
  54. package/dist/components/PrimeListbox.vue.d.ts +42 -0
  55. package/dist/components/PrimeMultiSelect.d.vue.ts +53 -0
  56. package/dist/components/PrimeMultiSelect.vue +52 -7
  57. package/dist/components/PrimeMultiSelect.vue.d.ts +53 -0
  58. package/dist/components/PrimeOutputBoolean.d.vue.ts +16 -0
  59. package/dist/components/PrimeOutputBoolean.vue +27 -28
  60. package/dist/components/PrimeOutputBoolean.vue.d.ts +16 -0
  61. package/dist/components/PrimeOutputDate.d.vue.ts +16 -0
  62. package/dist/components/PrimeOutputDate.vue +33 -33
  63. package/dist/components/PrimeOutputDate.vue.d.ts +16 -0
  64. package/dist/components/PrimeOutputDuration.d.vue.ts +16 -0
  65. package/dist/components/PrimeOutputDuration.vue +19 -23
  66. package/dist/components/PrimeOutputDuration.vue.d.ts +16 -0
  67. package/dist/components/PrimeOutputLink.d.vue.ts +16 -0
  68. package/dist/components/PrimeOutputLink.vue +27 -29
  69. package/dist/components/PrimeOutputLink.vue.d.ts +16 -0
  70. package/dist/components/PrimeOutputList.d.vue.ts +19 -0
  71. package/dist/components/PrimeOutputList.vue +40 -71
  72. package/dist/components/PrimeOutputList.vue.d.ts +19 -0
  73. package/dist/components/PrimeOutputNumber.d.vue.ts +16 -0
  74. package/dist/components/PrimeOutputNumber.vue +39 -36
  75. package/dist/components/PrimeOutputNumber.vue.d.ts +16 -0
  76. package/dist/components/PrimeOutputReference.d.vue.ts +16 -0
  77. package/dist/components/PrimeOutputReference.vue +30 -32
  78. package/dist/components/PrimeOutputReference.vue.d.ts +16 -0
  79. package/dist/components/PrimeOutputText.d.vue.ts +22 -0
  80. package/dist/components/PrimeOutputText.vue +53 -53
  81. package/dist/components/PrimeOutputText.vue.d.ts +22 -0
  82. package/dist/components/PrimePassword.d.vue.ts +33 -0
  83. package/dist/components/PrimePassword.vue +32 -11
  84. package/dist/components/PrimePassword.vue.d.ts +33 -0
  85. package/dist/components/PrimeRadioButton.d.vue.ts +28 -0
  86. package/dist/components/PrimeRadioButton.vue +29 -19
  87. package/dist/components/PrimeRadioButton.vue.d.ts +28 -0
  88. package/dist/components/PrimeRating.d.vue.ts +24 -0
  89. package/dist/components/PrimeRating.vue +22 -7
  90. package/dist/components/PrimeRating.vue.d.ts +24 -0
  91. package/dist/components/PrimeSelect.d.vue.ts +50 -0
  92. package/dist/components/PrimeSelect.vue +49 -7
  93. package/dist/components/PrimeSelect.vue.d.ts +50 -0
  94. package/dist/components/PrimeSelectButton.d.vue.ts +28 -0
  95. package/dist/components/PrimeSelectButton.vue +27 -7
  96. package/dist/components/PrimeSelectButton.vue.d.ts +28 -0
  97. package/dist/components/PrimeSlider.d.vue.ts +26 -0
  98. package/dist/components/PrimeSlider.vue +28 -10
  99. package/dist/components/PrimeSlider.vue.d.ts +26 -0
  100. package/dist/components/PrimeTextarea.d.vue.ts +25 -0
  101. package/dist/components/PrimeTextarea.vue +23 -7
  102. package/dist/components/PrimeTextarea.vue.d.ts +25 -0
  103. package/dist/components/PrimeToggleButton.d.vue.ts +26 -0
  104. package/dist/components/PrimeToggleButton.vue +25 -7
  105. package/dist/components/PrimeToggleButton.vue.d.ts +26 -0
  106. package/dist/components/PrimeToggleSwitch.d.vue.ts +23 -0
  107. package/dist/components/PrimeToggleSwitch.vue +23 -8
  108. package/dist/components/PrimeToggleSwitch.vue.d.ts +23 -0
  109. package/dist/components/PrimeTreeSelect.d.vue.ts +32 -0
  110. package/dist/components/PrimeTreeSelect.vue +30 -7
  111. package/dist/components/PrimeTreeSelect.vue.d.ts +32 -0
  112. package/dist/components/index.d.ts +23 -23
  113. package/dist/composables/index.d.ts +8 -8
  114. package/dist/composables/index.js +8 -8
  115. package/dist/composables/index.mjs +8 -8
  116. package/dist/composables/useFormKitInput.js +1 -5
  117. package/dist/composables/useFormKitInput.mjs +1 -13
  118. package/dist/composables/useFormKitRepeater.js +1 -1
  119. package/dist/composables/useFormKitRepeater.mjs +17 -45
  120. package/dist/composables/useFormKitSchema.mjs +2 -10
  121. package/dist/composables/useInputEditor.js +4 -4
  122. package/dist/composables/useInputEditor.mjs +24 -52
  123. package/dist/composables/useInputEditorSchema.js +3 -3
  124. package/dist/composables/useInputEditorSchema.mjs +17 -25
  125. package/dist/composables/useOutputDuration.mjs +6 -3
  126. package/dist/definitions/index.js +2 -2
  127. package/dist/definitions/index.mjs +2 -2
  128. package/dist/definitions/input.d.ts +1 -1
  129. package/dist/definitions/input.mjs +15 -301
  130. package/dist/definitions/output.d.ts +1 -1
  131. package/dist/definitions/output.js +1 -1
  132. package/dist/definitions/output.mjs +14 -95
  133. package/dist/index.d.ts +48 -48
  134. package/dist/index.js +12 -12
  135. package/dist/index.mjs +3 -9
  136. package/dist/plugins/index.d.ts +1 -1
  137. package/dist/plugins/index.mjs +27 -31
  138. package/dist/sass/formkit-primevue.scss +101 -99
  139. package/package.json +88 -51
  140. package/dist/vue.d.ts +0 -5
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
- # tsdown-starter
1
+ # Formkit - Primevue
2
2
 
3
- A starter for creating a TypeScript package.
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
- ## Development
5
+ Main focus of this project is to provide configuration based forms with validation.
6
6
 
7
- - Install dependencies:
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
- ```bash
10
- npm install
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
+ [![CI](https://github.com/sfxcode/formkit-primevue/actions/workflows/deploy.yml/badge.svg)](https://github.com/sfxcode/formkit-primevue/actions/workflows/deploy.yml)
18
+
19
+ [![Netlify Status](https://api.netlify.com/api/v1/badges/6142cb73-02e0-4b2a-9ca3-25496f59ba9b/deploy-status)](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
- - Run the unit tests:
29
+ ### Configuration
14
30
 
15
- ```bash
16
- npm run test
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
- - Build the library:
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
- ```bash
22
- npm run build
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
+ ![](formkit-primevue.png)
@@ -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;
@@ -1,14 +1,14 @@
1
- <script setup>
1
+ <script setup lang='ts'>
2
2
  defineProps({
3
3
  data: {
4
4
  type: Object,
5
- default: null
5
+ default: null,
6
6
  },
7
7
  header: {
8
8
  type: String,
9
- default: "Debug"
10
- }
11
- });
9
+ default: 'Debug',
10
+ },
11
+ })
12
12
  </script>
13
13
 
14
14
  <template>
@@ -17,3 +17,7 @@ defineProps({
17
17
  <span v-else>No Data available</span>
18
18
  </Fieldset>
19
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
+ };
@@ -1,86 +1,94 @@
1
- <script setup>
2
- import { reset } from "@formkit/core";
3
- import { FormKit, FormKitMessages, FormKitSchema } from "@formkit/vue";
4
- import { ref } from "vue";
5
- import FormKitDataDebug from "./FormKitDataDebug.vue";
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
+
6
9
  const props = defineProps({
7
10
  id: {
8
11
  type: String,
9
- default: "formkit_form"
12
+ default: 'formkit_form',
10
13
  },
11
14
  data: {
12
15
  type: Object,
13
- default: null
16
+ default: null,
14
17
  },
15
18
  schema: {
16
- type: Object,
17
- default: null
19
+ type: Object as PropType<FormKitSchemaDefinition>,
20
+ default: null,
18
21
  },
19
22
  formClass: {
20
23
  type: String,
21
- default: ""
24
+ default: '',
22
25
  },
23
26
  actionsClass: {
24
27
  type: String,
25
- default: ""
28
+ default: '',
26
29
  },
27
30
  submitSeverity: {
28
31
  type: String,
29
- default: ""
32
+ default: '',
30
33
  },
31
34
  submitClass: {
32
35
  type: String,
33
- default: ""
36
+ default: '',
34
37
  },
35
38
  submitLabel: {
36
39
  type: String,
37
- default: "Save"
40
+ default: 'Save',
38
41
  },
39
42
  submitIcon: {
40
43
  type: String,
41
- default: ""
44
+ default: '',
42
45
  },
43
46
  showReset: {
44
47
  type: Boolean,
45
- default: false
48
+ default: false,
46
49
  },
47
50
  resetSeverity: {
48
51
  type: String,
49
- default: "danger"
52
+ default: 'danger',
50
53
  },
51
54
  resetLabel: {
52
55
  type: String,
53
- default: "Reset"
56
+ default: 'Reset',
54
57
  },
55
58
  resetClass: {
56
59
  type: String,
57
- default: ""
60
+ default: '',
58
61
  },
59
62
  resetIcon: {
60
63
  type: String,
61
- default: ""
64
+ default: '',
62
65
  },
63
66
  debugData: {
64
67
  type: Boolean,
65
- default: false
68
+ default: false,
66
69
  },
67
70
  debugSchema: {
68
71
  type: Boolean,
69
- default: false
70
- }
71
- });
72
- const emit = defineEmits(["dataSaved", "onReset"]);
73
- const formData = defineModel({ type: null });
72
+ default: false,
73
+ },
74
+ })
75
+ const emit = defineEmits(['dataSaved', 'onReset'])
76
+
77
+ const formData = defineModel<any>()
78
+
74
79
  if (props.data) {
75
- formData.value = props.data;
80
+ formData.value = props.data
76
81
  }
77
- const formSchema = ref(props.schema);
82
+
83
+ const formSchema = ref(props.schema)
84
+
78
85
  function handleSave() {
79
- emit("dataSaved", formData.value);
86
+ emit('dataSaved', formData.value)
80
87
  }
88
+
81
89
  function handleReset() {
82
- reset(props.id);
83
- emit("onReset");
90
+ reset(props.id)
91
+ emit('onReset')
84
92
  }
85
93
  </script>
86
94
 
@@ -97,11 +105,7 @@ function handleReset() {
97
105
  <FormKitSchema v-if="formSchema" :schema="formSchema" :data="formData" />
98
106
  <slot />
99
107
  <FormKitDataDebug v-if="debugData" :data="formData" header="Debug Mode - Data" />
100
- <FormKitDataDebug
101
- v-if="debugSchema"
102
- :data="formSchema as object"
103
- header="Debug Mode - Schema"
104
- />
108
+ <FormKitDataDebug v-if="debugSchema" :data="formSchema as object" header="Debug Mode - Schema" />
105
109
  </template>
106
110
  <template #messages>
107
111
  <slot name="messages">
@@ -110,24 +114,13 @@ function handleReset() {
110
114
  </template>
111
115
  <template #submit>
112
116
  <slot name="submit">
113
- <Button
114
- :icon="submitIcon"
115
- type="submit"
116
- :label="submitLabel"
117
- :class="submitClass"
118
- :severity="submitSeverity"
119
- @submit="handleSave"
120
- />
121
- <Button
122
- v-if="showReset"
123
- type="reset"
124
- :icon="resetIcon"
125
- :label="resetLabel"
126
- :class="resetClass"
127
- :severity="resetSeverity"
128
- @click="handleReset"
129
- />
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" />
130
119
  </slot>
131
120
  </template>
132
121
  </FormKit>
133
122
  </template>
123
+
124
+ <style scoped>
125
+
126
+ </style>