@zohodesk/components 1.0.0-temp-220.10 → 1.0.0-temp-219.3
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/es/CheckBox/CheckBox.js +9 -2
- package/es/Label/Label.js +9 -2
- package/es/Popup/Popup.js +92 -200
- package/es/Provider/Config.js +1 -2
- package/lib/CheckBox/CheckBox.js +9 -2
- package/lib/Label/Label.js +9 -2
- package/lib/Popup/Popup.js +147 -272
- package/lib/Provider/Config.js +1 -2
- package/package.json +4 -2
- package/result.json +1 -1
- package/es/Popup/Registry.js +0 -37
- package/lib/Popup/Registry.js +0 -47
package/es/CheckBox/CheckBox.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { propTypes } from "./props/propTypes";
|
|
3
3
|
import { defaultProps } from "./props/defaultProps";
|
|
4
|
+
import { withComponentRegistrar } from '@zohodesk/dotkit/es/react/ComponentRegistry';
|
|
4
5
|
import Label from "../Label/Label";
|
|
5
6
|
import { Container, Box } from "../Layout";
|
|
6
7
|
import CssProvider from "../Provider/CssProvider";
|
|
7
8
|
import style from "./CheckBox.module.css";
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
class CheckBox extends React.Component {
|
|
9
11
|
constructor(props) {
|
|
10
12
|
super(props);
|
|
11
13
|
this.onChange = this.onChange.bind(this);
|
|
@@ -163,10 +165,15 @@ export default class CheckBox extends React.Component {
|
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
}
|
|
168
|
+
|
|
166
169
|
CheckBox.defaultProps = defaultProps;
|
|
167
170
|
CheckBox.propTypes = propTypes; // if (__DOCS__) {
|
|
168
171
|
// CheckBox.docs = {
|
|
169
172
|
// componentGroup: 'Form Elements',
|
|
170
173
|
// folderName: 'Style Guide'
|
|
171
174
|
// };
|
|
172
|
-
// }
|
|
175
|
+
// }
|
|
176
|
+
|
|
177
|
+
export default withComponentRegistrar(CheckBox, {
|
|
178
|
+
name: 'ZDC_CheckBox'
|
|
179
|
+
});
|
package/es/Label/Label.js
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { defaultProps } from "./props/defaultProps";
|
|
6
6
|
import { propTypes } from "./props/propTypes";
|
|
7
|
+
import { withComponentRegistrar } from '@zohodesk/dotkit/es/react/ComponentRegistry';
|
|
7
8
|
import style from "./Label.module.css";
|
|
8
9
|
import colors from "./LabelColors.module.css";
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
class Label extends React.Component {
|
|
10
12
|
render() {
|
|
11
13
|
let {
|
|
12
14
|
text,
|
|
@@ -42,10 +44,15 @@ export default class Label extends React.Component {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
}
|
|
47
|
+
|
|
45
48
|
Label.defaultProps = defaultProps;
|
|
46
49
|
Label.propTypes = propTypes; // if (__DOCS__) {
|
|
47
50
|
// Label.docs = {
|
|
48
51
|
// componentGroup: 'Form Elements',
|
|
49
52
|
// folderName: 'Style Guide'
|
|
50
53
|
// };
|
|
51
|
-
// }
|
|
54
|
+
// }
|
|
55
|
+
|
|
56
|
+
export default withComponentRegistrar(Label, {
|
|
57
|
+
name: 'ZDC_Label'
|
|
58
|
+
});
|
package/es/Popup/Popup.js
CHANGED
|
@@ -12,10 +12,11 @@ import { addIntersectionObserver, removeIntersectionObserver } from "./intersect
|
|
|
12
12
|
import { positionMapping } from "../DropBox/DropBoxPositionMapping.js";
|
|
13
13
|
import isMobilePopover from "../DropBox/utils/isMobilePopover.js";
|
|
14
14
|
import selectn from 'selectn';
|
|
15
|
-
|
|
15
|
+
let lastOpenedGroup = [];
|
|
16
|
+
let popups = {};
|
|
16
17
|
|
|
17
18
|
global.closeGroupPopups = function (groupName) {
|
|
18
|
-
const groupPopups =
|
|
19
|
+
const groupPopups = popups[groupName] || [];
|
|
19
20
|
groupPopups.forEach(popup => {
|
|
20
21
|
popup.state.isPopupOpen && popup.setState({
|
|
21
22
|
isPopupOpen: false,
|
|
@@ -37,51 +38,6 @@ const defaultState = {
|
|
|
37
38
|
//{height: ‘’, width: ‘’,}
|
|
38
39
|
isAbsolutePositioningNeeded: true
|
|
39
40
|
};
|
|
40
|
-
const SCROLL_BLOCK_EVENTS = Object.freeze([{
|
|
41
|
-
name: 'wheel',
|
|
42
|
-
handlerName: 'handleBlockScroll',
|
|
43
|
-
options: {
|
|
44
|
-
capture: true,
|
|
45
|
-
passive: false
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
name: 'touchmove',
|
|
49
|
-
handlerName: 'handleBlockScroll',
|
|
50
|
-
options: {
|
|
51
|
-
capture: true,
|
|
52
|
-
passive: false
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
name: 'scroll',
|
|
56
|
-
handlerName: 'handlePositionChange',
|
|
57
|
-
options: {
|
|
58
|
-
capture: true,
|
|
59
|
-
passive: false
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
name: 'keydown',
|
|
63
|
-
handlerName: 'preventKeyboardScroll',
|
|
64
|
-
options: {
|
|
65
|
-
capture: true,
|
|
66
|
-
passive: false
|
|
67
|
-
}
|
|
68
|
-
}]);
|
|
69
|
-
const IFRAME_SCROLL_BLOCK_EVENTS = Object.freeze(SCROLL_BLOCK_EVENTS.filter(event => event.name !== 'keydown'));
|
|
70
|
-
const CLICK_EVENTS = Object.freeze([{
|
|
71
|
-
name: 'click',
|
|
72
|
-
handlerName: 'documentClickHandler',
|
|
73
|
-
options: {
|
|
74
|
-
capture: false,
|
|
75
|
-
passive: false
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
name: 'click',
|
|
79
|
-
handlerName: 'documentClickHandler1',
|
|
80
|
-
options: {
|
|
81
|
-
capture: true,
|
|
82
|
-
passive: false
|
|
83
|
-
}
|
|
84
|
-
}]);
|
|
85
41
|
/* eslint-disable react/no-deprecated */
|
|
86
42
|
|
|
87
43
|
/* eslint-disable react/prop-types */
|
|
@@ -143,11 +99,8 @@ const Popup = function (Component) {
|
|
|
143
99
|
this.handleBlockScroll = this.handleBlockScroll.bind(this);
|
|
144
100
|
this.handlePositionChange = this.handlePositionChange.bind(this);
|
|
145
101
|
this.preventKeyboardScroll = this.preventKeyboardScroll.bind(this);
|
|
146
|
-
this.updateListeners = this.updateListeners.bind(this);
|
|
147
102
|
this.addScrollBlockListeners = this.addScrollBlockListeners.bind(this);
|
|
148
103
|
this.removeScrollBlockListeners = this.removeScrollBlockListeners.bind(this);
|
|
149
|
-
this.addScrollToUpdateListeners = this.addScrollToUpdateListeners.bind(this);
|
|
150
|
-
this.removeScrollToUpdateListeners = this.removeScrollToUpdateListeners.bind(this);
|
|
151
104
|
this.handleAddingScrollBlock = this.handleAddingScrollBlock.bind(this);
|
|
152
105
|
this.handleRemovingScrollBlock = this.handleRemovingScrollBlock.bind(this);
|
|
153
106
|
this.handleIntersectionObserver = this.handleIntersectionObserver.bind(this);
|
|
@@ -157,10 +110,8 @@ const Popup = function (Component) {
|
|
|
157
110
|
this.setContainerDynamicPositioning = this.setContainerDynamicPositioning.bind(this);
|
|
158
111
|
this.updatePopupState = this.updatePopupState.bind(this);
|
|
159
112
|
this.handleScrollAndBlockEvents = this.handleScrollAndBlockEvents.bind(this);
|
|
160
|
-
this.handleIframeEventListeners = this.handleIframeEventListeners.bind(this);
|
|
161
113
|
this.handleDropElementStyleUpdate = this.handleDropElementStyleUpdate.bind(this);
|
|
162
114
|
this.positionRef = /*#__PURE__*/React.createRef();
|
|
163
|
-
this.rootElement = Registry.getRootElement();
|
|
164
115
|
this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
|
|
165
116
|
|
|
166
117
|
this.size = null;
|
|
@@ -177,15 +128,16 @@ const Popup = function (Component) {
|
|
|
177
128
|
|
|
178
129
|
componentDidMount() {
|
|
179
130
|
const group = this.getGroup();
|
|
180
|
-
const groupPopups =
|
|
131
|
+
const groupPopups = popups[group] || [];
|
|
181
132
|
groupPopups.push(this);
|
|
182
|
-
|
|
133
|
+
popups[group] = groupPopups;
|
|
183
134
|
|
|
184
|
-
if (Object.keys(
|
|
185
|
-
|
|
135
|
+
if (Object.keys(popups).length === 1 && groupPopups.length === 1) {
|
|
136
|
+
document.addEventListener('click', this.documentClickHandler, false);
|
|
186
137
|
document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);
|
|
187
138
|
|
|
188
139
|
window.addEventListener('resize', this.handleResize);
|
|
140
|
+
document.addEventListener('click', this.documentClickHandler1, true);
|
|
189
141
|
document.addEventListener('mousedown', this.handleDocumentMouseDown, true);
|
|
190
142
|
document.addEventListener('focus', this.handleDocumentFocus, true);
|
|
191
143
|
}
|
|
@@ -204,8 +156,8 @@ const Popup = function (Component) {
|
|
|
204
156
|
}
|
|
205
157
|
}
|
|
206
158
|
|
|
207
|
-
handleScrollAndBlockEvents(
|
|
208
|
-
if (
|
|
159
|
+
handleScrollAndBlockEvents(isPopupReady, isMobile) {
|
|
160
|
+
if (isPopupReady && !isMobile) {
|
|
209
161
|
this.handleAddingScrollBlock();
|
|
210
162
|
this.handleAddingScrollToUpdatePosition();
|
|
211
163
|
} else {
|
|
@@ -214,16 +166,6 @@ const Popup = function (Component) {
|
|
|
214
166
|
}
|
|
215
167
|
}
|
|
216
168
|
|
|
217
|
-
handleIframeEventListeners(shouldAdd, eventList) {
|
|
218
|
-
this.rootElement.querySelectorAll('iframe').forEach(frame => {
|
|
219
|
-
const frameDocument = frame.contentDocument;
|
|
220
|
-
|
|
221
|
-
if (frameDocument) {
|
|
222
|
-
this.updateListeners(shouldAdd, eventList, frameDocument);
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
169
|
componentDidUpdate(prevProps, prevState) {
|
|
228
170
|
const {
|
|
229
171
|
isPopupReady,
|
|
@@ -250,31 +192,28 @@ const Popup = function (Component) {
|
|
|
250
192
|
}
|
|
251
193
|
|
|
252
194
|
if (oldStateOpen !== isPopupReady && !isMobile || oldIsMobileState !== isMobile) {
|
|
253
|
-
|
|
254
|
-
this.handleScrollAndBlockEvents(shouldAdd);
|
|
255
|
-
this.handleIframeEventListeners(shouldAdd, CLICK_EVENTS);
|
|
195
|
+
this.handleScrollAndBlockEvents(isPopupReady, isMobile);
|
|
256
196
|
}
|
|
257
197
|
}
|
|
258
198
|
|
|
259
199
|
componentWillUnmount() {
|
|
260
200
|
const group = this.getGroup();
|
|
261
|
-
|
|
201
|
+
popups = Object.keys(popups).reduce((res, groupName) => {
|
|
262
202
|
if (groupName === group) {
|
|
263
|
-
const groupPopups =
|
|
203
|
+
const groupPopups = popups[group];
|
|
264
204
|
const newGroupPopups = groupPopups.filter(popup => popup !== this);
|
|
265
|
-
newGroupPopups.length === 0 &&
|
|
205
|
+
newGroupPopups.length === 0 && lastOpenedGroup.indexOf(group) >= 0 && lastOpenedGroup.splice(lastOpenedGroup.indexOf(group), 1);
|
|
266
206
|
res[group] = newGroupPopups;
|
|
267
207
|
}
|
|
268
208
|
|
|
269
209
|
return res;
|
|
270
|
-
},
|
|
210
|
+
}, popups);
|
|
271
211
|
this.handleRemovingScrollBlock();
|
|
272
212
|
this.handleRemovingScrollToUpdatePosition();
|
|
273
|
-
this.handleIframeEventListeners(false, CLICK_EVENTS);
|
|
274
213
|
let noPopups = true;
|
|
275
214
|
|
|
276
|
-
for (const i in
|
|
277
|
-
if (
|
|
215
|
+
for (const i in popups) {
|
|
216
|
+
if (popups[i].length >= 1) {
|
|
278
217
|
noPopups = false;
|
|
279
218
|
break;
|
|
280
219
|
}
|
|
@@ -285,10 +224,11 @@ const Popup = function (Component) {
|
|
|
285
224
|
}
|
|
286
225
|
|
|
287
226
|
if (noPopups) {
|
|
288
|
-
|
|
227
|
+
document.removeEventListener('click', this.documentClickHandler);
|
|
289
228
|
document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);
|
|
290
229
|
|
|
291
230
|
window.removeEventListener('resize', this.handleResize);
|
|
231
|
+
document.removeEventListener('click', this.documentClickHandler1, true);
|
|
292
232
|
document.removeEventListener('mousedown', this.handleDocumentMouseDown, true);
|
|
293
233
|
document.removeEventListener('focus', this.handleDocumentFocus, true);
|
|
294
234
|
}
|
|
@@ -320,13 +260,10 @@ const Popup = function (Component) {
|
|
|
320
260
|
|
|
321
261
|
if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
322
262
|
addIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
Registry.scrollableThisHandler.addScrollToUpdateListeners();
|
|
328
|
-
Registry.isScrollToUpdatePositionListenersAdded = true;
|
|
329
|
-
}
|
|
263
|
+
document.addEventListener('scroll', this.updatePositionOnScroll, {
|
|
264
|
+
capture: true,
|
|
265
|
+
passive: false
|
|
266
|
+
});
|
|
330
267
|
}
|
|
331
268
|
}
|
|
332
269
|
|
|
@@ -336,13 +273,10 @@ const Popup = function (Component) {
|
|
|
336
273
|
|
|
337
274
|
if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
338
275
|
removeIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
Registry.isScrollToUpdatePositionListenersAdded = false;
|
|
344
|
-
Registry.scrollableThisHandler = undefined;
|
|
345
|
-
}
|
|
276
|
+
document.removeEventListener('scroll', this.updatePositionOnScroll, {
|
|
277
|
+
capture: true,
|
|
278
|
+
passive: false
|
|
279
|
+
});
|
|
346
280
|
}
|
|
347
281
|
}
|
|
348
282
|
|
|
@@ -401,125 +335,83 @@ const Popup = function (Component) {
|
|
|
401
335
|
}
|
|
402
336
|
|
|
403
337
|
updatePositionOnScroll(e) {
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
defaultPosition,
|
|
410
|
-
isTargetElementVisible,
|
|
411
|
-
handlePopupPosition
|
|
412
|
-
} = _ref2;
|
|
413
|
-
|
|
414
|
-
if (e.target.contains(placeHolderElement) && isTargetElementVisible) {
|
|
415
|
-
handlePopupPosition(defaultPosition, true);
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
}
|
|
338
|
+
const {
|
|
339
|
+
placeHolderElement,
|
|
340
|
+
defaultPosition,
|
|
341
|
+
isTargetElementVisible
|
|
342
|
+
} = this;
|
|
419
343
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
let element = arguments.length > 2 ? arguments[2] : undefined;
|
|
424
|
-
const method = add ? 'addEventListener' : 'removeEventListener';
|
|
425
|
-
eventList.forEach(_ref3 => {
|
|
426
|
-
let {
|
|
427
|
-
name,
|
|
428
|
-
handlerName,
|
|
429
|
-
options
|
|
430
|
-
} = _ref3;
|
|
431
|
-
const handler = this[handlerName];
|
|
432
|
-
|
|
433
|
-
if (handler) {
|
|
434
|
-
element[method](name, handler, options);
|
|
435
|
-
}
|
|
436
|
-
});
|
|
344
|
+
if (e.target.contains(placeHolderElement) && isTargetElementVisible) {
|
|
345
|
+
this.handlePopupPosition(defaultPosition, true);
|
|
346
|
+
}
|
|
437
347
|
}
|
|
438
348
|
|
|
439
349
|
addScrollBlockListeners() {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
350
|
+
document.addEventListener('wheel', this.handleBlockScroll, {
|
|
351
|
+
capture: true,
|
|
352
|
+
passive: false
|
|
353
|
+
});
|
|
354
|
+
document.addEventListener('touchmove', this.handleBlockScroll, {
|
|
355
|
+
capture: true,
|
|
356
|
+
passive: false
|
|
357
|
+
});
|
|
358
|
+
document.addEventListener('scroll', this.handlePositionChange, {
|
|
359
|
+
capture: true,
|
|
360
|
+
passive: false
|
|
361
|
+
});
|
|
362
|
+
document.addEventListener('keydown', this.preventKeyboardScroll, {
|
|
363
|
+
capture: true,
|
|
364
|
+
passive: false
|
|
365
|
+
});
|
|
451
366
|
}
|
|
452
367
|
|
|
453
368
|
removeScrollBlockListeners() {
|
|
454
|
-
|
|
455
|
-
const shouldRemoveScrollBlockListeners = Registry.getScrollBlockedPopups().length === 0 && Registry.isScrollBlockListenersAdded;
|
|
456
|
-
|
|
457
|
-
if (shouldRemoveScrollBlockListeners) {
|
|
458
|
-
Registry.scrollBlockedThisHandler.updateListeners(false, SCROLL_BLOCK_EVENTS, document);
|
|
459
|
-
Registry.scrollBlockedThisHandler.handleIframeEventListeners(false, IFRAME_SCROLL_BLOCK_EVENTS);
|
|
460
|
-
Registry.isScrollBlockListenersAdded = false;
|
|
461
|
-
Registry.scrollBlockedThisHandler = undefined;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
addScrollToUpdateListeners() {
|
|
466
|
-
document.addEventListener('scroll', this.updatePositionOnScroll, {
|
|
369
|
+
document.removeEventListener('wheel', this.handleBlockScroll, {
|
|
467
370
|
capture: true,
|
|
468
371
|
passive: false
|
|
469
372
|
});
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
373
|
+
document.removeEventListener('touchmove', this.handleBlockScroll, {
|
|
374
|
+
capture: true,
|
|
375
|
+
passive: false
|
|
376
|
+
});
|
|
377
|
+
document.removeEventListener('scroll', this.handlePositionChange, {
|
|
378
|
+
capture: true,
|
|
379
|
+
passive: false
|
|
380
|
+
});
|
|
381
|
+
document.removeEventListener('keydown', this.preventKeyboardScroll, {
|
|
474
382
|
capture: true,
|
|
475
383
|
passive: false
|
|
476
384
|
});
|
|
477
385
|
}
|
|
478
386
|
|
|
479
387
|
handleBlockScroll(event) {
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
if (isOutsideAllDropElements) {
|
|
388
|
+
// const targetElement = this.placeHolderElement;
|
|
389
|
+
const containerElement = this.dropElement;
|
|
390
|
+
|
|
391
|
+
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target)) {
|
|
392
|
+
// --- Scroll exclude Target & Container elements --- For reference. Will adopt in future
|
|
393
|
+
// if(
|
|
394
|
+
// (containerElement && (containerElement !== event.target && !containerElement.contains(event.target)))
|
|
395
|
+
// && (targetElement && (targetElement !== event.target && !targetElement.contains(event.target)))
|
|
396
|
+
// ) {
|
|
490
397
|
event.preventDefault();
|
|
491
398
|
}
|
|
492
399
|
}
|
|
493
400
|
|
|
494
401
|
handlePositionChange(event) {
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
state
|
|
502
|
-
} = _ref5;
|
|
503
|
-
|
|
504
|
-
if (dropElement && dropElement !== event.target && !dropElement.contains(event.target) && placeHolderElement && placeHolderElement !== event.target && !placeHolderElement.contains(event.target) && event.target.contains(placeHolderElement)) {
|
|
505
|
-
handlePopupPosition(state.position, true);
|
|
506
|
-
}
|
|
507
|
-
});
|
|
402
|
+
const targetElement = this.placeHolderElement;
|
|
403
|
+
const containerElement = this.dropElement;
|
|
404
|
+
|
|
405
|
+
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && targetElement && targetElement !== event.target && !targetElement.contains(event.target) && event.target.contains(targetElement)) {
|
|
406
|
+
this.handlePopupPosition(this.state.position, true); // this.closePopupOnly(event);
|
|
407
|
+
}
|
|
508
408
|
}
|
|
509
409
|
|
|
510
410
|
preventKeyboardScroll(event) {
|
|
411
|
+
const containerElement = this.dropElement;
|
|
511
412
|
const keys = [32, 37, 38, 39, 40]; // Space, Arrow keys
|
|
512
413
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
const isOutsideAllDropElements = scrollBlockedPopups.every(_ref6 => {
|
|
516
|
-
let {
|
|
517
|
-
dropElement
|
|
518
|
-
} = _ref6;
|
|
519
|
-
return dropElement && dropElement !== event.target && !dropElement.contains(event.target) && keys.includes(event.keyCode);
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
if (isOutsideAllDropElements) {
|
|
414
|
+
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && keys.includes(event.keyCode)) {
|
|
523
415
|
event.preventDefault();
|
|
524
416
|
}
|
|
525
417
|
}
|
|
@@ -618,9 +510,9 @@ const Popup = function (Component) {
|
|
|
618
510
|
const {
|
|
619
511
|
isPopupOpen
|
|
620
512
|
} = this.state;
|
|
621
|
-
const groupPopups =
|
|
622
|
-
|
|
623
|
-
isPopupOpen &&
|
|
513
|
+
const groupPopups = popups[group] || [];
|
|
514
|
+
lastOpenedGroup = !isPopupOpen && lastOpenedGroup.indexOf(group) === -1 ? [group, ...lastOpenedGroup] : lastOpenedGroup;
|
|
515
|
+
isPopupOpen && lastOpenedGroup.splice(0, 1);
|
|
624
516
|
groupPopups.forEach(popup => {
|
|
625
517
|
if (popup !== this && popup.state.isPopupOpen) {
|
|
626
518
|
popup.setState({
|
|
@@ -643,18 +535,18 @@ const Popup = function (Component) {
|
|
|
643
535
|
openPopupOnly(e, defaultPosition) {
|
|
644
536
|
const group = this.getGroup();
|
|
645
537
|
this.removeClose(e);
|
|
646
|
-
|
|
538
|
+
lastOpenedGroup = lastOpenedGroup.indexOf(group) === -1 ? [group, ...lastOpenedGroup] : lastOpenedGroup;
|
|
647
539
|
this.handlePopupPosition(defaultPosition);
|
|
648
540
|
}
|
|
649
541
|
|
|
650
542
|
closePopupOnly(e) {
|
|
651
543
|
this.removeClose(e);
|
|
544
|
+
lastOpenedGroup.splice(0, 1);
|
|
652
545
|
const {
|
|
653
546
|
isPopupOpen
|
|
654
547
|
} = this.state;
|
|
655
548
|
|
|
656
549
|
if (isPopupOpen) {
|
|
657
|
-
Registry.lastOpenedGroup.splice(0, 1);
|
|
658
550
|
this.setState({
|
|
659
551
|
isPopupOpen: false,
|
|
660
552
|
isPopupReady: false
|
|
@@ -663,8 +555,8 @@ const Popup = function (Component) {
|
|
|
663
555
|
}
|
|
664
556
|
|
|
665
557
|
handleCloseLastOpenedGroup() {
|
|
666
|
-
const groupPopups =
|
|
667
|
-
|
|
558
|
+
const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] || [] : [];
|
|
559
|
+
lastOpenedGroup.splice(0, 1);
|
|
668
560
|
groupPopups.forEach(popup => {
|
|
669
561
|
popup.state.isPopupOpen && popup.setState({
|
|
670
562
|
isPopupOpen: false,
|
|
@@ -692,11 +584,11 @@ const Popup = function (Component) {
|
|
|
692
584
|
handleGetNeedPrevent(e) {
|
|
693
585
|
let needPrevent = false;
|
|
694
586
|
|
|
695
|
-
if (
|
|
587
|
+
if (lastOpenedGroup.length > 1) {
|
|
696
588
|
const {
|
|
697
589
|
target
|
|
698
590
|
} = e;
|
|
699
|
-
const groupPopups =
|
|
591
|
+
const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] : [];
|
|
700
592
|
let openedPopup = null; // eslint-disable-next-line guard-for-in
|
|
701
593
|
|
|
702
594
|
for (const i in groupPopups) {
|
|
@@ -742,8 +634,8 @@ const Popup = function (Component) {
|
|
|
742
634
|
|
|
743
635
|
documentClickHandler() {
|
|
744
636
|
try {
|
|
745
|
-
Object.keys(
|
|
746
|
-
const groupPopups =
|
|
637
|
+
Object.keys(popups).forEach(groupName => {
|
|
638
|
+
const groupPopups = popups[groupName] || [];
|
|
747
639
|
groupPopups.forEach(popup => {
|
|
748
640
|
popup.state.isPopupOpen && (!popup.props.checkBeforeClose || popup.props.checkBeforeClose && popup.props.checkBeforeClose()) && !isTextSelected() && popup.setState({
|
|
749
641
|
isPopupOpen: false,
|
|
@@ -751,7 +643,7 @@ const Popup = function (Component) {
|
|
|
751
643
|
});
|
|
752
644
|
});
|
|
753
645
|
});
|
|
754
|
-
|
|
646
|
+
lastOpenedGroup = [];
|
|
755
647
|
} catch (e) {// eslint-disable-next-line no-console
|
|
756
648
|
//console.error('popup component not unmounted properly', e);
|
|
757
649
|
}
|
|
@@ -871,8 +763,8 @@ const Popup = function (Component) {
|
|
|
871
763
|
}
|
|
872
764
|
|
|
873
765
|
handleOpenPopupPositionChange() {
|
|
874
|
-
Object.keys(
|
|
875
|
-
const groupPopups =
|
|
766
|
+
Object.keys(popups).forEach(groupName => {
|
|
767
|
+
const groupPopups = popups[groupName] || [];
|
|
876
768
|
groupPopups.forEach(popup => {
|
|
877
769
|
if (popup.state.isPopupOpen) {
|
|
878
770
|
const {
|
package/es/Provider/Config.js
CHANGED
package/lib/CheckBox/CheckBox.js
CHANGED
|
@@ -13,6 +13,8 @@ var _propTypes = require("./props/propTypes");
|
|
|
13
13
|
|
|
14
14
|
var _defaultProps = require("./props/defaultProps");
|
|
15
15
|
|
|
16
|
+
var _ComponentRegistry = require("@zohodesk/dotkit/es/react/ComponentRegistry");
|
|
17
|
+
|
|
16
18
|
var _Label = _interopRequireDefault(require("../Label/Label"));
|
|
17
19
|
|
|
18
20
|
var _Layout = require("../Layout");
|
|
@@ -213,11 +215,16 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
213
215
|
return CheckBox;
|
|
214
216
|
}(_react["default"].Component);
|
|
215
217
|
|
|
216
|
-
exports["default"] = CheckBox;
|
|
217
218
|
CheckBox.defaultProps = _defaultProps.defaultProps;
|
|
218
219
|
CheckBox.propTypes = _propTypes.propTypes; // if (__DOCS__) {
|
|
219
220
|
// CheckBox.docs = {
|
|
220
221
|
// componentGroup: 'Form Elements',
|
|
221
222
|
// folderName: 'Style Guide'
|
|
222
223
|
// };
|
|
223
|
-
// }
|
|
224
|
+
// }
|
|
225
|
+
|
|
226
|
+
var _default = (0, _ComponentRegistry.withComponentRegistrar)(CheckBox, {
|
|
227
|
+
name: 'ZDC_CheckBox'
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
exports["default"] = _default;
|
package/lib/Label/Label.js
CHANGED
|
@@ -13,6 +13,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = require("./props/propTypes");
|
|
15
15
|
|
|
16
|
+
var _ComponentRegistry = require("@zohodesk/dotkit/es/react/ComponentRegistry");
|
|
17
|
+
|
|
16
18
|
var _LabelModule = _interopRequireDefault(require("./Label.module.css"));
|
|
17
19
|
|
|
18
20
|
var _LabelColorsModule = _interopRequireDefault(require("./LabelColors.module.css"));
|
|
@@ -87,11 +89,16 @@ var Label = /*#__PURE__*/function (_React$Component) {
|
|
|
87
89
|
return Label;
|
|
88
90
|
}(_react["default"].Component);
|
|
89
91
|
|
|
90
|
-
exports["default"] = Label;
|
|
91
92
|
Label.defaultProps = _defaultProps.defaultProps;
|
|
92
93
|
Label.propTypes = _propTypes.propTypes; // if (__DOCS__) {
|
|
93
94
|
// Label.docs = {
|
|
94
95
|
// componentGroup: 'Form Elements',
|
|
95
96
|
// folderName: 'Style Guide'
|
|
96
97
|
// };
|
|
97
|
-
// }
|
|
98
|
+
// }
|
|
99
|
+
|
|
100
|
+
var _default = (0, _ComponentRegistry.withComponentRegistrar)(Label, {
|
|
101
|
+
name: 'ZDC_Label'
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
exports["default"] = _default;
|