@ui5/webcomponents-localization 1.14.2 → 1.15.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.14.2](https://github.com/SAP/ui5-webcomponents/compare/v1.14.1...v1.14.2) (2023-06-12)
6
+ # [1.15.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.0...v1.15.0-rc.1) (2023-06-15)
7
7
 
8
8
  **Note:** Version bump only for package @ui5/webcomponents-localization
9
9
 
@@ -11,9 +11,16 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [1.14.1](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0...v1.14.1) (2023-06-08)
15
14
 
16
- **Note:** Version bump only for package @ui5/webcomponents-localization
15
+
16
+
17
+
18
+ # [1.15.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0...v1.15.0-rc.0) (2023-06-08)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **ui5-calendar:** prevent focus loss during arrow navigation with mouse/touch ([#6957](https://github.com/SAP/ui5-webcomponents/issues/6957)) ([216f6a7](https://github.com/SAP/ui5-webcomponents/commit/216f6a7a476d18a0f6fdf7ff189f953085e30b47))
17
24
 
18
25
 
19
26
 
@@ -6,8 +6,9 @@ import CalendarDate from "./CalendarDate.js";
6
6
  * @param date CalendarDate instance
7
7
  * @param amount how many days/months/years to add (can be a negative number)
8
8
  * @param unit what to modify: "day", "month" or "year"
9
+ * @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April)
9
10
  * @param minDate minimum date to enforce
10
11
  * @param maxDate maximum date to enforce
11
12
  */
12
- declare const modifyDateBy: (date: CalendarDate, amount: number, unit: string, minDate?: CalendarDate, maxDate?: CalendarDate) => CalendarDate;
13
+ declare const modifyDateBy: (date: CalendarDate, amount: number, unit: string, preserveDate?: boolean, minDate?: CalendarDate, maxDate?: CalendarDate) => CalendarDate;
13
14
  export default modifyDateBy;
@@ -6,32 +6,47 @@ import CalendarDate from "./CalendarDate.js";
6
6
  * @param date CalendarDate instance
7
7
  * @param amount how many days/months/years to add (can be a negative number)
8
8
  * @param unit what to modify: "day", "month" or "year"
9
+ * @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April)
9
10
  * @param minDate minimum date to enforce
10
11
  * @param maxDate maximum date to enforce
11
12
  */
