@blokkli/editor 1.0.2 → 1.0.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/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +5 -3
- package/dist/runtime/components/Edit/Features/Edit/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +2 -4
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +5 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +4 -6
- package/package.json +1 -1
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* This file should contain all helpers that are meant for runtime functionality, such as defineBlokkli composable or <BlokkliProvider>.
|
|
3
3
|
*/
|
|
4
4
|
import type { BlockOptionDefinition } from '#blokkli/types/blokkOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Map all kinds of truthy values for a checkbox.
|
|
7
|
+
* Returns our "internal" value of a checkbox state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mapCheckboxTrue(v?: unknown): '1' | '0';
|
|
5
10
|
/**
|
|
6
11
|
* Get the runtime value for an option.
|
|
7
12
|
*
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
export function mapCheckboxTrue(v) {
|
|
2
|
+
return v === true || v === "1" || v === 1 || v === "true" ? "1" : "0";
|
|
3
|
+
}
|
|
1
4
|
export function getRuntimeOptionValue(definition, value) {
|
|
2
5
|
if (definition.type === "checkbox") {
|
|
3
|
-
|
|
4
|
-
return value === "1" || value === "true";
|
|
5
|
-
} else if (typeof value === "boolean") {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
6
|
+
return mapCheckboxTrue(value) === "1";
|
|
9
7
|
} else if (definition.type === "radios") {
|
|
10
8
|
if (typeof value === "string") {
|
|
11
9
|
return value;
|