@sfxcode/formkit-primevue 4.1.10 → 4.2.1
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 +12 -1
- package/dist/components/FormKitDataView.vue +12 -1
- package/dist/components/PrimeListbox.d.vue.ts +4 -0
- package/dist/components/PrimeListbox.vue +55 -19
- package/dist/components/PrimeListbox.vue.d.ts +4 -0
- package/dist/definitions/repeater.js +83 -25
- package/dist/definitions/repeater.mjs +91 -22
- package/dist/sass/formkit-primevue.scss +45 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -3,7 +3,7 @@ import type { FormKitSchemaDefinition } from '@formkit/core'
|
|
|
3
3
|
import type { PropType } from 'vue'
|
|
4
4
|
import { reset } from '@formkit/core'
|
|
5
5
|
import { FormKit, FormKitMessages, FormKitSchema } from '@formkit/vue'
|
|
6
|
-
import { ref } from 'vue'
|
|
6
|
+
import { ref, watch } from 'vue'
|
|
7
7
|
import FormKitDataDebug from './FormKitDataDebug.vue'
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
@@ -82,6 +82,17 @@ if (props.data) {
|
|
|
82
82
|
|
|
83
83
|
const formSchema = ref(props.schema)
|
|
84
84
|
|
|
85
|
+
// Watch for changes to props and update internal refs
|
|
86
|
+
watch(() => props.schema, (newSchema) => {
|
|
87
|
+
formSchema.value = newSchema
|
|
88
|
+
}, { deep: true })
|
|
89
|
+
|
|
90
|
+
watch(() => props.data, (newData) => {
|
|
91
|
+
if (newData && newData !== formData.value) {
|
|
92
|
+
formData.value = newData
|
|
93
|
+
}
|
|
94
|
+
}, { deep: true })
|
|
95
|
+
|
|
85
96
|
function handleSave() {
|
|
86
97
|
emit('dataSaved', formData.value)
|
|
87
98
|
}
|
|
@@ -3,7 +3,7 @@ import type { FormKitSchemaDefinition } from '@formkit/core'
|
|
|
3
3
|
import type { PropType } from 'vue'
|
|
4
4
|
|
|
5
5
|
import { FormKit, FormKitSchema } from '@formkit/vue'
|
|
6
|
-
import { ref } from 'vue'
|
|
6
|
+
import { ref, watch } from 'vue'
|
|
7
7
|
import FormKitDataDebug from './FormKitDataDebug.vue'
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
@@ -33,6 +33,17 @@ const formSchema = ref(props.schema)
|
|
|
33
33
|
|
|
34
34
|
const formData = defineModel<any>()
|
|
35
35
|
|
|
36
|
+
// Watch for changes to props and update internal refs
|
|
37
|
+
watch(() => props.schema, (newSchema) => {
|
|
38
|
+
formSchema.value = newSchema
|
|
39
|
+
}, { deep: true })
|
|
40
|
+
|
|
41
|
+
watch(() => props.data, (newData) => {
|
|
42
|
+
if (newData && newData !== formData.value) {
|
|
43
|
+
formData.value = newData
|
|
44
|
+
}
|
|
45
|
+
}, { deep: true })
|
|
46
|
+
|
|
36
47
|
if (props.data) {
|
|
37
48
|
formData.value = props.data
|
|
38
49
|
}
|
|
@@ -31,6 +31,10 @@ export interface FormKitPrimeListboxProps {
|
|
|
31
31
|
transferRightHeaderText?: string;
|
|
32
32
|
transferHeaderClass?: string;
|
|
33
33
|
transferAll?: boolean;
|
|
34
|
+
transferButtonSeverity?: string;
|
|
35
|
+
transferContainerClass?: string;
|
|
36
|
+
transferListContainerClass?: string;
|
|
37
|
+
transferButtonClass?: string;
|
|
34
38
|
}
|
|
35
39
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
36
40
|
context: {
|
|
@@ -35,6 +35,10 @@ export interface FormKitPrimeListboxProps {
|
|
|
35
35
|
transferRightHeaderText?: string
|
|
36
36
|
transferHeaderClass?: string
|
|
37
37
|
transferAll?: boolean
|
|
38
|
+
transferButtonSeverity?: string
|
|
39
|
+
transferContainerClass?: string
|
|
40
|
+
transferListContainerClass?: string
|
|
41
|
+
transferButtonClass?: string
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
const props = defineProps({
|
|
@@ -44,7 +48,24 @@ const props = defineProps({
|
|
|
44
48
|
},
|
|
45
49
|
})
|
|
46
50
|
|
|
47
|
-
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur, modelValue } = useFormKitInput(props.context)
|
|
51
|
+
const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur, handleChange, modelValue } = useFormKitInput(props.context)
|
|
52
|
+
|
|
53
|
+
// Computed properties for transfer mode styling
|
|
54
|
+
const transferContainerClass = computed(() => {
|
|
55
|
+
return props.context.transferContainerClass || 'p-formkit-transfer'
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const transferListContainerClass = computed(() => {
|
|
59
|
+
return props.context.transferListContainerClass || 'p-formkit-transfer-list-container'
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const transferButtonClass = computed(() => {
|
|
63
|
+
return props.context.transferButtonClass || ''
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const transferButtonSeverity = computed(() => {
|
|
67
|
+
return props.context.transferButtonSeverity || 'secondary'
|
|
68
|
+
})
|
|
48
69
|
|
|
49
70
|
// Transfer List functionality
|
|
50
71
|
const optionValueKey = computed(() => {
|
|
@@ -89,22 +110,30 @@ const sourceItems = computed(() => {
|
|
|
89
110
|
})
|
|
90
111
|
|
|
91
112
|
function transferSelected() {
|
|
92
|
-
|
|
113
|
+
if (sourceSelection.value.length === 0)
|
|
114
|
+
return
|
|
115
|
+
// Use splice-based approach for better performance
|
|
93
116
|
targetItems.value = [...targetItems.value, ...sourceSelection.value]
|
|
94
117
|
sourceSelection.value = []
|
|
95
118
|
}
|
|
96
119
|
|
|
97
120
|
function transferAll() {
|
|
121
|
+
if (sourceItems.value.length === 0)
|
|
122
|
+
return
|
|
98
123
|
targetItems.value = [...targetItems.value, ...sourceItems.value]
|
|
99
124
|
sourceSelection.value = []
|
|
100
125
|
}
|
|
101
126
|
|
|
102
127
|
function removeSelected() {
|
|
103
|
-
|
|
128
|
+
if (targetSelection.value.length === 0)
|
|
129
|
+
return
|
|
130
|
+
|
|
131
|
+
// Filter out selected items using splice-inspired logic
|
|
132
|
+
const valueKey = optionValueKey.value
|
|
104
133
|
targetItems.value = targetItems.value.filter((item: any) => {
|
|
105
|
-
const itemValue =
|
|
134
|
+
const itemValue = valueKey && typeof item === 'object' ? item[valueKey] : item
|
|
106
135
|
return !targetSelection.value.some((sel: any) => {
|
|
107
|
-
const selValue =
|
|
136
|
+
const selValue = valueKey && typeof sel === 'object' ? sel[valueKey] : sel
|
|
108
137
|
return selValue === itemValue
|
|
109
138
|
})
|
|
110
139
|
})
|
|
@@ -112,6 +141,8 @@ function removeSelected() {
|
|
|
112
141
|
}
|
|
113
142
|
|
|
114
143
|
function removeAll() {
|
|
144
|
+
if (targetItems.value.length === 0)
|
|
145
|
+
return
|
|
115
146
|
targetItems.value = []
|
|
116
147
|
targetSelection.value = []
|
|
117
148
|
}
|
|
@@ -119,6 +150,7 @@ function removeAll() {
|
|
|
119
150
|
watch(targetItems, (newVal) => {
|
|
120
151
|
modelValue.value = newVal
|
|
121
152
|
handleInput(newVal)
|
|
153
|
+
handleChange(newVal)
|
|
122
154
|
}, { deep: true })
|
|
123
155
|
|
|
124
156
|
// Watch for external changes to modelValue and update targetItems
|
|
@@ -168,7 +200,8 @@ watch(() => modelValue.value, (newVal) => {
|
|
|
168
200
|
:pt="context.pt"
|
|
169
201
|
:pt-options="context.ptOptions"
|
|
170
202
|
:unstyled="unstyled"
|
|
171
|
-
@
|
|
203
|
+
@update:model-value="handleInput"
|
|
204
|
+
@change="handleChange"
|
|
172
205
|
@blur="handleBlur"
|
|
173
206
|
>
|
|
174
207
|
<template v-for="slotName in validSlotNames" :key="slotName" #[slotName]="slotProps">
|
|
@@ -180,11 +213,10 @@ watch(() => modelValue.value, (newVal) => {
|
|
|
180
213
|
<!-- Transfer Mode -->
|
|
181
214
|
<div
|
|
182
215
|
v-if="context.displayMode === 'transfer'"
|
|
183
|
-
class="
|
|
184
|
-
style="display: flex; align-items: stretch; gap: 1rem; width: 100%;"
|
|
216
|
+
:class="transferContainerClass"
|
|
185
217
|
>
|
|
186
218
|
<!-- Source List -->
|
|
187
|
-
<div
|
|
219
|
+
<div :class="transferListContainerClass">
|
|
188
220
|
<span
|
|
189
221
|
v-if="context.transferLeftHeaderText"
|
|
190
222
|
:class="transferHeaderClass"
|
|
@@ -199,7 +231,7 @@ watch(() => modelValue.value, (newVal) => {
|
|
|
199
231
|
:class="context?.attrs?.class"
|
|
200
232
|
:invalid="isInvalid"
|
|
201
233
|
:tabindex="context?.attrs.tabindex"
|
|
202
|
-
:aria-label="context?.attrs.ariaLabel"
|
|
234
|
+
:aria-label="context?.attrs.ariaLabel || 'Source list'"
|
|
203
235
|
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
204
236
|
:options="sourceItems"
|
|
205
237
|
:option-label="context.optionLabel"
|
|
@@ -229,19 +261,21 @@ watch(() => modelValue.value, (newVal) => {
|
|
|
229
261
|
</div>
|
|
230
262
|
|
|
231
263
|
<!-- Transfer Buttons -->
|
|
232
|
-
<div
|
|
264
|
+
<div class="p-formkit-transfer-buttons">
|
|
233
265
|
<Button
|
|
234
266
|
icon="pi pi-angle-right"
|
|
235
|
-
severity="
|
|
267
|
+
:severity="transferButtonSeverity"
|
|
268
|
+
:class="transferButtonClass"
|
|
236
269
|
outlined
|
|
237
270
|
:disabled="sourceSelection.length === 0"
|
|
238
|
-
aria-label="Move selected to target"
|
|
271
|
+
:aria-label="context.transferAll ? 'Move selected to target' : 'Move to target'"
|
|
239
272
|
@click="transferSelected"
|
|
240
273
|
/>
|
|
241
274
|
<Button
|
|
242
275
|
v-if="context.transferAll"
|
|
243
276
|
icon="pi pi-angle-double-right"
|
|
244
|
-
severity="
|
|
277
|
+
:severity="transferButtonSeverity"
|
|
278
|
+
:class="transferButtonClass"
|
|
245
279
|
outlined
|
|
246
280
|
:disabled="sourceItems.length === 0"
|
|
247
281
|
aria-label="Move all to target"
|
|
@@ -249,16 +283,18 @@ watch(() => modelValue.value, (newVal) => {
|
|
|
249
283
|
/>
|
|
250
284
|
<Button
|
|
251
285
|
icon="pi pi-angle-left"
|
|
252
|
-
severity="
|
|
286
|
+
:severity="transferButtonSeverity"
|
|
287
|
+
:class="transferButtonClass"
|
|
253
288
|
outlined
|
|
254
289
|
:disabled="targetSelection.length === 0"
|
|
255
|
-
aria-label="Move selected to source"
|
|
290
|
+
:aria-label="context.transferAll ? 'Move selected to source' : 'Move to source'"
|
|
256
291
|
@click="removeSelected"
|
|
257
292
|
/>
|
|
258
293
|
<Button
|
|
259
294
|
v-if="context.transferAll"
|
|
260
295
|
icon="pi pi-angle-double-left"
|
|
261
|
-
severity="
|
|
296
|
+
:severity="transferButtonSeverity"
|
|
297
|
+
:class="transferButtonClass"
|
|
262
298
|
outlined
|
|
263
299
|
:disabled="targetItems.length === 0"
|
|
264
300
|
aria-label="Move all to source"
|
|
@@ -267,7 +303,7 @@ watch(() => modelValue.value, (newVal) => {
|
|
|
267
303
|
</div>
|
|
268
304
|
|
|
269
305
|
<!-- Target List -->
|
|
270
|
-
<div
|
|
306
|
+
<div :class="transferListContainerClass">
|
|
271
307
|
<span
|
|
272
308
|
v-if="context.transferRightHeaderText"
|
|
273
309
|
:class="transferHeaderClass"
|
|
@@ -282,7 +318,7 @@ watch(() => modelValue.value, (newVal) => {
|
|
|
282
318
|
:class="context?.attrs?.class"
|
|
283
319
|
:invalid="isInvalid"
|
|
284
320
|
:tabindex="context?.attrs.tabindex"
|
|
285
|
-
:aria-label="context?.attrs.ariaLabel"
|
|
321
|
+
:aria-label="context?.attrs.ariaLabel || 'Target list'"
|
|
286
322
|
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
287
323
|
:options="targetItems"
|
|
288
324
|
:option-label="context.optionLabel"
|
|
@@ -31,6 +31,10 @@ export interface FormKitPrimeListboxProps {
|
|
|
31
31
|
transferRightHeaderText?: string;
|
|
32
32
|
transferHeaderClass?: string;
|
|
33
33
|
transferAll?: boolean;
|
|
34
|
+
transferButtonSeverity?: string;
|
|
35
|
+
transferContainerClass?: string;
|
|
36
|
+
transferListContainerClass?: string;
|
|
37
|
+
transferButtonClass?: string;
|
|
34
38
|
}
|
|
35
39
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
36
40
|
context: {
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.primeRepeaterDefinition = void 0;
|
|
7
7
|
var _vue = require("@formkit/vue");
|
|
8
|
-
var
|
|
8
|
+
var _composables = require("../composables");
|
|
9
9
|
const {
|
|
10
10
|
addList,
|
|
11
11
|
addElement,
|
|
12
12
|
addListGroup,
|
|
13
13
|
addComponent
|
|
14
|
-
} = (0,
|
|
14
|
+
} = (0, _composables.useFormKitSchema)();
|
|
15
15
|
function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", buttonSize, render = "true") {
|
|
16
16
|
const addActionButtonComponent = (onClick = "", icon = "", severity = "", render2 = "true", disabled = "false") => {
|
|
17
17
|
return addElement("div", [addComponent("Button", {
|
|
@@ -24,7 +24,7 @@ function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", button
|
|
|
24
24
|
class: buttonGroupItemClass
|
|
25
25
|
}, render2);
|
|
26
26
|
};
|
|
27
|
-
return addElement("div", [addActionButtonComponent("$moveNodeUp($node.parent, $index)", "pi pi-arrow-up", "secondary", "$renderMoveButtons", "$index === 0"), addActionButtonComponent("$removeNode($node.parent, $index)", "pi pi-trash", "danger", "$displayDeleteButton", "$
|
|
27
|
+
return addElement("div", [addActionButtonComponent("$moveNodeUp($node.parent, $index)", "pi pi-arrow-up", "secondary", "$renderMoveButtons", "$index === 0"), addActionButtonComponent("$removeNode($node.parent, $index)", "pi pi-trash", "danger", "$displayDeleteButton", "$node.parent.value.length === $minItems"), addActionButtonComponent("$cloneNode($node.parent, $index)", "pi pi-clone", "", "$displayCloneButton", "$node.parent.value.length > $maxItems -1"), addActionButtonComponent("$addNode($node.parent, $index)", "pi pi-plus", "", "$displayAddButton", "$node.parent.value.length > $maxItems -1"), addActionButtonComponent("$moveNodeDown($node.parent, $index)", "pi pi-arrow-down", "secondary", "$renderMoveButtons", "$index === $node.parent.value.length -1")], {
|
|
28
28
|
class: buttonGroupClass
|
|
29
29
|
}, render);
|
|
30
30
|
}
|
|
@@ -33,39 +33,62 @@ function addInsertButton(label = "Add Item", icon = "i-lucide-plus", styleClass
|
|
|
33
33
|
onClick: "$insertNode($node)",
|
|
34
34
|
label,
|
|
35
35
|
icon,
|
|
36
|
-
size: buttonSize
|
|
36
|
+
size: buttonSize,
|
|
37
|
+
disabled: "$node.value.length > $maxItems -1"
|
|
37
38
|
})], {
|
|
38
39
|
class: styleClass
|
|
39
40
|
}, render);
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
function addDragHandle(handleClass = "", iconClass = "", render = "true") {
|
|
43
|
+
return addElement("span", [addElement("i", [], {
|
|
44
|
+
class: iconClass
|
|
45
|
+
})], {
|
|
46
|
+
"class": handleClass,
|
|
47
|
+
"aria-label": "Drag to reorder"
|
|
48
|
+
}, render);
|
|
49
|
+
}
|
|
50
|
+
const primeRepeaterDefinition = exports.primeRepeaterDefinition = (0, _vue.createInput)(addElement("div", [addList("$listName", [addInsertButton("$insertButtonLabel", "pi pi-plus", "$insertButtonClass", "$insertButtonSize", "$node.children.length == 0 || $alwaysDisplayInsertButton"), addListGroup([addElement("div", [addDragHandle("$internalDragHandleClass", "$dragHandleIconClass", "$renderDragHandle"), {
|
|
42
51
|
children: "$slots.default"
|
|
43
52
|
}, addButtonGroup("$buttonGroupClass", "$buttonGroupItemClass", "$buttonSize", "$renderButtons")], {
|
|
44
|
-
class: "$
|
|
53
|
+
class: "$getListItemClass($index)",
|
|
54
|
+
draggable: "$renderDragHandle",
|
|
55
|
+
onDragstart: "$dragNodeStart($node.parent, $index)",
|
|
56
|
+
onDragover: "$dragNodeOver($index)",
|
|
57
|
+
onDragleave: "$dragNodeLeave($index)",
|
|
58
|
+
onDrop: "$dropNode($node.parent, $index)",
|
|
59
|
+
onDragend: "$dragNodeEnd"
|
|
45
60
|
})], true, {})], true, "true")], {
|
|
46
|
-
class: "$internalListClass"
|
|
61
|
+
class: "$internalListClass",
|
|
62
|
+
id: "$internalListId"
|
|
47
63
|
}, true), {
|
|
48
|
-
props: ["insertButtonLabel", "insertButtonClass", "insertButtonSize", "alwaysDisplayInsertButton", "newItem", "listClass", "listItemClass", "hideButtonGroup", "hideMoveButtons", "buttonGroupClass", "buttonGroupItemClass", "buttonSize", "displayCloneButton", "displayAddButton", "displayDeleteButton"],
|
|
64
|
+
props: ["insertButtonLabel", "insertButtonClass", "insertButtonSize", "alwaysDisplayInsertButton", "newItem", "listClass", "listItemClass", "hideButtonGroup", "hideMoveButtons", "buttonGroupClass", "buttonGroupItemClass", "buttonSize", "displayCloneButton", "displayAddButton", "displayDeleteButton", "minItems", "maxItems", "displayDragHandle", "dragHandleClass", "dragHandleIconClass"],
|
|
49
65
|
features: [addRepeaterHandler]
|
|
50
66
|
});
|
|
51
67
|
function addRepeaterHandler(node) {
|
|
52
68
|
const swapElements = (array, index1, index2) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
newArray[index1] = newArray[index2];
|
|
56
|
-
newArray[index2] = temp;
|
|
57
|
-
return newArray;
|
|
69
|
+
array.splice(index2, 0, array.splice(index1, 1)[0]);
|
|
70
|
+
return array;
|
|
58
71
|
};
|
|
59
72
|
node.on("created", () => {
|
|
60
73
|
if (node.context) {
|
|
74
|
+
let dragStartIndex = null;
|
|
75
|
+
let dragOverIndex = null;
|
|
61
76
|
const newItem = node.context.newItem || {};
|
|
62
77
|
node.context.listName = node.name;
|
|
63
78
|
node.context.renderButtons = !node.context.hideButtonGroup;
|
|
64
79
|
node.context.insertButtonSize = node.context.insertButtonSize ? node.context.insertButtonSize : "";
|
|
65
80
|
node.context.buttonSize = node.context.buttonSize ? node.context.buttonSize : "";
|
|
66
81
|
node.context.renderMoveButtons = !node.context.hideMoveButtons;
|
|
82
|
+
node.context.renderDragHandle = !!node.context.displayDragHandle;
|
|
83
|
+
node.context.dragHandleIconClass = node.context.dragHandleIconClass || "pi pi-bars";
|
|
84
|
+
node.context.internalDragHandleClass = node.context.dragHandleClass ? `formkit-repeater-drag-handle ${node.context.dragHandleClass}` : "formkit-repeater-drag-handle";
|
|
67
85
|
node.context.internalListClass = node.context.listClass ? `formkit-items ${node.context.listClass}` : "formkit-items";
|
|
68
86
|
node.context.internalListItemClass = node.context.listItemClass ? `formkit-item ${node.context.listItemClass}` : "formkit-item";
|
|
87
|
+
node.context.internalListId = `formkit-prime-repeater-${String(node.props.id || node.name || "list").replace(/[^\w-]/g, "-")}`;
|
|
88
|
+
node.context.getListItemClass = index => {
|
|
89
|
+
if (dragOverIndex === index && dragStartIndex !== index) return `${node.context?.internalListItemClass} formkit-repeater-drop-target`;
|
|
90
|
+
return node.context?.internalListItemClass?.toString() ?? "";
|
|
91
|
+
};
|
|
69
92
|
node.context.insertNode = parentNode => () => {
|
|
70
93
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
71
94
|
const newArray = [{
|
|
@@ -81,33 +104,68 @@ function addRepeaterHandler(node) {
|
|
|
81
104
|
};
|
|
82
105
|
node.context.addNode = (parentNode, index) => () => {
|
|
83
106
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
parentNode.input([...newArray], false);
|
|
107
|
+
const array = parentNode.value;
|
|
108
|
+
array.splice(index + 1, 0, newItem);
|
|
109
|
+
parentNode.input(array, false);
|
|
88
110
|
}
|
|
89
111
|
};
|
|
90
112
|
node.context.cloneNode = (parentNode, index) => () => {
|
|
91
113
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
92
114
|
const item = parentNode.value[index];
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
parentNode.input([...newArray], false);
|
|
115
|
+
const array = parentNode.value;
|
|
116
|
+
array.splice(index + 1, 0, item);
|
|
117
|
+
parentNode.input(array, false);
|
|
97
118
|
}
|
|
98
119
|
};
|
|
99
120
|
node.context.moveNodeUp = (parentNode, index) => () => {
|
|
100
121
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
101
|
-
|
|
102
|
-
if (index > 0) parentNode.input(swapElements(array, index - 1, index), false);
|
|
122
|
+
if (index > 0) parentNode.input(swapElements(parentNode.value, index - 1, index), false);
|
|
103
123
|
}
|
|
104
124
|
};
|
|
105
125
|
node.context.moveNodeDown = (parentNode, index) => () => {
|
|
106
126
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
107
|
-
|
|
108
|
-
|
|
127
|
+
if (index < parentNode.value.length - 1) parentNode.input(swapElements(parentNode.value, index, index + 1), false);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
node.context.dragNodeStart = (_parentNode, index) => event => {
|
|
131
|
+
dragStartIndex = index;
|
|
132
|
+
if (event?.dataTransfer) {
|
|
133
|
+
event.dataTransfer.effectAllowed = "move";
|
|
134
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
109
135
|
}
|
|
110
136
|
};
|
|
137
|
+
node.context.dragNodeOver = targetIndex => event => {
|
|
138
|
+
event?.preventDefault();
|
|
139
|
+
dragOverIndex = targetIndex;
|
|
140
|
+
if (event?.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
141
|
+
};
|
|
142
|
+
node.context.dragNodeLeave = targetIndex => () => {
|
|
143
|
+
if (dragOverIndex === targetIndex) dragOverIndex = null;
|
|
144
|
+
};
|
|
145
|
+
node.context.dropNode = (parentNode, targetIndex) => event => {
|
|
146
|
+
event?.preventDefault();
|
|
147
|
+
if (!parentNode || !Array.isArray(parentNode._value)) {
|
|
148
|
+
dragOverIndex = null;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const sourceFromEvent = Number.parseInt(event?.dataTransfer?.getData("text/plain") || "", 10);
|
|
152
|
+
const sourceIndex = Number.isInteger(sourceFromEvent) ? sourceFromEvent : dragStartIndex;
|
|
153
|
+
if (sourceIndex === null || sourceIndex === targetIndex) {
|
|
154
|
+
dragOverIndex = null;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (sourceIndex < 0 || sourceIndex >= parentNode.value.length) {
|
|
158
|
+
dragOverIndex = null;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
parentNode.input(swapElements(parentNode.value, sourceIndex, targetIndex), false);
|
|
162
|
+
dragStartIndex = null;
|
|
163
|
+
dragOverIndex = null;
|
|
164
|
+
};
|
|
165
|
+
node.context.dragNodeEnd = () => {
|
|
166
|
+
dragStartIndex = null;
|
|
167
|
+
dragOverIndex = null;
|
|
168
|
+
};
|
|
111
169
|
}
|
|
112
170
|
});
|
|
113
171
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createInput } from "@formkit/vue";
|
|
2
|
-
import { useFormKitSchema } from "../composables/
|
|
2
|
+
import { useFormKitSchema } from "../composables/index.mjs";
|
|
3
3
|
const { addList, addElement, addListGroup, addComponent } = useFormKitSchema();
|
|
4
4
|
function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", buttonSize, render = "true") {
|
|
5
5
|
const addActionButtonComponent = (onClick = "", icon = "", severity = "", render2 = "true", disabled = "false") => {
|
|
@@ -7,49 +7,77 @@ function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", button
|
|
|
7
7
|
};
|
|
8
8
|
return addElement("div", [
|
|
9
9
|
addActionButtonComponent("$moveNodeUp($node.parent, $index)", "pi pi-arrow-up", "secondary", "$renderMoveButtons", "$index === 0"),
|
|
10
|
-
addActionButtonComponent("$removeNode($node.parent, $index)", "pi pi-trash", "danger", "$displayDeleteButton", "$
|
|
11
|
-
addActionButtonComponent("$cloneNode($node.parent, $index)", "pi pi-clone", "", "$displayCloneButton", "$
|
|
12
|
-
addActionButtonComponent("$addNode($node.parent, $index)", "pi pi-plus", "", "$displayAddButton", "$
|
|
10
|
+
addActionButtonComponent("$removeNode($node.parent, $index)", "pi pi-trash", "danger", "$displayDeleteButton", "$node.parent.value.length === $minItems"),
|
|
11
|
+
addActionButtonComponent("$cloneNode($node.parent, $index)", "pi pi-clone", "", "$displayCloneButton", "$node.parent.value.length > $maxItems -1"),
|
|
12
|
+
addActionButtonComponent("$addNode($node.parent, $index)", "pi pi-plus", "", "$displayAddButton", "$node.parent.value.length > $maxItems -1"),
|
|
13
13
|
addActionButtonComponent("$moveNodeDown($node.parent, $index)", "pi pi-arrow-down", "secondary", "$renderMoveButtons", "$index === $node.parent.value.length -1")
|
|
14
14
|
], { class: buttonGroupClass }, render);
|
|
15
15
|
}
|
|
16
16
|
function addInsertButton(label = "Add Item", icon = "i-lucide-plus", styleClass = "", buttonSize, render = "true") {
|
|
17
17
|
return addElement("div", [
|
|
18
|
-
addComponent("Button", { onClick: "$insertNode($node)", label, icon, size: buttonSize })
|
|
18
|
+
addComponent("Button", { onClick: "$insertNode($node)", label, icon, size: buttonSize, disabled: "$node.value.length > $maxItems -1" })
|
|
19
19
|
], { class: styleClass }, render);
|
|
20
20
|
}
|
|
21
|
+
function addDragHandle(handleClass = "", iconClass = "", render = "true") {
|
|
22
|
+
return addElement("span", [
|
|
23
|
+
addElement("i", [], { class: iconClass })
|
|
24
|
+
], {
|
|
25
|
+
"class": handleClass,
|
|
26
|
+
"aria-label": "Drag to reorder"
|
|
27
|
+
}, render);
|
|
28
|
+
}
|
|
21
29
|
export const primeRepeaterDefinition = createInput(
|
|
22
30
|
addElement("div", [
|
|
23
31
|
addList("$listName", [
|
|
24
32
|
addInsertButton("$insertButtonLabel", "pi pi-plus", "$insertButtonClass", "$insertButtonSize", "$node.children.length == 0 || $alwaysDisplayInsertButton"),
|
|
25
33
|
addListGroup([
|
|
26
|
-
addElement("div", [
|
|
34
|
+
addElement("div", [
|
|
35
|
+
addDragHandle("$internalDragHandleClass", "$dragHandleIconClass", "$renderDragHandle"),
|
|
36
|
+
{ children: "$slots.default" },
|
|
37
|
+
addButtonGroup("$buttonGroupClass", "$buttonGroupItemClass", "$buttonSize", "$renderButtons")
|
|
38
|
+
], {
|
|
39
|
+
class: "$getListItemClass($index)",
|
|
40
|
+
draggable: "$renderDragHandle",
|
|
41
|
+
onDragstart: "$dragNodeStart($node.parent, $index)",
|
|
42
|
+
onDragover: "$dragNodeOver($index)",
|
|
43
|
+
onDragleave: "$dragNodeLeave($index)",
|
|
44
|
+
onDrop: "$dropNode($node.parent, $index)",
|
|
45
|
+
onDragend: "$dragNodeEnd"
|
|
46
|
+
})
|
|
27
47
|
], true, {})
|
|
28
48
|
], true, "true")
|
|
29
|
-
], { class: "$internalListClass" }, true),
|
|
49
|
+
], { class: "$internalListClass", id: "$internalListId" }, true),
|
|
30
50
|
{
|
|
31
|
-
props: ["insertButtonLabel", "insertButtonClass", "insertButtonSize", "alwaysDisplayInsertButton", "newItem", "listClass", "listItemClass", "hideButtonGroup", "hideMoveButtons", "buttonGroupClass", "buttonGroupItemClass", "buttonSize", "displayCloneButton", "displayAddButton", "displayDeleteButton"],
|
|
51
|
+
props: ["insertButtonLabel", "insertButtonClass", "insertButtonSize", "alwaysDisplayInsertButton", "newItem", "listClass", "listItemClass", "hideButtonGroup", "hideMoveButtons", "buttonGroupClass", "buttonGroupItemClass", "buttonSize", "displayCloneButton", "displayAddButton", "displayDeleteButton", "minItems", "maxItems", "displayDragHandle", "dragHandleClass", "dragHandleIconClass"],
|
|
32
52
|
features: [addRepeaterHandler]
|
|
33
53
|
}
|
|
34
54
|
);
|
|
35
55
|
function addRepeaterHandler(node) {
|
|
36
56
|
const swapElements = (array, index1, index2) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
newArray[index1] = newArray[index2];
|
|
40
|
-
newArray[index2] = temp;
|
|
41
|
-
return newArray;
|
|
57
|
+
array.splice(index2, 0, array.splice(index1, 1)[0]);
|
|
58
|
+
return array;
|
|
42
59
|
};
|
|
43
60
|
node.on("created", () => {
|
|
44
61
|
if (node.context) {
|
|
62
|
+
let dragStartIndex = null;
|
|
63
|
+
let dragOverIndex = null;
|
|
45
64
|
const newItem = node.context.newItem || {};
|
|
46
65
|
node.context.listName = node.name;
|
|
47
66
|
node.context.renderButtons = !node.context.hideButtonGroup;
|
|
48
67
|
node.context.insertButtonSize = node.context.insertButtonSize ? node.context.insertButtonSize : "";
|
|
49
68
|
node.context.buttonSize = node.context.buttonSize ? node.context.buttonSize : "";
|
|
50
69
|
node.context.renderMoveButtons = !node.context.hideMoveButtons;
|
|
70
|
+
node.context.renderDragHandle = !!node.context.displayDragHandle;
|
|
71
|
+
node.context.dragHandleIconClass = node.context.dragHandleIconClass || "pi pi-bars";
|
|
72
|
+
node.context.internalDragHandleClass = node.context.dragHandleClass ? `formkit-repeater-drag-handle ${node.context.dragHandleClass}` : "formkit-repeater-drag-handle";
|
|
51
73
|
node.context.internalListClass = node.context.listClass ? `formkit-items ${node.context.listClass}` : "formkit-items";
|
|
52
74
|
node.context.internalListItemClass = node.context.listItemClass ? `formkit-item ${node.context.listItemClass}` : "formkit-item";
|
|
75
|
+
node.context.internalListId = `formkit-prime-repeater-${String(node.props.id || node.name || "list").replace(/[^\w-]/g, "-")}`;
|
|
76
|
+
node.context.getListItemClass = (index) => {
|
|
77
|
+
if (dragOverIndex === index && dragStartIndex !== index)
|
|
78
|
+
return `${node.context?.internalListItemClass} formkit-repeater-drop-target`;
|
|
79
|
+
return node.context?.internalListItemClass?.toString() ?? "";
|
|
80
|
+
};
|
|
53
81
|
node.context.insertNode = (parentNode) => () => {
|
|
54
82
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
55
83
|
const newArray = [{ ...newItem }, ...parentNode.value];
|
|
@@ -63,31 +91,72 @@ function addRepeaterHandler(node) {
|
|
|
63
91
|
};
|
|
64
92
|
node.context.addNode = (parentNode, index) => () => {
|
|
65
93
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
66
|
-
const
|
|
67
|
-
|
|
94
|
+
const array = parentNode.value;
|
|
95
|
+
array.splice(index + 1, 0, newItem);
|
|
96
|
+
parentNode.input(array, false);
|
|
68
97
|
}
|
|
69
98
|
};
|
|
70
99
|
node.context.cloneNode = (parentNode, index) => () => {
|
|
71
100
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
72
101
|
const item = parentNode.value[index];
|
|
73
|
-
const
|
|
74
|
-
|
|
102
|
+
const array = parentNode.value;
|
|
103
|
+
array.splice(index + 1, 0, item);
|
|
104
|
+
parentNode.input(array, false);
|
|
75
105
|
}
|
|
76
106
|
};
|
|
77
107
|
node.context.moveNodeUp = (parentNode, index) => () => {
|
|
78
108
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
79
|
-
const array = [...parentNode.value];
|
|
80
109
|
if (index > 0)
|
|
81
|
-
parentNode.input(swapElements(
|
|
110
|
+
parentNode.input(swapElements(parentNode.value, index - 1, index), false);
|
|
82
111
|
}
|
|
83
112
|
};
|
|
84
113
|
node.context.moveNodeDown = (parentNode, index) => () => {
|
|
85
114
|
if (parentNode && Array.isArray(parentNode._value)) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
115
|
+
if (index < parentNode.value.length - 1)
|
|
116
|
+
parentNode.input(swapElements(parentNode.value, index, index + 1), false);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
node.context.dragNodeStart = (_parentNode, index) => (event) => {
|
|
120
|
+
dragStartIndex = index;
|
|
121
|
+
if (event?.dataTransfer) {
|
|
122
|
+
event.dataTransfer.effectAllowed = "move";
|
|
123
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
89
124
|
}
|
|
90
125
|
};
|
|
126
|
+
node.context.dragNodeOver = (targetIndex) => (event) => {
|
|
127
|
+
event?.preventDefault();
|
|
128
|
+
dragOverIndex = targetIndex;
|
|
129
|
+
if (event?.dataTransfer)
|
|
130
|
+
event.dataTransfer.dropEffect = "move";
|
|
131
|
+
};
|
|
132
|
+
node.context.dragNodeLeave = (targetIndex) => () => {
|
|
133
|
+
if (dragOverIndex === targetIndex)
|
|
134
|
+
dragOverIndex = null;
|
|
135
|
+
};
|
|
136
|
+
node.context.dropNode = (parentNode, targetIndex) => (event) => {
|
|
137
|
+
event?.preventDefault();
|
|
138
|
+
if (!parentNode || !Array.isArray(parentNode._value)) {
|
|
139
|
+
dragOverIndex = null;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const sourceFromEvent = Number.parseInt(event?.dataTransfer?.getData("text/plain") || "", 10);
|
|
143
|
+
const sourceIndex = Number.isInteger(sourceFromEvent) ? sourceFromEvent : dragStartIndex;
|
|
144
|
+
if (sourceIndex === null || sourceIndex === targetIndex) {
|
|
145
|
+
dragOverIndex = null;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (sourceIndex < 0 || sourceIndex >= parentNode.value.length) {
|
|
149
|
+
dragOverIndex = null;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
parentNode.input(swapElements(parentNode.value, sourceIndex, targetIndex), false);
|
|
153
|
+
dragStartIndex = null;
|
|
154
|
+
dragOverIndex = null;
|
|
155
|
+
};
|
|
156
|
+
node.context.dragNodeEnd = () => {
|
|
157
|
+
dragStartIndex = null;
|
|
158
|
+
dragOverIndex = null;
|
|
159
|
+
};
|
|
91
160
|
}
|
|
92
161
|
});
|
|
93
162
|
}
|
|
@@ -177,6 +177,27 @@ $grid-breakpoints: (
|
|
|
177
177
|
border-radius: 1rem;
|
|
178
178
|
padding: 0.2rem 0.5rem;
|
|
179
179
|
}
|
|
180
|
+
|
|
181
|
+
.formkit-repeater-drag-handle {
|
|
182
|
+
display: inline-flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
cursor: grab;
|
|
185
|
+
user-select: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.formkit-item[draggable="true"] {
|
|
189
|
+
cursor: grab;
|
|
190
|
+
|
|
191
|
+
&:active {
|
|
192
|
+
cursor: grabbing;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&.formkit-repeater-drop-target {
|
|
196
|
+
outline: 1px dashed var(--p-primary-color, #3b82f6);
|
|
197
|
+
outline-offset: 2px;
|
|
198
|
+
background: color-mix(in srgb, var(--p-primary-color, #3b82f6) 12%, transparent);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
180
201
|
}
|
|
181
202
|
|
|
182
203
|
// data view only
|
|
@@ -287,6 +308,30 @@ $grid-breakpoints: (
|
|
|
287
308
|
}
|
|
288
309
|
}
|
|
289
310
|
|
|
311
|
+
// Listbox Transfer
|
|
312
|
+
.p-formkit-transfer {
|
|
313
|
+
display: flex;
|
|
314
|
+
align-items: stretch;
|
|
315
|
+
gap: 1rem;
|
|
316
|
+
width: 100%;
|
|
317
|
+
min-width: 600px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.p-formkit-transfer-list-container {
|
|
321
|
+
display: flex;
|
|
322
|
+
flex-direction: column;
|
|
323
|
+
flex: 1;
|
|
324
|
+
gap: 0.5rem;
|
|
325
|
+
min-width: 0;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.p-formkit-transfer-buttons {
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: column;
|
|
331
|
+
align-items: center;
|
|
332
|
+
justify-content: center;
|
|
333
|
+
gap: 0.5rem;
|
|
334
|
+
}
|
|
290
335
|
|
|
291
336
|
|
|
292
337
|
// Debug
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--formkit-error-color: #ef9a9a}.formkit-form .formkit-messages{margin:.125rem 0;padding-top:.5rem;padding-left:.5rem}.formkit-form .formkit-message{list-style:none;padding:0;margin:0;color:var(--formkit-error-color);font-size:.8rem}.formkit-form .formkit-outer{padding-bottom:.8rem}.formkit-form .formkit-outer .formkit-messages{margin:.125rem 0;padding-top:.25rem;padding-left:0}.formkit-form .formkit-outer .formkit-inner .p-formkit .p-formkit-icon{box-sizing:border-box;width:100%}.formkit-form .formkit-outer .formkit-inner .p-formkit .p-inputtext,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-textarea,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-password,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-multiselect,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-select,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-editor{box-sizing:border-box;width:100%}.formkit-form .formkit-outer .formkit-inner .p-formkit .p-inputtext.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-textarea.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-password.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-multiselect.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-select.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-editor.p-colorpicker-preview{width:2rem}.formkit-form .formkit-outer .formkit-help{margin:.25rem 0 0 0;font-size:.8rem;color:var(--text-color-secondary)}.formkit-form .formkit-label{display:block;margin:0;padding-bottom:.5rem;font-weight:bold;font-size:.8rem}.formkit-form .p-formkit>*{margin-right:.5rem}.formkit-form .p-formkit>*:last-child,.formkit-form .p-formkit>*:only-child{margin-right:0}.formkit-form .p-formkit-options{display:flex;flex-wrap:wrap;gap:.5rem}.formkit-form .p-formkit-options .p-formkit-option{display:flex;align-items:center}.formkit-form .p-formkit-options .p-formkit-option label{margin-left:.5rem}.formkit-form .formkit-fieldset{margin:0;padding:0;border-radius:0;border:0}.formkit-form .formkit-fieldset:focus-within{border:0}.formkit-form .formkit-fieldset>.formkit-help{margin-top:0;margin-bottom:0}.formkit-form .formkit-legend{display:block;margin:0;padding:0}.formkit-form .formkit-actions{padding-top:.5rem;display:flex}.formkit-form .formkit-actions button{margin-right:.5rem}.formkit-form .p-action-buttons{margin-top:.25rem}.formkit-form .p-action-buttons .p-button{margin-right:.5rem}.formkit-form .p-action-buttons span .p-space{margin-right:3rem}.formkit-form .p-chip-item{align-items:center;background:var(--p-surface-500);color:var(--p-surface-0);border-radius:1rem;padding:.2rem .5rem}.p-formkit-data-view .formkit-outer{padding-bottom:.5rem}.p-formkit-data-view.form-horizontal{padding-bottom:.8rem}.p-formkit-data-view .formkit-help{padding-top:.25rem;margin:0}.p-formkit-data-view ul,.p-formkit-data-view ol{padding-inline-start:1rem;margin-block-start:0;margin-block-end:0}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper{display:flex;flex-wrap:wrap}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .formkit-inner{width:auto !important}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label{width:auto;order:2;padding:.125rem 0}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:after{content:""}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label+.formkit-inner{margin-left:0 !important;order:1;flex-basis:2rem;flex-grow:0;flex-shrink:0;overflow:hidden}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label+.formkit-inner:has(label){flex-grow:1;flex-basis:100%}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3),.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3)~label{width:auto}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3){order:1}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3)+div.p-checkbox{order:2;width:auto}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3)~label{order:3}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .formkit-inner:first-child{margin-left:0 !important}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .formkit-inner:first-child .p-formkit{display:flex}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .p-checkbox:not(:only-child){width:2rem;overflow:hidden}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-help{width:auto !important}.p-formkit-data-debug pre,.p-formkit-data-debug span{font-size:.75rem;line-height:1rem}@media(min-width: 1024px){.formkit-form{display:flex;flex-wrap:wrap;margin-left:-0.5rem;margin-right:-0.5rem}.formkit-form>*{flex-shrink:0;width:100%;max-width:100%;padding-left:.5rem;padding-right:.5rem}.col-1{width:8.3333333333%}.col-2{width:16.6666666667%}.col-3{width:25%}.col-4{width:33.3333333333%}.col-5{width:41.6666666667%}.col-6{width:50%}.col-7{width:58.3333333333%}.col-8{width:66.6666666667%}.col-9{width:75%}.col-10{width:83.3333333333%}.col-11{width:91.6666666667%}.col-12{width:100%}}@media(min-width: 768px){.formkit-form.form-horizontal .formkit-wrapper{display:flex}.formkit-form.form-horizontal .formkit-wrapper label{display:inline-block;padding:0 .25rem 0 0;font-size:inherit}.formkit-form.form-horizontal .formkit-wrapper label:after{content:":"}}@media(min-width: 768px)and (min-width: 768px){.formkit-form.form-horizontal.form-horizontal-checkbox-indent .formkit-outer[data-type=primeCheckbox]{padding-left:33.3333333333%}}@media(min-width: 768px){.p-formkit-data-view .formkit-form.form-horizontal label{white-space:nowrap}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-outer{width:100%}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-outer label{width:33.3333333333%;padding-top:.25rem;line-height:normal}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-outer .formkit-inner{width:66.6666666667%}.p-formkit-data-edit .formkit-form.form-horizontal div[data-type=primeCheckbox] .formkit-inner{margin-left:auto}.p-formkit-data-edit .formkit-form.form-horizontal div[data-type=primeCheckbox] .formkit-inner .p-formkit{display:flex}.p-formkit-data-edit .formkit-form.form-horizontal div[data-type=primeCheckbox] .formkit-inner label{width:auto;padding:0}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-help,.p-formkit-data-edit .formkit-form.form-horizontal .formkit-messages{width:66.6666666667%;margin-left:auto}}
|
|
1
|
+
:root{--formkit-error-color: #ef9a9a}.formkit-form .formkit-messages{margin:.125rem 0;padding-top:.5rem;padding-left:.5rem}.formkit-form .formkit-message{list-style:none;padding:0;margin:0;color:var(--formkit-error-color);font-size:.8rem}.formkit-form .formkit-outer{padding-bottom:.8rem}.formkit-form .formkit-outer .formkit-messages{margin:.125rem 0;padding-top:.25rem;padding-left:0}.formkit-form .formkit-outer .formkit-inner .p-formkit .p-formkit-icon{box-sizing:border-box;width:100%}.formkit-form .formkit-outer .formkit-inner .p-formkit .p-inputtext,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-textarea,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-password,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-multiselect,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-select,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-editor{box-sizing:border-box;width:100%}.formkit-form .formkit-outer .formkit-inner .p-formkit .p-inputtext.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-textarea.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-password.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-multiselect.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-select.p-colorpicker-preview,.formkit-form .formkit-outer .formkit-inner .p-formkit .p-editor.p-colorpicker-preview{width:2rem}.formkit-form .formkit-outer .formkit-help{margin:.25rem 0 0 0;font-size:.8rem;color:var(--text-color-secondary)}.formkit-form .formkit-label{display:block;margin:0;padding-bottom:.5rem;font-weight:bold;font-size:.8rem}.formkit-form .p-formkit>*{margin-right:.5rem}.formkit-form .p-formkit>*:last-child,.formkit-form .p-formkit>*:only-child{margin-right:0}.formkit-form .p-formkit-options{display:flex;flex-wrap:wrap;gap:.5rem}.formkit-form .p-formkit-options .p-formkit-option{display:flex;align-items:center}.formkit-form .p-formkit-options .p-formkit-option label{margin-left:.5rem}.formkit-form .formkit-fieldset{margin:0;padding:0;border-radius:0;border:0}.formkit-form .formkit-fieldset:focus-within{border:0}.formkit-form .formkit-fieldset>.formkit-help{margin-top:0;margin-bottom:0}.formkit-form .formkit-legend{display:block;margin:0;padding:0}.formkit-form .formkit-actions{padding-top:.5rem;display:flex}.formkit-form .formkit-actions button{margin-right:.5rem}.formkit-form .p-action-buttons{margin-top:.25rem}.formkit-form .p-action-buttons .p-button{margin-right:.5rem}.formkit-form .p-action-buttons span .p-space{margin-right:3rem}.formkit-form .p-chip-item{align-items:center;background:var(--p-surface-500);color:var(--p-surface-0);border-radius:1rem;padding:.2rem .5rem}.formkit-form .formkit-repeater-drag-handle{display:inline-flex;align-items:center;cursor:grab;user-select:none}.formkit-form .formkit-item[draggable=true]{cursor:grab}.formkit-form .formkit-item[draggable=true]:active{cursor:grabbing}.formkit-form .formkit-item[draggable=true].formkit-repeater-drop-target{outline:1px dashed var(--p-primary-color, #3b82f6);outline-offset:2px;background:color-mix(in srgb, var(--p-primary-color, #3b82f6) 12%, transparent)}.p-formkit-data-view .formkit-outer{padding-bottom:.5rem}.p-formkit-data-view.form-horizontal{padding-bottom:.8rem}.p-formkit-data-view .formkit-help{padding-top:.25rem;margin:0}.p-formkit-data-view ul,.p-formkit-data-view ol{padding-inline-start:1rem;margin-block-start:0;margin-block-end:0}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper{display:flex;flex-wrap:wrap}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .formkit-inner{width:auto !important}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label{width:auto;order:2;padding:.125rem 0}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:after{content:""}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label+.formkit-inner{margin-left:0 !important;order:1;flex-basis:2rem;flex-grow:0;flex-shrink:0;overflow:hidden}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label+.formkit-inner:has(label){flex-grow:1;flex-basis:100%}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3),.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3)~label{width:auto}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3){order:1}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3)+div.p-checkbox{order:2;width:auto}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper label:first-child:nth-last-child(3)~label{order:3}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .formkit-inner:first-child{margin-left:0 !important}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .formkit-inner:first-child .p-formkit{display:flex}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-wrapper .p-checkbox:not(:only-child){width:2rem;overflow:hidden}.p-formkit-data-edit .formkit-outer[data-type=primeCheckbox] .formkit-help{width:auto !important}.p-formkit-transfer{display:flex;align-items:stretch;gap:1rem;width:100%;min-width:600px}.p-formkit-transfer-list-container{display:flex;flex-direction:column;flex:1;gap:.5rem;min-width:0}.p-formkit-transfer-buttons{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem}.p-formkit-data-debug pre,.p-formkit-data-debug span{font-size:.75rem;line-height:1rem}@media(min-width: 1024px){.formkit-form{display:flex;flex-wrap:wrap;margin-left:-0.5rem;margin-right:-0.5rem}.formkit-form>*{flex-shrink:0;width:100%;max-width:100%;padding-left:.5rem;padding-right:.5rem}.col-1{width:8.3333333333%}.col-2{width:16.6666666667%}.col-3{width:25%}.col-4{width:33.3333333333%}.col-5{width:41.6666666667%}.col-6{width:50%}.col-7{width:58.3333333333%}.col-8{width:66.6666666667%}.col-9{width:75%}.col-10{width:83.3333333333%}.col-11{width:91.6666666667%}.col-12{width:100%}}@media(min-width: 768px){.formkit-form.form-horizontal .formkit-wrapper{display:flex}.formkit-form.form-horizontal .formkit-wrapper label{display:inline-block;padding:0 .25rem 0 0;font-size:inherit}.formkit-form.form-horizontal .formkit-wrapper label:after{content:":"}}@media(min-width: 768px)and (min-width: 768px){.formkit-form.form-horizontal.form-horizontal-checkbox-indent .formkit-outer[data-type=primeCheckbox]{padding-left:33.3333333333%}}@media(min-width: 768px){.p-formkit-data-view .formkit-form.form-horizontal label{white-space:nowrap}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-outer{width:100%}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-outer label{width:33.3333333333%;padding-top:.25rem;line-height:normal}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-outer .formkit-inner{width:66.6666666667%}.p-formkit-data-edit .formkit-form.form-horizontal div[data-type=primeCheckbox] .formkit-inner{margin-left:auto}.p-formkit-data-edit .formkit-form.form-horizontal div[data-type=primeCheckbox] .formkit-inner .p-formkit{display:flex}.p-formkit-data-edit .formkit-form.form-horizontal div[data-type=primeCheckbox] .formkit-inner label{width:auto;padding:0}.p-formkit-data-edit .formkit-form.form-horizontal .formkit-help,.p-formkit-data-edit .formkit-form.form-horizontal .formkit-messages{width:66.6666666667%;margin-left:auto}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/formkit-primevue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.1
|
|
4
|
+
"version": "4.2.1",
|
|
5
5
|
"packageManager": "pnpm@11.0.9+sha512.34ce82e6780233cf9cad8685029a8f81d2e06196c5a9bad98879f7424940c6817c4e4524fb7d38b8553ceed48b9758b8ebaf1abd3600c232c4c8cf7366086f38",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Tom",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@formkit/addons": "^2.0.0",
|
|
98
|
+
"@formkit/auto-animate": "^0.9.0",
|
|
98
99
|
"@formkit/core": "^2.0.0",
|
|
99
100
|
"@formkit/i18n": "^2.0.0",
|
|
100
101
|
"@formkit/inputs": "^2.0.0",
|
|
@@ -106,7 +107,6 @@
|
|
|
106
107
|
},
|
|
107
108
|
"devDependencies": {
|
|
108
109
|
"@antfu/eslint-config": "^9.0.0",
|
|
109
|
-
"@formkit/drag-and-drop": "^0.5.3",
|
|
110
110
|
"@primeuix/themes": "^2.0.3",
|
|
111
111
|
"@types/node": "^25.9.1",
|
|
112
112
|
"@unocss/preset-icons": "66.7.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@vitest/ui": "^4.1.8",
|
|
117
117
|
"@vue/compiler-sfc": "^3.5.35",
|
|
118
118
|
"@vue/server-renderer": "^3.5.35",
|
|
119
|
-
"@vue/test-utils": "^2.4.
|
|
119
|
+
"@vue/test-utils": "^2.4.11",
|
|
120
120
|
"@vue/tsconfig": "^0.9.1",
|
|
121
121
|
"@vueuse/core": "^14.3.0",
|
|
122
122
|
"@vueuse/head": "^2.0.0",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"cookie": "^1.1.1",
|
|
127
127
|
"esbuild": "^0.28.0",
|
|
128
128
|
"eslint": "^10.4.1",
|
|
129
|
-
"happy-dom": "^20.
|
|
129
|
+
"happy-dom": "^20.10.1",
|
|
130
130
|
"json-editor-vue": "^0.18.1",
|
|
131
131
|
"mkdist": "^2.4.1",
|
|
132
132
|
"sass": "^1.100.0",
|