@refinitiv-ui/elements 6.8.5 → 6.8.6
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 +12 -0
- package/lib/calendar/index.js +2 -6
- package/lib/flag/index.d.ts +5 -0
- package/lib/flag/index.js +9 -1
- package/lib/icon/index.d.ts +5 -0
- package/lib/icon/index.js +9 -1
- package/lib/number-field/index.d.ts +6 -0
- package/lib/number-field/index.js +25 -1
- package/lib/version.js +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.8.6](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.5...@refinitiv-ui/elements@6.8.6) (2023-06-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **calendar, datetime-picker:** prevent deselect date on calendar ([#735](https://github.com/Refinitiv/refinitiv-ui/issues/735)) ([4b0799a](https://github.com/Refinitiv/refinitiv-ui/commit/4b0799a19725cba456fa41be35de24b79df466c5))
|
|
12
|
+
* **number-field:** fix Floating point Division on validate method ([#757](https://github.com/Refinitiv/refinitiv-ui/issues/757)) ([a7095ae](https://github.com/Refinitiv/refinitiv-ui/commit/a7095ae861e0948f95cc73ac68d31eb5585a54a6))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [6.8.5](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.4...@refinitiv-ui/elements@6.8.5) (2023-06-08)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @refinitiv-ui/elements
|
package/lib/calendar/index.js
CHANGED
|
@@ -795,16 +795,12 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
795
795
|
values = [value];
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
else if (this.values.indexOf(value) === -1) {
|
|
799
|
-
values = [value];
|
|
800
|
-
}
|
|
801
798
|
else {
|
|
802
|
-
|
|
803
|
-
values = [];
|
|
799
|
+
values = [value];
|
|
804
800
|
}
|
|
805
801
|
}
|
|
806
802
|
else {
|
|
807
|
-
values =
|
|
803
|
+
values = [value];
|
|
808
804
|
}
|
|
809
805
|
this.notifyValuesChange(values);
|
|
810
806
|
}
|
package/lib/flag/index.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export declare class Flag extends BasicElement {
|
|
|
29
29
|
*/
|
|
30
30
|
get flag(): string | null;
|
|
31
31
|
set flag(value: string | null);
|
|
32
|
+
/**
|
|
33
|
+
* Deprecation noticed, used to display a warning message
|
|
34
|
+
* when deprecated features are used.
|
|
35
|
+
*/
|
|
36
|
+
private deprecationNotice;
|
|
32
37
|
private _src;
|
|
33
38
|
/**
|
|
34
39
|
* Src location of an svg flag.
|
package/lib/flag/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { BasicElement, svg, css } from '@refinitiv-ui/core';
|
|
2
|
+
import { BasicElement, svg, css, DeprecationNotice } 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 { unsafeHTML } from '@refinitiv-ui/core/directives/unsafe-html.js';
|
|
@@ -18,6 +18,11 @@ let Flag = class Flag extends BasicElement {
|
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this._flag = null;
|
|
21
|
+
/**
|
|
22
|
+
* Deprecation noticed, used to display a warning message
|
|
23
|
+
* when deprecated features are used.
|
|
24
|
+
*/
|
|
25
|
+
this.deprecationNotice = new DeprecationNotice('`src` attribute and property are deprecated. Use `flag` for attribute and property instead.');
|
|
21
26
|
this._src = null;
|
|
22
27
|
this._template = EmptyTemplate;
|
|
23
28
|
}
|
|
@@ -80,6 +85,9 @@ let Flag = class Flag extends BasicElement {
|
|
|
80
85
|
void this.loadAndRenderFlag(value);
|
|
81
86
|
}
|
|
82
87
|
}
|
|
88
|
+
if (value && !this.flag) {
|
|
89
|
+
this.deprecationNotice.once();
|
|
90
|
+
}
|
|
83
91
|
}
|
|
84
92
|
/**
|
|
85
93
|
* The flag template to render
|
package/lib/icon/index.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ export declare class Icon extends BasicElement {
|
|
|
28
28
|
*/
|
|
29
29
|
get icon(): string | null;
|
|
30
30
|
set icon(value: string | null);
|
|
31
|
+
/**
|
|
32
|
+
* Deprecation noticed, used to display a warning message
|
|
33
|
+
* when deprecated features are used.
|
|
34
|
+
*/
|
|
35
|
+
private deprecationNotice;
|
|
31
36
|
private _src;
|
|
32
37
|
/**
|
|
33
38
|
* Src location of an svg icon.
|
package/lib/icon/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { BasicElement, svg, css } from '@refinitiv-ui/core';
|
|
2
|
+
import { BasicElement, svg, css, DeprecationNotice } 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 { unsafeSVG } from '@refinitiv-ui/core/directives/unsafe-svg.js';
|
|
@@ -19,6 +19,11 @@ let Icon = class Icon extends BasicElement {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
21
|
this._icon = null;
|
|
22
|
+
/**
|
|
23
|
+
* Deprecation noticed, used to display a warning message
|
|
24
|
+
* when deprecated features are used.
|
|
25
|
+
*/
|
|
26
|
+
this.deprecationNotice = new DeprecationNotice('`src` attribute and property are deprecated. Use `icon` for attribute and property instead.');
|
|
22
27
|
this._src = null;
|
|
23
28
|
this._template = EmptyTemplate;
|
|
24
29
|
}
|
|
@@ -85,6 +90,9 @@ let Icon = class Icon extends BasicElement {
|
|
|
85
90
|
void this.loadAndRenderIcon(value);
|
|
86
91
|
}
|
|
87
92
|
}
|
|
93
|
+
if (value && !this.icon) {
|
|
94
|
+
this.deprecationNotice.once();
|
|
95
|
+
}
|
|
88
96
|
}
|
|
89
97
|
/**
|
|
90
98
|
* The icon template to render
|
|
@@ -216,6 +216,12 @@ export declare class NumberField extends FormFieldElement {
|
|
|
216
216
|
* @returns step base
|
|
217
217
|
*/
|
|
218
218
|
private get stepBase();
|
|
219
|
+
/**
|
|
220
|
+
* Count precision number
|
|
221
|
+
* @param number value to count
|
|
222
|
+
* @returns precision number
|
|
223
|
+
*/
|
|
224
|
+
private getPrecision;
|
|
219
225
|
/**
|
|
220
226
|
* Check if value subtracted from the step base is not an integral multiple of the allowed value step
|
|
221
227
|
* @param value value to check
|
|
@@ -449,6 +449,25 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
449
449
|
}
|
|
450
450
|
return 0;
|
|
451
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* Count precision number
|
|
454
|
+
* @param number value to count
|
|
455
|
+
* @returns precision number
|
|
456
|
+
*/
|
|
457
|
+
getPrecision(number) {
|
|
458
|
+
const getDecimalPrecision = (number) => {
|
|
459
|
+
const [wholeNumber, decimalNumber] = number.split('.');
|
|
460
|
+
return (wholeNumber.length ?? 0) + (decimalNumber?.length ?? 0);
|
|
461
|
+
};
|
|
462
|
+
const numberString = number.toString();
|
|
463
|
+
// Check if the number is in exponential notation.
|
|
464
|
+
if (numberString.includes('e')) {
|
|
465
|
+
const [mantissa, exponent] = numberString.split('e');
|
|
466
|
+
const precision = getDecimalPrecision(mantissa) + Math.abs(Number(exponent));
|
|
467
|
+
return precision;
|
|
468
|
+
}
|
|
469
|
+
return getDecimalPrecision(numberString);
|
|
470
|
+
}
|
|
452
471
|
/**
|
|
453
472
|
* Check if value subtracted from the step base is not an integral multiple of the allowed value step
|
|
454
473
|
* @param value value to check
|
|
@@ -459,7 +478,12 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
459
478
|
return true;
|
|
460
479
|
}
|
|
461
480
|
const decimals = Math.max(this.getDecimalPlace(value), this.stepDecimals);
|
|
462
|
-
const
|
|
481
|
+
const dividend = this.stepBase - value;
|
|
482
|
+
const divisor = this.getAllowedValueStep();
|
|
483
|
+
// calculate precision to prevent Floating point precision issue.
|
|
484
|
+
// e.g. 1111111/0.00001 would not result in 111111100000 as expected.
|
|
485
|
+
const precision = this.getPrecision(dividend) + this.getPrecision(divisor);
|
|
486
|
+
const division = parseFloat((dividend / divisor).toPrecision(precision));
|
|
463
487
|
const number = decimals ? this.toFixedNumber(division, decimals) : division;
|
|
464
488
|
// (2 - 1.01) % 0.33 needs to give 0. So we cannot use % directly as it is intended for integers
|
|
465
489
|
return number % 1 === 0;
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '6.8.
|
|
1
|
+
export const VERSION = '6.8.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinitiv-ui/elements",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.6",
|
|
4
4
|
"description": "Element Framework Elements",
|
|
5
5
|
"author": "LSEG",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -349,24 +349,24 @@
|
|
|
349
349
|
"tslib": "^2.3.1"
|
|
350
350
|
},
|
|
351
351
|
"devDependencies": {
|
|
352
|
-
"@refinitiv-ui/core": "^6.4.
|
|
353
|
-
"@refinitiv-ui/demo-block": "^6.1.
|
|
352
|
+
"@refinitiv-ui/core": "^6.4.4",
|
|
353
|
+
"@refinitiv-ui/demo-block": "^6.1.5",
|
|
354
354
|
"@refinitiv-ui/i18n": "^6.0.13",
|
|
355
355
|
"@refinitiv-ui/phrasebook": "^6.3.2",
|
|
356
356
|
"@refinitiv-ui/test-helpers": "^6.0.10",
|
|
357
|
-
"@refinitiv-ui/translate": "^6.0.
|
|
358
|
-
"@refinitiv-ui/utils": "^6.2.
|
|
357
|
+
"@refinitiv-ui/translate": "^6.0.22",
|
|
358
|
+
"@refinitiv-ui/utils": "^6.2.5",
|
|
359
359
|
"@types/d3-interpolate": "^3.0.1"
|
|
360
360
|
},
|
|
361
361
|
"peerDependencies": {
|
|
362
|
-
"@refinitiv-ui/core": "^6.4.
|
|
362
|
+
"@refinitiv-ui/core": "^6.4.4",
|
|
363
363
|
"@refinitiv-ui/i18n": "^6.0.13",
|
|
364
364
|
"@refinitiv-ui/phrasebook": "^6.3.2",
|
|
365
|
-
"@refinitiv-ui/translate": "^6.0.
|
|
366
|
-
"@refinitiv-ui/utils": "^6.2.
|
|
365
|
+
"@refinitiv-ui/translate": "^6.0.22",
|
|
366
|
+
"@refinitiv-ui/utils": "^6.2.5"
|
|
367
367
|
},
|
|
368
368
|
"publishConfig": {
|
|
369
369
|
"access": "public"
|
|
370
370
|
},
|
|
371
|
-
"gitHead": "
|
|
371
|
+
"gitHead": "67e77dd42b2f6bba345440cd122ef5d733455661"
|
|
372
372
|
}
|