superdesk-ui-framework 4.0.35 → 4.0.36

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.
@@ -180,7 +180,7 @@ export class TreeMenu<T> extends React.Component<IProps<T>, IState<T>> {
180
180
  document.addEventListener("keydown", this.onPressEsc);
181
181
  }
182
182
 
183
- componentDidUpdate(_prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void {
183
+ componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void {
184
184
  if (prevState.openDropdown !== this.state.openDropdown) {
185
185
  this.toggleMenu();
186
186
  }
@@ -192,6 +192,18 @@ export class TreeMenu<T> extends React.Component<IProps<T>, IState<T>> {
192
192
  ) {
193
193
  this.popperInstance?.update();
194
194
  }
195
+
196
+ // Update options when getOptions prop is updated
197
+ if (this.props.getOptions && prevProps.getOptions !== this.props.getOptions) {
198
+ const newOptions = this.props.getOptions();
199
+ this.setState({
200
+ options: newOptions,
201
+ firstBranchOptions: newOptions,
202
+ filterArr: [],
203
+ }, () => {
204
+ this.recursion(newOptions);
205
+ });
206
+ }
195
207
  }
196
208
 
197
209
  toggleMenu() {
@@ -79448,7 +79448,8 @@ var TreeMenu = /** @class */ (function (_super) {
79448
79448
  document.removeEventListener("keydown", this.onKeyDown);
79449
79449
  document.addEventListener("keydown", this.onPressEsc);
79450
79450
  };
79451
- TreeMenu.prototype.componentDidUpdate = function (_prevProps, prevState) {
79451
+ TreeMenu.prototype.componentDidUpdate = function (prevProps, prevState) {
79452
+ var _this = this;
79452
79453
  var _a;
79453
79454
  if (prevState.openDropdown !== this.state.openDropdown) {
79454
79455
  this.toggleMenu();
@@ -79458,6 +79459,17 @@ var TreeMenu = /** @class */ (function (_super) {
79458
79459
  || (prevState.options !== this.state.options)) {
79459
79460
  (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
79460
79461
  }
79462
+ // Update options when getOptions prop is updated
79463
+ if (this.props.getOptions && prevProps.getOptions !== this.props.getOptions) {
79464
+ var newOptions_1 = this.props.getOptions();
79465
+ this.setState({
79466
+ options: newOptions_1,
79467
+ firstBranchOptions: newOptions_1,
79468
+ filterArr: [],
79469
+ }, function () {
79470
+ _this.recursion(newOptions_1);
79471
+ });
79472
+ }
79461
79473
  };
79462
79474
  TreeMenu.prototype.toggleMenu = function () {
79463
79475
  var _this = this;
@@ -186344,7 +186356,7 @@ exports.ThreePaneLayoutPattern = ThreePaneLayoutPattern;
186344
186356
  /* 938 */
186345
186357
  /***/ (function(module, exports) {
186346
186358
 
186347
- module.exports = {"name":"superdesk-ui-framework","version":"4.0.35","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","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}' && npm run playground-lint","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/enzyme-adapter-react-16":"^1.0.6","@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","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","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","moment":"^2.29.3","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","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":{"@popperjs/core":"^2.4.0","@superdesk/common":"0.0.28","@superdesk/primereact":"^5.0.2-13","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"2.7.0","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-scrollspy":"^3.4.3","tippy.js":"^6.3.7"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
186359
+ module.exports = {"name":"superdesk-ui-framework","version":"4.0.36","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","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}' && npm run playground-lint","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/enzyme-adapter-react-16":"^1.0.6","@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","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","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","moment":"^2.29.3","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","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":{"@popperjs/core":"^2.4.0","@superdesk/common":"0.0.28","@superdesk/primereact":"^5.0.2-13","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"2.7.0","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-scrollspy":"^3.4.3","tippy.js":"^6.3.7"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
186348
186360
 
186349
186361
  /***/ }),
186350
186362
  /* 939 */
@@ -78569,7 +78569,8 @@ var TreeMenu = /** @class */ (function (_super) {
78569
78569
  document.removeEventListener("keydown", this.onKeyDown);
78570
78570
  document.addEventListener("keydown", this.onPressEsc);
78571
78571
  };
78572
- TreeMenu.prototype.componentDidUpdate = function (_prevProps, prevState) {
78572
+ TreeMenu.prototype.componentDidUpdate = function (prevProps, prevState) {
78573
+ var _this = this;
78573
78574
  var _a;
78574
78575
  if (prevState.openDropdown !== this.state.openDropdown) {
78575
78576
  this.toggleMenu();
@@ -78579,6 +78580,17 @@ var TreeMenu = /** @class */ (function (_super) {
78579
78580
  || (prevState.options !== this.state.options)) {
78580
78581
  (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
78581
78582
  }
78583
+ // Update options when getOptions prop is updated
78584
+ if (this.props.getOptions && prevProps.getOptions !== this.props.getOptions) {
78585
+ var newOptions_1 = this.props.getOptions();
78586
+ this.setState({
78587
+ options: newOptions_1,
78588
+ firstBranchOptions: newOptions_1,
78589
+ filterArr: [],
78590
+ }, function () {
78591
+ _this.recursion(newOptions_1);
78592
+ });
78593
+ }
78582
78594
  };
78583
78595
  TreeMenu.prototype.toggleMenu = function () {
78584
78596
  var _this = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "4.0.35",
3
+ "version": "4.0.36",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,7 @@ export declare class TreeMenu<T> extends React.Component<IProps<T>, IState<T>> {
48
48
  onPressEsc: (event: KeyboardEvent) => void;
49
49
  componentDidMount: () => void;
50
50
  componentWillUnmount(): void;
51
- componentDidUpdate(_prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
51
+ componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
52
52
  toggleMenu(): void;
53
53
  toggle(event: React.SyntheticEvent): void;
54
54
  handleMultiLevel(item: ITreeMenuNode<T>): void;
@@ -170,7 +170,8 @@ var TreeMenu = /** @class */ (function (_super) {
170
170
  document.removeEventListener("keydown", this.onKeyDown);
171
171
  document.addEventListener("keydown", this.onPressEsc);
172
172
  };
173
- TreeMenu.prototype.componentDidUpdate = function (_prevProps, prevState) {
173
+ TreeMenu.prototype.componentDidUpdate = function (prevProps, prevState) {
174
+ var _this = this;
174
175
  var _a;
175
176
  if (prevState.openDropdown !== this.state.openDropdown) {
176
177
  this.toggleMenu();
@@ -180,6 +181,17 @@ var TreeMenu = /** @class */ (function (_super) {
180
181
  || (prevState.options !== this.state.options)) {
181
182
  (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
182
183
  }
184
+ // Update options when getOptions prop is updated
185
+ if (this.props.getOptions && prevProps.getOptions !== this.props.getOptions) {
186
+ var newOptions_1 = this.props.getOptions();
187
+ this.setState({
188
+ options: newOptions_1,
189
+ firstBranchOptions: newOptions_1,
190
+ filterArr: [],
191
+ }, function () {
192
+ _this.recursion(newOptions_1);
193
+ });
194
+ }
183
195
  };
184
196
  TreeMenu.prototype.toggleMenu = function () {
185
197
  var _this = this;