superdesk-ui-framework 4.0.81 → 4.0.82
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/app-typescript/components/ShowPopup.tsx +12 -4
- package/app-typescript/components/WithPopover.tsx +2 -2
- package/dist/examples.bundle.js +11 -5
- package/dist/superdesk-ui.bundle.js +10 -4
- package/package.json +1 -1
- package/react/components/ShowPopup.d.ts +2 -2
- package/react/components/ShowPopup.js +9 -3
- package/react/components/WithPopover.d.ts +1 -1
- package/react/components/WithPopover.js +1 -1
|
@@ -9,7 +9,7 @@ interface IPropsPopupPositioner {
|
|
|
9
9
|
getReferenceElement(): HTMLElement;
|
|
10
10
|
placement: Placement;
|
|
11
11
|
onClose(): void;
|
|
12
|
-
|
|
12
|
+
shouldClose?: (event: MouseEvent | Event) => boolean;
|
|
13
13
|
closeOnHoverEnd?: boolean;
|
|
14
14
|
'data-test-id'?: string;
|
|
15
15
|
}
|
|
@@ -36,7 +36,7 @@ export class PopupPositioner extends React.PureComponent<IPropsPopupPositioner>
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
if (this.props.
|
|
39
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -53,6 +53,10 @@ export class PopupPositioner extends React.PureComponent<IPropsPopupPositioner>
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
if (this.wrapperEl.contains(event.target as Node) !== true) {
|
|
57
61
|
this.props.onClose();
|
|
58
62
|
}
|
|
@@ -63,6 +67,10 @@ export class PopupPositioner extends React.PureComponent<IPropsPopupPositioner>
|
|
|
63
67
|
return;
|
|
64
68
|
}
|
|
65
69
|
|
|
70
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
if (this.wrapperEl.contains(event.target as Node) !== true) {
|
|
67
75
|
this.props.onClose();
|
|
68
76
|
}
|
|
@@ -196,7 +204,7 @@ export function showPopup(
|
|
|
196
204
|
Component: React.ComponentType<{closePopup(): void}>,
|
|
197
205
|
closeOnHoverEnd?: boolean,
|
|
198
206
|
onClose?: () => void,
|
|
199
|
-
|
|
207
|
+
shouldClose?: (event: MouseEvent | Event) => boolean,
|
|
200
208
|
): {close: () => void} {
|
|
201
209
|
const el = document.createElement('div');
|
|
202
210
|
|
|
@@ -213,7 +221,7 @@ export function showPopup(
|
|
|
213
221
|
getReferenceElement={() => referenceElement}
|
|
214
222
|
placement={placement}
|
|
215
223
|
onClose={closeFn}
|
|
216
|
-
|
|
224
|
+
shouldClose={shouldClose}
|
|
217
225
|
closeOnHoverEnd={closeOnHoverEnd || false}
|
|
218
226
|
>
|
|
219
227
|
<Component closePopup={closeFn} />
|
|
@@ -8,7 +8,7 @@ export interface IPropsWithPopover {
|
|
|
8
8
|
component: React.ComponentType<{closePopup(): void}>;
|
|
9
9
|
closeOnHoverEnd?: boolean;
|
|
10
10
|
onClose?: () => void;
|
|
11
|
-
|
|
11
|
+
shouldClose?(event: MouseEvent | Event): boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -38,7 +38,7 @@ export class WithPopover extends React.PureComponent<IPropsWithPopover> {
|
|
|
38
38
|
this.closePopup = undefined;
|
|
39
39
|
this.props.onClose?.();
|
|
40
40
|
},
|
|
41
|
-
this.props.
|
|
41
|
+
this.props.shouldClose,
|
|
42
42
|
).close;
|
|
43
43
|
}
|
|
44
44
|
}
|
package/dist/examples.bundle.js
CHANGED
|
@@ -60159,7 +60159,7 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
60159
60159
|
if (this.wrapperEl == null) {
|
|
60160
60160
|
return;
|
|
60161
60161
|
}
|
|
60162
|
-
if (this.props.
|
|
60162
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
60163
60163
|
return;
|
|
60164
60164
|
}
|
|
60165
60165
|
if (this.props.getReferenceElement().contains(event.target) !== true &&
|
|
@@ -60171,6 +60171,9 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
60171
60171
|
if (this.wrapperEl == null) {
|
|
60172
60172
|
return;
|
|
60173
60173
|
}
|
|
60174
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
60175
|
+
return;
|
|
60176
|
+
}
|
|
60174
60177
|
if (this.wrapperEl.contains(event.target) !== true) {
|
|
60175
60178
|
this.props.onClose();
|
|
60176
60179
|
}
|
|
@@ -60179,6 +60182,9 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
60179
60182
|
if (this.wrapperEl == null) {
|
|
60180
60183
|
return;
|
|
60181
60184
|
}
|
|
60185
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
60186
|
+
return;
|
|
60187
|
+
}
|
|
60182
60188
|
if (this.wrapperEl.contains(event.target) !== true) {
|
|
60183
60189
|
this.props.onClose();
|
|
60184
60190
|
}
|
|
@@ -60285,7 +60291,7 @@ exports.PopupPositioner = PopupPositioner;
|
|
|
60285
60291
|
/**
|
|
60286
60292
|
* The popup will remove itself if click/scroll events are detected outside the popup.
|
|
60287
60293
|
*/
|
|
60288
|
-
function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose,
|
|
60294
|
+
function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose, shouldClose) {
|
|
60289
60295
|
var el = document.createElement('div');
|
|
60290
60296
|
document.body.appendChild(el);
|
|
60291
60297
|
var closeFn = function () {
|
|
@@ -60293,7 +60299,7 @@ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onCl
|
|
|
60293
60299
|
el.remove();
|
|
60294
60300
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
60295
60301
|
};
|
|
60296
|
-
react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn,
|
|
60302
|
+
react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, shouldClose: shouldClose, closeOnHoverEnd: closeOnHoverEnd || false },
|
|
60297
60303
|
React.createElement(Component, { closePopup: closeFn })), el);
|
|
60298
60304
|
return { close: closeFn };
|
|
60299
60305
|
}
|
|
@@ -70618,7 +70624,7 @@ var WithPopover = /** @class */ (function (_super) {
|
|
|
70618
70624
|
var _a, _b;
|
|
70619
70625
|
_this.closePopup = undefined;
|
|
70620
70626
|
(_b = (_a = _this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
70621
|
-
}, this.props.
|
|
70627
|
+
}, this.props.shouldClose).close;
|
|
70622
70628
|
}
|
|
70623
70629
|
};
|
|
70624
70630
|
WithPopover.prototype.render = function () {
|
|
@@ -195161,7 +195167,7 @@ exports.ThreePaneLayoutPattern = ThreePaneLayoutPattern;
|
|
|
195161
195167
|
/* 1049 */
|
|
195162
195168
|
/***/ (function(module, exports) {
|
|
195163
195169
|
|
|
195164
|
-
module.exports = {"name":"superdesk-ui-framework","version":"4.0.
|
|
195170
|
+
module.exports = {"name":"superdesk-ui-framework","version":"4.0.82","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
195171
|
|
|
195166
195172
|
/***/ }),
|
|
195167
195173
|
/* 1050 */
|
|
@@ -59889,7 +59889,7 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
59889
59889
|
if (this.wrapperEl == null) {
|
|
59890
59890
|
return;
|
|
59891
59891
|
}
|
|
59892
|
-
if (this.props.
|
|
59892
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
59893
59893
|
return;
|
|
59894
59894
|
}
|
|
59895
59895
|
if (this.props.getReferenceElement().contains(event.target) !== true &&
|
|
@@ -59901,6 +59901,9 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
59901
59901
|
if (this.wrapperEl == null) {
|
|
59902
59902
|
return;
|
|
59903
59903
|
}
|
|
59904
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
59905
|
+
return;
|
|
59906
|
+
}
|
|
59904
59907
|
if (this.wrapperEl.contains(event.target) !== true) {
|
|
59905
59908
|
this.props.onClose();
|
|
59906
59909
|
}
|
|
@@ -59909,6 +59912,9 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
59909
59912
|
if (this.wrapperEl == null) {
|
|
59910
59913
|
return;
|
|
59911
59914
|
}
|
|
59915
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
59916
|
+
return;
|
|
59917
|
+
}
|
|
59912
59918
|
if (this.wrapperEl.contains(event.target) !== true) {
|
|
59913
59919
|
this.props.onClose();
|
|
59914
59920
|
}
|
|
@@ -60015,7 +60021,7 @@ exports.PopupPositioner = PopupPositioner;
|
|
|
60015
60021
|
/**
|
|
60016
60022
|
* The popup will remove itself if click/scroll events are detected outside the popup.
|
|
60017
60023
|
*/
|
|
60018
|
-
function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose,
|
|
60024
|
+
function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose, shouldClose) {
|
|
60019
60025
|
var el = document.createElement('div');
|
|
60020
60026
|
document.body.appendChild(el);
|
|
60021
60027
|
var closeFn = function () {
|
|
@@ -60023,7 +60029,7 @@ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onCl
|
|
|
60023
60029
|
el.remove();
|
|
60024
60030
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
60025
60031
|
};
|
|
60026
|
-
react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn,
|
|
60032
|
+
react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, shouldClose: shouldClose, closeOnHoverEnd: closeOnHoverEnd || false },
|
|
60027
60033
|
React.createElement(Component, { closePopup: closeFn })), el);
|
|
60028
60034
|
return { close: closeFn };
|
|
60029
60035
|
}
|
|
@@ -70348,7 +70354,7 @@ var WithPopover = /** @class */ (function (_super) {
|
|
|
70348
70354
|
var _a, _b;
|
|
70349
70355
|
_this.closePopup = undefined;
|
|
70350
70356
|
(_b = (_a = _this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
70351
|
-
}, this.props.
|
|
70357
|
+
}, this.props.shouldClose).close;
|
|
70352
70358
|
}
|
|
70353
70359
|
};
|
|
70354
70360
|
WithPopover.prototype.render = function () {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ interface IPropsPopupPositioner {
|
|
|
4
4
|
getReferenceElement(): HTMLElement;
|
|
5
5
|
placement: Placement;
|
|
6
6
|
onClose(): void;
|
|
7
|
-
|
|
7
|
+
shouldClose?: (event: MouseEvent | Event) => boolean;
|
|
8
8
|
closeOnHoverEnd?: boolean;
|
|
9
9
|
'data-test-id'?: string;
|
|
10
10
|
}
|
|
@@ -25,7 +25,7 @@ export declare class PopupPositioner extends React.PureComponent<IPropsPopupPosi
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function showPopup(referenceElement: HTMLElement, placement: Placement, Component: React.ComponentType<{
|
|
27
27
|
closePopup(): void;
|
|
28
|
-
}>, closeOnHoverEnd?: boolean, onClose?: () => void,
|
|
28
|
+
}>, closeOnHoverEnd?: boolean, onClose?: () => void, shouldClose?: (event: MouseEvent | Event) => boolean): {
|
|
29
29
|
close: () => void;
|
|
30
30
|
};
|
|
31
31
|
export {};
|
|
@@ -76,7 +76,7 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
76
76
|
if (this.wrapperEl == null) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
if (this.props.
|
|
79
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (this.props.getReferenceElement().contains(event.target) !== true &&
|
|
@@ -88,6 +88,9 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
88
88
|
if (this.wrapperEl == null) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
91
94
|
if (this.wrapperEl.contains(event.target) !== true) {
|
|
92
95
|
this.props.onClose();
|
|
93
96
|
}
|
|
@@ -96,6 +99,9 @@ var PopupPositioner = /** @class */ (function (_super) {
|
|
|
96
99
|
if (this.wrapperEl == null) {
|
|
97
100
|
return;
|
|
98
101
|
}
|
|
102
|
+
if (this.props.shouldClose != null && this.props.shouldClose(event) === false) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
99
105
|
if (this.wrapperEl.contains(event.target) !== true) {
|
|
100
106
|
this.props.onClose();
|
|
101
107
|
}
|
|
@@ -202,7 +208,7 @@ exports.PopupPositioner = PopupPositioner;
|
|
|
202
208
|
/**
|
|
203
209
|
* The popup will remove itself if click/scroll events are detected outside the popup.
|
|
204
210
|
*/
|
|
205
|
-
function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose,
|
|
211
|
+
function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onClose, shouldClose) {
|
|
206
212
|
var el = document.createElement('div');
|
|
207
213
|
document.body.appendChild(el);
|
|
208
214
|
var closeFn = function () {
|
|
@@ -210,7 +216,7 @@ function showPopup(referenceElement, placement, Component, closeOnHoverEnd, onCl
|
|
|
210
216
|
el.remove();
|
|
211
217
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
212
218
|
};
|
|
213
|
-
react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn,
|
|
219
|
+
react_dom_1.default.render(React.createElement(PopupPositioner, { getReferenceElement: function () { return referenceElement; }, placement: placement, onClose: closeFn, shouldClose: shouldClose, closeOnHoverEnd: closeOnHoverEnd || false },
|
|
214
220
|
React.createElement(Component, { closePopup: closeFn })), el);
|
|
215
221
|
return { close: closeFn };
|
|
216
222
|
}
|
|
@@ -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
|
-
}, this.props.
|
|
76
|
+
}, this.props.shouldClose).close;
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
WithPopover.prototype.render = function () {
|