@jetbrains/ring-ui 5.0.109 → 5.0.111
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/components/list/list.js
CHANGED
|
@@ -46,6 +46,9 @@ const nonActivatableTypes = [
|
|
|
46
46
|
function isActivatable(item) {
|
|
47
47
|
return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
|
|
48
48
|
}
|
|
49
|
+
function getDataHash(data) {
|
|
50
|
+
return data.map(it => it.key).join('-');
|
|
51
|
+
}
|
|
49
52
|
const shouldActivateFirstItem = (props) => props.activateFirstItem ||
|
|
50
53
|
props.activateSingleItem && props.data.length === 1;
|
|
51
54
|
export const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
|
|
@@ -158,7 +161,7 @@ export default class List extends Component {
|
|
|
158
161
|
this.virtualizedList.recomputeRowHeights();
|
|
159
162
|
}
|
|
160
163
|
if (this.props.activeIndex == null &&
|
|
161
|
-
this.props.data !== prevProps.data &&
|
|
164
|
+
getDataHash(this.props.data) !== getDataHash(prevProps.data) &&
|
|
162
165
|
shouldActivateFirstItem(this.props)) {
|
|
163
166
|
this.activateFirst();
|
|
164
167
|
}
|
|
@@ -360,6 +360,23 @@ export default class QueryAssist extends Component {
|
|
|
360
360
|
if (this.isComposing) {
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
+
if (this.state.query) {
|
|
364
|
+
let i = 0;
|
|
365
|
+
while (this.state.query[i] === this.immediateState.query[i] && i < this.state.query.length - 1) {
|
|
366
|
+
i++;
|
|
367
|
+
}
|
|
368
|
+
const diff = this.immediateState.query.length - this.state.query.length;
|
|
369
|
+
const originalIndex = this.immediateState.caret - diff;
|
|
370
|
+
const ranges = [...this.state.styleRanges ?? []];
|
|
371
|
+
const range = ranges.
|
|
372
|
+
find(r => originalIndex >= r.start && originalIndex <= r.start + r.length);
|
|
373
|
+
if (range) {
|
|
374
|
+
range.length += diff;
|
|
375
|
+
}
|
|
376
|
+
ranges.filter(r => r.start > originalIndex).forEach(r => {
|
|
377
|
+
r.start += diff;
|
|
378
|
+
});
|
|
379
|
+
}
|
|
363
380
|
this.immediateState = props;
|
|
364
381
|
this.props.onChange(props);
|
|
365
382
|
if (this.props.autoOpen === 'force' || props.query.length > 0) {
|
package/dist/list/list.js
CHANGED
|
@@ -63,6 +63,9 @@ const nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
|
|
|
63
63
|
function isActivatable(item) {
|
|
64
64
|
return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
|
|
65
65
|
}
|
|
66
|
+
function getDataHash(data) {
|
|
67
|
+
return data.map(it => it.key).join('-');
|
|
68
|
+
}
|
|
66
69
|
const shouldActivateFirstItem = props => props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
|
|
67
70
|
const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
|
|
68
71
|
/**
|
|
@@ -468,7 +471,7 @@ class List extends Component {
|
|
|
468
471
|
if (this.virtualizedList && prevProps.data !== this.props.data) {
|
|
469
472
|
this.virtualizedList.recomputeRowHeights();
|
|
470
473
|
}
|
|
471
|
-
if (this.props.activeIndex == null && this.props.data !== prevProps.data && shouldActivateFirstItem(this.props)) {
|
|
474
|
+
if (this.props.activeIndex == null && getDataHash(this.props.data) !== getDataHash(prevProps.data) && shouldActivateFirstItem(this.props)) {
|
|
472
475
|
this.activateFirst();
|
|
473
476
|
}
|
|
474
477
|
this.checkOverflow();
|
|
@@ -225,6 +225,23 @@ class QueryAssist extends Component {
|
|
|
225
225
|
if (this.isComposing) {
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
+
if (this.state.query) {
|
|
229
|
+
var _this$state$styleRang;
|
|
230
|
+
let i = 0;
|
|
231
|
+
while (this.state.query[i] === this.immediateState.query[i] && i < this.state.query.length - 1) {
|
|
232
|
+
i++;
|
|
233
|
+
}
|
|
234
|
+
const diff = this.immediateState.query.length - this.state.query.length;
|
|
235
|
+
const originalIndex = this.immediateState.caret - diff;
|
|
236
|
+
const ranges = [...((_this$state$styleRang = this.state.styleRanges) !== null && _this$state$styleRang !== void 0 ? _this$state$styleRang : [])];
|
|
237
|
+
const range = ranges.find(r => originalIndex >= r.start && originalIndex <= r.start + r.length);
|
|
238
|
+
if (range) {
|
|
239
|
+
range.length += diff;
|
|
240
|
+
}
|
|
241
|
+
ranges.filter(r => r.start > originalIndex).forEach(r => {
|
|
242
|
+
r.start += diff;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
228
245
|
this.immediateState = props;
|
|
229
246
|
this.props.onChange(props);
|
|
230
247
|
if (this.props.autoOpen === 'force' || props.query.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.111",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@types/chai-dom": "0.0.10",
|
|
105
105
|
"@types/chai-enzyme": "^0.6.8",
|
|
106
106
|
"@types/enzyme": "^3.10.12",
|
|
107
|
-
"@types/react": "^18.0.
|
|
107
|
+
"@types/react": "^18.0.28",
|
|
108
108
|
"@types/react-dom": "^18.0.10",
|
|
109
109
|
"@types/sinon": "^10.0.13",
|
|
110
110
|
"@types/sinon-chai": "^3.2.9",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"core-js": "^3.27.2",
|
|
126
126
|
"cpy-cli": "^3.1.1",
|
|
127
127
|
"enzyme": "^3.11.0",
|
|
128
|
-
"eslint": "^8.
|
|
128
|
+
"eslint": "^8.34.0",
|
|
129
129
|
"eslint-import-resolver-webpack": "^0.13.2",
|
|
130
130
|
"eslint-plugin-angular": "^4.1.0",
|
|
131
131
|
"eslint-plugin-bdd": "^2.1.1",
|
|
@@ -151,21 +151,21 @@
|
|
|
151
151
|
"merge-options": "^3.0.4",
|
|
152
152
|
"mocha": "^10.2.0",
|
|
153
153
|
"pinst": "^3.0.0",
|
|
154
|
-
"puppeteer": "^19.
|
|
154
|
+
"puppeteer": "^19.7.0",
|
|
155
155
|
"raw-loader": "^4.0.2",
|
|
156
156
|
"react": "^18.2.0",
|
|
157
157
|
"react-dom": "^18.2.0",
|
|
158
158
|
"react-test-renderer": "^18.2.0",
|
|
159
159
|
"regenerator-runtime": "^0.13.11",
|
|
160
160
|
"rimraf": "^4.1.2",
|
|
161
|
-
"rollup": "^3.
|
|
161
|
+
"rollup": "^3.15.0",
|
|
162
162
|
"rollup-plugin-clear": "^2.0.7",
|
|
163
163
|
"rollup-plugin-styles": "^4.0.0",
|
|
164
164
|
"sinon": "^15.0.1",
|
|
165
165
|
"sinon-chai": "^3.7.0",
|
|
166
166
|
"storage-mock": "^2.1.0",
|
|
167
167
|
"storybook-addon-themes": "^6.1.0",
|
|
168
|
-
"stylelint": "^
|
|
168
|
+
"stylelint": "^15.1.0",
|
|
169
169
|
"svg-inline-loader": "^0.8.2",
|
|
170
170
|
"teamcity-service-messages": "^0.1.14",
|
|
171
171
|
"terser-webpack-plugin": "^5.3.6",
|