superdesk-ui-framework 3.0.48 → 3.0.50

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.
@@ -3,7 +3,16 @@ import classNames from 'classnames';
3
3
  import { Icon } from './Icon';
4
4
  import { Spinner } from './Spinner';
5
5
 
6
- interface IButtonBase {
6
+ interface IPropsButton {
7
+ text: string;
8
+ onClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>): void;
9
+
10
+ expand?: boolean;
11
+ style?: 'filled' | 'hollow' | 'text-only'; // defaults to 'filled'
12
+ shape?: 'square' | 'round'; // defaults to 'square'
13
+ isLoading?: boolean;
14
+ loadingLabel?: string;
15
+ tooltip?: string;
7
16
  id?: string;
8
17
  theme?: 'light' | 'dark'; // defaults to 'light'
9
18
  type?: 'default' | 'primary' | 'success' | 'warning' | 'alert' | 'highlight' | 'sd-green';
@@ -12,19 +21,9 @@ interface IButtonBase {
12
21
  icon?: string;
13
22
  disabled?: boolean;
14
23
  iconOnly?: boolean;
15
- onClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>): void;
16
24
  'data-test-id'?: string;
17
25
  }
18
26
 
19
- interface IPropsButton extends IButtonBase {
20
- text: string;
21
- expand?: boolean;
22
- style?: 'filled' | 'hollow' | 'text-only'; // defaults to 'filled'
23
- shape?: 'square' | 'round'; // defaults to 'square'
24
- isLoading?: boolean;
25
- loadingLabel?: string;
26
- }
27
-
28
27
  export class Button extends React.PureComponent<IPropsButton> {
29
28
  render() {
30
29
  let classes = classNames('btn', {
@@ -47,7 +46,9 @@ export class Button extends React.PureComponent<IPropsButton> {
47
46
  data-loading={this.props.isLoading}
48
47
  onClick={this.props.disabled ? () => false : (event) => this.props.onClick(event)}
49
48
  aria-label={this.props.iconOnly ? this.props.text : ''}
50
- data-test-id={this.props['data-test-id']}>
49
+ data-test-id={this.props['data-test-id']}
50
+ title={this.props.tooltip}
51
+ >
51
52
  {this.props.isLoading ? <Spinner size="mini" /> : null}
52
53
  {this.props.icon && !this.props.isLoading ? <Icon name={this.props.icon} /> : null}
53
54
  {this.props.iconOnly ? null : this.props.text}
@@ -176,7 +176,9 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
176
176
  if (!isEqual(prevState.value, this.state.value)) {
177
177
  this.props.onChange(this.state.value);
178
178
  } else if (!isEqual(prevProps.value, this.props.value)) {
179
- this.props.onChange(this.state.value);
179
+ this.setState({
180
+ value: this.props.value ?? [],
181
+ });
180
182
  }
181
183
 
182
184
  if (prevState.openDropdown !== this.state.openDropdown) {
@@ -38403,7 +38403,7 @@ var Button = /** @class */ (function (_super) {
38403
38403
  _a['btn--ui-dark'] = this.props.theme === 'dark',
38404
38404
  _a['btn--icon-only-circle'] = this.props.shape === 'round' && this.props.iconOnly,
38405
38405
  _a));
38406
- return (React.createElement("button", { id: this.props.id, className: classes, tabIndex: 0, disabled: this.props.isLoading, "data-loading": this.props.isLoading, onClick: this.props.disabled ? function () { return false; } : function (event) { return _this.props.onClick(event); }, "aria-label": this.props.iconOnly ? this.props.text : '', "data-test-id": this.props['data-test-id'] },
38406
+ return (React.createElement("button", { id: this.props.id, className: classes, tabIndex: 0, disabled: this.props.isLoading, "data-loading": this.props.isLoading, onClick: this.props.disabled ? function () { return false; } : function (event) { return _this.props.onClick(event); }, "aria-label": this.props.iconOnly ? this.props.text : '', "data-test-id": this.props['data-test-id'], title: this.props.tooltip },
38407
38407
  this.props.isLoading ? React.createElement(Spinner_1.Spinner, { size: "mini" }) : null,
38408
38408
  this.props.icon && !this.props.isLoading ? React.createElement(Icon_1.Icon, { name: this.props.icon }) : null,
38409
38409
  this.props.iconOnly ? null : this.props.text));
@@ -64551,12 +64551,14 @@ var TreeSelect = /** @class */ (function (_super) {
64551
64551
  document.removeEventListener("keydown", this.onKeyDown);
64552
64552
  };
64553
64553
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
64554
- var _a;
64554
+ var _a, _b;
64555
64555
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
64556
64556
  this.props.onChange(this.state.value);
64557
64557
  }
64558
64558
  else if (!(0, lodash_1.isEqual)(prevProps.value, this.props.value)) {
64559
- this.props.onChange(this.state.value);
64559
+ this.setState({
64560
+ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : [],
64561
+ });
64560
64562
  }
64561
64563
  if (prevState.openDropdown !== this.state.openDropdown) {
64562
64564
  this.toggleMenu();
@@ -64565,7 +64567,7 @@ var TreeSelect = /** @class */ (function (_super) {
64565
64567
  if ((prevState.activeTree !== this.state.activeTree)
64566
64568
  || (prevState.filterArr !== this.state.filterArr)
64567
64569
  || (prevState.options !== this.state.options)) {
64568
- (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
64570
+ (_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.update();
64569
64571
  }
64570
64572
  }
64571
64573
  };
@@ -143421,7 +143423,7 @@ exports.ResizablePanelsDoc = ResizablePanelsDoc;
143421
143423
  /* 689 */
143422
143424
  /***/ (function(module, exports) {
143423
143425
 
143424
- module.exports = {"name":"superdesk-ui-framework","version":"3.0.48","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build","unit-test":"mocha","debug-unit-tests":"mocha --inspect-brk"},"devDependencies":{"@types/assert":"^1.5.6","@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.12","@types/lodash":"^4.14.161","@types/mocha":"^9.1.1","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"^5.58.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","jsdom":"20.0.3","jsdom-global":"3.0.2","lodash":"4.17.21","mocha":"^8.4.0","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-bootstrap":"^0.31.2","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","ts-node":"^10.9.1","tslint":"^5.18.0","typescript":"4.9.5","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@material-ui/lab":"^4.0.0-alpha.56","@popperjs/core":"^2.4.0","@superdesk/primereact":"^5.0.2-12","@superdesk/react-resizable-panels":"0.0.39","@types/enzyme-adapter-react-16":"^1.0.6","@types/node":"^14.10.2","chart.js":"^2.9.3","date-fns":"2.7.0","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","moment":"^2.29.3","popper-max-size-modifier":"^0.2.0","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-popper":"^2.2.3","react-scrollspy":"^3.4.3"}}
143426
+ module.exports = {"name":"superdesk-ui-framework","version":"3.0.50","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build","unit-test":"mocha","debug-unit-tests":"mocha --inspect-brk"},"devDependencies":{"@types/assert":"^1.5.6","@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.12","@types/lodash":"^4.14.161","@types/mocha":"^9.1.1","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"^5.58.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","jsdom":"20.0.3","jsdom-global":"3.0.2","lodash":"4.17.21","mocha":"^8.4.0","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-bootstrap":"^0.31.2","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","ts-node":"^10.9.1","tslint":"^5.18.0","typescript":"4.9.5","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@material-ui/lab":"^4.0.0-alpha.56","@popperjs/core":"^2.4.0","@superdesk/primereact":"^5.0.2-12","@superdesk/react-resizable-panels":"0.0.39","@types/enzyme-adapter-react-16":"^1.0.6","@types/node":"^14.10.2","chart.js":"^2.9.3","date-fns":"2.7.0","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","moment":"^2.29.3","popper-max-size-modifier":"^0.2.0","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-popper":"^2.2.3","react-scrollspy":"^3.4.3"}}
143425
143427
 
143426
143428
  /***/ }),
143427
143429
  /* 690 */
@@ -38047,7 +38047,7 @@ var Button = /** @class */ (function (_super) {
38047
38047
  _a['btn--ui-dark'] = this.props.theme === 'dark',
38048
38048
  _a['btn--icon-only-circle'] = this.props.shape === 'round' && this.props.iconOnly,
38049
38049
  _a));
38050
- return (React.createElement("button", { id: this.props.id, className: classes, tabIndex: 0, disabled: this.props.isLoading, "data-loading": this.props.isLoading, onClick: this.props.disabled ? function () { return false; } : function (event) { return _this.props.onClick(event); }, "aria-label": this.props.iconOnly ? this.props.text : '', "data-test-id": this.props['data-test-id'] },
38050
+ return (React.createElement("button", { id: this.props.id, className: classes, tabIndex: 0, disabled: this.props.isLoading, "data-loading": this.props.isLoading, onClick: this.props.disabled ? function () { return false; } : function (event) { return _this.props.onClick(event); }, "aria-label": this.props.iconOnly ? this.props.text : '', "data-test-id": this.props['data-test-id'], title: this.props.tooltip },
38051
38051
  this.props.isLoading ? React.createElement(Spinner_1.Spinner, { size: "mini" }) : null,
38052
38052
  this.props.icon && !this.props.isLoading ? React.createElement(Icon_1.Icon, { name: this.props.icon }) : null,
38053
38053
  this.props.iconOnly ? null : this.props.text));
@@ -64168,12 +64168,14 @@ var TreeSelect = /** @class */ (function (_super) {
64168
64168
  document.removeEventListener("keydown", this.onKeyDown);
64169
64169
  };
64170
64170
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
64171
- var _a;
64171
+ var _a, _b;
64172
64172
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
64173
64173
  this.props.onChange(this.state.value);
64174
64174
  }
64175
64175
  else if (!(0, lodash_1.isEqual)(prevProps.value, this.props.value)) {
64176
- this.props.onChange(this.state.value);
64176
+ this.setState({
64177
+ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : [],
64178
+ });
64177
64179
  }
64178
64180
  if (prevState.openDropdown !== this.state.openDropdown) {
64179
64181
  this.toggleMenu();
@@ -64182,7 +64184,7 @@ var TreeSelect = /** @class */ (function (_super) {
64182
64184
  if ((prevState.activeTree !== this.state.activeTree)
64183
64185
  || (prevState.filterArr !== this.state.filterArr)
64184
64186
  || (prevState.options !== this.state.options)) {
64185
- (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
64187
+ (_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.update();
64186
64188
  }
64187
64189
  }
64188
64190
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "3.0.48",
3
+ "version": "3.0.50",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,13 @@
1
1
  import * as React from 'react';
2
- interface IButtonBase {
2
+ interface IPropsButton {
3
+ text: string;
4
+ onClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>): void;
5
+ expand?: boolean;
6
+ style?: 'filled' | 'hollow' | 'text-only';
7
+ shape?: 'square' | 'round';
8
+ isLoading?: boolean;
9
+ loadingLabel?: string;
10
+ tooltip?: string;
3
11
  id?: string;
4
12
  theme?: 'light' | 'dark';
5
13
  type?: 'default' | 'primary' | 'success' | 'warning' | 'alert' | 'highlight' | 'sd-green';
@@ -8,17 +16,8 @@ interface IButtonBase {
8
16
  icon?: string;
9
17
  disabled?: boolean;
10
18
  iconOnly?: boolean;
11
- onClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>): void;
12
19
  'data-test-id'?: string;
13
20
  }
14
- interface IPropsButton extends IButtonBase {
15
- text: string;
16
- expand?: boolean;
17
- style?: 'filled' | 'hollow' | 'text-only';
18
- shape?: 'square' | 'round';
19
- isLoading?: boolean;
20
- loadingLabel?: string;
21
- }
22
21
  export declare class Button extends React.PureComponent<IPropsButton> {
23
22
  render(): JSX.Element;
24
23
  }
@@ -65,7 +65,7 @@ var Button = /** @class */ (function (_super) {
65
65
  _a['btn--ui-dark'] = this.props.theme === 'dark',
66
66
  _a['btn--icon-only-circle'] = this.props.shape === 'round' && this.props.iconOnly,
67
67
  _a));
68
- return (React.createElement("button", { id: this.props.id, className: classes, tabIndex: 0, disabled: this.props.isLoading, "data-loading": this.props.isLoading, onClick: this.props.disabled ? function () { return false; } : function (event) { return _this.props.onClick(event); }, "aria-label": this.props.iconOnly ? this.props.text : '', "data-test-id": this.props['data-test-id'] },
68
+ return (React.createElement("button", { id: this.props.id, className: classes, tabIndex: 0, disabled: this.props.isLoading, "data-loading": this.props.isLoading, onClick: this.props.disabled ? function () { return false; } : function (event) { return _this.props.onClick(event); }, "aria-label": this.props.iconOnly ? this.props.text : '', "data-test-id": this.props['data-test-id'], title: this.props.tooltip },
69
69
  this.props.isLoading ? React.createElement(Spinner_1.Spinner, { size: "mini" }) : null,
70
70
  this.props.icon && !this.props.isLoading ? React.createElement(Icon_1.Icon, { name: this.props.icon }) : null,
71
71
  this.props.iconOnly ? null : this.props.text));
@@ -146,12 +146,14 @@ var TreeSelect = /** @class */ (function (_super) {
146
146
  document.removeEventListener("keydown", this.onKeyDown);
147
147
  };
148
148
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
149
- var _a;
149
+ var _a, _b;
150
150
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
151
151
  this.props.onChange(this.state.value);
152
152
  }
153
153
  else if (!(0, lodash_1.isEqual)(prevProps.value, this.props.value)) {
154
- this.props.onChange(this.state.value);
154
+ this.setState({
155
+ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : [],
156
+ });
155
157
  }
156
158
  if (prevState.openDropdown !== this.state.openDropdown) {
157
159
  this.toggleMenu();
@@ -160,7 +162,7 @@ var TreeSelect = /** @class */ (function (_super) {
160
162
  if ((prevState.activeTree !== this.state.activeTree)
161
163
  || (prevState.filterArr !== this.state.filterArr)
162
164
  || (prevState.options !== this.state.options)) {
163
- (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
165
+ (_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.update();
164
166
  }
165
167
  }
166
168
  };