@sfxcode/formkit-primevue 2.5.9 → 2.5.10
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 +4 -2
- package/dist/components/FormKitDataView.vue +4 -2
- package/dist/components/PrimeAutoComplete.vue +2 -1
- package/dist/components/PrimeCheckbox.vue +1 -1
- package/dist/components/PrimeDatePicker.vue +1 -1
- package/dist/components/PrimeEditor.vue +1 -1
- package/dist/components/PrimeInputNumber.vue +1 -1
- package/dist/components/PrimeMultiSelect.vue +0 -1
- package/dist/composables/useFormKitSection.d.ts +1 -1
- package/dist/composables/useInputEditor.js +7 -5
- package/dist/composables/useInputEditor.mjs +6 -5
- package/dist/plugins/index.d.ts +2 -1
- package/dist/plugins/index.js +15 -13
- package/dist/plugins/index.mjs +15 -13
- package/package.json +11 -10
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
+
import type { FormKitSchemaDefinition } from '@formkit/core'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
2
4
|
import { FormKit, FormKitMessages, FormKitSchema } from '@formkit/vue'
|
|
3
5
|
import { ref } from 'vue'
|
|
4
6
|
import FormKitDebug from './FormKitDebug.vue'
|
|
@@ -13,7 +15,7 @@ const props = defineProps({
|
|
|
13
15
|
default: null,
|
|
14
16
|
},
|
|
15
17
|
schema: {
|
|
16
|
-
type: Object
|
|
18
|
+
type: Object as PropType<FormKitSchemaDefinition>,
|
|
17
19
|
default: null,
|
|
18
20
|
},
|
|
19
21
|
debugData: {
|
|
@@ -82,7 +84,7 @@ function handleSave() {
|
|
|
82
84
|
</template>
|
|
83
85
|
</FormKit>
|
|
84
86
|
<FormKitDebug v-if="debugData" :data="formData" header="Data" />
|
|
85
|
-
<FormKitDebug v-if="debugSchema" :data="formSchema" header="Schema" />
|
|
87
|
+
<FormKitDebug v-if="debugSchema" :data="formSchema as object" header="Schema" />
|
|
86
88
|
</div>
|
|
87
89
|
</template>
|
|
88
90
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
+
import type { FormKitSchemaDefinition } from '@formkit/core'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
2
4
|
import { FormKit, FormKitSchema } from '@formkit/vue'
|
|
3
5
|
import { ref } from 'vue'
|
|
4
6
|
import FormKitDebug from './FormKitDebug.vue'
|
|
@@ -9,7 +11,7 @@ const props = defineProps({
|
|
|
9
11
|
default: null,
|
|
10
12
|
},
|
|
11
13
|
schema: {
|
|
12
|
-
type: Object
|
|
14
|
+
type: Object as PropType<FormKitSchemaDefinition>,
|
|
13
15
|
default: null,
|
|
14
16
|
},
|
|
15
17
|
formClass: {
|
|
@@ -42,7 +44,7 @@ const formData = ref(props.data)
|
|
|
42
44
|
<slot />
|
|
43
45
|
</FormKit>
|
|
44
46
|
<FormKitDebug v-if="debugData" :data="formData" header="Data" />
|
|
45
|
-
<FormKitDebug v-if="debugSchema" :data="formSchema" header="Schema" />
|
|
47
|
+
<FormKitDebug v-if="debugSchema" :data="formSchema as object" header="Schema" />
|
|
46
48
|
</div>
|
|
47
49
|
</template>
|
|
48
50
|
|
|
@@ -25,7 +25,8 @@ const props = defineProps({
|
|
|
25
25
|
|
|
26
26
|
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
|
|
27
27
|
|
|
28
|
-
const suggestions = ref([])
|
|
28
|
+
const suggestions = ref(['', {}])
|
|
29
|
+
suggestions.value = []
|
|
29
30
|
|
|
30
31
|
function search(event: AutoCompleteCompleteEvent) {
|
|
31
32
|
if (props.context?.options && props.context?.optionLabel) {
|
|
@@ -47,7 +47,7 @@ const generatedId = generateId()
|
|
|
47
47
|
:tabindex="context?.attrs.tabindex"
|
|
48
48
|
:aria-label="context?.attrs.ariaLabel"
|
|
49
49
|
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
50
|
-
:indeterminate="context.indeterminate ??
|
|
50
|
+
:indeterminate="context.indeterminate ?? undefined"
|
|
51
51
|
:binary="context.binary ?? true"
|
|
52
52
|
:variant="context.variant ?? 'outlined'"
|
|
53
53
|
:true-value="context.trueValue ?? undefined"
|
|
@@ -62,7 +62,7 @@ const props = defineProps({
|
|
|
62
62
|
const { validSlotNames, unstyled, isInvalid, handleInput } = useFormKitInput(props.context)
|
|
63
63
|
|
|
64
64
|
function handleBlur(e: DatePickerBlurEvent) {
|
|
65
|
-
props.context?.handlers.blur(e.originalEvent)
|
|
65
|
+
props.context?.handlers.blur(e.originalEvent as FocusEvent)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function handleClearClick() {
|
|
@@ -26,7 +26,7 @@ const { unstyled, isInvalid, handleInput } = useFormKitInput(props.context)
|
|
|
26
26
|
|
|
27
27
|
function handleSelection(e: EditorSelectionChangeEvent) {
|
|
28
28
|
if (e.range === null)
|
|
29
|
-
props.context?.
|
|
29
|
+
props.context?.node.input(props.context?._value)
|
|
30
30
|
}
|
|
31
31
|
</script>
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ const props = defineProps({
|
|
|
37
37
|
const { validSlotNames, unstyled, isInvalid } = useFormKitInput(props.context)
|
|
38
38
|
|
|
39
39
|
function handleBlur(e: InputNumberBlurEvent) {
|
|
40
|
-
props.context?.handlers.blur(e.originalEvent)
|
|
40
|
+
props.context?.handlers.blur(e.originalEvent as FocusEvent)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function handleInput(_: any) {
|
|
@@ -13,7 +13,6 @@ export interface FormKitPrimeMultiSelectProps {
|
|
|
13
13
|
optionGroupLabel?: MultiSelectProps['optionGroupLabel']
|
|
14
14
|
optionGroupChildren?: MultiSelectProps['optionGroupChildren']
|
|
15
15
|
scrollHeight?: MultiSelectProps['scrollHeight']
|
|
16
|
-
closeIcon?: MultiSelectProps['closeIcon']
|
|
17
16
|
dataKey?: MultiSelectProps['dataKey']
|
|
18
17
|
filter?: MultiSelectProps['filter']
|
|
19
18
|
filterPlaceholder?: MultiSelectProps['filterPlaceholder']
|
|
@@ -12,14 +12,16 @@ function useInputEditor() {
|
|
|
12
12
|
if (!data) return {};
|
|
13
13
|
const formkitInput = data?._dollar_formkit;
|
|
14
14
|
let tempData = {};
|
|
15
|
-
if (data.prime && data.prime
|
|
16
|
-
const mapped = data.prime
|
|
15
|
+
if (data.prime && data.prime.length > 0) {
|
|
16
|
+
const mapped = data.prime.map(entry => {
|
|
17
17
|
const key = entry.prime_key;
|
|
18
18
|
let value = entry.prime_value;
|
|
19
|
-
if (formkitInput === "primeInputOtp" && key === "length")
|
|
19
|
+
if (formkitInput === "primeInputOtp" && key === "length") {
|
|
20
|
+
value = +value;
|
|
21
|
+
}
|
|
20
22
|
return [key, value];
|
|
21
23
|
});
|
|
22
|
-
tempData = Object.assign(...mapped.map(([key, val]) => ({
|
|
24
|
+
tempData = Object.assign({}, ...mapped.map(([key, val]) => ({
|
|
23
25
|
[key]: val
|
|
24
26
|
})));
|
|
25
27
|
}
|
|
@@ -93,7 +95,7 @@ function useInputEditor() {
|
|
|
93
95
|
}
|
|
94
96
|
function objectToString(data) {
|
|
95
97
|
return `{${Object.entries(data).map(([key, value]) => {
|
|
96
|
-
if (key === "options" && value.length > 0) {
|
|
98
|
+
if (key === "options" && Array.isArray(value) && value.length > 0) {
|
|
97
99
|
let result = "[";
|
|
98
100
|
value.forEach(o => result = `${result + objectToString(o)}, `);
|
|
99
101
|
return `${key}: ${result.substring(0, result.length - 2)}]`;
|
|
@@ -7,15 +7,16 @@ export function useInputEditor() {
|
|
|
7
7
|
return {};
|
|
8
8
|
const formkitInput = data?._dollar_formkit;
|
|
9
9
|
let tempData = {};
|
|
10
|
-
if (data.prime && data.prime
|
|
11
|
-
const mapped = data.prime
|
|
10
|
+
if (data.prime && data.prime.length > 0) {
|
|
11
|
+
const mapped = data.prime.map((entry) => {
|
|
12
12
|
const key = entry.prime_key;
|
|
13
13
|
let value = entry.prime_value;
|
|
14
|
-
if (formkitInput === "primeInputOtp" && key === "length")
|
|
14
|
+
if (formkitInput === "primeInputOtp" && key === "length") {
|
|
15
15
|
value = +value;
|
|
16
|
+
}
|
|
16
17
|
return [key, value];
|
|
17
18
|
});
|
|
18
|
-
tempData = Object.assign(...mapped.map(([key, val]) => ({ [key]: val })));
|
|
19
|
+
tempData = Object.assign({}, ...mapped.map(([key, val]) => ({ [key]: val })));
|
|
19
20
|
}
|
|
20
21
|
const readonlyValue = data.readonly ? true : void 0;
|
|
21
22
|
const disabledValue = data.disabled ? true : void 0;
|
|
@@ -60,7 +61,7 @@ export function useInputEditor() {
|
|
|
60
61
|
}
|
|
61
62
|
function objectToString(data) {
|
|
62
63
|
return `{${Object.entries(data).map(([key, value]) => {
|
|
63
|
-
if (key === "options" && value.length > 0) {
|
|
64
|
+
if (key === "options" && Array.isArray(value) && value.length > 0) {
|
|
64
65
|
let result = "[";
|
|
65
66
|
value.forEach((o) => result = `${result + objectToString(o)}, `);
|
|
66
67
|
return `${key}: ${result.substring(0, result.length - 2)}]`;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FormKitNode } from '@formkit/core';
|
|
2
|
+
export declare function addPrimeAsteriskPlugin(node: FormKitNode): void;
|
package/dist/plugins/index.js
CHANGED
|
@@ -7,19 +7,21 @@ exports.addPrimeAsteriskPlugin = addPrimeAsteriskPlugin;
|
|
|
7
7
|
function addPrimeAsteriskPlugin(node) {
|
|
8
8
|
if (!node.props.type.startsWith("prime")) return;
|
|
9
9
|
node.on("created", () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
if (node.props.definition?.schema) {
|
|
11
|
+
const schemaFn = node.props.definition?.schema;
|
|
12
|
+
node.props.definition.schema = (sectionsSchema = {}) => {
|
|
13
|
+
sectionsSchema.label = {
|
|
14
|
+
children: ["$label", {
|
|
15
|
+
$el: "span",
|
|
16
|
+
if: "$state.required",
|
|
17
|
+
attrs: {
|
|
18
|
+
class: "p-formkit-asterisk"
|
|
19
|
+
},
|
|
20
|
+
children: ["*"]
|
|
21
|
+
}]
|
|
22
|
+
};
|
|
23
|
+
return schemaFn(sectionsSchema);
|
|
21
24
|
};
|
|
22
|
-
|
|
23
|
-
};
|
|
25
|
+
}
|
|
24
26
|
});
|
|
25
27
|
}
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -2,19 +2,21 @@ export function addPrimeAsteriskPlugin(node) {
|
|
|
2
2
|
if (!node.props.type.startsWith("prime"))
|
|
3
3
|
return;
|
|
4
4
|
node.on("created", () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
if (node.props.definition?.schema) {
|
|
6
|
+
const schemaFn = node.props.definition?.schema;
|
|
7
|
+
node.props.definition.schema = (sectionsSchema = {}) => {
|
|
8
|
+
sectionsSchema.label = {
|
|
9
|
+
children: ["$label", {
|
|
10
|
+
$el: "span",
|
|
11
|
+
if: "$state.required",
|
|
12
|
+
attrs: {
|
|
13
|
+
class: "p-formkit-asterisk"
|
|
14
|
+
},
|
|
15
|
+
children: ["*"]
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
18
|
+
return schemaFn(sectionsSchema);
|
|
16
19
|
};
|
|
17
|
-
|
|
18
|
-
};
|
|
20
|
+
}
|
|
19
21
|
});
|
|
20
22
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/formkit-primevue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.10",
|
|
5
5
|
"packageManager": "pnpm@9.12.1+sha256.91452fdfa46234ae447d46d5c4fc4e7e0a7058f90495c4b6f77f8beebbb154e3",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Tom",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"dist"
|
|
69
69
|
],
|
|
70
70
|
"scripts": {
|
|
71
|
-
"build": "unbuild",
|
|
71
|
+
"build": "vue-tsc --build --force && unbuild",
|
|
72
72
|
"dev": "vite serve dev",
|
|
73
73
|
"dev:build": "vite build dev",
|
|
74
74
|
"dev:preview": "vite preview dev",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@formkit/addons": "^1.6.7",
|
|
91
|
-
"@formkit/drag-and-drop": "^0.2.
|
|
91
|
+
"@formkit/drag-and-drop": "^0.2.5",
|
|
92
92
|
"@formkit/i18n": "^1.6.7",
|
|
93
93
|
"@formkit/vue": "^1.6.7",
|
|
94
94
|
"@intlify/core": "9.14.1",
|
|
@@ -102,9 +102,10 @@
|
|
|
102
102
|
"@antfu/eslint-config": "^3.8.0",
|
|
103
103
|
"@formkit/core": "^1.6.7",
|
|
104
104
|
"@primevue/themes": "^4.1.1",
|
|
105
|
-
"@types/node": "^22.7.
|
|
106
|
-
"@
|
|
107
|
-
"@unocss/preset-
|
|
105
|
+
"@types/node": "^22.7.9",
|
|
106
|
+
"@types/uuid": "^10.0.0",
|
|
107
|
+
"@unocss/preset-icons": "^0.63.6",
|
|
108
|
+
"@unocss/preset-uno": "^0.63.6",
|
|
108
109
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
109
110
|
"@vitest/coverage-v8": "^2.1.3",
|
|
110
111
|
"@vitest/ui": "^2.1.3",
|
|
@@ -128,12 +129,12 @@
|
|
|
128
129
|
"tslib": "^2.8.0",
|
|
129
130
|
"typescript": "^5.6.3",
|
|
130
131
|
"unbuild": "2.0.0",
|
|
131
|
-
"unocss": "^0.63.
|
|
132
|
+
"unocss": "^0.63.6",
|
|
132
133
|
"unplugin-auto-import": "^0.18.3",
|
|
133
134
|
"unplugin-vue-components": "^0.27.4",
|
|
134
|
-
"vanilla-jsoneditor": "^1.
|
|
135
|
-
"vite": "^5.4.
|
|
136
|
-
"vite-plugin-dts": "^4.
|
|
135
|
+
"vanilla-jsoneditor": "^1.1.1",
|
|
136
|
+
"vite": "^5.4.10",
|
|
137
|
+
"vite-plugin-dts": "^4.3.0",
|
|
137
138
|
"vite-plugin-eslint": "^1.8.1",
|
|
138
139
|
"vite-plugin-pages": "^0.32.3",
|
|
139
140
|
"vite-ssg": "^0.23.8",
|