@refinitiv-ui/elements 7.10.6 → 7.10.7

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,6 +3,12 @@
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
+ ## [7.10.7](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.10.6...@refinitiv-ui/elements@7.10.7) (2024-03-12)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **datetime-picker:** validate values for weekendsonly and weekdaysonly ([#1117](https://github.com/Refinitiv/refinitiv-ui/issues/1117)) ([0898814](https://github.com/Refinitiv/refinitiv-ui/commit/089881482effc70cf9e2b47f3148b44140ce37a2))
11
+
6
12
  ## [7.10.6](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.10.5...@refinitiv-ui/elements@7.10.6) (2024-02-27)
7
13
 
8
14
  **Note:** Version bump only for package @refinitiv-ui/elements
@@ -427,6 +427,11 @@ export declare class DatetimePicker extends FormFieldElement implements MultiVal
427
427
  * @returns true if `from` is before or the same as `to`
428
428
  */
429
429
  private isFromBeforeTo;
430
+ /**
431
+ * Check if `values` correspond to dates that are allowed within the conditions of weekdays or weekends
432
+ * @returns false if `values` don't correspond to dates that are allowed within the conditions of weekdays or weekends.
433
+ */
434
+ private isValidDay;
430
435
  /**
431
436
  * Check if datetime picker has an error
432
437
  * @returns true if error
@@ -8,7 +8,7 @@ import { property } from '@refinitiv-ui/core/decorators/property.js';
8
8
  import { query } from '@refinitiv-ui/core/decorators/query.js';
9
9
  import '@refinitiv-ui/phrasebook/locale/en/datetime-picker.js';
10
10
  import { TranslatePropertyKey, getLocale, translate } from '@refinitiv-ui/translate';
11
- import { DateFormat, DateTimeFormat, addMonths, format, isAfter, isBefore, isValidDate, isValidDateTime, parse, subMonths } from '@refinitiv-ui/utils/date.js';
11
+ import { DateFormat, DateTimeFormat, addMonths, format, isAfter, isBefore, isValidDate, isValidDateTime, isWeekend, parse, subMonths } from '@refinitiv-ui/utils/date.js';
12
12
  import '../calendar/index.js';
13
13
  import '../icon/index.js';
14
14
  import '../overlay/index.js';
@@ -442,7 +442,9 @@ let DatetimePicker = class DatetimePicker extends FormFieldElement {
442
442
  if ((changedProperties.has('_values') && changedProperties.get('_values') !== undefined) ||
443
443
  (changedProperties.has('min') && changedProperties.get('min') !== undefined) ||
444
444
  (changedProperties.has('max') && changedProperties.get('max') !== undefined) ||
445
- (changedProperties.has('showSeconds') && changedProperties.get('showSeconds') !== undefined)) {
445
+ (changedProperties.has('showSeconds') && changedProperties.get('showSeconds') !== undefined) ||
446
+ (changedProperties.has('weekdaysOnly') && changedProperties.get('weekdaysOnly') !== undefined) ||
447
+ (changedProperties.has('weekendsOnly') && changedProperties.get('weekendsOnly') !== undefined)) {
446
448
  return true;
447
449
  }
448
450
  return false;
@@ -893,12 +895,30 @@ let DatetimePicker = class DatetimePicker extends FormFieldElement {
893
895
  }
894
896
  return true;
895
897
  }
898
+ /**
899
+ * Check if `values` correspond to dates that are allowed within the conditions of weekdays or weekends
900
+ * @returns false if `values` don't correspond to dates that are allowed within the conditions of weekdays or weekends.
901
+ */
902
+ isValidDay() {
903
+ for (const value of this.values) {
904
+ if (this.weekdaysOnly && isWeekend(value)) {
905
+ return false;
906
+ }
907
+ if (this.weekendsOnly && !isWeekend(value)) {
908
+ return false;
909
+ }
910
+ }
911
+ return true;
912
+ }
896
913
  /**
897
914
  * Check if datetime picker has an error
898
915
  * @returns true if error
899
916
  */
900
917
  hasError() {
901
- return !(this.isValidFormat() && this.isValueWithinMinMax() && this.isFromBeforeTo());
918
+ return !(this.isValidFormat() &&
919
+ this.isValueWithinMinMax() &&
920
+ this.isFromBeforeTo() &&
921
+ this.isValidDay());
902
922
  }
903
923
  /**
904
924
  * Toggles the opened state of the list
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.10.6';
1
+ export const VERSION = '7.10.7';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "7.10.6",
3
+ "version": "7.10.7",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "LSEG",
6
6
  "license": "Apache-2.0",
@@ -344,7 +344,7 @@
344
344
  "@lit-labs/context": "^0.3.1",
345
345
  "@refinitiv-ui/halo-theme": "^7.3.5",
346
346
  "@refinitiv-ui/solar-theme": "^7.2.6",
347
- "chart.js": "^4.3.0",
347
+ "chart.js": "^4.4.2",
348
348
  "chartjs-adapter-date-fns": "^3.0.0",
349
349
  "d3-interpolate": "^3.0.1",
350
350
  "date-fns": "^2.29.3",
@@ -373,5 +373,5 @@
373
373
  "publishConfig": {
374
374
  "access": "public"
375
375
  },
376
- "gitHead": "117edaaf144ec73b9e45ab5b03c90d67100d13b2"
376
+ "gitHead": "95774e711a8ad9898e4cb12aa97e050622d593ac"
377
377
  }