@sfxcode/formkit-primevue 3.3.1 → 3.3.3
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 +138 -13
- package/components.d.ts +1 -0
- package/dist/components/FormKitDataDebug.d.vue.ts +24 -0
- package/dist/components/FormKitDataDebug.vue +23 -0
- package/dist/components/FormKitDataDebug.vue.d.ts +24 -0
- package/dist/components/FormKitDataEdit.d.vue.ts +180 -0
- package/dist/components/FormKitDataEdit.vue +126 -0
- package/dist/components/FormKitDataEdit.vue.d.ts +180 -0
- package/dist/components/FormKitDataView.d.vue.ts +73 -0
- package/dist/components/FormKitDataView.vue +58 -0
- package/dist/components/FormKitDataView.vue.d.ts +73 -0
- package/dist/components/FormKitIcon.d.vue.ts +39 -0
- package/dist/components/FormKitIcon.vue +25 -0
- package/dist/components/FormKitIcon.vue.d.ts +39 -0
- package/dist/components/FormKitPrefix.d.vue.ts +7 -0
- package/dist/components/FormKitPrefix.vue +11 -0
- package/dist/components/FormKitPrefix.vue.d.ts +7 -0
- package/dist/components/FormKitSuffix.d.vue.ts +7 -0
- package/dist/components/FormKitSuffix.vue +11 -0
- package/dist/components/FormKitSuffix.vue.d.ts +7 -0
- package/dist/components/PrimeAutoComplete.d.vue.ts +31 -0
- package/dist/components/PrimeAutoComplete.vue +140 -0
- package/dist/components/PrimeAutoComplete.vue.d.ts +31 -0
- package/dist/components/PrimeCascadeSelect.d.vue.ts +28 -0
- package/dist/components/PrimeCascadeSelect.vue +62 -0
- package/dist/components/PrimeCascadeSelect.vue.d.ts +28 -0
- package/dist/components/PrimeCheckbox.d.vue.ts +27 -0
- package/dist/components/PrimeCheckbox.vue +71 -0
- package/dist/components/PrimeCheckbox.vue.d.ts +27 -0
- package/dist/components/PrimeColorPicker.d.vue.ts +24 -0
- package/dist/components/PrimeColorPicker.vue +48 -0
- package/dist/components/PrimeColorPicker.vue.d.ts +24 -0
- package/dist/components/PrimeDatePicker.d.vue.ts +63 -0
- package/dist/components/PrimeDatePicker.vue +153 -0
- package/dist/components/PrimeDatePicker.vue.d.ts +63 -0
- package/dist/components/PrimeInputMask.d.vue.ts +28 -0
- package/dist/components/PrimeInputMask.vue +88 -0
- package/dist/components/PrimeInputMask.vue.d.ts +28 -0
- package/dist/components/PrimeInputNumber.d.vue.ts +36 -0
- package/dist/components/PrimeInputNumber.vue +110 -0
- package/dist/components/PrimeInputNumber.vue.d.ts +36 -0
- package/dist/components/PrimeInputOtp.d.vue.ts +26 -0
- package/dist/components/PrimeInputOtp.vue +59 -0
- package/dist/components/PrimeInputOtp.vue.d.ts +26 -0
- package/dist/components/PrimeInputText.d.vue.ts +24 -0
- package/dist/components/PrimeInputText.vue +80 -0
- package/dist/components/PrimeInputText.vue.d.ts +24 -0
- package/dist/components/PrimeKnob.d.vue.ts +31 -0
- package/dist/components/PrimeKnob.vue +75 -0
- package/dist/components/PrimeKnob.vue.d.ts +31 -0
- package/dist/components/PrimeListbox.d.vue.ts +42 -0
- package/dist/components/PrimeListbox.vue +86 -0
- package/dist/components/PrimeListbox.vue.d.ts +42 -0
- package/dist/components/PrimeMultiSelect.d.vue.ts +53 -0
- package/dist/components/PrimeMultiSelect.vue +115 -0
- package/dist/components/PrimeMultiSelect.vue.d.ts +53 -0
- package/dist/components/PrimeOutputBoolean.d.vue.ts +16 -0
- package/dist/components/PrimeOutputBoolean.vue +41 -0
- package/dist/components/PrimeOutputBoolean.vue.d.ts +16 -0
- package/dist/components/PrimeOutputDate.d.vue.ts +16 -0
- package/dist/components/PrimeOutputDate.vue +51 -0
- package/dist/components/PrimeOutputDate.vue.d.ts +16 -0
- package/dist/components/PrimeOutputDuration.d.vue.ts +16 -0
- package/dist/components/PrimeOutputDuration.vue +32 -0
- package/dist/components/PrimeOutputDuration.vue.d.ts +16 -0
- package/dist/components/PrimeOutputLink.d.vue.ts +16 -0
- package/dist/components/PrimeOutputLink.vue +50 -0
- package/dist/components/PrimeOutputLink.vue.d.ts +16 -0
- package/dist/components/PrimeOutputList.d.vue.ts +19 -0
- package/dist/components/PrimeOutputList.vue +75 -0
- package/dist/components/PrimeOutputList.vue.d.ts +19 -0
- package/dist/components/PrimeOutputNumber.d.vue.ts +16 -0
- package/dist/components/PrimeOutputNumber.vue +59 -0
- package/dist/components/PrimeOutputNumber.vue.d.ts +16 -0
- package/dist/components/PrimeOutputReference.d.vue.ts +16 -0
- package/dist/components/PrimeOutputReference.vue +62 -0
- package/dist/components/PrimeOutputReference.vue.d.ts +16 -0
- package/dist/components/PrimeOutputText.d.vue.ts +22 -0
- package/dist/components/PrimeOutputText.vue +72 -0
- package/dist/components/PrimeOutputText.vue.d.ts +22 -0
- package/dist/components/PrimePassword.d.vue.ts +33 -0
- package/dist/components/PrimePassword.vue +73 -0
- package/dist/components/PrimePassword.vue.d.ts +33 -0
- package/dist/components/PrimeRadioButton.d.vue.ts +28 -0
- package/dist/components/PrimeRadioButton.vue +58 -0
- package/dist/components/PrimeRadioButton.vue.d.ts +28 -0
- package/dist/components/PrimeRating.d.vue.ts +24 -0
- package/dist/components/PrimeRating.vue +55 -0
- package/dist/components/PrimeRating.vue.d.ts +24 -0
- package/dist/components/PrimeSelect.d.vue.ts +50 -0
- package/dist/components/PrimeSelect.vue +113 -0
- package/dist/components/PrimeSelect.vue.d.ts +50 -0
- package/dist/components/PrimeSelectButton.d.vue.ts +28 -0
- package/dist/components/PrimeSelectButton.vue +64 -0
- package/dist/components/PrimeSelectButton.vue.d.ts +28 -0
- package/dist/components/PrimeSlider.d.vue.ts +26 -0
- package/dist/components/PrimeSlider.vue +60 -0
- package/dist/components/PrimeSlider.vue.d.ts +26 -0
- package/dist/components/PrimeTextarea.d.vue.ts +25 -0
- package/dist/components/PrimeTextarea.vue +53 -0
- package/dist/components/PrimeTextarea.vue.d.ts +25 -0
- package/dist/components/PrimeToggleButton.d.vue.ts +26 -0
- package/dist/components/PrimeToggleButton.vue +60 -0
- package/dist/components/PrimeToggleButton.vue.d.ts +26 -0
- package/dist/components/PrimeToggleSwitch.d.vue.ts +23 -0
- package/dist/components/PrimeToggleSwitch.vue +57 -0
- package/dist/components/PrimeToggleSwitch.vue.d.ts +23 -0
- package/dist/components/PrimeTreeSelect.d.vue.ts +32 -0
- package/dist/components/PrimeTreeSelect.vue +71 -0
- package/dist/components/PrimeTreeSelect.vue.d.ts +32 -0
- package/dist/components/index.d.ts +24 -2
- package/dist/components/index.js +167 -4
- package/dist/components/index.mjs +48 -0
- package/dist/composables/index.d.ts +9 -2
- package/dist/composables/index.js +61 -2
- package/dist/composables/index.mjs +18 -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 +15 -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/composables/usePrimeInputs.d.ts +3 -0
- package/dist/composables/usePrimeInputs.js +62 -0
- package/dist/composables/usePrimeInputs.mjs +53 -0
- package/dist/definitions/index.d.ts +32 -37
- package/dist/definitions/index.js +42 -4
- package/dist/definitions/index.mjs +68 -0
- package/dist/definitions/input.d.ts +47 -0
- package/dist/definitions/input.js +142 -0
- package/dist/definitions/input.mjs +135 -0
- package/dist/definitions/output.d.ts +9 -0
- package/dist/definitions/output.js +46 -0
- package/dist/definitions/output.mjs +39 -0
- package/dist/index.d.ts +143 -146
- package/dist/index.js +62 -5
- package/dist/index.mjs +14 -0
- package/dist/plugins/index.d.ts +3 -7
- package/dist/plugins/index.js +57 -45
- package/dist/plugins/index.mjs +55 -0
- package/dist/sass/formkit-primevue.scss +101 -99
- package/package.json +115 -30
- package/dist/PrimeTreeSelect-Dksx7tL-.js +0 -1881
- package/dist/components-HJnJ39cU.js +0 -255
- package/dist/composables-CZ6f1QYe.js +0 -820
- package/dist/definitions-BHwWaom7.js +0 -1196
- package/dist/index-Ch3MtT1C.d.ts +0 -266
- package/dist/index-EJ8M51RO.d.ts +0 -917
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useFormKitSchema } from "./useFormKitSchema.mjs";
|
|
2
|
+
export function useFormKitRepeater() {
|
|
3
|
+
const { addElement, addComponent, addElementsInOuterDiv } = useFormKitSchema();
|
|
4
|
+
function addInsertButton(label = "Add", innerClass = "", outerClass = "", buttonClass = "p-button-sm", iconClass = "pi pi-plus") {
|
|
5
|
+
return addElementsInOuterDiv([
|
|
6
|
+
addComponent("Button", { onClick: "$addNode($node)", label, class: buttonClass, icon: iconClass }, "$node.children.length == 0")
|
|
7
|
+
], innerClass, outerClass);
|
|
8
|
+
}
|
|
9
|
+
function addListGroupFunctions(data, addNodeDefaultObject = {}) {
|
|
10
|
+
const swapElements = (array, index1, index2) => {
|
|
11
|
+
const newArray = [...array];
|
|
12
|
+
const temp = newArray[index1];
|
|
13
|
+
newArray[index1] = newArray[index2];
|
|
14
|
+
newArray[index2] = temp;
|
|
15
|
+
return newArray;
|
|
16
|
+
};
|
|
17
|
+
data.addNode = (parentNode) => () => {
|
|
18
|
+
const newArray = [...parentNode.value, addNodeDefaultObject];
|
|
19
|
+
parentNode.input(newArray, false);
|
|
20
|
+
};
|
|
21
|
+
data.removeNode = (parentNode, index) => () => {
|
|
22
|
+
parentNode.input(parentNode._value.filter((_, i) => i !== index), false);
|
|
23
|
+
};
|
|
24
|
+
data.moveNodeUp = (parentNode, index) => () => {
|
|
25
|
+
const array = [...parentNode.value];
|
|
26
|
+
if (index > 0)
|
|
27
|
+
parentNode.input(swapElements(array, index - 1, index), false);
|
|
28
|
+
};
|
|
29
|
+
data.moveNodeDown = (parentNode, index) => () => {
|
|
30
|
+
const array = [...parentNode.value];
|
|
31
|
+
if (index < array.length - 1)
|
|
32
|
+
parentNode.input(swapElements(array, index, index + 1), false);
|
|
33
|
+
};
|
|
34
|
+
data.copyNode = (parentNode, index) => () => {
|
|
35
|
+
const obj = parentNode.value[index];
|
|
36
|
+
const newArray = [...parentNode.value, { ...obj }];
|
|
37
|
+
parentNode.input(newArray, false);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function addGroupButtons(innerClass = "", outerClass = "col-4", label = "Actions", help = "", render = "true") {
|
|
41
|
+
const addButtonComponent = (onClick = "", label2 = "", icon = "", severity = "", render2 = "true", styleClass = "p-button-sm") => {
|
|
42
|
+
return addComponent("Button", { onClick, label: label2, icon, class: styleClass, severity }, render2);
|
|
43
|
+
};
|
|
44
|
+
return addElementsInOuterDiv([
|
|
45
|
+
addButtonComponent("$removeNode($node.parent, $index)", "", "pi pi-times", "danger"),
|
|
46
|
+
addButtonComponent("$copyNode($node.parent, $index)", "", "pi pi-plus"),
|
|
47
|
+
addButtonComponent("$moveNodeUp($node.parent, $index)", "", "pi pi-arrow-up", "secondary", "$index != 0"),
|
|
48
|
+
addElement("span", [], { class: "p-space" }, "$index == 0"),
|
|
49
|
+
addButtonComponent("$moveNodeDown($node.parent, $index)", "", "pi pi-arrow-down", "secondary", "$index < $node.parent.value.length -1"),
|
|
50
|
+
addElement("span", [], { class: "p-space" }, "$index == $node.parent.value.length -1")
|
|
51
|
+
], `p-action-buttons ${innerClass}`, outerClass, label, help, render);
|
|
52
|
+
}
|
|
53
|
+
return { addInsertButton, addGroupButtons, addListGroupFunctions };
|
|
54
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare function useFormKitSchema(): {
|
|
2
|
+
addComponent: (component?: string, props?: object, render?: string | boolean, formKitAttrs?: object) => object;
|
|
3
|
+
addElement: (element?: string, children?: any[] | string, attrs?: object, render?: string | boolean, formKitAttrs?: object) => {
|
|
4
|
+
$el: string;
|
|
5
|
+
if: string;
|
|
6
|
+
attrs: object;
|
|
7
|
+
children: string | any[];
|
|
8
|
+
};
|
|
9
|
+
addGroup: (name: string, children?: object[], render?: string | boolean, formKitAttrs?: object) => {
|
|
10
|
+
$formkit: string;
|
|
11
|
+
if: string;
|
|
12
|
+
name: string;
|
|
13
|
+
children: object[];
|
|
14
|
+
};
|
|
15
|
+
addList: (name: string, children?: object[], dynamic?: boolean, render?: string | boolean, formKitAttrs?: object) => {
|
|
16
|
+
$formkit: string;
|
|
17
|
+
if: string;
|
|
18
|
+
name: string;
|
|
19
|
+
dynamic: boolean;
|
|
20
|
+
children: object[];
|
|
21
|
+
};
|
|
22
|
+
addListGroup: (children?: object[], render?: string | boolean, formKitAttrs?: object) => {
|
|
23
|
+
$formkit: string;
|
|
24
|
+
if: string;
|
|
25
|
+
for: string[];
|
|
26
|
+
key: string;
|
|
27
|
+
index: string;
|
|
28
|
+
children: object[];
|
|
29
|
+
};
|
|
30
|
+
addElementsInOuterDiv: (children?: object[], innerClass?: string, outerClass?: string, label?: string, help?: string, render?: string | boolean) => {
|
|
31
|
+
$el: string;
|
|
32
|
+
if: string;
|
|
33
|
+
attrs: object;
|
|
34
|
+
children: string | any[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFormKitSchema = useFormKitSchema;
|
|
7
|
+
function useFormKitSchema() {
|
|
8
|
+
const addComponent = (component = "Button", props = {}, render = true, formKitAttrs = {}) => {
|
|
9
|
+
return {
|
|
10
|
+
$cmp: component,
|
|
11
|
+
if: render.toString(),
|
|
12
|
+
props,
|
|
13
|
+
...formKitAttrs
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const addElement = (element = "div", children = [], attrs = {}, render = true, formKitAttrs = {}) => {
|
|
17
|
+
return {
|
|
18
|
+
$el: element,
|
|
19
|
+
if: render.toString(),
|
|
20
|
+
attrs,
|
|
21
|
+
children,
|
|
22
|
+
...formKitAttrs
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const addGroup = (name, children = [], render = true, formKitAttrs = {}) => {
|
|
26
|
+
return {
|
|
27
|
+
$formkit: "group",
|
|
28
|
+
if: render.toString(),
|
|
29
|
+
name,
|
|
30
|
+
children,
|
|
31
|
+
...formKitAttrs
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const addList = (name, children = [], dynamic = true, render = true, formKitAttrs = {}) => {
|
|
35
|
+
return {
|
|
36
|
+
$formkit: "list",
|
|
37
|
+
if: render.toString(),
|
|
38
|
+
name,
|
|
39
|
+
dynamic,
|
|
40
|
+
children,
|
|
41
|
+
...formKitAttrs
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const addListGroup = (children = [], render = true, formKitAttrs = {}) => {
|
|
45
|
+
return {
|
|
46
|
+
$formkit: "group",
|
|
47
|
+
if: render.toString(),
|
|
48
|
+
for: ["item", "index", "$items"],
|
|
49
|
+
// 👈 $items is in the slot’s scope
|
|
50
|
+
key: "$item",
|
|
51
|
+
index: "$index",
|
|
52
|
+
children,
|
|
53
|
+
...formKitAttrs
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const addElementsInOuterDiv = (children = [], innerClass = "", outerClass = "", label = "", help = "", render = true) => {
|
|
57
|
+
const inner = addElement("div", children, {
|
|
58
|
+
class: `formkit-inner ${innerClass}`,
|
|
59
|
+
style: "position: relative;"
|
|
60
|
+
});
|
|
61
|
+
const labelDiv = addElement("label", [label], {
|
|
62
|
+
class: "formkit-label"
|
|
63
|
+
});
|
|
64
|
+
const wrapperDiv = addElement("div", [labelDiv, inner], {
|
|
65
|
+
class: "formkit-wrapper"
|
|
66
|
+
});
|
|
67
|
+
const helpDiv = addElement("div", [help], {
|
|
68
|
+
class: "formkit-help"
|
|
69
|
+
});
|
|
70
|
+
return addElement("div", [wrapperDiv, helpDiv], {
|
|
71
|
+
class: `formkit-outer ${outerClass}`,
|
|
72
|
+
style: "position: relative;"
|
|
73
|
+
}, render);
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
addComponent,
|
|
77
|
+
addElement,
|
|
78
|
+
addGroup,
|
|
79
|
+
addList,
|
|
80
|
+
addListGroup,
|
|
81
|
+
addElementsInOuterDiv
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function useFormKitSchema() {
|
|
2
|
+
const addComponent = (component = "Button", props = {}, render = true, formKitAttrs = {}) => {
|
|
3
|
+
return {
|
|
4
|
+
$cmp: component,
|
|
5
|
+
if: render.toString(),
|
|
6
|
+
props,
|
|
7
|
+
...formKitAttrs
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
const addElement = (element = "div", children = [], attrs = {}, render = true, formKitAttrs = {}) => {
|
|
11
|
+
return {
|
|
12
|
+
$el: element,
|
|
13
|
+
if: render.toString(),
|
|
14
|
+
attrs,
|
|
15
|
+
children,
|
|
16
|
+
...formKitAttrs
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const addGroup = (name, children = [], render = true, formKitAttrs = {}) => {
|
|
20
|
+
return {
|
|
21
|
+
$formkit: "group",
|
|
22
|
+
if: render.toString(),
|
|
23
|
+
name,
|
|
24
|
+
children,
|
|
25
|
+
...formKitAttrs
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const addList = (name, children = [], dynamic = true, render = true, formKitAttrs = {}) => {
|
|
29
|
+
return {
|
|
30
|
+
$formkit: "list",
|
|
31
|
+
if: render.toString(),
|
|
32
|
+
name,
|
|
33
|
+
dynamic,
|
|
34
|
+
children,
|
|
35
|
+
...formKitAttrs
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const addListGroup = (children = [], render = true, formKitAttrs = {}) => {
|
|
39
|
+
return {
|
|
40
|
+
$formkit: "group",
|
|
41
|
+
if: render.toString(),
|
|
42
|
+
for: ["item", "index", "$items"],
|
|
43
|
+
// 👈 $items is in the slot’s scope
|
|
44
|
+
key: "$item",
|
|
45
|
+
index: "$index",
|
|
46
|
+
children,
|
|
47
|
+
...formKitAttrs
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const addElementsInOuterDiv = (children = [], innerClass = "", outerClass = "", label = "", help = "", render = true) => {
|
|
51
|
+
const inner = addElement("div", children, { class: `formkit-inner ${innerClass}`, style: "position: relative;" });
|
|
52
|
+
const labelDiv = addElement("label", [label], { class: "formkit-label" });
|
|
53
|
+
const wrapperDiv = addElement("div", [labelDiv, inner], { class: "formkit-wrapper" });
|
|
54
|
+
const helpDiv = addElement("div", [help], { class: "formkit-help" });
|
|
55
|
+
return addElement("div", [wrapperDiv, helpDiv], { class: `formkit-outer ${outerClass}`, style: "position: relative;" }, render);
|
|
56
|
+
};
|
|
57
|
+
return { addComponent, addElement, addGroup, addList, addListGroup, addElementsInOuterDiv };
|
|
58
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function useFormKitSection(context: any): {
|
|
2
|
+
generateId: () => string;
|
|
3
|
+
hasPrefix: import("vue").ComputedRef<boolean>;
|
|
4
|
+
hasPrefixIcon: import("vue").ComputedRef<boolean>;
|
|
5
|
+
hasSuffix: import("vue").ComputedRef<boolean>;
|
|
6
|
+
hasSuffixIcon: import("vue").ComputedRef<boolean>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFormKitSection = useFormKitSection;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
function useFormKitSection(context) {
|
|
9
|
+
const hasPrefix = (0, _vue.computed)(() => {
|
|
10
|
+
return Boolean(context?.prefix?.length > 0);
|
|
11
|
+
});
|
|
12
|
+
const hasPrefixIcon = (0, _vue.computed)(() => {
|
|
13
|
+
return Boolean(context?.iconPrefix?.length > 0);
|
|
14
|
+
});
|
|
15
|
+
const hasSuffixIcon = (0, _vue.computed)(() => {
|
|
16
|
+
return Boolean(context?.iconSuffix?.length > 0);
|
|
17
|
+
});
|
|
18
|
+
const hasSuffix = (0, _vue.computed)(() => {
|
|
19
|
+
return Boolean(context?.suffix?.length > 0);
|
|
20
|
+
});
|
|
21
|
+
function generateId() {
|
|
22
|
+
return typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
generateId,
|
|
26
|
+
hasPrefix,
|
|
27
|
+
hasPrefixIcon,
|
|
28
|
+
hasSuffix,
|
|
29
|
+
hasSuffixIcon
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
export function useFormKitSection(context) {
|
|
3
|
+
const hasPrefix = computed(() => {
|
|
4
|
+
return Boolean(context?.prefix?.length > 0);
|
|
5
|
+
});
|
|
6
|
+
const hasPrefixIcon = computed(() => {
|
|
7
|
+
return Boolean(context?.iconPrefix?.length > 0);
|
|
8
|
+
});
|
|
9
|
+
const hasSuffixIcon = computed(() => {
|
|
10
|
+
return Boolean(context?.iconSuffix?.length > 0);
|
|
11
|
+
});
|
|
12
|
+
const hasSuffix = computed(() => {
|
|
13
|
+
return Boolean(context?.suffix?.length > 0);
|
|
14
|
+
});
|
|
15
|
+
function generateId() {
|
|
16
|
+
return typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
17
|
+
}
|
|
18
|
+
return { generateId, hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon };
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function useInputEditor(): {
|
|
2
|
+
primeInputNames: string[];
|
|
3
|
+
primeOutputNames: string[];
|
|
4
|
+
editorDataToSchema: (data: any) => any;
|
|
5
|
+
editorDataToJson: (data: any) => string;
|
|
6
|
+
editorDataToCode: (data: any) => string;
|
|
7
|
+
schemaToEditorData: (schema: any) => any;
|
|
8
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useInputEditor = useInputEditor;
|
|
7
|
+
function useInputEditor() {
|
|
8
|
+
const primeInputWithOptionNames = ["CascadeSelect", "Listbox", "MultiSelect", "RadioButton", "Select", "SelectButton", "TreeSelect"];
|
|
9
|
+
const primeInputNames = [...primeInputWithOptionNames, "AutoComplete", "Checkbox", "ColorPicker", "DatePicker", "Editor", "InputMask", "InputNumber", "InputOtp", "InputText", "Knob", "Password", "Rating", "Slider", "Textarea", "ToggleButton", "ToggleSwitch"].sort();
|
|
10
|
+
const primeOutputNames = ["OutputBoolean", "OutputDate", "OutputDuration", "OutputLink", "OutputList", "OutputNumber", "OutputReference", "OutputText"];
|
|
11
|
+
function editorDataToSchema(data) {
|
|
12
|
+
if (!data) return {};
|
|
13
|
+
const formkitInput = data?._dollar_formkit;
|
|
14
|
+
let tempData = {};
|
|
15
|
+
if (data.prime && Array.isArray(data.prime) && data.prime.length > 0) {
|
|
16
|
+
const mapped = data.prime.filter(entry => entry && typeof entry === "object" && "prime_key" in entry && "prime_value" in entry).map(entry => {
|
|
17
|
+
const key = entry.prime_key || "";
|
|
18
|
+
let value = entry.prime_value;
|
|
19
|
+
if (formkitInput === "primeInputOtp" && key === "length" && value !== void 0) {
|
|
20
|
+
value = Number(value);
|
|
21
|
+
}
|
|
22
|
+
return [key, value];
|
|
23
|
+
});
|
|
24
|
+
tempData = {
|
|
25
|
+
...Object.fromEntries(mapped)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const readonlyValue = data.readonly === true ? true : void 0;
|
|
29
|
+
const disabledValue = data.disabled === true ? true : void 0;
|
|
30
|
+
const preserveValue = data.preserve === true ? true : void 0;
|
|
31
|
+
const defaultObject = {
|
|
32
|
+
readonly: readonlyValue,
|
|
33
|
+
disabled: disabledValue,
|
|
34
|
+
preserve: preserveValue
|
|
35
|
+
};
|
|
36
|
+
let outerClass = "";
|
|
37
|
+
if (data.outerClass) outerClass = `${outerClass} ${data.outerClass}`.trim();
|
|
38
|
+
let wrapperClass = "";
|
|
39
|
+
if (data.wrapperClass) wrapperClass = `${wrapperClass} ${data.wrapperClass}`.trim();
|
|
40
|
+
let innerClass = "";
|
|
41
|
+
if (data.innerClass) innerClass = `${innerClass} ${data.innerClass}`.trim();
|
|
42
|
+
const undefinedObject = {
|
|
43
|
+
prime: void 0,
|
|
44
|
+
schemaResultFormKey: void 0,
|
|
45
|
+
_dollar_formkit: void 0,
|
|
46
|
+
slots: void 0,
|
|
47
|
+
selectButton: void 0
|
|
48
|
+
};
|
|
49
|
+
const useOptions = formkitInput ? primeInputWithOptionNames.map(s => `prime${s}`).includes(formkitInput) : false;
|
|
50
|
+
let result;
|
|
51
|
+
if (useOptions) {
|
|
52
|
+
result = {
|
|
53
|
+
...data,
|
|
54
|
+
$formkit: formkitInput,
|
|
55
|
+
...tempData,
|
|
56
|
+
...undefinedObject,
|
|
57
|
+
...defaultObject,
|
|
58
|
+
outerClass,
|
|
59
|
+
wrapperClass,
|
|
60
|
+
innerClass,
|
|
61
|
+
optionLabel: "label",
|
|
62
|
+
optionValue: "value"
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
result = {
|
|
66
|
+
...data,
|
|
67
|
+
$formkit: formkitInput,
|
|
68
|
+
...tempData,
|
|
69
|
+
...undefinedObject,
|
|
70
|
+
...defaultObject,
|
|
71
|
+
outerClass,
|
|
72
|
+
wrapperClass,
|
|
73
|
+
innerClass,
|
|
74
|
+
options: void 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
for (const key in result) {
|
|
78
|
+
const value = result[key];
|
|
79
|
+
if (value !== null && value !== void 0 && typeof value === "string") {
|
|
80
|
+
if (value.trim().length === 0) {
|
|
81
|
+
result[key] = void 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
function dataToSchema(data) {
|
|
88
|
+
if (!data) return {};
|
|
89
|
+
const schema = editorDataToSchema(data);
|
|
90
|
+
if (schema?.options && Array.isArray(schema.options)) {
|
|
91
|
+
const options = schema.options.map(o => o ? JSON.parse(JSON.stringify(o)) : {});
|
|
92
|
+
return {
|
|
93
|
+
...schema,
|
|
94
|
+
options
|
|
95
|
+
};
|
|
96
|
+
} else {
|
|
97
|
+
return schema;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function editorDataToJson(data) {
|
|
101
|
+
if (!data) return "{}";
|
|
102
|
+
return JSON.stringify(dataToSchema(data));
|
|
103
|
+
}
|
|
104
|
+
function objectToString(data) {
|
|
105
|
+
if (!data) return "{}";
|
|
106
|
+
return `{${Object.entries(data).map(([key, value]) => {
|
|
107
|
+
if (key === "options" && Array.isArray(value) && value.length > 0) {
|
|
108
|
+
let result = "[";
|
|
109
|
+
value.forEach(o => {
|
|
110
|
+
if (o && typeof o === "object") {
|
|
111
|
+
result = `${result + objectToString(o)}, `;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return `${key}: ${result.substring(0, result.length - 2)}]`;
|
|
115
|
+
} else if (key === "primeInputOtp") {
|
|
116
|
+
return `${key}: ${value}`;
|
|
117
|
+
} else {
|
|
118
|
+
return `${key}: '${value}'`;
|
|
119
|
+
}
|
|
120
|
+
}).join()}}`;
|
|
121
|
+
}
|
|
122
|
+
function editorDataToObject(data) {
|
|
123
|
+
if (!data) return "{}";
|
|
124
|
+
try {
|
|
125
|
+
const jsonData = editorDataToJson(data);
|
|
126
|
+
return objectToString(JSON.parse(jsonData));
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error("Error in editorDataToObject:", error);
|
|
129
|
+
return "{}";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function schemaToEditorData(schema) {
|
|
133
|
+
if (!schema) return {};
|
|
134
|
+
const formkitInput = schema?.$formkit;
|
|
135
|
+
return {
|
|
136
|
+
...schema,
|
|
137
|
+
_dollar_formkit: formkitInput
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
primeInputNames,
|
|
142
|
+
primeOutputNames,
|
|
143
|
+
editorDataToSchema,
|
|
144
|
+
editorDataToJson,
|
|
145
|
+
editorDataToCode: editorDataToObject,
|
|
146
|
+
schemaToEditorData
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export function useInputEditor() {
|
|
2
|
+
const primeInputWithOptionNames = ["CascadeSelect", "Listbox", "MultiSelect", "RadioButton", "Select", "SelectButton", "TreeSelect"];
|
|
3
|
+
const primeInputNames = [...primeInputWithOptionNames, "AutoComplete", "Checkbox", "ColorPicker", "DatePicker", "Editor", "InputMask", "InputNumber", "InputOtp", "InputText", "Knob", "Password", "Rating", "Slider", "Textarea", "ToggleButton", "ToggleSwitch"].sort();
|
|
4
|
+
const primeOutputNames = ["OutputBoolean", "OutputDate", "OutputDuration", "OutputLink", "OutputList", "OutputNumber", "OutputReference", "OutputText"];
|
|
5
|
+
function editorDataToSchema(data) {
|
|
6
|
+
if (!data)
|
|
7
|
+
return {};
|
|
8
|
+
const formkitInput = data?._dollar_formkit;
|
|
9
|
+
let tempData = {};
|
|
10
|
+
if (data.prime && Array.isArray(data.prime) && data.prime.length > 0) {
|
|
11
|
+
const mapped = data.prime.filter((entry) => entry && typeof entry === "object" && "prime_key" in entry && "prime_value" in entry).map((entry) => {
|
|
12
|
+
const key = entry.prime_key || "";
|
|
13
|
+
let value = entry.prime_value;
|
|
14
|
+
if (formkitInput === "primeInputOtp" && key === "length" && value !== void 0) {
|
|
15
|
+
value = Number(value);
|
|
16
|
+
}
|
|
17
|
+
return [key, value];
|
|
18
|
+
});
|
|
19
|
+
tempData = { ...Object.fromEntries(mapped) };
|
|
20
|
+
}
|
|
21
|
+
const readonlyValue = data.readonly === true ? true : void 0;
|
|
22
|
+
const disabledValue = data.disabled === true ? true : void 0;
|
|
23
|
+
const preserveValue = data.preserve === true ? true : void 0;
|
|
24
|
+
const defaultObject = {
|
|
25
|
+
readonly: readonlyValue,
|
|
26
|
+
disabled: disabledValue,
|
|
27
|
+
preserve: preserveValue
|
|
28
|
+
};
|
|
29
|
+
let outerClass = "";
|
|
30
|
+
if (data.outerClass)
|
|
31
|
+
outerClass = `${outerClass} ${data.outerClass}`.trim();
|
|
32
|
+
let wrapperClass = "";
|
|
33
|
+
if (data.wrapperClass)
|
|
34
|
+
wrapperClass = `${wrapperClass} ${data.wrapperClass}`.trim();
|
|
35
|
+
let innerClass = "";
|
|
36
|
+
if (data.innerClass)
|
|
37
|
+
innerClass = `${innerClass} ${data.innerClass}`.trim();
|
|
38
|
+
const undefinedObject = {
|
|
39
|
+
prime: void 0,
|
|
40
|
+
schemaResultFormKey: void 0,
|
|
41
|
+
_dollar_formkit: void 0,
|
|
42
|
+
slots: void 0,
|
|
43
|
+
selectButton: void 0
|
|
44
|
+
};
|
|
45
|
+
const useOptions = formkitInput ? primeInputWithOptionNames.map((s) => `prime${s}`).includes(formkitInput) : false;
|
|
46
|
+
let result;
|
|
47
|
+
if (useOptions) {
|
|
48
|
+
result = {
|
|
49
|
+
...data,
|
|
50
|
+
$formkit: formkitInput,
|
|
51
|
+
...tempData,
|
|
52
|
+
...undefinedObject,
|
|
53
|
+
...defaultObject,
|
|
54
|
+
outerClass,
|
|
55
|
+
wrapperClass,
|
|
56
|
+
innerClass,
|
|
57
|
+
optionLabel: "label",
|
|
58
|
+
optionValue: "value"
|
|
59
|
+
};
|
|
60
|
+
} else {
|
|
61
|
+
result = {
|
|
62
|
+
...data,
|
|
63
|
+
$formkit: formkitInput,
|
|
64
|
+
...tempData,
|
|
65
|
+
...undefinedObject,
|
|
66
|
+
...defaultObject,
|
|
67
|
+
outerClass,
|
|
68
|
+
wrapperClass,
|
|
69
|
+
innerClass,
|
|
70
|
+
options: void 0
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
for (const key in result) {
|
|
74
|
+
const value = result[key];
|
|
75
|
+
if (value !== null && value !== void 0 && typeof value === "string") {
|
|
76
|
+
if (value.trim().length === 0) {
|
|
77
|
+
result[key] = void 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
function dataToSchema(data) {
|
|
84
|
+
if (!data)
|
|
85
|
+
return {};
|
|
86
|
+
const schema = editorDataToSchema(data);
|
|
87
|
+
if (schema?.options && Array.isArray(schema.options)) {
|
|
88
|
+
const options = schema.options.map((o) => o ? JSON.parse(JSON.stringify(o)) : {});
|
|
89
|
+
return { ...schema, options };
|
|
90
|
+
} else {
|
|
91
|
+
return schema;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function editorDataToJson(data) {
|
|
95
|
+
if (!data)
|
|
96
|
+
return "{}";
|
|
97
|
+
return JSON.stringify(dataToSchema(data));
|
|
98
|
+
}
|
|
99
|
+
function objectToString(data) {
|
|
100
|
+
if (!data)
|
|
101
|
+
return "{}";
|
|
102
|
+
return `{${Object.entries(data).map(([key, value]) => {
|
|
103
|
+
if (key === "options" && Array.isArray(value) && value.length > 0) {
|
|
104
|
+
let result = "[";
|
|
105
|
+
value.forEach((o) => {
|
|
106
|
+
if (o && typeof o === "object") {
|
|
107
|
+
result = `${result + objectToString(o)}, `;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return `${key}: ${result.substring(0, result.length - 2)}]`;
|
|
111
|
+
} else if (key === "primeInputOtp") {
|
|
112
|
+
return `${key}: ${value}`;
|
|
113
|
+
} else {
|
|
114
|
+
return `${key}: '${value}'`;
|
|
115
|
+
}
|
|
116
|
+
}).join()}}`;
|
|
117
|
+
}
|
|
118
|
+
function editorDataToObject(data) {
|
|
119
|
+
if (!data)
|
|
120
|
+
return "{}";
|
|
121
|
+
try {
|
|
122
|
+
const jsonData = editorDataToJson(data);
|
|
123
|
+
return objectToString(JSON.parse(jsonData));
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error("Error in editorDataToObject:", error);
|
|
126
|
+
return "{}";
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function schemaToEditorData(schema) {
|
|
130
|
+
if (!schema)
|
|
131
|
+
return {};
|
|
132
|
+
const formkitInput = schema?.$formkit;
|
|
133
|
+
return { ...schema, _dollar_formkit: formkitInput };
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
primeInputNames,
|
|
137
|
+
primeOutputNames,
|
|
138
|
+
editorDataToSchema,
|
|
139
|
+
editorDataToJson,
|
|
140
|
+
editorDataToCode: editorDataToObject,
|
|
141
|
+
schemaToEditorData
|
|
142
|
+
};
|
|
143
|
+
}
|