diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Label.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Label.java index a7106b9f97..943f092795 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Label.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Label.java @@ -21,21 +21,10 @@ /** * Interface for a label * - * @since com.adobe.cq.forms.core.components.models.form 0.0.1 + * @since com.adobe.cq.forms.core.components.models.form 4.8.0 */ @ConsumerType -public interface Label { - - /** - * Returns {@code true} if label is rich text, otherwise {@code false}. - * - * @return {@code true} if label is rich text, otherwise {@code false} - * @since com.adobe.cq.forms.core.components.models.form 0.0.1 - */ - @Nullable - default Boolean isRichText() { - return null; - } +public interface Label extends TextContent { /** * Returns {@code true} if label should be visible, otherwise {@code false}. @@ -48,15 +37,4 @@ default Boolean isVisible() { return null; } - /** - * Returns the value of this label. - * - * @return the value of this label - * @since com.adobe.cq.forms.core.components.models.form 0.0.1 - */ - @Nullable - default String getValue() { - return null; - } - } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/OptionsConstraint.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/OptionsConstraint.java index 2b949352d7..8168e18310 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/OptionsConstraint.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/OptionsConstraint.java @@ -17,6 +17,7 @@ import org.osgi.annotation.versioning.ProviderType; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -57,5 +58,17 @@ default boolean isEnforceEnum() { * @return the list of enum names * @since com.adobe.cq.forms.core.components.models.form 0.0.1 */ + @Deprecated + @JsonIgnore String[] getEnumNames(); + + /** + * Returns a list of RichText to be displayed to the end user. + * The length of enum and enumNames array must match + * + * @return the list of enum names + * @since com.adobe.cq.forms.core.components.models.form 4.8.0 + */ + @JsonProperty("enumNames") + TextContent[] getEnumNamesAsTextContent(); } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextContent.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextContent.java new file mode 100644 index 0000000000..44d60a9161 --- /dev/null +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextContent.java @@ -0,0 +1,51 @@ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Copyright 2023 Adobe + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +package com.adobe.cq.forms.core.components.models.form; + +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Interface to represent text as rich content + * + * @since com.adobe.cq.forms.core.components.models.form 4.8.0 + */ +@ProviderType +public interface TextContent { + + /** + * Returns {@code true} if text is rich, otherwise {@code false}. + * + * @return {@code true} if text is rich, otherwise {@code false} + * @since com.adobe.cq.forms.core.components.models.form 4.8.0 + */ + @Nullable + default Boolean isRichText() { + return null; + } + + /** + * Returns a user friendly text to display for the possible options to be shown to the end user. + * + * @return the content of this text + * @since com.adobe.cq.forms.core.components.models.form 4.8.0 + */ + @Nullable + default String getValue() { + return null; + } + +} \ No newline at end of file diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java index 90fe5ba473..10dabbbd46 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java @@ -29,6 +29,9 @@ import com.adobe.cq.forms.core.components.models.form.Field; import com.adobe.cq.forms.core.components.models.form.OptionsConstraint; +import com.adobe.cq.forms.core.components.models.form.TextContent; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; /** * Abstract class which can be used as base class for options {@link Field} implementations. @@ -49,6 +52,10 @@ public abstract class AbstractOptionsFieldImpl extends AbstractFieldImpl impleme @Nullable protected String[] enumNames; + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "areOptionsRichText") + @Nullable + private Boolean areOptionsRichText; + @Override public boolean isEnforceEnum() { return enforceEnum; @@ -95,6 +102,8 @@ public Object[] getEnums() { } @Override + @Deprecated + @JsonIgnore public String[] getEnumNames() { if (enumNames != null) { Map map = removeDuplicates(); @@ -108,6 +117,29 @@ public String[] getEnumNames() { return null; } + @Override + public TextContent[] getEnumNamesAsTextContent() { + if (enumNames != null) { + Map map = removeDuplicates(); + String[] enumName = map.values().toArray(new String[0]); + return Arrays.stream(enumName) + .map(p -> new TextContent() { + @Override + @JsonInclude(JsonInclude.Include.NON_NULL) + public @Nullable Boolean isRichText() { + return areOptionsRichText; + } + + @Override + public @Nullable String getValue() { + return translate("enumNames", p); + } + }) + .toArray(TextContent[]::new); + } + return null; + } + @Override public Object[] getDefault() { Object[] typedDefaultValue = null; diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java index 3d4eb5bc59..f58a06bb78 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java @@ -25,6 +25,7 @@ import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.sling.api.resource.Resource; import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest; +import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -296,6 +297,44 @@ void testGetType() { void testGetEnumNames() { CheckBoxGroup checkboxGroup = getCheckBoxGroupUnderTest(PATH_CHECKBOX_GROUP); assertArrayEquals(new String[] { "m", "f", "o" }, checkboxGroup.getEnumNames()); + TextContent textContent1 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return null; + } + + @Override + public @Nullable String getValue() { + return "m"; + } + }; + TextContent textContent2 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return null; + } + + @Override + public @Nullable String getValue() { + return "f"; + } + }; + TextContent textContent3 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return null; + } + + @Override + public @Nullable String getValue() { + return "o"; + } + }; + TextContent[] textContent = new TextContent[] { textContent1, textContent2, textContent3 }; + for (int i = 0; i < checkboxGroup.getEnumNamesAsTextContent().length; i++) { + assertEquals(textContent[i].getValue(), checkboxGroup.getEnumNamesAsTextContent()[i].getValue()); + assertEquals(textContent[i].isRichText(), checkboxGroup.getEnumNamesAsTextContent()[i].isRichText()); + } } @Test @@ -306,6 +345,9 @@ void testGetEnumNamesWithDuplicateEnumValues() { map.put("1", "Item 2"); map.put("0", "Item 3"); assertArrayEquals(map.values().toArray(new String[0]), checkboxGroup.getEnumNames()); + String[] checkboxGroupValues = Arrays.stream(checkboxGroup.getEnumNamesAsTextContent()).map(d -> d.getValue()).toArray( + size -> new String[checkboxGroup.getEnumNamesAsTextContent().length]); + assertArrayEquals(map.values().toArray(new String[0]), checkboxGroupValues); } @Test @@ -386,5 +428,8 @@ void testInsertionOrderForEnumNames() { Set set = new LinkedHashSet<>(Arrays.asList("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty")); assertArrayEquals(set.toArray(new String[0]), checkboxGroup.getEnumNames()); + String[] checkboxGroupValues = Arrays.stream(checkboxGroup.getEnumNamesAsTextContent()).map(d -> d.getValue()).toArray( + size -> new String[checkboxGroup.getEnumNamesAsTextContent().length]); + assertArrayEquals(set.toArray(new String[0]), checkboxGroupValues); } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java index 071ce8d418..b3d8c6efbb 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java @@ -27,12 +27,8 @@ import com.adobe.cq.forms.core.Utils; import com.adobe.cq.forms.core.components.internal.form.FormConstants; -import com.adobe.cq.forms.core.components.models.form.Base; -import com.adobe.cq.forms.core.components.models.form.CheckBox; +import com.adobe.cq.forms.core.components.models.form.*; import com.adobe.cq.forms.core.components.models.form.CheckBox.Orientation; -import com.adobe.cq.forms.core.components.models.form.ConstraintType; -import com.adobe.cq.forms.core.components.models.form.FieldType; -import com.adobe.cq.forms.core.components.models.form.Label; import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext; import com.adobe.cq.wcm.style.ComponentStyleInfo; import io.wcm.testing.mock.aem.junit5.AemContext; @@ -309,6 +305,16 @@ void testGetEnum() { } + @Test + void testGetNullEnumNames() { + CheckBox checkbox = getCheckBoxUnderTest(PATH_CHECKBOX); + assertNull(checkbox.getEnumNamesAsTextContent()); + assertNull(checkbox.getEnumNames()); + CheckBox noEnumCheckbox = getCheckBoxUnderTest(PATH_CHECKBOX_NOENUM); + assertNull(noEnumCheckbox.getEnumNamesAsTextContent()); + assertNull(noEnumCheckbox.getEnumNames()); + } + @Test void testGetNullEnum() { CheckBox noEnumCheckbox = getCheckBoxUnderTest(PATH_CHECKBOX_NOENUM); diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java index 824078c932..ed9b4da4b1 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java @@ -25,6 +25,7 @@ import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.sling.api.resource.Resource; import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest; +import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -379,6 +380,44 @@ void testGetMultiSelectMaxItems() { void testGetEnumNames() { DropDown dropdown = Utils.getComponentUnderTest(PATH_DROPDOWN_1, DropDown.class, context); assertArrayEquals(new String[] { "m", "f", "o" }, dropdown.getEnumNames()); + TextContent textContent1 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return null; + } + + @Override + public @Nullable String getValue() { + return "m"; + } + }; + TextContent textContent2 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return null; + } + + @Override + public @Nullable String getValue() { + return "f"; + } + }; + TextContent textContent3 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return null; + } + + @Override + public @Nullable String getValue() { + return "o"; + } + }; + TextContent[] textContent = new TextContent[] { textContent1, textContent2, textContent3 }; + for (int i = 0; i < dropdown.getEnumNamesAsTextContent().length; i++) { + assertEquals(textContent[i].getValue(), dropdown.getEnumNamesAsTextContent()[i].getValue()); + assertEquals(textContent[i].isRichText(), dropdown.getEnumNamesAsTextContent()[i].isRichText()); + } } @Test @@ -389,6 +428,10 @@ void testGetEnumNamesWithDuplicateEnumValues() { map.put("1", "Item 2"); map.put("0", "Item 3"); assertArrayEquals(map.values().toArray(new String[0]), dropdown.getEnumNames()); + String[] dropdownValues = Arrays.stream(dropdown.getEnumNamesAsTextContent()).map(d -> d.getValue()).toArray( + size -> new String[dropdown + .getEnumNamesAsTextContent().length]); + assertArrayEquals(map.values().toArray(new String[0]), dropdownValues); } @Test @@ -438,5 +481,9 @@ void testInsertionOrderForEnumNames() { Set set = new LinkedHashSet<>(Arrays.asList("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty")); assertArrayEquals(set.toArray(new String[0]), dropdown.getEnumNames()); + String[] dropdownValues = Arrays.stream(dropdown.getEnumNamesAsTextContent()).map(d -> d.getValue()).toArray( + size -> new String[dropdown + .getEnumNamesAsTextContent().length]); + assertArrayEquals(set.toArray(new String[0]), dropdownValues); } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java index 22dcf6f74a..3df63727d1 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java @@ -24,6 +24,7 @@ import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest; +import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -307,10 +308,42 @@ void testGetType() { assertEquals(BaseConstraint.Type.STRING, radioButtonMock.getType()); } + @Test + void testDeprecatedGetEnumNames() { + RadioButton radioButton = getRadioButtonUnderTest(PATH_RADIOBUTTON_CUSTOMIZED); + assertArrayEquals(new String[] { "

Item 1

", "

Item 2

" }, radioButton.getEnumNames()); + } + @Test void testGetEnumNames() { RadioButton radioButton = getRadioButtonUnderTest(PATH_RADIOBUTTON_CUSTOMIZED); - assertArrayEquals(new String[] { "Item 1", "Item 2" }, radioButton.getEnumNames()); + TextContent textContent1 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return true; + } + + @Override + public @Nullable String getValue() { + return "

Item 1

"; + } + }; + TextContent textContent2 = new TextContent() { + @Override + public @Nullable Boolean isRichText() { + return true; + } + + @Override + public @Nullable String getValue() { + return "

Item 2

"; + } + }; + TextContent[] textContent = new TextContent[] { textContent1, textContent2 }; + for (int i = 0; i < radioButton.getEnumNamesAsTextContent().length; i++) { + assertEquals(textContent[i].getValue(), radioButton.getEnumNamesAsTextContent()[i].getValue()); + assertEquals(textContent[i].isRichText(), radioButton.getEnumNamesAsTextContent()[i].isRichText()); + } } @Test @@ -321,6 +354,10 @@ void testGetEnumNamesWithDuplicateEnumValues() { map.put("1", "Item 2"); map.put("0", "Item 3"); assertArrayEquals(map.values().toArray(new String[0]), radioButton.getEnumNames()); + String[] radioButtonValues = Arrays.stream(radioButton.getEnumNamesAsTextContent()).map(d -> d.getValue()).toArray( + size -> new String[radioButton + .getEnumNamesAsTextContent().length]); + assertArrayEquals(map.values().toArray(new String[0]), radioButtonValues); } @Test @@ -389,5 +426,9 @@ void testInsertionOrderForEnumNames() { Set set = new LinkedHashSet<>(Arrays.asList("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty")); assertArrayEquals(set.toArray(new String[0]), radioButton.getEnumNames()); + String[] radioButtonValues = Arrays.stream(radioButton.getEnumNamesAsTextContent()).map(d -> d.getValue()).toArray( + size -> new String[radioButton + .getEnumNamesAsTextContent().length]); + assertArrayEquals(set.toArray(new String[0]), radioButtonValues); } } diff --git a/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup-datalayer.json b/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup-datalayer.json index 986b3f2b6a..de77a5d84f 100644 --- a/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup-datalayer.json +++ b/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup-datalayer.json @@ -9,8 +9,12 @@ "readOnly": false, "enforceEnum": true, "enumNames": [ - "Cat Person", - "Dog Person" + { + "value": "Cat Person" + }, + { + "value": "Dog Person" + } ], "label": { "value": "Personality" diff --git a/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup.json b/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup.json index b71aa10538..f82ba6229a 100644 --- a/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup.json +++ b/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup.json @@ -16,9 +16,15 @@ "readOnly": true, "enforceEnum": true, "enumNames": [ - "m", - "f", - "o" + { + "value": "m" + }, + { + "value": "f" + }, + { + "value": "o" + } ], "default": [ 0, diff --git a/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-1.json b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-1.json index 60987e7d27..b20398a150 100644 --- a/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-1.json +++ b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-1.json @@ -15,9 +15,15 @@ "readOnly": false, "enforceEnum": true, "enumNames": [ - "m", - "f", - "o" + { + "value": "m" + }, + { + "value": "f" + }, + { + "value": "o" + } ], "label": { "visible": true, diff --git a/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-datalayer.json b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-datalayer.json index 4b7d3b72e6..f02d9514a7 100644 --- a/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-datalayer.json +++ b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-datalayer.json @@ -9,8 +9,12 @@ "readOnly": false, "enforceEnum": true, "enumNames": [ - "Owl", - "Wolf" + { + "value": "Owl" + }, + { + "value": "Wolf" + } ], "label": { "value": "Favorite Animal" diff --git a/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown.json b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown.json index 7ecce9aa4e..64e232f04e 100644 --- a/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown.json +++ b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown.json @@ -4,7 +4,17 @@ "name": "abc", "type": "string", "enforceEnum": true, - "enumNames": ["m", "f", "o"], + "enumNames": [ + { + "value": "m" + }, + { + "value": "f" + }, + { + "value": "o" + } + ], "enum": ["0", "1", "2"], "label": { "value": "def" diff --git a/bundles/af-core/src/test/resources/form/dropdown/exporter-multiselect-dropdown.json b/bundles/af-core/src/test/resources/form/dropdown/exporter-multiselect-dropdown.json index 43860b3db0..9547715155 100644 --- a/bundles/af-core/src/test/resources/form/dropdown/exporter-multiselect-dropdown.json +++ b/bundles/af-core/src/test/resources/form/dropdown/exporter-multiselect-dropdown.json @@ -15,9 +15,15 @@ }, "enforceEnum": true, "enumNames": [ - "m", - "f", - "o" + { + "value": "m" + }, + { + "value": "f" + }, + { + "value": "o" + } ], "default": [ 0, diff --git a/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-customized.json b/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-customized.json index 988424436a..7225f64b53 100644 --- a/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-customized.json +++ b/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-customized.json @@ -16,8 +16,14 @@ }, "enforceEnum": true, "enumNames": [ - "Item 1", - "Item 2" + { + "richText": true, + "value": "

Item 1

" + }, + { + "richText": true, + "value": "

Item 2

" + } ], "default": "0", "screenReaderText": "'custom text'", diff --git a/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-datalayer.json b/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-datalayer.json index 6662d77b6d..870734a41e 100644 --- a/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-datalayer.json +++ b/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton-datalayer.json @@ -9,8 +9,12 @@ "readOnly": false, "enforceEnum": true, "enumNames": [ - "Male", - "Female" + { + "value": "Male" + }, + { + "value": "Female" + } ], "label": { "value": "Gender" diff --git a/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton.json b/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton.json index 078687521f..9fd2561296 100644 --- a/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton.json +++ b/bundles/af-core/src/test/resources/form/radiobutton/exporter-radiobutton.json @@ -5,8 +5,14 @@ "type": "string", "enforceEnum": true, "enumNames": [ - "Item 1", - "Item 2" + { + "richText": true, + "value": "

Item 1

" + }, + { + "richText": true, + "value": "

Item 2

" + } ], "label": { "value": "Radio Button" diff --git a/bundles/af-core/src/test/resources/form/radiobutton/test-content.json b/bundles/af-core/src/test/resources/form/radiobutton/test-content.json index d68b10d0c8..076198ea4c 100644 --- a/bundles/af-core/src/test/resources/form/radiobutton/test-content.json +++ b/bundles/af-core/src/test/resources/form/radiobutton/test-content.json @@ -8,13 +8,14 @@ "orientation": "vertical", "jcr:lastModifiedBy": "admin", "jcr:created": "Tue Sep 13 2022 15:17:35 GMT+0530", + "areOptionsRichText": true, "enum": [ "0", "1" ], "enumNames": [ - "Item 1", - "Item 2" + "

Item 1

", + "

Item 2

" ], "jcr:lastModified": "Tue Sep 13 2022 15:18:50 GMT+0530", "fieldType": "radio-group" @@ -37,14 +38,15 @@ "dorColspan": "4", "assistPriority": "custom", "jcr:created": "Tue Sep 13 2022 15:17:35 GMT+0530", + "areOptionsRichText": true, "enum": [ "0", "1" ], "type": "string", "enumNames": [ - "Item 1", - "Item 2" + "

Item 1

", + "

Item 2

" ], "visible": false, "readOnly": true, diff --git a/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json index a2e0b6ead3..b7a56e1246 100644 --- a/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json +++ b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json @@ -23,7 +23,6 @@ "approvalcheckbox", "link" ], - ":type": "core/fd/components/form/termsandconditions/v1/termsandconditions", ":items": { "approvalcheckbox": { "id": "checkbox-9d01a4893a", @@ -57,9 +56,6 @@ "name": "link1694159323342", "type": "string", "enforceEnum": true, - "enumNames": [ - "label for the link" - ], "label": { "value": "" }, @@ -80,7 +76,13 @@ "enum": [ "yourlink" ], - ":type": "core/fd/components/form/checkboxgroup/v1/checkboxgroup" + ":type": "core/fd/components/form/checkboxgroup/v1/checkboxgroup", + "enumNames": [ + { + "value": "label for the link" + } + ] } - } + }, + ":type": "core/fd/components/form/termsandconditions/v1/termsandconditions" } diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/de.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/de.xml index 04ee0e1ebd..0184cfce56 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/de.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/de.xml @@ -129,6 +129,21 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="Zauberer"/> + <_x0039_6b6493f-b93e-4b2d-8b38-3633a3fe6286 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##jcr:title##3329" + sling:message="<p><b>Tier auswählen</b></p>"/> + + <_x0037_c44f84b-8830-4270-ba63-8aa9de935572 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>Katze</u></p>"/> + + + <_x0031_33de41e-050d-4628-8b22-34b8b6dfa9fa + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>Gato</u></p>"/> + + <_x0037_e28c9de-7712-4f7b-969d-0c90f92935af + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##0" + sling:message="<p><i>Chien</i></p>"/> + <_x0032_869e60b-f2eb-4e35-8d17-0673f7d870bc + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>Chat</u></p>"/> diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/hi.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/hi.xml index 81f80c0637..9ab5e0f0b2 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/hi.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/hi.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="जादूगर"/> + <_x0035_3786ca1-ac18-4151-8e13-db1ec440cb44 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##jcr:title##3329" + sling:message="<p><b>पशु का चयन करें</b></p>"/> + + diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/it.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/it.xml index 88d4a55147..06a9c39887 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/it.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/it.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="mago"/> + <_x0038_fa19b1d-324d-453f-895f-60c86adb001c + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##jcr:title##3329" + sling:message="<p><b>Seleziona animale</b></p>"/> + <_x0030_ac73bc4-9c29-470f-9a99-a1c7f685a5b9 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##0" + sling:message="<p><i>Cane</i></p>"/> + <_x0038_23d3ccb-d875-4a8d-9ff9-2a2859d7bdbd + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>Gatto</u></p>"/> diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ja.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ja.xml index 5ade060385..10e9a6fce7 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ja.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ja.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="魔法使い"/> + <_x0030_9640d23-a956-457d-82fa-671bf0750fce + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##jcr:title##3329" + sling:message="<p><b>動物を選択</b></p>"/> + + <_x0038_a1f5c5f-4a24-4c48-a433-ce761870bbb1 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>猫</u></p>"/> diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ko-kr.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ko-kr.xml index 4650cd9bff..c68ecb7698 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ko-kr.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ko-kr.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="마법사"/> + <_x0030_d52109d-2260-4962-b0a4-a589fceb42cd + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##jcr:title##3329" + sling:message="<p><b>동물 선택</b></p>"/> + <_x0030_ab74673-ed86-4d13-853e-86fbcb638588 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##0" + sling:message="<p><i>개</i></p>"/> + diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/pt-br.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/pt-br.xml index 59242cfbb7..6f41b8ee49 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/pt-br.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/pt-br.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="mago"/> + + <_x0031_b25629c-4816-4847-a9d1-63e421b47930 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##0" + sling:message="<p><i>Cão</i></p>"/> + diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ru-ru.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ru-ru.xml index 855f673d2b..67653db508 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ru-ru.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/ru-ru.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="колдун"/> + + + <_x0038_d8b15a1-c3c9-4816-abd6-7e69bc3c477a + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>Кошка</u></p>"/> diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-cn.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-cn.xml index ff03638494..edd3fd1865 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-cn.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-cn.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="巫师"/> + <_x0034_6fd8a2d-db44-4204-aca8-a4e8ecb178f7 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##jcr:title##3329" + sling:message="<p><b>选择动物</b></p>"/> + + <_x0037_79cf790-b54b-429e-b5b2-ebed6ea0cbb7 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>猫</u></p>"/> diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-tw.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-tw.xml index fd7a76f7e6..d317556721 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-tw.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/_jcr_content/dictionary/zh-tw.xml @@ -129,4 +129,19 @@ jcr:primaryType="nt:folder" sling:key="guideContainer##wizard##jcr:title##299" sling:message="巫師"/> + <_x0036_0c96847-776f-406a-9de3-a669f70ca113 + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##jcr:title##3329" + sling:message="<p><b>選擇動物</b></p>"/> + <_x0037_75e6e65-0828-4020-95f6-355249b69aaf + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##0" + sling:message="<p><i>狗</i></p>"/> + <_x0030_a911e93-4cd9-416d-ac7a-1f348014bbed + jcr:mixinTypes="[sling:Message]" + jcr:primaryType="nt:folder" + sling:key="guideContainer##checkboxgroup7##enumNames##7570##1" + sling:message="<p><u>貓</u></p>"/> diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/af2-form-translation/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/af2-form-translation/.content.xml index e47fefc6db..228fda67fc 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/af2-form-translation/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/af2-form-translation/.content.xml @@ -48,7 +48,7 @@ enum="[0,1]" enumNames="[Item 1, Item 2]" fieldType="checkbox-group" - name="checkboxgroup1678442866069" + name="checkboxgroup1" type="number[]"/> + diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/checkboxgroup/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/checkboxgroup/basic/.content.xml index 30e1d78040..9dc2b02920 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/checkboxgroup/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/checkboxgroup/basic/.content.xml @@ -153,6 +153,28 @@ textIsRich="[true,true]" type="number[]" visible="{Boolean}true"/> + diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/basic/.content.xml index 735577ac08..fc040d93fc 100644 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/basic/.content.xml @@ -118,7 +118,7 @@ sling:resourceType="core/fd/components/form/toggleablelink/v1/toggleablelink" enabled="{Boolean}true" enum="http://localhost" - enumNames="[label for the link]" + enumNames="label for the link" fieldType="checkbox-group" hideTitle="false" name="link1695211072051" diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/af-commons/v1/fieldTemplates/label.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/af-commons/v1/fieldTemplates/label.html index 07f79c829e..823bd9bd9b 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/af-commons/v1/fieldTemplates/label.html +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/af-commons/v1/fieldTemplates/label.html @@ -1,4 +1,4 @@ -