@sfxcode/formkit-primevue 3.2.4 → 3.2.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.
- package/dist/components/FormKitDataEdit.vue +57 -72
- package/dist/components/FormKitDataView.vue +27 -35
- package/dist/components/FormKitDebug.vue +7 -12
- 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 +47 -98
- 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 +15 -73
- package/dist/components/PrimeInputMask.vue +10 -29
- package/dist/components/PrimeInputNumber.vue +22 -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 +16 -23
- package/dist/components/PrimeOutputDate.vue +21 -31
- package/dist/components/PrimeOutputDuration.vue +11 -17
- package/dist/components/PrimeOutputLink.vue +17 -24
- package/dist/components/PrimeOutputList.vue +18 -29
- package/dist/components/PrimeOutputNumber.vue +24 -37
- package/dist/components/PrimeOutputReference.vue +21 -28
- package/dist/components/PrimeOutputText.vue +22 -37
- package/dist/components/PrimePassword.vue +7 -31
- package/dist/components/PrimeRadioButton.vue +7 -23
- 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/sass/formkit-primevue.scss +0 -5
- package/dist/style.css +1 -1
- package/package.json +11 -11
- 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/FormKitDebug.d.vue.ts +0 -34
- package/dist/components/FormKitDebug.vue.d.ts +0 -34
- 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 -21
- package/dist/components/PrimeOutputText.vue.d.ts +0 -21
- 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
|
@@ -1,129 +1,114 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { ref } from 'vue'
|
|
7
|
-
|
|
8
|
-
import FormKitDebug from './FormKitDebug.vue'
|
|
9
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reset } from "@formkit/core";
|
|
3
|
+
import { FormKit, FormKitMessages, FormKitSchema } from "@formkit/vue";
|
|
4
|
+
import { ref } from "vue";
|
|
5
|
+
import FormKitDebug from "./FormKitDebug.vue";
|
|
10
6
|
const props = defineProps({
|
|
11
7
|
id: {
|
|
12
8
|
type: String,
|
|
13
|
-
default:
|
|
9
|
+
default: "formkit_form"
|
|
14
10
|
},
|
|
15
11
|
data: {
|
|
16
12
|
type: Object,
|
|
17
|
-
default: null
|
|
13
|
+
default: null
|
|
18
14
|
},
|
|
19
15
|
schema: {
|
|
20
|
-
type: Object
|
|
21
|
-
default: null
|
|
16
|
+
type: Object,
|
|
17
|
+
default: null
|
|
22
18
|
},
|
|
23
19
|
formClass: {
|
|
24
20
|
type: String,
|
|
25
|
-
default:
|
|
21
|
+
default: ""
|
|
26
22
|
},
|
|
27
23
|
actionsClass: {
|
|
28
24
|
type: String,
|
|
29
|
-
default:
|
|
25
|
+
default: ""
|
|
30
26
|
},
|
|
31
27
|
submitSeverity: {
|
|
32
28
|
type: String,
|
|
33
|
-
default:
|
|
29
|
+
default: ""
|
|
34
30
|
},
|
|
35
31
|
submitClass: {
|
|
36
32
|
type: String,
|
|
37
|
-
default:
|
|
33
|
+
default: ""
|
|
38
34
|
},
|
|
39
35
|
submitLabel: {
|
|
40
36
|
type: String,
|
|
41
|
-
default:
|
|
37
|
+
default: "Save"
|
|
42
38
|
},
|
|
43
39
|
submitIcon: {
|
|
44
40
|
type: String,
|
|
45
|
-
default:
|
|
41
|
+
default: ""
|
|
46
42
|
},
|
|
47
43
|
showReset: {
|
|
48
44
|
type: Boolean,
|
|
49
|
-
default: false
|
|
45
|
+
default: false
|
|
50
46
|
},
|
|
51
47
|
resetSeverity: {
|
|
52
48
|
type: String,
|
|
53
|
-
default:
|
|
49
|
+
default: "danger"
|
|
54
50
|
},
|
|
55
51
|
resetLabel: {
|
|
56
52
|
type: String,
|
|
57
|
-
default:
|
|
53
|
+
default: "Reset"
|
|
58
54
|
},
|
|
59
55
|
resetClass: {
|
|
60
56
|
type: String,
|
|
61
|
-
default:
|
|
57
|
+
default: ""
|
|
62
58
|
},
|
|
63
59
|
resetIcon: {
|
|
64
60
|
type: String,
|
|
65
|
-
default:
|
|
61
|
+
default: ""
|
|
66
62
|
},
|
|
67
63
|
debugData: {
|
|
68
64
|
type: Boolean,
|
|
69
|
-
default: false
|
|
65
|
+
default: false
|
|
70
66
|
},
|
|
71
67
|
debugSchema: {
|
|
72
68
|
type: Boolean,
|
|
73
|
-
default: false
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
const emit = defineEmits([
|
|
77
|
-
|
|
78
|
-
const formData = defineModel<any>()
|
|
79
|
-
|
|
69
|
+
default: false
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const emit = defineEmits(["dataSaved", "onReset"]);
|
|
73
|
+
const formData = defineModel({ type: null });
|
|
80
74
|
if (props.data) {
|
|
81
|
-
formData.value = props.data
|
|
75
|
+
formData.value = props.data;
|
|
82
76
|
}
|
|
83
|
-
|
|
84
|
-
const formSchema = ref(props.schema)
|
|
85
|
-
|
|
77
|
+
const formSchema = ref(props.schema);
|
|
86
78
|
function handleSave() {
|
|
87
|
-
emit(
|
|
79
|
+
emit("dataSaved", formData.value);
|
|
88
80
|
}
|
|
89
|
-
|
|
90
81
|
function handleReset() {
|
|
91
|
-
reset(props.id)
|
|
92
|
-
emit(
|
|
82
|
+
reset(props.id);
|
|
83
|
+
emit("onReset");
|
|
93
84
|
}
|
|
94
85
|
</script>
|
|
95
86
|
|
|
96
87
|
<template>
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
>
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
</
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</
|
|
121
|
-
</
|
|
122
|
-
|
|
123
|
-
<FormKitDebug v-if="debugSchema" :data="formSchema as object" header="Schema" />
|
|
124
|
-
</div>
|
|
88
|
+
<FormKit
|
|
89
|
+
:id="id"
|
|
90
|
+
v-model="formData"
|
|
91
|
+
:actions-class="actionsClass"
|
|
92
|
+
:form-class="`p-formkit-data-edit ${formClass}`"
|
|
93
|
+
type="form"
|
|
94
|
+
@submit="handleSave"
|
|
95
|
+
>
|
|
96
|
+
<template #default>
|
|
97
|
+
<FormKitSchema v-if="formSchema" :schema="formSchema" :data="formData" />
|
|
98
|
+
<slot />
|
|
99
|
+
<FormKitDebug v-if="debugData" :data="formData" header="Debug Mode - Data" />
|
|
100
|
+
<FormKitDebug v-if="debugSchema" :data="formSchema as object" header="Debug Mode - Schema" />
|
|
101
|
+
</template>
|
|
102
|
+
<template #messages>
|
|
103
|
+
<slot name="messages">
|
|
104
|
+
<FormKitMessages class="p-formkit-data-edit-messages" />
|
|
105
|
+
</slot>
|
|
106
|
+
</template>
|
|
107
|
+
<template #submit>
|
|
108
|
+
<slot name="submit">
|
|
109
|
+
<Button :icon="submitIcon" type="submit" :label="submitLabel" :class="submitClass" :severity="submitSeverity" @submit="handleSave" />
|
|
110
|
+
<Button v-if="showReset" type="reset" :icon="resetIcon" :label="resetLabel" :class="resetClass" :severity="resetSeverity" @click="handleReset" />
|
|
111
|
+
</slot>
|
|
112
|
+
</template>
|
|
113
|
+
</FormKit>
|
|
125
114
|
</template>
|
|
126
|
-
|
|
127
|
-
<style scoped>
|
|
128
|
-
|
|
129
|
-
</style>
|
|
@@ -1,55 +1,47 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import FormKitDebug from './FormKitDebug.vue'
|
|
6
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { FormKit, FormKitSchema } from "@formkit/vue";
|
|
3
|
+
import { ref } from "vue";
|
|
4
|
+
import FormKitDebug from "./FormKitDebug.vue";
|
|
7
5
|
const props = defineProps({
|
|
8
6
|
data: {
|
|
9
7
|
type: Object,
|
|
10
|
-
default: null
|
|
8
|
+
default: null
|
|
11
9
|
},
|
|
12
10
|
schema: {
|
|
13
|
-
type: Object
|
|
14
|
-
default: null
|
|
11
|
+
type: Object,
|
|
12
|
+
default: null
|
|
15
13
|
},
|
|
16
14
|
formClass: {
|
|
17
15
|
type: String,
|
|
18
|
-
default:
|
|
16
|
+
default: ""
|
|
19
17
|
},
|
|
20
18
|
debugData: {
|
|
21
19
|
type: Boolean,
|
|
22
|
-
default: false
|
|
20
|
+
default: false
|
|
23
21
|
},
|
|
24
22
|
debugSchema: {
|
|
25
23
|
type: Boolean,
|
|
26
|
-
default: false
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const formData = defineModel
|
|
31
|
-
|
|
24
|
+
default: false
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const formSchema = ref(props.schema);
|
|
28
|
+
const formData = defineModel({ type: null });
|
|
32
29
|
if (props.data) {
|
|
33
|
-
formData.value = props.data
|
|
30
|
+
formData.value = props.data;
|
|
34
31
|
}
|
|
35
32
|
</script>
|
|
36
33
|
|
|
37
34
|
<template>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<FormKitDebug v-if="
|
|
49
|
-
|
|
50
|
-
</div>
|
|
35
|
+
<FormKit
|
|
36
|
+
v-model="formData"
|
|
37
|
+
:actions="false"
|
|
38
|
+
:form-class="`p-formkit-data-view ${formClass}`"
|
|
39
|
+
class="p-formkit-data-view"
|
|
40
|
+
type="form"
|
|
41
|
+
>
|
|
42
|
+
<FormKitSchema v-if="schema" :schema="formSchema" :data="formData" />
|
|
43
|
+
<slot />
|
|
44
|
+
<FormKitDebug v-if="debugData" :data="formData" header="Debug Mode - Data" />
|
|
45
|
+
<FormKitDebug v-if="debugSchema" :data="formSchema as object" header="Debug Mode - Schema" />
|
|
46
|
+
</FormKit>
|
|
51
47
|
</template>
|
|
52
|
-
|
|
53
|
-
<style scoped>
|
|
54
|
-
|
|
55
|
-
</style>
|
|
@@ -1,25 +1,20 @@
|
|
|
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>
|
|
15
|
-
<
|
|
16
|
-
<h3>{{ header }}</h3>
|
|
15
|
+
<Fieldset class="p-formkit-data-debug" :legend="header" :toggleable="true" :collapsed="true">
|
|
17
16
|
<slot />
|
|
18
17
|
<pre v-if="data">{{ data }}</pre>
|
|
19
18
|
<span v-else>No Data available</span>
|
|
20
|
-
</
|
|
19
|
+
</Fieldset>
|
|
21
20
|
</template>
|
|
22
|
-
|
|
23
|
-
<style scoped>
|
|
24
|
-
|
|
25
|
-
</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,123 +1,72 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type { PropType } from 'vue'
|
|
5
|
-
import { ref, watch } 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, watch } from "vue";
|
|
3
|
+
import { useFormKitInput } from "../composables";
|
|
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
|
-
// Local value for v-model
|
|
38
|
-
const localValue = ref(props.context._value)
|
|
39
|
-
|
|
40
|
-
// Sync localValue with context._value
|
|
6
|
+
type: Object,
|
|
7
|
+
required: true
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur } = useFormKitInput(props.context);
|
|
11
|
+
const suggestions = ref(["", {}]);
|
|
12
|
+
suggestions.value = [];
|
|
13
|
+
const loading = ref(false);
|
|
14
|
+
const localValue = ref(props.context._value);
|
|
41
15
|
watch(
|
|
42
16
|
() => props.context._value,
|
|
43
17
|
(newVal) => {
|
|
44
|
-
localValue.value = newVal
|
|
45
|
-
}
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
// Emit changes from localValue to context
|
|
18
|
+
localValue.value = newVal;
|
|
19
|
+
}
|
|
20
|
+
);
|
|
49
21
|
watch(
|
|
50
22
|
localValue,
|
|
51
23
|
(newVal) => {
|
|
52
24
|
if (newVal !== props.context._value) {
|
|
53
|
-
props.context._value = newVal
|
|
54
|
-
props.context?.node?.input?.(newVal)
|
|
25
|
+
props.context._value = newVal;
|
|
26
|
+
props.context?.node?.input?.(newVal);
|
|
55
27
|
}
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Searches for suggestions based on the input query.
|
|
61
|
-
*/
|
|
62
|
-
async function search(event: AutoCompleteCompleteEvent) {
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
async function search(event) {
|
|
63
31
|
if (props.context?.options && props.context?.optionLabel) {
|
|
64
32
|
suggestions.value = props.context.options.filter((option) => {
|
|
65
|
-
return option[`${props.context.optionLabel}`].toString().toLowerCase().includes(event.query.toLowerCase())
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
loading.value = true
|
|
33
|
+
return option[`${props.context.optionLabel}`].toString().toLowerCase().includes(event.query.toLowerCase());
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
loading.value = true;
|
|
70
37
|
try {
|
|
71
|
-
suggestions.value = await props.context?.attrs.complete(event.query)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
finally {
|
|
78
|
-
loading.value = false
|
|
38
|
+
suggestions.value = await props.context?.attrs.complete(event.query);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error("Error fetching suggestions:", error);
|
|
41
|
+
suggestions.value = [];
|
|
42
|
+
} finally {
|
|
43
|
+
loading.value = false;
|
|
79
44
|
}
|
|
80
45
|
}
|
|
81
46
|
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Handles paste event to transform a string separated by any of the provided separators into multiple items.
|
|
85
|
-
*/
|
|
86
|
-
function handlePaste(event: ClipboardEvent) {
|
|
47
|
+
function handlePaste(event) {
|
|
87
48
|
if (!props.context?.multiple)
|
|
88
|
-
return
|
|
89
|
-
const clipboardData = event.clipboardData
|
|
49
|
+
return;
|
|
50
|
+
const clipboardData = event.clipboardData;
|
|
90
51
|
if (!clipboardData)
|
|
91
|
-
return
|
|
92
|
-
const pastedText = clipboardData.getData(
|
|
93
|
-
const separators = Array.isArray(props.context?.separators) && props.context.separators.length > 0
|
|
94
|
-
|
|
95
|
-
: [',']
|
|
96
|
-
const regex = new RegExp(`[${separators.map(s => s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')).join('')}]`)
|
|
97
|
-
// If separators are provided, split the pasted text by them
|
|
52
|
+
return;
|
|
53
|
+
const pastedText = clipboardData.getData("text");
|
|
54
|
+
const separators = Array.isArray(props.context?.separators) && props.context.separators.length > 0 ? props.context.separators : [","];
|
|
55
|
+
const regex = new RegExp(`[${separators.map((s) => s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("")}]`);
|
|
98
56
|
if (pastedText && regex.test(pastedText)) {
|
|
99
|
-
event.preventDefault()
|
|
100
|
-
const items = pastedText
|
|
101
|
-
.split(regex)
|
|
102
|
-
.map(item => item.trim())
|
|
103
|
-
.filter(item => item.length > 0)
|
|
104
|
-
// Use a local ref, never mutate context._value directly
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
const items = pastedText.split(regex).map((item) => item.trim()).filter((item) => item.length > 0);
|
|
105
59
|
if (Array.isArray(localValue.value)) {
|
|
106
|
-
localValue.value = [...localValue.value, ...items]
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
localValue.value = items
|
|
60
|
+
localValue.value = [...localValue.value, ...items];
|
|
61
|
+
} else {
|
|
62
|
+
localValue.value = items;
|
|
110
63
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
else if (pastedText) {
|
|
114
|
-
event.preventDefault()
|
|
115
|
-
// If no separators, just set the value directly
|
|
64
|
+
} else if (pastedText) {
|
|
65
|
+
event.preventDefault();
|
|
116
66
|
if (Array.isArray(localValue.value)) {
|
|
117
|
-
localValue.value = [...localValue.value, pastedText.trim()]
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
localValue.value = [pastedText.trim()]
|
|
67
|
+
localValue.value = [...localValue.value, pastedText.trim()];
|
|
68
|
+
} else {
|
|
69
|
+
localValue.value = [pastedText.trim()];
|
|
121
70
|
}
|
|
122
71
|
}
|
|
123
72
|
}
|
|
@@ -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";
|
|
21
3
|
const props = defineProps({
|
|
22
4
|
context: {
|
|
23
|
-
type: Object
|
|
24
|
-
required: true
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
|
|
5
|
+
type: Object,
|
|
6
|
+
required: true
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur } = useFormKitInput(props.context);
|
|
29
10
|
</script>
|
|
30
11
|
|
|
31
12
|
<template>
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import type { CheckboxProps } from 'primevue/checkbox'
|
|
4
|
-
|
|
5
|
-
import type { PropType } from 'vue'
|
|
6
|
-
import { useFormKitInput, useFormKitSection } from '../composables'
|
|
7
|
-
|
|
8
|
-
export interface FormKitPrimeCheckboxProps {
|
|
9
|
-
binary?: CheckboxProps['binary']
|
|
10
|
-
trueValue?: CheckboxProps['trueValue']
|
|
11
|
-
falseValue?: CheckboxProps['falseValue']
|
|
12
|
-
pt?: CheckboxProps['pt']
|
|
13
|
-
ptOptions?: CheckboxProps['ptOptions']
|
|
14
|
-
unstyled?: CheckboxProps['unstyled']
|
|
15
|
-
indeterminate?: CheckboxProps['indeterminate']
|
|
16
|
-
variant?: CheckboxProps['variant']
|
|
17
|
-
size?: CheckboxProps['size']
|
|
18
|
-
}
|
|
19
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useFormKitInput, useFormKitSection } from "../composables";
|
|
20
3
|
const props = defineProps({
|
|
21
4
|
context: {
|
|
22
|
-
type: Object
|
|
23
|
-
required: true
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
|
|
30
|
-
|
|
31
|
-
const generatedId = generateId()
|
|
5
|
+
type: Object,
|
|
6
|
+
required: true
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const { hasPrefix, hasSuffix, generateId } = useFormKitSection(props.context);
|
|
10
|
+
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur } = useFormKitInput(props.context);
|
|
11
|
+
const generatedId = generateId();
|
|
32
12
|
</script>
|
|
33
13
|
|
|
34
14
|
<template>
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import type { ColorPickerProps } from 'primevue/colorpicker'
|
|
4
|
-
|
|
5
|
-
import type { PropType } from 'vue'
|
|
6
|
-
import { useFormKitInput } from '../composables'
|
|
7
|
-
|
|
8
|
-
export interface FormKitPrimeColorPickerProps {
|
|
9
|
-
defaultColor?: ColorPickerProps['defaultColor']
|
|
10
|
-
inline?: ColorPickerProps['inline']
|
|
11
|
-
format?: ColorPickerProps['format']
|
|
12
|
-
pt?: ColorPickerProps['pt']
|
|
13
|
-
ptOptions?: ColorPickerProps['ptOptions']
|
|
14
|
-
unstyled?: ColorPickerProps['unstyled']
|
|
15
|
-
}
|
|
16
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useFormKitInput } from "../composables";
|
|
17
3
|
const props = defineProps({
|
|
18
4
|
context: {
|
|
19
|
-
type: Object
|
|
20
|
-
required: true
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const { unstyled, handleChange } = useFormKitInput(props.context)
|
|
5
|
+
type: Object,
|
|
6
|
+
required: true
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const { unstyled, handleChange } = useFormKitInput(props.context);
|
|
25
10
|
</script>
|
|
26
11
|
|
|
27
12
|
<template>
|