@refinitiv-ui/elements 7.0.2 → 7.2.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 +22 -8
- package/lib/chart/custom-elements.md +3 -3
- package/lib/chart/elements/chart.d.ts +7 -1
- package/lib/chart/elements/chart.js +11 -2
- package/lib/datetime-picker/index.js +5 -5
- package/lib/heatmap/helpers/types.d.ts +10 -10
- package/lib/heatmap/index.js +55 -26
- package/lib/interactive-chart/custom-elements.json +5 -0
- package/lib/interactive-chart/custom-elements.md +1 -0
- package/lib/interactive-chart/index.d.ts +5 -1
- package/lib/interactive-chart/index.js +32 -12
- package/lib/number-field/index.d.ts +1 -0
- package/lib/number-field/index.js +2 -0
- package/lib/tooltip/helpers/renderer.d.ts +1 -1
- package/lib/tooltip/helpers/renderer.js +3 -3
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,29 +3,43 @@
|
|
|
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
|
-
|
|
6
|
+
# [7.2.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.1.0...@refinitiv-ui/elements@7.2.0) (2023-07-31)
|
|
8
7
|
|
|
9
8
|
### Bug Fixes
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
- **heatmap:** `HeatmapCell` properties other than `value` should be optional ([#866](https://github.com/Refinitiv/refinitiv-ui/issues/866)) ([c27d3d6](https://github.com/Refinitiv/refinitiv-ui/commit/c27d3d6a004f897a0d8c037899514c9fe154a21c))
|
|
11
|
+
- **number-field:** add aria-valuetext to prevent VO announce % ([e127ccb](https://github.com/Refinitiv/refinitiv-ui/commit/e127ccb403f2dc1795f25a24f41ac293f701647e))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
12
14
|
|
|
15
|
+
- **interactive-chart:** change chart instance access modifier to public ([88ed541](https://github.com/Refinitiv/refinitiv-ui/commit/88ed541212f494877678213f9d8a68c0c8fa0b2c))
|
|
16
|
+
- **tooltip:** add data-tooltip alias for tooltip attribute ([#859](https://github.com/Refinitiv/refinitiv-ui/issues/859)) ([3d2a333](https://github.com/Refinitiv/refinitiv-ui/commit/3d2a333f28afacbac353d344beae5fa6c52f61db))
|
|
13
17
|
|
|
18
|
+
# [7.1.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.0.2...@refinitiv-ui/elements@7.1.0) (2023-07-25)
|
|
14
19
|
|
|
20
|
+
### Bug Fixes
|
|
15
21
|
|
|
22
|
+
- **chart:** font doesn't update after font loaded ([#832](https://github.com/Refinitiv/refinitiv-ui/issues/832)) ([ff64371](https://github.com/Refinitiv/refinitiv-ui/commit/ff64371b292955f980c1bb8e1189afdf23702534))
|
|
23
|
+
- **datetime-picker:** allow user to clear invalid value in input ([#847](https://github.com/Refinitiv/refinitiv-ui/issues/847)) ([30334e5](https://github.com/Refinitiv/refinitiv-ui/commit/30334e55d7001e33175ddcb7a3b612be1dd1121a))
|
|
24
|
+
- **datetime-picker:** prevent view change when either from/to has been selected ([#841](https://github.com/Refinitiv/refinitiv-ui/issues/841)) ([4f92738](https://github.com/Refinitiv/refinitiv-ui/commit/4f92738c381ea13d799fa8767bb3e6b99442fc01))
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
### Features
|
|
18
27
|
|
|
28
|
+
- **interactive-chart:** migrate interactive chart api ([#840](https://github.com/Refinitiv/refinitiv-ui/issues/840)) ([94ffcae](https://github.com/Refinitiv/refinitiv-ui/commit/94ffcae24302e3bcf53cb9ec86e1d6562ccb4ee4))
|
|
19
29
|
|
|
20
|
-
|
|
30
|
+
## [7.0.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.0.1...@refinitiv-ui/elements@7.0.2) (2023-07-19)
|
|
21
31
|
|
|
22
|
-
|
|
23
|
-
* flag attribute not reflecting when set through property ([#822](https://github.com/Refinitiv/refinitiv-ui/issues/822)) ([c6cb02a](https://github.com/Refinitiv/refinitiv-ui/commit/c6cb02a744e16fd2f3f356fcc6f66325c9245118))
|
|
24
|
-
* **interactive-chart:** export chart interface ([#812](https://github.com/Refinitiv/refinitiv-ui/issues/812)) ([7ec5eab](https://github.com/Refinitiv/refinitiv-ui/commit/7ec5eabffc82e5a4866f9de7662b4d3d69e2640b))
|
|
32
|
+
### Bug Fixes
|
|
25
33
|
|
|
34
|
+
- **notification,toggle:** make user-select overridable ([#835](https://github.com/Refinitiv/refinitiv-ui/issues/835)) ([011130e](https://github.com/Refinitiv/refinitiv-ui/commit/011130e76341ec362cbd86b7dd93f2d77464ce64))
|
|
26
35
|
|
|
36
|
+
## [7.0.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.0.0...@refinitiv-ui/elements@7.0.1) (2023-07-17)
|
|
27
37
|
|
|
38
|
+
### Bug Fixes
|
|
28
39
|
|
|
40
|
+
- **chart:** wrong type on onRenderLabel ([#820](https://github.com/Refinitiv/refinitiv-ui/issues/820)) ([29a0e44](https://github.com/Refinitiv/refinitiv-ui/commit/29a0e44993c54bcff0279eb11a9a7dcfb755cbc2))
|
|
41
|
+
- flag attribute not reflecting when set through property ([#822](https://github.com/Refinitiv/refinitiv-ui/issues/822)) ([c6cb02a](https://github.com/Refinitiv/refinitiv-ui/commit/c6cb02a744e16fd2f3f356fcc6f66325c9245118))
|
|
42
|
+
- **interactive-chart:** export chart interface ([#812](https://github.com/Refinitiv/refinitiv-ui/issues/812)) ([7ec5eab](https://github.com/Refinitiv/refinitiv-ui/commit/7ec5eabffc82e5a4866f9de7662b4d3d69e2640b))
|
|
29
43
|
|
|
30
44
|
# [7.0.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.8...@refinitiv-ui/elements@7.0.0) (2023-06-30)
|
|
31
45
|
|
|
@@ -12,6 +12,6 @@ Charting component that uses ChartJS library
|
|
|
12
12
|
|
|
13
13
|
## Methods
|
|
14
14
|
|
|
15
|
-
| Method | Type
|
|
16
|
-
|
|
17
|
-
| `updateChart` | `(updateMode
|
|
15
|
+
| Method | Type | Description |
|
|
16
|
+
|---------------|----------------------------|--------------------------------------------------|
|
|
17
|
+
| `updateChart` | `(updateMode?: any): void` | Update all data, title, scales, legends and re-render the chart based on its config<br /><br />**updateMode**: Additional configuration for control an animation in the update process. |
|
|
@@ -106,6 +106,12 @@ export declare class Chart extends BasicElement {
|
|
|
106
106
|
* @returns The value as a number, or, undefined if NaN.
|
|
107
107
|
*/
|
|
108
108
|
protected cssVarAsNumber(...args: string[]): number | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Callback beforeUpdate event from Chartjs
|
|
111
|
+
* @param chart Chart.js instance
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
protected beforeUpdate: (chart: ChartJS) => void;
|
|
109
115
|
/**
|
|
110
116
|
* Inject theme color into each datasets
|
|
111
117
|
* @param chart Chart.js instance
|
|
@@ -154,7 +160,7 @@ export declare class Chart extends BasicElement {
|
|
|
154
160
|
* @param updateMode Additional configuration for control an animation in the update process.
|
|
155
161
|
* @returns {void}
|
|
156
162
|
*/
|
|
157
|
-
updateChart(updateMode
|
|
163
|
+
updateChart(updateMode?: UpdateMode): void;
|
|
158
164
|
/**
|
|
159
165
|
* Template for title
|
|
160
166
|
* Rendered when `config.plugins.title.text` is set
|
|
@@ -30,6 +30,16 @@ let Chart = class Chart extends BasicElement {
|
|
|
30
30
|
* Canvas element used to render Chart
|
|
31
31
|
*/
|
|
32
32
|
this.canvas = createRef();
|
|
33
|
+
/**
|
|
34
|
+
* Callback beforeUpdate event from Chartjs
|
|
35
|
+
* @param chart Chart.js instance
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
this.beforeUpdate = (chart) => {
|
|
39
|
+
// set global config again in case the CSS font isn't loaded when updating the chart
|
|
40
|
+
this.setGlobalConfig();
|
|
41
|
+
this.decorateColors(chart);
|
|
42
|
+
};
|
|
33
43
|
/**
|
|
34
44
|
* Inject theme color into each datasets
|
|
35
45
|
* @param chart Chart.js instance
|
|
@@ -303,7 +313,6 @@ let Chart = class Chart extends BasicElement {
|
|
|
303
313
|
*/
|
|
304
314
|
connectedCallback() {
|
|
305
315
|
super.connectedCallback();
|
|
306
|
-
this.setGlobalConfig();
|
|
307
316
|
if (this.canvas.value) {
|
|
308
317
|
this.createChart();
|
|
309
318
|
}
|
|
@@ -327,7 +336,7 @@ let Chart = class Chart extends BasicElement {
|
|
|
327
336
|
const option = this.themableChartOption;
|
|
328
337
|
merge(chart.config.options, option);
|
|
329
338
|
},
|
|
330
|
-
beforeUpdate: this.
|
|
339
|
+
beforeUpdate: this.beforeUpdate
|
|
331
340
|
};
|
|
332
341
|
}
|
|
333
342
|
/**
|
|
@@ -252,7 +252,7 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
|
|
|
252
252
|
*/
|
|
253
253
|
set values(values) {
|
|
254
254
|
const oldValues = this._values;
|
|
255
|
-
if (String(oldValues) !== String(values)) {
|
|
255
|
+
if (String(oldValues) !== String(values) || !values.length) {
|
|
256
256
|
this._values = values;
|
|
257
257
|
this.valuesToSegments();
|
|
258
258
|
this.requestUpdate('_values', oldValues); /* segments are populated in update */
|
|
@@ -562,17 +562,17 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
|
|
|
562
562
|
}
|
|
563
563
|
// duplex split
|
|
564
564
|
if (index === 0) {
|
|
565
|
-
|
|
565
|
+
// from. to must be after or the same when no value has been selected
|
|
566
566
|
let after = views[1] || addMonths(view, 1);
|
|
567
|
-
if (isBefore(after, view)) {
|
|
567
|
+
if (this.values.every((value) => !value) && isBefore(after, view)) {
|
|
568
568
|
after = view;
|
|
569
569
|
}
|
|
570
570
|
return [view, formatToView(after)];
|
|
571
571
|
}
|
|
572
572
|
if (index === 1) {
|
|
573
|
-
|
|
573
|
+
// to. from must be before or the same when no value has been selected
|
|
574
574
|
let before = views[0] || subMonths(view, 1);
|
|
575
|
-
if (isAfter(before, view)) {
|
|
575
|
+
if (this.values.every((value) => !value) && isAfter(before, view)) {
|
|
576
576
|
before = view;
|
|
577
577
|
}
|
|
578
578
|
return [formatToView(before), view];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type HeatmapConfig = {
|
|
2
|
-
data:
|
|
2
|
+
data: HeatmapCell[][];
|
|
3
3
|
yAxis?: HeatmapYAxis;
|
|
4
4
|
xAxis?: HeatmapXAxis;
|
|
5
5
|
};
|
|
@@ -13,18 +13,18 @@ type HeatmapYAxis = {
|
|
|
13
13
|
position: 'left' | 'right';
|
|
14
14
|
};
|
|
15
15
|
type HeatmapCell = {
|
|
16
|
-
rowIndex
|
|
17
|
-
colIndex
|
|
18
|
-
x
|
|
19
|
-
y
|
|
20
|
-
width
|
|
21
|
-
height
|
|
16
|
+
rowIndex?: number;
|
|
17
|
+
colIndex?: number;
|
|
18
|
+
x?: number;
|
|
19
|
+
y?: number;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
22
|
value: number | null;
|
|
23
23
|
header?: string;
|
|
24
24
|
label?: string;
|
|
25
|
-
foregroundColor
|
|
26
|
-
defaultBackground
|
|
27
|
-
backgroundColor
|
|
25
|
+
foregroundColor?: string;
|
|
26
|
+
defaultBackground?: string;
|
|
27
|
+
backgroundColor?: string;
|
|
28
28
|
animationFrame?: number;
|
|
29
29
|
customLabel?: string;
|
|
30
30
|
customBackgroundColor?: string;
|
package/lib/heatmap/index.js
CHANGED
|
@@ -318,15 +318,13 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
318
318
|
*/
|
|
319
319
|
onResize() {
|
|
320
320
|
this.updateTimer = 0;
|
|
321
|
-
if (!this.isSizeCalculated) {
|
|
322
|
-
if (this.offsetWidth || this.offsetHeight) {
|
|
323
|
-
this.isSizeCalculated = true;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
321
|
if (this.isSizeCalculated) {
|
|
327
322
|
const spacing = parseFloat(this.getComputedVariable('--spacing', '0'));
|
|
328
323
|
this.cellMargin = spacing / 2;
|
|
329
324
|
}
|
|
325
|
+
else {
|
|
326
|
+
this.isSizeCalculated = Boolean(this.offsetWidth || this.offsetHeight);
|
|
327
|
+
}
|
|
330
328
|
// calculate responsive height
|
|
331
329
|
if (this.responsiveHeight || !this.offsetHeight) {
|
|
332
330
|
const width = this.offsetWidth;
|
|
@@ -397,12 +395,17 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
397
395
|
*/
|
|
398
396
|
/* c8 ignore start */
|
|
399
397
|
updateTooltipOverlayPosition(cell) {
|
|
398
|
+
if (cell.x === undefined ||
|
|
399
|
+
cell.y === undefined ||
|
|
400
|
+
cell.width === undefined ||
|
|
401
|
+
cell.height === undefined) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
400
404
|
// Compensate x-axis height for overlay when x-axis is at top position
|
|
401
405
|
let marginOverlayTop = 0;
|
|
402
406
|
if (this.config?.xAxis && this.xAxis?.offsetHeight) {
|
|
403
407
|
marginOverlayTop = this.config.xAxis.position === 'bottom' ? 0 : this.xAxis?.offsetHeight;
|
|
404
408
|
}
|
|
405
|
-
// Update overlay position
|
|
406
409
|
this.tooltipOverlay.style.left = `${cell.x}px`;
|
|
407
410
|
this.tooltipOverlay.style.top = `${cell.y + marginOverlayTop}px`;
|
|
408
411
|
this.tooltipOverlay.style.width = `${cell.width}px`;
|
|
@@ -417,7 +420,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
417
420
|
*/
|
|
418
421
|
/* c8 ignore start */
|
|
419
422
|
hoverCellChanged(cell, previousCell) {
|
|
420
|
-
if (cell && cell.value !== null) {
|
|
423
|
+
if (cell && cell.value !== null && cell.backgroundColor) {
|
|
421
424
|
if (this.tooltipCallback) {
|
|
422
425
|
this.updateTooltipOverlayPosition(cell);
|
|
423
426
|
}
|
|
@@ -427,7 +430,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
427
430
|
this.fade(cell, cell.backgroundColor, fadedColor, 100);
|
|
428
431
|
}
|
|
429
432
|
// returns color of previous cell to default cell color
|
|
430
|
-
if (previousCell && previousCell.value !== null) {
|
|
433
|
+
if (previousCell && previousCell.value !== null && previousCell.backgroundColor) {
|
|
431
434
|
previousCell.foregroundColor = this.foregroundColor;
|
|
432
435
|
this.fade(previousCell, previousCell.backgroundColor, this.getBackgroundColor(previousCell.value), 300);
|
|
433
436
|
}
|
|
@@ -487,6 +490,12 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
487
490
|
*/
|
|
488
491
|
/* c8 ignore start */
|
|
489
492
|
resetCell(cell) {
|
|
493
|
+
if (cell.x === undefined ||
|
|
494
|
+
cell.y === undefined ||
|
|
495
|
+
cell.width === undefined ||
|
|
496
|
+
cell.height === undefined) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
490
499
|
this.canvasContext?.clearRect(cell.x, cell.y, cell.width, cell.height);
|
|
491
500
|
}
|
|
492
501
|
/* c8 ignore stop */
|
|
@@ -504,6 +513,9 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
504
513
|
const start = performance.now();
|
|
505
514
|
const end = start + duration;
|
|
506
515
|
const fadingAnimation = (time) => {
|
|
516
|
+
if (cell.colIndex === undefined || cell.rowIndex === undefined) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
507
519
|
cell.x = this.colTrack.getContentStart(cell.colIndex);
|
|
508
520
|
cell.y = this.rowTrack.getContentStart(cell.rowIndex);
|
|
509
521
|
cell.width = this.colTrack.getContentSize(cell.colIndex);
|
|
@@ -641,12 +653,18 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
641
653
|
* @returns {void}
|
|
642
654
|
*/
|
|
643
655
|
paintLabel(cell) {
|
|
656
|
+
if (!this.canvasContext ||
|
|
657
|
+
cell.x === undefined ||
|
|
658
|
+
cell.y === undefined ||
|
|
659
|
+
cell.width === undefined ||
|
|
660
|
+
cell.height === undefined ||
|
|
661
|
+
cell.foregroundColor === undefined) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
644
664
|
const margin = cell.header ? this.calculateHeaderMargin(cell.height) : 0;
|
|
645
665
|
const label = typeof cell.customLabel === 'string' ? cell.customLabel : cell.label;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
this.canvasContext.fillText(label || '', cell.x + cell.width / 2, cell.y + 1 + cell.height / 2 + margin);
|
|
649
|
-
}
|
|
666
|
+
this.canvasContext.fillStyle = cell.customForegroundColor || cell.foregroundColor;
|
|
667
|
+
this.canvasContext.fillText(label || '', cell.x + cell.width / 2, cell.y + 1 + cell.height / 2 + margin);
|
|
650
668
|
}
|
|
651
669
|
/**
|
|
652
670
|
* Check if the text (label / header and label) can be paint on the cell
|
|
@@ -796,15 +814,21 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
796
814
|
* @returns {void}
|
|
797
815
|
*/
|
|
798
816
|
paintHeader(cell) {
|
|
799
|
-
if (this.canvasContext
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
this.canvasContext.font = labelFontStyle;
|
|
817
|
+
if (!this.canvasContext ||
|
|
818
|
+
cell.x === undefined ||
|
|
819
|
+
cell.y === undefined ||
|
|
820
|
+
cell.width === undefined ||
|
|
821
|
+
cell.height === undefined ||
|
|
822
|
+
cell.foregroundColor === undefined) {
|
|
823
|
+
return;
|
|
807
824
|
}
|
|
825
|
+
const labelFontStyle = this.canvasContext.font;
|
|
826
|
+
const margin = this.labelHidden ? 0 : this.calculateHeaderMargin(cell.height);
|
|
827
|
+
this.canvasContext.font = 'bold ' + labelFontStyle;
|
|
828
|
+
this.canvasContext.fillStyle = cell.customForegroundColor || cell.foregroundColor;
|
|
829
|
+
this.canvasContext.fillText(cell.header || '', cell.x + cell.width / 2, cell.y + 1 + cell.height / 2 - margin);
|
|
830
|
+
// Reverts font style to paint label correctly
|
|
831
|
+
this.canvasContext.font = labelFontStyle;
|
|
808
832
|
}
|
|
809
833
|
/**
|
|
810
834
|
* Paints header to all cells
|
|
@@ -847,10 +871,16 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
847
871
|
* @returns {void}
|
|
848
872
|
*/
|
|
849
873
|
paintCellBackground(cell) {
|
|
850
|
-
if (this.canvasContext
|
|
851
|
-
|
|
852
|
-
|
|
874
|
+
if (!this.canvasContext ||
|
|
875
|
+
cell.x === undefined ||
|
|
876
|
+
cell.y === undefined ||
|
|
877
|
+
cell.width === undefined ||
|
|
878
|
+
cell.height === undefined ||
|
|
879
|
+
cell.backgroundColor === undefined) {
|
|
880
|
+
return;
|
|
853
881
|
}
|
|
882
|
+
this.canvasContext.fillStyle = cell.customBackgroundColor || cell.backgroundColor;
|
|
883
|
+
this.canvasContext.fillRect(cell.x, cell.y, cell.width, cell.height);
|
|
854
884
|
}
|
|
855
885
|
/**
|
|
856
886
|
* Construct and renders x-axis
|
|
@@ -1011,7 +1041,6 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
1011
1041
|
if (this.hoverCell && this.canvasContext && this.tooltipCallback) {
|
|
1012
1042
|
return this.tooltipCallback(this.hoverCell);
|
|
1013
1043
|
}
|
|
1014
|
-
return undefined;
|
|
1015
1044
|
}
|
|
1016
1045
|
/* c8 ignore stop */
|
|
1017
1046
|
/**
|
|
@@ -1084,10 +1113,10 @@ __decorate([
|
|
|
1084
1113
|
property({ type: Number })
|
|
1085
1114
|
], Heatmap.prototype, "saturation", void 0);
|
|
1086
1115
|
__decorate([
|
|
1087
|
-
property({
|
|
1116
|
+
property({ attribute: false })
|
|
1088
1117
|
], Heatmap.prototype, "tooltipCallback", void 0);
|
|
1089
1118
|
__decorate([
|
|
1090
|
-
property({
|
|
1119
|
+
property({ attribute: false })
|
|
1091
1120
|
], Heatmap.prototype, "renderCallback", void 0);
|
|
1092
1121
|
__decorate([
|
|
1093
1122
|
query('[part=canvas]', true)
|
|
@@ -56,6 +56,11 @@
|
|
|
56
56
|
"description": "Set legend style i.e. `horizontal`, `vertical`.",
|
|
57
57
|
"type": "\"vertical\" | \"horizontal\"",
|
|
58
58
|
"default": "\"vertical\""
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "chart",
|
|
62
|
+
"description": "lightweight-charts object",
|
|
63
|
+
"type": "IChartApi | null"
|
|
59
64
|
}
|
|
60
65
|
],
|
|
61
66
|
"events": [
|
|
@@ -7,6 +7,7 @@ By lightweight-charts library.
|
|
|
7
7
|
|
|
8
8
|
| Property | Attribute | Type | Default | Description |
|
|
9
9
|
|----------------------|------------------------|------------------------------|------------|-------------------------------------------------|
|
|
10
|
+
| `chart` | | `IChartApi \| null` | null | lightweight-charts object |
|
|
10
11
|
| `config` | `config` | `InteractiveChartConfig` | null | Chart configurations for init chart |
|
|
11
12
|
| `disabledJumpButton` | `disabled-jump-button` | `boolean` | false | Hide jump to latest data button |
|
|
12
13
|
| `disabledLegend` | `disabled-legend` | `boolean` | false | Hide legend |
|
|
@@ -49,10 +49,14 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
49
49
|
* Array of series instances in chart
|
|
50
50
|
*/
|
|
51
51
|
seriesList: SeriesList[];
|
|
52
|
+
/**
|
|
53
|
+
* lightweight-charts object
|
|
54
|
+
* @type {IChartApi | null}
|
|
55
|
+
*/
|
|
56
|
+
chart: IChartApi | null;
|
|
52
57
|
private jumpButtonInitialized;
|
|
53
58
|
private legendInitialized;
|
|
54
59
|
private isCrosshairVisible;
|
|
55
|
-
protected chart: IChartApi | null;
|
|
56
60
|
protected rowLegend: RowLegend;
|
|
57
61
|
private timeScale;
|
|
58
62
|
private width;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var InteractiveChart_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
|
-
import { createChart as chart } from 'lightweight-charts';
|
|
3
|
+
import { ColorType, createChart as chart } from 'lightweight-charts';
|
|
4
4
|
import { ResponsiveElement, css, html } from '@refinitiv-ui/core';
|
|
5
5
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
6
6
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
@@ -39,10 +39,14 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
39
39
|
* Array of series instances in chart
|
|
40
40
|
*/
|
|
41
41
|
this.seriesList = [];
|
|
42
|
+
/**
|
|
43
|
+
* lightweight-charts object
|
|
44
|
+
* @type {IChartApi | null}
|
|
45
|
+
*/
|
|
46
|
+
this.chart = null;
|
|
42
47
|
this.jumpButtonInitialized = false;
|
|
43
48
|
this.legendInitialized = false;
|
|
44
49
|
this.isCrosshairVisible = false;
|
|
45
|
-
this.chart = null;
|
|
46
50
|
this.rowLegend = null;
|
|
47
51
|
this.timeScale = null;
|
|
48
52
|
this.width = 0;
|
|
@@ -507,7 +511,10 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
507
511
|
// Create object same as the theme
|
|
508
512
|
const chartThemeOptions = {
|
|
509
513
|
layout: {
|
|
510
|
-
|
|
514
|
+
background: {
|
|
515
|
+
type: ColorType.Solid,
|
|
516
|
+
color: this.theme.backgroundColor
|
|
517
|
+
},
|
|
511
518
|
textColor: this.theme.textColor,
|
|
512
519
|
fontFamily: defaultFontFamily
|
|
513
520
|
},
|
|
@@ -659,14 +666,29 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
659
666
|
let value;
|
|
660
667
|
let priceColor = '';
|
|
661
668
|
// When have price on event moved on the crosshair
|
|
662
|
-
if (eventMove?.
|
|
663
|
-
|
|
669
|
+
if (eventMove?.seriesData.get(this.seriesList[idx]) && eventMove.time) {
|
|
670
|
+
const data = eventMove.seriesData.get(this.seriesList[idx]);
|
|
671
|
+
switch (chartType) {
|
|
672
|
+
case 'line':
|
|
673
|
+
case 'area':
|
|
674
|
+
case 'volume':
|
|
675
|
+
value = data.value;
|
|
676
|
+
break;
|
|
677
|
+
case 'bar':
|
|
678
|
+
case 'candlestick': {
|
|
679
|
+
const { open, high, low, close } = data;
|
|
680
|
+
value = { open, high, low, close };
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
default:
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
664
686
|
priceColor = this.getColorInSeries(eventMove, chartType, idx);
|
|
665
687
|
this.isCrosshairVisible = true;
|
|
666
688
|
this.hasDataPoint = true;
|
|
667
689
|
}
|
|
668
690
|
// when there's no data point in the series object.
|
|
669
|
-
else if (!eventMove?.
|
|
691
|
+
else if (!eventMove?.seriesData.get(this.seriesList[idx]) && eventMove?.time) {
|
|
670
692
|
value = NO_DATA_POINT;
|
|
671
693
|
this.isCrosshairVisible = true;
|
|
672
694
|
this.hasDataPoint = false;
|
|
@@ -885,11 +907,9 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
885
907
|
return this.getLegendPriceColor(this.seriesList[index].options().color);
|
|
886
908
|
}
|
|
887
909
|
else if (chartType === 'candlestick') {
|
|
888
|
-
const
|
|
889
|
-
? seriesData?.seriesPrices.get(this.seriesList[index])
|
|
890
|
-
: seriesData;
|
|
910
|
+
const { close, open } = seriesData;
|
|
891
911
|
const barStyle = this.seriesList[index].options();
|
|
892
|
-
const colorBar =
|
|
912
|
+
const colorBar = close > open ? barStyle.borderUpColor : barStyle.borderDownColor;
|
|
893
913
|
return colorBar;
|
|
894
914
|
}
|
|
895
915
|
else if (chartType === 'bar') {
|
|
@@ -899,8 +919,8 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
899
919
|
return this.getLegendPriceColor(this.seriesList[index].options().lineColor);
|
|
900
920
|
}
|
|
901
921
|
else if (chartType === 'volume') {
|
|
902
|
-
const priceValue = seriesData.hasOwnProperty('
|
|
903
|
-
? seriesData.
|
|
922
|
+
const priceValue = seriesData.hasOwnProperty('seriesData')
|
|
923
|
+
? seriesData.seriesData.get(this.seriesList[index])
|
|
904
924
|
: seriesData.value;
|
|
905
925
|
let dataItem = {};
|
|
906
926
|
this.internalConfig.series[index].data.forEach((dataConfig) => {
|
|
@@ -315,6 +315,7 @@ export declare class NumberField extends FormFieldElement {
|
|
|
315
315
|
* inputmode="decimal" - show decimals keyboard by default
|
|
316
316
|
* role="spinbutton" - number field is actually a spinner
|
|
317
317
|
* aria-valuenow - current value or 0
|
|
318
|
+
* aria-valuetext - current value or 0, need this to improve user-friendly and human-understandable when screen reader announce value
|
|
318
319
|
* @keydown - Listener for `keydown` event. Runs `this.onInputKeyDown`
|
|
319
320
|
* @beforeinput - Listener for `beforeinput` event. Runs `this.onBeforeInputChange`
|
|
320
321
|
* @returns template map
|
|
@@ -724,6 +724,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
724
724
|
* inputmode="decimal" - show decimals keyboard by default
|
|
725
725
|
* role="spinbutton" - number field is actually a spinner
|
|
726
726
|
* aria-valuenow - current value or 0
|
|
727
|
+
* aria-valuetext - current value or 0, need this to improve user-friendly and human-understandable when screen reader announce value
|
|
727
728
|
* @keydown - Listener for `keydown` event. Runs `this.onInputKeyDown`
|
|
728
729
|
* @beforeinput - Listener for `beforeinput` event. Runs `this.onBeforeInputChange`
|
|
729
730
|
* @returns template map
|
|
@@ -736,6 +737,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
736
737
|
inputmode: 'decimal',
|
|
737
738
|
role: 'spinbutton',
|
|
738
739
|
'aria-valuenow': `${this.value || 0}`,
|
|
740
|
+
'aria-valuetext': `${this.value || 0}`,
|
|
739
741
|
'@keydown': this.onInputKeyDown,
|
|
740
742
|
'@beforeinput': this.onBeforeInputChange
|
|
741
743
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A default renderer that renders `tooltip`
|
|
2
|
+
* A default renderer that renders `tooltip` or `data-tooltip` attributes
|
|
3
3
|
* @param target Target to check
|
|
4
4
|
* @returns tooltip or null or undefined
|
|
5
5
|
*/
|
|
6
6
|
const tooltipRenderer = (target) => {
|
|
7
|
-
if (target.hasAttribute('tooltip')) {
|
|
8
|
-
return target.getAttribute('tooltip');
|
|
7
|
+
if (target.hasAttribute('tooltip') || target.hasAttribute('data-tooltip')) {
|
|
8
|
+
return target.getAttribute('tooltip') || target.getAttribute('data-tooltip');
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
export { tooltipRenderer };
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '7.0
|
|
1
|
+
export const VERSION = '7.2.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinitiv-ui/elements",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Element Framework Elements",
|
|
5
5
|
"author": "Refinitiv",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
"chartjs-adapter-date-fns": "^3.0.0",
|
|
349
349
|
"d3-interpolate": "^3.0.1",
|
|
350
350
|
"date-fns": "^2.29.3",
|
|
351
|
-
"lightweight-charts": "^
|
|
351
|
+
"lightweight-charts": "^4.0.1",
|
|
352
352
|
"tslib": "^2.3.1"
|
|
353
353
|
},
|
|
354
354
|
"devDependencies": {
|
|
@@ -371,5 +371,5 @@
|
|
|
371
371
|
"publishConfig": {
|
|
372
372
|
"access": "public"
|
|
373
373
|
},
|
|
374
|
-
"gitHead": "
|
|
374
|
+
"gitHead": "c890f2c543e97eb3397bd2b7b506c624679c8f5b"
|
|
375
375
|
}
|