@refinitiv-ui/elements 7.13.2 → 7.13.4

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,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.4](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.13.3...@refinitiv-ui/elements@7.13.4) (2024-08-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **tree-select:** fix item interface doesn't sync with values ([#1206](https://github.com/Refinitiv/refinitiv-ui/issues/1206)) ([9691ff6](https://github.com/Refinitiv/refinitiv-ui/commit/9691ff6608f99af7ea47121c3f9325ea35b05e12))
11
+
12
+ ## [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)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **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))
17
+
6
18
  ## [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
19
 
8
20
  ### 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
- if (name === SliderDataName.to) {
810
- shouldUpdate = this.isValueInBoundary(Number(value), SliderDataName.to);
811
- }
812
- else {
813
- shouldUpdate = this.isValueInBoundary(Number(value), '');
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] = value;
817
- this.notifyPropertyChange(name, value);
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
- if (this.isValueInBoundary(this.fromNumber, SliderDataName.from)) {
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
- if (valueFor === SliderDataName.to && value < this.fromNumber + this.minRangeNumber) {
1132
- return false;
1133
- }
1134
- else if (valueFor === SliderDataName.from && value > this.toNumber - this.minRangeNumber) {
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
- if (this.isValueInBoundary(this.toNumber, SliderDataName.to)) {
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 {
@@ -116,6 +116,12 @@ export declare class TreeSelect extends ComboBox<TreeSelectDataItem> {
116
116
  */
117
117
  get values(): string[];
118
118
  set values(values: string[]);
119
+ /**
120
+ * Update composer values.
121
+ * @param newValues new values
122
+ * @returns {void}
123
+ */
124
+ protected updateComposerValues(newValues: string[]): void;
119
125
  /**
120
126
  * Renderer used to render tree item elements
121
127
  */
@@ -199,6 +199,28 @@ let TreeSelect = class TreeSelect extends ComboBox {
199
199
  this.requestUpdate('values', oldValues);
200
200
  }
201
201
  }
202
+ /**
203
+ * Update composer values.
204
+ * @param newValues new values
205
+ * @returns {void}
206
+ */
207
+ updateComposerValues(newValues) {
208
+ for (const item of this.treeManager.checkedItems) {
209
+ this.treeManager.uncheckItem(item);
210
+ }
211
+ const selectedItems = this.queryItems((item, composer) => {
212
+ return newValues.includes(composer.getItemPropertyValue(item, 'value') ?? '');
213
+ });
214
+ const sortedSelectedItem = [];
215
+ for (const item of selectedItems) {
216
+ const value = this.composer.getItemPropertyValue(item, 'value') ?? '';
217
+ const index = newValues.indexOf(value);
218
+ sortedSelectedItem[index] = item;
219
+ }
220
+ for (const item of sortedSelectedItem) {
221
+ this.treeManager.checkItem(item);
222
+ }
223
+ }
202
224
  /**
203
225
  * Set maximum number of selected items
204
226
  * @param value max value
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.13.2';
1
+ export const VERSION = '7.13.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "7.13.2",
3
+ "version": "7.13.4",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "LSEG",
6
6
  "license": "Apache-2.0",
@@ -353,25 +353,25 @@
353
353
  "tslib": "^2.3.1"
354
354
  },
355
355
  "devDependencies": {
356
- "@refinitiv-ui/core": "^7.5.0",
357
- "@refinitiv-ui/demo-block": "^7.1.14",
358
- "@refinitiv-ui/i18n": "^7.1.4",
356
+ "@refinitiv-ui/core": "^7.5.1",
357
+ "@refinitiv-ui/demo-block": "^7.1.15",
358
+ "@refinitiv-ui/i18n": "^7.1.5",
359
359
  "@refinitiv-ui/phrasebook": "^7.1.1",
360
- "@refinitiv-ui/test-helpers": "^7.1.1",
361
- "@refinitiv-ui/translate": "^7.1.8",
360
+ "@refinitiv-ui/test-helpers": "^7.1.2",
361
+ "@refinitiv-ui/translate": "^7.1.9",
362
362
  "@refinitiv-ui/utils": "^7.3.0",
363
363
  "@types/d3-interpolate": "^3.0.1"
364
364
  },
365
365
  "peerDependencies": {
366
366
  "@refinitiv-ui/browser-sparkline": "^1.0.0 || ^2.0.0",
367
- "@refinitiv-ui/core": "^7.5.0",
368
- "@refinitiv-ui/i18n": "^7.1.4",
367
+ "@refinitiv-ui/core": "^7.5.1",
368
+ "@refinitiv-ui/i18n": "^7.1.5",
369
369
  "@refinitiv-ui/phrasebook": "^7.1.1",
370
- "@refinitiv-ui/translate": "^7.1.8",
370
+ "@refinitiv-ui/translate": "^7.1.9",
371
371
  "@refinitiv-ui/utils": "^7.3.0"
372
372
  },
373
373
  "publishConfig": {
374
374
  "access": "public"
375
375
  },
376
- "gitHead": "73f95529865ca81cce75efbe496d7e4b37e5d67a"
376
+ "gitHead": "8055e563e6634f16068e6752a63cf6237e2e47e6"
377
377
  }