@zohodesk/components 1.5.2 → 1.5.4-temp-1
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/README.md +21 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +2 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +2 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +2 -0
- package/es/CheckBox/CheckBox.js +21 -10
- package/es/CheckBox/CheckBox.module.css +21 -6
- package/es/CheckBox/__tests__/CheckBox.spec.js +9 -0
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
- package/es/CheckBox/props/propTypes.js +4 -1
- package/es/DropBox/DropBoxElement/DropBoxElement.js +1 -1
- package/es/DropBox/utils/isMobilePopover.js +3 -14
- package/es/Label/Label.js +19 -1
- package/es/Label/__tests__/Label.spec.js +58 -0
- package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
- package/es/Label/props/defaultProps.js +1 -0
- package/es/Label/props/propTypes.js +7 -1
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +7 -7
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +7 -7
- package/es/Popup/Popup.js +32 -1045
- package/es/Radio/Radio.js +20 -9
- package/es/Radio/Radio.module.css +38 -5
- package/es/Radio/__tests__/Radio.spec.js +10 -0
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +154 -81
- package/es/Radio/props/propTypes.js +4 -1
- package/es/Tag/Tag.js +5 -2
- package/es/Tag/props/propTypes.js +2 -0
- package/es/utils/Common.js +1 -1
- package/es/v1/Popup/Popup.js +2 -2
- package/lib/CheckBox/CheckBox.js +23 -9
- package/lib/CheckBox/CheckBox.module.css +21 -6
- package/lib/CheckBox/__tests__/CheckBox.spec.js +21 -12
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
- package/lib/CheckBox/props/propTypes.js +5 -1
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +5 -5
- package/lib/DropBox/utils/isMobilePopover.js +4 -14
- package/lib/Label/Label.js +21 -1
- package/lib/Label/__tests__/Label.spec.js +58 -0
- package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
- package/lib/Label/props/defaultProps.js +1 -0
- package/lib/Label/props/propTypes.js +8 -1
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +7 -7
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +7 -7
- package/lib/Popup/Popup.js +36 -1149
- package/lib/Radio/Radio.js +22 -8
- package/lib/Radio/Radio.module.css +38 -5
- package/lib/Radio/__tests__/Radio.spec.js +10 -0
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +154 -81
- package/lib/Radio/props/propTypes.js +5 -1
- package/lib/Tag/Tag.js +6 -2
- package/lib/Tag/props/propTypes.js +2 -0
- package/lib/utils/Common.js +1 -1
- package/lib/v1/Popup/Popup.js +4 -4
- package/package.json +9 -9
- package/es/DropBox/DropBoxPositionMapping.js +0 -142
- package/es/Popup/PositionMapping.js +0 -72
- package/es/Popup/Registry.js +0 -36
- package/es/Popup/intersectionObserver.js +0 -49
- package/es/Popup/viewPort.js +0 -373
- package/lib/DropBox/DropBoxPositionMapping.js +0 -149
- package/lib/Popup/PositionMapping.js +0 -81
- package/lib/Popup/Registry.js +0 -46
- package/lib/Popup/intersectionObserver.js +0 -72
- package/lib/Popup/viewPort.js +0 -367
package/es/Popup/viewPort.js
DELETED
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
const defaultOrder = ['bottomCenter', 'bottomLeftToRight', 'bottomCenterToRight', 'bottomRightToLeft', 'bottomCenterToLeft', 'topCenter', 'topLeftToRight', 'topCenterToRight', 'topRightToLeft', 'topCenterToLeft', 'rightTopToBottom', 'rightCenterToBottom', 'rightCenter', 'rightBottomToTop', 'rightCenterToTop', 'leftTopToBottom', 'leftCenterToBottom', 'leftCenter', 'leftBottomToTop', 'leftCenterToTop', 'bottomRight', 'bottomLeft', 'topRight', 'topLeft', 'rightBottom', 'rightTop', 'leftBottom', 'leftTop'];
|
|
2
|
-
let viewPort = {
|
|
3
|
-
frameRelativeRects: (el, customFrame, documentEle) => {
|
|
4
|
-
if (!el) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
let rectTemp = el.getBoundingClientRect();
|
|
9
|
-
let rect = {
|
|
10
|
-
height: rectTemp.height || el.clientHeight,
|
|
11
|
-
width: rectTemp.width || el.clientWidth,
|
|
12
|
-
top: rectTemp.top,
|
|
13
|
-
bottom: rectTemp.bottom,
|
|
14
|
-
left: rectTemp.left,
|
|
15
|
-
right: rectTemp.right,
|
|
16
|
-
x: rectTemp.x,
|
|
17
|
-
y: rectTemp.y
|
|
18
|
-
};
|
|
19
|
-
documentEle = documentEle ? documentEle : document.documentElement;
|
|
20
|
-
let customFrameRect = {
|
|
21
|
-
top: 0,
|
|
22
|
-
left: 0,
|
|
23
|
-
right: documentEle.clientWidth,
|
|
24
|
-
bottom: documentEle.clientHeight,
|
|
25
|
-
height: documentEle.clientHeight,
|
|
26
|
-
width: documentEle.clientWidth,
|
|
27
|
-
x: 0,
|
|
28
|
-
y: 0
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
if (customFrame) {
|
|
32
|
-
customFrameRect = customFrame.getBoundingClientRect();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let newRect = {
|
|
36
|
-
top: rect.top - customFrameRect.top,
|
|
37
|
-
left: rect.left - customFrameRect.left,
|
|
38
|
-
height: rect.height,
|
|
39
|
-
width: rect.width
|
|
40
|
-
};
|
|
41
|
-
newRect.bottom = newRect.top + newRect.height;
|
|
42
|
-
newRect.right = newRect.left + newRect.width;
|
|
43
|
-
newRect.x = newRect.left;
|
|
44
|
-
newRect.y = newRect.top;
|
|
45
|
-
let rectGap = {
|
|
46
|
-
top: newRect.top,
|
|
47
|
-
left: newRect.left,
|
|
48
|
-
bottom: customFrameRect.height - newRect.bottom,
|
|
49
|
-
right: customFrameRect.width - newRect.right
|
|
50
|
-
};
|
|
51
|
-
rectGap.center = {
|
|
52
|
-
top: rectGap.top + newRect.height / 2,
|
|
53
|
-
left: rectGap.left + newRect.width / 2,
|
|
54
|
-
bottom: rectGap.bottom + newRect.height / 2,
|
|
55
|
-
right: rectGap.right + newRect.width / 2
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
frameRect: customFrameRect,
|
|
59
|
-
rect: newRect,
|
|
60
|
-
rectGap
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
isInViewPort: (el, customFrame) => {
|
|
64
|
-
if (!el) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
let elRects = viewPort.frameRelativeRects(el, customFrame);
|
|
69
|
-
let {
|
|
70
|
-
rect
|
|
71
|
-
} = elRects;
|
|
72
|
-
let {
|
|
73
|
-
frameRect
|
|
74
|
-
} = elRects;
|
|
75
|
-
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= frameRect.height && rect.right <= frameRect.width;
|
|
76
|
-
},
|
|
77
|
-
getViewPortEle: el => {
|
|
78
|
-
return el.closest('[data-viewport-container=true]') ? el.closest('[data-viewport-container=true]') : document.documentElement;
|
|
79
|
-
},
|
|
80
|
-
possibilities: function (el, relativeBox, customFrame) {
|
|
81
|
-
let {
|
|
82
|
-
needArrow,
|
|
83
|
-
isAbsolute
|
|
84
|
-
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
85
|
-
|
|
86
|
-
if (!el) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let elViewPortEle = viewPort.getViewPortEle(el);
|
|
91
|
-
let elRects = viewPort.frameRelativeRects(el, customFrame, elViewPortEle);
|
|
92
|
-
let {
|
|
93
|
-
rect
|
|
94
|
-
} = elRects;
|
|
95
|
-
let relativeBoxViewPortEle = viewPort.getViewPortEle(relativeBox);
|
|
96
|
-
let relativeBoxRects = viewPort.frameRelativeRects(relativeBox, customFrame, relativeBoxViewPortEle);
|
|
97
|
-
let {
|
|
98
|
-
rectGap: relativeBoxGap,
|
|
99
|
-
rect: relativeBoxRect
|
|
100
|
-
} = relativeBoxRects;
|
|
101
|
-
let relativeBoxDocumentRects = viewPort.frameRelativeRects(relativeBox, customFrame);
|
|
102
|
-
let {
|
|
103
|
-
rectGap: documentGap
|
|
104
|
-
} = relativeBoxDocumentRects; //rect => PopOverContainer, relativeBoxGap => PopOverTarget
|
|
105
|
-
//Horizontal ~ ----- X axis
|
|
106
|
-
//Vertical ~ ||||||| Y axis
|
|
107
|
-
|
|
108
|
-
let paddingSpace = 5; // space between target and relative element
|
|
109
|
-
|
|
110
|
-
let arrowSize = needArrow ? 10 : 0;
|
|
111
|
-
let padding = needArrow ? arrowSize : paddingSpace;
|
|
112
|
-
let arrowHorizontalBalancePx = !isAbsolute && needArrow ? 30 : 0;
|
|
113
|
-
let arrowVerticalBalancePx = !isAbsolute && needArrow ? 27 : 0;
|
|
114
|
-
let bottomOverFlow = rect.height + padding > relativeBoxGap.bottom;
|
|
115
|
-
let topOverFlow = rect.height + padding > relativeBoxGap.top;
|
|
116
|
-
let rightOverFlow = rect.width + padding > relativeBoxGap.right;
|
|
117
|
-
let leftOverFlow = rect.width + padding > relativeBoxGap.left;
|
|
118
|
-
let horizontalCenterOverFlow = rect.width / 2 + padding > relativeBoxGap.center.right || rect.width / 2 + padding > relativeBoxGap.center.left;
|
|
119
|
-
let verticalCenterOverFlow = rect.height / 2 + padding > relativeBoxGap.center.top || rect.height / 2 + padding > relativeBoxGap.center.bottom;
|
|
120
|
-
let horizontalLeftToRightOverFlow = rect.width + padding > relativeBoxRect.width + relativeBoxGap.right;
|
|
121
|
-
let horizontalCenterToRightOverFlow = rect.width + padding > relativeBoxGap.center.right || arrowHorizontalBalancePx > relativeBoxGap.center.left;
|
|
122
|
-
let horizontalRightToLeft = rect.width + padding > relativeBoxRect.width + relativeBoxGap.left;
|
|
123
|
-
let horizontalCenterToLeft = rect.width + padding > relativeBoxGap.center.left || arrowHorizontalBalancePx > relativeBoxGap.center.right;
|
|
124
|
-
let verticalTopToBottomOverFlow = rect.height + padding > relativeBoxRect.height + relativeBoxGap.bottom;
|
|
125
|
-
let verticalCenterToBottomOverFlow = rect.height + padding > relativeBoxGap.center.bottom || arrowVerticalBalancePx > relativeBoxGap.center.top;
|
|
126
|
-
let verticalBottomToTopOverFlow = rect.height + padding > relativeBoxRect.height + relativeBoxGap.top;
|
|
127
|
-
let verticalCenterToTopOverFlow = rect.height + padding > relativeBoxGap.center.top || arrowVerticalBalancePx > relativeBoxGap.center.bottom;
|
|
128
|
-
let views = {
|
|
129
|
-
bottomCenter: !(bottomOverFlow || horizontalCenterOverFlow),
|
|
130
|
-
bottomLeftToRight: !(bottomOverFlow || horizontalLeftToRightOverFlow),
|
|
131
|
-
bottomCenterToRight: !(bottomOverFlow || horizontalCenterToRightOverFlow),
|
|
132
|
-
bottomRight: !(bottomOverFlow || rightOverFlow || arrowHorizontalBalancePx > relativeBoxRect.right),
|
|
133
|
-
bottomRightToLeft: !(bottomOverFlow || horizontalRightToLeft),
|
|
134
|
-
bottomCenterToLeft: !(bottomOverFlow || horizontalCenterToLeft),
|
|
135
|
-
bottomLeft: !(bottomOverFlow || leftOverFlow || arrowHorizontalBalancePx > relativeBoxGap.right + relativeBoxRect.width),
|
|
136
|
-
topCenter: !(topOverFlow || horizontalCenterOverFlow),
|
|
137
|
-
topLeftToRight: !(topOverFlow || horizontalLeftToRightOverFlow),
|
|
138
|
-
topCenterToRight: !(topOverFlow || horizontalCenterToRightOverFlow),
|
|
139
|
-
topRight: !(topOverFlow || rightOverFlow || arrowHorizontalBalancePx > relativeBoxRect.right),
|
|
140
|
-
topRightToLeft: !(topOverFlow || horizontalRightToLeft),
|
|
141
|
-
topCenterToLeft: !(topOverFlow || horizontalCenterToLeft),
|
|
142
|
-
topLeft: !(topOverFlow || leftOverFlow || arrowHorizontalBalancePx > relativeBoxGap.right + relativeBoxRect.width),
|
|
143
|
-
rightCenter: !(rightOverFlow || verticalCenterOverFlow),
|
|
144
|
-
rightTopToBottom: !(rightOverFlow || verticalTopToBottomOverFlow),
|
|
145
|
-
rightCenterToBottom: !(rightOverFlow || verticalCenterToBottomOverFlow),
|
|
146
|
-
rightBottom: !(rightOverFlow || bottomOverFlow || arrowVerticalBalancePx > relativeBoxRect.bottom),
|
|
147
|
-
rightBottomToTop: !(rightOverFlow || verticalBottomToTopOverFlow),
|
|
148
|
-
rightCenterToTop: !(rightOverFlow || verticalCenterToTopOverFlow),
|
|
149
|
-
rightTop: !(rightOverFlow || topOverFlow || arrowVerticalBalancePx > relativeBoxGap.bottom + relativeBoxRect.height),
|
|
150
|
-
leftCenter: !(leftOverFlow || verticalCenterOverFlow),
|
|
151
|
-
leftTopToBottom: !(leftOverFlow || verticalTopToBottomOverFlow),
|
|
152
|
-
leftCenterToBottom: !(leftOverFlow || verticalCenterToBottomOverFlow),
|
|
153
|
-
leftBottom: !(leftOverFlow || bottomOverFlow || arrowVerticalBalancePx > relativeBoxRect.bottom),
|
|
154
|
-
leftBottomToTop: !(leftOverFlow || verticalBottomToTopOverFlow),
|
|
155
|
-
leftCenterToTop: !(leftOverFlow || verticalCenterToTopOverFlow),
|
|
156
|
-
leftTop: !(leftOverFlow || topOverFlow || arrowVerticalBalancePx > relativeBoxGap.bottom + relativeBoxRect.height)
|
|
157
|
-
};
|
|
158
|
-
let horizontalCenter = relativeBoxGap.left + relativeBoxRect.width / 2;
|
|
159
|
-
let horizontalLeft = relativeBoxGap.left;
|
|
160
|
-
let horizontalRight = relativeBoxGap.left + relativeBoxRect.width;
|
|
161
|
-
let verticalBottom = relativeBoxGap.top + relativeBoxRect.height;
|
|
162
|
-
let verticalTop = relativeBoxGap.top;
|
|
163
|
-
let verticalCenter = relativeBoxGap.top + relativeBoxRect.height / 2;
|
|
164
|
-
let horizontalTop = documentGap.bottom + relativeBoxRect.height;
|
|
165
|
-
let verticalCenterToTop = documentGap.bottom + relativeBoxRect.height / 2;
|
|
166
|
-
let viewsOffset = {
|
|
167
|
-
bottomCenter: {
|
|
168
|
-
left: horizontalCenter - rect.width / 2,
|
|
169
|
-
top: verticalBottom + arrowSize
|
|
170
|
-
},
|
|
171
|
-
bottomLeftToRight: {
|
|
172
|
-
left: horizontalLeft,
|
|
173
|
-
top: verticalBottom + arrowSize
|
|
174
|
-
},
|
|
175
|
-
bottomCenterToRight: {
|
|
176
|
-
left: horizontalCenter - arrowHorizontalBalancePx,
|
|
177
|
-
top: verticalBottom + arrowSize
|
|
178
|
-
},
|
|
179
|
-
bottomRight: {
|
|
180
|
-
left: horizontalRight - arrowHorizontalBalancePx,
|
|
181
|
-
top: verticalBottom + arrowSize
|
|
182
|
-
},
|
|
183
|
-
bottomRightToLeft: {
|
|
184
|
-
left: horizontalRight - rect.width,
|
|
185
|
-
top: verticalBottom + arrowSize
|
|
186
|
-
},
|
|
187
|
-
bottomCenterToLeft: {
|
|
188
|
-
left: horizontalCenter - rect.width + arrowHorizontalBalancePx,
|
|
189
|
-
top: verticalBottom + arrowSize
|
|
190
|
-
},
|
|
191
|
-
bottomLeft: {
|
|
192
|
-
left: horizontalLeft - rect.width + arrowHorizontalBalancePx,
|
|
193
|
-
top: verticalBottom + arrowSize
|
|
194
|
-
},
|
|
195
|
-
topCenter: {
|
|
196
|
-
left: horizontalCenter - rect.width / 2,
|
|
197
|
-
bottom: horizontalTop + arrowSize
|
|
198
|
-
},
|
|
199
|
-
topLeftToRight: {
|
|
200
|
-
left: horizontalLeft,
|
|
201
|
-
bottom: horizontalTop + arrowSize
|
|
202
|
-
},
|
|
203
|
-
topCenterToRight: {
|
|
204
|
-
left: horizontalCenter - arrowHorizontalBalancePx,
|
|
205
|
-
bottom: horizontalTop + arrowSize
|
|
206
|
-
},
|
|
207
|
-
topRight: {
|
|
208
|
-
left: horizontalRight - arrowHorizontalBalancePx,
|
|
209
|
-
bottom: horizontalTop + arrowSize
|
|
210
|
-
},
|
|
211
|
-
topRightToLeft: {
|
|
212
|
-
left: horizontalRight - rect.width,
|
|
213
|
-
bottom: horizontalTop + arrowSize
|
|
214
|
-
},
|
|
215
|
-
topCenterToLeft: {
|
|
216
|
-
left: horizontalCenter - rect.width + arrowHorizontalBalancePx,
|
|
217
|
-
bottom: horizontalTop + arrowSize
|
|
218
|
-
},
|
|
219
|
-
topLeft: {
|
|
220
|
-
left: horizontalLeft - rect.width + arrowHorizontalBalancePx,
|
|
221
|
-
top: verticalTop - (rect.height + arrowSize)
|
|
222
|
-
},
|
|
223
|
-
rightCenter: {
|
|
224
|
-
left: horizontalRight + arrowSize,
|
|
225
|
-
top: verticalCenter - rect.height / 2
|
|
226
|
-
},
|
|
227
|
-
rightTopToBottom: {
|
|
228
|
-
left: horizontalRight + arrowSize,
|
|
229
|
-
top: verticalTop
|
|
230
|
-
},
|
|
231
|
-
rightCenterToBottom: {
|
|
232
|
-
left: horizontalRight + arrowSize,
|
|
233
|
-
top: verticalCenter - arrowVerticalBalancePx
|
|
234
|
-
},
|
|
235
|
-
rightBottom: {
|
|
236
|
-
left: horizontalRight + arrowSize,
|
|
237
|
-
top: verticalBottom - arrowVerticalBalancePx
|
|
238
|
-
},
|
|
239
|
-
rightBottomToTop: {
|
|
240
|
-
left: horizontalRight + arrowSize,
|
|
241
|
-
bottom: documentGap.bottom
|
|
242
|
-
},
|
|
243
|
-
rightCenterToTop: {
|
|
244
|
-
left: horizontalRight + arrowSize,
|
|
245
|
-
bottom: verticalCenterToTop - arrowVerticalBalancePx
|
|
246
|
-
},
|
|
247
|
-
rightTop: {
|
|
248
|
-
left: horizontalRight + arrowSize,
|
|
249
|
-
bottom: horizontalTop - arrowVerticalBalancePx
|
|
250
|
-
},
|
|
251
|
-
leftCenter: {
|
|
252
|
-
left: horizontalLeft - (rect.width + arrowSize),
|
|
253
|
-
top: verticalCenter - rect.height / 2
|
|
254
|
-
},
|
|
255
|
-
leftTopToBottom: {
|
|
256
|
-
left: horizontalLeft - (rect.width + arrowSize),
|
|
257
|
-
top: verticalTop
|
|
258
|
-
},
|
|
259
|
-
leftCenterToBottom: {
|
|
260
|
-
left: horizontalLeft - (rect.width + arrowSize),
|
|
261
|
-
top: verticalCenter - arrowVerticalBalancePx
|
|
262
|
-
},
|
|
263
|
-
leftBottom: {
|
|
264
|
-
left: horizontalLeft - (rect.width + arrowSize),
|
|
265
|
-
top: verticalBottom - arrowVerticalBalancePx
|
|
266
|
-
},
|
|
267
|
-
leftBottomToTop: {
|
|
268
|
-
left: horizontalLeft - (rect.width + arrowSize),
|
|
269
|
-
bottom: documentGap.bottom
|
|
270
|
-
},
|
|
271
|
-
leftCenterToTop: {
|
|
272
|
-
left: horizontalLeft - (rect.width + arrowSize),
|
|
273
|
-
bottom: verticalCenterToTop - arrowVerticalBalancePx
|
|
274
|
-
},
|
|
275
|
-
leftTop: {
|
|
276
|
-
left: horizontalLeft - (rect.width + arrowSize),
|
|
277
|
-
bottom: horizontalTop - arrowVerticalBalancePx
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
return {
|
|
281
|
-
views,
|
|
282
|
-
viewsOffset,
|
|
283
|
-
targetOffset: relativeBoxRect,
|
|
284
|
-
popupOffset: rect
|
|
285
|
-
};
|
|
286
|
-
},
|
|
287
|
-
getArrowAdjustments: (el, relativeBox, customFrame) => {
|
|
288
|
-
if (!el) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
let elRects = viewPort.frameRelativeRects(el, customFrame);
|
|
293
|
-
let {
|
|
294
|
-
rectGap
|
|
295
|
-
} = elRects;
|
|
296
|
-
let relativeBoxRects = viewPort.frameRelativeRects(relativeBox, customFrame);
|
|
297
|
-
let relativeBoxGap = relativeBoxRects.rectGap;
|
|
298
|
-
return {
|
|
299
|
-
left: relativeBoxGap.center.left - rectGap.left,
|
|
300
|
-
right: relativeBoxGap.center.right - rectGap.right,
|
|
301
|
-
top: relativeBoxGap.center.top - rectGap.top,
|
|
302
|
-
bottom: relativeBoxGap.center.bottom - rectGap.bottom
|
|
303
|
-
};
|
|
304
|
-
},
|
|
305
|
-
betterView: function (popup, relativeBox) {
|
|
306
|
-
let defaultView = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
307
|
-
let customFrame = arguments.length > 3 ? arguments[3] : undefined;
|
|
308
|
-
let {
|
|
309
|
-
needArrow,
|
|
310
|
-
isAbsolute,
|
|
311
|
-
customOrder = []
|
|
312
|
-
} = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
313
|
-
let customScrollFrame = isAbsolute ? customFrame : '';
|
|
314
|
-
let viewPortPossibilities = viewPort.possibilities(popup, relativeBox, customScrollFrame, {
|
|
315
|
-
needArrow,
|
|
316
|
-
isAbsolute
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
if (!viewPortPossibilities) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
let {
|
|
324
|
-
views,
|
|
325
|
-
viewsOffset,
|
|
326
|
-
targetOffset,
|
|
327
|
-
popupOffset
|
|
328
|
-
} = viewPortPossibilities;
|
|
329
|
-
let view = null;
|
|
330
|
-
let isViewFound = false;
|
|
331
|
-
|
|
332
|
-
if (!isViewFound && defaultView && views[defaultView]) {
|
|
333
|
-
view = defaultView;
|
|
334
|
-
isViewFound = true;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (!isViewFound) {
|
|
338
|
-
if (customOrder.length > 0) {
|
|
339
|
-
isViewFound = customOrder.some(position => {
|
|
340
|
-
if (views[position]) {
|
|
341
|
-
view = position;
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
} else {
|
|
346
|
-
isViewFound = defaultOrder.some(position => {
|
|
347
|
-
if (views[position]) {
|
|
348
|
-
view = position;
|
|
349
|
-
return true;
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (!isViewFound) {
|
|
356
|
-
view = defaultView;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
return {
|
|
360
|
-
view,
|
|
361
|
-
views,
|
|
362
|
-
viewsOffset,
|
|
363
|
-
targetOffset,
|
|
364
|
-
popupOffset
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
export default {
|
|
369
|
-
betterView: viewPort.betterView,
|
|
370
|
-
frameRelativeRects: viewPort.frameRelativeRects,
|
|
371
|
-
getArrowAdjustments: viewPort.getArrowAdjustments,
|
|
372
|
-
isInViewPort: viewPort.isInViewPort
|
|
373
|
-
};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.positionMapping = void 0;
|
|
7
|
-
var positionMapping = {
|
|
8
|
-
"bottomCenter": {
|
|
9
|
-
"direction": "bottom",
|
|
10
|
-
"arrowPosition": "mid",
|
|
11
|
-
"positionStyle": "bottomMid"
|
|
12
|
-
},
|
|
13
|
-
"bottomLeftToRight": {
|
|
14
|
-
"direction": "bottom",
|
|
15
|
-
"arrowPosition": "start",
|
|
16
|
-
"positionStyle": "bottomEnd"
|
|
17
|
-
},
|
|
18
|
-
"bottomCenterToRight": {
|
|
19
|
-
"direction": "bottom",
|
|
20
|
-
"arrowPosition": "start",
|
|
21
|
-
"positionStyle": "bottomEnd"
|
|
22
|
-
},
|
|
23
|
-
"bottomRightToLeft": {
|
|
24
|
-
"direction": "bottom",
|
|
25
|
-
"arrowPosition": "end",
|
|
26
|
-
"positionStyle": "bottomStart"
|
|
27
|
-
},
|
|
28
|
-
"bottomCenterToLeft": {
|
|
29
|
-
"direction": "bottom",
|
|
30
|
-
"arrowPosition": "end",
|
|
31
|
-
"positionStyle": "bottomStart"
|
|
32
|
-
},
|
|
33
|
-
"topCenter": {
|
|
34
|
-
"direction": "top",
|
|
35
|
-
"arrowPosition": "mid",
|
|
36
|
-
"positionStyle": "topMid"
|
|
37
|
-
},
|
|
38
|
-
"topLeftToRight": {
|
|
39
|
-
"direction": "top",
|
|
40
|
-
"arrowPosition": "start",
|
|
41
|
-
"positionStyle": "topEnd"
|
|
42
|
-
},
|
|
43
|
-
"topCenterToRight": {
|
|
44
|
-
"direction": "top",
|
|
45
|
-
"arrowPosition": "start",
|
|
46
|
-
"positionStyle": "topEnd"
|
|
47
|
-
},
|
|
48
|
-
"topRightToLeft": {
|
|
49
|
-
"direction": "top",
|
|
50
|
-
"arrowPosition": "end",
|
|
51
|
-
"positionStyle": "topStart"
|
|
52
|
-
},
|
|
53
|
-
"topCenterToLeft": {
|
|
54
|
-
"direction": "top",
|
|
55
|
-
"arrowPosition": "end",
|
|
56
|
-
"positionStyle": "topStart"
|
|
57
|
-
},
|
|
58
|
-
"rightCenter": {
|
|
59
|
-
"direction": "right",
|
|
60
|
-
"arrowPosition": "mid",
|
|
61
|
-
"positionStyle": "rightMid"
|
|
62
|
-
},
|
|
63
|
-
"rightTopToBottom": {
|
|
64
|
-
"direction": "right",
|
|
65
|
-
"arrowPosition": "start",
|
|
66
|
-
"positionStyle": "rightEnd"
|
|
67
|
-
},
|
|
68
|
-
"rightCenterToBottom": {
|
|
69
|
-
"direction": "right",
|
|
70
|
-
"arrowPosition": "start",
|
|
71
|
-
"positionStyle": "rightEnd"
|
|
72
|
-
},
|
|
73
|
-
"rightBottomToTop": {
|
|
74
|
-
"direction": "right",
|
|
75
|
-
"arrowPosition": "end",
|
|
76
|
-
"positionStyle": "rightStart"
|
|
77
|
-
},
|
|
78
|
-
"rightCenterToTop": {
|
|
79
|
-
"direction": "right",
|
|
80
|
-
"arrowPosition": "end",
|
|
81
|
-
"positionStyle": "rightStart"
|
|
82
|
-
},
|
|
83
|
-
"leftCenter": {
|
|
84
|
-
"direction": "left",
|
|
85
|
-
"arrowPosition": "mid",
|
|
86
|
-
"positionStyle": "leftMid"
|
|
87
|
-
},
|
|
88
|
-
"leftTopToBottom": {
|
|
89
|
-
"direction": "left",
|
|
90
|
-
"arrowPosition": "start",
|
|
91
|
-
"positionStyle": "leftEnd"
|
|
92
|
-
},
|
|
93
|
-
"leftCenterToBottom": {
|
|
94
|
-
"direction": "left",
|
|
95
|
-
"arrowPosition": "start",
|
|
96
|
-
"positionStyle": "leftEnd"
|
|
97
|
-
},
|
|
98
|
-
"leftBottomToTop": {
|
|
99
|
-
"direction": "left",
|
|
100
|
-
"arrowPosition": "end",
|
|
101
|
-
"positionStyle": "leftStart"
|
|
102
|
-
},
|
|
103
|
-
"leftCenterToTop": {
|
|
104
|
-
"direction": "left",
|
|
105
|
-
"arrowPosition": "end",
|
|
106
|
-
"positionStyle": "leftStart"
|
|
107
|
-
},
|
|
108
|
-
"bottomRight": {
|
|
109
|
-
"direction": "bottom",
|
|
110
|
-
"arrowPosition": "start",
|
|
111
|
-
"positionStyle": "bottomEnd"
|
|
112
|
-
},
|
|
113
|
-
"bottomLeft": {
|
|
114
|
-
"direction": "bottom",
|
|
115
|
-
"arrowPosition": "end",
|
|
116
|
-
"positionStyle": "bottomStart"
|
|
117
|
-
},
|
|
118
|
-
"topRight": {
|
|
119
|
-
"direction": "top",
|
|
120
|
-
"arrowPosition": "start",
|
|
121
|
-
"positionStyle": "topEnd"
|
|
122
|
-
},
|
|
123
|
-
"topLeft": {
|
|
124
|
-
"direction": "top",
|
|
125
|
-
"arrowPosition": "end",
|
|
126
|
-
"positionStyle": "topStart"
|
|
127
|
-
},
|
|
128
|
-
"rightBottom": {
|
|
129
|
-
"direction": "right",
|
|
130
|
-
"arrowPosition": "start",
|
|
131
|
-
"positionStyle": "rightEnd"
|
|
132
|
-
},
|
|
133
|
-
"rightTop": {
|
|
134
|
-
"direction": "right",
|
|
135
|
-
"arrowPosition": "end",
|
|
136
|
-
"positionStyle": "rightStart"
|
|
137
|
-
},
|
|
138
|
-
"leftBottom": {
|
|
139
|
-
"direction": "left",
|
|
140
|
-
"arrowPosition": "start",
|
|
141
|
-
"positionStyle": "leftEnd"
|
|
142
|
-
},
|
|
143
|
-
"leftTop": {
|
|
144
|
-
"direction": "left",
|
|
145
|
-
"arrowPosition": "end",
|
|
146
|
-
"positionStyle": "leftStart"
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
exports.positionMapping = positionMapping;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.rtlFixedPositionMapping = exports.rtlAbsolutePositionMapping = exports.absolutePositionMapping = void 0;
|
|
7
|
-
var absolutePositionMapping = {
|
|
8
|
-
"bottomCenter": "bottomCenter",
|
|
9
|
-
"bottomRight": "bottomLeftToRight",
|
|
10
|
-
"bottomLeft": "bottomRightToLeft",
|
|
11
|
-
"topCenter": "topCenter",
|
|
12
|
-
"topRight": "topLeftToRight",
|
|
13
|
-
"topLeft": "topRightToLeft",
|
|
14
|
-
"rightCenter": "rightCenter",
|
|
15
|
-
"rightBottom": "rightTopToBottom",
|
|
16
|
-
"rightTop": "rightBottomToTop",
|
|
17
|
-
"leftCenter": "leftCenter",
|
|
18
|
-
"leftBottom": "leftTopToBottom",
|
|
19
|
-
"leftTop": "leftBottomToTop",
|
|
20
|
-
"bottomLeftToRight": "bottomLeftToRight",
|
|
21
|
-
"bottomRightToLeft": "bottomRightToLeft",
|
|
22
|
-
"topLeftToRight": "topLeftToRight",
|
|
23
|
-
"topRightToLeft": "topRightToLeft",
|
|
24
|
-
"rightTopToBottom": "rightTopToBottom",
|
|
25
|
-
"rightBottomToTop": "rightBottomToTop",
|
|
26
|
-
"leftTopToBottom": "leftTopToBottom"
|
|
27
|
-
};
|
|
28
|
-
exports.absolutePositionMapping = absolutePositionMapping;
|
|
29
|
-
var rtlAbsolutePositionMapping = {
|
|
30
|
-
"bottomCenter": "bottomCenter",
|
|
31
|
-
"bottomRight": "bottomRightToLeft",
|
|
32
|
-
"bottomLeft": "bottomLeftToRight",
|
|
33
|
-
"topCenter": "topCenter",
|
|
34
|
-
"topRight": "topRightToLeft",
|
|
35
|
-
"topLeft": "topLeftToRight",
|
|
36
|
-
"rightCenter": "leftCenter",
|
|
37
|
-
"rightBottom": "leftTopToBottom",
|
|
38
|
-
"rightTop": "leftBottomToTop",
|
|
39
|
-
"leftCenter": "rightCenter",
|
|
40
|
-
"leftBottom": "rightTopToBottom",
|
|
41
|
-
"leftTop": "rightBottomToTop",
|
|
42
|
-
"bottomLeftToRight": "bottomLeftToRight",
|
|
43
|
-
"bottomRightToLeft": "bottomRightToLeft",
|
|
44
|
-
"topLeftToRight": "topLeftToRight",
|
|
45
|
-
"topRightToLeft": "topRightToLeft",
|
|
46
|
-
"rightTopToBottom": "rightTopToBottom",
|
|
47
|
-
"rightBottomToTop": "rightBottomToTop",
|
|
48
|
-
"leftTopToBottom": "leftTopToBottom"
|
|
49
|
-
};
|
|
50
|
-
exports.rtlAbsolutePositionMapping = rtlAbsolutePositionMapping;
|
|
51
|
-
var rtlFixedPositionMapping = {
|
|
52
|
-
"bottomCenter": "bottomCenter",
|
|
53
|
-
"bottomLeftToRight": "bottomRightToLeft",
|
|
54
|
-
"bottomCenterToRight": "bottomCenterToLeft",
|
|
55
|
-
"bottomRightToLeft": "bottomLeftToRight",
|
|
56
|
-
"bottomCenterToLeft": "bottomCenterToRight",
|
|
57
|
-
"topCenter": "topCenter",
|
|
58
|
-
"topLeftToRight": "topRightToLeft",
|
|
59
|
-
"topCenterToRight": "topCenterToLeft",
|
|
60
|
-
"topRightToLeft": "topLeftToRight",
|
|
61
|
-
"topCenterToLeft": "topCenterToRight",
|
|
62
|
-
"rightTopToBottom": "leftTopToBottom",
|
|
63
|
-
"rightCenterToBottom": "leftCenterToBottom",
|
|
64
|
-
"rightCenter": "leftCenter",
|
|
65
|
-
"rightBottomToTop": "leftBottomToTop",
|
|
66
|
-
"rightCenterToTop": "leftCenterToTop",
|
|
67
|
-
"leftTopToBottom": "rightTopToBottom",
|
|
68
|
-
"leftCenterToBottom": "rightCenterToBottom",
|
|
69
|
-
"leftCenter": "rightCenter",
|
|
70
|
-
"leftBottomToTop": "rightBottomToTop",
|
|
71
|
-
"leftCenterToTop": "rightCenterToTop",
|
|
72
|
-
"bottomRight": "bottomLeft",
|
|
73
|
-
"bottomLeft": "bottomRight",
|
|
74
|
-
"topRight": "topLeft",
|
|
75
|
-
"topLeft": "topRight",
|
|
76
|
-
"rightBottom": "leftBottom",
|
|
77
|
-
"rightTop": "leftTop",
|
|
78
|
-
"leftBottom": "rightBottom",
|
|
79
|
-
"leftTop": "rightTop"
|
|
80
|
-
};
|
|
81
|
-
exports.rtlFixedPositionMapping = rtlFixedPositionMapping;
|
package/lib/Popup/Registry.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _Config = require("../Provider/Config.js");
|
|
9
|
-
|
|
10
|
-
var Registry = {
|
|
11
|
-
lastOpenedGroup: [],
|
|
12
|
-
popups: {},
|
|
13
|
-
listenerPopupRef: undefined,
|
|
14
|
-
scrollBlockedListenerPopupRef: undefined,
|
|
15
|
-
scrollableListenerPopupRef: undefined,
|
|
16
|
-
getOpenedPopups: function getOpenedPopups() {
|
|
17
|
-
return Object.values(Registry.popups).flat().filter(function (popup) {
|
|
18
|
-
return popup.state.isPopupOpen;
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
getOpenedScrollBlockedFixedPopups: function getOpenedScrollBlockedFixedPopups() {
|
|
22
|
-
return Registry.getOpenedPopups().filter(function (popup) {
|
|
23
|
-
return popup.getIsOutsideScrollBlocked(popup) && !popup.getIsAbsolutePopup(popup);
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
getOpenedScrollableFixedPopups: function getOpenedScrollableFixedPopups() {
|
|
27
|
-
return Registry.getOpenedPopups().filter(function (popup) {
|
|
28
|
-
return !popup.getIsOutsideScrollBlocked(popup) && !popup.getIsAbsolutePopup(popup);
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
getRootElement: function getRootElement() {
|
|
32
|
-
var getRootElement = (0, _Config.getLibraryConfig)('getRootElement');
|
|
33
|
-
|
|
34
|
-
if (getRootElement && typeof getRootElement === 'function') {
|
|
35
|
-
var parent = getRootElement();
|
|
36
|
-
|
|
37
|
-
if (parent) {
|
|
38
|
-
return parent;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return document;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var _default = Registry;
|
|
46
|
-
exports["default"] = _default;
|