@refinitiv-ui/elements 6.10.2 → 6.12.0

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,24 @@
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
+ # [6.12.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.11.0...@refinitiv-ui/elements@6.12.0) (2023-09-18)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **slider:** incorrect updating to value ([#947](https://github.com/Refinitiv/refinitiv-ui/issues/947)) ([f883987](https://github.com/Refinitiv/refinitiv-ui/commit/f883987482cf91c7b6b687c9c67d733bf7a9e4d3))
11
+ - **slider:** number field not revalidate when error state changes ([#953](https://github.com/Refinitiv/refinitiv-ui/issues/953)) ([d4b952e](https://github.com/Refinitiv/refinitiv-ui/commit/d4b952e9d376b0e751584afc6de7a5527dbc11c3))
12
+
13
+ ### Features
14
+
15
+ - **utils:** add `selectedAt` property to `DataItem` interface ([181066b](https://github.com/Refinitiv/refinitiv-ui/commit/181066bad6842f0b06d0607150d3d633bf89f0e7))
16
+
17
+ # [6.11.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.10.2...@refinitiv-ui/elements@6.11.0) (2023-09-11)
18
+
19
+ ### Features
20
+
21
+ - **calendar:** custom cell content ([#930](https://github.com/Refinitiv/refinitiv-ui/issues/930)) ([781b9a8](https://github.com/Refinitiv/refinitiv-ui/commit/781b9a8a8718910a645267efbc4a8a9061ac4aa6))
22
+ - **number-field:** add new event step-up and step-down ([#910](https://github.com/Refinitiv/refinitiv-ui/issues/910)) ([3f42c66](https://github.com/Refinitiv/refinitiv-ui/commit/3f42c66bb1d73c4473d2e7bbfbe9df4295d5f720))
23
+
6
24
  ## [6.10.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.10.1...@refinitiv-ui/elements@6.10.2) (2023-09-04)
7
25
 
8
26
  ### Bug Fixes
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2023, Refinitiv.
1
+ Copyright © 2023, LSEG
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Element Framework
2
2
 
3
- Element Framework (EF) is a collection of elements that includes theming capability within the Refinitiv Workspace's design system. The elements are a set of web components which is a standard web technology and can be utilized across all browsers.
3
+ Element Framework (EF) is a collection of elements that includes theming capability within the LSEG Workspace's design system. The elements are a set of web components which is a standard web technology and can be utilized across all browsers.
4
4
 
5
5
  ## Usage
6
6
 
@@ -10,17 +10,17 @@ EF elements are published under single package.
10
10
  npm install @refinitiv-ui/elements
11
11
  ```
12
12
 
13
- The elements are required theme to instantiate itself in the app. Refinitiv Workspace's design system is called Halo theme and you can install it from npm command.
13
+ The elements are required theme to instantiate itself in the app. LSEG Workspace's design system is called Halo theme and you can install it from npm command.
14
14
 
15
15
  ```sh
16
16
  npm install @refinitiv-ui/halo-theme
17
17
  ```
18
18
 
19
- Finally, import both elements that you want to use and its themes into your application and it is ready to go. To follow Refinitiv Workspace's design system, it is required styles of some native elements e.g. typography.
19
+ Finally, import both elements that you want to use and its themes into your application and it is ready to go. To follow LSEG Workspace's design system, it is required styles of some native elements e.g. typography.
20
20
 
21
21
  <br>
22
22
 
23
- > The font "Proxima Nova Fin" shall only be used within Refinitiv products or services. The copyright owner must approve any use of such font outside of Refinitiv products or services, which may be subject to a fee. Please see https://www.fontspring.com/lic/fontspring/webfont#license_text
23
+ > The font "Proxima Nova Fin" shall only be used within LSEG products or services. The copyright owner must approve any use of such font outside of LSEG products or services, which may be subject to a fee. Please see https://www.fontspring.com/lic/fontspring/webfont#license_text
24
24
 
25
25
  <br>
26
26
 
@@ -57,4 +57,4 @@ See list of elements, demo and more tutorial by visiting [EF Documentation](http
57
57
 
58
58
  # License
59
59
 
60
- Apache License 2.0. However, Halo theme shall only be used within Refinitiv products or services due to license of the font "Proxima Nova Fin".
60
+ Apache License 2.0. However, Halo theme shall only be used within LSEG products or services due to license of the font "Proxima Nova Fin".
@@ -191,6 +191,10 @@
191
191
  }
192
192
  ],
193
193
  "slots": [
194
+ {
195
+ "name": "yyyy-mm-dd",
196
+ "description": "Adds slotted content into the specific date which use value in `ISO8601` date string format as a key e.g. `yyyy-MM-dd`, `yyyy-MM` and `yyyy`"
197
+ },
194
198
  {
195
199
  "name": "footer",
196
200
  "description": "Adds slotted content into the footer of the calendar control"
@@ -30,6 +30,7 @@ Standard calendar element
30
30
 
31
31
  ## Slots
32
32
 
33
- | Name | Description |
34
- |----------|--------------------------------------------------|
35
- | `footer` | Adds slotted content into the footer of the calendar control |
33
+ | Name | Description |
34
+ |--------------|--------------------------------------------------|
35
+ | `footer` | Adds slotted content into the footer of the calendar control |
36
+ | `yyyy-mm-dd` | Adds slotted content into the specific date which use value in `ISO8601` date string format as a key e.g. `yyyy-MM-dd`, `yyyy-MM` and `yyyy` |
@@ -18,6 +18,7 @@ export { CalendarFilter };
18
18
  * @attr {boolean} disabled - Set disabled state
19
19
  * @prop {boolean} [disabled=false] - Set disabled state
20
20
  *
21
+ * @slot yyyy-mm-dd - Adds slotted content into the specific date which use value in `ISO8601` date string format as a key e.g. `yyyy-MM-dd`, `yyyy-MM` and `yyyy`
21
22
  * @slot footer - Adds slotted content into the footer of the calendar control
22
23
  */
23
24
  export declare class Calendar extends ControlElement implements MultiValue {
@@ -288,6 +289,12 @@ export declare class Calendar extends ControlElement implements MultiValue {
288
289
  * @returns {void}
289
290
  */
290
291
  private onKeyDown;
292
+ /**
293
+ * Get cell content from tap event
294
+ * @param event Keyboard event
295
+ * @returns html element
296
+ */
297
+ private getCellContent;
291
298
  /**
292
299
  * Run when tap event happens ot table.
293
300
  * Select the values or switch the view
@@ -28,6 +28,7 @@ import { ViewFormatTranslateParams, formatLocaleDate, monthInfo, monthsNames, we
28
28
  * @attr {boolean} disabled - Set disabled state
29
29
  * @prop {boolean} [disabled=false] - Set disabled state
30
30
  *
31
+ * @slot yyyy-mm-dd - Adds slotted content into the specific date which use value in `ISO8601` date string format as a key e.g. `yyyy-MM-dd`, `yyyy-MM` and `yyyy`
31
32
  * @slot footer - Adds slotted content into the footer of the calendar control
32
33
  */
33
34
  let Calendar = class Calendar extends ControlElement {
@@ -623,6 +624,27 @@ let Calendar = class Calendar extends ControlElement {
623
624
  }
624
625
  event.preventDefault();
625
626
  }
627
+ /**
628
+ * Get cell content from tap event
629
+ * @param event Keyboard event
630
+ * @returns html element
631
+ */
632
+ getCellContent(event) {
633
+ const path = event.composedPath();
634
+ for (let i = 0; i <= path.length; i += 1) {
635
+ const node = path[i];
636
+ if (node === this) {
637
+ return null;
638
+ }
639
+ if (node.nodeType !== Node.ELEMENT_NODE) {
640
+ continue;
641
+ }
642
+ if (node.getAttribute('role') === 'button' && node.part.value.includes('cell-content')) {
643
+ return node;
644
+ }
645
+ }
646
+ return null;
647
+ }
626
648
  /**
627
649
  * Run when tap event happens ot table.
628
650
  * Select the values or switch the view
@@ -633,7 +655,7 @@ let Calendar = class Calendar extends ControlElement {
633
655
  if (event.defaultPrevented) {
634
656
  return;
635
657
  }
636
- const cell = event.target;
658
+ const cell = this.getCellContent(event);
637
659
  if (!cell || !this.isDateButton(cell) || !cell.value) {
638
660
  return;
639
661
  }
@@ -1140,6 +1162,7 @@ let Calendar = class Calendar extends ControlElement {
1140
1162
  const isSelectable = isSelection && !cell.disabled;
1141
1163
  const isSelected = cell.selected ? 'true' : 'false';
1142
1164
  const isActive = cell.active ? 0 : -1;
1165
+ const slotContent = cell.value ? html `<slot name=${cell.value}>${cell.text}</slot>` : cell.text;
1143
1166
  return html `<div
1144
1167
  role="gridcell"
1145
1168
  part="cell ${cell.view}"
@@ -1170,7 +1193,7 @@ let Calendar = class Calendar extends ControlElement {
1170
1193
  .value=${cell.value}
1171
1194
  .index=${cell.index}
1172
1195
  >
1173
- ${cell.text}
1196
+ ${slotContent}
1174
1197
  </div>
1175
1198
  </div>`;
1176
1199
  }
@@ -1,2 +1,2 @@
1
1
  import '@refinitiv-ui/elements/button/themes/halo/dark';
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12px;color:#ccc;min-width:196px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#262626;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#262626}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#333}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#404040}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#999;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#1a1a1a}:host [part~=cell-content]{background:#0d0d0d;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #0d0d0d}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12px;color:#ccc;min-width:196px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#262626;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#262626}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#333}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#404040}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#999;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#1a1a1a}:host [part~=cell-content]{background:#0d0d0d;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #0d0d0d}:host [part~=selection] ::slotted(*){position:absolute}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}' }}));
@@ -1,2 +1,2 @@
1
1
  import '@refinitiv-ui/elements/button/themes/halo/light';
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12px;color:#0d0d0d;min-width:196px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#f2f2f2;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-next]:not(:hover):not(:focus):not(:active),:host [part=btn-prev]:not(:hover):not(:focus):not(:active){color:#595959}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#e6e6e6}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#e6e6e6}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#0d0d0d}:host [part~=cell][today] [part~=selection]{background:#d9d9d9}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#737373;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#fafafa}:host [part~=cell-content]{background:#fff;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #fff}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12px;color:#0d0d0d;min-width:196px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#f2f2f2;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-next]:not(:hover):not(:focus):not(:active),:host [part=btn-prev]:not(:hover):not(:focus):not(:active){color:#595959}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#e6e6e6}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#e6e6e6}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#0d0d0d}:host [part~=cell][today] [part~=selection]{background:#d9d9d9}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#737373;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#fafafa}:host [part~=cell-content]{background:#fff;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #fff}:host [part~=selection] ::slotted(*){position:absolute}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}' }}));
@@ -1,2 +1,2 @@
1
1
  import '@refinitiv-ui/elements/button/themes/solar/charcoal';
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:13px;color:#c2c2c2;min-width:224px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#3c3c42;padding:4px}:host [part=navigation]{padding-bottom:4px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;color:inherit;box-shadow:none;margin-left:15px;padding:0}:host [part=btn-view]:not([focused=visible]){border:none}:host [part=table]{width:100%;box-shadow:0 0 0 1px #000;background:#212124}:host [part~=row]:not(:last-of-type){box-shadow:0 1px 0 0 #0a0a0a}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=selection]{top:1px}:host [part~=cell]:not(:last-of-type){box-shadow:1px 0 0 0 #0a0a0a}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#f93}:host [part~=cell][today] [part~=selection]{background:#3c3c42}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus,:host [part~=cell]:not([selected]):not([range]) [part~=selection]:hover{background:#3c3c42;color:#e2e2e2}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus{outline:#f93 dotted 1px}:host [part~=cell][range] [part~=selection]{background:rgba(255,153,51,.2)}:host [part~=cell][range][today]{color:#f93}:host [part~=cell][selected]{color:#000}:host [part~=cell][selected] [part~=selection]{background:#f93}:host [part~=cell]:not(:first-of-type) [part~=selection]{left:1px}:host [part~=day-name]{background-color:#151516;color:#666570;font-size:10px;font-weight:700}:host [part~=selection]{outline:0;top:0;bottom:0;right:0;left:0}:host([disabled]){opacity:.4}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:13px;color:#c2c2c2;min-width:224px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#3c3c42;padding:4px}:host [part=navigation]{padding-bottom:4px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;color:inherit;box-shadow:none;margin-left:15px;padding:0}:host [part=btn-view]:not([focused=visible]){border:none}:host [part=table]{width:100%;box-shadow:0 0 0 1px #000;background:#212124}:host [part~=row]:not(:last-of-type){box-shadow:0 1px 0 0 #0a0a0a}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=selection]{top:1px}:host [part~=cell]:not(:last-of-type){box-shadow:1px 0 0 0 #0a0a0a}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#f93}:host [part~=cell][today] [part~=selection]{background:#3c3c42}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus,:host [part~=cell]:not([selected]):not([range]) [part~=selection]:hover{background:#3c3c42;color:#e2e2e2}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus{outline:#f93 dotted 1px}:host [part~=cell][range] [part~=selection]{background:rgba(255,153,51,.2)}:host [part~=cell][range][today]{color:#f93}:host [part~=cell][selected]{color:#000}:host [part~=cell][selected] [part~=selection]{background:#f93}:host [part~=cell]:not(:first-of-type) [part~=selection]{left:1px}:host [part~=day-name]{background-color:#151516;color:#666570;font-size:10px;font-weight:700}:host [part~=selection]{outline:0;top:0;bottom:0;right:0;left:0}:host [part~=selection] ::slotted(*){position:absolute}:host([disabled]){opacity:.4}' }}));
@@ -1,2 +1,2 @@
1
1
  import '@refinitiv-ui/elements/button/themes/solar/pearl';
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:13px;color:#484848;min-width:224px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#fff;padding:4px}:host [part=navigation]{padding-bottom:4px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;color:inherit;box-shadow:none;margin-left:15px;padding:0}:host [part=btn-view]:not([focused=visible]){border:none}:host [part=table]{width:100%;box-shadow:0 0 0 1px #a9afba;background:#fff}:host [part~=row]:not(:last-of-type){box-shadow:0 1px 0 0 #d5d8db}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=selection]{top:1px}:host [part~=cell]:not(:last-of-type){box-shadow:1px 0 0 0 #d5d8db}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#acafb5}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus,:host [part~=cell]:not([selected]):not([range]) [part~=selection]:hover{background:#e4e8ed;color:#000}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus{outline:#ee7600 dotted 1px}:host [part~=cell][range] [part~=selection]{background:rgba(255,153,51,.2)}:host [part~=cell][range][today]{color:#f93}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#f93}:host [part~=cell]:not(:first-of-type) [part~=selection]{left:1px}:host [part~=day-name]{background-color:#e4e8ed;color:#6e6e78;font-size:10px;font-weight:700}:host [part~=selection]{outline:0;top:0;bottom:0;right:0;left:0}:host([disabled]){opacity:.4}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-calendar', styles: ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:13px;color:#484848;min-width:224px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#fff;padding:4px}:host [part=navigation]{padding-bottom:4px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;color:inherit;box-shadow:none;margin-left:15px;padding:0}:host [part=btn-view]:not([focused=visible]){border:none}:host [part=table]{width:100%;box-shadow:0 0 0 1px #a9afba;background:#fff}:host [part~=row]:not(:last-of-type){box-shadow:0 1px 0 0 #d5d8db}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=selection]{top:1px}:host [part~=cell]:not(:last-of-type){box-shadow:1px 0 0 0 #d5d8db}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#acafb5}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus,:host [part~=cell]:not([selected]):not([range]) [part~=selection]:hover{background:#e4e8ed;color:#000}:host [part~=cell]:not([selected]):not([range]) [part~=selection]:focus{outline:#ee7600 dotted 1px}:host [part~=cell][range] [part~=selection]{background:rgba(255,153,51,.2)}:host [part~=cell][range][today]{color:#f93}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#f93}:host [part~=cell]:not(:first-of-type) [part~=selection]{left:1px}:host [part~=day-name]{background-color:#e4e8ed;color:#6e6e78;font-size:10px;font-weight:700}:host [part~=selection]{outline:0;top:0;bottom:0;right:0;left:0}:host [part~=selection] ::slotted(*){position:absolute}:host([disabled]){opacity:.4}' }}));
@@ -288,9 +288,11 @@ let ComboBox = class ComboBox extends FormFieldElement {
288
288
  * @returns {void}
289
289
  */
290
290
  updateComposerValues(newValues) {
291
+ const selectedAt = Date.now();
291
292
  this.queryItems((item, composer) => {
292
293
  if (newValues.includes(composer.getItemPropertyValue(item, 'value'))) {
293
294
  composer.setItemPropertyValue(item, 'selected', true);
295
+ composer.setItemPropertyValue(item, 'selectedAt', selectedAt + newValues.indexOf(item.value ?? '')); // Sequential selection
294
296
  return true;
295
297
  }
296
298
  composer.setItemPropertyValue(item, 'selected', false);
@@ -159,6 +159,14 @@
159
159
  "name": "error-changed",
160
160
  "description": "Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically."
161
161
  },
162
+ {
163
+ "name": "step-up",
164
+ "description": "Fired when user acts value up on both pressing arrow up or tapping the spinner up. The event is not triggered if stepUp method is called programmatically."
165
+ },
166
+ {
167
+ "name": "step-down",
168
+ "description": "Fired when user acts value down on both pressing arrow down or tapping the spinner down. The event is not triggered if stepDown method is called programmatically."
169
+ },
162
170
  {
163
171
  "name": "input"
164
172
  }
@@ -34,4 +34,6 @@ Form control element for numbers.
34
34
  |-----------------|--------------------------------------------------|
35
35
  | `error-changed` | Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically. |
36
36
  | `input` | |
37
+ | `step-down` | Fired when user acts value down on both pressing arrow down or tapping the spinner down. The event is not triggered if stepDown method is called programmatically. |
38
+ | `step-up` | Fired when user acts value up on both pressing arrow up or tapping the spinner up. The event is not triggered if stepUp method is called programmatically. |
37
39
  | `value-changed` | Fired when user commits a value change. The event is not triggered if `value` property is changed programmatically. |
@@ -12,6 +12,8 @@ declare enum Direction {
12
12
  *
13
13
  * @fires value-changed - Fired when user commits a value change. The event is not triggered if `value` property is changed programmatically.
14
14
  * @fires error-changed - Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically.
15
+ * @fires step-up - Fired when user acts value up on both pressing arrow up or tapping the spinner up. The event is not triggered if stepUp method is called programmatically.
16
+ * @fires step-down - Fired when user acts value down on both pressing arrow down or tapping the spinner down. The event is not triggered if stepDown method is called programmatically.
15
17
  *
16
18
  * @attr {boolean} disabled - Set disabled state
17
19
  * @prop {boolean} [disabled=false] - Set disabled state
@@ -150,6 +152,12 @@ export declare class NumberField extends FormFieldElement {
150
152
  * @returns {void}
151
153
  */
152
154
  protected onInputKeyDown(event: KeyboardEvent): void;
155
+ /**
156
+ * Trigger step-up or step-down event and return the event is cancelled
157
+ * @param direction Up or Down
158
+ * @returns {boolean} false if cancelled event. And true otherwise.
159
+ */
160
+ private dispatchStepEvent;
153
161
  /**
154
162
  * Run when spinner has been tapped
155
163
  * @param event tap event
@@ -17,6 +17,8 @@ var Direction;
17
17
  *
18
18
  * @fires value-changed - Fired when user commits a value change. The event is not triggered if `value` property is changed programmatically.
19
19
  * @fires error-changed - Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically.
20
+ * @fires step-up - Fired when user acts value up on both pressing arrow up or tapping the spinner up. The event is not triggered if stepUp method is called programmatically.
21
+ * @fires step-down - Fired when user acts value down on both pressing arrow down or tapping the spinner down. The event is not triggered if stepDown method is called programmatically.
20
22
  *
21
23
  * @attr {boolean} disabled - Set disabled state
22
24
  * @prop {boolean} [disabled=false] - Set disabled state
@@ -253,6 +255,17 @@ let NumberField = class NumberField extends FormFieldElement {
253
255
  }
254
256
  event.preventDefault();
255
257
  }
258
+ /**
259
+ * Trigger step-up or step-down event and return the event is cancelled
260
+ * @param direction Up or Down
261
+ * @returns {boolean} false if cancelled event. And true otherwise.
262
+ */
263
+ dispatchStepEvent(direction) {
264
+ const eventName = direction === Direction.Up ? 'step-up' : 'step-down';
265
+ return this.dispatchEvent(new CustomEvent(eventName, {
266
+ cancelable: true
267
+ }));
268
+ }
256
269
  /**
257
270
  * Run when spinner has been tapped
258
271
  * @param event tap event
@@ -276,14 +289,17 @@ let NumberField = class NumberField extends FormFieldElement {
276
289
  * @returns {void}
277
290
  */
278
291
  onApplyStep(direction) {
279
- try {
280
- this.applyStepDirection(direction);
281
- this.dispatchEvent(new InputEvent('input'));
282
- this.setSilentlyValueAndNotify();
283
- }
284
- catch (error) {
285
- // According to specs stepDown/stepUp may fail for some invalid inputs
286
- // do nothing and report nothing in that case
292
+ const event = this.dispatchStepEvent(direction);
293
+ if (event) {
294
+ try {
295
+ this.applyStepDirection(direction);
296
+ this.dispatchEvent(new InputEvent('input'));
297
+ this.setSilentlyValueAndNotify();
298
+ }
299
+ catch (error) {
300
+ // According to specs stepDown/stepUp may fail for some invalid inputs
301
+ // do nothing and report nothing in that case
302
+ }
287
303
  }
288
304
  }
289
305
  /**
@@ -177,7 +177,7 @@
177
177
  },
178
178
  {
179
179
  "name": "input",
180
- "description": "Fired when the user inputs a value by interacting with the slider or updating its input field."
180
+ "description": "Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field."
181
181
  },
182
182
  {
183
183
  "name": "from-input",
@@ -25,7 +25,7 @@ Allows users to make selections from a range of values
25
25
  |-----------------|--------------------------------------------------|
26
26
  | `from-changed` | Fired when the user changes from's value. The event is not triggered if `from` property is changed programmatically. |
27
27
  | `from-input` | Fired when the user inputs from's value by interacting with the slider or updating its input field. |
28
- | `input` | Fired when the user inputs a value by interacting with the slider or updating its input field. |
28
+ | `input` | Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field. |
29
29
  | `to-changed` | Fired when the user changes to's value. The event is not triggered if `to` property is changed programmatically. |
30
30
  | `to-input` | Fired when the user inputs to's value by interacting with the slider or updating its input field. |
31
31
  | `value-changed` | Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically. |
@@ -18,7 +18,7 @@ import '../number-field/index.js';
18
18
  * @fires value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
19
19
  * @fires from-changed - Fired when the user changes from's value. The event is not triggered if `from` property is changed programmatically.
20
20
  * @fires to-changed - Fired when the user changes to's value. The event is not triggered if `to` property is changed programmatically.
21
- * @fires input - Fired when the user inputs a value by interacting with the slider or updating its input field.
21
+ * @fires input - Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field.
22
22
  * @fires from-input - Fired when the user inputs from's value by interacting with the slider or updating its input field.
23
23
  * @fires to-input - Fired when the user inputs to's value by interacting with the slider or updating its input field.
24
24
  */
@@ -341,6 +341,11 @@ export declare class Slider extends ControlElement {
341
341
  * @returns validated to value.
342
342
  */
343
343
  private validateTo;
344
+ /**
345
+ * Validate number field from changed thumb
346
+ * @returns {void}
347
+ */
348
+ private validateNumberField;
344
349
  /**
345
350
  * Calculate the nearest possible step value depending on step interval
346
351
  * @param thumbPosition current thumb position in fraction
@@ -27,7 +27,7 @@ import { clamp, countDecimalPlace, isDecimalNumber, preventDefault } from './uti
27
27
  * @fires value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
28
28
  * @fires from-changed - Fired when the user changes from's value. The event is not triggered if `from` property is changed programmatically.
29
29
  * @fires to-changed - Fired when the user changes to's value. The event is not triggered if `to` property is changed programmatically.
30
- * @fires input - Fired when the user inputs a value by interacting with the slider or updating its input field.
30
+ * @fires input - Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field.
31
31
  * @fires from-input - Fired when the user inputs from's value by interacting with the slider or updating its input field.
32
32
  * @fires to-input - Fired when the user inputs to's value by interacting with the slider or updating its input field.
33
33
  */
@@ -766,6 +766,7 @@ let Slider = class Slider extends ControlElement {
766
766
  this.valuePreviousInput = this.value;
767
767
  }
768
768
  this.onDrag(event);
769
+ this.validateNumberField();
769
770
  if (event.changedTouches) {
770
771
  this.addEventListener('touchmove', this.onDrag);
771
772
  this.addEventListener('touchend', this.onDragEnd);
@@ -859,6 +860,17 @@ let Slider = class Slider extends ControlElement {
859
860
  }
860
861
  return this.fromNumber + this.minRangeNumber;
861
862
  }
863
+ /**
864
+ * Validate number field from changed thumb
865
+ * @returns {void}
866
+ */
867
+ validateNumberField() {
868
+ if (this.isShowInputField) {
869
+ const name = this.changedThumb?.getAttribute('name');
870
+ const numberField = this[`${name}Input`];
871
+ requestAnimationFrame(() => numberField.reportValidity());
872
+ }
873
+ }
862
874
  /**
863
875
  * Calculate the nearest possible step value depending on step interval
864
876
  * @param thumbPosition current thumb position in fraction
@@ -1000,7 +1012,7 @@ let Slider = class Slider extends ControlElement {
1000
1012
  if (valueFor === SliderDataName.to && value < this.fromNumber + this.minRangeNumber) {
1001
1013
  return false;
1002
1014
  }
1003
- else if (value > this.toNumber - this.minRangeNumber) {
1015
+ else if (valueFor === SliderDataName.from && value > this.toNumber - this.minRangeNumber) {
1004
1016
  return false;
1005
1017
  }
1006
1018
  }
@@ -376,7 +376,7 @@ let Tree = class Tree extends List {
376
376
  */
377
377
  get values() {
378
378
  return this.manager.checkedItems.map((item) => {
379
- return this.composer.getItemPropertyValue(item, 'value') || '';
379
+ return this.composer.getItemPropertyValue(item, 'value') ?? '';
380
380
  });
381
381
  }
382
382
  set values(values) {
@@ -386,9 +386,9 @@ let Tree = class Tree extends List {
386
386
  }
387
387
  else {
388
388
  // Clone value arrays
389
- const newValue = [...values].sort().toString();
390
- const oldValue = [...this.values].sort().toString();
391
- if (newValue !== oldValue) {
389
+ const newValue = [...values];
390
+ const oldValue = [...this.values];
391
+ if (newValue.toString() !== oldValue.toString()) {
392
392
  this.manager.uncheckAllItems();
393
393
  values.some((value) => {
394
394
  this.queryItemsByPropertyValue('value', value).forEach((item) => {
@@ -24,6 +24,10 @@ export declare class TreeManager<T extends TreeDataItem> {
24
24
  * Mode (algorithm) the tree manage is using
25
25
  */
26
26
  private mode;
27
+ /**
28
+ * Last selected item timestamp
29
+ */
30
+ private lastSelectedAt?;
27
31
  constructor(composer: CollectionComposer<T>, mode?: TreeManagerMode);
28
32
  /**
29
33
  * Is the manager maintaining parent/child relationships
@@ -42,6 +46,10 @@ export declare class TreeManager<T extends TreeDataItem> {
42
46
  * When managing relationships, this excludes groups/parents from the result.
43
47
  */
44
48
  get checkedItems(): readonly T[];
49
+ /**
50
+ * Compare items function order by sequential selected timestamp
51
+ */
52
+ protected get orderBySelectedAt(): (itemA: T, itemB: T) => number;
45
53
  /**
46
54
  * Items which should be visibly displayed.
47
55
  * This can be used to render items.
@@ -47,12 +47,24 @@ export class TreeManager {
47
47
  * When managing relationships, this excludes groups/parents from the result.
48
48
  */
49
49
  get checkedItems() {
50
- return this.composer.queryItems((item) => {
50
+ const items = this.composer.queryItems((item) => {
51
51
  if (this.manageRelationships && this.isItemParent(item)) {
52
52
  return false;
53
53
  }
54
54
  return this.isItemChecked(item);
55
55
  }, Infinity);
56
+ return Object.freeze(items.slice().sort(this.orderBySelectedAt));
57
+ }
58
+ /**
59
+ * Compare items function order by sequential selected timestamp
60
+ */
61
+ get orderBySelectedAt() {
62
+ // Order by sequential selected timestamp
63
+ return (itemA, itemB) => {
64
+ const timeA = this.composer.getItemPropertyValue(itemA, 'selectedAt') ?? 0;
65
+ const timeB = this.composer.getItemPropertyValue(itemB, 'selectedAt') ?? 0;
66
+ return timeA - timeB;
67
+ };
56
68
  }
57
69
  /**
58
70
  * Items which should be visibly displayed.
@@ -341,7 +353,13 @@ export class TreeManager {
341
353
  }
342
354
  _checkItem(item, manageRelationships = this.manageRelationships) {
343
355
  if (this.canCheckItem(item)) {
356
+ // Create unique timestamp base on the latest selection for sequential selection.
357
+ const timestamp = Date.now();
358
+ this.lastSelectedAt =
359
+ this.lastSelectedAt && this.lastSelectedAt >= timestamp ? this.lastSelectedAt + 1 : timestamp;
360
+ // Set item selected with timestamp
344
361
  this.composer.setItemPropertyValue(item, 'selected', true);
362
+ this.composer.setItemPropertyValue(item, 'selectedAt', this.lastSelectedAt);
345
363
  if (manageRelationships) {
346
364
  this.forceUpdateOnPath(item);
347
365
  this.getItemDescendants(item).forEach((descendant) => this._checkItem(descendant, false));
@@ -59,7 +59,11 @@ export declare class TreeSelect extends ComboBox<TreeSelectDataItem> {
59
59
  /**
60
60
  * Extracted values from {@link this.checkedGroupedItems}
61
61
  */
62
- protected pillsData: TreeSelectDataItem[];
62
+ protected pillsData: Readonly<TreeSelectDataItem[]>;
63
+ /**
64
+ * Cache old selection timestamps for revert selected timestamps when cancel selection
65
+ */
66
+ protected oldSelection: Map<string, number | undefined>;
63
67
  /**
64
68
  * Are there pills visible
65
69
  */
@@ -207,10 +211,15 @@ export declare class TreeSelect extends ComboBox<TreeSelectDataItem> {
207
211
  */
208
212
  protected persistSelection(): void;
209
213
  /**
210
- * Reverse selection. Run on Esc or Cancel
214
+ * Revert modified selection to old values. Run on Esc or Cancel
215
+ * @returns {void}
216
+ */
217
+ protected revertModifiedSelection(): void;
218
+ /**
219
+ * Revert all selected timestamps to the previous state which affect to item sorting
211
220
  * @returns {void}
212
221
  */
213
- protected cancelSelection(): void;
222
+ protected revertSelectionTimestamps(): void;
214
223
  /**
215
224
  * Update memoized track
216
225
  *
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html, nothing, triggerResize } from '@refinitiv-ui/core';
2
+ import { WarningNotice, css, html, nothing, triggerResize } from '@refinitiv-ui/core';
3
3
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
4
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { query } from '@refinitiv-ui/core/decorators/query.js';
@@ -21,6 +21,7 @@ import { VERSION } from '../version.js';
21
21
  export { TreeSelectRenderer };
22
22
  const MEMO_THROTTLE = 16;
23
23
  const POPUP_POSITION = ['bottom-start', 'top-start'];
24
+ const valueFormatWarning = new WarningNotice("The specified 'values' format does not conform to the required format.");
24
25
  /**
25
26
  * Dropdown control that allows selection from the tree list
26
27
  *
@@ -65,6 +66,10 @@ let TreeSelect = class TreeSelect extends ComboBox {
65
66
  * Extracted values from {@link this.checkedGroupedItems}
66
67
  */
67
68
  this.pillsData = [];
69
+ /**
70
+ * Cache old selection timestamps for revert selected timestamps when cancel selection
71
+ */
72
+ this.oldSelection = new Map();
68
73
  /**
69
74
  * Are there pills visible
70
75
  */
@@ -165,8 +170,26 @@ let TreeSelect = class TreeSelect extends ComboBox {
165
170
  return this._values;
166
171
  }
167
172
  set values(values) {
168
- super.values = values;
169
- this._values = values;
173
+ if (!Array.isArray(values)) {
174
+ valueFormatWarning.show();
175
+ this.values = [];
176
+ return;
177
+ }
178
+ // Update the selection state when found new value
179
+ const newValues = values.slice(0, this.multiple ? values.length : 1);
180
+ const oldValues = this.values.slice();
181
+ if (newValues.toString() !== oldValues.toString()) {
182
+ this._values = values;
183
+ this.updateComposerValues(values);
184
+ this.updatePills();
185
+ if (this.freeText) {
186
+ // free text mode is only supported in single selection mode
187
+ // so if there is no valid selection in the composer, we can assume
188
+ // the first item can be used as the free text item.
189
+ this.freeTextValue = !this.composerValues.length ? newValues[0] : '';
190
+ }
191
+ this.requestUpdate('values', oldValues);
192
+ }
170
193
  }
171
194
  /**
172
195
  * Set maximum number of selected items
@@ -228,7 +251,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
228
251
  * @override
229
252
  */
230
253
  get selectedLabels() {
231
- return this.checkedGroupedItems.map((selected) => this.getItemPropertyValue(selected, 'label') || '');
254
+ return this.checkedGroupedItems.map((selected) => this.getItemPropertyValue(selected, 'label') ?? '');
232
255
  }
233
256
  /**
234
257
  * Returns memoized selected state
@@ -332,29 +355,37 @@ let TreeSelect = class TreeSelect extends ComboBox {
332
355
  * @returns {void}
333
356
  */
334
357
  persistSelection() {
335
- const oldValues = this.values.slice();
358
+ const oldValues = this.values;
336
359
  const newValues = this.composerValues;
337
- const oldComparison = oldValues.sort().toString();
338
- const newComparison = newValues.sort().toString();
339
- if (oldComparison !== newComparison) {
360
+ if (oldValues.toString() !== newValues.toString()) {
361
+ // Set new values order by sequential selection
340
362
  this.values = newValues;
341
363
  this.notifyPropertyChange('value', this.value);
342
364
  }
343
365
  }
344
366
  /**
345
- * Reverse selection. Run on Esc or Cancel
367
+ * Revert modified selection to old values. Run on Esc or Cancel
346
368
  * @returns {void}
347
369
  */
348
- cancelSelection() {
349
- const oldValues = this.values.slice();
370
+ revertModifiedSelection() {
371
+ const oldValues = this.values;
350
372
  const newValues = this.composerValues;
351
- const oldComparison = oldValues.sort().toString();
352
- const newComparison = newValues.sort().toString();
353
- if (oldComparison !== newComparison) {
354
- // revert selected item by updating the collection composer
355
- this.updateComposerValues(this._values);
373
+ if (oldValues.toString() !== newValues.toString()) {
374
+ // Revert selected item by updating the collection composer
375
+ this.updateComposerValues(oldValues);
356
376
  }
357
377
  }
378
+ /**
379
+ * Revert all selected timestamps to the previous state which affect to item sorting
380
+ * @returns {void}
381
+ */
382
+ revertSelectionTimestamps() {
383
+ this.selection.forEach((item) => {
384
+ const oldSelectedAt = this.oldSelection.get(item.value);
385
+ this.composer.setItemPropertyValue(item, 'selectedAt', oldSelectedAt);
386
+ });
387
+ this.oldSelection.clear(); // Clear cache old selection
388
+ }
358
389
  /**
359
390
  * Update memoized track
360
391
  *
@@ -419,6 +450,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
419
450
  const event = new CustomEvent('cancel');
420
451
  this.dispatchEvent(event);
421
452
  if (!event.defaultPrevented) {
453
+ this.revertSelectionTimestamps();
422
454
  this.closeAndReset();
423
455
  // reset always happens on popup close action
424
456
  }
@@ -487,6 +519,10 @@ let TreeSelect = class TreeSelect extends ComboBox {
487
519
  onPopupOpened() {
488
520
  super.onPopupOpened();
489
521
  this.clearSelectionFilter();
522
+ // Cache current selection timestamps for reverting modified selection when user cancel
523
+ this.selection.forEach((item) => {
524
+ this.oldSelection.set(item.value, this.getItemPropertyValue(item, 'selectedAt'));
525
+ });
490
526
  this.updatePills();
491
527
  this.updateMemo();
492
528
  }
@@ -504,7 +540,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
504
540
  onPopupClosed() {
505
541
  super.onPopupClosed();
506
542
  this.updateMemo();
507
- this.cancelSelection();
543
+ this.revertModifiedSelection();
508
544
  this.exitEditSelection();
509
545
  }
510
546
  /**
@@ -731,7 +767,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
731
767
  */
732
768
  updatePills() {
733
769
  if (this.showPills) {
734
- this.pillsData = this.checkedGroupedItems.slice();
770
+ this.pillsData = this.checkedGroupedItems;
735
771
  this.hasPills = !!this.pillsData.length;
736
772
  }
737
773
  }
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '6.10.2';
1
+ export const VERSION = '6.12.0';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "6.10.2",
3
+ "version": "6.12.0",
4
4
  "description": "Element Framework Elements",
5
- "author": "Refinitiv",
5
+ "author": "LSEG",
6
6
  "license": "Apache-2.0",
7
7
  "main": "./lib/index.js",
8
8
  "module": "./lib/index.js",
@@ -339,8 +339,8 @@
339
339
  },
340
340
  "dependencies": {
341
341
  "@lit-labs/context": "^0.3.1",
342
- "@refinitiv-ui/halo-theme": "^6.5.8",
343
- "@refinitiv-ui/solar-theme": "^6.3.9",
342
+ "@refinitiv-ui/halo-theme": "^6.6.1",
343
+ "@refinitiv-ui/solar-theme": "^6.4.1",
344
344
  "@types/chart.js": "^2.9.31",
345
345
  "chart.js": "~2.9.4",
346
346
  "d3-interpolate": "^3.0.1",
@@ -349,25 +349,25 @@
349
349
  "tslib": "^2.3.1"
350
350
  },
351
351
  "devDependencies": {
352
- "@refinitiv-ui/core": "^6.5.0",
353
- "@refinitiv-ui/demo-block": "^6.1.10",
354
- "@refinitiv-ui/i18n": "^6.0.17",
355
- "@refinitiv-ui/phrasebook": "^6.3.6",
356
- "@refinitiv-ui/test-helpers": "^6.0.14",
357
- "@refinitiv-ui/translate": "^6.0.26",
358
- "@refinitiv-ui/utils": "^6.2.9",
352
+ "@refinitiv-ui/core": "^6.5.1",
353
+ "@refinitiv-ui/demo-block": "^6.1.12",
354
+ "@refinitiv-ui/i18n": "^6.0.18",
355
+ "@refinitiv-ui/phrasebook": "^6.3.7",
356
+ "@refinitiv-ui/test-helpers": "^6.0.15",
357
+ "@refinitiv-ui/translate": "^6.0.27",
358
+ "@refinitiv-ui/utils": "^6.3.0",
359
359
  "@types/d3-interpolate": "^3.0.1"
360
360
  },
361
361
  "peerDependencies": {
362
362
  "@refinitiv-ui/browser-sparkline": "^1.0.0 || ^2.0.0",
363
- "@refinitiv-ui/core": "^6.5.0",
364
- "@refinitiv-ui/i18n": "^6.0.17",
365
- "@refinitiv-ui/phrasebook": "^6.3.6",
366
- "@refinitiv-ui/translate": "^6.0.26",
367
- "@refinitiv-ui/utils": "^6.2.9"
363
+ "@refinitiv-ui/core": "^6.5.1",
364
+ "@refinitiv-ui/i18n": "^6.0.18",
365
+ "@refinitiv-ui/phrasebook": "^6.3.7",
366
+ "@refinitiv-ui/translate": "^6.0.27",
367
+ "@refinitiv-ui/utils": "^6.3.0"
368
368
  },
369
369
  "publishConfig": {
370
370
  "access": "public"
371
371
  },
372
- "gitHead": "298203ce6b7e4ba226af85183213a0d2da350aa5"
372
+ "gitHead": "14c76686cee42f70897fd6234691ac09fd318858"
373
373
  }