@progress/kendo-react-popup 4.13.0-dev.202111300702 → 4.13.0
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/dist/cdn/js/kendo-react-popup.js +1 -1
- package/dist/es/Popup.d.ts +16 -3
- package/dist/es/Popup.js +51 -39
- package/dist/es/models/Align.d.ts +2 -1
- package/dist/es/models/Margin.d.ts +14 -0
- package/dist/es/models/{AlignElementSettings.js → Margin.js} +0 -0
- package/dist/es/models/Offset.d.ts +2 -1
- package/dist/es/models/PopupSettings.d.ts +37 -13
- package/dist/es/models/PositionMode.d.ts +5 -0
- package/dist/es/models/{Position.js → PositionMode.js} +0 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/util.d.ts +1 -39
- package/dist/es/util.js +0 -102
- package/dist/npm/Popup.d.ts +16 -3
- package/dist/npm/Popup.js +66 -54
- package/dist/npm/models/Align.d.ts +2 -1
- package/dist/npm/models/Margin.d.ts +14 -0
- package/dist/npm/models/{AlignElementSettings.js → Margin.js} +0 -0
- package/dist/npm/models/Offset.d.ts +2 -1
- package/dist/npm/models/PopupSettings.d.ts +37 -13
- package/dist/npm/models/PositionMode.d.ts +5 -0
- package/dist/npm/models/{Position.js → PositionMode.js} +0 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/util.d.ts +1 -39
- package/dist/npm/util.js +0 -102
- package/dist/systemjs/kendo-react-popup.js +1 -1
- package/package.json +3 -3
- package/dist/es/models/AlignElementSettings.d.ts +0 -11
- package/dist/es/models/Position.d.ts +0 -8
- package/dist/es/models/positionElementSettings.d.ts +0 -13
- package/dist/es/models/positionElementSettings.js +0 -0
- package/dist/es/services/alignService.d.ts +0 -14
- package/dist/es/services/alignService.js +0 -43
- package/dist/es/services/domService.d.ts +0 -34
- package/dist/es/services/domService.js +0 -140
- package/dist/es/services/positionService.d.ts +0 -12
- package/dist/es/services/positionService.js +0 -34
- package/dist/npm/models/AlignElementSettings.d.ts +0 -11
- package/dist/npm/models/Position.d.ts +0 -8
- package/dist/npm/models/positionElementSettings.d.ts +0 -13
- package/dist/npm/models/positionElementSettings.js +0 -2
- package/dist/npm/services/alignService.d.ts +0 -14
- package/dist/npm/services/alignService.js +0 -45
- package/dist/npm/services/domService.d.ts +0 -34
- package/dist/npm/services/domService.js +0 -142
- package/dist/npm/services/positionService.d.ts +0 -12
- package/dist/npm/services/positionService.js +0 -36
|
@@ -4,10 +4,13 @@ import { Align } from './Align';
|
|
|
4
4
|
import { OpenEvent, CloseEvent } from './Events';
|
|
5
5
|
import { Offset } from './Offset';
|
|
6
6
|
import { PopupAnimation } from './PopupAnimation';
|
|
7
|
+
import { Margin } from './Margin';
|
|
8
|
+
import { PositionMode } from './PositionMode';
|
|
9
|
+
import { PopupSettings as PopupSettingsBase } from '@progress/kendo-popup-common';
|
|
7
10
|
/**
|
|
8
11
|
* @hidden
|
|
9
12
|
*/
|
|
10
|
-
export interface PopupSettings {
|
|
13
|
+
export interface PopupSettings extends PopupSettingsBase {
|
|
11
14
|
/**
|
|
12
15
|
* Controls the Popup animation ([see example]({% slug animations_popup %})). By default, the opening and closing animations are enabled.
|
|
13
16
|
*/
|
|
@@ -16,22 +19,51 @@ export interface PopupSettings {
|
|
|
16
19
|
* Specifies the element which will be used as an anchor ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that element.
|
|
17
20
|
*/
|
|
18
21
|
anchor?: HTMLElement | null;
|
|
19
|
-
/**
|
|
20
|
-
* Specifies the pivot point of the anchor ([see example]({% slug alignmentpositioning_popup %})).
|
|
21
|
-
*/
|
|
22
|
-
anchorAlign?: Align;
|
|
23
22
|
/**
|
|
24
23
|
* Defines the container to which the Popup will be appended. Defaults to [`body`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body).
|
|
25
24
|
*/
|
|
26
25
|
appendTo?: HTMLElement | null;
|
|
26
|
+
/**
|
|
27
|
+
* Specifies the pivot point of the anchor ([see example]({% slug alignmentpositioning_popup %})).
|
|
28
|
+
*/
|
|
29
|
+
anchorAlign?: Align;
|
|
27
30
|
/**
|
|
28
31
|
* Configures the collision behavior of the Popup ([see example]({% slug viewportboundarydetection_popup %})).
|
|
29
32
|
*/
|
|
30
33
|
collision?: Collision;
|
|
34
|
+
/**
|
|
35
|
+
* Configures the margin value that will be added to the popup dimensions
|
|
36
|
+
* in pixels and leaves a blank space between the popup and the anchor.
|
|
37
|
+
*/
|
|
38
|
+
margin?: Margin;
|
|
39
|
+
/**
|
|
40
|
+
* Specifies the position mode of the component. By default, the Popup uses fixed positioning.
|
|
41
|
+
* To make the Popup acquire absolute positioning, set this option to `absolute`.
|
|
42
|
+
*
|
|
43
|
+
* > If you need to support mobile browsers with the zoom option, use the `absolute` positioning of the Popup.
|
|
44
|
+
*/
|
|
45
|
+
positionMode?: PositionMode;
|
|
46
|
+
/**
|
|
47
|
+
* Used to set the document scale when using a [scale transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale).
|
|
48
|
+
*
|
|
49
|
+
* The document or container scale is required to compute the popup position correctly. Detecting the scale is not reliable and must be set by providing a value for SCALE. See [Support for Document Scale]({% slug documentscale_popup %}).
|
|
50
|
+
*
|
|
51
|
+
* > Using this token is not necessary for user-applied browser zoom.
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
scale?: number;
|
|
31
55
|
/**
|
|
32
56
|
* Specifies the pivot point of the Popup ([see example]({% slug alignmentpositioning_popup %})).
|
|
33
57
|
*/
|
|
34
58
|
popupAlign?: Align;
|
|
59
|
+
/**
|
|
60
|
+
* Specifies the absolute position of the element ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that point. The pivot point of the Popup is defined by the `popupAlign` configuration option. The boundary detection is applied by using the window viewport.
|
|
61
|
+
*/
|
|
62
|
+
offset?: Offset;
|
|
63
|
+
/**
|
|
64
|
+
* Specifies a list of CSS classes that will be added to the internal animated element ([see example]({% slug appearance_popup %})).
|
|
65
|
+
*/
|
|
66
|
+
popupClass?: string | Array<string>;
|
|
35
67
|
/**
|
|
36
68
|
* Specifies a list of CSS classes that will be added to the Popup element.
|
|
37
69
|
*/
|
|
@@ -40,18 +72,10 @@ export interface PopupSettings {
|
|
|
40
72
|
* Specifies the id that will be added to the Popup element.
|
|
41
73
|
*/
|
|
42
74
|
id?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Specifies a list of CSS classes that will be added to the internal animated element ([see example]({% slug appearance_popup %})).
|
|
45
|
-
*/
|
|
46
|
-
popupClass?: string | Array<string>;
|
|
47
75
|
/**
|
|
48
76
|
* Represents the styles that are applied to the Popup.
|
|
49
77
|
*/
|
|
50
78
|
style?: React.CSSProperties;
|
|
51
|
-
/**
|
|
52
|
-
* Specifies the absolute position of the element ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that point. The pivot point of the Popup is defined by the `popupAlign` configuration option. The boundary detection is applied by using the window viewport.
|
|
53
|
-
*/
|
|
54
|
-
offset?: Offset;
|
|
55
79
|
/**
|
|
56
80
|
* Fires after the Popup is opened and the opening animation ends.
|
|
57
81
|
*/
|
|
File without changes
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-popup',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1638879960,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
package/dist/es/util.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare const eitherRect: (rect: ElementRect, offset: OffsetPosition) => ElementRect;
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
export declare const replaceOffset: (rect: ElementRect, offset: OffsetPosition) => ElementRect;
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare const removeStackingOffset: (rect: ElementRect, stackingOffset: ElementRect) => ElementRect;
|
|
1
|
+
import { OffsetPosition } from '@progress/kendo-popup-common';
|
|
14
2
|
/**
|
|
15
3
|
* @hidden
|
|
16
4
|
*/
|
|
@@ -19,26 +7,10 @@ export declare const isDifferentOffset: (oldOffset: OffsetPosition, newOffset: O
|
|
|
19
7
|
* @hidden
|
|
20
8
|
*/
|
|
21
9
|
export declare const hasBoundingRect: (elem: HTMLElement) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
export declare const OVERFLOW_REGEXP: RegExp;
|
|
26
|
-
/**
|
|
27
|
-
* @hidden
|
|
28
|
-
*/
|
|
29
|
-
export declare const scrollableParents: (element: HTMLElement) => any[];
|
|
30
10
|
/**
|
|
31
11
|
* @hidden
|
|
32
12
|
*/
|
|
33
13
|
export declare const FRAME_DURATION: number;
|
|
34
|
-
/**
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
export declare const HAS_RELATIVE_STACKING_CONTEXT: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* @hidden
|
|
40
|
-
*/
|
|
41
|
-
export declare const zIndex: (anchor: HTMLElement, container: HTMLElement) => number;
|
|
42
14
|
/**
|
|
43
15
|
* @hidden
|
|
44
16
|
*/
|
|
@@ -46,16 +18,6 @@ export declare const CollisionType: {
|
|
|
46
18
|
fit: string;
|
|
47
19
|
flip: string;
|
|
48
20
|
};
|
|
49
|
-
/**
|
|
50
|
-
* @hidden
|
|
51
|
-
*/
|
|
52
|
-
export declare const AlignPoint: {
|
|
53
|
-
left: string;
|
|
54
|
-
center: string;
|
|
55
|
-
right: string;
|
|
56
|
-
bottom: string;
|
|
57
|
-
top: string;
|
|
58
|
-
};
|
|
59
21
|
/**
|
|
60
22
|
* @hidden
|
|
61
23
|
*/
|
package/dist/es/util.js
CHANGED
|
@@ -1,44 +1,3 @@
|
|
|
1
|
-
import { parents, siblingContainer } from '@progress/kendo-popup-common';
|
|
2
|
-
import { canUseDOM, hasRelativeStackingContext } from '@progress/kendo-react-common';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
export var eitherRect = function (rect, offset) {
|
|
7
|
-
if (!rect) {
|
|
8
|
-
return { height: 0, left: offset.left, top: offset.top, width: 0 };
|
|
9
|
-
}
|
|
10
|
-
return rect;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export var replaceOffset = function (rect, offset) {
|
|
16
|
-
if (!offset) {
|
|
17
|
-
return rect;
|
|
18
|
-
}
|
|
19
|
-
var result = {
|
|
20
|
-
height: rect.height,
|
|
21
|
-
left: offset.left,
|
|
22
|
-
top: offset.top,
|
|
23
|
-
width: rect.width
|
|
24
|
-
};
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
export var removeStackingOffset = function (rect, stackingOffset) {
|
|
31
|
-
if (!stackingOffset) {
|
|
32
|
-
return rect;
|
|
33
|
-
}
|
|
34
|
-
var result = {
|
|
35
|
-
height: rect.height,
|
|
36
|
-
left: rect.left - stackingOffset.left,
|
|
37
|
-
top: rect.top - stackingOffset.top,
|
|
38
|
-
width: rect.width
|
|
39
|
-
};
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
1
|
/**
|
|
43
2
|
* @hidden
|
|
44
3
|
*/
|
|
@@ -51,61 +10,10 @@ export var isDifferentOffset = function (oldOffset, newOffset) {
|
|
|
51
10
|
* @hidden
|
|
52
11
|
*/
|
|
53
12
|
export var hasBoundingRect = function (elem) { return !!elem.getBoundingClientRect; };
|
|
54
|
-
/**
|
|
55
|
-
* @hidden
|
|
56
|
-
*/
|
|
57
|
-
export var OVERFLOW_REGEXP = /auto|scroll/;
|
|
58
|
-
/**
|
|
59
|
-
* @hidden
|
|
60
|
-
*/
|
|
61
|
-
var overflowStyle = function (element) {
|
|
62
|
-
var styles = window.getComputedStyle(element);
|
|
63
|
-
return "" + styles.overflow + styles.overflowX + styles.overflowY;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* @hidden
|
|
67
|
-
*/
|
|
68
|
-
export var scrollableParents = function (element) {
|
|
69
|
-
var parentElements = [];
|
|
70
|
-
if (!canUseDOM) {
|
|
71
|
-
return parentElements;
|
|
72
|
-
}
|
|
73
|
-
var parent = element.parentElement;
|
|
74
|
-
while (parent) {
|
|
75
|
-
if (OVERFLOW_REGEXP.test(overflowStyle(parent))) {
|
|
76
|
-
parentElements.push(parent);
|
|
77
|
-
}
|
|
78
|
-
parent = parent.parentElement;
|
|
79
|
-
}
|
|
80
|
-
parentElements.push(window);
|
|
81
|
-
return parentElements;
|
|
82
|
-
};
|
|
83
13
|
/**
|
|
84
14
|
* @hidden
|
|
85
15
|
*/
|
|
86
16
|
export var FRAME_DURATION = 1000 / 60; // 1000ms divided by 60fps
|
|
87
|
-
/**
|
|
88
|
-
* @hidden
|
|
89
|
-
*/
|
|
90
|
-
export var HAS_RELATIVE_STACKING_CONTEXT = hasRelativeStackingContext();
|
|
91
|
-
/**
|
|
92
|
-
* @hidden
|
|
93
|
-
*/
|
|
94
|
-
export var zIndex = function (anchor, container) {
|
|
95
|
-
if (!anchor || !canUseDOM) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
var sibling = siblingContainer(anchor, container);
|
|
99
|
-
if (!sibling) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
var result = [anchor].concat(parents(anchor, sibling)).reduce(function (index, p) {
|
|
103
|
-
var zIndexStyle = p.style.zIndex || window.getComputedStyle(p).zIndex;
|
|
104
|
-
var current = parseInt(zIndexStyle, 10);
|
|
105
|
-
return current > index ? current : index;
|
|
106
|
-
}, 0);
|
|
107
|
-
return result ? (result + 1) : null;
|
|
108
|
-
};
|
|
109
17
|
/**
|
|
110
18
|
* @hidden
|
|
111
19
|
*/
|
|
@@ -113,16 +21,6 @@ export var CollisionType = {
|
|
|
113
21
|
fit: 'fit',
|
|
114
22
|
flip: 'flip'
|
|
115
23
|
};
|
|
116
|
-
/**
|
|
117
|
-
* @hidden
|
|
118
|
-
*/
|
|
119
|
-
export var AlignPoint = {
|
|
120
|
-
left: 'left',
|
|
121
|
-
center: 'center',
|
|
122
|
-
right: 'right',
|
|
123
|
-
bottom: 'bottom',
|
|
124
|
-
top: 'top'
|
|
125
|
-
};
|
|
126
24
|
/**
|
|
127
25
|
* @hidden
|
|
128
26
|
*/
|
package/dist/npm/Popup.d.ts
CHANGED
|
@@ -66,6 +66,12 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
|
|
|
66
66
|
openDuration: PropTypes.Requireable<number>;
|
|
67
67
|
closeDuration: PropTypes.Requireable<number>;
|
|
68
68
|
}>>;
|
|
69
|
+
margin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
70
|
+
horizontal: PropTypes.Requireable<number>;
|
|
71
|
+
vertical: PropTypes.Requireable<number>;
|
|
72
|
+
}>>;
|
|
73
|
+
positionMode: PropTypes.Requireable<string>;
|
|
74
|
+
scale: PropTypes.Requireable<number>;
|
|
69
75
|
};
|
|
70
76
|
/**
|
|
71
77
|
* @hidden
|
|
@@ -89,14 +95,20 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
|
|
|
89
95
|
};
|
|
90
96
|
animate: boolean;
|
|
91
97
|
show: boolean;
|
|
98
|
+
margin: {
|
|
99
|
+
horizontal: number;
|
|
100
|
+
vertical: number;
|
|
101
|
+
};
|
|
102
|
+
positionMode: string;
|
|
92
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* @hidden
|
|
106
|
+
*/
|
|
107
|
+
static contextType: React.Context<number>;
|
|
93
108
|
/**
|
|
94
109
|
* @hidden
|
|
95
110
|
*/
|
|
96
111
|
readonly state: PopupState;
|
|
97
|
-
private _alignService;
|
|
98
|
-
private _positionService;
|
|
99
|
-
private _domService;
|
|
100
112
|
private _flipped;
|
|
101
113
|
private _scrollableParents;
|
|
102
114
|
private _popup;
|
|
@@ -147,5 +159,6 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
|
|
|
147
159
|
private attachRepositionHandlers;
|
|
148
160
|
private detachRepositionHandlers;
|
|
149
161
|
private reposition;
|
|
162
|
+
private getCurrentZIndex;
|
|
150
163
|
}
|
|
151
164
|
export {};
|
package/dist/npm/Popup.js
CHANGED
|
@@ -29,12 +29,11 @@ var ReactDOM = require("react-dom");
|
|
|
29
29
|
var PropTypes = require("prop-types");
|
|
30
30
|
var animation_1 = require("./animation");
|
|
31
31
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
32
|
+
var kendo_popup_common_1 = require("@progress/kendo-popup-common");
|
|
32
33
|
var util_1 = require("./util");
|
|
33
|
-
var alignService_1 = require("./services/alignService");
|
|
34
|
-
var domService_1 = require("./services/domService");
|
|
35
|
-
var positionService_1 = require("./services/positionService");
|
|
36
|
-
var kendo_react_common_2 = require("@progress/kendo-react-common");
|
|
37
34
|
var package_metadata_1 = require("./package-metadata");
|
|
35
|
+
var DEFAULT_POPUP_ZINDEX = 100;
|
|
36
|
+
var ZINDEX_POPUP_STEP = 1;
|
|
38
37
|
function isEquivalent(a, b) {
|
|
39
38
|
if (a === b) {
|
|
40
39
|
return true;
|
|
@@ -90,36 +89,30 @@ var Popup = /** @class */ (function (_super) {
|
|
|
90
89
|
_this.setState({ current: Status.shown, previous: _this.state.current });
|
|
91
90
|
};
|
|
92
91
|
_this.setPosition = function (popup) {
|
|
93
|
-
var _a = _this.props, anchorAlign = _a.anchorAlign, popupAlign = _a.popupAlign, collision = _a.collision, offset = _a.offset, anchor = _a.anchor;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
popupContent.style.position = 'absolute';
|
|
98
|
-
// Width and height are required since absolute position breaks the element sizing.
|
|
99
|
-
popupContent.style.width = contentWidth;
|
|
100
|
-
popupContent.style.height = contentHeight;
|
|
101
|
-
var alignedOffset = _this._alignService.alignElement({
|
|
92
|
+
var _a = _this.props, anchorAlign = _a.anchorAlign, popupAlign = _a.popupAlign, collision = _a.collision, offset = _a.offset, anchor = _a.anchor, margin = _a.margin, scale = _a.scale, positionMode = _a.positionMode;
|
|
93
|
+
popup.style.top = '0px';
|
|
94
|
+
popup.style.left = '-10000px';
|
|
95
|
+
var alignedOffset = kendo_popup_common_1.alignElement({
|
|
102
96
|
anchor: anchor,
|
|
103
|
-
element:
|
|
97
|
+
element: popup,
|
|
104
98
|
elementAlign: popupAlign,
|
|
105
99
|
anchorAlign: anchorAlign,
|
|
106
|
-
offset: offset
|
|
100
|
+
offset: offset,
|
|
101
|
+
margin: margin,
|
|
102
|
+
positionMode: positionMode,
|
|
103
|
+
scale: scale
|
|
107
104
|
});
|
|
108
|
-
var position =
|
|
105
|
+
var position = kendo_popup_common_1.positionElement({
|
|
109
106
|
anchor: anchor,
|
|
110
107
|
anchorAlign: anchorAlign,
|
|
111
108
|
collisions: collision,
|
|
112
|
-
element:
|
|
109
|
+
element: popup,
|
|
113
110
|
currentLocation: alignedOffset,
|
|
114
|
-
elementAlign: popupAlign
|
|
111
|
+
elementAlign: popupAlign,
|
|
112
|
+
margin: _this.props.margin
|
|
115
113
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
popup.style.left = position.offset.left + 'px';
|
|
119
|
-
popupContent.style.position = '';
|
|
120
|
-
popupContent.style.width = '';
|
|
121
|
-
popupContent.style.height = '';
|
|
122
|
-
}
|
|
114
|
+
popup.style.top = position.offset.top + 'px';
|
|
115
|
+
popup.style.left = position.offset.left + 'px';
|
|
123
116
|
_this._flipped = position.flipped;
|
|
124
117
|
};
|
|
125
118
|
_this.onOpened = function () {
|
|
@@ -152,10 +145,10 @@ var Popup = /** @class */ (function (_super) {
|
|
|
152
145
|
_this.props.onClose.call(undefined, { target: _this });
|
|
153
146
|
}
|
|
154
147
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
148
|
+
_this.getCurrentZIndex = function () {
|
|
149
|
+
return _this.context ? _this.context + ZINDEX_POPUP_STEP : DEFAULT_POPUP_ZINDEX;
|
|
150
|
+
};
|
|
151
|
+
kendo_react_common_1.validatePackage(package_metadata_1.packageMetadata);
|
|
159
152
|
_this.reposition = util_1.throttle(_this.reposition.bind(_this), util_1.FRAME_DURATION);
|
|
160
153
|
return _this;
|
|
161
154
|
}
|
|
@@ -231,7 +224,7 @@ var Popup = /** @class */ (function (_super) {
|
|
|
231
224
|
*/
|
|
232
225
|
Popup.prototype.render = function () {
|
|
233
226
|
var _this = this;
|
|
234
|
-
var _a = this.props, children = _a.children, className = _a.className, popupClass = _a.popupClass, show = _a.show, id = _a.id;
|
|
227
|
+
var _a = this.props, children = _a.children, className = _a.className, popupClass = _a.popupClass, show = _a.show, id = _a.id, positionMode = _a.positionMode;
|
|
235
228
|
var appendTo = this.props.appendTo ?
|
|
236
229
|
this.props.appendTo :
|
|
237
230
|
kendo_react_common_1.canUseDOM ?
|
|
@@ -240,12 +233,14 @@ var Popup = /** @class */ (function (_super) {
|
|
|
240
233
|
if (this.state.current === Status.reposition && this.state.previous === Status.shown && this._popup) {
|
|
241
234
|
this.setPosition(this._popup);
|
|
242
235
|
}
|
|
243
|
-
var style = Object.assign({}, { position:
|
|
236
|
+
var style = Object.assign({}, { position: positionMode }, this.props.style || {});
|
|
244
237
|
var closing = this.state.current === Status.hiding;
|
|
245
238
|
if ((show || closing) && appendTo) {
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
var currentZIndex = this.getCurrentZIndex();
|
|
240
|
+
var popupElement = (React.createElement(kendo_react_common_1.ZIndexContext.Provider, { value: currentZIndex },
|
|
241
|
+
React.createElement("div", { className: kendo_react_common_1.classNames(ANIMATION_CONTAINER, ANIMATION_CONTAINER_RELATIVE, className), id: id, ref: function (e) { return _this._popup = e; }, style: __assign({ zIndex: currentZIndex }, style) },
|
|
242
|
+
React.createElement("div", { className: kendo_react_common_1.classNames(popupClass, K_POPUP, ANIMATION_CONTAINER_CHILD), style: { transitionDelay: '0ms' } }, children))));
|
|
243
|
+
return ReactDOM.createPortal(popupElement, appendTo);
|
|
249
244
|
}
|
|
250
245
|
return null;
|
|
251
246
|
};
|
|
@@ -271,7 +266,7 @@ var Popup = /** @class */ (function (_super) {
|
|
|
271
266
|
Popup.prototype.attachRepositionHandlers = function (element) {
|
|
272
267
|
var _this = this;
|
|
273
268
|
this.detachRepositionHandlers();
|
|
274
|
-
this._scrollableParents =
|
|
269
|
+
this._scrollableParents = kendo_popup_common_1.domUtils.scrollableParents(this.props.anchor || element);
|
|
275
270
|
this._scrollableParents.map(function (p) { return p.addEventListener('scroll', _this.reposition); });
|
|
276
271
|
window.addEventListener('resize', this.reposition);
|
|
277
272
|
};
|
|
@@ -319,26 +314,26 @@ var Popup = /** @class */ (function (_super) {
|
|
|
319
314
|
}),
|
|
320
315
|
anchorAlign: PropTypes.shape({
|
|
321
316
|
horizontal: PropTypes.oneOf([
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
317
|
+
kendo_popup_common_1.AlignPoint.left,
|
|
318
|
+
kendo_popup_common_1.AlignPoint.center,
|
|
319
|
+
kendo_popup_common_1.AlignPoint.right
|
|
325
320
|
]),
|
|
326
321
|
vertical: PropTypes.oneOf([
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
322
|
+
kendo_popup_common_1.AlignPoint.top,
|
|
323
|
+
kendo_popup_common_1.AlignPoint.center,
|
|
324
|
+
kendo_popup_common_1.AlignPoint.bottom
|
|
330
325
|
])
|
|
331
326
|
}),
|
|
332
327
|
popupAlign: PropTypes.shape({
|
|
333
328
|
horizontal: PropTypes.oneOf([
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
329
|
+
kendo_popup_common_1.AlignPoint.left,
|
|
330
|
+
kendo_popup_common_1.AlignPoint.center,
|
|
331
|
+
kendo_popup_common_1.AlignPoint.right
|
|
337
332
|
]),
|
|
338
333
|
vertical: PropTypes.oneOf([
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
334
|
+
kendo_popup_common_1.AlignPoint.top,
|
|
335
|
+
kendo_popup_common_1.AlignPoint.center,
|
|
336
|
+
kendo_popup_common_1.AlignPoint.bottom
|
|
342
337
|
])
|
|
343
338
|
}),
|
|
344
339
|
offset: PropTypes.shape({
|
|
@@ -356,7 +351,16 @@ var Popup = /** @class */ (function (_super) {
|
|
|
356
351
|
openDuration: PropTypes.number,
|
|
357
352
|
closeDuration: PropTypes.number
|
|
358
353
|
})
|
|
359
|
-
])
|
|
354
|
+
]),
|
|
355
|
+
margin: PropTypes.shape({
|
|
356
|
+
horizontal: PropTypes.number,
|
|
357
|
+
vertical: PropTypes.number
|
|
358
|
+
}),
|
|
359
|
+
positionMode: PropTypes.oneOf([
|
|
360
|
+
'fixed',
|
|
361
|
+
'absolute'
|
|
362
|
+
]),
|
|
363
|
+
scale: PropTypes.number
|
|
360
364
|
};
|
|
361
365
|
/**
|
|
362
366
|
* @hidden
|
|
@@ -367,18 +371,26 @@ var Popup = /** @class */ (function (_super) {
|
|
|
367
371
|
vertical: util_1.CollisionType.flip
|
|
368
372
|
},
|
|
369
373
|
anchorAlign: {
|
|
370
|
-
horizontal:
|
|
371
|
-
vertical:
|
|
374
|
+
horizontal: kendo_popup_common_1.AlignPoint.left,
|
|
375
|
+
vertical: kendo_popup_common_1.AlignPoint.bottom
|
|
372
376
|
},
|
|
373
377
|
popupAlign: {
|
|
374
|
-
horizontal:
|
|
375
|
-
vertical:
|
|
378
|
+
horizontal: kendo_popup_common_1.AlignPoint.left,
|
|
379
|
+
vertical: kendo_popup_common_1.AlignPoint.top
|
|
376
380
|
},
|
|
377
381
|
offset: DEFAULT_OFFSET,
|
|
378
382
|
animate: true,
|
|
379
|
-
|
|
380
|
-
|
|
383
|
+
show: false,
|
|
384
|
+
margin: {
|
|
385
|
+
horizontal: 0,
|
|
386
|
+
vertical: 0
|
|
387
|
+
},
|
|
388
|
+
positionMode: 'absolute'
|
|
381
389
|
};
|
|
390
|
+
/**
|
|
391
|
+
* @hidden
|
|
392
|
+
*/
|
|
393
|
+
Popup.contextType = kendo_react_common_1.ZIndexContext;
|
|
382
394
|
return Popup;
|
|
383
395
|
}(React.Component));
|
|
384
396
|
exports.Popup = Popup;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AlignStrategy } from '@progress/kendo-popup-common';
|
|
1
2
|
/**
|
|
2
3
|
* Defines the horizontal and vertical aligning point of the Popup.
|
|
3
4
|
*/
|
|
4
|
-
export interface Align {
|
|
5
|
+
export interface Align extends AlignStrategy {
|
|
5
6
|
/**
|
|
6
7
|
* Defines the possible horizontal point values that are relative to the anchor or the Popup.
|
|
7
8
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MarginSettings } from '@progress/kendo-popup-common';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the horizontal and the vertical margin offset of the component.
|
|
4
|
+
*/
|
|
5
|
+
export interface Margin extends MarginSettings {
|
|
6
|
+
/**
|
|
7
|
+
* Defines the possible horizontal margin value.
|
|
8
|
+
*/
|
|
9
|
+
horizontal: number;
|
|
10
|
+
/**
|
|
11
|
+
* Defines the possible vertical margin value.
|
|
12
|
+
*/
|
|
13
|
+
vertical: number;
|
|
14
|
+
}
|
|
File without changes
|
|
@@ -4,10 +4,13 @@ import { Align } from './Align';
|
|
|
4
4
|
import { OpenEvent, CloseEvent } from './Events';
|
|
5
5
|
import { Offset } from './Offset';
|
|
6
6
|
import { PopupAnimation } from './PopupAnimation';
|
|
7
|
+
import { Margin } from './Margin';
|
|
8
|
+
import { PositionMode } from './PositionMode';
|
|
9
|
+
import { PopupSettings as PopupSettingsBase } from '@progress/kendo-popup-common';
|
|
7
10
|
/**
|
|
8
11
|
* @hidden
|
|
9
12
|
*/
|
|
10
|
-
export interface PopupSettings {
|
|
13
|
+
export interface PopupSettings extends PopupSettingsBase {
|
|
11
14
|
/**
|
|
12
15
|
* Controls the Popup animation ([see example]({% slug animations_popup %})). By default, the opening and closing animations are enabled.
|
|
13
16
|
*/
|
|
@@ -16,22 +19,51 @@ export interface PopupSettings {
|
|
|
16
19
|
* Specifies the element which will be used as an anchor ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that element.
|
|
17
20
|
*/
|
|
18
21
|
anchor?: HTMLElement | null;
|
|
19
|
-
/**
|
|
20
|
-
* Specifies the pivot point of the anchor ([see example]({% slug alignmentpositioning_popup %})).
|
|
21
|
-
*/
|
|
22
|
-
anchorAlign?: Align;
|
|
23
22
|
/**
|
|
24
23
|
* Defines the container to which the Popup will be appended. Defaults to [`body`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body).
|
|
25
24
|
*/
|
|
26
25
|
appendTo?: HTMLElement | null;
|
|
26
|
+
/**
|
|
27
|
+
* Specifies the pivot point of the anchor ([see example]({% slug alignmentpositioning_popup %})).
|
|
28
|
+
*/
|
|
29
|
+
anchorAlign?: Align;
|
|
27
30
|
/**
|
|
28
31
|
* Configures the collision behavior of the Popup ([see example]({% slug viewportboundarydetection_popup %})).
|
|
29
32
|
*/
|
|
30
33
|
collision?: Collision;
|
|
34
|
+
/**
|
|
35
|
+
* Configures the margin value that will be added to the popup dimensions
|
|
36
|
+
* in pixels and leaves a blank space between the popup and the anchor.
|
|
37
|
+
*/
|
|
38
|
+
margin?: Margin;
|
|
39
|
+
/**
|
|
40
|
+
* Specifies the position mode of the component. By default, the Popup uses fixed positioning.
|
|
41
|
+
* To make the Popup acquire absolute positioning, set this option to `absolute`.
|
|
42
|
+
*
|
|
43
|
+
* > If you need to support mobile browsers with the zoom option, use the `absolute` positioning of the Popup.
|
|
44
|
+
*/
|
|
45
|
+
positionMode?: PositionMode;
|
|
46
|
+
/**
|
|
47
|
+
* Used to set the document scale when using a [scale transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale).
|
|
48
|
+
*
|
|
49
|
+
* The document or container scale is required to compute the popup position correctly. Detecting the scale is not reliable and must be set by providing a value for SCALE. See [Support for Document Scale]({% slug documentscale_popup %}).
|
|
50
|
+
*
|
|
51
|
+
* > Using this token is not necessary for user-applied browser zoom.
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
scale?: number;
|
|
31
55
|
/**
|
|
32
56
|
* Specifies the pivot point of the Popup ([see example]({% slug alignmentpositioning_popup %})).
|
|
33
57
|
*/
|
|
34
58
|
popupAlign?: Align;
|
|
59
|
+
/**
|
|
60
|
+
* Specifies the absolute position of the element ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that point. The pivot point of the Popup is defined by the `popupAlign` configuration option. The boundary detection is applied by using the window viewport.
|
|
61
|
+
*/
|
|
62
|
+
offset?: Offset;
|
|
63
|
+
/**
|
|
64
|
+
* Specifies a list of CSS classes that will be added to the internal animated element ([see example]({% slug appearance_popup %})).
|
|
65
|
+
*/
|
|
66
|
+
popupClass?: string | Array<string>;
|
|
35
67
|
/**
|
|
36
68
|
* Specifies a list of CSS classes that will be added to the Popup element.
|
|
37
69
|
*/
|
|
@@ -40,18 +72,10 @@ export interface PopupSettings {
|
|
|
40
72
|
* Specifies the id that will be added to the Popup element.
|
|
41
73
|
*/
|
|
42
74
|
id?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Specifies a list of CSS classes that will be added to the internal animated element ([see example]({% slug appearance_popup %})).
|
|
45
|
-
*/
|
|
46
|
-
popupClass?: string | Array<string>;
|
|
47
75
|
/**
|
|
48
76
|
* Represents the styles that are applied to the Popup.
|
|
49
77
|
*/
|
|
50
78
|
style?: React.CSSProperties;
|
|
51
|
-
/**
|
|
52
|
-
* Specifies the absolute position of the element ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that point. The pivot point of the Popup is defined by the `popupAlign` configuration option. The boundary detection is applied by using the window viewport.
|
|
53
|
-
*/
|
|
54
|
-
offset?: Offset;
|
|
55
79
|
/**
|
|
56
80
|
* Fires after the Popup is opened and the opening animation ends.
|
|
57
81
|
*/
|