Skip to content

Commit 9e45e75

Browse files
Merge pull request #1166 from adobe/devToMaster4April
Dev to master4 april
2 parents 404540d + 11f662b commit 9e45e75

File tree

10 files changed

+165
-10
lines changed

10 files changed

+165
-10
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"FileCloseAccessText" : "اضغط على Enter لحذف الملف",
3+
"FileSizeGreater" : "حجم الملفات (${0}) أكبر من الحجم المتوقع: ${1} ميجابايت.",
4+
"FileNameInvalid" : "لا تقم بإرفاق ملفات يبدأ اسم الملف بـ (.)، أو يحتوي على \\ / : * ? \" < > | ; % $، أو هو كلمة محجوزة مثل nul، prn، con، lpt، أو com.",
5+
"FileMimeTypeInvalid" : "أنواع الملفات (${0}) غير مدعومة",
6+
"InternalFormSubmissionError" : "حدث خطأ داخلي أثناء تقديم النموذج.",
7+
"electronicSignature" : "التوقيع الإلكتروني",
8+
"readOnlyMessage" : "قراءة فقط",
9+
"thankYouMessage" : "شكرًا لتقديم النموذج",
10+
"type" : "الرجاء إدخال قيمة صالحة.",
11+
"required" : "الرجاء ملء هذا الحقل.",
12+
"minimum" : "يجب أن تكون القيمة أكبر من أو تساوي ${0}.",
13+
"maximum" : "يجب أن تكون القيمة أقل من أو تساوي ${0}.",
14+
"minLength" : "الرجاء تمديد هذا النص إلى ${0} أحرف أو أكثر.",
15+
"maxLength" : "الرجاء تقصير هذا النص إلى ${0} حرفًا أو أقل.",
16+
"step" : "الرجاء إدخال قيمة صالحة.",
17+
"format" : "حدد القيمة بالتنسيق المسموح به: ${0}.",
18+
"pattern" : "الرجاء مطابقة الشكل المطلوب.",
19+
"minItems" : "حدد عدد العناصر مساويًا أو أكبر من ${0}.",
20+
"maxItems" : "حدد عدد العناصر مساويًا أو أقل من ${0}.",
21+
"uniqueItems" : "يجب أن تكون جميع العناصر فريدة.",
22+
"validationExpression" : "الرجاء إدخال قيمة صالحة.",
23+
"maxFileSize" : "حجم الملف كبير جدًا. يرجى تقليل الحجم والمحاولة مرة أخرى.",
24+
"accept" : "النوع المحدد للملف غير مدعوم.",
25+
"defaultError" : "هناك خطأ في الحقل",
26+
"clearText" : "مسح",
27+
"calendarSymbols" : {
28+
"monthNames" : ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"],
29+
"abbrmonthNames" : ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"],
30+
"dayNames" : ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"],
31+
"abbrdayNames" : ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"],
32+
"meridiemNames" : ["ص", "م"],
33+
"eraNames" : ["ق.م", "م"],
34+
"day": "يوم",
35+
"days": "أيام",
36+
"month": "شهر",
37+
"months": "أشهر",
38+
"year": "سنة",
39+
"years": "سنوات",
40+
"more": "أكثر",
41+
"less": "أقل"
42+
}
43+
}

it/config/src/main/content/jcr_root/apps/system/config/Guide Localization Service.cfg.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"es",
1313
"ru-ru",
1414
"hi",
15-
"th"
15+
"th",
16+
"fa"
1617
]
1718
}

it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/af2-form-translation/.content.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<ru-ru/>
2222
<hi/>
2323
<th/>
24+
<fa/>
2425
</dictionary>
2526
<metadata
2627
fd:version="2.1"

it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic/.content.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:dam="http://www.day.com/dam/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
33
jcr:primaryType="dam:Asset">
44
<jcr:content
5-
jcr:lastModified="{Date}2023-01-20T15:28:03.292+05:30"
5+
jcr:lastModified="{Date}2024-04-03T17:09:20.123+05:30"
66
jcr:primaryType="dam:AssetContent"
77
sling:resourceType="fd/fm/af/render"
88
guide="1"
99
type="guide">
1010
<metadata
1111
fd:version="2.1"
12-
themeRef="/libs/fd/af/themes/canvas"
1312
jcr:primaryType="nt:unstructured"
1413
allowedRenderFormat="HTML"
1514
author="admin"
1615
availableInMobileApp="{Boolean}false"
16+
dorTemplateChanged="Boolean"
1717
dorType="none"
1818
formmodel="none"
1919
hasCustomThumbnail="{Boolean}false"
20+
themeRef="/libs/fd/af/themes/canvas"
2021
title="Adaptive Form V2 (IT)"/>
2122
</jcr:content>
2223
</jcr:root>

