@refinitiv-ui/elements 6.10.0 → 6.10.2

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 CHANGED
@@ -3,6 +3,19 @@
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.10.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.10.1...@refinitiv-ui/elements@6.10.2) (2023-09-04)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **number-field:** stepUp/stepDown not fire input event ([#925](https://github.com/Refinitiv/refinitiv-ui/issues/925)) ([cb2b994](https://github.com/Refinitiv/refinitiv-ui/commit/cb2b994dbdb0adf520f95f2a1239eab55024106f))
11
+
12
+ ## [6.10.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.10.0...@refinitiv-ui/elements@6.10.1) (2023-08-28)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **slider:** display and initial to value incorrectly ([#914](https://github.com/Refinitiv/refinitiv-ui/issues/914)) ([f1964db](https://github.com/Refinitiv/refinitiv-ui/commit/f1964dbb42721ca84efe4c79014b43573a289a11))
17
+ - **slider:** page freeze when from/to overflow max value ([#920](https://github.com/Refinitiv/refinitiv-ui/issues/920)) ([efa8314](https://github.com/Refinitiv/refinitiv-ui/commit/efa8314cda00e3a1c4d31bb24e50e46b835ba95d))
18
+
6
19
  # [6.10.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.9.2...@refinitiv-ui/elements@6.10.0) (2023-08-21)
7
20
 
8
21
  ### Bug Fixes
@@ -158,6 +158,9 @@
158
158
  {
159
159
  "name": "error-changed",
160
160
  "description": "Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically."
161
+ },
162
+ {
163
+ "name": "input"
161
164
  }
162
165
  ],
163
166
  "methods": [
@@ -33,4 +33,5 @@ Form control element for numbers.
33
33
  | Event | Description |
34
34
  |-----------------|--------------------------------------------------|
35
35
  | `error-changed` | Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically. |
36
+ | `input` | |
36
37
  | `value-changed` | Fired when user commits a value change. The event is not triggered if `value` property is changed programmatically. |
@@ -278,6 +278,7 @@ let NumberField = class NumberField extends FormFieldElement {
278
278
  onApplyStep(direction) {
279
279
  try {
280
280
  this.applyStepDirection(direction);
281
+ this.dispatchEvent(new InputEvent('input'));
281
282
  this.setSilentlyValueAndNotify();
282
283
  }
283
284
  catch (error) {
@@ -445,8 +445,8 @@ let Slider = class Slider extends ControlElement {
445
445
  }
446
446
  }
447
447
  else {
448
- this.from = clamp(this.fromNumber || this.minNumber, this.minNumber, this.toNumber);
449
- this.to = clamp(this.toNumber || this.maxNumber, this.fromNumber, this.maxNumber);
448
+ this.from = clamp(this.fromNumber, this.minNumber, this.toNumber);
449
+ this.to = clamp(this.toNumber, this.fromNumber, this.maxNumber);
450
450
  }
451
451
  }
452
452
  else {
@@ -966,10 +966,8 @@ let Slider = class Slider extends ControlElement {
966
966
  }
967
967
  else {
968
968
  // if value is outside boundary, set to boundary
969
- if (this.fromNumber < this.minNumber) {
970
- this.from = this.min;
971
- }
972
- else if (this.fromNumber > this.toNumber) {
969
+ this.from = clamp(this.fromNumber, this.minNumber, this.maxNumber);
970
+ if (this.fromNumber > this.toNumber) {
973
971
  this.from = this.to;
974
972
  }
975
973
  if (this.minRangeNumber) {
@@ -991,24 +989,19 @@ let Slider = class Slider extends ControlElement {
991
989
  * @returns true if value and step inside a boundary
992
990
  */
993
991
  isValueInBoundary(value, valueFor) {
994
- if (this.minNumber < this.maxNumber) {
995
- // Check if value is in range
996
- if (this.range) {
997
- if (valueFor === SliderDataName.to) {
998
- if (value < this.fromNumber + this.minRangeNumber || value > this.maxNumber) {
999
- return false;
1000
- }
1001
- }
1002
- else if (value < this.minNumber || value > this.toNumber - this.minRangeNumber) {
1003
- return false;
1004
- }
1005
- }
1006
- else if (value < this.minNumber || value > this.maxNumber) {
992
+ if (this.minNumber > this.maxNumber) {
993
+ return false;
994
+ }
995
+ // Check if value is in range
996
+ if (value < this.minNumber || value > this.maxNumber) {
997
+ return false;
998
+ }
999
+ if (this.range) {
1000
+ if (valueFor === SliderDataName.to && value < this.fromNumber + this.minRangeNumber) {
1007
1001
  return false;
1008
1002
  }
1009
- // check step min and max in range
1010
- if (this.stepRange < this.minNumber || this.stepRange > this.maxNumber) {
1011
- return true;
1003
+ else if (value > this.toNumber - this.minRangeNumber) {
1004
+ return false;
1012
1005
  }
1013
1006
  }
1014
1007
  return true;
@@ -1023,12 +1016,10 @@ let Slider = class Slider extends ControlElement {
1023
1016
  }
1024
1017
  else {
1025
1018
  // if value is outside boundary, set to boundary
1019
+ this.to = clamp(this.toNumber, this.minNumber, this.maxNumber);
1026
1020
  if (this.toNumber < this.fromNumber) {
1027
1021
  this.to = this.from;
1028
1022
  }
1029
- else if (this.toNumber > this.maxNumber) {
1030
- this.to = this.max;
1031
- }
1032
1023
  if (this.minRangeNumber) {
1033
1024
  const distanceFromTo = Math.abs(this.toNumber - this.fromNumber);
1034
1025
  const distanceMax = this.fromNumber + this.minRangeNumber;
@@ -1055,9 +1046,8 @@ let Slider = class Slider extends ControlElement {
1055
1046
  onMinRangeChange() {
1056
1047
  const valueMinRange = Math.abs(this.minRangeNumber);
1057
1048
  const maximumRangeMinMax = Math.abs(this.maxNumber - this.minNumber);
1058
- const maximumRangeFromTo = Math.abs(this.toNumber - this.fromNumber);
1059
1049
  if (valueMinRange && valueMinRange >= this.stepNumber) {
1060
- if (valueMinRange <= maximumRangeMinMax && valueMinRange <= maximumRangeFromTo) {
1050
+ if (valueMinRange <= maximumRangeMinMax) {
1061
1051
  this.minRange = valueMinRange.toString();
1062
1052
  }
1063
1053
  else {
@@ -1201,8 +1191,8 @@ let Slider = class Slider extends ControlElement {
1201
1191
  */
1202
1192
  renderThumb(from, to) {
1203
1193
  return html `
1204
- ${this.thumbTemplate(from, this.calculatePosition(from), to ? SliderDataName.from : SliderDataName.value)}
1205
- ${to && this.thumbTemplate(to, this.calculatePosition(to), SliderDataName.to)}
1194
+ ${this.thumbTemplate(from, this.calculatePosition(from), to !== undefined ? SliderDataName.from : SliderDataName.value)}
1195
+ ${to !== undefined ? this.thumbTemplate(to, this.calculatePosition(to), SliderDataName.to) : nothing}
1206
1196
  `;
1207
1197
  }
1208
1198
  /**
@@ -1223,7 +1213,6 @@ let Slider = class Slider extends ControlElement {
1223
1213
  @blur=${this.onNumberFieldBlur}
1224
1214
  @keydown=${this.onNumberFieldKeyDown}
1225
1215
  @input=${this.onNumberFieldInput}
1226
- @value-changed=${this.onNumberFieldInput}
1227
1216
  part="input"
1228
1217
  name="${name}"
1229
1218
  no-spinner
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '6.10.0';
1
+ export const VERSION = '6.10.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "6.10.0",
3
+ "version": "6.10.2",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "Refinitiv",
6
6
  "license": "Apache-2.0",
@@ -369,5 +369,5 @@
369
369
  "publishConfig": {
370
370
  "access": "public"
371
371
  },
372
- "gitHead": "5df63d07a3a62aa3b4bb613a67f533a053eca260"
372
+ "gitHead": "298203ce6b7e4ba226af85183213a0d2da350aa5"
373
373
  }