@refinitiv-ui/elements 7.13.2 → 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 +6 -0
- package/lib/slider/elements/slider.js +48 -18
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
|
|
6
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)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -806,20 +806,27 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
806
806
|
*/
|
|
807
807
|
updateNotifyProperty(name, value) {
|
|
808
808
|
let shouldUpdate = false;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
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
|
+
};
|
|
815
822
|
if (shouldUpdate) {
|
|
816
|
-
this[name] =
|
|
817
|
-
this.notifyPropertyChange(name,
|
|
818
|
-
}
|
|
819
|
-
else {
|
|
820
|
-
const inputName = `${name}Input`;
|
|
821
|
-
this[inputName].value = this[name];
|
|
823
|
+
this[name] = adjustValue(this.format(valueNumber));
|
|
824
|
+
this.notifyPropertyChange(name, this[name]);
|
|
822
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];
|
|
823
830
|
}
|
|
824
831
|
/**
|
|
825
832
|
* Dispatch data {value, from, to} changed event
|
|
@@ -1091,7 +1098,18 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
1091
1098
|
* @returns {void}
|
|
1092
1099
|
*/
|
|
1093
1100
|
onFromValueChange() {
|
|
1094
|
-
|
|
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)) {
|
|
1095
1113
|
this.from = this.format(this.fromNumber);
|
|
1096
1114
|
}
|
|
1097
1115
|
else {
|
|
@@ -1128,10 +1146,11 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
1128
1146
|
return false;
|
|
1129
1147
|
}
|
|
1130
1148
|
if (this.range) {
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
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) {
|
|
1135
1154
|
return false;
|
|
1136
1155
|
}
|
|
1137
1156
|
}
|
|
@@ -1142,7 +1161,18 @@ let Slider = class Slider extends FormFieldElement {
|
|
|
1142
1161
|
* @returns {void}
|
|
1143
1162
|
*/
|
|
1144
1163
|
onToValueChange() {
|
|
1145
|
-
|
|
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)) {
|
|
1146
1176
|
this.to = this.format(this.toNumber);
|
|
1147
1177
|
}
|
|
1148
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
|
}
|