@refinitiv-ui/elements 6.2.2 → 6.3.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,22 @@
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.3.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.2.2...@refinitiv-ui/elements@6.3.0) (2022-10-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **tree:** update parent item in values setter ([#496](https://github.com/Refinitiv/refinitiv-ui/issues/496)) ([0409fd4](https://github.com/Refinitiv/refinitiv-ui/commit/0409fd485deb74d311c06d4169dc64795e288ae8))
12
+
13
+
14
+ ### Features
15
+
16
+ * **utils:** add util color `readableColor` ([#487](https://github.com/Refinitiv/refinitiv-ui/issues/487)) ([42b3ea2](https://github.com/Refinitiv/refinitiv-ui/commit/42b3ea26c2e810cf285ccaab56fd0e5e4d3fdc23))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [6.2.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.2.1...@refinitiv-ui/elements@6.2.2) (2022-10-10)
7
23
 
8
24
 
@@ -18,6 +34,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
18
34
 
19
35
  ## [6.2.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.2.0...@refinitiv-ui/elements@6.2.1) (2022-09-26)
20
36
 
37
+ * Update all formatjs dependencies to support typescript 4.8 ([#459](https://github.com/Refinitiv/refinitiv-ui/pull/454)) ([5337b97](https://github.com/Refinitiv/refinitiv-ui/commit/5337b97dc6958f84b36bdbffdea6dfbbc5203596))
38
+ * Upgrade typescript to 4.8.3 ([#459](https://github.com/Refinitiv/refinitiv-ui/pull/454)) ([5337b97](https://github.com/Refinitiv/refinitiv-ui/commit/5337b97dc6958f84b36bdbffdea6dfbbc5203596))
39
+
21
40
 
22
41
  ### Bug Fixes
23
42
 
@@ -89,11 +89,6 @@ export class Palettes extends BasicElement {
89
89
  */
90
90
  onTouchmove(event) {
91
91
  const touchOffsets = event.changedTouches[0];
92
- // TODO: it is a bug of TypeScript@4.4 remove ts-ignore once it is fixed
93
- // https://github.com/microsoft/TypeScript/issues/45047
94
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
95
- // @ts-ignore
96
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
97
92
  const realTarget = this.shadowRoot?.elementFromPoint(touchOffsets.clientX, touchOffsets.clientY);
98
93
  this.updateValue(realTarget);
99
94
  }
@@ -1,5 +1,5 @@
1
1
  import { JSXInterface } from '../../jsx';
2
- import { ControlElement, CSSResultGroup, PropertyValues, TapEvent, TemplateResult } from '@refinitiv-ui/core';
2
+ import { ControlElement, CSSResultGroup, PropertyValues, TapEvent, TemplateResult, WarningNotice } from '@refinitiv-ui/core';
3
3
  import { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js';
4
4
  import type { ItemData } from '../../item';
5
5
  import type { ListData } from '../helpers/types';
@@ -12,6 +12,7 @@ declare enum Direction {
12
12
  UP = -1,
13
13
  DOWN = 1
14
14
  }
15
+ export declare const valueFormatWarning: WarningNotice;
15
16
  /**
16
17
  * Provides listing and immutable selection
17
18
  * @fires value-changed - Dispatched when value changes
@@ -84,7 +85,6 @@ export declare class List<T extends DataItem = ItemData> extends ControlElement
84
85
  * selected item values
85
86
  * @type {string[]}
86
87
  * @default []
87
- * @readonly
88
88
  */
89
89
  get values(): string[];
90
90
  set values(values: string[]);
@@ -15,7 +15,7 @@ var Direction;
15
15
  Direction[Direction["UP"] = -1] = "UP";
16
16
  Direction[Direction["DOWN"] = 1] = "DOWN";
17
17
  })(Direction || (Direction = {}));
18
- const valueFormatWarning = new WarningNotice('The specified \'values\' format does not conform to the required format.');
18
+ export const valueFormatWarning = new WarningNotice('The specified \'values\' format does not conform to the required format.');
19
19
  /**
20
20
  * Provides listing and immutable selection
21
21
  * @fires value-changed - Dispatched when value changes
@@ -129,7 +129,6 @@ let List = class List extends ControlElement {
129
129
  * selected item values
130
130
  * @type {string[]}
131
131
  * @default []
132
- * @readonly
133
132
  */
134
133
  get values() {
135
134
  return this.queryItemsByPropertyValue('selected', true)
@@ -176,7 +176,7 @@ export declare class Tree<T extends TreeDataItem = TreeDataItem> extends List<T>
176
176
  * @default []
177
177
  */
178
178
  get values(): string[];
179
- set values(value: string[]);
179
+ set values(values: string[]);
180
180
  /**
181
181
  * Data object to be used for creating tree
182
182
  * @override
@@ -2,7 +2,7 @@ import { __decorate } from "tslib";
2
2
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
3
3
  import { property } from '@refinitiv-ui/core/decorators/property.js';
4
4
  import { VERSION } from '../../version.js';
5
- import { List } from '../../list/index.js';
5
+ import { List, valueFormatWarning } from '../../list/index.js';
6
6
  import { TreeRenderer } from '../helpers/renderer.js';
7
7
  import { defaultFilter } from '../helpers/filter.js';
8
8
  import { TreeManager, TreeManagerMode } from '../managers/tree-manager.js';
@@ -377,8 +377,26 @@ let Tree = class Tree extends List {
377
377
  return this.composer.getItemPropertyValue(item, 'value') || '';
378
378
  });
379
379
  }
380
- set values(value) {
381
- super.values = value;
380
+ set values(values) {
381
+ if (!Array.isArray(values)) {
382
+ valueFormatWarning.show();
383
+ this.values = [];
384
+ }
385
+ else {
386
+ // Clone value arrays
387
+ const newValue = [...values].sort().toString();
388
+ const oldValue = [...this.values].sort().toString();
389
+ if (newValue !== oldValue) {
390
+ this.manager.uncheckAllItems();
391
+ values.some((value) => {
392
+ this.queryItemsByPropertyValue('value', value).forEach((item) => {
393
+ this.manager.checkItem(item);
394
+ });
395
+ return !this.multiple; // Only set the fist value if multiple is not enabled
396
+ });
397
+ this.requestUpdate('values', this.values);
398
+ }
399
+ }
382
400
  }
383
401
  /**
384
402
  * Data object to be used for creating tree
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '6.2.2';
1
+ export const VERSION = '6.3.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "6.2.2",
3
+ "version": "6.3.0",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "Refinitiv",
6
6
  "license": "Apache-2.0",
@@ -343,24 +343,24 @@
343
343
  "tslib": "^2.3.1"
344
344
  },
345
345
  "devDependencies": {
346
- "@refinitiv-ui/core": "^6.0.8",
347
- "@refinitiv-ui/demo-block": "^6.0.9",
348
- "@refinitiv-ui/i18n": "^6.0.6",
346
+ "@refinitiv-ui/core": "^6.0.9",
347
+ "@refinitiv-ui/demo-block": "^6.0.10",
348
+ "@refinitiv-ui/i18n": "^6.0.7",
349
349
  "@refinitiv-ui/phrasebook": "^6.2.0",
350
350
  "@refinitiv-ui/test-helpers": "^6.0.4",
351
- "@refinitiv-ui/translate": "^6.0.8",
352
- "@refinitiv-ui/utils": "^6.1.1",
351
+ "@refinitiv-ui/translate": "^6.0.9",
352
+ "@refinitiv-ui/utils": "^6.2.0",
353
353
  "@types/d3-interpolate": "^3.0.1"
354
354
  },
355
355
  "peerDependencies": {
356
- "@refinitiv-ui/core": "^6.0.8",
357
- "@refinitiv-ui/i18n": "^6.0.6",
356
+ "@refinitiv-ui/core": "^6.0.9",
357
+ "@refinitiv-ui/i18n": "^6.0.7",
358
358
  "@refinitiv-ui/phrasebook": "^6.2.0",
359
- "@refinitiv-ui/translate": "^6.0.8",
360
- "@refinitiv-ui/utils": "^6.1.1"
359
+ "@refinitiv-ui/translate": "^6.0.9",
360
+ "@refinitiv-ui/utils": "^6.2.0"
361
361
  },
362
362
  "publishConfig": {
363
363
  "access": "public"
364
364
  },
365
- "gitHead": "0fb64e96c19eb8f9177170ab5c834d0553559b78"
365
+ "gitHead": "4f5025365f935bb03aaf2afe26e9e1d0e55caf04"
366
366
  }