superdesk-ui-framework 4.0.77 → 4.0.78

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.
@@ -9,6 +9,7 @@ interface IPropsPopupPositioner {
9
9
  getReferenceElement(): HTMLElement;
10
10
  placement: Placement;
11
11
  onClose(): void;
12
+ shouldCloseOnClick?: (event: MouseEvent) => boolean;
12
13
  closeOnHoverEnd?: boolean;
13
14
  'data-test-id'?: string;
14
15
  }
@@ -35,6 +36,10 @@ export class PopupPositioner extends React.PureComponent<IPropsPopupPositioner>
35
36
  return;
36
37
  }
37
38
 
39
+ if (this.props.shouldCloseOnClick != null && this.props.shouldCloseOnClick(event) === false) {
40
+ return;
41
+ }
42
+
38
43
  if (
39
44
  this.props.getReferenceElement().contains(event.target as Node) !== true &&
40
45
  this.wrapperEl.contains(event.target as Node) !== true
@@ -191,6 +196,7 @@ export function showPopup(
191
196
  Component: React.ComponentType<{closePopup(): void}>,
192
197
  closeOnHoverEnd?: boolean,
193
198
  onClose?: () => void,
199
+ shouldCloseOnClick?: (event: MouseEvent) => boolean,
194
200
  ): {close: () => void} {
195
201
  const el = document.createElement('div');
196
202
 
@@ -207,6 +213,7 @@ export function showPopup(
207
213
  getReferenceElement={() => referenceElement}
208
214
  placement={placement}
209
215
  onClose={closeFn}
216
+ shouldCloseOnClick={shouldCloseOnClick}
210
217
  closeOnHoverEnd={closeOnHoverEnd || false}
211
218
  >
212
219
  <Component closePopup={closeFn} />
@@ -8,6 +8,7 @@ export interface IPropsWithPopover {
8
8
  component: React.ComponentType<{closePopup(): void}>;
9
9
  closeOnHoverEnd?: boolean;
10
10
  onClose?: () => void;
11
+ shouldCloseOnClick?(event: MouseEvent): boolean;
11
12
  }
12
13
 
13
14
  /**
@@ -37,6 +38,7 @@ export class WithPopover extends React.PureComponent<IPropsWithPopover> {
37
38
  this.closePopup = undefined;
38
39
  this.props.onClose?.();
39
40
  },
41
+ this.props.shouldCloseOnClick,
40
42
  ).close;
41
43
  }
42
44
  }
@@ -60158,6 +60158,9 @@ var PopupPositioner = /** @class */ (function (_super) {
60158
60158
  if (this.wrapperEl == null) {
60159
60159
  return;
60160
60160
  }
60161
+ if (this.props.shouldCloseOnClick != null && this.props.shouldCloseOnClick(event) === false) {
60162
+ return;
60163
+ }
60161
60164
  if (this.props.getReferenceElement().contains(event.target) !== true &&
60162
60165
  this.wrapperEl.contains(event.target) !== true) {
60163
60166
  this.props.onClose();
@@ -60281,7 +60284,7 @@ exports.PopupPositioner = PopupPositioner;
60281
60284
  /**
60282
60285
  * The popup will remove itself if click/scroll events are detected outside the popup.
60283
60286
  */
60284
- function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose) {
60287
+ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose, shouldCloseOnClick) {
60285
60288
  var el = document.createElement('div');
60286
60289
  document.body.appendChild(el);
60287
60290
  var closeFn = function () {
@@ -60289,7 +60292,7 @@ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onCl
60289
60292
  el.remove();
60290
60293
  onClose === null || onClose === void 0 ? void 0 : onClose();
60291
60294
  };
60292
- react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, closeOnHoverEnd: closeOnHoverEnd || false },
60295
+ react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, shouldCloseOnClick: shouldCloseOnClick, closeOnHoverEnd: closeOnHoverEnd || false },
60293
60296
  React.createElement(Component, { closePopup: closeFn })), el);
60294
60297
  return { close: closeFn };
60295
60298
  }
@@ -70614,7 +70617,7 @@ var WithPopover = /** @class */ (function (_super) {
70614
70617
  var _a, _b;
70615
70618
  _this.closePopup = undefined;
70616
70619
  (_b = (_a = _this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
70617
- }).close;
70620
+ }, this.props.shouldCloseOnClick).close;
70618
70621
  }
70619
70622
  };
