From ff09432336c6c28f190ece9e99dff83476452d70 Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 12 Mar 2024 17:16:51 +0530 Subject: [PATCH 01/21] Add support for displayValueExpression --- .../models/v1/form/NumberInputImpl.java | 12 +- .../components/models/form/NumberInput.java | 10 + .../java/com/adobe/cq/forms/core/Utils.java | 2 +- .../models/v1/form/NumberInputImplTest.java | 8 + ...er-numberinput-displayvalueExpression.json | 22 + .../form/numberinput/test-content.json | 8 + ...ve-form-aem-allowed-components.schema.json | 18 + ...aem-responsive-grid-properties.schema.json | 52 + ...-form-container-dor-properties.schema.json | 41 + ...adaptive-form-data-constraints.schema.json | 147 ++ .../adaptive-form-data-layer.schema.json | 60 + .../0.12.5/adaptive-form-defaults.schema.json | 255 +++ .../adaptive-form-dor-properties.schema.json | 58 + .../adaptive-form-enum-name.schema.json | 19 + .../0.12.5/adaptive-form-events.schema.json | 79 + .../0.12.5/adaptive-form-label.schema.json | 24 + .../adaptive-form-properties.schema.json | 320 ++++ ...ive-form-property-restrictions.schema.json | 396 +++++ .../adaptive-form-sign-properties.schema.json | 25 + ...daptive-form-signer-properties.schema.json | 83 + .../schema/0.12.5/adaptive-form.schema.json | 1423 +++++++++++++++++ .../test/resources/schema/0.12.5/form.json | 14 + .../js/functions.js | 17 +- ...mpl.dev.DynamicToggleProviderImpl.cfg.json | 4 +- .../samples/numberinput/basic/.content.xml | 28 +- .../clientlibs/site/js/numberinputview.js | 2 +- ui.frontend/package-lock.json | 79 +- ui.frontend/package.json | 4 +- ui.tests/test-module/package-lock.json | 9 +- .../numberinput/numberinput.runtime.spec.js | 22 + 30 files changed, 3196 insertions(+), 45 deletions(-) create mode 100644 bundles/af-core/src/test/resources/form/numberinput/exporter-numberinput-displayvalueExpression.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json create mode 100644 bundles/af-core/src/test/resources/schema/0.12.5/form.json diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java index 3bcaa83dea..6293e84f7b 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java @@ -15,6 +15,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ package com.adobe.cq.forms.core.components.internal.models.v1.form; +import javax.annotation.Nullable; import javax.annotation.PostConstruct; import org.apache.sling.api.SlingHttpServletRequest; @@ -24,7 +25,6 @@ import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy; import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; -import org.jetbrains.annotations.Nullable; import com.adobe.cq.export.json.ComponentExporter; import com.adobe.cq.export.json.ExporterConstants; @@ -65,6 +65,10 @@ public class NumberInputImpl extends AbstractFieldImpl implements NumberInput { private Boolean excludeMinimumCheck; /** End **/ + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) + @Nullable + protected String displayValueExpression; + private Long exclusiveMinimumVaue; private Long exclusiveMaximumValue; @@ -114,4 +118,10 @@ private void initNumberInput() { minimum = null; } } + + @Override + @Nullable + public String getDisplayValueExpression() { + return displayValueExpression; + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java index 3dbb87a8e3..9383730b84 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java @@ -28,6 +28,16 @@ @ConsumerType public interface NumberInput extends Field, NumberConstraint { + /** + * The expression that when evaluated would determine what the displayValue of a field would be + * + * @return display value expression of the field + * @since com.adobe.cq.forms.core.components.models.form 5.2.0 + */ + default String getDisplayValueExpression() { + return null; + } + @Nullable @JsonIgnore default String getEditFormat() { diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java index 6617127727..9b1a8f94eb 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java @@ -125,7 +125,7 @@ public static void testSchemaValidation(@NotNull Object model) { // create an instance of the JsonSchemaFactory using version flag JsonSchemaFactory schemaFactory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7); try { - InputStream schemaStream = Utils.class.getResourceAsStream("/schema/0.12.1/adaptive-form.schema.json"); + InputStream schemaStream = Utils.class.getResourceAsStream("/schema/0.12.5/adaptive-form.schema.json"); JsonSchema schema = schemaFactory.getSchema(schemaStream); // read data from the stream and store it into JsonNode JsonNode json = objectMapper.readTree(jsonStream); diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java index bc31c7a919..d7d703d7d2 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java @@ -55,6 +55,8 @@ public class NumberInputImplTest { private static final String PATH_NUMBER_INPUT = CONTENT_ROOT + "/numberinput"; private static final String PATH_NUMBER_INPUT_DATALAYER = CONTENT_ROOT + "/numberinput-datalayer"; + private static final String PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION = CONTENT_ROOT + "/numberinput-displayvalueExpression"; + private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @BeforeEach @@ -366,4 +368,10 @@ void testJSONExportDataLayer() throws Exception { FieldUtils.writeField(numberInput, "dataLayerEnabled", true, true); Utils.testJSONExport(numberInput, Utils.getTestExporterJSONPath(BASE, PATH_NUMBER_INPUT_DATALAYER)); } + + @Test + void testJSONExportForEmptyValidationExpression() throws Exception { + NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION, NumberInput.class, context); + Utils.testJSONExport(numberInput, Utils.getTestExporterJSONPath(BASE, PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION)); + } } diff --git a/bundles/af-core/src/test/resources/form/numberinput/exporter-numberinput-displayvalueExpression.json b/bundles/af-core/src/test/resources/form/numberinput/exporter-numberinput-displayvalueExpression.json new file mode 100644 index 0000000000..40076d98d0 --- /dev/null +++ b/bundles/af-core/src/test/resources/form/numberinput/exporter-numberinput-displayvalueExpression.json @@ -0,0 +1,22 @@ +{ + "id": "numberinput-30f1c1a86c", + "fieldType": "number-input", + "name": "abc", + "type": "number", + "displayValueExpression": "($field.$value & abc)", + "label": { + "value": "def" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/numberinput-displayvalueExpression" + }, + ":type": "core/fd/components/form/numberinput/v1/numberinput" +} diff --git a/bundles/af-core/src/test/resources/form/numberinput/test-content.json b/bundles/af-core/src/test/resources/form/numberinput/test-content.json index 4fd1658e88..57dd336389 100644 --- a/bundles/af-core/src/test/resources/form/numberinput/test-content.json +++ b/bundles/af-core/src/test/resources/form/numberinput/test-content.json @@ -6,6 +6,14 @@ "jcr:title" : "def", "fieldType": "number-input" }, + "numberinput-displayvalueExpression" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/numberinput/v1/numberinput", + "name" : "abc", + "jcr:title" : "def", + "fieldType": "number-input", + "displayValueExpression": "($field.$value & abc)" + }, "numberinput-customized" : { "jcr:primaryType": "nt:unstructured", "sling:resourceType" : "core/fd/components/form/numberinput/v1/numberinput", diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json new file mode 100644 index 0000000000..9a821f8d89 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json @@ -0,0 +1,18 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-aem-allowed-components.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "Allowed Components object for the current panel.", + "description": "This is applicable only if the panel's layout is grid system. This property is useful if needs to show list of allowed components in the client while authoring the panel.", + "properties": { + "components": { + "type": "array", + "title": "List of simple objects representing all Allowed Components for the given panel" + }, + "applicable": { + "type": "boolean", + "title": "Is the given panel contained by a page, with authored template structure and is the given panel set as editable (unlocked)", + "description": "true if the template has structure support and the panel is editable, false otherwise" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json new file mode 100644 index 0000000000..91ce8e01b8 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json @@ -0,0 +1,52 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-aem-responsive-grid-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "allowedComponents": { + "$ref": "./adaptive-form-aem-allowed-components.schema.json" + }, + "appliedCssClassNames": { + "title": "CSS classes delimited using a SPACE character", + "description": "Describes the style system information associated with the current form element", + "type": "string", + "examples": [ + { + "appliedCssClassNames": "outlined red-border" + } + ] + }, + "gridClassNames": { + "title": "The CSS class names to be applied to the current panel delimited using a SPACE character", + "description": "This is applicable only if the panel's layout is grid system.", + "type": "string", + "examples": [ + { + "gridClassNames": "aem-Grid aem-Grid--12 aem-Grid--default--12" + } + ] + }, + "columnClassNames": { + "title": "The CSS class names associated with each responsive grid column and listed by column name", + "description": "This is applicable only if the panel's layout is grid system.", + "type": "object", + "examples": [ + { + "columnClassNames": { + "title_v3": "aem-GridColumn aem-GridColumn--default--12" + } + } + ] + }, + "columnCount": { + "title": "The number of columns available for direct children in the panel.", + "description": "This is applicable only if the panel's layout is grid system.", + "type": "number", + "examples": [ + { + "columnCount": 12 + } + ] + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json new file mode 100644 index 0000000000..a1c39c95fe --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json @@ -0,0 +1,41 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-container-dor-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "dorType": { + "title": "DOR Type", + "description": "Describes the type of Document of Record (DOR)", + "type": "string", + "enum": [ + "generate", + "select" + ], + "examples": [ + { + "dorType": "generate" + } + ] + }, + "dorTemplateRef": { + "title": "DOR Template Reference", + "description": "Reference to the template for the Document of Record (DOR).", + "type": "string", + "examples": [ + { + "dorTemplateRef": "/content/dam/formsanddocuments/acro form conversion.pdf" + } + ] + }, + "dorTemplateType": { + "title": "DOR Template Type", + "description": "Type of the template for the Document of Record (DOR).", + "enum": [ + "acroform", + "xfa" + ], + "type": "string" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json new file mode 100644 index 0000000000..a2320e3304 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json @@ -0,0 +1,147 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-data-constraints.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Constraints applicable to fields", + "type": "object", + "properties": { + "accept": { + "title": "The constraint is applicable for fields having type file or with fields having type string and format as data-url / binary. It signifies the list of IANA media types that fields can accept.", + "type": "array", + "items": { + "type": "string" + } + }, + "enforceEnum": { + "title": "Whether a user can enter a value that is not present in the enum array", + "description": "If set to true, a user will be able to enter any other value that is not in the list of enum. That generally means that enum is used a aid for users to enter the value but is not a validation constraint.", + "type": "boolean" + }, + "exclusiveMaximum": { + "title": "maximum value or date (exclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "exclusiveMinimum": { + "title": "minimum value or date (exclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "format": { + "title": "formats as specified in JSON Schema. The constraint is applicable only for string data types", + "type": "string", + "enum": [ + "date", + "email", + "date-time", + "data-url" + ] + }, + "maxFileSize": { + "title": "The constraint is applicable for fields having type file or with fields having type string and format as data-url / binary. It signifies the maximum file size as per IEC specification", + "type": "string" + }, + "maximum": { + "title": "maximum value or date (inclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "maxItems": { + "title": "Maximum number of items in a field/panel capturing array data", + "type": "number" + }, + "maxOccur": { + "title": "Maximum number of occurrence of repeating panel - capturing array data,", + "type": "number" + }, + "maxLength": { + "title": "Maximum Length of the data. The constraint is applicable only for string data types", + "type": "number" + }, + "minimum": { + "title": "minimum value or date (inclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "minItems": { + "title": "Minimum number of items in a field/panel capturing array data", + "type": "number" + }, + "minOccur": { + "title": "Minimum number of occurrence of repeating panel - capturing array data", + "type": "number" + }, + "minLength": { + "title": "Minimum Length of the data. The constraint is applicable only for string data types", + "type": "number" + }, + "pattern": { + "title": "The regular expression against which the value will be compared against", + "type": "string", + "format": "regex" + }, + "required": { + "type": "boolean", + "title": "Indicates whether the value is required or not" + }, + "step": { + "title": "The constraint is applicable for fields having type number. It signifies the value should be a multipleOf some number", + "type": "number" + }, + "type": { + "title": "Data Type of the value that this field captures. When submitting the value will be coerced into the format specified by the type", + "type": "string", + "enum": [ + "string", + "file", + "number", + "array", + "object", + "string[]", + "file[]", + "number[]", + "boolean[]", + "boolean" + ] + }, + "uniqueItems": { + "title": "Array items must be unique", + "type": "boolean" + }, + "validationExpression": { + "type": "string", + "format": "json-formula" + }, + "displayValueExpression": { + "type": "string", + "format": "json-formula" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json new file mode 100644 index 0000000000..29d3cf1583 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json @@ -0,0 +1,60 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-data-layer.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "@id": { + "type": "string", + "title": "Id of the form element" + }, + "@type": { + "type": "string", + "title": "Type of the form element used in the data layer" + }, + "repo:modifyDate": { + "type": "string", + "title": "Last modified date using ISO 8601 standard" + }, + "parentId": { + "type": "string", + "title": "Parent id of the form element" + }, + "dc:title": { + "type": "string", + "title": "Label of the form element used in the data layer" + }, + "dc:description": { + "type": "string", + "title": "Description of the form element used in the data layer" + }, + "xdm:text": { + "type": "string", + "title": "Text of the form element used in the data layer" + }, + "xdm:linkURL": { + "type": "string", + "title": "Link URL of the form element used in the data layer" + }, + "fieldType": { + "title": "Type of widget to show to the user for capturing the data", + "enum": [ + "text-input", + "number-input", + "date-input", + "file-input", + "multiline-input", + "drop-down", + "radio-group", + "checkbox-group", + "checkbox", + "switch", + "plain-text", + "button", + "panel", + "image", + "email", + "captcha" + ] + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json new file mode 100644 index 0000000000..f1ee139984 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json @@ -0,0 +1,255 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-defaults.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "The schema defines the default field types for Form Fields", + "allOf": [ + { + "title": "Default field for capturing date types is date-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "string" + }, + "format": { + "const": "date" + } + }, + "required": [ + "type", + "format" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "date-input" + } + } + } + }, + { + "title": "Default field for capturing file types is file-input", + "if": { + "type": "object", + "properties": { + "type": { + "enum": [ + "file", + "file[]" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "file-input" + } + } + } + }, + { + "title": "Default field for capturing file types is file-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "string" + }, + "format": { + "enum": [ + "binary", + "data-url" + ] + } + }, + "required": [ + "type", + "format" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "file-input" + } + } + } + }, + { + "title": "Default field for capturing string type is text-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "string" + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "text-input" + } + } + } + }, + { + "title": "Default Field for capturing number types is number-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "number" + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "number-input" + } + } + } + }, + { + "title": "Default field for capturing data that can be only be one of two values is checkbox", + "if": { + "type": "object", + "properties": { + "enum": { + "type": "array", + "maxItems": 2 + } + }, + "required": [ + "enum" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "checkbox" + } + } + } + }, + { + "title": "Default field for capturing boolean data is checkbox", + "if": { + "type": "object", + "properties": { + "type": { + "const": "boolean" + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "checkbox" + }, + "enum": { + "default": [ + true, + false + ] + } + } + } + }, + { + "title": "Default field for capturing data that allows only a set of options is drop-down", + "if": { + "type": "object", + "properties": { + "enum": { + "type": "array", + "minItems": 3 + } + }, + "required": [ + "enum" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "drop-down" + } + } + } + }, + { + "title": "Default field for capturing complex types is panel", + "if": { + "type": "object", + "properties": { + "items": { + "type": [ + "array", + "object" + ] + } + }, + "required": [ + "items" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "panel" + } + } + } + }, + { + "title": "Default value of dataRef for static text is none", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "button", + "plain-text" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "dataRef": { + "default": "none" + } + } + } + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json new file mode 100644 index 0000000000..baaee5328b --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json @@ -0,0 +1,58 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-dor-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "dorColspan": { + "title": "DOR Colspan", + "description": "Specifies the colspan attribute for the Document of Record (DOR). This attribute controls the number of columns a form element should span.", + "type": "string" + }, + "breakAfterText": { + "title": "Break After Text", + "description": "Indicates whether a break should occur after the text content of the Document of Record (DOR). This affects the layout and presentation of the DOR.", + "type": "string" + }, + "breakBeforeText": { + "title": "Break Before Text", + "description": "Indicates whether a break should occur before the text content of the Document of Record (DOR). This influences the layout and presentation of the DOR.", + "type": "string" + }, + "overflowText": { + "title": "Overflow Text", + "description": "Specifies how overflow should be handled for the text content of the Document of Record (DOR). This property controls how text exceeding the available space is displayed.", + "type": "string" + }, + "dorLayoutType": { + "title": "DOR Layout Type", + "description": "Defines the layout type for the Document of Record (DOR). This property determines how the DOR elements are arranged and presented.", + "type": "string" + }, + "dorNumCols": { + "title": "DOR Number of Columns", + "description": "Specifies the number of columns for the layout of the Document of Record (DOR). This property determines how the DOR elements are arranged and presented in columns.", + "type": "string" + }, + "dorBindRef": { + "title": "DOR Binding Reference", + "description": "Specifies the binding reference for the Document of Record (DOR). This property determines how the DOR elements are bound to data.", + "type": "string" + }, + "dorExclusion": { + "title": "DOR Exclusion.", + "description": "Exclusion flag for the Document of Record (DOR).", + "type": "boolean" + }, + "dorExcludeTitle": { + "title": "Exclude Title in DOR.", + "description": "Flag to exclude title in the Document of Record (DOR).", + "type": "boolean" + }, + "dorExcludeDescription": { + "title": "Exclude Description in DOR.", + "description": "Flag to exclude description in the Document of Record (DOR).", + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json new file mode 100644 index 0000000000..9abea9636c --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json @@ -0,0 +1,19 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-enum-name.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "richText": { + "type": "boolean", + "default": false, + "title": "If the value of the option/enumName is to be considered as rich text or plain text" + }, + "value": { + "type": "string", + "title": "A user friendly text to display for the possible options to be shown to the end user. If the rich text property is set to true, the contents will be considered as Rich Text." + } + }, + "required": [ + "value" + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json new file mode 100644 index 0000000000..609dfc343e --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json @@ -0,0 +1,79 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-events.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Specify what operations to perform on certain user or custom events.", + "description": "Events is a dictionary of eventName to the actions to perform. Whenever the event is dispatched the expressions defined on that event are evaluated. The return value of that expression is applied to the field. The return value of the expression can be either of\n * null, literal or array: The value property of the field is set to the return value\n * dictionary: The field json is merged with the returned dictionary\n * empty dictionary: the field should not be modified.", + "$defs": { + "SingleEventHandler": { + "type": "string", + "format": "json-formula" + }, + "EventHandler": { + "oneOf": [ + { + "$ref": "#/$defs/SingleEventHandler" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/SingleEventHandler" + } + } + ] + } + }, + "type": "object", + "properties": { + "click": { + "$ref": "#/$defs/EventHandler" + }, + "initialize": { + "$ref": "#/$defs/EventHandler" + }, + "focus": { + "$ref": "#/$defs/EventHandler" + }, + "blur": { + "$ref": "#/$defs/EventHandler" + }, + "change": { + "$ref": "#/$defs/EventHandler" + }, + "submit": { + "$ref": "#/$defs/EventHandler" + } + }, + "propertyNames": { + "anyOf": [ + { + "enum": [ + "click", + "initialize", + "focus", + "blur", + "change", + "submit", + "submitError", + "submitFailure", + "submitSuccess" + ] + }, + { + "pattern": "custom:[a-zA-Z0-9]+" + } + ], + "errorMessage": "${0} is not a valid Event Name. It should be either click, initialize, focus, blur, change, submitError, submitFailure, submitSuccess or a custom event" + }, + "examples": [ + { + "Terms&Conditions": [ + { + "name": "terms" + }, + { + "click": "{value: true}" + } + ] + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json new file mode 100644 index 0000000000..973e1d0a0d --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json @@ -0,0 +1,24 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-label.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "richText": { + "type": "boolean", + "default": false, + "title": "If the value of the label is to be considered as rich text or plain text" + }, + "visible": { + "type": "boolean", + "title": "If the field's visible property is false, this property is ignored.", + "default": true + }, + "value": { + "type": "string", + "title": "The content of the label. If the rich text property is set to true, the contents will be considered as Rich Text" + } + }, + "required": [ + "value" + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json new file mode 100644 index 0000000000..479c282d31 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json @@ -0,0 +1,320 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "$defs": { + "SingleEventHandler": { + "type": "string", + "format": "json-formula" + }, + "EventHandler": { + "oneOf": [ + { + "$ref": "#/$defs/SingleEventHandler" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/SingleEventHandler" + } + } + ] + } + }, + "allOf": [ + { + "$ref": "./adaptive-form-aem-responsive-grid-properties.schema.json" + }, + { + "type": "object", + "properties": { + ":type": { + "type": "string", + "title": "A hint to the rendering engine for rendering custom components." + }, + "altText": { + "title": "For images an alternate string to be displayed in case image cannot be shown", + "type": "string" + }, + "autocomplete": { + "title": "Provide assistance to the end users to autocomplete values saved during previous form filling sessions", + "type": "string" + }, + "checked": { + "title": "Indicates the checked status of the checkbox. The property is available only for fieldType checkbox If the value of this property is true, then the checkbox is selected and its value is set to on value. This value overrides the default property in case of a conflict.", + "type": "boolean" + }, + "constraintMessages": { + "title": "An object containing the custom error messages to be shown to the end user on different constraint validation", + "type": "object", + "propertyNames": { + "enum": [ + "type", + "required", + "minimum", + "maximum", + "minLength", + "maxLength", + "step", + "format", + "pattern", + "minItems", + "maxItems", + "maxOccur", + "minOccur", + "maxFileSize", + "accept", + "uniqueItems", + "enforceEnum", + "validationExpression" + ], + "errorMessage": "${0} is not a valid constraintMessage" + } + }, + "dataFormat": { + "type": "string", + "title": "The format in which the value will be exported or submitted. Applicable for date and number types." + }, + "dataRef": { + "type": [ + "string", + "null" + ], + "title": "The jsonpath of the data instance that is mapped to the field's value.", + "description": "It will be defined relative to the parent's dataRef property except for the two conditions. * null signifying don't save the data of this field or panel. * jsonpath begining with \"$.\" signifying that the jsonpath is not relative to the parent's dataRef property.\nIf the parent's dataRef is set to \"none\", then it will be relative to the" + }, + "default": { + "title": "The value of the field when no value is provided by the end user or data model.", + "description": "The type of this property should match the value of the `type` property defined in the Field. If not, then a type coercion will be tried and if that fails, the value will be set to null.", + "oneOf": [ + { + "type": [ + "string", + "number", + "boolean" + ] + }, + { + "type": "array", + "items": { + "type": [ + "string", + "number", + "boolean" + ] + } + } + ] + }, + "description": { + "type": "string", + "title": "Extra description to be shown to the user to aid in form filling experience. It can be rich text. Can be used as help text for a field or a top level description for a Panel" + }, + "displayFormat": { + "type": "string", + "title": "The format in which the value will be displayed to the user on screen in the field.", + "description": "The format in which the value will be displayed to the user on screen in the field. Applicable for date and number types. For example when using a currency field, the currency sign should be shown to the user." + }, + "editFormat": { + "type": "string", + "title": "The format in which the value will be edited by the user.", + "description": "The format in which the value will be edited by the user. Applicable for date and number types. For instance users in Germany would want to interchange decimal (.) and comma (,) when entering numerical values." + }, + "emptyValue": { + "type": [ + "string" + ], + "title": "The value when user has not entered any value in the field", + "description": "Determines what value should be saved when user has not entered any value in the field. Can be one of\n * null\n * undefined\n * \"\" (empty string) (only valid for dataType = string)", + "enum": [ + "null", + "undefined", + "" + ] + }, + "enabled": { + "type": "boolean", + "title": "whether the field is enabled and takes part in rules, events etc. A disabled field can have calculations and custom events" + }, + "enum": { + "title": "A list of options to put restrictions on the possible values of the field", + "description": "The type of values in the enum array must match the value of the `type` property defined in the field. For array type fields, the type of element in the In case the `type` property is not defined, then the type of elements in the enum becomes the value of the `type` property. If the value of the `type` property doesn't match with the type of values in the `enum` array, then a type coercion will be made to match the `type` property. If the coercion is not possible, then the value will be set to null", + "type": "array", + "items": { + "type": [ + "string", + "boolean", + "number" + ] + }, + "uniqueItems": true + }, + "enumNames": { + "title": "A user friendly text to display for the possible options to be shown to the end user.", + "description": "The length of enum and enumNames array must match. In case the length of enum is greator, then those will be used as display text for the user. If the length of enumNames is greator, those will be discarded.", + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "./adaptive-form-enum-name.schema.json" + } + ] + } + }, + "events": { + "$ref": "./adaptive-form-events.schema.json" + }, + "fieldType": { + "title": "Type of widget to show to the user for capturing the data", + "description": "It must be one of the types from the list * text-input * number-input * date-input * file-input * drop-down * radio-group * plain-text * checkbox * button * plain-text * panel * multiline-input * panel * image * email * captcha", + "enum": [ + "text-input", + "number-input", + "date-input", + "file-input", + "multiline-input", + "drop-down", + "radio-group", + "checkbox-group", + "checkbox", + "switch", + "plain-text", + "button", + "panel", + "image", + "email", + "captcha" + ] + }, + "label": { + "$ref": "./adaptive-form-label.schema.json" + }, + "dataLayer": { + "$ref": "./adaptive-form-data-layer.schema.json" + }, + "name": { + "type": "string", + "title": "Name of the element. It is also the key in the JSON data, if dataRef is not defined explicitly, that the form produces. If two fields/panels under a same panel have the same name, their values will be same" + }, + "placeholder": { + "type": "string", + "title": "The placeholder to show on the widget." + }, + "properties": { + "title": "An object containing custom properties that can be modified via rules as well.", + "type": "object", + "properties": { + "fd:dor": { + "$ref": "./adaptive-form-dor-properties.schema.json" + } + }, + "additionalProperties": true + }, + "readOnly": { + "type": "boolean", + "title": "whether the field should be readOnly to author or not", + "description": "Determines how an element is treated: 'readOnly=true' means it cannot be modified by user. It will participate in all the events." + }, + "richText": { + "type": "boolean", + "description": "whether the content of the text to be treated as rich text or not" + }, + "rules": { + "type": "object", + "title": "Rules that modify the property of the object dynamically", + "description": "An author can dynamically change any property that is defined in the spec as modifiable. The rules are evaluated whenever the dependency changes. Apart from properties defined on the field, rules can have an extra key `value` which auto computes the value of the field", + "additionalProperties": { + "type": "string" + }, + "propertyNames": { + "not": { + "enum": [ + "name", + "default", + "type", + "fieldType", + "items", + "displayFormat", + "editFormat", + "rules", + "events", + "props" + ] + } + }, + "examples": [ + { + "rules": { + "required": "$form.maritalStatus.value == 'married'" + } + }, + { + "lastName": { + "name": "lastName", + "rules": { + "value": "$form.firstName.value & ' ' & $form.lastName.value" + } + } + } + ] + }, + "screenReaderText": { + "type": "string", + "title": "a string to indicate the text to be read by screen readers" + }, + "tooltip": { + "type": "string", + "title": "Tooltip of the form element" + }, + "visible": { + "type": "boolean", + "title": "whether the field should be visible to author or not" + }, + "id": { + "type": "string", + "title": "unique identifier for a form element" + }, + "items": { + "title": "Fields/Panels inside a Panel", + "description": "If the Fields inside a panel are repeatable then the items should be an array containing only 1 field", + "type": "array", + "errorMessage": { + "oneOf": "Items must be an array with atleast 1 field" + } + }, + "repeatable": { + "type": "boolean", + "title": "whether the field/panel should be repeatable or not", + "description": "If the property is present on a field, then the data would be generated as an array depending upon the type property on the field and if the property is present on a panel then the data would be an array of object/array depending upon the value of the type property. If the type is object, then items must have a name property. If type is array, then name property in the items would be ignored." + }, + ":items": { + "title": "Fields/Panels inside a Panel", + "description": "If the Fields inside a panel are repeatable then the items should be an array containing only 1 field", + "type": "object", + "errorMessage": { + "oneOf": "Items must be an object with atleast 1 field" + } + }, + ":itemsOrder": { + "title": "Order of Fields/Panels inside a Panel", + "description": "Order of items in the object specified by :items", + "type": "array", + "errorMessage": { + "oneOf": "Items Order must be an array with atleast 1 field" + }, + "examples": [ + { + ":itemsOrder": [ + "firstName", + "lastName" + ] + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json new file mode 100644 index 0000000000..e5d5f34957 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json @@ -0,0 +1,396 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-property-restrictions.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "$defs": { + "Date": { + "title": "property with type date", + "type": "string", + "format": "date" + }, + "DateField": { + "type": "object", + "properties": { + "type": { + "enum": [ + "string", + "string[]" + ] + }, + "format": { + "const": "date" + } + }, + "required": [ + "type", + "format" + ] + }, + "NumberField": { + "type": "object", + "properties": { + "type": { + "enum": [ + "number", + "number[]" + ] + } + }, + "required": [ + "type" + ] + }, + "DateOrNumberField": { + "type": "object", + "oneOf": [ + { + "$ref": "#/$defs/NumberField" + }, + { + "$ref": "#/$defs/DateField" + } + ] + }, + "StringTypeField": { + "title": "field having type string", + "type": "object", + "properties": { + "type": { + "enum": [ + "string", + "string[]" + ] + } + } + }, + "FileTypeField": { + "title": "field with type file having format as data-url or binary", + "type": "object", + "properties": { + "type": { + "enum": [ + "string", + "string[]" + ] + }, + "format": { + "enum": [ + "binary", + "data-url" + ] + } + } + }, + "OptimizedFileTypeField": { + "title": "field having type file", + "type": "object", + "properties": { + "type": { + "enum": [ + "file", + "file[]" + ] + } + } + } + }, + "title": "The schema defines constraints on which Headless Adaptive Form properties can be used together", + "allOf": [ + { + "title": "minimum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "minimum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "minimum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "minimum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "minimum constraint is valid only for numeric or date types" + }, + { + "title": "exclusiveMinimum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "exclusiveMinimum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "exclusiveMinimum constraint is valid only for numeric or date types" + }, + { + "title": "maximum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "maximum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "maximum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "maximum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "maximum constraint is valid only for numeric or date types" + }, + { + "title": "exclusiveMaximum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "exclusiveMinimum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "exclusiveMaximum constraint is valid only for numeric or date types" + }, + { + "title": "step constraint is valid only for number type or date types", + "type": "object", + "dependencies": { + "step": { + "$ref": "#/$defs/DateOrNumberField" + } + }, + "errorMessage": "step constraint is valid only for date and number type" + }, + { + "title": "format, pattern, minLength and maxLength constraint are valid only for fields with type string", + "type": "object", + "dependencies": { + "format": { + "$ref": "#/$defs/StringTypeField" + }, + "pattern": { + "$ref": "#/$defs/StringTypeField" + }, + "minLength": { + "$ref": "#/$defs/StringTypeField" + }, + "maxLength": { + "$ref": "#/$defs/StringTypeField" + } + }, + "errorMessage": "format, pattern, minLength and maxLength constraint are valid only for fields with type string" + }, + { + "title": "enforceEnum is valid only if enum property is defined", + "type": "object", + "dependencies": { + "enforceEnum": { + "type": "object", + "required": [ + "enum" + ] + } + }, + "errorMessage": "enforceEnum is valid only if enum property is defined" + }, + { + "title": "minItems, maxItems, uniqueItems are valid only for type array", + "type": "object", + "dependencies": { + "minItems": { + "type": "object", + "properties": { + "type": { + "enum": [ + "array", + "string[]", + "boolean[]", + "number[]", + "file[]" + ] + } + } + }, + "maxItems": { + "type": "object", + "properties": { + "type": { + "enum": [ + "array", + "string[]", + "boolean[]", + "number[]", + "file[]" + ] + } + } + }, + "uniqueItems": { + "type": "object", + "properties": { + "type": { + "enum": [ + "array", + "string[]", + "boolean[]", + "number[]", + "file[]" + ] + } + } + } + }, + "errorMessage": "minItems, maxItems are valid only for type array" + }, + { + "title": "maxFileSize, accept are valid only for file types", + "type": "object", + "dependencies": { + "maxFileSize": { + "oneOf": [ + { + "$ref": "#/$defs/OptimizedFileTypeField" + }, + { + "$ref": "#/$defs/FileTypeField" + } + ] + }, + "accept": { + "oneOf": [ + { + "$ref": "#/$defs/OptimizedFileTypeField" + }, + { + "$ref": "#/$defs/FileTypeField" + } + ] + } + }, + "errorMessage": "maxFileSize, accept are valid only for file types" + }, + { + "title": "editFormat, displayFormat, dataFormat are valid only for fields with type date or number", + "type": "object", + "dependencies": { + "editFormat": { + "$ref": "#/$defs/DateOrNumberField" + }, + "displayFormat": { + "$ref": "#/$defs/DateOrNumberField" + }, + "dataFormat": { + "$ref": "#/$defs/DateOrNumberField" + } + } + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json new file mode 100644 index 0000000000..b0332767dc --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json @@ -0,0 +1,25 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-sign-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "firstSignerFormFiller": { + "title": "First Signer Form Filler", + "description": "Specifies whether the signer is the first form filler.", + "type": "boolean" + }, + "workflowType": { + "title": "Workflow Type", + "enum": [ + "SEQUENTIAL", + "PARALLEL" + ], + "description": "Specifies the type of workflow for the sign.", + "type": "string" + }, + "signers": { + "$ref": "./adaptive-form-signer-properties.schema.json" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json new file mode 100644 index 0000000000..2dd60e1029 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json @@ -0,0 +1,83 @@ +{ + "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-signer-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Signers Information", + "description": "Represents information about signers.", + "type": "object", + "additionalProperties": true, + "properties": { + "signerTitle": { + "title": "Signer Title", + "description": "The title or name of the signer.", + "type": "string" + }, + "email": { + "title": "Email Information", + "description": "Information about the signer's email address.", + "type": "object", + "properties": { + "type": { + "title": "Email Type", + "description": "Indicates whether the email value is sourced from form data or form configuration.", + "type": "string", + "enum": [ + "data", + "form" + ] + }, + "value": { + "title": "Email Address", + "description": "The email address value.", + "type": "string" + } + } + }, + "countryCode": { + "title": "Country Code", + "description": "Information about the country code for the phone number.", + "type": "object", + "properties": { + "type": { + "title": "Country Code Type", + "description": "Indicates whether the country code value is sourced from form data or form configuration.", + "type": "string", + "enum": [ + "data", + "form" + ] + }, + "value": { + "title": "Country Code Value", + "description": "The country code value.", + "type": "string" + } + } + }, + "phone": { + "title": "Phone Number", + "description": "Information about the signer's phone number.", + "type": "object", + "properties": { + "type": { + "title": "Phone Number Type", + "description": "Indicates whether the phone number value is sourced from form data or form configuration.", + "type": "string", + "enum": [ + "data", + "form" + ] + }, + "value": { + "title": "Phone Number Value", + "description": "The phone number value.", + "type": "string" + } + } + }, + "securityOption": { + "title": "Security Option", + "description": "Specifies the security option for the signer.", + "type": "string" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json new file mode 100644 index 0000000000..393c31d9dc --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json @@ -0,0 +1,1423 @@ +{ + "$id": "classpath:/schema/0.12.1/adaptive-form.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "$defs": { + "FormElement": { + "allOf": [ + { + "$ref": "./adaptive-form-properties.schema.json" + }, + { + "$ref": "./adaptive-form-data-constraints.schema.json" + }, + { + "$ref": "./adaptive-form-property-restrictions.schema.json" + } + ] + }, + "TextField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "text-input", + "multiline-input" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "text-input", + "multiline-input" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "autocomplete", + "constraintMessages", + "dataFormat", + "dataRef", + "default", + "description", + "displayFormat", + "editFormat", + "emptyValue", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "pattern", + "placeholder", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "enforceEnum", + "exclusiveMaximum", + "exclusiveMinimum", + "format", + "maximum", + "maxLength", + "minimum", + "minLength", + "pattern", + "required", + "type", + "validationExpression", + "displayValueExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in text-input" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid TextField field type. It should be text-input" + } + } + } + }, + "NumberField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "number-input" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "type": { + "enum": [ + "number", + "integer" + ] + }, + "fieldType": { + "const": "number-input" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "maximum", + "minimum", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "autocomplete", + "constraintMessages", + "dataFormat", + "dataRef", + "default", + "description", + "displayFormat", + "editFormat", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "placeholder", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "enforceEnum", + "exclusiveMaximum", + "exclusiveMinimum", + "maximum", + "minimum", + "required", + "step", + "type", + "validationExpression", + "displayValueExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in NumberField" + } + } + } + }, + "SwitchField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "switch", + "checkbox" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "switch", + "checkbox" + ] + }, + "enum": { + "type": "array", + "maxItems": 2 + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "checked", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "checked", + "constraintMessages", + "dataFormat", + "dataRef", + "default", + "description", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "enforceEnum", + "required", + "type", + "validationExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in SwitchField" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid SwitchField field type. It should be either switch or checkbox" + } + }, + "anyOf": [ + { + "type": "object", + "required": [ + "enum" + ] + }, + { + "type": "object", + "properties": { + "type": { + "const": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "DateField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "date-input" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "date-input" + }, + "type": { + "const": "string" + }, + "format": { + "const": "date" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "maximum", + "minimum", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "constraintMessages", + "dataFormat", + "dataRef", + "default", + "description", + "displayFormat", + "editFormat", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "placeholder", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "enforceEnum", + "exclusiveMaximum", + "exclusiveMinimum", + "format", + "maximum", + "minimum", + "required", + "step", + "type", + "validationExpression", + "displayValueExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in DateField" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid DateField field type. It should be date-input" + } + } + } + }, + "EmailField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "email" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "email" + }, + "type": { + "const": "string" + }, + "format": { + "const": "email" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "maximum", + "minimum", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "constraintMessages", + "dataFormat", + "dataRef", + "default", + "description", + "displayFormat", + "editFormat", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "placeholder", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "enforceEnum", + "exclusiveMaximum", + "exclusiveMinimum", + "format", + "maximum", + "minimum", + "required", + "type", + "validationExpression", + "displayValueExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in EmailFIeld" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid EmailField field type. It should be email" + } + } + } + }, + "SelectionField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "drop-down", + "checkbox-group" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "drop-down", + "checkbox-group" + ] + }, + "type": { + "enum": [ + "string", + "number", + "boolean", + "string[]", + "number[]", + "boolean[]" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "constraintMessages", + "dataRef", + "default", + "description", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "placeholder", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "enforceEnum", + "maxItems", + "minItems", + "required", + "uniqueItems", + "type", + "validationExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in SelectionField" + } + }, + "required": [ + "enum" + ], + "errorMessage": { + "required": { + "enum": "Options are missing from selection. Add an empty enum array" + }, + "properties": { + "fieldType": "${0/fieldType} is not a valid SelectionField field type. It should be either drop-down or checkbox-group" + } + } + } + }, + "RadioGroupField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "radio-group" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "radio-group" + }, + "type": { + "enum": [ + "string", + "number", + "boolean" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "constraintMessages", + "dataRef", + "default", + "description", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "placeholder", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "enforceEnum", + "required", + "type", + "validationExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in RadioGroupField" + } + }, + "required": [ + "enum" + ], + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid radio group field type. It should be radio-group" + } + } + } + }, + "FileField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "file-input" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "file-input" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "constraintMessages", + "dataRef", + "default", + "description", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "label", + "name", + "placeholder", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "accept", + "format", + "maxFileSize", + "maxItems", + "minItems", + "required", + "uniqueItems", + "type", + "validationExpression", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in file-input" + } + } + } + }, + "Button": { + "title": "Clickable Button Field", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "button" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "button" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "label", + "properties", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "dataRef", + "description", + "enabled", + "events", + "fieldType", + "label", + "name", + "properties", + "rules", + "screenReaderText", + "tooltip", + "visible", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Button" + } + } + } + }, + "StaticField": { + "title": "Static Field represents the Field that do not capture value from the user but can be", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "plain-text" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "plain-text" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "properties", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "dataRef", + "events", + "fieldType", + "name", + "properties", + "richText", + "rules", + "visible", + "value", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in StaticField" + } + } + } + }, + "Image": { + "title": "Image Component", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "image" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "image" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "altText", + "description", + "properties", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "altText", + "dataRef", + "description", + "events", + "fieldType", + "name", + "properties", + "rules", + "visible", + "value", + "id", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Image" + } + } + } + }, + "Panel": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "panel" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "allOf": [ + { + "$ref": "#/$defs/Container" + }, + { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "panel" + ] + }, + "type": { + "enum": [ + "object", + "array" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "label", + "maxItems", + "minItems", + "maxOccur", + "minOccur", + "repeatable", + "properties", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "constraintMessages", + "dataRef", + "description", + "enabled", + "events", + "fieldType", + "items", + ":items", + ":itemsOrder", + "label", + "name", + "properties", + "readOnly", + "rules", + "screenReaderText", + "tooltip", + "visible", + "maxItems", + "minItems", + "maxOccur", + "minOccur", + "repeatable", + "required", + "type", + "uniqueItems", + "validationExpression", + "id", + "columnClassNames", + "columnCount", + "allowedComponents", + "appliedCssClassNames", + "dataLayer" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Panel" + } + }, + "anyOf": [ + { + "required": [ + "items" + ] + }, + { + "required": [ + ":items", + ":itemsOrder" + ] + } + ] + } + ] + } + }, + "Captcha": { + "title": "Captcha Component", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "captcha" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "captcha" + ] + } + }, + "propertyNames": { + "enum": [ + ":type", + "label", + "description", + "tooltip", + "fieldType", + "name", + "properties", + "required", + "validationExpression", + "type", + "id", + "appliedCssClassNames", + "dataLayer", + "visible", + "enabled", + "readOnly", + "events" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Captcha" + } + } + } + }, + "CustomElement": { + "if": { + "allOf": [ + { + "type": "object", + "not": { + "required": [ + "fieldType" + ] + } + }, + { + "type": "object", + "required": [ + ":type" + ] + } + ] + }, + "then": { + "type": "object", + "properties": { + ":type": { + "type": "string" + }, + ":itemsOrder": { + "$ref": "#/$defs/ColonItemsOrder" + }, + ":items": { + "$ref": "#/$defs/ColonItems" + } + }, + "required": [ + ":type" + ], + "additionalProperties": true, + "dependencies": { + ":items": { + "type": "object", + "required": [ + ":type", + ":itemsOrder" + ] + } + } + } + }, + "Child": { + "allOf": [ + { + "anyOf": [ + { + "type": "object", + "required": [ + "fieldType" + ] + }, + { + "type": "object", + "required": [ + ":type" + ] + }, + { + "type": "object", + "required": [ + "type" + ] + }, + { + "type": "object", + "required": [ + "enum" + ] + }, + { + "type": "object", + "required": [ + "items" + ] + }, + { + "type": "object", + "required": [ + ":items", + ":itemsOrder" + ] + } + ] + }, + { + "allOf": [ + { + "$ref": "#/$defs/FormElement" + }, + { + "$ref": "#/$defs/FileField" + }, + { + "$ref": "#/$defs/NumberField" + }, + { + "$ref": "#/$defs/DateField" + }, + { + "$ref": "#/$defs/EmailField" + }, + { + "$ref": "#/$defs/SwitchField" + }, + { + "$ref": "#/$defs/SelectionField" + }, + { + "$ref": "#/$defs/RadioGroupField" + }, + { + "$ref": "#/$defs/TextField" + }, + { + "$ref": "#/$defs/Panel" + }, + { + "$ref": "#/$defs/Button" + }, + { + "$ref": "#/$defs/StaticField" + }, + { + "$ref": "#/$defs/Image" + }, + { + "$ref": "#/$defs/Captcha" + }, + { + "$ref": "#/$defs/CustomElement" + } + ] + } + ], + "errorMessage": "Object doesn't match any field type" + }, + "Items": { + "type": "array", + "items": { + "$ref": "#/$defs/Child" + } + }, + "ColonItems": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Child" + } + }, + "ColonItemsOrder": { + "type": "array", + "items": { + "type": "string" + } + }, + "Container": { + "type": "object", + "properties": { + "items": { + "$ref": "#/$defs/Items" + }, + ":items": { + "$ref": "#/$defs/ColonItems" + }, + ":itemsOrder": { + "$ref": "#/$defs/ColonItemsOrder" + }, + "anyOf": [ + { + "required": [ + "items" + ] + }, + { + "required": [ + ":items", + ":itemsOrder" + ] + } + ] + } + } + }, + "type": "object", + "allOf": [ + { + "$ref": "./adaptive-form-aem-responsive-grid-properties.schema.json" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "events": { + "type": "object", + "propertyNames": { + "anyOf": [ + { + "enum": [ + "submit", + "reset", + "initialize" + ] + }, + { + "pattern": "custom:[a-zA-Z0-9]+" + } + ] + } + }, + ":type": { + "type": "string", + "title": "A hint to the rendering engine for rendering custom components." + }, + "action": { + "title": "URL indicating the endpoint where the data would be submitted when submit event is triggered", + "type": "string" + }, + "adaptiveform": { + "anyOf": [ + { + "const": "0.11.0-Pre" + }, + { + "const": "0.12.0" + }, + { + "const": "0.12.1" + } + ] + }, + "description": { + "type": "string", + "title": "A user friendly description of the form" + }, + "fieldType": { + "const": "form" + }, + "id": { + "type": "string", + "title": "unique identifier for a form element" + }, + "items": { + "$ref": "#/$defs/Items" + }, + ":items": { + "$ref": "#/$defs/ColonItems" + }, + ":itemsOrder": { + "$ref": "#/$defs/ColonItemsOrder" + }, + "lang": { + "type": "string", + "title": "The language in which the Form was authored.", + "description": "The language needs to be defined as per the [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) tag" + }, + "metadata": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "grammar": { + "const": "json-formula-1.0.0" + }, + "formattingLanguage": { + "const": "xfa-picture-clause" + } + }, + "required": [ + "version" + ] + }, + "properties": { + "title": "An object containing custom properties that can be modified via rules as well.", + "type": "object", + "properties": { + "fd:dor": { + "$ref": "./adaptive-form-container-dor-properties.schema.json" + }, + "fd:signerInfo": { + "$ref": "./adaptive-form-sign-properties.schema.json" + } + }, + "additionalProperties": true + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "properties" + ] + } + }, + "title": { + "type": "string", + "maxLength": 140, + "title": "A user friendly one line title for the form" + } + } + } + ], + "anyOf": [ + { + "required": [ + "metadata", + "items", + "adaptiveform", + "fieldType" + ] + }, + { + "required": [ + "metadata", + ":items", + ":itemsOrder", + "adaptiveform", + "fieldType" + ] + } + ] +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/form.json b/bundles/af-core/src/test/resources/schema/0.12.5/form.json new file mode 100644 index 0000000000..626fdaaae6 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.12.5/form.json @@ -0,0 +1,14 @@ +{ + "items": [ + ], + "fieldType" : "form", + "metadata": { + "action": "/a/b", + "dataUrl": "/c/d", + "locale": "en-us", + "grammar": "json-formula-1.0.0", + "version": "1.0.0" + }, + "adaptiveform":"0.12.5", + ":type": "core/fd/components/form/container/v2/container" +} diff --git a/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js b/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js index d3bc53a5a4..13f1ad1e15 100644 --- a/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js +++ b/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js @@ -61,7 +61,22 @@ function clearEnums() { return enums; } - +/** + * Formats Credit Card Number + * @name formatCreditCardNumber Formats Credit Card Number + * @param {object} field field whose value to be formatted + * @return {string} + */ +function formatCreditCardNumber(field) +{ + var cardNumber = field.$value ? field.$value + '' : field.$value; + var formattedNumber = cardNumber; + if(cardNumber) { + var maskedNumber = cardNumber.replace(/\d(?=\d{4})/g, '*'); // Replace digits with masked characters except for the last four + var formattedNumber = maskedNumber.replace(/(.{4})/g, '$1 '); // Add spaces after every 4 letters + } + return formattedNumber; +} diff --git a/it/config/src/main/content/jcr_root/apps/system/config/com.adobe.granite.toggle.impl.dev.DynamicToggleProviderImpl.cfg.json b/it/config/src/main/content/jcr_root/apps/system/config/com.adobe.granite.toggle.impl.dev.DynamicToggleProviderImpl.cfg.json index ffef36dda3..10f55312d6 100644 --- a/it/config/src/main/content/jcr_root/apps/system/config/com.adobe.granite.toggle.impl.dev.DynamicToggleProviderImpl.cfg.json +++ b/it/config/src/main/content/jcr_root/apps/system/config/com.adobe.granite.toggle.impl.dev.DynamicToggleProviderImpl.cfg.json @@ -5,6 +5,8 @@ "FT_FORMS-2494", "FT_SKYOPS-60870", "FT_FORMS-8965", - "FT_FORMS-9244" + "FT_FORMS-9244", + "FT_FORMS-13193", + "FT_FORMS-11541" ] } diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/numberinput/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/numberinput/basic/.content.xml index 87b0cf9413..22318918e9 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/numberinput/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/numberinput/basic/.content.xml @@ -3,7 +3,7 @@ jcr:primaryType="cq:Page"> + + + + - \ No newline at end of file + diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/numberinput/v1/numberinput/clientlibs/site/js/numberinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/numberinput/v1/numberinput/clientlibs/site/js/numberinputview.js index 8dab8f2978..057ca8dbb8 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/numberinput/v1/numberinput/clientlibs/site/js/numberinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/numberinput/v1/numberinput/clientlibs/site/js/numberinputview.js @@ -87,7 +87,7 @@ setModel(model) { super.setModel(model); // only initialize if patterns are set - if (this._model._jsonModel.editFormat || this._model._jsonModel.displayFormat + if (this._model._jsonModel.editFormat || this._model._jsonModel.displayFormat || this._model._jsonModel.displayValueExpression || this._model._jsonModel.type === 'integer' || FormView.Utils.isUserAgent('safari')) { if (this.widgetObject == null) { this.initializeWidget(); diff --git a/ui.frontend/package-lock.json b/ui.frontend/package-lock.json index 57470bb486..de0ac1c215 100644 --- a/ui.frontend/package-lock.json +++ b/ui.frontend/package-lock.json @@ -9,9 +9,9 @@ "version": "1.0.0", "license": "Apache-2.0", "dependencies": { - "@aemforms/af-core": "^0.22.73", + "@aemforms/af-core": "^0.22.76", "@aemforms/af-custom-functions": "1.0.4", - "@aemforms/af-formatters": "^0.22.73" + "@aemforms/af-formatters": "^0.22.76" }, "devDependencies": { "@babel/preset-env": "^7.18.2", @@ -26,6 +26,32 @@ "webpack-merge": "^5.8.0" } }, + "../../af2-web-runtime/packages/forms-next-formatters": { + "name": "@aemforms/af-formatters", + "version": "0.22.75", + "extraneous": true, + "license": "Adobe Proprietary", + "devDependencies": { + "@babel/cli": "^7.18.10", + "@babel/core": "^7.19.0", + "@babel/preset-env": "^7.19.0", + "babel-jest": "^29.0.2", + "eslint": "^7.30.0", + "eslint-config-standard": "^16.0.3", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jest": "^24.3.6", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", + "form-data": "^4.0.0", + "jest": "26.6.0", + "jest-junit": "^12.2.0", + "nock": "^13.1.3", + "node-fetch": "^2.6.1", + "ts-jest": "26.5.6", + "typedoc": "0.22.11", + "typedoc-plugin-markdown": "3.11.13" + } + }, "node_modules/@adobe/json-formula": { "version": "0.1.50", "resolved": "https://registry.npmjs.org/@adobe/json-formula/-/json-formula-0.1.50.tgz", @@ -35,12 +61,12 @@ } }, "node_modules/@aemforms/af-core": { - "version": "0.22.73", - "resolved": "https://registry.npmjs.org/@aemforms/af-core/-/af-core-0.22.73.tgz", - "integrity": "sha512-1q/V8YqS1+vqmJy3pQ+QjJLSnHygMH1RAvqeWFY2A6cVIe381e2SOJsyfdT2mzBQUFCW/9rs1b64VhcGzICKzA==", + "version": "0.22.76", + "resolved": "https://registry.npmjs.org/@aemforms/af-core/-/af-core-0.22.76.tgz", + "integrity": "sha512-u3t6uhwQ56IEeMW4YZFhxix/ZL8yxL7P0VBzRBySXgixSpmjXQoNHdti2w/KwKj1XAIaGrLLi+LHPkOJDvqdhw==", "dependencies": { "@adobe/json-formula": "0.1.50", - "@aemforms/af-formatters": "^0.22.73" + "@aemforms/af-formatters": "^0.22.76" } }, "node_modules/@aemforms/af-custom-functions": { @@ -49,9 +75,9 @@ "integrity": "sha512-NT0ctJmf6HJyZCXtGCcU1H9NF03X/NqEO+sYkQ4zDgNRDQNfMW1QBxiANf20JxYojhXF+/DOIkKteA5Ase+KJw==" }, "node_modules/@aemforms/af-formatters": { - "version": "0.22.73", - "resolved": "https://registry.npmjs.org/@aemforms/af-formatters/-/af-formatters-0.22.73.tgz", - "integrity": "sha512-U4h8WkGb6ljYYeQ/zjHeO1uQtqPm8271NpG7Vk8fY6Im8u5rzGi8SLobrSypZaVbM4/zA4IrhDb+qZxh9eUlzw==" + "version": "0.22.76", + "resolved": "https://registry.npmjs.org/@aemforms/af-formatters/-/af-formatters-0.22.76.tgz", + "integrity": "sha512-XLYht85qus28yTX4VGz7SQFEg1XUYbeuhhuXI6NurciGkn2AZnD5E4kySg9hSy0atdit8fRRdGx9GTALz/lbeQ==" }, "node_modules/@ampproject/remapping": { "version": "2.2.1", @@ -12021,12 +12047,12 @@ "integrity": "sha512-dmlLYfbty8NPVIdxvI9cJ+ZdXsrRCFrCdmL1+aR2auEzXJ86rD0bm1qu+S4NOpFiZLKIyx0zvUTykms40vNjsA==" }, "@aemforms/af-core": { - "version": "0.22.73", - "resolved": "https://registry.npmjs.org/@aemforms/af-core/-/af-core-0.22.73.tgz", - "integrity": "sha512-1q/V8YqS1+vqmJy3pQ+QjJLSnHygMH1RAvqeWFY2A6cVIe381e2SOJsyfdT2mzBQUFCW/9rs1b64VhcGzICKzA==", + "version": "0.22.76", + "resolved": "https://registry.npmjs.org/@aemforms/af-core/-/af-core-0.22.76.tgz", + "integrity": "sha512-u3t6uhwQ56IEeMW4YZFhxix/ZL8yxL7P0VBzRBySXgixSpmjXQoNHdti2w/KwKj1XAIaGrLLi+LHPkOJDvqdhw==", "requires": { "@adobe/json-formula": "0.1.50", - "@aemforms/af-formatters": "^0.22.73" + "@aemforms/af-formatters": "^0.22.76" } }, "@aemforms/af-custom-functions": { @@ -12035,9 +12061,9 @@ "integrity": "sha512-NT0ctJmf6HJyZCXtGCcU1H9NF03X/NqEO+sYkQ4zDgNRDQNfMW1QBxiANf20JxYojhXF+/DOIkKteA5Ase+KJw==" }, "@aemforms/af-formatters": { - "version": "0.22.73", - "resolved": "https://registry.npmjs.org/@aemforms/af-formatters/-/af-formatters-0.22.73.tgz", - "integrity": "sha512-U4h8WkGb6ljYYeQ/zjHeO1uQtqPm8271NpG7Vk8fY6Im8u5rzGi8SLobrSypZaVbM4/zA4IrhDb+qZxh9eUlzw==" + "version": "0.22.76", + "resolved": "https://registry.npmjs.org/@aemforms/af-formatters/-/af-formatters-0.22.76.tgz", + "integrity": "sha512-XLYht85qus28yTX4VGz7SQFEg1XUYbeuhhuXI6NurciGkn2AZnD5E4kySg9hSy0atdit8fRRdGx9GTALz/lbeQ==" }, "@ampproject/remapping": { "version": "2.2.1", @@ -12383,8 +12409,7 @@ "version": "7.21.0-placeholder-for-preset-env.2", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", - "dev": true, - "requires": {} + "dev": true }, "@babel/plugin-syntax-async-generators": { "version": "7.8.4", @@ -14792,8 +14817,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", - "dev": true, - "requires": {} + "dev": true }, "@webpack-cli/info": { "version": "1.5.0", @@ -14808,8 +14832,7 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", - "dev": true, - "requires": {} + "dev": true }, "@xtuc/ieee754": { "version": "1.2.0", @@ -14857,8 +14880,7 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", - "dev": true, - "requires": {} + "dev": true }, "acorn-walk": { "version": "7.2.0", @@ -14904,8 +14926,7 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "requires": {} + "dev": true }, "ansi-escapes": { "version": "4.3.2", @@ -17931,8 +17952,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "requires": {} + "dev": true }, "jest-regex-util": { "version": "26.0.0", @@ -21092,8 +21112,7 @@ "version": "8.16.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", - "dev": true, - "requires": {} + "dev": true }, "xml-name-validator": { "version": "4.0.0", diff --git a/ui.frontend/package.json b/ui.frontend/package.json index 0e81b4eab4..39889721d1 100644 --- a/ui.frontend/package.json +++ b/ui.frontend/package.json @@ -23,8 +23,8 @@ "webpack-merge": "^5.8.0" }, "dependencies": { - "@aemforms/af-core": "^0.22.73", - "@aemforms/af-formatters": "^0.22.73", + "@aemforms/af-core": "^0.22.76", + "@aemforms/af-formatters": "^0.22.76", "@aemforms/af-custom-functions": "1.0.4" } } diff --git a/ui.tests/test-module/package-lock.json b/ui.tests/test-module/package-lock.json index 11fbffd3e0..5c54673beb 100644 --- a/ui.tests/test-module/package-lock.json +++ b/ui.tests/test-module/package-lock.json @@ -14913,8 +14913,7 @@ "version": "10.0.0", "resolved": "https://registry.npmjs.org/babelify/-/babelify-10.0.0.tgz", "integrity": "sha512-X40FaxyH7t3X+JFAKvb1H9wooWKLRCi8pg3m8poqtdZaIng+bjzp9RvKQCvRjF9isHiPkXspbbXT/zwXLtwgwg==", - "dev": true, - "requires": {} + "dev": true }, "backo2": { "version": "1.0.2", @@ -15927,8 +15926,7 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz", "integrity": "sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==", - "dev": true, - "requires": {} + "dev": true }, "cypress-iframe": { "version": "1.0.1", @@ -20788,8 +20786,7 @@ "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "dev": true, - "requires": {} + "dev": true }, "xhr": { "version": "2.6.0", diff --git a/ui.tests/test-module/specs/numberinput/numberinput.runtime.spec.js b/ui.tests/test-module/specs/numberinput/numberinput.runtime.spec.js index a9e09562be..87c7c5eb33 100644 --- a/ui.tests/test-module/specs/numberinput/numberinput.runtime.spec.js +++ b/ui.tests/test-module/specs/numberinput/numberinput.runtime.spec.js @@ -18,6 +18,7 @@ describe("Form with Number Input", () => { const pagePath = "content/forms/af/core-components-it/samples/numberinput/basic.html" const bemBlock = 'cmp-adaptiveform-numberinput' const IS = "adaptiveFormNumberInput" + let toggle_array = []; const selectors = { numberinput : `[data-cmp-is="${IS}"]` } @@ -28,6 +29,12 @@ describe("Form with Number Input", () => { cy.previewForm(pagePath).then(p => { formContainer = p; }) + + cy.fetchFeatureToggles().then((response) => { + if (response.status === 200) { + toggle_array = response.body.enabled; + } + }); }); const checkHTML = (id, state) => { @@ -222,4 +229,19 @@ describe("Form with Number Input", () => { cy.get(`#${numberInput7}`).should('have.class', 'cmp-adaptiveform-numberinput--filled'); }); }); + + it(" should support display value expression", () => { + if(toggle_array.includes("FT_FORMS-13193")) { + const [numberInput, numberInputFieldView] = Object.entries(formContainer._fields)[7]; + const input = 1234567812345678; + const formatted= '**** **** **** 5678 ' + let model = numberInputFieldView.getModel(); + + cy.get(`#${numberInput}`).find("input").clear().type(input).blur().then(x => { + expect(Number(model.getState().value)).to.equal(Number(input)); + expect(model.getState().displayValue).to.be.equal(formatted) + cy.get(`#${numberInput}`).find('input').should('have.value', model.getState().displayValue); + }) + } + }); }) From 15c3bd85a3719040ddcaea16d2aa31fac4f6318b Mon Sep 17 00:00:00 2001 From: Ravi Date: Fri, 15 Mar 2024 12:45:10 +0530 Subject: [PATCH 02/21] Fix test cases --- .../specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js b/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js index 7890822c0a..1db0ea8562 100644 --- a/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js +++ b/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js @@ -41,7 +41,7 @@ describe("Sites with Aem Embed Container", () => { it("test for aemembedcontainer presence inside iframe", () => { getIframeBody().find('.cmp-adaptiveform-container').should('have.length', 1); - getIframeBody().find('.cmp-adaptiveform-container').find('.cmp-adaptiveform-numberinput__widget').should('have.length', 7); + getIframeBody().find('.cmp-adaptiveform-container').find('.cmp-adaptiveform-numberinput__widget').should('have.length', 8); }) it("test for form presence in nonIframe mode", () => { @@ -134,4 +134,4 @@ describe("Sites with Aem Embed Container", () => { }) }) }) -}) \ No newline at end of file +}) From fedd33b47e781bf0a0a2d2f93eede7199fb70221 Mon Sep 17 00:00:00 2001 From: Ravi Date: Mon, 18 Mar 2024 12:21:10 +0530 Subject: [PATCH 03/21] Exposed displayValueExpression for telephone,text,email and date input --- .../models/v1/form/DatePickerImpl.java | 13 +++++++++++ .../models/v1/form/TextInputImpl.java | 10 ++++++++ .../components/models/form/DatePicker.java | 10 ++++++++ .../components/models/form/TextInput.java | 10 ++++++++ .../models/v1/form/DatePickerImplTest.java | 7 ++++++ .../models/v1/form/NumberInputImplTest.java | 2 +- .../models/v1/form/TextInputImplTest.java | 7 ++++++ ...ter-datepicker-displayValueExpression.json | 23 +++++++++++++++++++ .../form/datepicker/test-content.json | 10 +++++++- ...rter-textinput-displayValueExpression.json | 22 ++++++++++++++++++ .../form/textinput/test-content.json | 8 +++++++ 11 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 bundles/af-core/src/test/resources/form/datepicker/exporter-datepicker-displayValueExpression.json create mode 100644 bundles/af-core/src/test/resources/form/textinput/exporter-textinput-displayValueExpression.json diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java index b97416f5b8..413c7655a0 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java @@ -18,13 +18,16 @@ import java.util.Date; import java.util.Map; +import javax.annotation.Nullable; import javax.annotation.PostConstruct; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Exporter; import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy; import org.apache.sling.models.annotations.injectorspecific.SlingObject; +import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; import org.jetbrains.annotations.NotNull; import com.adobe.cq.export.json.ComponentExporter; @@ -69,6 +72,10 @@ public Date getExclusiveMinimumDate() { return ComponentUtils.clone(exclusiveMinimumVaue); } + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) + @Nullable + protected String displayValueExpression; + public @NotNull Map getConstraintMessages() { Map res = super.getConstraintMessages(); String msg = getConstraintMessage(ConstraintType.MINIMUM); @@ -94,4 +101,10 @@ private void initDatePicker() { minimumDate = null; } } + + @Override + @Nullable + public String getDisplayValueExpression() { + return displayValueExpression; + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java index a83447b075..8356ca53ab 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java @@ -70,6 +70,10 @@ public class TextInputImpl extends AbstractFieldImpl implements TextInput { /** End of Type number specific constraints **/ + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) + @Nullable + protected String displayValueExpression; + @Override public boolean isMultiLine() { return multiLine; @@ -169,4 +173,10 @@ private void initTextInput() { minimum = null; } } + + @Override + @Nullable + public String getDisplayValueExpression() { + return displayValueExpression; + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java index c90b5ca6a8..c3a2b8304f 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java @@ -36,4 +36,14 @@ public interface DatePicker extends Field, DateConstraint { default Object[] getDefault() { return null; } + + /** + * The expression that when evaluated would determine what the displayValue of a field would be + * + * @return display value expression of the field + * @since com.adobe.cq.forms.core.components.models.form 5.2.0 + */ + default String getDisplayValueExpression() { + return null; + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java index 4415ceabde..ee833c9f63 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java @@ -66,4 +66,14 @@ default String getFormat() { return null; } + /** + * The expression that when evaluated would determine what the displayValue of a field would be + * + * @return display value expression of the field + * @since com.adobe.cq.forms.core.components.models.form 5.2.0 + */ + default String getDisplayValueExpression() { + return null; + } + } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java index cd9f725999..dabcbb1e4b 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java @@ -46,6 +46,7 @@ public class DatePickerImplTest { private static final String PATH_DATEPICKER = CONTENT_ROOT + "/datepicker"; private static final String PATH_DATEPICKER_DATALAYER = CONTENT_ROOT + "/datepicker-datalayer"; + private static final String PATH_DATEPICKER_DISPLAY_VALUE_EXPRESSION = CONTENT_ROOT + "/datepicker-displayValueExpression"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -292,4 +293,10 @@ void testJSONExportDataLayer() throws Exception { FieldUtils.writeField(datePicker, "dataLayerEnabled", true, true); Utils.testJSONExport(datePicker, Utils.getTestExporterJSONPath(BASE, PATH_DATEPICKER_DATALAYER)); } + + @Test + void testJSONExportForDisplayValueExpression() throws Exception { + DatePicker datePicker = Utils.getComponentUnderTest(PATH_DATEPICKER_DISPLAY_VALUE_EXPRESSION, DatePicker.class, context); + Utils.testJSONExport(datePicker, Utils.getTestExporterJSONPath(BASE, PATH_DATEPICKER_DISPLAY_VALUE_EXPRESSION)); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java index d7d703d7d2..97683b8923 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java @@ -370,7 +370,7 @@ void testJSONExportDataLayer() throws Exception { } @Test - void testJSONExportForEmptyValidationExpression() throws Exception { + void testJSONExportForDisplayValueExpression() throws Exception { NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION, NumberInput.class, context); Utils.testJSONExport(numberInput, Utils.getTestExporterJSONPath(BASE, PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION)); } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java index 6538bd8472..1b7debab49 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java @@ -57,6 +57,7 @@ public class TextInputImplTest { private static final String PATH_TEXTINPUT_UNBOUNDFORMELEMENT = CONTENT_ROOT + "/textinput_unboundFormElement"; private static final String PATH_TEXTINPUT_BLANK_DATAREF = CONTENT_ROOT + "/textinput-blank-dataref"; private static final String PATH_TEXTINPUT_BLANK_VALIDATIONEXPRESSION = CONTENT_ROOT + "/textinput-blank-validationExpression"; + private static final String PATH_TEXTINPUT_DISPLAY_VALUE_EXPRESSION = CONTENT_ROOT + "/textinput-displayValueExpression"; private static final String PATH_TEXTINPUT_PLACEHOLDER_AUTOCOMPLETE = CONTENT_ROOT + "/textinput-placeholder-autocomplete"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -449,4 +450,10 @@ void testPlaceholderAndAutocomplete() throws Exception { assertEquals("given-name", textInput.getAutoComplete()); assertEquals("test-placeholder", textInput.getPlaceHolder()); } + + @Test + void testJSONExportForDisplayValueExpression() throws Exception { + TextInput textInput = Utils.getComponentUnderTest(PATH_TEXTINPUT_DISPLAY_VALUE_EXPRESSION, TextInput.class, context); + Utils.testJSONExport(textInput, Utils.getTestExporterJSONPath(BASE, PATH_TEXTINPUT_DISPLAY_VALUE_EXPRESSION)); + } } diff --git a/bundles/af-core/src/test/resources/form/datepicker/exporter-datepicker-displayValueExpression.json b/bundles/af-core/src/test/resources/form/datepicker/exporter-datepicker-displayValueExpression.json new file mode 100644 index 0000000000..7c9f1a1300 --- /dev/null +++ b/bundles/af-core/src/test/resources/form/datepicker/exporter-datepicker-displayValueExpression.json @@ -0,0 +1,23 @@ +{ + "id": "datepicker-c7fc29dc99", + "fieldType": "date-input", + "name": "abc", + "type": "string", + "displayValueExpression": "($field.$value & abc)", + "label": { + "value": "def" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/datepicker-displayValueExpression" + }, + "format": "date", + ":type": "core/fd/components/form/datepicker/v1/datepicker" +} diff --git a/bundles/af-core/src/test/resources/form/datepicker/test-content.json b/bundles/af-core/src/test/resources/form/datepicker/test-content.json index 1cae1ff7a8..bc5ccabfed 100644 --- a/bundles/af-core/src/test/resources/form/datepicker/test-content.json +++ b/bundles/af-core/src/test/resources/form/datepicker/test-content.json @@ -87,5 +87,13 @@ }, "format": "date", ":type": "forms-components-examples/components/form/datepicker" + }, + "datepicker-displayValueExpression" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/datepicker/v1/datepicker", + "name" : "abc", + "jcr:title" : "def", + "fieldType": "date-input", + "displayValueExpression": "($field.$value & abc)" } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/form/textinput/exporter-textinput-displayValueExpression.json b/bundles/af-core/src/test/resources/form/textinput/exporter-textinput-displayValueExpression.json new file mode 100644 index 0000000000..1f0cbde4fd --- /dev/null +++ b/bundles/af-core/src/test/resources/form/textinput/exporter-textinput-displayValueExpression.json @@ -0,0 +1,22 @@ +{ + "id": "textinput-1247cf0c35", + "fieldType": "text-input", + "name": "abc", + "type": "string", + "displayValueExpression": "($field.$value & abc)", + "label": { + "value": "def" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/textinput-displayValueExpression" + }, + ":type": "core/fd/components/form/textinput/v1/textinput" +} diff --git a/bundles/af-core/src/test/resources/form/textinput/test-content.json b/bundles/af-core/src/test/resources/form/textinput/test-content.json index d3ea3efdb3..6ec6ba2def 100644 --- a/bundles/af-core/src/test/resources/form/textinput/test-content.json +++ b/bundles/af-core/src/test/resources/form/textinput/test-content.json @@ -157,6 +157,14 @@ "fieldType": "text-input", "validationExpression": "" }, + "textinput-displayValueExpression" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput", + "name" : "abc", + "jcr:title" : "def", + "fieldType": "text-input", + "displayValueExpression": "($field.$value & abc)" + }, "textinput-placeholder-autocomplete" : { "jcr:primaryType": "nt:unstructured", "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput", From 33f994c8e5faa8251ee41fc092340e263e42b882 Mon Sep 17 00:00:00 2001 From: Ravi Date: Mon, 18 Mar 2024 15:45:14 +0530 Subject: [PATCH 04/21] Added e2e tests for remaining components --- .../js/functions.js | 52 +++ .../samples/datepicker/basic/.content.xml | 76 ++-- .../samples/emailinput/basic/.content.xml | 113 +++--- .../samples/telephoneinput/basic/.content.xml | 138 +++++--- .../samples/textinput/basic/.content.xml | 332 ++++++++++-------- .../clientlibs/site/js/datepickerview.js | 2 +- .../clientlibs/site/js/emailinputview.js | 6 + .../clientlibs/site/js/telephoneinputview.js | 6 + .../clientlibs/site/js/textinputview.js | 6 + .../datepicker/datepicker.runtime.spec.js | 23 +- .../emailinput/emailinput.runtime.spec.js | 21 ++ .../telephoneinput.runtime.spec.js | 21 ++ .../specs/textinput/textinput.runtime.spec.js | 21 ++ 13 files changed, 549 insertions(+), 268 deletions(-) diff --git a/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js b/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js index 13f1ad1e15..c87a810260 100644 --- a/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js +++ b/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js @@ -78,5 +78,57 @@ function formatCreditCardNumber(field) return formattedNumber; } +/** + * Formats Date input + * @name formatDateInput Formats Date input + * @param {object} field field whose value to be formatted + * @return {string} + */ +function formatDateInput(field) +{ + var date = field.$value; + return date ? date + ' today' : date; +} + +/** + * Formats email input + * @name formatEmailInput Formats email input + * @param {object} field field whose value to be formatted + * @return {string} + */ +function formatEmailInput(field) +{ + var email = field.$value; + var transformedEmail; + if(email) { + var parts = email.split('@'); + if (parts[0].length > 1) { + transformedEmail = parts[0][0] + '*'.repeat(parts[0].length - 1) + '@' + parts[1]; + } else { + transformedEmail = email; + } + } + + return transformedEmail; +} + + +/** + * Formats telephone input + * @name formatTelephoneInput Formats telephone input + * @param {object} field field whose value to be formatted + * @return {string} + */ +function formatTelephoneInput(field) +{ + var phoneNumber = field.$value; + if(phoneNumber) { + var maskedDigits = phoneNumber.substring(0, 7).replace(/\d/g, '*'); + var lastThreeDigits = phoneNumber.substring(7); + return maskedDigits + lastThreeDigits; + } + return phoneNumber; +} + diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml index 2ca60e315a..7fc38b394e 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml @@ -3,7 +3,7 @@ jcr:primaryType="cq:Page"> + clientLibRef="corecomponent.it.customfunction" + fieldType="form" + schemaType="none" + textIsRich="true" + thankYouMessage="Thank you for submitting the form." + thankYouOption="page"> - + + + + + - \ No newline at end of file + diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/emailinput/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/emailinput/basic/.content.xml index a18c2ced25..f200415a6c 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/emailinput/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/emailinput/basic/.content.xml @@ -1,56 +1,89 @@ - + + cq:deviceGroups="[mobile/groups/responsive]" + cq:lastModified="{Date}2024-03-18T15:28:40.954+05:30" + cq:lastModifiedBy="admin" + cq:template="/conf/core-components-examples/settings/wcm/templates/af-blank-v2" + jcr:language="en" + jcr:primaryType="cq:PageContent" + jcr:title="Adaptive Form V2 (IT)" + sling:resourceType="forms-components-examples/components/page"> - - + + - + + fieldType="email" + name="emailinput3" + visible="{Boolean}false"/> + jcr:primaryType="nt:unstructured" + jcr:title="Email Input With Tooltip, Description, Tooltip always visible" + sling:resourceType="forms-components-examples/components/form/emailinput" + description="This is long description" + fieldType="email" + formatMessage="custom format error message!" + id="tooltip_scenario_test" + mandatoryMessage="custom mandatory message!" + name="emailinput41710755860333" + required="true" + tooltip="This is short description" + tooltipVisible="true"/> + + + + diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/telephoneinput/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/telephoneinput/basic/.content.xml index 3505287b99..23835da7e4 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/telephoneinput/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/telephoneinput/basic/.content.xml @@ -1,86 +1,120 @@ - + + cq:deviceGroups="[mobile/groups/responsive]" + cq:lastModified="{Date}2024-03-18T15:20:01.947+05:30" + cq:lastModifiedBy="admin" + cq:template="/conf/core-components-examples/settings/wcm/templates/af-blank-v2" + jcr:language="en" + jcr:primaryType="cq:PageContent" + jcr:title="Adaptive Form V2 (IT)" + sling:resourceType="forms-components-examples/components/page"> - - + + + name="Telephoneinput2" + required="true" + visible="{Boolean}true"/> + fieldType="text-input" + name="telephoneinput3" + visible="{Boolean}false"/> - + + visible="{Boolean}true"/> + visible="{Boolean}true"/> + visible="{Boolean}true"/> + + + + diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/textinput/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/textinput/basic/.content.xml index 37d0d944e1..17e6183f7b 100644 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/textinput/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/textinput/basic/.content.xml @@ -1,188 +1,218 @@ + jcr:primaryType="cq:Page"> + cq:deviceGroups="[mobile/groups/responsive]" + cq:lastModified="{Date}2024-03-18T15:35:43.912+05:30" + cq:lastModifiedBy="admin" + cq:template="/conf/core-components-examples/settings/wcm/templates/af-blank-v2" + jcr:language="en" + jcr:primaryType="cq:PageContent" + jcr:title="Adaptive Form V2 (IT)" + sling:resourceType="forms-components-examples/components/page"> - - + + jcr:title="Text Input 1" + sling:resourceType="forms-components-examples/components/form/textinput" + fieldType="text-input" + name="textinput1" + validationExpression="$field == 'validate'"> + + jcr:primaryType="nt:unstructured" + change="[if($field == 'adobe'\, dispatchEvent(textinput3\, 'custom:setProperty'\, {visible : true()})\, {}),if($field == 'adobe'\, dispatchEvent(textinput2\, 'custom:setProperty'\, {visible : false()})\, {}),if($field == 'aem'\, dispatchEvent(textinput2\, 'custom:setProperty'\, {enabled : true()})\, {}),if($field == 'aem'\, dispatchEvent(textinput41671690715329\, 'custom:setProperty'\, {enabled : false()})\, {})]"/> + jcr:primaryType="nt:unstructured" + jcr:title="Text Input 2" + sling:resourceType="forms-components-examples/components/form/textinput" + enabled="{Boolean}false" + fieldType="text-input" + name="textinput2" + visible="{Boolean}true"/> + jcr:primaryType="nt:unstructured" + jcr:title="Text Input 3" + sling:resourceType="forms-components-examples/components/form/textinput" + enabled="{Boolean}true" + fieldType="text-input" + name="textinput3" + visible="{Boolean}false"/> + jcr:primaryType="nt:unstructured" + jcr:title="Text Input With Tooltip, Description, Tooltip always visible" + sling:resourceType="forms-components-examples/components/form/textinput" + description="This is long description" + fieldType="text-input" + id="tooltip_scenario_test" + name="textinput41671690715329" + tooltip="This is short description" + tooltipVisible="true"/> - + jcr:title="Text Input 5" + sling:resourceType="forms-components-examples/components/form/textinput" + autocomplete="off" + enabled="{Boolean}true" + fieldType="text-input" + name="textinput_14695624421673260189420" + readOnly="{Boolean}false" + textIsRich="[true,true,true]" + validatePictureClauseMessage="[,]" + visible="{Boolean}true"> + + jcr:primaryType="nt:unstructured" + change="[if($field == 'aemforms'\, dispatchEvent(textinput1\, 'custom:setProperty'\, {value : 'new value'})\, {}),if($field == 'aemforms'\, dispatchEvent(textinput41671690715329\, 'custom:setProperty'\, {value : `null`})\, {})]"/> + jcr:lastModified="{Date}2023-06-22T18:14:59.804+05:30" + jcr:lastModifiedBy="admin" + jcr:primaryType="nt:unstructured" + jcr:title="Text Input 6" + sling:resourceType="forms-components-examples/components/form/textinput" + autocomplete="off" + enabled="{Boolean}true" + fieldType="text-input" + hideTitle="false" + name="textinput_21065339181687434913522" + pattern="\[^'\\x22]+" + readOnly="{Boolean}false" + required="true" + textIsRich="[true,true]" + unboundFormElement="{Boolean}false" + validationPatternType="custom" + visible="{Boolean}true"/> + jcr:lastModified="{Date}2023-06-22T17:28:31.083+05:30" + jcr:lastModifiedBy="admin" + jcr:primaryType="nt:unstructured" + jcr:title="Text Input 7" + sling:resourceType="forms-components-examples/components/form/textinput" + autocomplete="off" + default="longer text than allowed" + enabled="{Boolean}true" + fieldType="text-input" + hideTitle="false" + maxLength="20" + name="textinput_66014071687434939255" + readOnly="{Boolean}false" + textIsRich="[true,true]" + unboundFormElement="{Boolean}false" + visible="{Boolean}true"/> + jcr:lastModified="{Date}2023-06-22T17:29:41.384+05:30" + jcr:lastModifiedBy="admin" + jcr:primaryType="nt:unstructured" + jcr:title="Text Input 8" + sling:resourceType="forms-components-examples/components/form/textinput" + autocomplete="off" + default="small text" + enabled="{Boolean}true" + fieldType="text-input" + hideTitle="false" + minLength="12" + name="textinput_10649255691687435008215" + readOnly="{Boolean}false" + textIsRich="[true,true]" + unboundFormElement="{Boolean}false" + visible="{Boolean}true"/> + jcr:primaryType="nt:unstructured" + jcr:title="Text Input 9" + sling:resourceType="forms-components-examples/components/form/textinput" + autocomplete="off" + enabled="{Boolean}true" + fieldType="text-input" + hideTitle="false" + name="textinput_2607077271690896983422" + readOnly="{Boolean}false" + textIsRich="[true,true]" + unboundFormElement="{Boolean}false" + visible="{Boolean}true"> - + + unboundFormElement="{Boolean}false" + visible="{Boolean}true"/> + jcr:lastModified="{Date}2023-06-22T17:28:46.456+05:30" + jcr:lastModifiedBy="admin" + jcr:primaryType="nt:unstructured" + jcr:title="Submit" + sling:resourceType="forms-components-examples/components/form/actions/submit" + buttonType="submit" + dorExclusion="true" + fieldType="button" + name="submit1687435309125"> + fd:click="[{"nodeName":"ROOT"\,"items":[{"nodeName":"STATEMENT"\,"choice":{"nodeName":"EVENT_SCRIPTS"\,"items":[{"nodeName":"EVENT_CONDITION"\,"choice":{"nodeName":"EVENT_AND_COMPARISON"\,"items":[{"nodeName":"COMPONENT"\,"value":{"id":"$form.button1667450213112"\,"type":"BUTTON"\,"name":"button1667450213112"}}\,{"nodeName":"EVENT_AND_COMPARISON_OPERATOR"\,"choice":{"nodeName":"is clicked"\,"value":null}}\,{"nodeName":"PRIMITIVE_EXPRESSION"\,"choice":null}]}\,"nested":false}\,{"nodeName":"Then"\,"value":null}\,{"nodeName":"BLOCK_STATEMENTS"\,"items":[{"nodeName":"BLOCK_STATEMENT"\,"choice":{"nodeName":"SUBMIT_FORM"\,"items":[]}}]}]}}]\,"isValid":true\,"enabled":true\,"version":1\,"script":["submitForm('custom:submitSuccess'\, 'custom:submitError')"]\,"eventName":"Click"\,"ruleType":""\,"description":""}]" + jcr:primaryType="nt:unstructured"/> + jcr:primaryType="nt:unstructured" + click="[submitForm('custom:submitSuccess'\, 'custom:submitError')]"/> + + + + diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/clientlibs/site/js/datepickerview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/clientlibs/site/js/datepickerview.js index 5671a64446..5e1ee4879e 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/clientlibs/site/js/datepickerview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/clientlibs/site/js/datepickerview.js @@ -109,7 +109,7 @@ #noFormats() { return (this._model.editFormat == null || this._model.editFormat === 'date|short') && - (this._model.displayFormat == null || this._model.displayFormat === 'date|short'); + (this._model.displayFormat == null || this._model.displayFormat === 'date|short') && (this._model.displayValueExpression == null) } } diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js index c6bcbf324a..ef0b9a2fa3 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js @@ -72,10 +72,16 @@ } this.widget.addEventListener('blur', (e) => { this._model.value = e.target.value; + if(this._model.displayValue) { + this.widget.value = this._model.displayValue; + } this.setInactive(); }); this.widget.addEventListener('focus', (e) => { this.setActive(); + if(this._model.displayValue) { + this.widget.value = this._model.value; + } }); } } diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js index ff8e911f71..0f0a7c86f3 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js @@ -72,10 +72,16 @@ } this.widget.addEventListener('blur', (e) => { this._model.value = e.target.value; + if(this._model.displayValue) { + this.widget.value = this._model.displayValue; + } this.setInactive(); }); this.widget.addEventListener('focus', (e) => { this.setActive(); + if(this._model.displayValue) { + this.widget.value = this._model.value; + } }); } } diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js index d11545fd3a..a7f498ba1f 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js @@ -72,10 +72,16 @@ } this.widget.addEventListener('blur', (e) => { this._model.value = e.target.value; + if(this._model.displayValue) { + this.widget.value = this._model.displayValue; + } this.setInactive(); }); this.widget.addEventListener('focus', (e) => { this.setActive(); + if(this._model.displayValue) { + this.widget.value = this._model.value; + } }); } } diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js index 87d9ff5a72..709e505532 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js @@ -17,6 +17,7 @@ describe("Form Runtime with Date Picker", () => { const pagePath = "content/forms/af/core-components-it/samples/datepicker/basic.html" const bemBlock = 'cmp-adaptiveform-datepicker' + let toggle_array = []; let formContainer = null @@ -24,6 +25,11 @@ describe("Form Runtime with Date Picker", () => { cy.previewForm(pagePath).then(p => { formContainer = p; }) + cy.fetchFeatureToggles().then((response) => { + if (response.status === 200) { + toggle_array = response.body.enabled; + } + }); }); const checkHTML = (id, state, displayValue) => { @@ -221,4 +227,19 @@ describe("Form Runtime with Date Picker", () => { }); }); -}) \ No newline at end of file + it(" should support display value expression", () => { + if(toggle_array.includes("FT_FORMS-13193")) { + const [dateInput, dateInputView] = Object.entries(formContainer._fields)[7]; + const input = '2024-02-02'; + const formatted= '2024-02-02 today' + let model = dateInputView.getModel(); + + cy.get(`#${dateInput}`).find("input").clear().type(input).blur().then(x => { + expect(model.getState().value).to.equal('2024-02-02'); + expect(model.getState().displayValue).to.be.equal(formatted) + cy.get(`#${dateInput}`).find('input').should('have.value', model.getState().displayValue); + }) + } + }); + +}) diff --git a/ui.tests/test-module/specs/emailinput/emailinput.runtime.spec.js b/ui.tests/test-module/specs/emailinput/emailinput.runtime.spec.js index d353dbb2a2..d87241d60f 100644 --- a/ui.tests/test-module/specs/emailinput/emailinput.runtime.spec.js +++ b/ui.tests/test-module/specs/emailinput/emailinput.runtime.spec.js @@ -18,6 +18,7 @@ describe("Form Runtime with Email Input", () => { const pagePath = "content/forms/af/core-components-it/samples/emailinput/basic.html" const bemBlock = 'cmp-adaptiveform-emailinput' const IS = "adaptiveFormEmailInput" + let toggle_array = []; const selectors = { textinput : `[data-cmp-is="${IS}"]` } @@ -28,6 +29,11 @@ describe("Form Runtime with Email Input", () => { cy.previewForm(pagePath).then(p => { formContainer = p; }) + cy.fetchFeatureToggles().then((response) => { + if (response.status === 200) { + toggle_array = response.body.enabled; + } + }); }); const checkHTML = (id, state) => { @@ -155,4 +161,19 @@ describe("Form Runtime with Email Input", () => { cy.get(`#${id}`).should('have.class', 'cmp-adaptiveform-emailinput--filled'); }); }); + + it(" should support display value expression", () => { + if(toggle_array.includes("FT_FORMS-13193")) { + const [field, fieldView] = Object.entries(formContainer._fields)[4]; + const input = 'johndoe@adobe.com'; + const formatted= 'j******@adobe.com' + let model = fieldView.getModel(); + + cy.get(`#${field}`).find("input").clear().type(input).blur().then(x => { + expect(model.getState().value).to.equal('johndoe@adobe.com'); + expect(model.getState().displayValue).to.be.equal(formatted) + cy.get(`#${field}`).find('input').should('have.value', model.getState().displayValue); + }) + } + }); }) diff --git a/ui.tests/test-module/specs/telephoneinput/telephoneinput.runtime.spec.js b/ui.tests/test-module/specs/telephoneinput/telephoneinput.runtime.spec.js index 4ea63c44bc..2b92ddb3c9 100644 --- a/ui.tests/test-module/specs/telephoneinput/telephoneinput.runtime.spec.js +++ b/ui.tests/test-module/specs/telephoneinput/telephoneinput.runtime.spec.js @@ -18,6 +18,7 @@ describe("Form Runtime with Telephone Input", () => { const pagePath = "content/forms/af/core-components-it/samples/telephoneinput/basic.html" const bemBlock = 'cmp-adaptiveform-telephoneinput' const IS = "adaptiveFormTelephoneInput" + let toggle_array = []; const selectors = { telephoneinput : `[data-cmp-is="${IS}"]` } @@ -28,6 +29,11 @@ describe("Form Runtime with Telephone Input", () => { cy.previewForm(pagePath).then(p => { formContainer = p; }) + cy.fetchFeatureToggles().then((response) => { + if (response.status === 200) { + toggle_array = response.body.enabled; + } + }); }); const checkHTML = (id, state) => { @@ -142,4 +148,19 @@ describe("Form Runtime with Telephone Input", () => { cy.get(`#${id}`).should('have.class', 'cmp-adaptiveform-telephoneinput--filled'); }); }); + + it(" should support display value expression", () => { + if(toggle_array.includes("FT_FORMS-13193")) { + const [field, fieldView] = Object.entries(formContainer._fields)[7]; + const input = 9999999999; + const formatted= '*******999' + let model = fieldView.getModel(); + + cy.get(`#${field}`).find("input").clear().type(input).blur().then(x => { + expect(model.getState().value).to.equal('9999999999'); + expect(model.getState().displayValue).to.be.equal(formatted) + cy.get(`#${field}`).find('input').should('have.value', model.getState().displayValue); + }) + } + }); }) diff --git a/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js b/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js index b54af794dd..706dbaefc3 100644 --- a/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js +++ b/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js @@ -28,6 +28,7 @@ describe("Form Runtime with Text Input", () => { } let formContainer = null + let toggle_array = []; beforeEach(() => { if (Cypress.mocha.getRunner().suite.ctx.currentTest.title !== "should show different localised default error messages on different constraints") { @@ -35,6 +36,11 @@ describe("Form Runtime with Text Input", () => { formContainer = p; }) } + cy.fetchFeatureToggles().then((response) => { + if (response.status === 200) { + toggle_array = response.body.enabled; + } + }); }); const checkHTML = (id, state) => { @@ -273,6 +279,21 @@ describe("Form Runtime with Text Input", () => { .invoke('attr', 'autocomplete') .should("eq", "given-name"); }) + + it(" should support display value expression", () => { + if(toggle_array.includes("FT_FORMS-13193")) { + const [textInput, textInputField] = Object.entries(formContainer._fields)[10]; + const input = '1234567812345678'; + const formatted= '**** **** **** 5678 ' + let model = textInputField.getModel(); + + cy.get(`#${textInput}`).find("input").clear().type(input).blur().then(x => { + expect(model.getState().value).to.equal(input); + expect(model.getState().displayValue).to.be.equal(formatted) + cy.get(`#${textInput}`).find('input').should('have.value', model.getState().displayValue); + }) + } + }); }) describe("Form Runtime with Text Input For Different locale", () => { From fccccf4a732b4adda649cc64443c80a1ffec517f Mon Sep 17 00:00:00 2001 From: Ravi Date: Mon, 18 Mar 2024 20:00:22 +0530 Subject: [PATCH 05/21] Incorporating review comments --- ...ve-form-aem-allowed-components.schema.json | 4 +- ...aem-responsive-grid-properties.schema.json | 4 +- ...-form-container-dor-properties.schema.json | 4 +- ...adaptive-form-data-constraints.schema.json | 8 +-- .../adaptive-form-data-layer.schema.json | 4 +- .../0.12.5/adaptive-form-defaults.schema.json | 4 +- .../adaptive-form-dor-properties.schema.json | 4 +- .../adaptive-form-enum-name.schema.json | 4 +- .../0.12.5/adaptive-form-events.schema.json | 4 +- .../0.12.5/adaptive-form-label.schema.json | 4 +- .../adaptive-form-properties.schema.json | 9 +++- ...ive-form-property-restrictions.schema.json | 4 +- .../adaptive-form-sign-properties.schema.json | 4 +- ...daptive-form-signer-properties.schema.json | 4 +- .../main/content/META-INF/vault/filter.xml | 1 + .../content/jcr_root/conf/forms/.content.xml | 4 ++ .../forms/core-components-it/.content.xml | 4 ++ .../core-components-it/samples/.content.xml | 4 ++ .../samples/datepicker/.content.xml | 4 ++ .../samples/datepicker/basic/.content.xml | 4 ++ .../basic/_sling_configs/.content.xml | 12 +++++ .../basic/_sling_configs/_rep_policy.xml | 8 +++ .../.content.xml | 54 +++++++++++++++++++ .../aemEmbedContainer.runtime.spec.js | 2 +- .../datepicker/datepicker.runtime.spec.js | 2 + .../embedFormsInSite.runtime.spec.js | 6 +-- 26 files changed, 134 insertions(+), 36 deletions(-) create mode 100755 it/content/src/main/content/jcr_root/conf/forms/.content.xml create mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml create mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml create mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml create mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml create mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml create mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml create mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json index 9a821f8d89..fa855ea141 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-aem-allowed-components.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-aem-allowed-components.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "title": "Allowed Components object for the current panel.", @@ -15,4 +15,4 @@ "description": "true if the template has structure support and the panel is editable, false otherwise" } } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json index 91ce8e01b8..5913896e5d 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-aem-responsive-grid-properties.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-aem-responsive-grid-properties.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { @@ -49,4 +49,4 @@ ] } } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json index a1c39c95fe..27000602c5 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-container-dor-properties.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-container-dor-properties.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-container-dor-properties.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, @@ -38,4 +38,4 @@ "type": "string" } } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json index a2320e3304..79f14e358f 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-constraints.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-data-constraints.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-data-constraints.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Constraints applicable to fields", "type": "object", @@ -138,10 +138,6 @@ "validationExpression": { "type": "string", "format": "json-formula" - }, - "displayValueExpression": { - "type": "string", - "format": "json-formula" } } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json index 29d3cf1583..1b98317a97 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-data-layer.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-data-layer.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-data-layer.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { @@ -57,4 +57,4 @@ ] } } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json index f1ee139984..760ce8248b 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-defaults.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-defaults.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-defaults.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "The schema defines the default field types for Form Fields", "allOf": [ @@ -252,4 +252,4 @@ } } ] -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json index baaee5328b..2e8dd9ffed 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-dor-properties.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-dor-properties.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-dor-properties.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, @@ -55,4 +55,4 @@ "type": "boolean" } } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json index 9abea9636c..60a5da0309 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-enum-name.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-enum-name.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-enum-name.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { @@ -16,4 +16,4 @@ "required": [ "value" ] -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json index 609dfc343e..2aa908bb41 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-events.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-events.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-events.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Specify what operations to perform on certain user or custom events.", "description": "Events is a dictionary of eventName to the actions to perform. Whenever the event is dispatched the expressions defined on that event are evaluated. The return value of that expression is applied to the field. The return value of the expression can be either of\n * null, literal or array: The value property of the field is set to the return value\n * dictionary: The field json is merged with the returned dictionary\n * empty dictionary: the field should not be modified.", @@ -76,4 +76,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json index 973e1d0a0d..6950967e9e 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-label.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-label.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-label.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { @@ -21,4 +21,4 @@ "required": [ "value" ] -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json index 479c282d31..5c40ae058d 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-properties.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-properties.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-properties.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "$defs": { @@ -120,6 +120,11 @@ "title": "The format in which the value will be edited by the user.", "description": "The format in which the value will be edited by the user. Applicable for date and number types. For instance users in Germany would want to interchange decimal (.) and comma (,) when entering numerical values." }, + "displayValueExpression": { + "type": "string", + "title": "The json-formula expression which when evaluated will return the value that will be displayed to the user on screen in the field.", + "description": "The json-formula expression which when evaluated will return the value that will be displayed to the user on screen in the field. Applicable for date,number, text, email and telephone input fields. For instance users might need to mask certain chars in the input." + }, "emptyValue": { "type": [ "string" @@ -317,4 +322,4 @@ } } ] -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json index e5d5f34957..58e12844c5 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-property-restrictions.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-property-restrictions.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-property-restrictions.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "$defs": { "Date": { @@ -393,4 +393,4 @@ } } ] -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json index b0332767dc..baca796944 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-sign-properties.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-sign-properties.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-sign-properties.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, @@ -22,4 +22,4 @@ "$ref": "./adaptive-form-signer-properties.schema.json" } } -} \ No newline at end of file +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json index 2dd60e1029..881b4e153e 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form-signer-properties.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://git.corp.adobe.com/pages/livecycle/af2-docs/schema/generated/adaptive-form-signer-properties.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form-signer-properties.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Signers Information", "description": "Represents information about signers.", @@ -80,4 +80,4 @@ "type": "string" } } -} \ No newline at end of file +} diff --git a/it/content/src/main/content/META-INF/vault/filter.xml b/it/content/src/main/content/META-INF/vault/filter.xml index 09149dc37c..b190a0b2f5 100644 --- a/it/content/src/main/content/META-INF/vault/filter.xml +++ b/it/content/src/main/content/META-INF/vault/filter.xml @@ -1,6 +1,7 @@ + diff --git a/it/content/src/main/content/jcr_root/conf/forms/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/.content.xml new file mode 100755 index 0000000000..1581aa3428 --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/.content.xml @@ -0,0 +1,4 @@ + + diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml new file mode 100755 index 0000000000..9908fc60a1 --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml @@ -0,0 +1,4 @@ + + diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml new file mode 100755 index 0000000000..9908fc60a1 --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml @@ -0,0 +1,4 @@ + + diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml new file mode 100755 index 0000000000..9908fc60a1 --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml @@ -0,0 +1,4 @@ + + diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml new file mode 100755 index 0000000000..9908fc60a1 --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml @@ -0,0 +1,4 @@ + + diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml new file mode 100755 index 0000000000..39d5339311 --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml new file mode 100755 index 0000000000..2339ed0e6b --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml @@ -0,0 +1,8 @@ + + + + diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml new file mode 100755 index 0000000000..16d833f686 --- /dev/null +++ b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js b/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js index 1db0ea8562..0c5a5c9ef7 100644 --- a/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js +++ b/ui.tests/test-module/specs/aemEmbedContainer/aemEmbedContainer.runtime.spec.js @@ -46,7 +46,7 @@ describe("Sites with Aem Embed Container", () => { it("test for form presence in nonIframe mode", () => { cy.get('.cmp-adaptiveform-container').should('have.length', 1); - cy.get('.cmp-adaptiveform-container').find('.cmp-adaptiveform-textinput__widget').should('have.length', 10); + cy.get('.cmp-adaptiveform-container').find('.cmp-adaptiveform-textinput__widget').should('have.length', 11); }) it('Test iframe src with dataRef', () => { diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js index 709e505532..731637bc01 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js @@ -16,6 +16,7 @@ describe("Form Runtime with Date Picker", () => { const pagePath = "content/forms/af/core-components-it/samples/datepicker/basic.html" + const fmPropertiesUI = "/libs/fd/fm/gui/content/forms/formmetadataeditor.html/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic" const bemBlock = 'cmp-adaptiveform-datepicker' let toggle_array = []; @@ -25,6 +26,7 @@ describe("Form Runtime with Date Picker", () => { cy.previewForm(pagePath).then(p => { formContainer = p; }) + cy.fetchFeatureToggles().then((response) => { if (response.status === 200) { toggle_array = response.body.enabled; diff --git a/ui.tests/test-module/specs/embedFormsInSite/embedFormsInSite.runtime.spec.js b/ui.tests/test-module/specs/embedFormsInSite/embedFormsInSite.runtime.spec.js index 5c762033f9..faf3867cc9 100644 --- a/ui.tests/test-module/specs/embedFormsInSite/embedFormsInSite.runtime.spec.js +++ b/ui.tests/test-module/specs/embedFormsInSite/embedFormsInSite.runtime.spec.js @@ -56,12 +56,12 @@ describe("Embed multiple form in site", () => { it("form 1 model initialized properly", () => { expect(formContainer[0], "formcontainer is initialized").to.not.be.null; - expect(Object.keys(formContainer[0]._fields).length).to.equal(11); + expect(Object.keys(formContainer[0]._fields).length).to.equal(12); }); it("form 2 model initialized properly", () => { expect(formContainer[1], "formcontainer is initialized").to.not.be.null; - expect(Object.keys(formContainer[1]._fields).length).to.equal(4); + expect(Object.keys(formContainer[1]._fields).length).to.equal(5); }); it(" model's changes are reflected in the html for form1", () => { @@ -110,4 +110,4 @@ describe("Embed multiple form in site", () => { }) }) -}) \ No newline at end of file +}) From 2b04deee1a59a546b35c4b217fa13208bc6992a0 Mon Sep 17 00:00:00 2001 From: Ravi Date: Mon, 18 Mar 2024 20:04:18 +0530 Subject: [PATCH 06/21] Fix tests --- ui.tests/test-module/specs/textinput/textinput.runtime.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js b/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js index 706dbaefc3..a3f1ad86d7 100644 --- a/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js +++ b/ui.tests/test-module/specs/textinput/textinput.runtime.spec.js @@ -169,7 +169,7 @@ describe("Form Runtime with Text Input", () => { const [textbox7, textBox7FieldView] = Object.entries(formContainer._fields)[6]; const [textbox8, textBox8FieldView] = Object.entries(formContainer._fields)[7]; - const [submitbutton1, fieldView] = Object.entries(formContainer._fields)[10] + const [submitbutton1, fieldView] = Object.entries(formContainer._fields)[11] // 1. Required cy.get(`#${textbox6}`).find("input").focus().blur().then(x => { From c66920684ee908b443369ea228ea6ce63f129ce5 Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 19 Mar 2024 10:29:40 +0530 Subject: [PATCH 07/21] Add theme to datepicker tests --- .../af/core-components-it/samples/datepicker/basic/.content.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml index 7fc38b394e..7b4d24a477 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml @@ -9,6 +9,7 @@ jcr:language="en" jcr:primaryType="cq:PageContent" jcr:title="Adaptive Form V2 (IT)" + sling:configRef="/conf/forms/core-components-it/samples/datepicker/basic/" sling:resourceType="forms-components-examples/components/page"> Date: Tue, 19 Mar 2024 10:51:32 +0530 Subject: [PATCH 08/21] incorporating review comments --- .../internal/models/v1/form/DatePickerImpl.java | 13 ------------- .../internal/models/v1/form/TextInputImpl.java | 11 ----------- .../core/components/models/form/DatePicker.java | 10 ---------- .../cq/forms/core/components/models/form/Field.java | 10 ++++++++++ .../core/components/models/form/TextInput.java | 10 ---------- .../core/components/util/AbstractFieldImpl.java | 10 ++++++++++ 6 files changed, 20 insertions(+), 44 deletions(-) diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java index 413c7655a0..b97416f5b8 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java @@ -18,16 +18,13 @@ import java.util.Date; import java.util.Map; -import javax.annotation.Nullable; import javax.annotation.PostConstruct; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Exporter; import org.apache.sling.models.annotations.Model; -import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy; import org.apache.sling.models.annotations.injectorspecific.SlingObject; -import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; import org.jetbrains.annotations.NotNull; import com.adobe.cq.export.json.ComponentExporter; @@ -72,10 +69,6 @@ public Date getExclusiveMinimumDate() { return ComponentUtils.clone(exclusiveMinimumVaue); } - @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) - @Nullable - protected String displayValueExpression; - public @NotNull Map getConstraintMessages() { Map res = super.getConstraintMessages(); String msg = getConstraintMessage(ConstraintType.MINIMUM); @@ -101,10 +94,4 @@ private void initDatePicker() { minimumDate = null; } } - - @Override - @Nullable - public String getDisplayValueExpression() { - return displayValueExpression; - } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java index 8356ca53ab..7f980f9f89 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java @@ -69,11 +69,6 @@ public class TextInputImpl extends AbstractFieldImpl implements TextInput { private Object exclusiveMaximumValue; /** End of Type number specific constraints **/ - - @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) - @Nullable - protected String displayValueExpression; - @Override public boolean isMultiLine() { return multiLine; @@ -173,10 +168,4 @@ private void initTextInput() { minimum = null; } } - - @Override - @Nullable - public String getDisplayValueExpression() { - return displayValueExpression; - } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java index c3a2b8304f..c90b5ca6a8 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/DatePicker.java @@ -36,14 +36,4 @@ public interface DatePicker extends Field, DateConstraint { default Object[] getDefault() { return null; } - - /** - * The expression that when evaluated would determine what the displayValue of a field would be - * - * @return display value expression of the field - * @since com.adobe.cq.forms.core.components.models.form 5.2.0 - */ - default String getDisplayValueExpression() { - return null; - } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Field.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Field.java index 20985af3ee..4d2f4f1899 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Field.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Field.java @@ -98,4 +98,14 @@ default Object[] getDefault() { return null; } + /** + * The expression that when evaluated would determine what the displayValue of a field would be + * + * @return display value expression of the field + * @since com.adobe.cq.forms.core.components.models.form 5.2.0 + */ + default String getDisplayValueExpression() { + return null; + } + } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java index ee833c9f63..4415ceabde 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TextInput.java @@ -66,14 +66,4 @@ default String getFormat() { return null; } - /** - * The expression that when evaluated would determine what the displayValue of a field would be - * - * @return display value expression of the field - * @since com.adobe.cq.forms.core.components.models.form 5.2.0 - */ - default String getDisplayValueExpression() { - return null; - } - } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFieldImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFieldImpl.java index 4a325c5bfa..9840ff2689 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFieldImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFieldImpl.java @@ -64,6 +64,10 @@ public abstract class AbstractFieldImpl extends AbstractBaseImpl implements Fiel @Nullable protected String editFormat; + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) + @Nullable + protected String displayValueExpression; + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dataFormat") @Nullable protected String dataFormat; @@ -181,6 +185,12 @@ public String getEditFormat() { return editFormat; } + @Override + @Nullable + public String getDisplayValueExpression() { + return displayValueExpression; + } + @Override @Nullable public String getDataFormat() { From 69c460c5dbdc592394b183eb3051f54f5105ac97 Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 19 Mar 2024 11:10:06 +0530 Subject: [PATCH 09/21] Added themeRef on guidecontainer for datepicker collateral --- .../af/core-components-it/samples/datepicker/basic/.content.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml index 7b4d24a477..c900cf461c 100755 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml @@ -17,6 +17,7 @@ jcr:lastModifiedBy="admin" jcr:primaryType="nt:unstructured" sling:resourceType="forms-components-examples/components/form/container" + themeRef="/libs/fd/af/themes/canvas" clientLibRef="corecomponent.it.customfunction" fieldType="form" schemaType="none" From c4f849666a9d43586a2b560894b9a1a4c1632c41 Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 19 Mar 2024 11:26:06 +0530 Subject: [PATCH 10/21] Incorporating review comments --- .../internal/models/v1/form/NumberInputImpl.java | 11 ----------- .../core/components/models/form/NumberInput.java | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java index 6293e84f7b..6d1be3be18 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java @@ -64,11 +64,6 @@ public class NumberInputImpl extends AbstractFieldImpl implements NumberInput { @Nullable private Boolean excludeMinimumCheck; /** End **/ - - @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) - @Nullable - protected String displayValueExpression; - private Long exclusiveMinimumVaue; private Long exclusiveMaximumValue; @@ -118,10 +113,4 @@ private void initNumberInput() { minimum = null; } } - - @Override - @Nullable - public String getDisplayValueExpression() { - return displayValueExpression; - } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java index 9383730b84..690cd3a8ce 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/NumberInput.java @@ -27,17 +27,6 @@ */ @ConsumerType public interface NumberInput extends Field, NumberConstraint { - - /** - * The expression that when evaluated would determine what the displayValue of a field would be - * - * @return display value expression of the field - * @since com.adobe.cq.forms.core.components.models.form 5.2.0 - */ - default String getDisplayValueExpression() { - return null; - } - @Nullable @JsonIgnore default String getEditFormat() { From 1971b5617601262af92ec27b5f21357e2a88696e Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 19 Mar 2024 13:06:44 +0530 Subject: [PATCH 11/21] Incorporating review comments RTC @done --- .../main/content/META-INF/vault/filter.xml | 1 - .../content/jcr_root/conf/forms/.content.xml | 4 -- .../forms/core-components-it/.content.xml | 4 -- .../core-components-it/samples/.content.xml | 4 -- .../samples/datepicker/.content.xml | 4 -- .../samples/datepicker/basic/.content.xml | 4 -- .../basic/_sling_configs/.content.xml | 12 ----- .../basic/_sling_configs/_rep_policy.xml | 8 --- .../.content.xml | 54 ------------------- .../clientlibs/site/js/emailinputview.js | 8 +-- .../clientlibs/site/js/telephoneinputview.js | 8 +-- .../clientlibs/site/js/textinputview.js | 8 +-- ui.frontend/src/view/FormFieldBase.js | 12 +++++ ui.tests/test-module/libs/support/commands.js | 12 +++-- .../datepicker.runtime.localisation.spec.js | 15 +++++- .../datepicker/datepicker.runtime.spec.js | 14 ++++- .../datepicker.runtime.thai.locale.spec.js | 15 +++++- 17 files changed, 67 insertions(+), 120 deletions(-) delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/.content.xml delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml delete mode 100755 it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml diff --git a/it/content/src/main/content/META-INF/vault/filter.xml b/it/content/src/main/content/META-INF/vault/filter.xml index b190a0b2f5..09149dc37c 100644 --- a/it/content/src/main/content/META-INF/vault/filter.xml +++ b/it/content/src/main/content/META-INF/vault/filter.xml @@ -1,7 +1,6 @@ - diff --git a/it/content/src/main/content/jcr_root/conf/forms/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/.content.xml deleted file mode 100755 index 1581aa3428..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml deleted file mode 100755 index 9908fc60a1..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml deleted file mode 100755 index 9908fc60a1..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml deleted file mode 100755 index 9908fc60a1..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml deleted file mode 100755 index 9908fc60a1..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml deleted file mode 100755 index 39d5339311..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/.content.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml deleted file mode 100755 index 2339ed0e6b..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/_rep_policy.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml b/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml deleted file mode 100755 index 16d833f686..0000000000 --- a/it/content/src/main/content/jcr_root/conf/forms/core-components-it/samples/datepicker/basic/_sling_configs/com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig/.content.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js index ef0b9a2fa3..81282127e8 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/emailinput/v1/emailinput/clientlibs/site/js/emailinputview.js @@ -72,16 +72,12 @@ } this.widget.addEventListener('blur', (e) => { this._model.value = e.target.value; - if(this._model.displayValue) { - this.widget.value = this._model.displayValue; - } + this.setWidgetValueToDisplayValue(); this.setInactive(); }); this.widget.addEventListener('focus', (e) => { this.setActive(); - if(this._model.displayValue) { - this.widget.value = this._model.value; - } + this.setWidgetValueToModelValue(); }); } } diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js index 0f0a7c86f3..d7d2142a60 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/telephoneinput/v1/telephoneinput/clientlibs/site/js/telephoneinputview.js @@ -72,16 +72,12 @@ } this.widget.addEventListener('blur', (e) => { this._model.value = e.target.value; - if(this._model.displayValue) { - this.widget.value = this._model.displayValue; - } + this.setWidgetValueToDisplayValue(); this.setInactive(); }); this.widget.addEventListener('focus', (e) => { this.setActive(); - if(this._model.displayValue) { - this.widget.value = this._model.value; - } + this.setWidgetValueToModelValue(); }); } } diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js index a7f498ba1f..183b2fe4db 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js @@ -72,16 +72,12 @@ } this.widget.addEventListener('blur', (e) => { this._model.value = e.target.value; - if(this._model.displayValue) { - this.widget.value = this._model.displayValue; - } + this.setWidgetValueToDisplayValue(); this.setInactive(); }); this.widget.addEventListener('focus', (e) => { this.setActive(); - if(this._model.displayValue) { - this.widget.value = this._model.value; - } + this.setWidgetValueToModelValue(); }); } } diff --git a/ui.frontend/src/view/FormFieldBase.js b/ui.frontend/src/view/FormFieldBase.js index 93e2b1d643..86c9b06d78 100644 --- a/ui.frontend/src/view/FormFieldBase.js +++ b/ui.frontend/src/view/FormFieldBase.js @@ -307,6 +307,18 @@ class FormFieldBase extends FormField { return this.parentView.getModel().name; } + setWidgetValueToDisplayValue() { + if(this._model.displayValue) { + this.widget.value = this._model.displayValue; + } + } + + setWidgetValueToModelValue() { + if(this._model.displayValue) { + this.widget.value = this._model.value; + } + } + /** * Shows or hides the tooltip
based on the provided flag. * @param {boolean} show - If true, the tooltip
will be shown; otherwise, it will be hidden. diff --git a/ui.tests/test-module/libs/support/commands.js b/ui.tests/test-module/libs/support/commands.js index c8a1438d16..d9d1e684ae 100644 --- a/ui.tests/test-module/libs/support/commands.js +++ b/ui.tests/test-module/libs/support/commands.js @@ -254,9 +254,13 @@ Cypress.Commands.add("openPage", (pagePath, options = {}) => { // getting status 403 intermittently, just ignore it const baseUrl = contextPath; cy.visit(baseUrl, {'failOnStatusCode': false}); - cy.login(baseUrl, () => { - cy.openPage(path, options); - }); + cy.getCookie('login-token').then(cookie => { + if(!cookie) { + cy.login(baseUrl, () => { + cy.openPage(path, options); + }); + } + }) } cy.visit(path, options); }); @@ -714,4 +718,4 @@ Cypress.Commands.add("getContentIframeBody", () => { .get('#ContentFrame') .its('0.contentDocument.body').should('not.be.empty') .then(cy.wrap) -}) \ No newline at end of file +}) diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js index c274d33bd5..a80487c438 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js @@ -19,6 +19,19 @@ describe("Form Runtime with Date Picker", () => { const bemBlock = 'cmp-adaptiveform-datepicker' let formContainer = null + const fmPropertiesUI = "/libs/fd/fm/gui/content/forms/formmetadataeditor.html/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic" + const themeRef = 'input[name="./jcr:content/metadata/themeRef"]' + const propertiesSaveBtn = '#shell-propertiespage-doneactivator' + // enabling theme for this test case as without theme there is a bug in custom widget css + before(() => { + cy.openPage(fmPropertiesUI).then(() => { + cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { + cy.get(propertiesSaveBtn).click().then(() => { + cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); + }) + }) + }) + }) beforeEach(() => { cy.previewForm(pagePath, {"params" : ["afAcceptLang=fr"]}).then(p => { @@ -81,4 +94,4 @@ describe("Form Runtime with Date Picker", () => { }); }); -}) \ No newline at end of file +}) diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js index 731637bc01..0d5a4bd2c0 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js @@ -16,11 +16,23 @@ describe("Form Runtime with Date Picker", () => { const pagePath = "content/forms/af/core-components-it/samples/datepicker/basic.html" - const fmPropertiesUI = "/libs/fd/fm/gui/content/forms/formmetadataeditor.html/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic" const bemBlock = 'cmp-adaptiveform-datepicker' let toggle_array = []; let formContainer = null + const fmPropertiesUI = "/libs/fd/fm/gui/content/forms/formmetadataeditor.html/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic" + const themeRef = 'input[name="./jcr:content/metadata/themeRef"]' + const propertiesSaveBtn = '#shell-propertiespage-doneactivator' + // enabling theme for this test case as without theme there is a bug in custom widget css + before(() => { + cy.openPage(fmPropertiesUI).then(() => { + cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { + cy.get(propertiesSaveBtn).click().then(() => { + cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); + }) + }) + }) + }) beforeEach(() => { cy.previewForm(pagePath).then(p => { diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js index e570e892a0..651406bad2 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js @@ -19,6 +19,19 @@ describe("Form Runtime with Date Picker", () => { const bemBlock = 'cmp-adaptiveform-datepicker' let formContainer = null + const fmPropertiesUI = "/libs/fd/fm/gui/content/forms/formmetadataeditor.html/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic" + const themeRef = 'input[name="./jcr:content/metadata/themeRef"]' + const propertiesSaveBtn = '#shell-propertiespage-doneactivator' + // enabling theme for this test case as without theme there is a bug in custom widget css + before(() => { + cy.openPage(fmPropertiesUI).then(() => { + cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { + cy.get(propertiesSaveBtn).click().then(() => { + cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); + }) + }) + }) + }) beforeEach(() => { cy.previewForm(pagePath, {"params" : ["afAcceptLang=th"]}).then(p => { @@ -62,4 +75,4 @@ describe("Form Runtime with Date Picker", () => { -}) \ No newline at end of file +}) From a88e8f17d3bf858e2e85521f4d1956f212f692fa Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 19 Mar 2024 14:42:09 +0530 Subject: [PATCH 12/21] RTC(Done) Fixing test cases --- ui.frontend/src/view/FormFieldBase.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui.frontend/src/view/FormFieldBase.js b/ui.frontend/src/view/FormFieldBase.js index 86c9b06d78..c6cbf8c578 100644 --- a/ui.frontend/src/view/FormFieldBase.js +++ b/ui.frontend/src/view/FormFieldBase.js @@ -308,13 +308,13 @@ class FormFieldBase extends FormField { } setWidgetValueToDisplayValue() { - if(this._model.displayValue) { + if(this._model.displayValueExpression && this._model.displayValue) { // only do this if displayValueExpression is set this.widget.value = this._model.displayValue; } } setWidgetValueToModelValue() { - if(this._model.displayValue) { + if(this._model.displayValueExpression && this._model.displayValue) { // only do this if displayValueExpression is set this.widget.value = this._model.value; } } From eca3efd4840f701453a7c6a993eca15f168f174d Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 19 Mar 2024 14:59:49 +0530 Subject: [PATCH 13/21] RTC(done) fixing tests --- .../specs/datepicker/datepicker.runtime.localisation.spec.js | 2 +- .../test-module/specs/datepicker/datepicker.runtime.spec.js | 2 +- .../specs/datepicker/datepicker.runtime.thai.locale.spec.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js index a80487c438..8a59d5f588 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js @@ -27,7 +27,7 @@ describe("Form Runtime with Date Picker", () => { cy.openPage(fmPropertiesUI).then(() => { cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { cy.get(propertiesSaveBtn).click().then(() => { - cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); + //cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); }) }) }) diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js index 0d5a4bd2c0..8839d4fff6 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js @@ -28,7 +28,7 @@ describe("Form Runtime with Date Picker", () => { cy.openPage(fmPropertiesUI).then(() => { cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { cy.get(propertiesSaveBtn).click().then(() => { - cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); + //cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); }) }) }) diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js index 651406bad2..1e59007699 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js @@ -27,7 +27,7 @@ describe("Form Runtime with Date Picker", () => { cy.openPage(fmPropertiesUI).then(() => { cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { cy.get(propertiesSaveBtn).click().then(() => { - cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); + //cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); }) }) }) From 3d7ae930b32a5304609b26b83c4ff84377148846 Mon Sep 17 00:00:00 2001 From: Ravi Date: Tue, 19 Mar 2024 15:53:54 +0530 Subject: [PATCH 14/21] RTC(done) fixing tests --- .../core-components-it/samples/datepicker/basic/.content.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic/.content.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic/.content.xml index 1187cc4bc6..d20ea90eb1 100755 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic/.content.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic/.content.xml @@ -9,6 +9,7 @@ type="guide"> - \ No newline at end of file + From 30376f83b55a6e5a4f3b5f13e006e3f4c72073b2 Mon Sep 17 00:00:00 2001 From: Ravi Date: Wed, 20 Mar 2024 12:22:28 +0530 Subject: [PATCH 15/21] RTC(done) specVersion updated in formContainer --- .../cq/forms/core/components/models/form/FormContainer.java | 4 ++-- .../specs/datepicker/datepicker.runtime.localisation.spec.js | 4 +--- .../test-module/specs/datepicker/datepicker.runtime.spec.js | 4 +--- .../specs/datepicker/datepicker.runtime.thai.locale.spec.js | 4 +--- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java index 52fffee5c2..83541d07f3 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java @@ -64,7 +64,7 @@ public interface FormContainer extends Container { */ String PN_CLIENT_LIB_REF = GuideConstants.CLIENT_LIB_REF; - String DEFAULT_FORMS_SPEC_VERSION = "0.12.1"; + String DEFAULT_FORMS_SPEC_VERSION = "0.12.5"; /** * Returns form metadata {@link FormMetaData} @@ -89,7 +89,7 @@ default String getAdaptiveFormVersion() { * Returns schema reference * * @return reference to schema - * + * * @since com.adobe.cq.forms.core.components.models.form 2.1.0 */ @Nullable diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js index 8a59d5f588..c62f3e2b45 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.localisation.spec.js @@ -26,9 +26,7 @@ describe("Form Runtime with Date Picker", () => { before(() => { cy.openPage(fmPropertiesUI).then(() => { cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { - cy.get(propertiesSaveBtn).click().then(() => { - //cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); - }) + cy.get(propertiesSaveBtn).click(); }) }) }) diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js index 8839d4fff6..11f032d3d9 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js @@ -27,9 +27,7 @@ describe("Form Runtime with Date Picker", () => { before(() => { cy.openPage(fmPropertiesUI).then(() => { cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { - cy.get(propertiesSaveBtn).click().then(() => { - //cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); - }) + cy.get(propertiesSaveBtn).click(); }) }) }) diff --git a/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js index 1e59007699..d972abf59a 100644 --- a/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js +++ b/ui.tests/test-module/specs/datepicker/datepicker.runtime.thai.locale.spec.js @@ -26,9 +26,7 @@ describe("Form Runtime with Date Picker", () => { before(() => { cy.openPage(fmPropertiesUI).then(() => { cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => { - cy.get(propertiesSaveBtn).click().then(() => { - //cy.url().should('include','/aem/forms.html/content/dam/formsanddocuments/core-components-it/'); - }) + cy.get(propertiesSaveBtn).click(); }) }) }) From 745dffc7b2d72feffdcdcb8c35717dbf19d7b9eb Mon Sep 17 00:00:00 2001 From: Ravi Date: Wed, 20 Mar 2024 14:10:57 +0530 Subject: [PATCH 16/21] RTC Fix test case --- .../java/com/adobe/cq/forms/core/Utils.java | 2 +- .../models/v2/form/FormContainerImplTest.java | 2 +- .../exporter-formcontainerv2.json | 32 ++++++++++--------- .../schema/0.12.5/adaptive-form.schema.json | 5 ++- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java index 9b1a8f94eb..1c1e502efe 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java @@ -132,7 +132,7 @@ public static void testSchemaValidation(@NotNull Object model) { // if there is a version bump of schema, then it needs to be validated against its corresponding sling model here // by explicitly checking the model implementation if (!(model instanceof FormContainerImpl)) { - InputStream formContainerTemplate = Utils.class.getResourceAsStream("/schema/0.12.0/form.json"); + InputStream formContainerTemplate = Utils.class.getResourceAsStream("/schema/0.12.5/form.json"); JsonNode formContainerTemplateNode = objectMapper.readTree(formContainerTemplate); ((ObjectNode) formContainerTemplateNode).putArray("items").add(json); json = formContainerTemplateNode; diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java index 12fe06fed1..d130dfb015 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java @@ -150,7 +150,7 @@ void testGetAdaptiveFormCustomVersion() throws Exception { void testGetAdaptiveFormDefaultVersion() throws Exception { FormContainer formContainer = Utils.getComponentUnderTest(PATH_FORM_1, FormContainer.class, context); assertNotNull(formContainer.getAdaptiveFormVersion()); - assertEquals("0.12.1", formContainer.getAdaptiveFormVersion()); + assertEquals("0.12.5", formContainer.getAdaptiveFormVersion()); } @Test diff --git a/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json b/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json index 8886dc2ab9..8b24ca1dcf 100644 --- a/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json +++ b/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json @@ -10,8 +10,22 @@ }, "fd:path": "/content/forms/af/demo/jcr:content/formcontainerv2", "fd:schemaType": "BASIC", - "fd:formDataEnabled" : true + "fd:formDataEnabled": true }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + ":itemsOrder": [ + "textinput" + ], + "adaptiveform": "0.12.5", + "metadata": { + "version": "1.0.0", + "grammar": "json-formula-1.0.0" + }, + ":type": "core/fd/components/form/container/v2/container", ":items": { "textinput": { "id": "textinput-9a52c5fa93", @@ -37,17 +51,5 @@ }, ":type": "core/fd/components/form/textinput/v1/textinput" } - }, - ":itemsOrder" : ["textinput"], - "events": { - "custom:setProperty": [ - "$event.payload" - ] - }, - "metadata": { - "version": "1.0.0", - "grammar": "json-formula-1.0.0" - }, - "adaptiveform": "0.12.1", - ":type": "core/fd/components/form/container/v2/container" -} \ No newline at end of file + } +} diff --git a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json index 393c31d9dc..1d9311021b 100644 --- a/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.12.5/adaptive-form.schema.json @@ -1,5 +1,5 @@ { - "$id": "classpath:/schema/0.12.1/adaptive-form.schema.json", + "$id": "classpath:/schema/0.12.5/adaptive-form.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "$defs": { "FormElement": { @@ -1327,6 +1327,9 @@ }, { "const": "0.12.1" + }, + { + "const": "0.12.5" } ] }, From 7c89e265521a719eb7745eaa2d4b5d32bb96b2bb Mon Sep 17 00:00:00 2001 From: Ravi Date: Wed, 20 Mar 2024 14:48:03 +0530 Subject: [PATCH 17/21] RTC Persisting spec Version in guideContainer node --- .../form/container/v2/container/_cq_dialog/.content.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml index 715481f6e8..b31f71548f 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml @@ -71,6 +71,11 @@ fieldDescription="This client library contains JavaScript Functions which can be used in expressions supported by Adaptive Forms." fieldLabel="Client library category" name="./clientLibRef"/> + From 4ff5af4b6c6b0d39132e8acaeadb3f1da28b9978 Mon Sep 17 00:00:00 2001 From: Ravi Date: Thu, 21 Mar 2024 12:59:38 +0530 Subject: [PATCH 18/21] RTC default value JUNIT added --- .../internal/models/v1/form/NumberInputImplTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java index 97683b8923..0c479ab27d 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java @@ -369,9 +369,19 @@ void testJSONExportDataLayer() throws Exception { Utils.testJSONExport(numberInput, Utils.getTestExporterJSONPath(BASE, PATH_NUMBER_INPUT_DATALAYER)); } + @Test + void testGetDisplayValueExpression() throws Exception { + NumberInput numberInputMock = Mockito.mock(NumberInput.class); + Mockito.when(numberInputMock.getDisplayValueExpression()).thenCallRealMethod(); + assertEquals(null, numberInputMock.getDataFormat()); + NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION, NumberInput.class, context); + assertEquals("($field.$value & abc)", numberInput.getDisplayValueExpression()); + } + @Test void testJSONExportForDisplayValueExpression() throws Exception { NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION, NumberInput.class, context); Utils.testJSONExport(numberInput, Utils.getTestExporterJSONPath(BASE, PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION)); } + } From 6ecd66f93f11798f85c88a9fb99aa6d25e03e3c6 Mon Sep 17 00:00:00 2001 From: Ravi Date: Thu, 21 Mar 2024 15:26:16 +0530 Subject: [PATCH 19/21] RTC fix tests --- .../components/internal/models/v1/form/NumberInputImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java index 0c479ab27d..8c16e2f670 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java @@ -375,7 +375,7 @@ void testGetDisplayValueExpression() throws Exception { Mockito.when(numberInputMock.getDisplayValueExpression()).thenCallRealMethod(); assertEquals(null, numberInputMock.getDataFormat()); NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION, NumberInput.class, context); - assertEquals("($field.$value & abc)", numberInput.getDisplayValueExpression()); + assertEquals("($field.$value & abc)",numberInput.getDisplayValueExpression()); } @Test From 4cd0179e49eac0f38c7489c92a1ff212020ec841 Mon Sep 17 00:00:00 2001 From: Ravi Date: Thu, 21 Mar 2024 15:32:40 +0530 Subject: [PATCH 20/21] RTC fix formatting --- .../components/internal/models/v1/form/NumberInputImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java index 8c16e2f670..0c479ab27d 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java @@ -375,7 +375,7 @@ void testGetDisplayValueExpression() throws Exception { Mockito.when(numberInputMock.getDisplayValueExpression()).thenCallRealMethod(); assertEquals(null, numberInputMock.getDataFormat()); NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION, NumberInput.class, context); - assertEquals("($field.$value & abc)",numberInput.getDisplayValueExpression()); + assertEquals("($field.$value & abc)", numberInput.getDisplayValueExpression()); } @Test From bba5c509e0980e0e0994c516de63084a65cd1c7d Mon Sep 17 00:00:00 2001 From: Ravi Date: Thu, 21 Mar 2024 16:08:28 +0530 Subject: [PATCH 21/21] RTC fix tests --- .../models/v1/form/NumberInputImplTest.java | 2 +- ui.frontend/package-lock.json | 21 +++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java index 0c479ab27d..2f6a56d0b7 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java @@ -373,7 +373,7 @@ void testJSONExportDataLayer() throws Exception { void testGetDisplayValueExpression() throws Exception { NumberInput numberInputMock = Mockito.mock(NumberInput.class); Mockito.when(numberInputMock.getDisplayValueExpression()).thenCallRealMethod(); - assertEquals(null, numberInputMock.getDataFormat()); + assertEquals(null, numberInputMock.getDisplayValueExpression()); NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION, NumberInput.class, context); assertEquals("($field.$value & abc)", numberInput.getDisplayValueExpression()); } diff --git a/ui.frontend/package-lock.json b/ui.frontend/package-lock.json index ac4f3844cf..b50d90e1e2 100644 --- a/ui.frontend/package-lock.json +++ b/ui.frontend/package-lock.json @@ -11365,8 +11365,7 @@ }, "@babel/plugin-proposal-private-property-in-object": { "version": "7.21.0-placeholder-for-preset-env.2", - "dev": true, - "requires": {} + "dev": true }, "@babel/plugin-syntax-async-generators": { "version": "7.8.4", @@ -13304,8 +13303,7 @@ }, "@webpack-cli/configtest": { "version": "1.2.0", - "dev": true, - "requires": {} + "dev": true }, "@webpack-cli/info": { "version": "1.5.0", @@ -13316,8 +13314,7 @@ }, "@webpack-cli/serve": { "version": "1.7.0", - "dev": true, - "requires": {} + "dev": true }, "@xtuc/ieee754": { "version": "1.2.0", @@ -13351,8 +13348,7 @@ }, "acorn-import-assertions": { "version": "1.9.0", - "dev": true, - "requires": {} + "dev": true }, "acorn-walk": { "version": "7.2.0", @@ -13388,8 +13384,7 @@ }, "ajv-keywords": { "version": "3.5.2", - "dev": true, - "requires": {} + "dev": true }, "ansi-escapes": { "version": "4.3.2", @@ -15755,8 +15750,7 @@ }, "jest-pnp-resolver": { "version": "1.2.3", - "dev": true, - "requires": {} + "dev": true }, "jest-regex-util": { "version": "26.0.0", @@ -18238,8 +18232,7 @@ }, "ws": { "version": "8.16.0", - "dev": true, - "requires": {} + "dev": true }, "xml-name-validator": { "version": "4.0.0",