2024-02-02 17:24:01 +08:00
|
|
|
import React from "react";
|
|
|
|
import {apply as json_logic_apply, add_operation as json_add_operation} from "json-logic-js";
|
|
|
|
|
|
|
|
|
2024-02-07 16:23:17 +08:00
|
|
|
json_add_operation("lower", (some_str) => some_str && some_str.toLowerCase(some_str));
|
|
|
|
json_add_operation("upper", (some_str) => some_str && some_str.toUpperCase(some_str));
|
|
|
|
json_add_operation("capitalize", (some_str) => some_str && some_str.capitalizeFirstLetter(some_str));
|
2024-02-02 17:24:01 +08:00
|
|
|
|
|
|
|
export function Label(target, id, data, {content}) {
|
|
|
|
const resulting_string = json_logic_apply(content, data).flat().join("");
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div id={id+"label"} key={id+"label"} className="options-label">
|
|
|
|
{resulting_string}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|