70620
70623
  WithPopover.prototype.render = function () {
@@ -195159,7 +195162,7 @@ exports.ThreePaneLayoutPattern = ThreePaneLayoutPattern;
195159
195162
  /* 1049 */
195160
195163
  /***/ (function(module, exports) {
195161
195164
 
195162
- module.exports = {"name":"superdesk-ui-framework","version":"4.0.77","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":"tsc -p tsconfig.json --noEmit && webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","format-code":"npx prettier . --write","lint":"tsc -p tsconfig.json --noEmit && npx prettier . --check && eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}' && npm run playground-lint && npm run unit-test","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","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","prettier":"3.5.3","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":"^5.8.3","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","@sourcefabric/common":"0.0.66","@superdesk/primereact":"^5.0.2-13","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"^4.1.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","weekstart":"^2.0.0"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
195165
+ module.exports = {"name":"superdesk-ui-framework","version":"4.0.78","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":"tsc -p tsconfig.json --noEmit && webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","format-code":"npx prettier . --write","lint":"tsc -p tsconfig.json --noEmit && npx prettier . --check && eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}' && npm run playground-lint && npm run unit-test","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","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","prettier":"3.5.3","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":"^5.8.3","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","@sourcefabric/common":"0.0.66","@superdesk/primereact":"^5.0.2-13","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"^4.1.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","weekstart":"^2.0.0"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
195163
195166
 
195164
195167
  /***/ }),
195165
195168
  /* 1050 */
@@ -59888,6 +59888,9 @@ var PopupPositioner = /** @class */ (function (_super) {
59888
59888
  if (this.wrapperEl == null) {
59889
59889
  return;
59890
59890
  }
59891
+ if (this.props.shouldCloseOnClick != null && this.props.shouldCloseOnClick(event) === false) {
59892
+ return;
59893
+ }
59891
59894
  if (this.props.getReferenceElement().contains(event.target) !== true &&
59892
59895
  this.wrapperEl.contains(event.target) !== true) {
59893
59896
  this.props.onClose();
@@ -60011,7 +60014,7 @@ exports.PopupPositioner = PopupPositioner;
60011
60014
  /**
60012
60015
  * The popup will remove itself if click/scroll events are detected outside the popup.
60013
60016
  */
60014
- function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose) {
60017
+ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose, shouldCloseOnClick) {
60015
60018
  var el = document.createElement('div');
60016
60019
  document.body.appendChild(el);
60017
60020
  var closeFn = function () {
@@ -60019,7 +60022,7 @@ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onCl
60019
60022
  el.remove();
60020
60023
  onClose === null || onClose === void 0 ? void 0 : onClose();
60021
60024
  };
60022
- react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, closeOnHoverEnd: closeOnHoverEnd || false },
60025
+ react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, shouldCloseOnClick: shouldCloseOnClick, closeOnHoverEnd: closeOnHoverEnd || false },
60023
60026
  React.createElement(Component, { closePopup: closeFn })), el);
60024
60027
  return { close: closeFn };
60025
60028
  }
@@ -70344,7 +70347,7 @@ var WithPopover = /** @class */ (function (_super) {
70344
70347
  var _a, _b;
70345
70348
  _this.closePopup = undefined;
70346
70349
  (_b = (_a = _this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
70347
- }).close;
70350
+ }, this.props.shouldCloseOnClick).close;
70348
70351
  }
70349
70352
  };
70350
70353
  WithPopover.prototype.render = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "4.0.77",
3
+ "version": "4.0.78",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,6 +4,7 @@ interface IPropsPopupPositioner {
4
4
  getReferenceElement(): HTMLElement;
5
5
  placement: Placement;
6
6
  onClose(): void;
7
+ shouldCloseOnClick?: (event: MouseEvent) => boolean;
7
8
  closeOnHoverEnd?: boolean;
8
9
  'data-test-id'?: string;
9
10
  }
@@ -24,7 +25,7 @@ export declare class PopupPositioner extends React.PureComponent<IPropsPopupPosi
24
25
  */
25
26
  export declare function showPopup(referenceElement: HTMLElement, placement: Placement, Component: React.ComponentType<{
26
27
  closePopup(): void;
27
- }>, closeOnHoverEnd?: boolean, onClose?: () => void): {
28
+ }>, closeOnHoverEnd?: boolean, onClose?: () => void, shouldCloseOnClick?: (event: MouseEvent) => boolean): {
28
29
  close: () => void;
29
30
  };
30
31
  export {};
@@ -76,6 +76,9 @@ var PopupPositioner = /** @class */ (function (_super) {
76
76
  if (this.wrapperEl == null) {
77
77
  return;
78
78
  }
79
+ if (this.props.shouldCloseOnClick != null && this.props.shouldCloseOnClick(event) === false) {
80
+ return;
81
+ }
79
82
  if (this.props.getReferenceElement().contains(event.target) !== true &&
80
83
  this.wrapperEl.contains(event.target) !== true) {
81
84
  this.props.onClose();
@@ -199,7 +202,7 @@ exports.PopupPositioner = PopupPositioner;
199
202
  /**
200
203
  * The popup will remove itself if click/scroll events are detected outside the popup.
201
204
  */
202
- function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose) {
205
+ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose, shouldCloseOnClick) {
203
206
  var el = document.createElement('div');
204
207
  document.body.appendChild(el);
205
208
  var closeFn = function () {
@@ -207,7 +210,7 @@ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onCl
207
210
  el.remove();
208
211
  onClose === null || onClose === void 0 ? void 0 : onClose();
209
212
  };
210
- react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, closeOnHoverEnd: closeOnHoverEnd || false },
213
+ react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, shouldCloseOnClick: shouldCloseOnClick, closeOnHoverEnd: closeOnHoverEnd || false },
211
214
  React.createElement(Component, { closePopup: closeFn })), el);
212
215
  return { close: closeFn };
213
216
  }
@@ -8,6 +8,7 @@ export interface IPropsWithPopover {
8
8
  }>;
9
9
  closeOnHoverEnd?: boolean;
10
10
  onClose?: () => void;
11
+ shouldCloseOnClick?(event: MouseEvent): boolean;
11
12
  }
12
13
  /**
13
14
  * Wraps `PopupPositioner`
@@ -73,7 +73,7 @@ var WithPopover = /** @class */ (function (_super) {
73
73
  var _a, _b;
74
74
  _this.closePopup = undefined;
75
75
  (_b = (_a = _this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
76
- }).close;
76
+ }, this.props.shouldCloseOnClick).close;
77
77
  }
78
78
  };
79
79
  WithPopover.prototype.render = function () {