it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/datepicker/basic/.content.xml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
jcr:primaryType="cq:Page">
44
<jcr:content
55
cq:deviceGroups="[mobile/groups/responsive]"
6-
cq:lastModified="{Date}2024-03-18T15:08:02.397+05:30"
6+
cq:lastModified="{Date}2024-04-03T17:09:19.976+05:30"
77
cq:lastModifiedBy="admin"
88
cq:template="/conf/core-components-examples/settings/wcm/templates/af-blank-v2"
99
jcr:language="en"
@@ -17,13 +17,14 @@
1717
jcr:lastModifiedBy="admin"
1818
jcr:primaryType="nt:unstructured"
1919
sling:resourceType="forms-components-examples/components/form/container"
20-
themeRef="/libs/fd/af/themes/canvas"
2120
clientLibRef="corecomponent.it.customfunction"
21+
dorType="none"
2222
fieldType="form"
2323
schemaType="none"
2424
textIsRich="true"
2525
thankYouMessage="Thank you for submitting the form."
26-
thankYouOption="page">
26+
thankYouOption="page"
27+
themeRef="/libs/fd/af/themes/canvas">
2728
<dateinput1
2829
jcr:primaryType="nt:unstructured"
2930
jcr:title="Date Input 1"
@@ -103,7 +104,7 @@
103104
<datepicker
104105
jcr:created="{Date}2023-08-10T15:45:30.311+05:30"
105106
jcr:createdBy="admin"
106-
jcr:lastModified="{Date}2023-08-10T15:47:00.344+05:30"
107+
jcr:lastModified="{Date}2024-04-03T17:07:16.009+05:30"
107108
jcr:lastModifiedBy="admin"
108109
jcr:primaryType="nt:unstructured"
109110
jcr:title="Date Picker with edit and display formats"
@@ -114,6 +115,7 @@
114115
editPatternType="d/M/y"
115116
enabled="{Boolean}true"
116117
fieldType="date-input"
118+
formatMessage="Date format expected is d/M/y"
117119
hideTitle="false"
118120
name="datepicker7"
119121
readOnly="{Boolean}false"
@@ -143,6 +145,27 @@
143145
validationStatus="valid"/>
144146
<fd:events jcr:primaryType="nt:unstructured"/>
145147
</datepicker_1911670949>
148+
<datepicker_269513547
149+
jcr:created="{Date}2024-04-04T09:54:04.561+05:30"
150+
jcr:createdBy="admin"
151+
jcr:lastModified="{Date}2024-04-04T10:01:04.574+05:30"
152+
jcr:lastModifiedBy="admin"
153+
jcr:primaryType="nt:unstructured"
154+
jcr:title="Date Input with fixed date"
155+
sling:resourceType="forms-components-examples/components/form/datepicker"
156+
default="2024-03-01"
157+
displayFormat="MMMM d, y"
158+
displayPatternType="MMMM d, y"
159+
editFormat="MMMM d, y"
160+
editPatternType="MMMM d, y"
161+
enabled="{Boolean}true"
162+
fieldType="date-input"
163+
hideTitle="false"
164+
name="datepicker_2695135471712204644671"
165+
readOnly="{Boolean}false"
166+
textIsRich="[true,true,true]"
167+
unboundFormElement="{Boolean}false"
168+
visible="{Boolean}true"/>
146169
</guideContainer>
147170
</jcr:content>
148171
</jcr:root>

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/_cq_dialog/.content.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@
215215
fieldLabel="Edit Format"
216216
name="./editFormat">
217217
</editFormat>
218+
<formatMessage
219+
jcr:primaryType="nt:unstructured"
220+
sling:resourceType="granite/ui/components/coral/foundation/form/textarea"
221+
fieldDescription="Error message shown when the date format is incorrect."
222+
granite:class="cmp-adaptiveform-datepicker__formatmessage"
223+
fieldLabel="Format error message"
224+
name="./formatMessage"/>
218225
</items>
219226
</editPatternGroup>
220227
</items>

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/clientlibs/site/js/datepickerwidget.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,13 +728,24 @@ if (typeof window.DatePickerWidget === 'undefined') {
728728
}
729729