12
- const modifyDateBy = (date, amount, unit, minDate, maxDate) => {
13
+ const modifyDateBy = (date, amount, unit, preserveDate = true, minDate, maxDate) => {
13
14
  const newDate = new CalendarDate(date);
14
- if (unit === "day") {
15
- newDate.setDate(date.getDate() + amount);
15
+ switch (unit) {
16
+ case "day":
17
+ newDate.setDate(date.getDate() + amount);
18
+ break;
19
+ case "month":
20
+ if (preserveDate) {
21
+ newDate.setMonth(date.getMonth() + amount);
22
+ const stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month
23
+ const monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month
24
+ if (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios
25
+ newDate.setDate(0);
26
+ }
27
+ }
28
+ else {
29
+ if (amount === 1) {
30
+ newDate.setMonth(newDate.getMonth() + 1, 1);
31
+ }
32
+ if (amount === -1) {
33
+ newDate.setDate(0);
34
+ }
35
+ }
36
+ break;
37
+ case "year":
38
+ newDate.setYear(date.getYear() + amount);
39
+ if (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year
40
+ newDate.setDate(0); // Select the last day of the month
41
+ }
42
+ break;
43
+ default:
44
+ break;
16
45
  }
17
- else if (unit === "month") {
18
- newDate.setMonth(date.getMonth() + amount);
19
- const stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month
20
- const monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month
21
- if (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios
22
- newDate.setDate(0);
23
- }
24
- }
25
- else {
26
- newDate.setYear(date.getYear() + amount);
27
- if (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year
28
- newDate.setDate(0); // Select the last day of the month
29
- }
30
- }
31
- if (minDate && newDate.valueOf() < minDate.valueOf()) {
46
+ if (minDate && newDate.isBefore(minDate)) {
32
47
  return new CalendarDate(minDate);
33
48
  }
34
- if (maxDate && newDate.valueOf() > maxDate.valueOf()) {
49
+ if (maxDate && newDate.isAfter(maxDate)) {
35
50
  return new CalendarDate(maxDate);
36
51
  }
37
52
  return newDate;
@@ -1 +1 @@
1
- {"version":3,"file":"modifyDateBy.js","sourceRoot":"","sources":["../../src/dates/modifyDateBy.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,MAAc,EAAE,IAAY,EAAE,OAAsB,EAAE,OAAsB,EAAE,EAAE;IACzH,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,IAAI,KAAK,KAAK,EAAE;QACnB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;KACzC;SAAM,IAAI,IAAI,KAAK,OAAO,EAAE;QAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;QAC3C,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,yCAAyC;QACzH,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,sCAAsC;QACrH,IAAI,cAAc,IAAI,YAAY,EAAE,EAAE,+DAA+D;YACpG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACnB;KACD;SAAM;QACN,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;QACzC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,kCAAkC;YAC/E,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC;SACvD;KACD;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE;QACrD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE;QACrD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import CalendarDate from \"./CalendarDate.js\";\n\n/**\n * Adds or subtracts a given amount of days/months/years from a date.\n * If minDate or maxDate are given, the result will be enforced within these limits\n *\n * @param date CalendarDate instance\n * @param amount how many days/months/years to add (can be a negative number)\n * @param unit what to modify: \"day\", \"month\" or \"year\"\n * @param minDate minimum date to enforce\n * @param maxDate maximum date to enforce\n */\nconst modifyDateBy = (date: CalendarDate, amount: number, unit: string, minDate?: CalendarDate, maxDate?: CalendarDate) => {\n\tconst newDate = new CalendarDate(date);\n\tif (unit === \"day\") {\n\t\tnewDate.setDate(date.getDate() + amount);\n\t} else if (unit === \"month\") {\n\t\tnewDate.setMonth(date.getMonth() + amount);\n\t\tconst stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month\n\t\tconst monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month\n\t\tif (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios\n\t\t\tnewDate.setDate(0);\n\t\t}\n\t} else {\n\t\tnewDate.setYear(date.getYear() + amount);\n\t\tif (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year\n\t\t\tnewDate.setDate(0); // Select the last day of the month\n\t\t}\n\t}\n\n\tif (minDate && newDate.valueOf() < minDate.valueOf()) {\n\t\treturn new CalendarDate(minDate);\n\t}\n\n\tif (maxDate && newDate.valueOf() > maxDate.valueOf()) {\n\t\treturn new CalendarDate(maxDate);\n\t}\n\n\treturn newDate;\n};\n\nexport default modifyDateBy;\n"]}
1
+ {"version":3,"file":"modifyDateBy.js","sourceRoot":"","sources":["../../src/dates/modifyDateBy.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,MAAc,EAAE,IAAY,EAAE,YAAY,GAAG,IAAI,EAAE,OAAsB,EAAE,OAAsB,EAAE,EAAE;IAC9I,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAEvC,QAAQ,IAAI,EAAE;QACd,KAAK,KAAK;YACT,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;YACzC,MAAM;QACP,KAAK,OAAO;YACX,IAAI,YAAY,EAAE;gBACjB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;gBAC3C,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,yCAAyC;gBACzH,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,sCAAsC;gBACrH,IAAI,cAAc,IAAI,YAAY,EAAE,EAAE,+DAA+D;oBACpG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACnB;aACD;iBAAM;gBACN,IAAI,MAAM,KAAK,CAAC,EAAE;oBACjB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;iBAC5C;gBACD,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE;oBAClB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACnB;aACD;YACD,MAAM;QACP,KAAK,MAAM;YACV,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;YACzC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,kCAAkC;gBAC/E,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC;aACvD;YACD,MAAM;QACP;YACC,MAAM;KACN;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACzC,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACxC,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import CalendarDate from \"./CalendarDate.js\";\n\n/**\n * Adds or subtracts a given amount of days/months/years from a date.\n * If minDate or maxDate are given, the result will be enforced within these limits\n *\n * @param date CalendarDate instance\n * @param amount how many days/months/years to add (can be a negative number)\n * @param unit what to modify: \"day\", \"month\" or \"year\"\n * @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April)\n * @param minDate minimum date to enforce\n * @param maxDate maximum date to enforce\n */\nconst modifyDateBy = (date: CalendarDate, amount: number, unit: string, preserveDate = true, minDate?: CalendarDate, maxDate?: CalendarDate) => {\n\tconst newDate = new CalendarDate(date);\n\n\tswitch (unit) {\n\tcase \"day\":\n\t\tnewDate.setDate(date.getDate() + amount);\n\t\tbreak;\n\tcase \"month\":\n\t\tif (preserveDate) {\n\t\t\tnewDate.setMonth(date.getMonth() + amount);\n\t\t\tconst stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month\n\t\t\tconst monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month\n\t\t\tif (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios\n\t\t\t\tnewDate.setDate(0);\n\t\t\t}\n\t\t} else {\n\t\t\tif (amount === 1) {\n\t\t\t\tnewDate.setMonth(newDate.getMonth() + 1, 1);\n\t\t\t}\n\t\t\tif (amount === -1) {\n\t\t\t\tnewDate.setDate(0);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase \"year\":\n\t\tnewDate.setYear(date.getYear() + amount);\n\t\tif (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year\n\t\t\tnewDate.setDate(0); // Select the last day of the month\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\n\tif (minDate && newDate.isBefore(minDate)) {\n\t\treturn new CalendarDate(minDate);\n\t}\n\n\tif (maxDate && newDate.isAfter(maxDate)) {\n\t\treturn new CalendarDate(maxDate);\n\t}\n\n\treturn newDate;\n};\n\nexport default modifyDateBy;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-localization",
3
- "version": "1.14.2",
3
+ "version": "1.15.0-rc.1",
4
4
  "description": "Localization for UI5 Web Components",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -29,14 +29,14 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@openui5/sap.ui.core": "1.112.0",
32
- "@ui5/webcomponents-tools": "1.14.1",
32
+ "@ui5/webcomponents-tools": "1.15.0-rc.1",
33
33
  "chromedriver": "113.0.0",
34
34
  "mkdirp": "^1.0.4",
35
35
  "resolve": "^1.20.0"
36
36
  },
37
37
  "dependencies": {
38
38
  "@types/openui5": "^1.113.0",
39
- "@ui5/webcomponents-base": "1.14.2"
39
+ "@ui5/webcomponents-base": "1.15.0-rc.1"
40
40
  },
41
- "gitHead": "0a6f7a35499b83bb94d2fd595e060ff4473c27fc"
41
+ "gitHead": "3f60daa4116acec326076557b25d27b88a464b77"
42
42
  }