@sfxcode/formkit-primevue 3.3.3 → 3.3.4
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/README.md +13 -138
- package/dist/components/FormKitDataDebug.vue +5 -9
- package/dist/components/FormKitDataEdit.vue +53 -46
- package/dist/components/FormKitDataView.vue +20 -27
- package/dist/components/FormKitIcon.vue +6 -13
- package/dist/components/FormKitPrefix.vue +3 -3
- package/dist/components/FormKitSuffix.vue +3 -3
- package/dist/components/PrimeAutoComplete.vue +41 -86
- package/dist/components/PrimeCascadeSelect.vue +7 -26
- package/dist/components/PrimeCheckbox.vue +9 -29
- package/dist/components/PrimeColorPicker.vue +7 -22
- package/dist/components/PrimeDatePicker.vue +17 -73
- package/dist/components/PrimeInputMask.vue +10 -29
- package/dist/components/PrimeInputNumber.vue +21 -56
- package/dist/components/PrimeInputOtp.vue +7 -24
- package/dist/components/PrimeInputText.vue +10 -25
- package/dist/components/PrimeKnob.vue +12 -37
- package/dist/components/PrimeListbox.vue +7 -39
- package/dist/components/PrimeMultiSelect.vue +7 -52
- package/dist/components/PrimeOutputBoolean.vue +28 -27
- package/dist/components/PrimeOutputDate.vue +33 -33
- package/dist/components/PrimeOutputDuration.vue +23 -19
- package/dist/components/PrimeOutputLink.vue +29 -27
- package/dist/components/PrimeOutputList.vue +71 -40
- package/dist/components/PrimeOutputNumber.vue +36 -39
- package/dist/components/PrimeOutputReference.vue +32 -30
- package/dist/components/PrimeOutputText.vue +53 -53
- package/dist/components/PrimePassword.vue +11 -32
- package/dist/components/PrimeRadioButton.vue +19 -29
- package/dist/components/PrimeRating.vue +7 -22
- package/dist/components/PrimeSelect.vue +7 -49
- package/dist/components/PrimeSelectButton.vue +7 -27
- package/dist/components/PrimeSlider.vue +10 -28
- package/dist/components/PrimeTextarea.vue +7 -23
- package/dist/components/PrimeToggleButton.vue +7 -25
- package/dist/components/PrimeToggleSwitch.vue +8 -23
- package/dist/components/PrimeTreeSelect.vue +7 -30
- package/dist/components/index.d.ts +23 -23
- package/dist/composables/index.d.ts +8 -8
- package/dist/composables/index.js +8 -8
- package/dist/composables/index.mjs +8 -8
- package/dist/composables/useFormKitInput.js +5 -1
- package/dist/composables/useFormKitInput.mjs +13 -1
- package/dist/composables/useFormKitRepeater.js +1 -1
- package/dist/composables/useFormKitRepeater.mjs +45 -17
- package/dist/composables/useFormKitSchema.mjs +10 -2
- package/dist/composables/useInputEditor.js +4 -4
- package/dist/composables/useInputEditor.mjs +52 -24
- package/dist/composables/useInputEditorSchema.js +3 -3
- package/dist/composables/useInputEditorSchema.mjs +25 -17
- package/dist/composables/useOutputDuration.mjs +3 -6
- package/dist/definitions/index.js +2 -2
- package/dist/definitions/index.mjs +2 -2
- package/dist/definitions/input.d.ts +1 -1
- package/dist/definitions/input.mjs +301 -15
- package/dist/definitions/output.d.ts +1 -1
- package/dist/definitions/output.js +1 -1
- package/dist/definitions/output.mjs +95 -14
- package/dist/index.d.ts +48 -48
- package/dist/index.js +12 -12
- package/dist/index.mjs +9 -3
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.mjs +31 -27
- package/dist/sass/formkit-primevue.scss +99 -101
- package/dist/vue.d.ts +5 -0
- package/package.json +51 -88
- package/LICENSE +0 -21
- package/components.d.ts +0 -1
- package/dist/components/FormKitDataDebug.d.vue.ts +0 -24
- package/dist/components/FormKitDataDebug.vue.d.ts +0 -24
- package/dist/components/FormKitDataEdit.d.vue.ts +0 -180
- package/dist/components/FormKitDataEdit.vue.d.ts +0 -180
- package/dist/components/FormKitDataView.d.vue.ts +0 -73
- package/dist/components/FormKitDataView.vue.d.ts +0 -73
- package/dist/components/FormKitIcon.d.vue.ts +0 -39
- package/dist/components/FormKitIcon.vue.d.ts +0 -39
- package/dist/components/FormKitPrefix.d.vue.ts +0 -7
- package/dist/components/FormKitPrefix.vue.d.ts +0 -7
- package/dist/components/FormKitSuffix.d.vue.ts +0 -7
- package/dist/components/FormKitSuffix.vue.d.ts +0 -7
- package/dist/components/PrimeAutoComplete.d.vue.ts +0 -31
- package/dist/components/PrimeAutoComplete.vue.d.ts +0 -31
- package/dist/components/PrimeCascadeSelect.d.vue.ts +0 -28
- package/dist/components/PrimeCascadeSelect.vue.d.ts +0 -28
- package/dist/components/PrimeCheckbox.d.vue.ts +0 -27
- package/dist/components/PrimeCheckbox.vue.d.ts +0 -27
- package/dist/components/PrimeColorPicker.d.vue.ts +0 -24
- package/dist/components/PrimeColorPicker.vue.d.ts +0 -24
- package/dist/components/PrimeDatePicker.d.vue.ts +0 -63
- package/dist/components/PrimeDatePicker.vue.d.ts +0 -63
- package/dist/components/PrimeInputMask.d.vue.ts +0 -28
- package/dist/components/PrimeInputMask.vue.d.ts +0 -28
- package/dist/components/PrimeInputNumber.d.vue.ts +0 -36
- package/dist/components/PrimeInputNumber.vue.d.ts +0 -36
- package/dist/components/PrimeInputOtp.d.vue.ts +0 -26
- package/dist/components/PrimeInputOtp.vue.d.ts +0 -26
- package/dist/components/PrimeInputText.d.vue.ts +0 -24
- package/dist/components/PrimeInputText.vue.d.ts +0 -24
- package/dist/components/PrimeKnob.d.vue.ts +0 -31
- package/dist/components/PrimeKnob.vue.d.ts +0 -31
- package/dist/components/PrimeListbox.d.vue.ts +0 -42
- package/dist/components/PrimeListbox.vue.d.ts +0 -42
- package/dist/components/PrimeMultiSelect.d.vue.ts +0 -53
- package/dist/components/PrimeMultiSelect.vue.d.ts +0 -53
- package/dist/components/PrimeOutputBoolean.d.vue.ts +0 -16
- package/dist/components/PrimeOutputBoolean.vue.d.ts +0 -16
- package/dist/components/PrimeOutputDate.d.vue.ts +0 -16
- package/dist/components/PrimeOutputDate.vue.d.ts +0 -16
- package/dist/components/PrimeOutputDuration.d.vue.ts +0 -16
- package/dist/components/PrimeOutputDuration.vue.d.ts +0 -16
- package/dist/components/PrimeOutputLink.d.vue.ts +0 -16
- package/dist/components/PrimeOutputLink.vue.d.ts +0 -16
- package/dist/components/PrimeOutputList.d.vue.ts +0 -19
- package/dist/components/PrimeOutputList.vue.d.ts +0 -19
- package/dist/components/PrimeOutputNumber.d.vue.ts +0 -16
- package/dist/components/PrimeOutputNumber.vue.d.ts +0 -16
- package/dist/components/PrimeOutputReference.d.vue.ts +0 -16
- package/dist/components/PrimeOutputReference.vue.d.ts +0 -16
- package/dist/components/PrimeOutputText.d.vue.ts +0 -22
- package/dist/components/PrimeOutputText.vue.d.ts +0 -22
- package/dist/components/PrimePassword.d.vue.ts +0 -33
- package/dist/components/PrimePassword.vue.d.ts +0 -33
- package/dist/components/PrimeRadioButton.d.vue.ts +0 -28
- package/dist/components/PrimeRadioButton.vue.d.ts +0 -28
- package/dist/components/PrimeRating.d.vue.ts +0 -24
- package/dist/components/PrimeRating.vue.d.ts +0 -24
- package/dist/components/PrimeSelect.d.vue.ts +0 -50
- package/dist/components/PrimeSelect.vue.d.ts +0 -50
- package/dist/components/PrimeSelectButton.d.vue.ts +0 -28
- package/dist/components/PrimeSelectButton.vue.d.ts +0 -28
- package/dist/components/PrimeSlider.d.vue.ts +0 -26
- package/dist/components/PrimeSlider.vue.d.ts +0 -26
- package/dist/components/PrimeTextarea.d.vue.ts +0 -25
- package/dist/components/PrimeTextarea.vue.d.ts +0 -25
- package/dist/components/PrimeToggleButton.d.vue.ts +0 -26
- package/dist/components/PrimeToggleButton.vue.d.ts +0 -26
- package/dist/components/PrimeToggleSwitch.d.vue.ts +0 -23
- package/dist/components/PrimeToggleSwitch.vue.d.ts +0 -23
- package/dist/components/PrimeTreeSelect.d.vue.ts +0 -32
- package/dist/components/PrimeTreeSelect.vue.d.ts +0 -32
|
@@ -51,11 +51,11 @@ Object.defineProperty(exports, "usePrimeInputs", {
|
|
|
51
51
|
return _usePrimeInputs.usePrimeInputs;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
var _useFormKitInput = require("./useFormKitInput");
|
|
55
|
-
var _useFormKitRepeater = require("./useFormKitRepeater");
|
|
56
|
-
var _useFormKitSchema = require("./useFormKitSchema");
|
|
57
|
-
var _useFormKitSection = require("./useFormKitSection");
|
|
58
|
-
var _useInputEditor = require("./useInputEditor");
|
|
59
|
-
var _useInputEditorSchema = require("./useInputEditorSchema");
|
|
60
|
-
var _useOutputDuration = require("./useOutputDuration");
|
|
61
|
-
var _usePrimeInputs = require("./usePrimeInputs");
|
|
54
|
+
var _useFormKitInput = require("./useFormKitInput.ts");
|
|
55
|
+
var _useFormKitRepeater = require("./useFormKitRepeater.ts");
|
|
56
|
+
var _useFormKitSchema = require("./useFormKitSchema.ts");
|
|
57
|
+
var _useFormKitSection = require("./useFormKitSection.ts");
|
|
58
|
+
var _useInputEditor = require("./useInputEditor.ts");
|
|
59
|
+
var _useInputEditorSchema = require("./useInputEditorSchema.ts");
|
|
60
|
+
var _useOutputDuration = require("./useOutputDuration.ts");
|
|
61
|
+
var _usePrimeInputs = require("./usePrimeInputs.ts");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useFormKitInput } from "./useFormKitInput.
|
|
2
|
-
import { useFormKitRepeater } from "./useFormKitRepeater.
|
|
3
|
-
import { useFormKitSchema } from "./useFormKitSchema.
|
|
4
|
-
import { useFormKitSection } from "./useFormKitSection.
|
|
5
|
-
import { useInputEditor } from "./useInputEditor.
|
|
6
|
-
import { useInputEditorSchema } from "./useInputEditorSchema.
|
|
7
|
-
import { useOutputDuration } from "./useOutputDuration.
|
|
8
|
-
import { usePrimeInputs } from "./usePrimeInputs.
|
|
1
|
+
import { useFormKitInput } from "./useFormKitInput.ts";
|
|
2
|
+
import { useFormKitRepeater } from "./useFormKitRepeater.ts";
|
|
3
|
+
import { useFormKitSchema } from "./useFormKitSchema.ts";
|
|
4
|
+
import { useFormKitSection } from "./useFormKitSection.ts";
|
|
5
|
+
import { useInputEditor } from "./useInputEditor.ts";
|
|
6
|
+
import { useInputEditorSchema } from "./useInputEditorSchema.ts";
|
|
7
|
+
import { useOutputDuration } from "./useOutputDuration.ts";
|
|
8
|
+
import { usePrimeInputs } from "./usePrimeInputs.ts";
|
|
9
9
|
export {
|
|
10
10
|
useFormKitInput,
|
|
11
11
|
useFormKitRepeater,
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useFormKitInput = useFormKitInput;
|
|
7
7
|
var _config = require("primevue/config");
|
|
8
8
|
var _vue = require("vue");
|
|
9
|
+
var _consola = _interopRequireDefault(require("consola"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
11
|
function useFormKitInput(context) {
|
|
10
12
|
const isInvalid = (0, _vue.computed)(() => {
|
|
11
13
|
return context?.state?.validationVisible && !context?.state?.valid;
|
|
@@ -18,7 +20,9 @@ function useFormKitInput(context) {
|
|
|
18
20
|
try {
|
|
19
21
|
const primevue = (0, _config.usePrimeVue)();
|
|
20
22
|
result = primevue?.config?.unstyled || false;
|
|
21
|
-
} catch (e) {
|
|
23
|
+
} catch (e) {
|
|
24
|
+
_consola.default.log(e);
|
|
25
|
+
}
|
|
22
26
|
return result;
|
|
23
27
|
}
|
|
24
28
|
const unstyled = (0, _vue.computed)(() => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { usePrimeVue } from "primevue/config";
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
+
import consola from "consola";
|
|
3
4
|
export function useFormKitInput(context) {
|
|
4
5
|
const isInvalid = computed(() => {
|
|
5
6
|
return context?.state?.validationVisible && !context?.state?.valid;
|
|
@@ -13,6 +14,7 @@ export function useFormKitInput(context) {
|
|
|
13
14
|
const primevue = usePrimeVue();
|
|
14
15
|
result = primevue?.config?.unstyled || false;
|
|
15
16
|
} catch (e) {
|
|
17
|
+
consola.log(e);
|
|
16
18
|
}
|
|
17
19
|
return result;
|
|
18
20
|
}
|
|
@@ -41,5 +43,15 @@ export function useFormKitInput(context) {
|
|
|
41
43
|
context.node.input(value);
|
|
42
44
|
}
|
|
43
45
|
});
|
|
44
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
isInvalid,
|
|
48
|
+
validSlotNames,
|
|
49
|
+
styleClass,
|
|
50
|
+
unstyled,
|
|
51
|
+
handleBlur,
|
|
52
|
+
handleChange,
|
|
53
|
+
handleInput,
|
|
54
|
+
handleSelect,
|
|
55
|
+
modelValue
|
|
56
|
+
};
|
|
45
57
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useFormKitRepeater = useFormKitRepeater;
|
|
7
|
-
var _useFormKitSchema = require("./useFormKitSchema");
|
|
7
|
+
var _useFormKitSchema = require("./useFormKitSchema.ts");
|
|
8
8
|
function useFormKitRepeater() {
|
|
9
9
|
const {
|
|
10
10
|
addElement,
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { useFormKitSchema } from "./useFormKitSchema.
|
|
1
|
+
import { useFormKitSchema } from "./useFormKitSchema.ts";
|
|
2
2
|
export function useFormKitRepeater() {
|
|
3
3
|
const { addElement, addComponent, addElementsInOuterDiv } = useFormKitSchema();
|
|
4
4
|
function addInsertButton(label = "Add", innerClass = "", outerClass = "", buttonClass = "p-button-sm", iconClass = "pi pi-plus") {
|
|
5
|
-
return addElementsInOuterDiv(
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
return addElementsInOuterDiv(
|
|
6
|
+
[
|
|
7
|
+
addComponent(
|
|
8
|
+
"Button",
|
|
9
|
+
{ onClick: "$addNode($node)", label, class: buttonClass, icon: iconClass },
|
|
10
|
+
"$node.children.length == 0"
|
|
11
|
+
)
|
|
12
|
+
],
|
|
13
|
+
innerClass,
|
|
14
|
+
outerClass
|
|
15
|
+
);
|
|
8
16
|
}
|
|
9
17
|
function addListGroupFunctions(data, addNodeDefaultObject = {}) {
|
|
10
18
|
const swapElements = (array, index1, index2) => {
|
|
@@ -19,17 +27,18 @@ export function useFormKitRepeater() {
|
|
|
19
27
|
parentNode.input(newArray, false);
|
|
20
28
|
};
|
|
21
29
|
data.removeNode = (parentNode, index) => () => {
|
|
22
|
-
parentNode.input(
|
|
30
|
+
parentNode.input(
|
|
31
|
+
parentNode._value.filter((_, i) => i !== index),
|
|
32
|
+
false
|
|
33
|
+
);
|
|
23
34
|
};
|
|
24
35
|
data.moveNodeUp = (parentNode, index) => () => {
|
|
25
36
|
const array = [...parentNode.value];
|
|
26
|
-
if (index > 0)
|
|
27
|
-
parentNode.input(swapElements(array, index - 1, index), false);
|
|
37
|
+
if (index > 0) parentNode.input(swapElements(array, index - 1, index), false);
|
|
28
38
|
};
|
|
29
39
|
data.moveNodeDown = (parentNode, index) => () => {
|
|
30
40
|
const array = [...parentNode.value];
|
|
31
|
-
if (index < array.length - 1)
|
|
32
|
-
parentNode.input(swapElements(array, index, index + 1), false);
|
|
41
|
+
if (index < array.length - 1) parentNode.input(swapElements(array, index, index + 1), false);
|
|
33
42
|
};
|
|
34
43
|
data.copyNode = (parentNode, index) => () => {
|
|
35
44
|
const obj = parentNode.value[index];
|
|
@@ -41,14 +50,33 @@ export function useFormKitRepeater() {
|
|
|
41
50
|
const addButtonComponent = (onClick = "", label2 = "", icon = "", severity = "", render2 = "true", styleClass = "p-button-sm") => {
|
|
42
51
|
return addComponent("Button", { onClick, label: label2, icon, class: styleClass, severity }, render2);
|
|
43
52
|
};
|
|
44
|
-
return addElementsInOuterDiv(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
return addElementsInOuterDiv(
|
|
54
|
+
[
|
|
55
|
+
addButtonComponent("$removeNode($node.parent, $index)", "", "pi pi-times", "danger"),
|
|
56
|
+
addButtonComponent("$copyNode($node.parent, $index)", "", "pi pi-plus"),
|
|
57
|
+
addButtonComponent(
|
|
58
|
+
"$moveNodeUp($node.parent, $index)",
|
|
59
|
+
"",
|
|
60
|
+
"pi pi-arrow-up",
|
|
61
|
+
"secondary",
|
|
62
|
+
"$index != 0"
|
|
63
|
+
),
|
|
64
|
+
addElement("span", [], { class: "p-space" }, "$index == 0"),
|
|
65
|
+
addButtonComponent(
|
|
66
|
+
"$moveNodeDown($node.parent, $index)",
|
|
67
|
+
"",
|
|
68
|
+
"pi pi-arrow-down",
|
|
69
|
+
"secondary",
|
|
70
|
+
"$index < $node.parent.value.length -1"
|
|
71
|
+
),
|
|
72
|
+
addElement("span", [], { class: "p-space" }, "$index == $node.parent.value.length -1")
|
|
73
|
+
],
|
|
74
|
+
`p-action-buttons ${innerClass}`,
|
|
75
|
+
outerClass,
|
|
76
|
+
label,
|
|
77
|
+
help,
|
|
78
|
+
render
|
|
79
|
+
);
|
|
52
80
|
}
|
|
53
81
|
return { addInsertButton, addGroupButtons, addListGroupFunctions };
|
|
54
82
|
}
|
|
@@ -48,11 +48,19 @@ export function useFormKitSchema() {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
const addElementsInOuterDiv = (children = [], innerClass = "", outerClass = "", label = "", help = "", render = true) => {
|
|
51
|
-
const inner = addElement("div", children, {
|
|
51
|
+
const inner = addElement("div", children, {
|
|
52
|
+
class: `formkit-inner ${innerClass}`,
|
|
53
|
+
style: "position: relative;"
|
|
54
|
+
});
|
|
52
55
|
const labelDiv = addElement("label", [label], { class: "formkit-label" });
|
|
53
56
|
const wrapperDiv = addElement("div", [labelDiv, inner], { class: "formkit-wrapper" });
|
|
54
57
|
const helpDiv = addElement("div", [help], { class: "formkit-help" });
|
|
55
|
-
return addElement(
|
|
58
|
+
return addElement(
|
|
59
|
+
"div",
|
|
60
|
+
[wrapperDiv, helpDiv],
|
|
61
|
+
{ class: `formkit-outer ${outerClass}`, style: "position: relative;" },
|
|
62
|
+
render
|
|
63
|
+
);
|
|
56
64
|
};
|
|
57
65
|
return { addComponent, addElement, addGroup, addList, addListGroup, addElementsInOuterDiv };
|
|
58
66
|
}
|
|
@@ -21,9 +21,9 @@ function useInputEditor() {
|
|
|
21
21
|
}
|
|
22
22
|
return [key, value];
|
|
23
23
|
});
|
|
24
|
-
tempData = {
|
|
25
|
-
|
|
26
|
-
};
|
|
24
|
+
tempData = Object.assign({}, ...mapped.map(([key, val]) => ({
|
|
25
|
+
[key]: val
|
|
26
|
+
})));
|
|
27
27
|
}
|
|
28
28
|
const readonlyValue = data.readonly === true ? true : void 0;
|
|
29
29
|
const disabledValue = data.disabled === true ? true : void 0;
|
|
@@ -47,7 +47,7 @@ function useInputEditor() {
|
|
|
47
47
|
selectButton: void 0
|
|
48
48
|
};
|
|
49
49
|
const useOptions = formkitInput ? primeInputWithOptionNames.map(s => `prime${s}`).includes(formkitInput) : false;
|
|
50
|
-
let result;
|
|
50
|
+
let result = {};
|
|
51
51
|
if (useOptions) {
|
|
52
52
|
result = {
|
|
53
53
|
...data,
|
|
@@ -1,14 +1,50 @@
|
|
|
1
1
|
export function useInputEditor() {
|
|
2
|
-
const primeInputWithOptionNames = [
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const primeInputWithOptionNames = [
|
|
3
|
+
"CascadeSelect",
|
|
4
|
+
"Listbox",
|
|
5
|
+
"MultiSelect",
|
|
6
|
+
"RadioButton",
|
|
7
|
+
"Select",
|
|
8
|
+
"SelectButton",
|
|
9
|
+
"TreeSelect"
|
|
10
|
+
];
|
|
11
|
+
const primeInputNames = [
|
|
12
|
+
...primeInputWithOptionNames,
|
|
13
|
+
"AutoComplete",
|
|
14
|
+
"Checkbox",
|
|
15
|
+
"ColorPicker",
|
|
16
|
+
"DatePicker",
|
|
17
|
+
"Editor",
|
|
18
|
+
"InputMask",
|
|
19
|
+
"InputNumber",
|
|
20
|
+
"InputOtp",
|
|
21
|
+
"InputText",
|
|
22
|
+
"Knob",
|
|
23
|
+
"Password",
|
|
24
|
+
"Rating",
|
|
25
|
+
"Slider",
|
|
26
|
+
"Textarea",
|
|
27
|
+
"ToggleButton",
|
|
28
|
+
"ToggleSwitch"
|
|
29
|
+
].sort();
|
|
30
|
+
const primeOutputNames = [
|
|
31
|
+
"OutputBoolean",
|
|
32
|
+
"OutputDate",
|
|
33
|
+
"OutputDuration",
|
|
34
|
+
"OutputLink",
|
|
35
|
+
"OutputList",
|
|
36
|
+
"OutputNumber",
|
|
37
|
+
"OutputReference",
|
|
38
|
+
"OutputText"
|
|
39
|
+
];
|
|
5
40
|
function editorDataToSchema(data) {
|
|
6
|
-
if (!data)
|
|
7
|
-
return {};
|
|
41
|
+
if (!data) return {};
|
|
8
42
|
const formkitInput = data?._dollar_formkit;
|
|
9
43
|
let tempData = {};
|
|
10
44
|
if (data.prime && Array.isArray(data.prime) && data.prime.length > 0) {
|
|
11
|
-
const mapped = data.prime.filter(
|
|
45
|
+
const mapped = data.prime.filter(
|
|
46
|
+
(entry) => entry && typeof entry === "object" && "prime_key" in entry && "prime_value" in entry
|
|
47
|
+
).map((entry) => {
|
|
12
48
|
const key = entry.prime_key || "";
|
|
13
49
|
let value = entry.prime_value;
|
|
14
50
|
if (formkitInput === "primeInputOtp" && key === "length" && value !== void 0) {
|
|
@@ -16,7 +52,7 @@ export function useInputEditor() {
|
|
|
16
52
|
}
|
|
17
53
|
return [key, value];
|
|
18
54
|
});
|
|
19
|
-
tempData = { ...
|
|
55
|
+
tempData = Object.assign({}, ...mapped.map(([key, val]) => ({ [key]: val })));
|
|
20
56
|
}
|
|
21
57
|
const readonlyValue = data.readonly === true ? true : void 0;
|
|
22
58
|
const disabledValue = data.disabled === true ? true : void 0;
|
|
@@ -27,14 +63,11 @@ export function useInputEditor() {
|
|
|
27
63
|
preserve: preserveValue
|
|
28
64
|
};
|
|
29
65
|
let outerClass = "";
|
|
30
|
-
if (data.outerClass)
|
|
31
|
-
outerClass = `${outerClass} ${data.outerClass}`.trim();
|
|
66
|
+
if (data.outerClass) outerClass = `${outerClass} ${data.outerClass}`.trim();
|
|
32
67
|
let wrapperClass = "";
|
|
33
|
-
if (data.wrapperClass)
|
|
34
|
-
wrapperClass = `${wrapperClass} ${data.wrapperClass}`.trim();
|
|
68
|
+
if (data.wrapperClass) wrapperClass = `${wrapperClass} ${data.wrapperClass}`.trim();
|
|
35
69
|
let innerClass = "";
|
|
36
|
-
if (data.innerClass)
|
|
37
|
-
innerClass = `${innerClass} ${data.innerClass}`.trim();
|
|
70
|
+
if (data.innerClass) innerClass = `${innerClass} ${data.innerClass}`.trim();
|
|
38
71
|
const undefinedObject = {
|
|
39
72
|
prime: void 0,
|
|
40
73
|
schemaResultFormKey: void 0,
|
|
@@ -43,7 +76,7 @@ export function useInputEditor() {
|
|
|
43
76
|
selectButton: void 0
|
|
44
77
|
};
|
|
45
78
|
const useOptions = formkitInput ? primeInputWithOptionNames.map((s) => `prime${s}`).includes(formkitInput) : false;
|
|
46
|
-
let result;
|
|
79
|
+
let result = {};
|
|
47
80
|
if (useOptions) {
|
|
48
81
|
result = {
|
|
49
82
|
...data,
|
|
@@ -81,8 +114,7 @@ export function useInputEditor() {
|
|
|
81
114
|
return result;
|
|
82
115
|
}
|
|
83
116
|
function dataToSchema(data) {
|
|
84
|
-
if (!data)
|
|
85
|
-
return {};
|
|
117
|
+
if (!data) return {};
|
|
86
118
|
const schema = editorDataToSchema(data);
|
|
87
119
|
if (schema?.options && Array.isArray(schema.options)) {
|
|
88
120
|
const options = schema.options.map((o) => o ? JSON.parse(JSON.stringify(o)) : {});
|
|
@@ -92,13 +124,11 @@ export function useInputEditor() {
|
|
|
92
124
|
}
|
|
93
125
|
}
|
|
94
126
|
function editorDataToJson(data) {
|
|
95
|
-
if (!data)
|
|
96
|
-
return "{}";
|
|
127
|
+
if (!data) return "{}";
|
|
97
128
|
return JSON.stringify(dataToSchema(data));
|
|
98
129
|
}
|
|
99
130
|
function objectToString(data) {
|
|
100
|
-
if (!data)
|
|
101
|
-
return "{}";
|
|
131
|
+
if (!data) return "{}";
|
|
102
132
|
return `{${Object.entries(data).map(([key, value]) => {
|
|
103
133
|
if (key === "options" && Array.isArray(value) && value.length > 0) {
|
|
104
134
|
let result = "[";
|
|
@@ -116,8 +146,7 @@ export function useInputEditor() {
|
|
|
116
146
|
}).join()}}`;
|
|
117
147
|
}
|
|
118
148
|
function editorDataToObject(data) {
|
|
119
|
-
if (!data)
|
|
120
|
-
return "{}";
|
|
149
|
+
if (!data) return "{}";
|
|
121
150
|
try {
|
|
122
151
|
const jsonData = editorDataToJson(data);
|
|
123
152
|
return objectToString(JSON.parse(jsonData));
|
|
@@ -127,8 +156,7 @@ export function useInputEditor() {
|
|
|
127
156
|
}
|
|
128
157
|
}
|
|
129
158
|
function schemaToEditorData(schema) {
|
|
130
|
-
if (!schema)
|
|
131
|
-
return {};
|
|
159
|
+
if (!schema) return {};
|
|
132
160
|
const formkitInput = schema?.$formkit;
|
|
133
161
|
return { ...schema, _dollar_formkit: formkitInput };
|
|
134
162
|
}
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useInputEditorSchema = useInputEditorSchema;
|
|
7
|
-
var _useFormKitRepeater = require("./useFormKitRepeater");
|
|
8
|
-
var _useFormKitSchema = require("./useFormKitSchema");
|
|
9
|
-
var _useInputEditor = require("./useInputEditor");
|
|
7
|
+
var _useFormKitRepeater = require("./useFormKitRepeater.ts");
|
|
8
|
+
var _useFormKitSchema = require("./useFormKitSchema.ts");
|
|
9
|
+
var _useInputEditor = require("./useInputEditor.ts");
|
|
10
10
|
function useInputEditorSchema() {
|
|
11
11
|
const {
|
|
12
12
|
addList,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useFormKitRepeater } from "./useFormKitRepeater.
|
|
2
|
-
import { useFormKitSchema } from "./useFormKitSchema.
|
|
3
|
-
import { useInputEditor } from "./useInputEditor.
|
|
1
|
+
import { useFormKitRepeater } from "./useFormKitRepeater.ts";
|
|
2
|
+
import { useFormKitSchema } from "./useFormKitSchema.ts";
|
|
3
|
+
import { useInputEditor } from "./useInputEditor.ts";
|
|
4
4
|
export function useInputEditorSchema() {
|
|
5
5
|
const { addList, addListGroup } = useFormKitSchema();
|
|
6
6
|
const { addInsertButton, addGroupButtons } = useFormKitRepeater();
|
|
@@ -269,10 +269,11 @@ export function useInputEditorSchema() {
|
|
|
269
269
|
key: "schema_validation-label",
|
|
270
270
|
preserve: true
|
|
271
271
|
},
|
|
272
|
-
addList(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
addList(
|
|
273
|
+
"options",
|
|
274
|
+
[
|
|
275
|
+
addInsertButton("Add Option"),
|
|
276
|
+
addListGroup([
|
|
276
277
|
{
|
|
277
278
|
$formkit: "primeInputText",
|
|
278
279
|
label: "Label",
|
|
@@ -286,13 +287,17 @@ export function useInputEditorSchema() {
|
|
|
286
287
|
outerClass: "col-4"
|
|
287
288
|
},
|
|
288
289
|
addGroupButtons()
|
|
289
|
-
]
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
290
|
+
])
|
|
291
|
+
],
|
|
292
|
+
true,
|
|
293
|
+
"$get(selectButton).value === 'showOptions'",
|
|
294
|
+
{ key: "schema_options", preserve: true }
|
|
295
|
+
),
|
|
296
|
+
addList(
|
|
297
|
+
"prime",
|
|
298
|
+
[
|
|
299
|
+
addInsertButton("Add PrimeVue Attribute"),
|
|
300
|
+
addListGroup([
|
|
296
301
|
{
|
|
297
302
|
$formkit: "primeInputText",
|
|
298
303
|
label: "PrimeVue Key",
|
|
@@ -306,9 +311,12 @@ export function useInputEditorSchema() {
|
|
|
306
311
|
outerClass: "col-3"
|
|
307
312
|
},
|
|
308
313
|
addGroupButtons()
|
|
309
|
-
]
|
|
310
|
-
|
|
311
|
-
|
|
314
|
+
])
|
|
315
|
+
],
|
|
316
|
+
true,
|
|
317
|
+
"$get(selectButton).value === 'showPrime'",
|
|
318
|
+
{ key: "schema_prime", preserve: true }
|
|
319
|
+
)
|
|
312
320
|
];
|
|
313
321
|
}
|
|
314
322
|
return { editorSchema, primeInputOptions };
|
|
@@ -11,10 +11,8 @@ export function useOutputDuration() {
|
|
|
11
11
|
if (lowerDuration.includes("h")) {
|
|
12
12
|
hours = +(lowerDuration.split("h")[0]?.trim() || "0");
|
|
13
13
|
const remainder = lowerDuration.split("h")[1] || "";
|
|
14
|
-
if (remainder.includes("m"))
|
|
15
|
-
|
|
16
|
-
else if (/^\d+$/.test(remainder))
|
|
17
|
-
minutes = +remainder;
|
|
14
|
+
if (remainder.includes("m")) minutes = +(remainder.split("m")[0]?.trim() || "0");
|
|
15
|
+
else if (/^\d+$/.test(remainder)) minutes = +remainder;
|
|
18
16
|
} else if (lowerDuration.includes("m")) {
|
|
19
17
|
minutes = +(lowerDuration.split("m")[0]?.trim() || "0");
|
|
20
18
|
} else if (/^\d+$/.test(lowerDuration)) {
|
|
@@ -27,8 +25,7 @@ export function useOutputDuration() {
|
|
|
27
25
|
const minutes = durationToMinutes(duration);
|
|
28
26
|
const hours = Math.trunc(minutes / 60);
|
|
29
27
|
const remainingMinutes = minutes % 60;
|
|
30
|
-
if (minutes === 0)
|
|
31
|
-
return "0";
|
|
28
|
+
if (minutes === 0) return "0";
|
|
32
29
|
return `${hours > 0 ? `${hours}h` : ""}${hours > 0 && remainingMinutes > 0 ? " " : ""}${remainingMinutes > 0 ? `${remainingMinutes}m` : ""}`;
|
|
33
30
|
}
|
|
34
31
|
return { durationToMinutes, formattedDuration };
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.primeOutputs = exports.primeInputs = void 0;
|
|
7
|
-
var _input = require("./input");
|
|
8
|
-
var _output = require("./output");
|
|
7
|
+
var _input = require("./input.ts");
|
|
8
|
+
var _output = require("./output.ts");
|
|
9
9
|
const primeInputs = exports.primeInputs = {
|
|
10
10
|
primeAutoComplete: _input.primeAutoCompleteDefinition,
|
|
11
11
|
primeInputText: _input.primeInputTextDefinition,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
primeToggleButtonDefinition,
|
|
22
22
|
primeToggleSwitchDefinition,
|
|
23
23
|
primeTreeSelectDefinition
|
|
24
|
-
} from "./input.
|
|
24
|
+
} from "./input.ts";
|
|
25
25
|
import {
|
|
26
26
|
primeOutputBooleanDefinition,
|
|
27
27
|
primeOutputDateDefinition,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
primeOutputNumberDefinition,
|
|
32
32
|
primeOutputReferenceDefinition,
|
|
33
33
|
primeOutputTextDefinition
|
|
34
|
-
} from "./output.
|
|
34
|
+
} from "./output.ts";
|
|
35
35
|
export const primeInputs = {
|
|
36
36
|
primeAutoComplete: primeAutoCompleteDefinition,
|
|
37
37
|
primeInputText: primeInputTextDefinition,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormKitTypeDefinition } from
|
|
1
|
+
import type { FormKitTypeDefinition } from "@formkit/core";
|
|
2
2
|
export declare const primeAutoCompleteDefinition: FormKitTypeDefinition;
|
|
3
3
|
export declare const primeInputTextDefinition: FormKitTypeDefinition;
|
|
4
4
|
export declare const primeInputNumberDefinition: FormKitTypeDefinition;
|