@jetbrains/ring-ui 4.1.25 → 4.1.28

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.
@@ -4,7 +4,7 @@
4
4
  * @constructor
5
5
  */
6
6
  export default class AnalyticsGAPlugin {
7
- constructor(gaId, isDevelopment, domain) {
7
+ constructor(gaId, isDevelopment, domain, cookielessUserIdentifier) {
8
8
  if (!gaId && !isDevelopment) {
9
9
  return;
10
10
  }
@@ -25,8 +25,16 @@ export default class AnalyticsGAPlugin {
25
25
  */
26
26
  const key = gaId || 'UA-57284711-1';
27
27
  /* global ga */
28
- const gaCookieParams = domain ? {cookieDomain: domain} : {};
29
- ga('create', key, (!gaId ? {cookieDomain: 'none'} : gaCookieParams));
28
+ if (cookielessUserIdentifier) {
29
+ ga('create', key, {
30
+ storage: 'none',
31
+ clientId: cookielessUserIdentifier
32
+ });
33
+ } else {
34
+ const gaCookieParams = domain ? {cookieDomain: domain} : {};
35
+ ga('create', key, (!gaId ? {cookieDomain: 'none'} : gaCookieParams));
36
+ }
37
+
30
38
  ga('set', 'anonymizeIp', true);
31
39
  ga('set', 'allowAdFeatures', false);
32
40
  }
@@ -171,27 +171,25 @@ export default class List extends Component {
171
171
  }
172
172
  }
173
173
 
174
- if (
175
- activeIndex == null &&
176
- prevState.activeIndex == null &&
177
- shouldActivateFirstItem(nextProps)
178
- ) {
174
+ return nextState;
175
+ }
176
+
177
+ componentDidMount() {
178
+ document.addEventListener('mousemove', this.onDocumentMouseMove);
179
+ document.addEventListener('keydown', this.onDocumentKeyDown, true);
180
+
181
+ const {data, activeIndex} = this.props;
182
+
183
+ if (activeIndex == null && shouldActivateFirstItem(this.props)) {
179
184
  const firstActivatableIndex = data.findIndex(isActivatable);
180
185
  if (firstActivatableIndex >= 0) {
181
- Object.assign(nextState, {
186
+ this.setState({
182
187
  activeIndex: firstActivatableIndex,
183
188
  activeItem: data[firstActivatableIndex],
184
189
  needScrollToActive: true
185
190
  });
186
191
  }
187
192
  }
188
-
189
- return nextState;
190
- }
191
-
192
- componentDidMount() {
193
- document.addEventListener('mousemove', this.onDocumentMouseMove);
194
- document.addEventListener('keydown', this.onDocumentKeyDown, true);
195
193
  }
196
194
 
197
195
  shouldComponentUpdate(nextProps, nextState) {
@@ -386,6 +386,10 @@ export default class Select extends Component {
386
386
  nextState.selected = Select._getEmptyValue(multiple);
387
387
  }
388
388
 
389
+ if (multiple && !nextState.selected) {
390
+ nextState.selected = prevState.selected;
391
+ }
392
+
389
393
  const {selected} = {...prevState, ...nextState};
390
394
  if (selected && multiple) {
391
395
  nextState.multipleMap = buildMultipleMap(selected);
@@ -29,10 +29,13 @@ class SmartTable extends PureComponent {
29
29
  };
30
30
 
31
31
  UNSAFE_componentWillReceiveProps(nextProps) {
32
- const {data, isItemSelectable} = nextProps;
33
- if (this.props.data !== data || this.props.isItemSelectable !== isItemSelectable) {
34
- const selection = new Selection({data, isItemSelectable});
32
+ const {data, isItemSelectable, selection} = nextProps;
33
+ if (this.props.remoteSelection && this.props.selection !== selection) {
35
34
  this.setState({selection});
35
+ } else if (this.props.data !== data || this.props.isItemSelectable !== isItemSelectable) {
36
+ this.setState({
37
+ selection: new Selection({data, isItemSelectable})
38
+ });
36
39
  }
37
40
  }
38
41
 
@@ -4,7 +4,7 @@
4
4
  * @constructor
5
5
  */
6
6
  class AnalyticsGAPlugin {
7
- constructor(gaId, isDevelopment, domain) {
7
+ constructor(gaId, isDevelopment, domain, cookielessUserIdentifier) {
8
8
  if (!gaId && !isDevelopment) {
9
9
  return;
10
10
  }
@@ -31,12 +31,20 @@ class AnalyticsGAPlugin {
31
31
  const key = gaId || 'UA-57284711-1';
32
32
  /* global ga */
33
33
 
34
- const gaCookieParams = domain ? {
35
- cookieDomain: domain
36
- } : {};
37
- ga('create', key, !gaId ? {
38
- cookieDomain: 'none'
39
- } : gaCookieParams);
34
+ if (cookielessUserIdentifier) {
35
+ ga('create', key, {
36
+ storage: 'none',
37
+ clientId: cookielessUserIdentifier
38
+ });
39
+ } else {
40
+ const gaCookieParams = domain ? {
41
+ cookieDomain: domain
42
+ } : {};
43
+ ga('create', key, !gaId ? {
44
+ cookieDomain: 'none'
45
+ } : gaCookieParams);
46
+ }
47
+
40
48
  ga('set', 'anonymizeIp', true);
41
49
  ga('set', 'allowAdFeatures', false);
42
50
  }
package/dist/list/list.js CHANGED
@@ -518,24 +518,28 @@ class List extends Component {
518
518
  }
519
519
  }
520
520
 
521
- if (activeIndex == null && prevState.activeIndex == null && shouldActivateFirstItem(nextProps)) {
521
+ return nextState;
522
+ }
523
+
524
+ componentDidMount() {
525
+ document.addEventListener('mousemove', this.onDocumentMouseMove);
526
+ document.addEventListener('keydown', this.onDocumentKeyDown, true);
527
+ const {
528
+ data,
529
+ activeIndex
530
+ } = this.props;
531
+
532
+ if (activeIndex == null && shouldActivateFirstItem(this.props)) {
522
533
  const firstActivatableIndex = data.findIndex(isActivatable);
523
534
 
524
535
  if (firstActivatableIndex >= 0) {
525
- Object.assign(nextState, {
536
+ this.setState({
526
537
  activeIndex: firstActivatableIndex,
527
538
  activeItem: data[firstActivatableIndex],
528
539
  needScrollToActive: true
529
540
  });
530
541
  }
531
542
  }
532
-
533
- return nextState;
534
- }
535
-
536
- componentDidMount() {
537
- document.addEventListener('mousemove', this.onDocumentMouseMove);
538
- document.addEventListener('keydown', this.onDocumentKeyDown, true);
539
543
  }
540
544
 
541
545
  shouldComponentUpdate(nextProps, nextState) {
@@ -697,6 +697,10 @@ class Select extends Component {
697
697
  nextState.selected = Select._getEmptyValue(multiple);
698
698
  }
699
699
 
700
+ if (multiple && !nextState.selected) {
701
+ nextState.selected = prevState.selected;
702
+ }
703
+
700
704
  const {
701
705
  selected
702
706
  } = { ...prevState,
@@ -85,17 +85,21 @@ class SmartTable extends PureComponent {
85
85
  UNSAFE_componentWillReceiveProps(nextProps) {
86
86
  const {
87
87
  data,
88
- isItemSelectable
88
+ isItemSelectable,
89
+ selection
89
90
  } = nextProps;
90
91
 
91
- if (this.props.data !== data || this.props.isItemSelectable !== isItemSelectable) {
92
- const selection = new Selection({
93
- data,
94
- isItemSelectable
95
- });
92
+ if (this.props.remoteSelection && this.props.selection !== selection) {
96
93
  this.setState({
97
94
  selection
98
95
  });
96
+ } else if (this.props.data !== data || this.props.isItemSelectable !== isItemSelectable) {
97
+ this.setState({
98
+ selection: new Selection({
99
+ data,
100
+ isItemSelectable
101
+ })
102
+ });
99
103
  }
100
104
  }
101
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "4.1.25",
3
+ "version": "4.1.28",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -70,7 +70,7 @@
70
70
  "@babel/cli": "^7.17.6",
71
71
  "@babel/eslint-parser": "^7.17.0",
72
72
  "@jetbrains/eslint-config": "^5.3.2",
73
- "@jetbrains/generator-ring-ui": "^4.1.8",
73
+ "@jetbrains/generator-ring-ui": "^4.1.9",
74
74
  "@jetbrains/stylelint-config": "^3.0.2",
75
75
  "@primer/octicons": "^17.0.0",
76
76
  "@rollup/plugin-babel": "^5.3.1",
@@ -91,7 +91,7 @@
91
91
  "@storybook/theming": "6.4.19",
92
92
  "@testing-library/react": "^12.1.4",
93
93
  "@testing-library/user-event": "^13.5.0",
94
- "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
94
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
95
95
  "angular": "^1.8.2",
96
96
  "angular-mocks": "^1.8.2",
97
97
  "angular-route": "^1.8.2",
@@ -104,7 +104,7 @@
104
104
  "cheerio": "^0.22.0",
105
105
  "core-js": "^3.21.1",
106
106
  "enzyme": "^3.11.0",
107
- "eslint": "^8.11.0",
107
+ "eslint": "^8.12.0",
108
108
  "eslint-import-resolver-webpack": "^0.13.2",
109
109
  "eslint-plugin-angular": "^4.1.0",
110
110
  "eslint-plugin-bdd": "^2.1.1",
@@ -142,7 +142,7 @@
142
142
  "sinon": "^13.0.1",
143
143
  "sinon-chai": "^3.7.0",
144
144
  "storage-mock": "^2.1.0",
145
- "stylelint": "^14.5.3",
145
+ "stylelint": "^14.6.1",
146
146
  "svg-inline-loader": "^0.8.2",
147
147
  "teamcity-service-messages": "^0.1.12",
148
148
  "terser-webpack-plugin": "^5.3.1",
@@ -164,14 +164,14 @@
164
164
  }
165
165
  },
166
166
  "dependencies": {
167
- "@babel/core": "^7.17.7",
167
+ "@babel/core": "^7.17.8",
168
168
  "@jetbrains/angular-elastic": "^2.5.1",
169
169
  "@jetbrains/babel-preset-jetbrains": "^2.3.2",
170
170
  "@jetbrains/icons": "^3.18.0",
171
171
  "@jetbrains/logos": "^1.4.27",
172
172
  "@jetbrains/postcss-require-hover": "^0.1.2",
173
173
  "@ungap/url-search-params": "^0.2.2",
174
- "babel-loader": "^8.2.3",
174
+ "babel-loader": "^8.2.4",
175
175
  "babel-plugin-transform-define": "^2.0.1",
176
176
  "browserslist": "^4.16.6",
177
177
  "change-case": "^4.1.1",
@@ -201,7 +201,7 @@
201
201
  "postcss-font-family-system-ui": "^5.0.0",
202
202
  "postcss-loader": "^6.2.1",
203
203
  "postcss-modules-values-replace": "^3.4.0",
204
- "postcss-preset-env": "^7.4.2",
204
+ "postcss-preset-env": "^7.4.3",
205
205
  "prop-types": "^15.8.1",
206
206
  "react-markdown": "^5.0.3",
207
207
  "react-movable": "^3.0.4",
@@ -221,5 +221,5 @@
221
221
  "node": ">=7.4",
222
222
  "npm": ">=6.0.0"
223
223
  },
224
- "gitHead": "d52f95d73b992b26ac69526b0ee3898e0e4ff9f3"
224
+ "gitHead": "9c606e0eacffbd1a127f595173026e100e48671e"
225
225
  }