Skip to content

Commit

Permalink
Merge pull request #1394 from adobe/devMaster12Sep
Browse files Browse the repository at this point in the history
Dev master12 sep
  • Loading branch information
rismehta authored Sep 12, 2024
2 parents 452ca1c + 7bffb4f commit fc8a109
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2022 Adobe
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->

<div class="form"
data-sly-use.container="com.adobe.cq.forms.core.components.models.form.FormContainer"
data-sly-use.formstructparser="com.adobe.cq.forms.core.components.models.form.FormStructureParser"
data-sly-use.formUtil="com.adobe.cq.forms.core.components.models.form.HtlUtil"
data-sly-test.isEdgeDeliveryRequest="${formUtil.edgeDeliveryRequest}">
<div>
<div>
<pre>
<code>"${formstructparser.formDefinition @ context='jsonString'}"</code>
</pre>
</div>
</div>
</div>
<sly data-sly-test="${!isEdgeDeliveryRequest}">
<sly data-sly-test="${wcmmode.edit}" data-sly-use.allowed="com.day.cq.wcm.foundation.AllowedComponentList"></sly>

<form data-sly-use.configurationProvider="com.adobe.cq.forms.core.components.models.form.FormConfigurationProvider"
role="${container.roleAttribute}"
autocomplete="off"
data-sly-use.grid="com.day.cq.wcm.foundation.model.responsivegrid.ResponsiveGrid"
data-sly-use.templates="core/wcm/components/commons/v1/templates.html"
action="${container.metadata.action}"
id="${container.id}"
data-cmp-is="adaptiveFormContainer"
data-cmp-context-path="${request.contextPath}"
data-cmp-page-lang="${container.containingPageLang}"
data-cmp-path="${resource.path}"
class="cmp-adaptiveform-container cmp-container ${wcmmode.edit ? 'cmp-adaptiveform-container--edit' : ''}"
data-cmp-custom-functions-module-url="${configurationProvider.customFunctionModuleUrl}"
dir="${container.languageDirection}"
method="post">

