@sfxcode/formkit-openvue 0.0.0-stage → 0.8.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/LICENSE +21 -0
- package/README.md +169 -2
- package/components.d.ts +1 -0
- package/dist/components/FormAutoComplete.vue +100 -0
- package/dist/components/FormCascadeSelect.vue +41 -0
- package/dist/components/FormCheckbox.vue +49 -0
- package/dist/components/FormColorPicker.vue +31 -0
- package/dist/components/FormDatePicker.vue +93 -0
- package/dist/components/FormInputMask.vue +67 -0
- package/dist/components/FormInputNumber.vue +72 -0
- package/dist/components/FormInputOtp.vue +40 -0
- package/dist/components/FormInputText.vue +63 -0
- package/dist/components/FormKitDataDebug.vue +25 -0
- package/dist/components/FormKitDataEdit.vue +123 -0
- package/dist/components/FormKitDataView.vue +56 -0
- package/dist/components/FormKitIcon.vue +23 -0
- package/dist/components/FormKitPrefix.vue +9 -0
- package/dist/components/FormKitSuffix.vue +9 -0
- package/dist/components/FormKnob.vue +48 -0
- package/dist/components/FormListbox.vue +482 -0
- package/dist/components/FormMultiSelect.vue +68 -0
- package/dist/components/FormOutputBoolean.vue +30 -0
- package/dist/components/FormOutputDate.vue +40 -0
- package/dist/components/FormOutputDuration.vue +24 -0
- package/dist/components/FormOutputLink.vue +39 -0
- package/dist/components/FormOutputList.vue +105 -0
- package/dist/components/FormOutputNumber.vue +47 -0
- package/dist/components/FormOutputReference.vue +52 -0
- package/dist/components/FormOutputText.vue +52 -0
- package/dist/components/FormPassword.vue +47 -0
- package/dist/components/FormRadioButton.vue +39 -0
- package/dist/components/FormRating.vue +38 -0
- package/dist/components/FormSelect.vue +69 -0
- package/dist/components/FormSelectButton.vue +42 -0
- package/dist/components/FormSlider.vue +40 -0
- package/dist/components/FormTextarea.vue +35 -0
- package/dist/components/FormToggleButton.vue +40 -0
- package/dist/components/FormToggleSwitch.vue +40 -0
- package/dist/components/FormTreeSelect.vue +46 -0
- package/dist/components/index.d.ts +24 -0
- package/dist/components/index.js +167 -0
- package/dist/components/index.mjs +48 -0
- package/dist/composables/index.d.ts +9 -0
- package/dist/composables/index.js +61 -0
- package/dist/composables/index.mjs +18 -0
- package/dist/composables/useFormInputs.d.ts +3 -0
- package/dist/composables/useFormInputs.js +62 -0
- package/dist/composables/useFormInputs.mjs +53 -0
- package/dist/composables/useFormKitInput.d.ts +11 -0
- package/dist/composables/useFormKitInput.js +58 -0
- package/dist/composables/useFormKitInput.mjs +45 -0
- package/dist/composables/useFormKitRepeater.d.ts +18 -0
- package/dist/composables/useFormKitRepeater.js +74 -0
- package/dist/composables/useFormKitRepeater.mjs +54 -0
- package/dist/composables/useFormKitSchema.d.ts +36 -0
- package/dist/composables/useFormKitSchema.js +83 -0
- package/dist/composables/useFormKitSchema.mjs +58 -0
- package/dist/composables/useFormKitSection.d.ts +7 -0
- package/dist/composables/useFormKitSection.js +31 -0
- package/dist/composables/useFormKitSection.mjs +19 -0
- package/dist/composables/useInputEditor.d.ts +8 -0
- package/dist/composables/useInputEditor.js +148 -0
- package/dist/composables/useInputEditor.mjs +143 -0
- package/dist/composables/useInputEditorSchema.d.ts +163 -0
- package/dist/composables/useInputEditorSchema.js +313 -0
- package/dist/composables/useInputEditorSchema.mjs +315 -0
- package/dist/composables/useOutputDuration.d.ts +4 -0
- package/dist/composables/useOutputDuration.js +40 -0
- package/dist/composables/useOutputDuration.mjs +35 -0
- package/dist/definitions/index.d.ts +35 -0
- package/dist/definitions/index.js +44 -0
- package/dist/definitions/index.mjs +70 -0
- package/dist/definitions/input.d.ts +23 -0
- package/dist/definitions/input.js +118 -0
- package/dist/definitions/input.mjs +111 -0
- package/dist/definitions/output.d.ts +9 -0
- package/dist/definitions/output.js +46 -0
- package/dist/definitions/output.mjs +136 -0
- package/dist/definitions/repeater.d.ts +2 -0
- package/dist/definitions/repeater.js +179 -0
- package/dist/definitions/repeater.mjs +168 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +62 -0
- package/dist/index.mjs +14 -0
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.js +60 -0
- package/dist/plugins/index.mjs +55 -0
- package/dist/sass/formkit-openvue.scss +460 -0
- package/dist/style.css +1 -0
- package/package.json +148 -4
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { createInput } from "@formkit/vue";
|
|
2
|
+
import { useFormKitSchema } from "../composables/index.mjs";
|
|
3
|
+
const { addList, addElement, addListGroup, addComponent } = useFormKitSchema();
|
|
4
|
+
function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", buttonSize, render = "true") {
|
|
5
|
+
const addActionButtonComponent = (onClick = "", icon = "", severity = "", render2 = "true", disabled = "false") => {
|
|
6
|
+
return addElement("div", [addComponent("Button", { onClick, icon, severity, disabled, size: buttonSize })], { class: buttonGroupItemClass }, render2);
|
|
7
|
+
};
|
|
8
|
+
return addElement("div", [
|
|
9
|
+
addActionButtonComponent("$moveNodeUp($node.parent, $index)", "oi oi-arrow-up", "secondary", "$renderMoveButtons", "$index === 0"),
|
|
10
|
+
addActionButtonComponent("$removeNode($node.parent, $index)", "oi oi-trash", "danger", "$displayDeleteButton", "$node.parent.value.length === $minItems"),
|
|
11
|
+
addActionButtonComponent("$cloneNode($node.parent, $index)", "oi oi-clone", "", "$displayCloneButton", "$node.parent.value.length > $maxItems -1"),
|
|
12
|
+
addActionButtonComponent("$addNode($node.parent, $index)", "oi oi-plus", "", "$displayAddButton", "$node.parent.value.length > $maxItems -1"),
|
|
13
|
+
addActionButtonComponent("$moveNodeDown($node.parent, $index)", "oi oi-arrow-down", "secondary", "$renderMoveButtons", "$index === $node.parent.value.length -1")
|
|
14
|
+
], { class: buttonGroupClass }, render);
|
|
15
|
+
}
|
|
16
|
+
function addInsertButton(label = "Add Item", icon = "i-lucide-plus", styleClass = "", buttonSize, render = "true") {
|
|
17
|
+
return addElement("div", [
|
|
18
|
+
addComponent("Button", { onClick: "$insertNode($node)", label, icon, size: buttonSize, disabled: "$node.value.length > $maxItems -1" })
|
|
19
|
+
], { class: styleClass }, render);
|
|
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
|
+
}
|
|
29
|
+
export const formRepeaterDefinition = createInput(
|
|
30
|
+
addElement("div", [
|
|
31
|
+
addList("$listName", [
|
|
32
|
+
addInsertButton("$insertButtonLabel", "oi oi-plus", "$insertButtonClass", "$insertButtonSize", "$node.children.length == 0 || $alwaysDisplayInsertButton"),
|
|
33
|
+
addListGroup([
|
|
34
|
+
addElement("div", [
|
|
35
|
+
addDragHandle("$internalDragHandleClass", "$dragHandleIconClass", "$renderDragHandle"),
|
|
36
|
+
{ children: "$slots.default" },
|
|
37
|
+
addButtonGroup("$buttonGroupClass", "$buttonGroupItemClass", "$buttonSize", "$renderButtons")
|
|
38
|
+
], {
|
|
39
|
+
id: "$getListItemId($index)",
|
|
40
|
+
class: "$getListItemClass($index)",
|
|
41
|
+
draggable: "$draggable",
|
|
42
|
+
onDragstart: "$dragNodeStart($node.parent, $index)",
|
|
43
|
+
onDragover: "$dragNodeOver($index)",
|
|
44
|
+
onDragleave: "$dragNodeLeave($index)",
|
|
45
|
+
onDrop: "$dropNode($node.parent, $index)",
|
|
46
|
+
onDragend: "$dragNodeEnd"
|
|
47
|
+
})
|
|
48
|
+
], true, {})
|
|
49
|
+
], true, "true", { value: "$value" })
|
|
50
|
+
], { class: "$internalListClass", id: "$internalListId" }, true),
|
|
51
|
+
{
|
|
52
|
+
props: ["insertButtonLabel", "insertButtonClass", "insertButtonSize", "alwaysDisplayInsertButton", "newItem", "listClass", "listItemClass", "hideButtonGroup", "hideMoveButtons", "buttonGroupClass", "buttonGroupItemClass", "buttonSize", "displayCloneButton", "displayAddButton", "displayDeleteButton", "minItems", "maxItems", "displayDragHandle", "draggable", "dragHandleClass", "dragHandleIconClass"],
|
|
53
|
+
features: [addRepeaterHandler]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
function addRepeaterHandler(node) {
|
|
57
|
+
const swapElements = (array, index1, index2) => {
|
|
58
|
+
array.splice(index2, 0, array.splice(index1, 1)[0]);
|
|
59
|
+
return array;
|
|
60
|
+
};
|
|
61
|
+
const uuid = typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
62
|
+
node.on("created", () => {
|
|
63
|
+
if (node.context) {
|
|
64
|
+
let dragStartIndex = null;
|
|
65
|
+
let dragOverIndex = null;
|
|
66
|
+
const newItem = node.context.newItem || {};
|
|
67
|
+
node.context.listName = node.name;
|
|
68
|
+
node.context.renderButtons = !node.context.hideButtonGroup;
|
|
69
|
+
node.context.insertButtonSize = node.context.insertButtonSize ? node.context.insertButtonSize : "";
|
|
70
|
+
node.context.buttonSize = node.context.buttonSize ? node.context.buttonSize : "";
|
|
71
|
+
node.context.renderMoveButtons = !node.context.hideMoveButtons;
|
|
72
|
+
node.context.draggable = !!node.context.draggable;
|
|
73
|
+
node.context.renderDragHandle = !!node.context.displayDragHandle;
|
|
74
|
+
node.context.dragHandleIconClass = node.context.dragHandleIconClass || "oi oi-bars";
|
|
75
|
+
node.context.internalDragHandleClass = node.context.dragHandleClass ? `formkit-repeater-drag-handle ${node.context.dragHandleClass}` : "formkit-repeater-drag-handle";
|
|
76
|
+
node.context.internalListClass = node.context.listClass ? `formkit-items ${node.context.listClass}` : "formkit-items";
|
|
77
|
+
node.context.internalListItemClass = node.context.listItemClass ? `formkit-item ${node.context.listItemClass}` : "formkit-item";
|
|
78
|
+
node.context.internalListId = `formkit-items-${uuid}`;
|
|
79
|
+
node.context.getListItemClass = (index) => {
|
|
80
|
+
if (dragOverIndex === index && dragStartIndex !== index)
|
|
81
|
+
return `${node.context?.internalListItemClass} formkit-repeater-drop-target`;
|
|
82
|
+
return node.context?.internalListItemClass?.toString() ?? "";
|
|
83
|
+
};
|
|
84
|
+
node.context.getListItemId = (index) => {
|
|
85
|
+
return `formkit-item-${index}-${uuid}`;
|
|
86
|
+
};
|
|
87
|
+
node.context.insertNode = (parentNode) => () => {
|
|
88
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
89
|
+
const newArray = [{ ...newItem }, ...parentNode.value];
|
|
90
|
+
parentNode.input(newArray, false);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
node.context.removeNode = (parentNode, index) => () => {
|
|
94
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
95
|
+
parentNode.input(parentNode._value.filter((_, i) => i !== index), false);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
node.context.addNode = (parentNode, index) => () => {
|
|
99
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
100
|
+
const array = parentNode.value;
|
|
101
|
+
array.splice(index + 1, 0, newItem);
|
|
102
|
+
parentNode.input(array, false);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
node.context.cloneNode = (parentNode, index) => () => {
|
|
106
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
107
|
+
const item = parentNode.value[index];
|
|
108
|
+
const array = parentNode.value;
|
|
109
|
+
array.splice(index + 1, 0, item);
|
|
110
|
+
parentNode.input(array, false);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
node.context.moveNodeUp = (parentNode, index) => () => {
|
|
114
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
115
|
+
if (index > 0)
|
|
116
|
+
parentNode.input(swapElements(parentNode.value, index - 1, index), false);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
node.context.moveNodeDown = (parentNode, index) => () => {
|
|
120
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
121
|
+
if (index < parentNode.value.length - 1)
|
|
122
|
+
parentNode.input(swapElements(parentNode.value, index, index + 1), false);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
node.context.dragNodeStart = (_parentNode, index) => (event) => {
|
|
126
|
+
dragStartIndex = index;
|
|
127
|
+
if (event?.dataTransfer) {
|
|
128
|
+
event.dataTransfer.effectAllowed = "move";
|
|
129
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
node.context.dragNodeOver = (targetIndex) => (event) => {
|
|
133
|
+
event?.preventDefault();
|
|
134
|
+
dragOverIndex = targetIndex;
|
|
135
|
+
if (event?.dataTransfer)
|
|
136
|
+
event.dataTransfer.dropEffect = "move";
|
|
137
|
+
};
|
|
138
|
+
node.context.dragNodeLeave = (targetIndex) => () => {
|
|
139
|
+
if (dragOverIndex === targetIndex)
|
|
140
|
+
dragOverIndex = null;
|
|
141
|
+
};
|
|
142
|
+
node.context.dropNode = (parentNode, targetIndex) => (event) => {
|
|
143
|
+
event?.preventDefault();
|
|
144
|
+
if (!parentNode || !Array.isArray(parentNode._value)) {
|
|
145
|
+
dragOverIndex = null;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const sourceFromEvent = Number.parseInt(event?.dataTransfer?.getData("text/plain") || "", 10);
|
|
149
|
+
const sourceIndex = Number.isInteger(sourceFromEvent) ? sourceFromEvent : dragStartIndex;
|
|
150
|
+
if (sourceIndex === null || sourceIndex === targetIndex) {
|
|
151
|
+
dragOverIndex = null;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (sourceIndex < 0 || sourceIndex >= parentNode.value.length) {
|
|
155
|
+
dragOverIndex = null;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
parentNode.input(swapElements(parentNode.value, sourceIndex, targetIndex), false);
|
|
159
|
+
dragStartIndex = null;
|
|
160
|
+
dragOverIndex = null;
|
|
161
|
+
};
|
|
162
|
+
node.context.dragNodeEnd = () => {
|
|
163
|
+
dragStartIndex = null;
|
|
164
|
+
dragOverIndex = null;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { FormKitBaseSlots, FormKitInputs } from '@formkit/inputs';
|
|
2
|
+
import type { AutoCompleteSlots, CascadeSelectSlots, CheckboxSlots, ColorPickerSlots, DatePickerSlots, InputMaskSlots, InputNumberSlots, InputOtpSlots, InputTextSlots, KnobSlots, ListboxSlots, MultiSelectSlots, PasswordSlots, RadioButtonSlots, RatingSlots, SelectButtonSlots, SelectSlots, SliderSlots, TextareaSlots, ToggleButtonSlots, ToggleSwitchSlots, TreeSelectSlots } from 'openvue';
|
|
3
|
+
import type { CascadeSelectProps } from 'openvue/cascadeselect';
|
|
4
|
+
import type { ListboxProps } from 'openvue/listbox';
|
|
5
|
+
import type { MultiSelectProps } from 'openvue/multiselect';
|
|
6
|
+
import type { SelectProps } from 'openvue/select';
|
|
7
|
+
import type { SelectButtonProps } from 'openvue/selectbutton';
|
|
8
|
+
import type { TreeSelectProps } from 'openvue/treeselect';
|
|
9
|
+
import { FormKitDataEdit, FormKitDataView } from './components';
|
|
10
|
+
import { useFormInputs, useFormKitRepeater, useFormKitSchema, useInputEditor, useInputEditorSchema } from './composables';
|
|
11
|
+
import { formInputs, formOutputs } from './definitions';
|
|
12
|
+
export { formInputs, FormKitDataEdit, FormKitDataView, formOutputs, useFormInputs, useFormKitRepeater, useFormKitSchema, useInputEditor, useInputEditorSchema, };
|
|
13
|
+
/**
|
|
14
|
+
* Keeps all slots from 1st argument, add any slots from 2nd type which do not collide with the 1st's names.
|
|
15
|
+
*/
|
|
16
|
+
type MergeSlots<A, B> = A & Omit<B, keyof A>;
|
|
17
|
+
declare module '@formkit/inputs' {
|
|
18
|
+
interface FormKitInputProps<Props extends FormKitInputs<Props>> {
|
|
19
|
+
formAutoComplete: {
|
|
20
|
+
type: 'formAutoComplete';
|
|
21
|
+
};
|
|
22
|
+
formInputText: {
|
|
23
|
+
type: 'formInputText';
|
|
24
|
+
};
|
|
25
|
+
formInputNumber: {
|
|
26
|
+
type: 'formInputNumber';
|
|
27
|
+
};
|
|
28
|
+
formInputMask: {
|
|
29
|
+
type: 'formInputMask';
|
|
30
|
+
};
|
|
31
|
+
formPassword: {
|
|
32
|
+
type: 'formPassword';
|
|
33
|
+
};
|
|
34
|
+
formCheckbox: {
|
|
35
|
+
type: 'formCheckbox';
|
|
36
|
+
};
|
|
37
|
+
formToggleSwitch: {
|
|
38
|
+
type: 'formToggleSwitch';
|
|
39
|
+
};
|
|
40
|
+
formTextarea: {
|
|
41
|
+
type: 'formTextarea';
|
|
42
|
+
};
|
|
43
|
+
formSelect: {
|
|
44
|
+
type: 'formSelect';
|
|
45
|
+
options?: SelectProps['options'];
|
|
46
|
+
};
|
|
47
|
+
formMultiSelect: {
|
|
48
|
+
type: 'formMultiSelect';
|
|
49
|
+
options?: MultiSelectProps['options'];
|
|
50
|
+
};
|
|
51
|
+
formDatePicker: {
|
|
52
|
+
type: 'formDatePicker';
|
|
53
|
+
};
|
|
54
|
+
formSlider: {
|
|
55
|
+
type: 'formSlider';
|
|
56
|
+
};
|
|
57
|
+
formKnob: {
|
|
58
|
+
type: 'formKnob';
|
|
59
|
+
};
|
|
60
|
+
formRating: {
|
|
61
|
+
type: 'formRating';
|
|
62
|
+
};
|
|
63
|
+
formRadioButton: {
|
|
64
|
+
type: 'formRadioButton';
|
|
65
|
+
};
|
|
66
|
+
formColorPicker: {
|
|
67
|
+
type: 'formColorPicker';
|
|
68
|
+
};
|
|
69
|
+
formToggleButton: {
|
|
70
|
+
type: 'formToggleButton';
|
|
71
|
+
};
|
|
72
|
+
formListbox: {
|
|
73
|
+
type: 'formListbox';
|
|
74
|
+
options?: ListboxProps['options'];
|
|
75
|
+
};
|
|
76
|
+
formSelectButton: {
|
|
77
|
+
type: 'formSelectButton';
|
|
78
|
+
options?: SelectButtonProps['options'];
|
|
79
|
+
};
|
|
80
|
+
formCascadeSelect: {
|
|
81
|
+
type: 'formCascadeSelect';
|
|
82
|
+
options?: CascadeSelectProps['options'];
|
|
83
|
+
};
|
|
84
|
+
formTreeSelect: {
|
|
85
|
+
type: 'formTreeSelect';
|
|
86
|
+
options?: TreeSelectProps['options'];
|
|
87
|
+
};
|
|
88
|
+
formInputOtp: {
|
|
89
|
+
type: 'formInputOtp';
|
|
90
|
+
};
|
|
91
|
+
formOutputText: {
|
|
92
|
+
type: 'formOutputText';
|
|
93
|
+
};
|
|
94
|
+
formOutputLink: {
|
|
95
|
+
type: 'formOutputLink';
|
|
96
|
+
};
|
|
97
|
+
formOutputReference: {
|
|
98
|
+
type: 'formOutputReference';
|
|
99
|
+
};
|
|
100
|
+
formOutputNumber: {
|
|
101
|
+
type: 'formOutputNumber';
|
|
102
|
+
};
|
|
103
|
+
formOutputDate: {
|
|
104
|
+
type: 'formOutputDate';
|
|
105
|
+
};
|
|
106
|
+
formOutputBoolean: {
|
|
107
|
+
type: 'formOutputBoolean';
|
|
108
|
+
};
|
|
109
|
+
formOutputDuration: {
|
|
110
|
+
type: 'formOutputDuration';
|
|
111
|
+
};
|
|
112
|
+
formOutputList: {
|
|
113
|
+
type: 'formOutputList';
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
interface FormKitInputSlots<Props extends FormKitInputs<Props>> {
|
|
117
|
+
formAutoComplete: MergeSlots<FormKitBaseSlots<Props>, AutoCompleteSlots>;
|
|
118
|
+
formCascadeSelect: MergeSlots<FormKitBaseSlots<Props>, CascadeSelectSlots>;
|
|
119
|
+
formCheckbox: MergeSlots<FormKitBaseSlots<Props>, CheckboxSlots>;
|
|
120
|
+
formColorPicker: MergeSlots<FormKitBaseSlots<Props>, ColorPickerSlots>;
|
|
121
|
+
formDatePicker: MergeSlots<FormKitBaseSlots<Props>, DatePickerSlots>;
|
|
122
|
+
formInputMask: MergeSlots<FormKitBaseSlots<Props>, InputMaskSlots>;
|
|
123
|
+
formInputNumber: MergeSlots<FormKitBaseSlots<Props>, InputNumberSlots>;
|
|
124
|
+
formInputOtp: MergeSlots<FormKitBaseSlots<Props>, InputOtpSlots>;
|
|
125
|
+
formInputText: MergeSlots<FormKitBaseSlots<Props>, InputTextSlots>;
|
|
126
|
+
formKnob: MergeSlots<FormKitBaseSlots<Props>, KnobSlots>;
|
|
127
|
+
formListbox: MergeSlots<FormKitBaseSlots<Props>, ListboxSlots>;
|
|
128
|
+
formMultiSelect: MergeSlots<FormKitBaseSlots<Props>, MultiSelectSlots>;
|
|
129
|
+
formOutputBoolean: FormKitBaseSlots<Props>;
|
|
130
|
+
formOutputDate: FormKitBaseSlots<Props>;
|
|
131
|
+
formOutputDuration: FormKitBaseSlots<Props>;
|
|
132
|
+
formOutputLink: FormKitBaseSlots<Props>;
|
|
133
|
+
formOutputList: FormKitBaseSlots<Props>;
|
|
134
|
+
formOutputNumber: FormKitBaseSlots<Props>;
|
|
135
|
+
formOutputReference: FormKitBaseSlots<Props>;
|
|
136
|
+
formOutputText: FormKitBaseSlots<Props>;
|
|
137
|
+
formPassword: MergeSlots<FormKitBaseSlots<Props>, PasswordSlots>;
|
|
138
|
+
formRadioButton: MergeSlots<FormKitBaseSlots<Props>, RadioButtonSlots>;
|
|
139
|
+
formRating: MergeSlots<FormKitBaseSlots<Props>, RatingSlots>;
|
|
140
|
+
formSelect: MergeSlots<FormKitBaseSlots<Props>, SelectSlots>;
|
|
141
|
+
formSelectButton: MergeSlots<FormKitBaseSlots<Props>, SelectButtonSlots>;
|
|
142
|
+
formSlider: MergeSlots<FormKitBaseSlots<Props>, SliderSlots>;
|
|
143
|
+
formTextarea: MergeSlots<FormKitBaseSlots<Props>, TextareaSlots>;
|
|
144
|
+
formToggleButton: MergeSlots<FormKitBaseSlots<Props>, ToggleButtonSlots>;
|
|
145
|
+
formToggleSwitch: MergeSlots<FormKitBaseSlots<Props>, ToggleSwitchSlots>;
|
|
146
|
+
formTreeSelect: MergeSlots<FormKitBaseSlots<Props>, TreeSelectSlots>;
|
|
147
|
+
}
|
|
148
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "FormKitDataEdit", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _components.FormKitDataEdit;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "FormKitDataView", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _components.FormKitDataView;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "formInputs", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _definitions.formInputs;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "formOutputs", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _definitions.formOutputs;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "useFormInputs", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _composables.useFormInputs;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "useFormKitRepeater", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _composables.useFormKitRepeater;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "useFormKitSchema", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _composables.useFormKitSchema;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "useInputEditor", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _composables.useInputEditor;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "useInputEditorSchema", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _composables.useInputEditorSchema;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var _components = require("./components");
|
|
61
|
+
var _composables = require("./composables");
|
|
62
|
+
var _definitions = require("./definitions");
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormKitDataEdit, FormKitDataView } from "./components/index.mjs";
|
|
2
|
+
import { useFormInputs, useFormKitRepeater, useFormKitSchema, useInputEditor, useInputEditorSchema } from "./composables/index.mjs";
|
|
3
|
+
import { formInputs, formOutputs } from "./definitions/index.mjs";
|
|
4
|
+
export {
|
|
5
|
+
formInputs,
|
|
6
|
+
FormKitDataEdit,
|
|
7
|
+
FormKitDataView,
|
|
8
|
+
formOutputs,
|
|
9
|
+
useFormInputs,
|
|
10
|
+
useFormKitRepeater,
|
|
11
|
+
useFormKitSchema,
|
|
12
|
+
useInputEditor,
|
|
13
|
+
useInputEditorSchema
|
|
14
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.addFormAsteriskPlugin = addFormAsteriskPlugin;
|
|
7
|
+
exports.addLabelPlugin = addLabelPlugin;
|
|
8
|
+
function addFormAsteriskPlugin(node) {
|
|
9
|
+
if (!/^form[A-Z]/.test(node.props.type) || node.props.type.startsWith("formOutput")) return;
|
|
10
|
+
node.on("created", () => {
|
|
11
|
+
if (node.props.definition?.schema) {
|
|
12
|
+
const schemaFn = node.props.definition?.schema;
|
|
13
|
+
node.props.definition.schema = (sectionsSchema = {}) => {
|
|
14
|
+
sectionsSchema.label = {
|
|
15
|
+
children: ["$label", {
|
|
16
|
+
$el: "span",
|
|
17
|
+
if: "$state.required",
|
|
18
|
+
attrs: {
|
|
19
|
+
class: "p-formkit-asterisk"
|
|
20
|
+
},
|
|
21
|
+
children: ["*"]
|
|
22
|
+
}]
|
|
23
|
+
};
|
|
24
|
+
return schemaFn(sectionsSchema);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function addLabelPlugin(node) {
|
|
30
|
+
if (!/^form[A-Z]/.test(node.props.type)) return;
|
|
31
|
+
node.on("created", () => {
|
|
32
|
+
if (node.props.definition?.schema) {
|
|
33
|
+
const schemaFn = node.props.definition?.schema;
|
|
34
|
+
node.props.definition.schema = (sectionsSchema = {}) => {
|
|
35
|
+
sectionsSchema.label = {
|
|
36
|
+
children: [{
|
|
37
|
+
$el: "span",
|
|
38
|
+
attrs: {
|
|
39
|
+
title: "$help",
|
|
40
|
+
class: "p-formkit-label"
|
|
41
|
+
},
|
|
42
|
+
children: ["$label"]
|
|
43
|
+
}, {
|
|
44
|
+
$el: "span",
|
|
45
|
+
if: "$state.required",
|
|
46
|
+
attrs: {
|
|
47
|
+
class: "p-formkit-required",
|
|
48
|
+
title: "$help"
|
|
49
|
+
},
|
|
50
|
+
children: ["*"]
|
|
51
|
+
}]
|
|
52
|
+
};
|
|
53
|
+
sectionsSchema.help = {
|
|
54
|
+
children: []
|
|
55
|
+
};
|
|
56
|
+
return schemaFn(sectionsSchema);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export function addFormAsteriskPlugin(node) {
|
|
2
|
+
if (!/^form[A-Z]/.test(node.props.type) || node.props.type.startsWith("formOutput"))
|
|
3
|
+
return;
|
|
4
|
+
node.on("created", () => {
|
|
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);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function addLabelPlugin(node) {
|
|
24
|
+
if (!/^form[A-Z]/.test(node.props.type))
|
|
25
|
+
return;
|
|
26
|
+
node.on("created", () => {
|
|
27
|
+
if (node.props.definition?.schema) {
|
|
28
|
+
const schemaFn = node.props.definition?.schema;
|
|
29
|
+
node.props.definition.schema = (sectionsSchema = {}) => {
|
|
30
|
+
sectionsSchema.label = {
|
|
31
|
+
children: [{
|
|
32
|
+
$el: "span",
|
|
33
|
+
attrs: {
|
|
34
|
+
title: "$help",
|
|
35
|
+
class: "p-formkit-label"
|
|
36
|
+
},
|
|
37
|
+
children: ["$label"]
|
|
38
|
+
}, {
|
|
39
|
+
$el: "span",
|
|
40
|
+
if: "$state.required",
|
|
41
|
+
attrs: {
|
|
42
|
+
class: "p-formkit-required",
|
|
43
|
+
title: "$help"
|
|
44
|
+
},
|
|
45
|
+
children: ["*"]
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
sectionsSchema.help = {
|
|
49
|
+
children: []
|
|
50
|
+
};
|
|
51
|
+
return schemaFn(sectionsSchema);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|