@sfxcode/formkit-primevue 3.3.3 → 3.3.5
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/README.md +13 -138
- package/dist/components/FormKitDataDebug.vue +5 -9
- package/dist/components/FormKitDataEdit.vue +53 -46
- package/dist/components/FormKitDataView.vue +20 -27
- package/dist/components/FormKitIcon.vue +6 -13
- package/dist/components/FormKitPrefix.vue +3 -3
- package/dist/components/FormKitSuffix.vue +3 -3
- package/dist/components/PrimeAutoComplete.vue +41 -86
- package/dist/components/PrimeCascadeSelect.vue +7 -26
- package/dist/components/PrimeCheckbox.vue +9 -29
- package/dist/components/PrimeColorPicker.vue +7 -22
- package/dist/components/PrimeDatePicker.vue +17 -73
- package/dist/components/PrimeInputMask.vue +10 -29
- package/dist/components/PrimeInputNumber.vue +21 -56
- package/dist/components/PrimeInputOtp.vue +7 -24
- package/dist/components/PrimeInputText.vue +10 -25
- package/dist/components/PrimeKnob.vue +12 -37
- package/dist/components/PrimeListbox.vue +7 -39
- package/dist/components/PrimeMultiSelect.vue +7 -52
- package/dist/components/PrimeOutputBoolean.vue +28 -27
- package/dist/components/PrimeOutputDate.vue +33 -33
- package/dist/components/PrimeOutputDuration.vue +23 -19
- package/dist/components/PrimeOutputLink.vue +29 -27
- package/dist/components/PrimeOutputList.vue +71 -40
- package/dist/components/PrimeOutputNumber.vue +36 -39
- package/dist/components/PrimeOutputReference.vue +32 -30
- package/dist/components/PrimeOutputText.vue +53 -53
- package/dist/components/PrimePassword.vue +11 -32
- package/dist/components/PrimeRadioButton.vue +19 -29
- package/dist/components/PrimeRating.vue +7 -22
- package/dist/components/PrimeSelect.vue +7 -49
- package/dist/components/PrimeSelectButton.vue +7 -27
- package/dist/components/PrimeSlider.vue +10 -28
- package/dist/components/PrimeTextarea.vue +7 -23
- package/dist/components/PrimeToggleButton.vue +7 -25
- package/dist/components/PrimeToggleSwitch.vue +8 -23
- package/dist/components/PrimeTreeSelect.vue +7 -30
- package/dist/components/index.d.ts +23 -23
- package/dist/composables/index.d.ts +8 -8
- package/dist/composables/index.js +8 -8
- package/dist/composables/index.mjs +8 -8
- package/dist/composables/useFormKitInput.js +5 -1
- package/dist/composables/useFormKitInput.mjs +13 -1
- package/dist/composables/useFormKitRepeater.js +1 -1
- package/dist/composables/useFormKitRepeater.mjs +45 -17
- package/dist/composables/useFormKitSchema.mjs +10 -2
- package/dist/composables/useInputEditor.js +4 -4
- package/dist/composables/useInputEditor.mjs +52 -24
- package/dist/composables/useInputEditorSchema.js +3 -3
- package/dist/composables/useInputEditorSchema.mjs +25 -17
- package/dist/composables/useOutputDuration.mjs +3 -6
- package/dist/definitions/index.js +2 -2
- package/dist/definitions/index.mjs +2 -2
- package/dist/definitions/input.d.ts +1 -1
- package/dist/definitions/input.mjs +301 -15
- package/dist/definitions/output.d.ts +1 -1
- package/dist/definitions/output.js +1 -1
- package/dist/definitions/output.mjs +95 -14
- package/dist/index.d.ts +48 -48
- package/dist/index.js +12 -12
- package/dist/index.mjs +9 -3
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.mjs +31 -27
- package/dist/sass/formkit-primevue.scss +99 -101
- package/dist/vue.d.ts +5 -0
- package/package.json +45 -80
- package/LICENSE +0 -21
- package/components.d.ts +0 -1
- package/dist/components/FormKitDataDebug.d.vue.ts +0 -24
- package/dist/components/FormKitDataDebug.vue.d.ts +0 -24
- package/dist/components/FormKitDataEdit.d.vue.ts +0 -180
- package/dist/components/FormKitDataEdit.vue.d.ts +0 -180
- package/dist/components/FormKitDataView.d.vue.ts +0 -73
- package/dist/components/FormKitDataView.vue.d.ts +0 -73
- package/dist/components/FormKitIcon.d.vue.ts +0 -39
- package/dist/components/FormKitIcon.vue.d.ts +0 -39
- package/dist/components/FormKitPrefix.d.vue.ts +0 -7
- package/dist/components/FormKitPrefix.vue.d.ts +0 -7
- package/dist/components/FormKitSuffix.d.vue.ts +0 -7
- package/dist/components/FormKitSuffix.vue.d.ts +0 -7
- package/dist/components/PrimeAutoComplete.d.vue.ts +0 -31
- package/dist/components/PrimeAutoComplete.vue.d.ts +0 -31
- package/dist/components/PrimeCascadeSelect.d.vue.ts +0 -28
- package/dist/components/PrimeCascadeSelect.vue.d.ts +0 -28
- package/dist/components/PrimeCheckbox.d.vue.ts +0 -27
- package/dist/components/PrimeCheckbox.vue.d.ts +0 -27
- package/dist/components/PrimeColorPicker.d.vue.ts +0 -24
- package/dist/components/PrimeColorPicker.vue.d.ts +0 -24
- package/dist/components/PrimeDatePicker.d.vue.ts +0 -63
- package/dist/components/PrimeDatePicker.vue.d.ts +0 -63
- package/dist/components/PrimeInputMask.d.vue.ts +0 -28
- package/dist/components/PrimeInputMask.vue.d.ts +0 -28
- package/dist/components/PrimeInputNumber.d.vue.ts +0 -36
- package/dist/components/PrimeInputNumber.vue.d.ts +0 -36
- package/dist/components/PrimeInputOtp.d.vue.ts +0 -26
- package/dist/components/PrimeInputOtp.vue.d.ts +0 -26
- package/dist/components/PrimeInputText.d.vue.ts +0 -24
- package/dist/components/PrimeInputText.vue.d.ts +0 -24
- package/dist/components/PrimeKnob.d.vue.ts +0 -31
- package/dist/components/PrimeKnob.vue.d.ts +0 -31
- package/dist/components/PrimeListbox.d.vue.ts +0 -42
- package/dist/components/PrimeListbox.vue.d.ts +0 -42
- package/dist/components/PrimeMultiSelect.d.vue.ts +0 -53
- package/dist/components/PrimeMultiSelect.vue.d.ts +0 -53
- package/dist/components/PrimeOutputBoolean.d.vue.ts +0 -16
- package/dist/components/PrimeOutputBoolean.vue.d.ts +0 -16
- package/dist/components/PrimeOutputDate.d.vue.ts +0 -16
- package/dist/components/PrimeOutputDate.vue.d.ts +0 -16
- package/dist/components/PrimeOutputDuration.d.vue.ts +0 -16
- package/dist/components/PrimeOutputDuration.vue.d.ts +0 -16
- package/dist/components/PrimeOutputLink.d.vue.ts +0 -16
- package/dist/components/PrimeOutputLink.vue.d.ts +0 -16
- package/dist/components/PrimeOutputList.d.vue.ts +0 -19
- package/dist/components/PrimeOutputList.vue.d.ts +0 -19
- package/dist/components/PrimeOutputNumber.d.vue.ts +0 -16
- package/dist/components/PrimeOutputNumber.vue.d.ts +0 -16
- package/dist/components/PrimeOutputReference.d.vue.ts +0 -16
- package/dist/components/PrimeOutputReference.vue.d.ts +0 -16
- package/dist/components/PrimeOutputText.d.vue.ts +0 -22
- package/dist/components/PrimeOutputText.vue.d.ts +0 -22
- package/dist/components/PrimePassword.d.vue.ts +0 -33
- package/dist/components/PrimePassword.vue.d.ts +0 -33
- package/dist/components/PrimeRadioButton.d.vue.ts +0 -28
- package/dist/components/PrimeRadioButton.vue.d.ts +0 -28
- package/dist/components/PrimeRating.d.vue.ts +0 -24
- package/dist/components/PrimeRating.vue.d.ts +0 -24
- package/dist/components/PrimeSelect.d.vue.ts +0 -50
- package/dist/components/PrimeSelect.vue.d.ts +0 -50
- package/dist/components/PrimeSelectButton.d.vue.ts +0 -28
- package/dist/components/PrimeSelectButton.vue.d.ts +0 -28
- package/dist/components/PrimeSlider.d.vue.ts +0 -26
- package/dist/components/PrimeSlider.vue.d.ts +0 -26
- package/dist/components/PrimeTextarea.d.vue.ts +0 -25
- package/dist/components/PrimeTextarea.vue.d.ts +0 -25
- package/dist/components/PrimeToggleButton.d.vue.ts +0 -26
- package/dist/components/PrimeToggleButton.vue.d.ts +0 -26
- package/dist/components/PrimeToggleSwitch.d.vue.ts +0 -23
- package/dist/components/PrimeToggleSwitch.vue.d.ts +0 -23
- package/dist/components/PrimeTreeSelect.d.vue.ts +0 -32
- package/dist/components/PrimeTreeSelect.vue.d.ts +0 -32
package/README.md
CHANGED
|
@@ -1,148 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# tsdown-starter
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A starter for creating a TypeScript package.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Development
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Install dependencies:
|
|
8
8
|
|
|
9
|
-
|
|
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
|
|
28
|
-
|
|
29
|
-
### Configuration
|
|
30
|
-
|
|
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
|
-
}))
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
43
11
|
```
|
|
44
12
|
|
|
45
|
-
|
|
13
|
+
- Run the unit tests:
|
|
46
14
|
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
import { primeInputs, primeOutputs } from '@sfxcode/formkit-primevue'
|
|
50
|
-
|
|
51
|
-
app.use(plugin, defaultConfig({
|
|
52
|
-
locales: { de, en },
|
|
53
|
-
// Define the active locale
|
|
54
|
-
locale: 'en',
|
|
55
|
-
inputs: { ...primeInputs, ...primeOutputs },
|
|
56
|
-
}))
|
|
15
|
+
```bash
|
|
16
|
+
npm run test
|
|
57
17
|
```
|
|
58
18
|
|
|
59
|
-
|
|
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.
|
|
19
|
+
- Build the library:
|
|
80
20
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-

|
|
21
|
+
```bash
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script setup
|
|
1
|
+
<script setup>
|
|
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:
|
|
10
|
-
}
|
|
11
|
-
})
|
|
9
|
+
default: "Debug"
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<template>
|
|
@@ -17,7 +17,3 @@ defineProps({
|
|
|
17
17
|
<span v-else>No Data available</span>
|
|
18
18
|
</Fieldset>
|
|
19
19
|
</template>
|
|
20
|
-
|
|
21
|
-
<style scoped>
|
|
22
|
-
|
|
23
|
-
</style>
|
|
@@ -1,94 +1,86 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { ref } from 'vue'
|
|
7
|
-
import FormKitDataDebug from './FormKitDataDebug.vue'
|
|
8
|
-
|
|
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";
|
|
9
6
|
const props = defineProps({
|
|
10
7
|
id: {
|
|
11
8
|
type: String,
|
|
12
|
-
default:
|
|
9
|
+
default: "formkit_form"
|
|
13
10
|
},
|
|
14
11
|
data: {
|
|
15
12
|
type: Object,
|
|
16
|
-
default: null
|
|
13
|
+
default: null
|
|
17
14
|
},
|
|
18
15
|
schema: {
|
|
19
|
-
type: Object
|
|
20
|
-
default: null
|
|
16
|
+
type: Object,
|
|
17
|
+
default: null
|
|
21
18
|
},
|
|
22
19
|
formClass: {
|
|
23
20
|
type: String,
|
|
24
|
-
default:
|
|
21
|
+
default: ""
|
|
25
22
|
},
|
|
26
23
|
actionsClass: {
|
|
27
24
|
type: String,
|
|
28
|
-
default:
|
|
25
|
+
default: ""
|
|
29
26
|
},
|
|
30
27
|
submitSeverity: {
|
|
31
28
|
type: String,
|
|
32
|
-
default:
|
|
29
|
+
default: ""
|
|
33
30
|
},
|
|
34
31
|
submitClass: {
|
|
35
32
|
type: String,
|
|
36
|
-
default:
|
|
33
|
+
default: ""
|
|
37
34
|
},
|
|
38
35
|
submitLabel: {
|
|
39
36
|
type: String,
|
|
40
|
-
default:
|
|
37
|
+
default: "Save"
|
|
41
38
|
},
|
|
42
39
|
submitIcon: {
|
|
43
40
|
type: String,
|
|
44
|
-
default:
|
|
41
|
+
default: ""
|
|
45
42
|
},
|
|
46
43
|
showReset: {
|
|
47
44
|
type: Boolean,
|
|
48
|
-
default: false
|
|
45
|
+
default: false
|
|
49
46
|
},
|
|
50
47
|
resetSeverity: {
|
|
51
48
|
type: String,
|
|
52
|
-
default:
|
|
49
|
+
default: "danger"
|
|
53
50
|
},
|
|
54
51
|
resetLabel: {
|
|
55
52
|
type: String,
|
|
56
|
-
default:
|
|
53
|
+
default: "Reset"
|
|
57
54
|
},
|
|
58
55
|
resetClass: {
|
|
59
56
|
type: String,
|
|
60
|
-
default:
|
|
57
|
+
default: ""
|
|
61
58
|
},
|
|
62
59
|
resetIcon: {
|
|
63
60
|
type: String,
|
|
64
|
-
default:
|
|
61
|
+
default: ""
|
|
65
62
|
},
|
|
66
63
|
debugData: {
|
|
67
64
|
type: Boolean,
|
|
68
|
-
default: false
|
|
65
|
+
default: false
|
|
69
66
|
},
|
|
70
67
|
debugSchema: {
|
|
71
68
|
type: Boolean,
|
|
72
|
-
default: false
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
const emit = defineEmits([
|
|
76
|
-
|
|
77
|
-
const formData = defineModel<any>()
|
|
78
|
-
|
|
69
|
+
default: false
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const emit = defineEmits(["dataSaved", "onReset"]);
|
|
73
|
+
const formData = defineModel({ type: null });
|
|
79
74
|
if (props.data) {
|
|
80
|
-
formData.value = props.data
|
|
75
|
+
formData.value = props.data;
|
|
81
76
|
}
|
|
82
|
-
|
|
83
|
-
const formSchema = ref(props.schema)
|
|
84
|
-
|
|
77
|
+
const formSchema = ref(props.schema);
|
|
85
78
|
function handleSave() {
|
|
86
|
-
emit(
|
|
79
|
+
emit("dataSaved", formData.value);
|
|
87
80
|
}
|
|
88
|
-
|
|
89
81
|
function handleReset() {
|
|
90
|
-
reset(props.id)
|
|
91
|
-
emit(
|
|
82
|
+
reset(props.id);
|
|
83
|
+
emit("onReset");
|
|
92
84
|
}
|
|
93
85
|
</script>
|
|
94
86
|
|
|
@@ -105,7 +97,11 @@ function handleReset() {
|
|
|
105
97
|
<FormKitSchema v-if="formSchema" :schema="formSchema" :data="formData" />
|
|
106
98
|
<slot />
|
|
107
99
|
<FormKitDataDebug v-if="debugData" :data="formData" header="Debug Mode - Data" />
|
|
108
|
-
<FormKitDataDebug
|
|
100
|
+
<FormKitDataDebug
|
|
101
|
+
v-if="debugSchema"
|
|
102
|
+
:data="formSchema as object"
|
|
103
|
+
header="Debug Mode - Schema"
|
|
104
|
+
/>
|
|
109
105
|
</template>
|
|
110
106
|
<template #messages>
|
|
111
107
|
<slot name="messages">
|
|
@@ -114,13 +110,24 @@ function handleReset() {
|
|
|
114
110
|
</template>
|
|
115
111
|
<template #submit>
|
|
116
112
|
<slot name="submit">
|
|
117
|
-
<Button
|
|
118
|
-
|
|
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
|
+
/>
|
|
119
130
|
</slot>
|
|
120
131
|
</template>
|
|
121
132
|
</FormKit>
|
|
122
133
|
</template>
|
|
123
|
-
|
|
124
|
-
<style scoped>
|
|
125
|
-
|
|
126
|
-
</style>
|
|
@@ -1,40 +1,33 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { FormKit, FormKitSchema } from '@formkit/vue'
|
|
6
|
-
import { ref } from 'vue'
|
|
7
|
-
import FormKitDataDebug from './FormKitDataDebug.vue'
|
|
8
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { FormKit, FormKitSchema } from "@formkit/vue";
|
|
3
|
+
import { ref } from "vue";
|
|
4
|
+
import FormKitDataDebug from "./FormKitDataDebug.vue";
|
|
9
5
|
const props = defineProps({
|
|
10
6
|
data: {
|
|
11
7
|
type: Object,
|
|
12
|
-
default: null
|
|
8
|
+
default: null
|
|
13
9
|
},
|
|
14
10
|
schema: {
|
|
15
|
-
type: Object
|
|
16
|
-
default: null
|
|
11
|
+
type: Object,
|
|
12
|
+
default: null
|
|
17
13
|
},
|
|
18
14
|
formClass: {
|
|
19
15
|
type: String,
|
|
20
|
-
default:
|
|
16
|
+
default: ""
|
|
21
17
|
},
|
|
22
18
|
debugData: {
|
|
23
19
|
type: Boolean,
|
|
24
|
-
default: false
|
|
20
|
+
default: false
|
|
25
21
|
},
|
|
26
22
|
debugSchema: {
|
|
27
23
|
type: Boolean,
|
|
28
|
-
default: false
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const formData = defineModel<any>()
|
|
35
|
-
|
|
24
|
+
default: false
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const formSchema = ref(props.schema);
|
|
28
|
+
const formData = defineModel({ type: null });
|
|
36
29
|
if (props.data) {
|
|
37
|
-
formData.value = props.data
|
|
30
|
+
formData.value = props.data;
|
|
38
31
|
}
|
|
39
32
|
</script>
|
|
40
33
|
|
|
@@ -49,10 +42,10 @@ if (props.data) {
|
|
|
49
42
|
<FormKitSchema v-if="schema" :schema="formSchema" :data="formData" />
|
|
50
43
|
<slot />
|
|
51
44
|
<FormKitDataDebug v-if="debugData" :data="formData" header="Debug Mode - Data" />
|
|
52
|
-
<FormKitDataDebug
|
|
45
|
+
<FormKitDataDebug
|
|
46
|
+
v-if="debugSchema"
|
|
47
|
+
:data="formSchema as object"
|
|
48
|
+
header="Debug Mode - Schema"
|
|
49
|
+
/>
|
|
53
50
|
</FormKit>
|
|
54
51
|
</template>
|
|
55
|
-
|
|
56
|
-
<style scoped>
|
|
57
|
-
|
|
58
|
-
</style>
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import type { PropType } from 'vue'
|
|
3
|
-
|
|
4
|
-
export interface FormKitIconProps {
|
|
5
|
-
onIconPrefixClicked?: () => void
|
|
6
|
-
onIconSuffixClicked?: () => void
|
|
7
|
-
}
|
|
8
|
-
|
|
1
|
+
<script setup>
|
|
9
2
|
defineProps({
|
|
10
3
|
iconClass: {
|
|
11
4
|
type: String,
|
|
12
|
-
default:
|
|
5
|
+
default: ""
|
|
13
6
|
},
|
|
14
|
-
onClick: { type: Function
|
|
7
|
+
onClick: { type: Function, default: void 0 },
|
|
15
8
|
position: {
|
|
16
9
|
type: String,
|
|
17
10
|
required: true,
|
|
18
|
-
validator: (val
|
|
19
|
-
}
|
|
20
|
-
})
|
|
11
|
+
validator: (val) => ["prefix", "suffix"].includes(val)
|
|
12
|
+
}
|
|
13
|
+
});
|
|
21
14
|
</script>
|
|
22
15
|
|
|
23
16
|
<template>
|
|
@@ -1,101 +1,56 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type { PropType } from 'vue'
|
|
5
|
-
import { ref } from 'vue'
|
|
6
|
-
import { useFormKitInput } from '../composables'
|
|
7
|
-
|
|
8
|
-
export interface FormKitPrimeAutoCompleteProps {
|
|
9
|
-
pt?: AutoCompleteProps['pt']
|
|
10
|
-
ptOptions?: AutoCompleteProps['ptOptions']
|
|
11
|
-
unstyled?: AutoCompleteProps['unstyled']
|
|
12
|
-
dropdown?: AutoCompleteProps['dropdown']
|
|
13
|
-
multiple?: AutoCompleteProps['multiple']
|
|
14
|
-
typeahead?: AutoCompleteProps['typeahead']
|
|
15
|
-
optionLabel?: AutoCompleteProps['optionLabel']
|
|
16
|
-
options?: any[] | undefined
|
|
17
|
-
size?: AutoCompleteProps['size']
|
|
18
|
-
minLength?: AutoCompleteProps['minLength']
|
|
19
|
-
placeholder?: AutoCompleteProps['placeholder']
|
|
20
|
-
fluid?: AutoCompleteProps['fluid']
|
|
21
|
-
separators?: string[] | []
|
|
22
|
-
}
|
|
23
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { useFormKitInput } from "../composables/index.ts";
|
|
24
4
|
const props = defineProps({
|
|
25
5
|
context: {
|
|
26
|
-
type: Object
|
|
27
|
-
required: true
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const loading = ref(false)
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Searches for suggestions based on the input query.
|
|
39
|
-
*/
|
|
40
|
-
async function search(event: AutoCompleteCompleteEvent) {
|
|
6
|
+
type: Object,
|
|
7
|
+
required: true
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur, modelValue } = useFormKitInput(props.context);
|
|
11
|
+
const suggestions = ref(["", {}]);
|
|
12
|
+
suggestions.value = [];
|
|
13
|
+
const loading = ref(false);
|
|
14
|
+
async function search(event) {
|
|
41
15
|
if (props.context?.options && props.context?.optionLabel) {
|
|
42
16
|
suggestions.value = props.context.options.filter((option) => {
|
|
43
|
-
return option[`${props.context.optionLabel}`].toString().toLowerCase().includes(event.query.toLowerCase())
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
loading.value = true
|
|
17
|
+
return option[`${props.context.optionLabel}`].toString().toLowerCase().includes(event.query.toLowerCase());
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
loading.value = true;
|
|
48
21
|
try {
|
|
49
|
-
suggestions.value = await props.context?.attrs.complete(event.query)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
finally {
|
|
56
|
-
loading.value = false
|
|
22
|
+
suggestions.value = await props.context?.attrs.complete(event.query);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error("Error fetching suggestions:", error);
|
|
25
|
+
suggestions.value = [];
|
|
26
|
+
} finally {
|
|
27
|
+
loading.value = false;
|
|
57
28
|
}
|
|
58
29
|
}
|
|
59
30
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return
|
|
70
|
-
const pastedText = clipboardData.getData('text')
|
|
71
|
-
const separators = Array.isArray(props.context?.separators) && props.context.separators.length > 0
|
|
72
|
-
? props.context.separators
|
|
73
|
-
: [',']
|
|
74
|
-
const regex = new RegExp(`[${separators.map(s => s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')).join('')}]`)
|
|
75
|
-
// If separators are provided, split the pasted text by them
|
|
31
|
+
function handlePaste(event) {
|
|
32
|
+
if (!props.context?.multiple) return;
|
|
33
|
+
const clipboardData = event.clipboardData;
|
|
34
|
+
if (!clipboardData) return;
|
|
35
|
+
const pastedText = clipboardData.getData("text");
|
|
36
|
+
const separators = Array.isArray(props.context?.separators) && props.context.separators.length > 0 ? props.context.separators : [","];
|
|
37
|
+
const regex = new RegExp(
|
|
38
|
+
`[${separators.map((s) => s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("")}]`
|
|
39
|
+
);
|
|
76
40
|
if (pastedText && regex.test(pastedText)) {
|
|
77
|
-
event.preventDefault()
|
|
78
|
-
const items = pastedText
|
|
79
|
-
.split(regex)
|
|
80
|
-
.map(item => item.trim())
|
|
81
|
-
.filter(item => item.length > 0)
|
|
82
|
-
// Use a local ref, never mutate context._value directly
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
const items = pastedText.split(regex).map((item) => item.trim()).filter((item) => item.length > 0);
|
|
83
43
|
if (Array.isArray(modelValue.value)) {
|
|
84
|
-
modelValue.value = [...modelValue.value, ...items]
|
|
44
|
+
modelValue.value = [...modelValue.value, ...items];
|
|
45
|
+
} else {
|
|
46
|
+
modelValue.value = items;
|
|
85
47
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// If no separators, just set the value directly
|
|
91
|
-
else if (pastedText) {
|
|
92
|
-
event.preventDefault()
|
|
93
|
-
// If no separators, just set the value directly
|
|
48
|
+
} else if (pastedText) {
|
|
49
|
+
event.preventDefault();
|
|
94
50
|
if (Array.isArray(modelValue.value)) {
|
|
95
|
-
modelValue.value = [...modelValue.value, pastedText.trim()]
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
modelValue.value = [pastedText.trim()]
|
|
51
|
+
modelValue.value = [...modelValue.value, pastedText.trim()];
|
|
52
|
+
} else {
|
|
53
|
+
modelValue.value = [pastedText.trim()];
|
|
99
54
|
}
|
|
100
55
|
}
|
|
101
56
|
}
|
|
@@ -1,31 +1,12 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import type { CascadeSelectProps } from 'primevue/cascadeselect'
|
|
4
|
-
|
|
5
|
-
import type { PropType } from 'vue'
|
|
6
|
-
import { useFormKitInput } from '../composables'
|
|
7
|
-
|
|
8
|
-
export interface FormKitPrimeCascadeSelectProps {
|
|
9
|
-
options?: CascadeSelectProps['options']
|
|
10
|
-
optionLabel?: CascadeSelectProps['optionLabel']
|
|
11
|
-
optionValue?: CascadeSelectProps['optionValue']
|
|
12
|
-
optionGroupLabel?: CascadeSelectProps['optionGroupLabel']
|
|
13
|
-
optionGroupChildren?: CascadeSelectProps['optionGroupChildren']
|
|
14
|
-
placeholder?: CascadeSelectProps['placeholder']
|
|
15
|
-
pt?: CascadeSelectProps['pt']
|
|
16
|
-
ptOptions?: CascadeSelectProps['ptOptions']
|
|
17
|
-
unstyled?: CascadeSelectProps['unstyled']
|
|
18
|
-
size?: CascadeSelectProps['size']
|
|
19
|
-
}
|
|
20
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useFormKitInput } from "../composables/index.ts";
|
|
21
3
|
const props = defineProps({
|
|
22
4
|
context: {
|
|
23
|
-
type: Object
|
|
24
|
-
required: true
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur, modelValue } = useFormKitInput(props.context)
|
|
5
|
+
type: Object,
|
|
6
|
+
required: true
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur, modelValue } = useFormKitInput(props.context);
|
|
29
10
|
</script>
|
|
30
11
|
|
|
31
12
|
<template>
|