Skip to content

Commit df6cd87

Browse files
scribble initial commit
1 parent 945972f commit df6cd87

File tree

41 files changed

+2083
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2083
-6
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2+
~ Copyright 2024 Adobe
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
16+
17+
package com.adobe.cq.forms.core.components.internal.models.v1.form;
18+
19+
import org.apache.sling.api.SlingHttpServletRequest;
20+
import org.apache.sling.api.resource.Resource;
21+
import org.apache.sling.models.annotations.Default;
22+
import org.apache.sling.models.annotations.Exporter;
23+
import org.apache.sling.models.annotations.Model;
24+
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
25+
26+
import com.adobe.cq.export.json.ComponentExporter;
27+
import com.adobe.cq.export.json.ExporterConstants;
28+
import com.adobe.cq.forms.core.components.models.form.Scribble;
29+
import com.adobe.cq.forms.core.components.util.AbstractFieldImpl;
30+
31+
@Model(
32+
adaptables = { SlingHttpServletRequest.class, Resource.class },
33+
adapters = { Scribble.class, ComponentExporter.class },
34+
resourceType = "core/fd/components/form/scribble/v1/scribble")
35+
@Exporter(
36+
name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
37+
extensions = ExporterConstants.SLING_MODEL_EXTENSION)
38+
public class ScribbleImpl extends AbstractFieldImpl implements Scribble {
39+
40+
@ValueMapValue
41+
@Default(values = "")
42+
private String value;
43+
44+
@Override
45+
public String getValue() {
46+
return value;
47+
}
48+
49+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2+
~ Copyright 2024 Adobe
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
16+
17+
package com.adobe.cq.forms.core.components.models.form;
18+
19+
import org.osgi.annotation.versioning.ConsumerType;
20+
21+
/**
22+
* Defines the form Scribble Sling Model used for the Scribble component.
23+
*
24+
* @since com.adobe.cq.forms.core.components.models.form 1.0.0
25+
*/
26+
@ConsumerType
27+
public interface Scribble extends Field {
28+
29+
/**
30+
* Returns the base64 encoded string of the scribble.
31+
*
32+
* @return Base64 encoded string representing the scribble
33+
* @since com.adobe.cq.forms.core.components.models.form 1.0.0
34+
*/
35+
String getValue();
36+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"id": "scribble-178a5c65c2",
3+
"fieldType": "text-input",
4+
"name": "scribble1710484027357",
5+
"value": "",
6+
"type": "string",
7+
"label": {
8+
"value": "Scribble"
9+
},
10+
"events": {
11+
"custom:setProperty": [
12+
"$event.payload"
13+
]
14+
},
15+
"properties": {
16+
"fd:dor": {
17+
"dorExclusion": false
18+
},
19+
"fd:path": "/content/forms/af/scribbletest/jcr:content/guideContainer/scribble"
20+
},
21+
":type": "forms-components-examples/components/form/scribble"
22+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
3+
jcr:primaryType="cq:Component"
4+
jcr:title="Adaptive Form Scribble"
5+
jcr:description="Add a field to capture scribble signature."
6+
sling:resourceSuperType="core/fd/components/form/scribble/v1/scribble"
7+
componentGroup="Core Components Examples - Adaptive Form"/>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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"
3+
jcr:primaryType="nt:unstructured"
4+
jcr:title="Scribble"
5+
fieldType="scribble"/>

ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
cssProcessor="[default:none,min:none]"
66
jsProcessor="[default:none,min:none]"
77
categories="[core.forms.components.runtime.all]"
8-
embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v3.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime,core.forms.components.switch.v1.runtime,core.forms.components.termsandconditions.v1.runtime, core.forms.components.hcaptcha.v1.runtime,core.forms.components.review.v1.runtime, core.forms.components.turnstile.v1.runtime]"/>
8+
embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v3.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime,core.forms.components.switch.v1.runtime,core.forms.components.termsandconditions.v1.runtime, core.forms.components.hcaptcha.v1.runtime,core.forms.components.review.v1.runtime, core.forms.components.turnstile.v1.runtime,core.forms.components.scribble.v1.runtime]"/>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
3+
jcr:primaryType="sling:Folder"/>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
3+
jcr:primaryType="nt:unstructured">
4+
5+
</jcr:root>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
3+
cq:icon="abc"
4+
jcr:description="Add a field to capture scribble signature."
5+
jcr:primaryType="cq:Component"
6+
jcr:title="Adaptive Form Scribble (v1)"
7+
sling:resourceSuperType="core/fd/components/form/base/v1/base"
8+
componentGroup=".core-adaptiveform"/>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<!--
2+
Copyright 2024 Adobe
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
Adaptive Form Scribble (v1)
17+
====
18+
Adaptive Form Scribble field component written in HTL.
19+
20+
## Features
21+
22+
* Provides the following type of input:
23+
* text
24+
* textarea
25+
* Custom constraint messages for the above types
26+
* Styles
27+
* Allows replacing this component with other component (as mentioned below).
28+
29+
### Use Object
30+
The Form Text component uses the `com.adobe.cq.forms.core.components.models.form.Scribble` Sling Model for its Use-object.
31+
32+
### Edit Dialog Properties
33+
The following properties are written to JCR for this Form Text component and are expected to be available as `Resource` properties:
34+
35+
1. `./jcr:title` - defines the label to use for this field
36+
2. `./hideTitle` - if set to `true`, the label of this field will be hidden
37+
3. `./name` - defines the name of the field, which will be submitted with the form data
38+
4. `./default` - defines the default value of the field
39+
5. `./description` - defines a help message that can be rendered in the field as a hint for the user
40+
6. `./required` - if set to `true`, this field will be marked as required, not allowing the form to be submitted until the field has a value
41+
7. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty
42+
8. `./readOnly` - if set to `true`, the filed will be read only
43+
44+
## Client Libraries
45+
The component provides a `core.forms.components.scribble.v1.runtime` client library category that contains the Javascript runtime for the component.
46+
It should be added to a relevant site client library using the `embed` property.
47+
48+
It also provides a `core.forms.components.scribble.v1.editor` editor client library category that includes
49+
JavaScript handling for dialog interaction. It is already included by its edit dialog.
50+
51+
## BEM Description
52+
```
53+
BLOCK cmp-adaptiveform-scribble
54+
ELEMENT cmp-adaptiveform-scribble__label
55+
ELEMENT cmp-adaptiveform-scribble__label-container
56+
ELEMENT cmp-adaptiveform-scribble__widget
57+
ELEMENT cmp-adaptiveform-scribble__questionmark
58+
ELEMENT cmp-adaptiveform-scribble__shortdescription
59+
ELEMENT cmp-adaptiveform-scribble__longdescription
60+
ELEMENT cmp-adaptiveform-scribble__errormessage
61+
```
62+
63+
### Note
64+
By placing the class names `cmp-adaptiveform-scribble__label` and `cmp-adaptiveform-scribble__questionmark` within the `cmp-adaptiveform-scribble__label-container` class, you create a logical grouping of the label and question mark elements. This approach simplifies the process of maintaining a consistent styling for both elements.
65+
66+
## Replace feature:
67+
We support replace feature that allows replacing Reset Button component to any of the below components:
68+
69+
* Button
70+
* Date Picker
71+
* Email Input
72+
* Number Input
73+
* Reset Button
74+
* Submit Button
75+
* Telephone Input
76+
* Text Box
77+
78+
## JavaScript Data Attribute Bindings
79+
80+
The following attributes must be added for the initialization of the text-input component in the form view:
81+
1. `data-cmp-is="adaptiveFormScribble"`
82+
2. `data-cmp-adaptiveformcontainer-path="${formstructparser.formContainerPath}"`
83+
84+
85+
The following are optional attributes that can be added to the component in the form view:
86+
1. `data-cmp-valid` having a boolean value to indicate whether the field is currently valid or not
87+
2. `data-cmp-required` having a boolean value to indicate whether the field is currently required or not
88+
3. `data-cmp-readonly` having a boolean value to indicate whether the field is currently readonly or not
89+
4. `data-cmp-active` having a boolean value to indicate whether the field is currently active or not
90+
5. `data-cmp-visible` having a boolean value to indicate whether the field is currently visible or not
91+
6. `data-cmp-enabled` having a boolean value to indicate whether the field is currently enabled or not

0 commit comments

Comments
 (0)