<sly data-sly-test.isAllowedApplicable="${allowed.isApplicable}"
data-sly-use.allowedTemplate="allowedcomponents.html"
data-sly-call="${allowedTemplate.allowedcomponents @ title=allowed.title, components=allowed.components}"></sly>
<input type="hidden" name=":formstart" value="${resource.path}"/>
<input type="hidden" name="_charset_" value="utf-8"/>
<input data-sly-test="${container.redirectUrl}" type="hidden" name=":redirect" value="${container.redirectUrl}"/>
<div id="${container.id}-wrapper"
class="cmp-adaptiveform-container__wrapper ${grid.cssClass} ${allowed.cssClass}">
<sly data-sly-test="${!isAllowedApplicable}" data-sly-repeat.paragraph="${grid.paragraphs}"
data-sly-resource="${paragraph.path @ resourceType=paragraph.resourceType, decorationTagName='div', cssClassName=paragraph.cssClass}"></sly>
<sly data-sly-resource="${resource.path @ resourceType='wcm/foundation/components/responsivegrid/new', appendPath='/*', decorationTagName='div', cssClassName='new section aem-Grid-newComponent'}"
data-sly-test="${!isAllowedApplicable && (wcmmode.edit || wcmmode.preview)}"></sly>
<sly data-sly-use="${'removeattribute.js' @ referencedPage }"/>
</div>
</form>
<div data-cmp-adaptiveform-container-loader="${container.id}"></div>
</sly>
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
jcr:primaryType="cq:Page">
jcr:primaryType="cq:Page">
<jcr:content
cq:deviceGroups="[mobile/groups/responsive]"
cq:lastModified="{Date}2023-01-09T16:01:24.451+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">
cq:deviceGroups="[mobile/groups/responsive]"
cq:lastModified="{Date}2024-09-10T14:57:01.796+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">
<guideContainer
fd:version="2.1"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/form/container"
dorType="none"
themeRef="/libs/fd/af/themes/canvas"
fieldType="form">
fd:version="2.1"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/form/container"
dorType="none"
fieldType="form"
themeRef="/libs/fd/af/themes/canvas">
<fragment
jcr:lastModified="{Date}2023-06-02T12:34:24.990+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Fragment"
sling:resourceType="forms-components-examples/components/form/fragment"
fieldType="panel"
fragmentPath="/content/forms/af/core-components-it/samples/fragment/test-fragment"
maxOccur="4"
minOccur="0"
name="fragment1685689465369"
repeatable="{Boolean}true"
wrapData="{Boolean}true"/>
<fragment1
jcr:lastModified="{Date}2023-06-02T12:34:24.990+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Fragment"
jcr:title="Fragment 1"
sling:resourceType="forms-components-examples/components/form/fragment"
fieldType="panel"
fragmentPath="/content/forms/af/core-components-it/samples/fragment/test-fragment"
repeatable="{Boolean}true"
maxOccur="4"
minOccur="0"
name="fragment1685689465369"
name="fragment16856894653691"
repeatable="{Boolean}true"
wrapData="{Boolean}true"/>
</guideContainer>
</jcr:content>
</jcr:root>
</jcr:root>
56 changes: 43 additions & 13 deletions .../jcr_root/content/forms/af/core-components-it/samples/fragment/test-fragment/.content.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
jcr:primaryType="cq:Page">
<jcr:content
cq:deviceGroups="[/etc/mobile/groups/responsive]"
cq:lastModified="{Date}2023-06-02T12:27:19.297+05:30"
cq:lastModified="{Date}2024-09-10T15:11:58.094+05:30"
cq:lastModifiedBy="admin"
cq:template="/conf/core-components-examples/settings/wcm/templates/af-blank-v2"
jcr:language="en"
Expand All @@ -12,15 +12,15 @@
sling:configRef="/conf/forms/core-components-it/af-v2-test/"
sling:resourceType="forms-components-examples/components/page">
<guideContainer
fd:version="2.1"
fd:type="fragment"
fd:version="2.1"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/form/fragmentcontainer"
clientLibRef="x.y"
dorType="none"
fieldType="form"
thankYouOption="page"
themeRef="/libs/fd/af/themes/canvas"
clientLibRef="x.y"
title="AF Fragment (v2)">
<textinput
jcr:lastModified="{Date}2023-06-02T12:27:19.294+05:30"
Expand All @@ -31,20 +31,50 @@
fieldType="text-input"
name="fragmenttextinput"/>
<textinput1
jcr:created="{Date}2024-05-08T20:17:24.203+05:30"
jcr:lastModified="{Date}2024-05-08T20:17:24.203+05:30"
jcr:primaryType="nt:unstructured"
jcr:title="Responsive Text Input"
sling:resourceType="forms-components-examples/components/form/textinput"
fieldType="text-input"
name="textinput1715179644273">
jcr:created="{Date}2024-05-08T20:17:24.203+05:30"
jcr:lastModified="{Date}2024-05-08T20:17:24.203+05:30"
jcr:primaryType="nt:unstructured"
jcr:title="Responsive Text Input"
sling:resourceType="forms-components-examples/components/form/textinput"
fieldType="text-input"
name="textinput1715179644273">
<cq:responsive jcr:primaryType="nt:unstructured">
<default
jcr:primaryType="nt:unstructured"
offset="1"
width="9"/>
jcr:primaryType="nt:unstructured"
offset="1"
width="9"/>
</cq:responsive>
<fd:rules
fd:calc="[{&quot;nodeName&quot;:&quot;ROOT&quot;\,&quot;items&quot;:[{&quot;nodeName&quot;:&quot;STATEMENT&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;CALC_EXPRESSION&quot;\,&quot;items&quot;:[{&quot;nodeName&quot;:&quot;VALUE_FIELD&quot;\,&quot;value&quot;:{&quot;id&quot;:&quot;$form.textinput1715179644273&quot;\,&quot;type&quot;:&quot;STRING&quot;\,&quot;name&quot;:&quot;textinput1715179644273&quot;}}\,{&quot;nodeName&quot;:&quot;to&quot;\,&quot;value&quot;:null}\,{&quot;nodeName&quot;:&quot;EXPRESSION&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;COMPONENT&quot;\,&quot;value&quot;:{&quot;id&quot;:&quot;$form.fragmenttextinput&quot;\,&quot;displayName&quot;:&quot;Text Input&quot;\,&quot;type&quot;:&quot;STRING&quot;\,&quot;displayPath&quot;:&quot;FORM/Text Input/&quot;\,&quot;name&quot;:&quot;fragmenttextinput&quot;\,&quot;parent&quot;:&quot;$form&quot;}}}\,{&quot;nodeName&quot;:&quot;When&quot;\,&quot;value&quot;:null}\,{&quot;nodeName&quot;:&quot;CONDITIONORALWAYS&quot;\,&quot;choice&quot;:null}]}}]\,&quot;isValid&quot;:true\,&quot;enabled&quot;:true\,&quot;version&quot;:1\,&quot;script&quot;:&quot;fragmenttextinput.$value&quot;\,&quot;eventName&quot;:&quot;Calculate&quot;\,&quot;ruleType&quot;:&quot;&quot;\,&quot;description&quot;:&quot;&quot;}]"
fd:valueCommit="[{&quot;nodeName&quot;:&quot;ROOT&quot;\,&quot;items&quot;:[{&quot;nodeName&quot;:&quot;STATEMENT&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;EVENT_SCRIPTS&quot;\,&quot;items&quot;:[{&quot;nodeName&quot;:&quot;EVENT_CONDITION&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;EVENT_AND_COMPARISON&quot;\,&quot;items&quot;:[{&quot;nodeName&quot;:&quot;COMPONENT&quot;\,&quot;value&quot;:{&quot;id&quot;:&quot;$form.textinput1715179644273&quot;\,&quot;type&quot;:&quot;STRING&quot;\,&quot;name&quot;:&quot;textinput1715179644273&quot;}}\,{&quot;nodeName&quot;:&quot;EVENT_AND_COMPARISON_OPERATOR&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;is changed&quot;\,&quot;value&quot;:null}}\,{&quot;nodeName&quot;:&quot;PRIMITIVE_EXPRESSION&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;STRING_LITERAL&quot;\,&quot;value&quot;:null}}]}\,&quot;nested&quot;:false}\,{&quot;nodeName&quot;:&quot;Then&quot;\,&quot;value&quot;:null}\,{&quot;nodeName&quot;:&quot;BLOCK_STATEMENTS&quot;\,&quot;items&quot;:[{&quot;nodeName&quot;:&quot;BLOCK_STATEMENT&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;SET_VALUE_STATEMENT&quot;\,&quot;items&quot;:[{&quot;nodeName&quot;:&quot;VALUE_FIELD&quot;\,&quot;value&quot;:{&quot;id&quot;:&quot;$form.panelcontainer1725960550534.text1725960554387&quot;\,&quot;displayName&quot;:&quot;text1725960554387&quot;\,&quot;type&quot;:&quot;STRING&quot;\,&quot;displayPath&quot;:&quot;FORM/Panel/text1725960554387/&quot;\,&quot;name&quot;:&quot;text1725960554387&quot;\,&quot;parent&quot;:&quot;$form.panelcontainer1725960550534&quot;}}\,{&quot;nodeName&quot;:&quot;to&quot;\,&quot;value&quot;:null}\,{&quot;nodeName&quot;:&quot;EXPRESSION&quot;\,&quot;choice&quot;:{&quot;nodeName&quot;:&quot;STRING_LITERAL&quot;\,&quot;value&quot;:&quot;Thanks&quot;}}]}}]}]}}]\,&quot;isValid&quot;:true\,&quot;enabled&quot;:true\,&quot;version&quot;:1\,&quot;script&quot;:[&quot;dispatchEvent($form.panelcontainer1725960550534.text1725960554387\, 'custom:setProperty'\, {value : 'Thanks'})&quot;]\,&quot;eventName&quot;:&quot;Value Commit&quot;\,&quot;ruleType&quot;:&quot;&quot;\,&quot;description&quot;:&quot;&quot;}]"
jcr:primaryType="nt:unstructured"
validationStatus="valid"
value="fragmenttextinput.$value"/>
<fd:events
jcr:primaryType="nt:unstructured"
change="[if(contains($event.payload.changes[].propertyName\, 'value')\, dispatchEvent($form.panelcontainer1725960550534.text1725960554387\, 'custom:setProperty'\, {value : 'Thanks'})\, {})]"/>
</textinput1>
<panelcontainer
jcr:created="{Date}2024-09-10T14:59:10.484+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2024-09-10T14:59:10.484+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Panel"
sling:resourceType="forms-components-examples/components/form/panelcontainer"
fieldType="panel"
name="panelcontainer1725960550534">
<text
jcr:created="{Date}2024-09-10T14:59:14.338+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2024-09-10T14:59:14.338+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Text"
sling:resourceType="forms-components-examples/components/form/text"
fieldType="plain-text"
name="text1725960554387"/>
</panelcontainer>
</guideContainer>
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@
updateValue(value) {
// html sets undefined value as undefined string in input value, hence this check is added
let actualValue = typeof value === "undefined" ? "" : value;

const sanitizedValue = window.DOMPurify ? window.DOMPurify.sanitize(actualValue) : actualValue;
// since there is no widget for textview, the innerHTML is being changed
this.element.children[0].innerHTML = actualValue;
if (this.element.children[0]) {
this.element.children[0].innerHTML = sanitizedValue;
} else {
this.element.innerHTML = sanitizedValue;
}
}
}

Expand Down
32 changes: 16 additions & 16 deletions ui.frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ui.frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"webpack-merge": "^5.8.0"
},
"dependencies": {
"@aemforms/af-core": "^0.22.102",
"@aemforms/af-formatters": "^0.22.102",
"@aemforms/af-core": "^0.22.104",
"@aemforms/af-formatters": "^0.22.104",
"@aemforms/af-custom-functions": "1.0.10"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe("Sites with Aem Embed Container", () => {
it("model initialized properly", () => {
expect(formContainer, "formcontainer is initialized").to.not.be.null;
// fragment component, text field and IntanceManager
expect(Object.keys(formContainer._fields).length).to.equal(4);
expect(Object.keys(formContainer._fields).length).to.be.gt(4);
})

it("model's changes are reflected in the html ", () => {
Expand Down
Loading

0 comments on commit fc8a109

Please sign in to comment.