Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ private FormConstants() {
/** The resource type for date picker v1 */
public static final String RT_FD_FORM_DATE_PICKER_V1 = RT_FD_FORM_PREFIX + "datepicker/v1/datepicker";

/** The resource type for date picker v2 */
public static final String RT_FD_FORM_DATE_PICKER_V2 = RT_FD_FORM_PREFIX + "datepicker/v2/datepicker";

/** The resource type for number input v1 */
public static final String RT_FD_FORM_NUMBER_INPUT_V1 = RT_FD_FORM_PREFIX + "numberinput/v1/numberinput";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = { DatePicker.class,
ComponentExporter.class },
resourceType = { FormConstants.RT_FD_FORM_DATE_PICKER_V1 })
resourceType = {
FormConstants.RT_FD_FORM_DATE_PICKER_V1,
FormConstants.RT_FD_FORM_DATE_PICKER_V2
})
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class DatePickerImpl extends AbstractFieldImpl implements DatePicker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
cssProcessor="[default:none,min:none]"
jsProcessor="[default:none,min:none]"
categories="[core.forms.components.it.runtime.all]"
embed="[core.forms.components.runtime.base,core.forms.components.it.container.v1.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.v2.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.it.textinput.v1.runtime, core.forms.components.hcaptcha.v1.runtime, core.forms.components.turnstile.v1.runtime]"/>
embed="[core.forms.components.runtime.base,core.forms.components.it.container.v1.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.datePicker.v2.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.v2.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.it.textinput.v1.runtime, core.forms.components.hcaptcha.v1.runtime, core.forms.components.turnstile.v1.runtime]"/>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
"FileNameInvalid" : "Do not attach files where filename starts with (.), contains \\ / : * ? \" < > | ; % $, or is a reserved keyword like nul, prn, con, lpt, or com.",
"FileMimeTypeInvalid" : "File(s) ${0} are unsupported file types",
"InternalFormSubmissionError" : "Encountered an internal error while submitting the form.",
"previousMonth" : "Previous month",
"nextMonth" : "Next month",
"previousYear" : "Previous year",
"nextYear" : "Next year",
"previousSetOfYears" : "Previous set of years",
"nextSetOfYears" : "Next set of years",
"FileSizeZero" : "The uploaded file(s) ${0} are empty. Make sure you're uploading file(s) with content.",
"type" : "Please enter a valid value.",
"required" : "Please fill in this field.",
Expand All @@ -22,6 +28,7 @@
"accept" : "The specified file type not supported.",
"defaultError" : "There is an error in the field",
"clearText" : "Clear",
"openCalendarText" : "Open calendar",
"calendarSymbols" : {
"monthNames" : ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
"abbrmonthNames" : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ if (typeof window.DatePickerWidget === 'undefined') {
'<div class="dp-caption"></div>' +
'<div class="dp-rightnav"></div>' +
'</div>' +
'<div class="view dp-monthview"></div>' +
'<div class="view dp-yearview"></div>' +
'<div class="view dp-yearsetview"></div>';
'<div class="view dp-monthview" role="grid" aria-labelledby="dp-caption"></div>' +
'<div class="view dp-yearview" role="grid" aria-labelledby="dp-caption"></div>' +
'<div class="view dp-yearsetview" role="grid" aria-labelledby="dp-caption"></div>';

constructor(view, widget, model) {
this.#model = model;
Expand Down Expand Up @@ -232,6 +232,7 @@ if (typeof window.DatePickerWidget === 'undefined') {
}
});
this.caption = this.#dp.getElementsByClassName("dp-caption")[0];
this.caption.id = "dp-caption";
this.caption.addEventListener("click",
function (evnt) {
if (self.view && self.#curInstance) {
Expand Down Expand Up @@ -847,12 +848,14 @@ if (typeof window.DatePickerWidget === 'undefined') {
let rowEl = document.createElement("ul");
rowEl.removeAttribute("aria-label");
rowEl.classList.toggle("header", isHeader);
rowEl.setAttribute("role", "row");
$row = $view.appendChild(rowEl);
}
items = $row.getElementsByTagName("li").length;
while (items++ < rowArray.length) {
let listItemEl = document.createElement("li");
listItemEl.id = "li-" + elementAt(rowNum, items).gridId;
listItemEl.setAttribute("role", isHeader ? "columnheader" : "gridcell");
$tmp = $row.appendChild(listItemEl);
if (!isHeader) {
let cb = function (evnt) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?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"
jcr:primaryType="nt:unstructured">
<datepicker/>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
cq:icon="date"
jcr:description="Add a field with a calendar widget to select a date."
jcr:primaryType="cq:Component"
jcr:title="Adaptive Form Date Picker (v2)"
sling:resourceSuperType="core/fd/components/form/base/v1/base"
componentGroup=".core-adaptiveform"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!--
Copyright 2025 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.
-->
Adaptive Form Date Picker (v2)
====
Adaptive Form Date Picker field component written in HTL.

## Features

* Provides the following type of input:
* date
* Allows replacing this component with other component (as mentioned below).

### Use Object
The Form Date Picker component uses the `com.adobe.cq.forms.core.components.models.form.DatePicker` Sling Model for its Use-object.

### Edit Dialog Properties
The following properties are written to JCR for this Form Date component and are expected to be available as `Resource` properties:

1. `./jcr:title` - defines the label to use for this field
2. `./hideTitle` - if set to `true`, the label of this field will be hidden
3. `./name` - defines the name of the field, which will be submitted with the form data
4. `./default` - defines the default value of the field
5. `./description` - defines a help message that can be rendered in the field as a hint for the user
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
7. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty
8. `./readOnly` - if set to `true`, the filed will be read only
9. `./dataFormat` - defines the format in which the value exported/submitted
10. `./editFormat` - defines the format in which the value will be edited by the user
11. `./minimumDate` - define the minimum date input allowed for the field
12. `./maximumDate` - define the maximum date input allowed for the field
13. `./displayFormat` - define the template for display pattern (Reference can be found [here](https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns)).

## Client Libraries
The component provides a `core.forms.components.datePicker.v2.runtime` client library category that contains the Javascript runtime for the component.
It should be added to a relevant site client library using the `embed` property.

## BEM Description
```
BLOCK cmp-adaptiveform-datepicker
ELEMENT cmp-adaptiveform-datepicker__label
ELEMENT cmp-adaptiveform-datepicker__label-container
ELEMENT cmp-adaptiveform-datepicker__widget
ELEMENT cmp-adaptiveform-datepicker__questionmark
ELEMENT cmp-adaptiveform-datepicker__shortdescription
ELEMENT cmp-adaptiveform-datepicker__longdescription
ELEMENT cmp-adaptiveform-datepicker__errormessage
```

### Note
By placing the class names `cmp-adaptiveform-datepicker__label` and `cmp-adaptiveform-datepicker__questionmark` within the `cmp-adaptiveform-datepicker__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.

## JavaScript Data Attribute Bindings

The following attributes must be added for the initialization of the date-picker component in the form view:
1. `data-cmp-is="adaptiveFormDatePicker"`
2. `data-cmp-adaptiveformcontainer-path="${formstructparser.formContainerPath}"`


The following are optional attributes that can be added to the component in the form view:
1. `data-cmp-valid` having a boolean value to indicate whether the field is currently valid or not
2. `data-cmp-required` having a boolean value to indicate whether the field is currently required or not
3. `data-cmp-readonly` having a boolean value to indicate whether the field is currently readonly or not
4. `data-cmp-active` having a boolean value to indicate whether the field is currently active or not
5. `data-cmp-visible` having a boolean value to indicate whether the field is currently visible or not
6. `data-cmp-enabled` having a boolean value to indicate whether the field is currently enabled or not

## Replace feature:
We support replace feature that allows replacing Reset Button component to any of the below components:

* Button
* Email Input
* Number Input
* Reset Button
* Submit Button
* Telephone Input
* Text Box
* Text Input


## Information
* **Vendor**: Adobe
* **Version**: v2
* **Compatibility**: Cloud
* **Status**: production-ready



Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Folder"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
allowProxy="{Boolean}true"
categories="[core.forms.components.datePicker.v2.runtime]"
dependencies="[core.forms.components.runtime.base]"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
###############################################################################
# Copyright 2025 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.
###############################################################################

#base=css
datepickerview.css
datepickerwidget.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright 2025 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.
******************************************************************************/
.cmp-adaptiveform-datepicker {

}

.cmp-adaptiveform-datepicker__widget {

}

.cmp-adaptiveform-datepicker__label {

}
.cmp-adaptiveform-datepicker__label-container{

}

.cmp-adaptiveform-datepicker__longdescription {

}

.cmp-adaptiveform-datepicker__shortdescription {

}

.cmp-adaptiveform-datepicker__questionmark {

}

.cmp-adaptiveform-datepicker__questionmark {

}
Loading
Loading