730730
#getLocalizedYear(date) {
731+
/*
732+
// Only Thai language return year according to Buddhist calendar, rest all languages follows gregorian calendar in practice.
733+
// The Buddhist Year in 2024 = 543 + 2024 = B.E. 2567 (reference https://wesak.org.my/calculating-b-e/)
734+
// Intl.DateTimeFormat#formatToParts returns number (2024) for all languages except for Thai (2567) & for Persian ('۱۴۰۳')
735+
// For Persian ('۱۴۰۳'), returned year is not in numbers that is breaking next flow.
736+
*/
737+
if(this.#lang === 'th') {
731738
const dateFormat = new Intl.DateTimeFormat(this.#lang, {
732-
year: 'numeric'
739+
year: 'numeric'
733740
});
734741
const dateParts = dateFormat.formatToParts(date);
735742
const yearObject = dateParts.find(yearObject => yearObject.type === "year");
736743
const localizedYear = yearObject.value;
737744
return Number(localizedYear);
745+
}
746+
else {
747+
return Number(date.getFullYear());
748+
}
738749
}
739750

740751
/*

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/dropdown/v1/dropdown/clientlibs/site/js/dropdownview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@
117117
}
118118
let isMultiSelect = this._model.isArrayType();
119119
[...this.widget].forEach((option) => {
120+
// clear of any selection, and re-add selection (otherwise HTML shows stale state if it already existed)
121+
option.removeAttribute('selected');
120122
if(this.#checkIfEqual(value, option.value, isMultiSelect)) {
121123
option.setAttribute('selected', 'selected');
122-
} else {
123-
option.removeAttribute('selected');
124124
}
125125
});
126126
super.updateEmptyStatus();
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
describe("Form Runtime with Date Picker", () => {
17+
18+
const pagePath = "content/forms/af/core-components-it/samples/datepicker/basic.html"
19+
const bemBlock = 'cmp-adaptiveform-datepicker'
20+
21+
let formContainer = null
22+
const fmPropertiesUI = "/libs/fd/fm/gui/content/forms/formmetadataeditor.html/content/dam/formsanddocuments/core-components-it/samples/datepicker/basic"
23+
const themeRef = 'input[name="./jcr:content/metadata/themeRef"]'
24+
const propertiesSaveBtn = '#shell-propertiespage-doneactivator'
25+
// enabling theme for this test case as without theme there is a bug in custom widget css
26+
before(() => {
27+
cy.openPage(fmPropertiesUI).then(() => {
28+
cy.get(themeRef).should('be.visible').clear().type('/libs/fd/af/themes/canvas').then(() => {
29+
cy.get(propertiesSaveBtn).click();
30+
})
31+
})
32+
})
33+
34+
beforeEach(() => {
35+
cy.previewForm(pagePath, {"params" : ["afAcceptLang=fa"]}).then(p => {
36+
formContainer = p;
37+
})
38+
});
39+
40+
// Year should be in Buddhist calendar year for Thai language
41+
it("Test localisation for date picker for Persian", () => {
42+
const [datePicker8, datePicker7FieldView] = Object.entries(formContainer._fields)[8];
43+
cy.get(`#${datePicker8}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => {
44+
let todayDate = new Date();
45+
cy.get(".dp-caption").invoke("text").should("eq", "مارس, 2024");
46+
cy.get(".dp-caption").click();
47+
cy.get(".dp-caption").invoke("text").should("eq", '2024');
48+
cy.get(".dp-rightnav").click();
49+
});
50+
});
51+
52+
53+
54+
55+
56+
})

ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,16 @@ describe("Form Runtime with Date Picker", () => {
256256
}
257257
});
258258

259+
it.only("Test custom error message when incorrect date format is entered", () => {
260+
const [datePicker7, datePicker7FieldView] = Object.entries(formContainer._fields)[6];
261+
const incorrectInputs = ["adfasdfa", "29/2/2023", "32/1/2023", "1/32/23", "1-1-2023"];
262+
incorrectInputs.forEach(incorrectInput => {
263+
cy.get(`#${datePicker7}`).find("input").should('have.attr',"type", "text");
264+
cy.get(`#${datePicker7}`).find("input").clear().wait(1000).type(incorrectInput).trigger('input').blur()
265+
.then(x => {
266+
cy.get(`#${datePicker7}`).find("input").should('have.value', incorrectInput); // Check if the input is the same
267+
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__errormessage").should('have.text',"Date format expected is d/M/y")
268+
});
269+
});
270+
});
259271
})

0 commit comments

Comments
 (0)