@refinitiv-ui/elements 6.6.2 → 6.7.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 +14 -1
- package/lib/heatmap/helpers/text.d.ts +1 -1
- package/lib/heatmap/helpers/text.js +1 -1
- package/lib/heatmap/index.js +6 -5
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +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.7.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.6.2...@refinitiv-ui/elements@6.7.0) (2023-02-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **heatmap:** increase heatmap font-size threshold & scaling factor and decrease cell padding ([#589](https://github.com/Refinitiv/refinitiv-ui/issues/589)) ([31f5b57](https://github.com/Refinitiv/refinitiv-ui/commit/31f5b57df0ec2b1f1d25c9c27e0be35f8c7f3812))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [6.6.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.6.1...@refinitiv-ui/elements@6.6.2) (2023-02-14)
|
|
7
18
|
|
|
8
|
-
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **combo-box:** fix value-changed event of free text mode ([#583](https://github.com/Refinitiv/refinitiv-ui/pull/583)) ([bae20f0](https://github.com/Refinitiv/refinitiv-ui/commit/bae20f0854d9f95d8c10985f8b2c5a9619922004))
|
|
9
22
|
|
|
10
23
|
|
|
11
24
|
|
package/lib/heatmap/index.js
CHANGED
|
@@ -11,7 +11,8 @@ import '../tooltip/index.js';
|
|
|
11
11
|
import { Track } from './helpers/track.js';
|
|
12
12
|
import { blend, brighten, darken, isLight, interpolate } from './helpers/color.js';
|
|
13
13
|
import { getResponsiveFontSize, getMaximumTextWidth, MIN_FONT_SIZE } from './helpers/text.js';
|
|
14
|
-
const
|
|
14
|
+
const CELL_PADDING = 0.12;
|
|
15
|
+
const CELL_MAX_TEXT_WIDTH = 1 - CELL_PADDING;
|
|
15
16
|
const DEFAULT_CANVAS_RATIO = 0.75; // ratio — 4:3
|
|
16
17
|
/**
|
|
17
18
|
* A graphical representation of data where the individual
|
|
@@ -647,7 +648,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
647
648
|
if (!canvas) {
|
|
648
649
|
return false;
|
|
649
650
|
}
|
|
650
|
-
const fontRatio = this.responsiveHeight ? 0.
|
|
651
|
+
const fontRatio = this.responsiveHeight ? 0.4 : 0.5;
|
|
651
652
|
const fontFamily = getComputedStyle(this).fontFamily;
|
|
652
653
|
const contentWidth = this.colTrack.getContentSize(0);
|
|
653
654
|
const contentHeight = this.rowTrack.getContentSize(0);
|
|
@@ -659,12 +660,12 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
659
660
|
canvas.textAlign = 'center';
|
|
660
661
|
canvas.textBaseline = 'middle';
|
|
661
662
|
canvas.font = `${fontSize}px ${fontFamily}`;
|
|
662
|
-
let isWithinMinCellWidth = ((this.labelWidth || getMaximumTextWidth(canvas, this.cells, this.hasCellHeader)) / contentWidth)
|
|
663
|
-
//
|
|
663
|
+
let isWithinMinCellWidth = ((this.labelWidth || getMaximumTextWidth(canvas, this.cells, this.hasCellHeader)) / contentWidth) <= CELL_MAX_TEXT_WIDTH;
|
|
664
|
+
// Tries to get the largest possible font size that is within `CELL_MAX_TEXT_WIDTH`
|
|
664
665
|
if (!isWithinMinCellWidth && fontSize !== MIN_FONT_SIZE) {
|
|
665
666
|
while (!isWithinMinCellWidth) {
|
|
666
667
|
canvas.font = `${fontSize}px ${fontFamily}`; // Should assigned new font size to canvas before calculated again.
|
|
667
|
-
isWithinMinCellWidth = ((this.labelWidth || getMaximumTextWidth(canvas, this.cells, this.hasCellHeader)) / contentWidth)
|
|
668
|
+
isWithinMinCellWidth = ((this.labelWidth || getMaximumTextWidth(canvas, this.cells, this.hasCellHeader)) / contentWidth) <= CELL_MAX_TEXT_WIDTH;
|
|
668
669
|
// Stops when reaches minimum font-size
|
|
669
670
|
if (fontSize === MIN_FONT_SIZE) {
|
|
670
671
|
break;
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '6.
|
|
1
|
+
export const VERSION = '6.7.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinitiv-ui/elements",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Element Framework Elements",
|
|
5
5
|
"author": "LSEG",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -366,5 +366,5 @@
|
|
|
366
366
|
"publishConfig": {
|
|
367
367
|
"access": "public"
|
|
368
368
|
},
|
|
369
|
-
"gitHead": "
|
|
369
|
+
"gitHead": "922387ffec63d1dd6b2bf735e9e8919837be2087"
|
|
370
370
|
}
|