@refinitiv-ui/elements 7.13.1 → 7.13.3
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/slider/elements/slider.js +54 -21
- package/lib/version.js +1 -1
- package/package.json +2 -2
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
|
+
## [7.13.3](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.13.2...@refinitiv-ui/elements@7.13.3) (2024-08-13)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **slider:** sync emitted value and input value ([#1198](https://github.com/Refinitiv/refinitiv-ui/issues/1198)) ([59099f6](https://github.com/Refinitiv/refinitiv-ui/commit/59099f619d95565f0aba2c2467056936c8b1e6bf))
|
|
11
|
+
|
|
12
|
+
## [7.13.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.13.1...@refinitiv-ui/elements@7.13.2) (2024-07-30)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **slider:** reflect to old value on empty input value ([#1195](https://github.com/Refinitiv/refinitiv-ui/issues/1195)) ([506ec73](https://github.com/Refinitiv/refinitiv-ui/commit/506ec73f8b588fbd9862497b58a7727a1adbc9f9))
|
|
17
|
+
|
|
6
18
|
## [7.13.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.13.0...@refinitiv-ui/elements@7.13.1) (2024-07-15)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
|
@@ -758,14 +758,17 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
758
758
|
if (this.readonly) {
|
|
759
759
|
return;
|
|
760
760
|
}
|
|
761
|
-
const
|
|
761
|
+
const inputEl = event.target;
|
|
762
|
+
const { value, name } = inputEl;
|
|
762
763
|
const currentData = name;
|
|
763
764
|
const previousData = `${name}Previous`;
|
|
764
|
-
if (value
|
|
765
|
+
if (!value) {
|
|
766
|
+
inputEl.value = this[currentData];
|
|
767
|
+
}
|
|
768
|
+
else if (this[currentData] !== value) {
|
|
765
769
|
this.updateNotifyProperty(currentData, value);
|
|
766
770
|
this[previousData] = value;
|
|
767
771
|
}
|
|
768
|
-
event.preventDefault();
|
|
769
772
|
}
|
|
770
773
|
/**
|
|
771
774
|
* On number-field input
|
|
@@ -803,20 +806,27 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
803
806
|
*/
|
|
804
807
|
updateNotifyProperty(name, value) {
|
|
805
808
|
let shouldUpdate = false;
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
809
|
+
const valueNumber = Number(value);
|
|
810
|
+
shouldUpdate = this.isValueInBoundary(valueNumber, name);
|
|
811
|
+
// Adjust update-pending from/to value based on min range
|
|
812
|
+
const adjustValue = (value) => {
|
|
813
|
+
const _currentValue = Number(value);
|
|
814
|
+
if (name === SliderDataName.from && _currentValue === this.toNumber) {
|
|
815
|
+
return String(_currentValue - this.minRangeNumber);
|
|
816
|
+
}
|
|
817
|
+
if (name === SliderDataName.to && _currentValue === this.fromNumber) {
|
|
818
|
+
return String(_currentValue + this.minRangeNumber);
|
|
819
|
+
}
|
|
820
|
+
return value;
|
|
821
|
+
};
|
|
812
822
|
if (shouldUpdate) {
|
|
813
|
-
this[name] =
|
|
814
|
-
this.notifyPropertyChange(name,
|
|
815
|
-
}
|
|
816
|
-
else {
|
|
817
|
-
const inputName = `${name}Input`;
|
|
818
|
-
this[inputName].value = this[name];
|
|
823
|
+
this[name] = adjustValue(this.format(valueNumber));
|
|
824
|
+
this.notifyPropertyChange(name, this[name]);
|
|
819
825
|
}
|
|
826
|
+
// Sync number field value with its component property counterpart.
|
|
827
|
+
// It's crucial especially when the value has been adjusted above.
|
|
828
|
+
const inputName = `${name}Input`;
|
|
829
|
+
this[inputName].value = this[name];
|
|
820
830
|
}
|
|
821
831
|
/**
|
|
822
832
|
* Dispatch data {value, from, to} changed event
|
|
@@ -1088,7 +1098,18 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
1088
1098
|
* @returns {void}
|
|
1089
1099
|
*/
|
|
1090
1100
|
onFromValueChange() {
|
|
1091
|
-
|
|
1101
|
+
/**
|
|
1102
|
+
* This method handles "from" value change triggered by
|
|
1103
|
+
* both user interaction and programmatic update.
|
|
1104
|
+
*
|
|
1105
|
+
* In case of user interaction update,
|
|
1106
|
+
* the value would be adjusted by min range before entering this method.
|
|
1107
|
+
* That adjustment needs to be reverted.
|
|
1108
|
+
*
|
|
1109
|
+
* In case of programmatic value update,
|
|
1110
|
+
* This method could handle the revert although there is no prior adjustment.
|
|
1111
|
+
*/
|
|
1112
|
+
if (this.isValueInBoundary(this.fromNumber + this.minRangeNumber, SliderDataName.from)) {
|
|
1092
1113
|
this.from = this.format(this.fromNumber);
|
|
1093
1114
|
}
|
|
1094
1115
|
else {
|
|
@@ -1125,10 +1146,11 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
1125
1146
|
return false;
|
|
1126
1147
|
}
|
|
1127
1148
|
if (this.range) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1149
|
+
const isFromOutOfBound = valueFor === SliderDataName.from &&
|
|
1150
|
+
(value > this.toNumber || (this.minRangeNumber > 0 && value >= this.toNumber));
|
|
1151
|
+
const isToOutOfBound = valueFor === SliderDataName.to &&
|
|
1152
|
+
(value < this.fromNumber || (this.minRangeNumber > 0 && value <= this.fromNumber));
|
|
1153
|
+
if (isFromOutOfBound || isToOutOfBound) {
|
|
1132
1154
|
return false;
|
|
1133
1155
|
}
|
|
1134
1156
|
}
|
|
@@ -1139,7 +1161,18 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
1139
1161
|
* @returns {void}
|
|
1140
1162
|
*/
|
|
1141
1163
|
onToValueChange() {
|
|
1142
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* This method handles "to" value change triggered by
|
|
1166
|
+
* both user interaction and programmatic update.
|
|
1167
|
+
*
|
|
1168
|
+
* In case of user interaction update,
|
|
1169
|
+
* the value would be adjusted by min range before entering this method.
|
|
1170
|
+
* That adjustment needs to be reverted.
|
|
1171
|
+
*
|
|
1172
|
+
* In case of programmatic value update,
|
|
1173
|
+
* This method could handle the revert although there is no prior adjustment.
|
|
1174
|
+
*/
|
|
1175
|
+
if (this.isValueInBoundary(this.toNumber - this.minRangeNumber, SliderDataName.to)) {
|
|
1143
1176
|
this.to = this.format(this.toNumber);
|
|
1144
1177
|
}
|
|
1145
1178
|
else {
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '7.13.
|
|
1
|
+
export const VERSION = '7.13.3';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinitiv-ui/elements",
|
|
3
|
-
"version": "7.13.
|
|
3
|
+
"version": "7.13.3",
|
|
4
4
|
"description": "Element Framework Elements",
|
|
5
5
|
"author": "LSEG",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -373,5 +373,5 @@
|
|
|
373
373
|
"publishConfig": {
|
|
374
374
|
"access": "public"
|
|
375
375
|
},
|
|
376
|
-
"gitHead": "
|
|
376
|
+
"gitHead": "80088aed35c12857c850127ce3a3fad421c3445a"
|
|
377
377
|
}
|