@zohodesk/dot 1.0.0-temp-138 → 1.0.0-temp-141
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 +0 -4
- package/es/FreezeLayer/FreezeLayer.js +7 -2
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +3 -14
- package/es/dropdown/ToggleDropDown/ToggleDropDown.module.css +2 -1
- package/es/dropdown/ToggleDropDown/props/defaultProps.js +1 -2
- package/es/dropdown/ToggleDropDown/props/propTypes.js +1 -2
- package/es/list/status/StatusDropdown/StatusDropdown.js +1 -3
- package/es/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/es/list/status/StatusDropdown/props/propTypes.js +1 -2
- package/es/list/status/StatusListItem/StatusListItem.js +3 -4
- package/es/list/status/StatusListItem/StatusListItem.module.css +2 -5
- package/es/list/status/StatusListItem/props/defaultProps.js +1 -2
- package/es/list/status/StatusListItem/props/propTypes.js +0 -1
- package/es/lookup/Lookup/DraggerUtil.js +31 -0
- package/es/lookup/Lookup/Lookup.module.css +8 -1
- package/es/lookup/Lookup/useDragger.js +65 -0
- package/es/lookup/Section/Section.js +1 -0
- package/es/version2/lookup/AlertHeader/AlertHeader.js +2 -1
- package/es/version2/lookup/AlertHeader/AlertHeaderNew.module.css +2 -0
- package/lib/FreezeLayer/FreezeLayer.js +10 -2
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +3 -12
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.module.css +2 -1
- package/lib/dropdown/ToggleDropDown/props/defaultProps.js +1 -2
- package/lib/dropdown/ToggleDropDown/props/propTypes.js +1 -2
- package/lib/list/status/StatusDropdown/StatusDropdown.js +1 -3
- package/lib/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/list/status/StatusListItem/StatusListItem.js +3 -4
- package/lib/list/status/StatusListItem/StatusListItem.module.css +2 -5
- package/lib/list/status/StatusListItem/props/defaultProps.js +1 -2
- package/lib/list/status/StatusListItem/props/propTypes.js +0 -1
- package/lib/lookup/Lookup/DraggerUtil.js +63 -0
- package/lib/lookup/Lookup/Lookup.module.css +8 -1
- package/lib/lookup/Lookup/useDragger.js +70 -0
- package/lib/lookup/Section/Section.js +1 -0
- package/lib/version2/lookup/AlertHeader/AlertHeader.js +2 -1
- package/lib/version2/lookup/AlertHeader/AlertHeaderNew.module.css +2 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
-
# 1.0.0-beta.251
|
|
6
|
-
|
|
7
|
-
- **ToggleDropdown, StatusDropdown, StatusListItem** - Added New Prop `needMultiLineText`
|
|
8
|
-
|
|
9
5
|
# 1.0.0-beta.250
|
|
10
6
|
|
|
11
7
|
- - **FreezeLayer** - converted to functional component
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import { defaultProps } from './props/defaultProps';
|
|
3
3
|
import { propTypes } from './props/propTypes';
|
|
4
4
|
import { Container } from '@zohodesk/components/lib/Layout';
|
|
@@ -8,6 +8,7 @@ import { useZIndex } from '@zohodesk/components/lib/Provider/ZindexProvider';
|
|
|
8
8
|
import cssJSLogic from './css/cssJSLogic';
|
|
9
9
|
import useFreezeLayer from './useFreezeLayer';
|
|
10
10
|
import style from './css/FreezeLayer.module.css';
|
|
11
|
+
import useDragger from '../lookup/Lookup/useDragger';
|
|
11
12
|
export default function FreezeLayer(props) {
|
|
12
13
|
let {
|
|
13
14
|
isActive: propsActive,
|
|
@@ -23,6 +24,7 @@ export default function FreezeLayer(props) {
|
|
|
23
24
|
needAutoZindex,
|
|
24
25
|
customStyle
|
|
25
26
|
} = props;
|
|
27
|
+
const createRef = useRef(null);
|
|
26
28
|
const finalStyle = mergeStyle(style, customStyle);
|
|
27
29
|
const {
|
|
28
30
|
freezeClass
|
|
@@ -39,6 +41,9 @@ export default function FreezeLayer(props) {
|
|
|
39
41
|
isActive: propsActive,
|
|
40
42
|
onClick
|
|
41
43
|
});
|
|
44
|
+
useDragger({
|
|
45
|
+
ParentRef: createRef
|
|
46
|
+
});
|
|
42
47
|
return /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
|
|
43
48
|
name: animationName && animationName,
|
|
44
49
|
isActive: isActive,
|
|
@@ -49,7 +54,7 @@ export default function FreezeLayer(props) {
|
|
|
49
54
|
} : {},
|
|
50
55
|
className: freezeClass,
|
|
51
56
|
onClick: handleClick,
|
|
52
|
-
ref:
|
|
57
|
+
ref: createRef
|
|
53
58
|
}, children && /*#__PURE__*/React.createElement(React.Fragment, null, childAnimationName ? /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
|
|
54
59
|
name: childAnimationName,
|
|
55
60
|
isActive: isChildActive,
|
|
@@ -519,9 +519,7 @@ export class ToggleDropDown extends Component {
|
|
|
519
519
|
hoverType,
|
|
520
520
|
palette,
|
|
521
521
|
getFooter,
|
|
522
|
-
customProps
|
|
523
|
-
needMultiLineText,
|
|
524
|
-
customClass
|
|
522
|
+
customProps
|
|
525
523
|
} = this.props;
|
|
526
524
|
let {
|
|
527
525
|
ToggleDropDownProps = {},
|
|
@@ -530,10 +528,6 @@ export class ToggleDropDown extends Component {
|
|
|
530
528
|
ListItemWithIconProps = {},
|
|
531
529
|
ListItemProps = {}
|
|
532
530
|
} = customProps;
|
|
533
|
-
let {
|
|
534
|
-
customDropBox,
|
|
535
|
-
customListBox
|
|
536
|
-
} = customClass;
|
|
537
531
|
const isPopupOpen = needExternalPopupState ? isPopupActive && isOpen : isOpen;
|
|
538
532
|
const Component = isToggleStateNeeded ? children.type : null,
|
|
539
533
|
componentProps = isToggleStateNeeded ? children.props : null;
|
|
@@ -618,8 +612,7 @@ export class ToggleDropDown extends Component {
|
|
|
618
612
|
isAnimate: true,
|
|
619
613
|
getRef: getContainerRef,
|
|
620
614
|
customClass: {
|
|
621
|
-
customDropBoxWrap: style.dropBoxContainer
|
|
622
|
-
customDropBox: customDropBox
|
|
615
|
+
customDropBoxWrap: style.dropBoxContainer
|
|
623
616
|
},
|
|
624
617
|
needResponsive: needResponsive,
|
|
625
618
|
isPadding: isPadding,
|
|
@@ -665,7 +658,7 @@ export class ToggleDropDown extends Component {
|
|
|
665
658
|
scroll: "vertical",
|
|
666
659
|
preventParentScroll: "vertical",
|
|
667
660
|
dataId: `${dataId}_list`,
|
|
668
|
-
className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}
|
|
661
|
+
className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
|
|
669
662
|
eleRef: this.scrollContentRef,
|
|
670
663
|
onScroll: this.handleScroll,
|
|
671
664
|
role: isSearch ? 'listbox' : undefined,
|
|
@@ -718,7 +711,6 @@ export class ToggleDropDown extends Component {
|
|
|
718
711
|
getRef: this.itemRef,
|
|
719
712
|
title: title ? title : item[keyName],
|
|
720
713
|
palette: palette,
|
|
721
|
-
needMultiLineText: needMultiLineText,
|
|
722
714
|
a11y: {
|
|
723
715
|
role: isSearch ? 'option' : 'menuitem',
|
|
724
716
|
ariaSelected: selectedId === item[idName],
|
|
@@ -741,7 +733,6 @@ export class ToggleDropDown extends Component {
|
|
|
741
733
|
getRef: this.itemRef,
|
|
742
734
|
title: title ? title : item[keyName],
|
|
743
735
|
palette: palette,
|
|
744
|
-
needMultiLineText: needMultiLineText,
|
|
745
736
|
a11y: {
|
|
746
737
|
role: isSearch ? 'option' : 'menuitem',
|
|
747
738
|
ariaSelected: selectedId === item[idName],
|
|
@@ -789,7 +780,6 @@ export class ToggleDropDown extends Component {
|
|
|
789
780
|
title: title ? title : item[keyName],
|
|
790
781
|
key: listIndex,
|
|
791
782
|
palette: palette,
|
|
792
|
-
needMultiLineText: needMultiLineText,
|
|
793
783
|
a11y: {
|
|
794
784
|
role: isSearch ? 'option' : 'menuitem',
|
|
795
785
|
ariaSelected: selectedId === item[idName],
|
|
@@ -812,7 +802,6 @@ export class ToggleDropDown extends Component {
|
|
|
812
802
|
getRef: this.itemRef,
|
|
813
803
|
title: title ? title : item[keyName],
|
|
814
804
|
palette: palette,
|
|
815
|
-
needMultiLineText: needMultiLineText,
|
|
816
805
|
a11y: {
|
|
817
806
|
role: isSearch ? 'option' : 'menuitem',
|
|
818
807
|
ariaSelected: selectedId === item[idName],
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
visibility: visible;
|
|
41
41
|
}
|
|
42
42
|
.value {
|
|
43
|
-
composes: dotted
|
|
43
|
+
composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
|
|
44
|
+
composes: offSelection from '~@zohodesk/components/lib/common/common.module.css';
|
|
44
45
|
}
|
|
45
46
|
.search {
|
|
46
47
|
padding: var(--zd_size6) var(--zd_size20) 0;
|
|
@@ -275,8 +275,7 @@ export class StatusDropdown extends React.Component {
|
|
|
275
275
|
arrowIconPosition,
|
|
276
276
|
statusColor,
|
|
277
277
|
needExternalPopupState = false,
|
|
278
|
-
isPopupActive = false
|
|
279
|
-
needMultiLineText
|
|
278
|
+
isPopupActive = false
|
|
280
279
|
} = this.props;
|
|
281
280
|
let isPopupOpen = needExternalPopupState ? isPopupActive && isOpen : isOpen;
|
|
282
281
|
let {
|
|
@@ -397,7 +396,6 @@ export class StatusDropdown extends React.Component {
|
|
|
397
396
|
getRef: this.itemRef,
|
|
398
397
|
bulletColor: item[statusColor],
|
|
399
398
|
title: item[keyName],
|
|
400
|
-
needMultiLineText: needMultiLineText,
|
|
401
399
|
a11y: {
|
|
402
400
|
role: isSearch ? 'option' : 'menuitem',
|
|
403
401
|
ariaSelected: value === item[keyName]
|
|
@@ -46,6 +46,5 @@ export const propTypes = {
|
|
|
46
46
|
targetAlign: PropTypes.oneOf(['vertical', 'horizontal', 'both', 'top', 'right', 'bottom', 'left', 'between', 'around']),
|
|
47
47
|
title: PropTypes.string,
|
|
48
48
|
togglePopup: PropTypes.func,
|
|
49
|
-
value: PropTypes.node
|
|
50
|
-
needMultiLineText: PropTypes.bool
|
|
49
|
+
value: PropTypes.node
|
|
51
50
|
};
|
|
@@ -60,8 +60,7 @@ export default class StatusListItem extends React.Component {
|
|
|
60
60
|
needBorder,
|
|
61
61
|
isDisabled,
|
|
62
62
|
bulletColor,
|
|
63
|
-
a11y
|
|
64
|
-
needMultiLineText
|
|
63
|
+
a11y
|
|
65
64
|
} = this.props;
|
|
66
65
|
let options = {};
|
|
67
66
|
let {
|
|
@@ -77,7 +76,7 @@ export default class StatusListItem extends React.Component {
|
|
|
77
76
|
role: role,
|
|
78
77
|
"aria-selected": ariaSelected,
|
|
79
78
|
isCover: false,
|
|
80
|
-
align: "
|
|
79
|
+
align: "vertical",
|
|
81
80
|
alignBox: "row",
|
|
82
81
|
className: `${style.list} ${style[size]} ${style[palette]} ${active ? style.active : highlight && !isDisabled ? style.hover : ''} ${autoHover && !isDisabled ? style.effect : ''} ${needTick ? style.withTick : ''} ${isDisabled ? CssProvider('isDisable') : ''} ${needBorder ? style.withBorder : ''}`,
|
|
83
82
|
dataId: String(value).replace("'", '_'),
|
|
@@ -93,7 +92,7 @@ export default class StatusListItem extends React.Component {
|
|
|
93
92
|
"data-title": isDisabled ? null : title,
|
|
94
93
|
flexible: true,
|
|
95
94
|
shrink: true,
|
|
96
|
-
className:
|
|
95
|
+
className: style.value
|
|
97
96
|
}, value), needTick && active ? /*#__PURE__*/React.createElement("div", {
|
|
98
97
|
className: style.tickIcon,
|
|
99
98
|
"aria-hidden": ariaHidden
|
|
@@ -33,14 +33,11 @@
|
|
|
33
33
|
.value {
|
|
34
34
|
composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
word-break: break-word;
|
|
38
|
-
line-height: var(--zd_size20);
|
|
39
|
-
composes: clamp from '~@zohodesk/components/lib/common/common.module.css';
|
|
40
|
-
}
|
|
36
|
+
|
|
41
37
|
[dir=ltr] .withBorder.active {
|
|
42
38
|
border-left-color: var(--zdt_statuslistitem_default_active_border);
|
|
43
39
|
}
|
|
40
|
+
|
|
44
41
|
[dir=rtl] .withBorder.active {
|
|
45
42
|
border-right-color: var(--zdt_statuslistitem_default_active_border);
|
|
46
43
|
}
|
|
@@ -20,7 +20,6 @@ export const propTypes = {
|
|
|
20
20
|
target: PropTypes.oneOf(['blank', 'self']),
|
|
21
21
|
title: PropTypes.string,
|
|
22
22
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
23
|
-
needMultiLineText: PropTypes.bool,
|
|
24
23
|
a11y: PropTypes.shape({
|
|
25
24
|
role: PropTypes.string,
|
|
26
25
|
ariaSelected: PropTypes.bool,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function DragPosCalc(_ref) {
|
|
2
|
+
let {
|
|
3
|
+
x,
|
|
4
|
+
y,
|
|
5
|
+
elmnt,
|
|
6
|
+
dragwrpper
|
|
7
|
+
} = _ref;
|
|
8
|
+
if (x < 0) {
|
|
9
|
+
x = 0;
|
|
10
|
+
}
|
|
11
|
+
if (x > dragwrpper.offsetWidth - elmnt.offsetWidth) {
|
|
12
|
+
x = dragwrpper.offsetWidth - elmnt.offsetWidth;
|
|
13
|
+
}
|
|
14
|
+
console.log(dragwrpper.offsetHeight, elmnt.offsetHeight, 'y');
|
|
15
|
+
if (y < 0) {
|
|
16
|
+
y = 0;
|
|
17
|
+
}
|
|
18
|
+
if (y > dragwrpper.offsetHeight - elmnt.offsetHeight) {
|
|
19
|
+
y = dragwrpper.offsetHeight - elmnt.offsetHeight;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
x,
|
|
23
|
+
y
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export const elementFinder = async (Parent, selector) => {
|
|
27
|
+
while (Parent && Parent.querySelector(selector) === null) {
|
|
28
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
29
|
+
}
|
|
30
|
+
return Parent && Parent.querySelector(selector);
|
|
31
|
+
};
|
|
@@ -2,25 +2,32 @@
|
|
|
2
2
|
font-size: var(--zd_font_size16);
|
|
3
3
|
padding-bottom: var(--zd_size10);
|
|
4
4
|
}
|
|
5
|
+
|
|
5
6
|
.box {
|
|
6
7
|
position: relative;
|
|
7
8
|
height: 100%;
|
|
8
9
|
width: 100%;
|
|
9
10
|
margin: auto;
|
|
11
|
+
|
|
10
12
|
}
|
|
13
|
+
|
|
11
14
|
/* Size */
|
|
12
15
|
.smallSize {
|
|
13
16
|
max-width: var(--zd_size470);
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
.xmediumSize {
|
|
16
20
|
max-width: var(--zd_size620);
|
|
17
21
|
}
|
|
22
|
+
|
|
18
23
|
.mediumSize {
|
|
19
24
|
max-width: var(--zd_size840);
|
|
20
25
|
}
|
|
26
|
+
|
|
21
27
|
.largeSize {
|
|
22
28
|
max-width: 70%;
|
|
23
29
|
}
|
|
30
|
+
|
|
24
31
|
.fullSize {
|
|
25
32
|
max-width: 90%;
|
|
26
|
-
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { elementFinder, DragPosCalc } from "./DraggerUtil";
|
|
3
|
+
export default function useDragger(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
ParentRef = null
|
|
6
|
+
} = _ref;
|
|
7
|
+
let dragableEle = useRef(null); //To set the Dragable Element
|
|
8
|
+
let parentEle = useRef(null); // Eo set the Parent Boundary Element
|
|
9
|
+
let offset = useRef({
|
|
10
|
+
x: 0,
|
|
11
|
+
y: 0
|
|
12
|
+
}); //To set the x and y Positions
|
|
13
|
+
let dragable = useRef(false); // To get track of dragable
|
|
14
|
+
|
|
15
|
+
const elementDrag = e => {
|
|
16
|
+
e = e || window.event;
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
if (dragable.current) {
|
|
19
|
+
const left = offset.current.x + e.clientX;
|
|
20
|
+
const top = offset.current.y + e.clientY;
|
|
21
|
+
if (parentEle.current) {
|
|
22
|
+
const calcValue = DragPosCalc({
|
|
23
|
+
x: left,
|
|
24
|
+
y: top,
|
|
25
|
+
dragwrpper: parentEle.current,
|
|
26
|
+
elmnt: dragableEle.current
|
|
27
|
+
});
|
|
28
|
+
dragableEle.current.style.left = calcValue.x + "px";
|
|
29
|
+
dragableEle.current.style.top = calcValue.y + "px";
|
|
30
|
+
} else {
|
|
31
|
+
dragableEle.current.style.left = left + "px";
|
|
32
|
+
dragableEle.current.style.top = top + "px";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const closeDragElement = () => {
|
|
37
|
+
document.removeEventListener("mouseup", closeDragElement);
|
|
38
|
+
document.removeEventListener("mousemove", elementDrag);
|
|
39
|
+
};
|
|
40
|
+
const dragMouseDown = e => {
|
|
41
|
+
//Initial position
|
|
42
|
+
requestAnimationFrame(() => {
|
|
43
|
+
let dragableEleRect = dragableEle.current.getBoundingClientRect();
|
|
44
|
+
e = e || window.event;
|
|
45
|
+
// e.preventDefault();
|
|
46
|
+
dragableEle.current.style.top = dragableEleRect.top + "px";
|
|
47
|
+
dragableEle.current.style.left = dragableEleRect.left + "px";
|
|
48
|
+
dragableEle.current.style.width = dragableEleRect.width + "px";
|
|
49
|
+
dragableEle.current.style.position = "fixed";
|
|
50
|
+
offset.current.x = dragableEle.current.offsetLeft - e.clientX;
|
|
51
|
+
offset.current.y = dragableEle.current.offsetTop - e.clientY;
|
|
52
|
+
dragable.current = true;
|
|
53
|
+
document.addEventListener("mouseup", closeDragElement);
|
|
54
|
+
document.addEventListener("mousemove", elementDrag);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
elementFinder(ParentRef.current, "[isdraggable=true]").then(dragableElement => {
|
|
59
|
+
dragableEle.current = dragableElement;
|
|
60
|
+
parentEle.current = ParentRef.current;
|
|
61
|
+
let dragController = dragableEle.current && dragableEle.current.querySelector("[isdrag-header=true]") ? dragableEle.current.querySelector("[isdrag-header=true]") : dragableEle.current;
|
|
62
|
+
dragController && dragController.addEventListener("mousedown", dragMouseDown);
|
|
63
|
+
});
|
|
64
|
+
}, [ParentRef.current]);
|
|
65
|
+
}
|
|
@@ -12,6 +12,7 @@ export default class Section extends Component {
|
|
|
12
12
|
className
|
|
13
13
|
} = this.props;
|
|
14
14
|
return /*#__PURE__*/React.createElement(Container, {
|
|
15
|
+
isdraggable: "true",
|
|
15
16
|
alignBox: alignBox,
|
|
16
17
|
className: `${style.section} ${className ? className : ''}`
|
|
17
18
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -24,7 +24,8 @@ export default class AlertHeader extends Component {
|
|
|
24
24
|
alignBox: "row",
|
|
25
25
|
className: `${style.container} ${headerElement ? style.headerLayout : ''} ${style[type]}`,
|
|
26
26
|
isCover: false,
|
|
27
|
-
wrap: "wrap"
|
|
27
|
+
wrap: "wrap",
|
|
28
|
+
"isdrag-header": "true"
|
|
28
29
|
}, needIcon ? /*#__PURE__*/React.createElement("div", {
|
|
29
30
|
className: style.iconContainer
|
|
30
31
|
}, /*#__PURE__*/React.createElement(AlertIcons, {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
border-style: solid;
|
|
9
9
|
border-color: var(--commonalert_border_color);
|
|
10
10
|
border-width: 2px 0 0 0;
|
|
11
|
+
cursor: move;
|
|
11
12
|
}
|
|
12
13
|
.headerLayout {
|
|
13
14
|
min-height: var(--zd_size54);
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
font-family: var(--zd_bold);
|
|
60
61
|
composes: ftsmooth wbreak from '~@zohodesk/components/lib/common/common.module.css';
|
|
61
62
|
vertical-align: middle;
|
|
63
|
+
cursor: default;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
[dir=ltr] .title {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = FreezeLayer;
|
|
7
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _defaultProps = require("./props/defaultProps");
|
|
9
10
|
var _propTypes = require("./props/propTypes");
|
|
10
11
|
var _Layout = require("@zohodesk/components/lib/Layout");
|
|
@@ -14,7 +15,10 @@ var _ZindexProvider = require("@zohodesk/components/lib/Provider/ZindexProvider"
|
|
|
14
15
|
var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
15
16
|
var _useFreezeLayer2 = _interopRequireDefault(require("./useFreezeLayer"));
|
|
16
17
|
var _FreezeLayerModule = _interopRequireDefault(require("./css/FreezeLayer.module.css"));
|
|
18
|
+
var _useDragger = _interopRequireDefault(require("../lookup/Lookup/useDragger"));
|
|
17
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
22
|
function FreezeLayer(props) {
|
|
19
23
|
var propsActive = props.isActive,
|
|
20
24
|
children = props.children,
|
|
@@ -28,6 +32,7 @@ function FreezeLayer(props) {
|
|
|
28
32
|
isSvgMask = props.isSvgMask,
|
|
29
33
|
needAutoZindex = props.needAutoZindex,
|
|
30
34
|
customStyle = props.customStyle;
|
|
35
|
+
var createRef = (0, _react.useRef)(null);
|
|
31
36
|
var finalStyle = (0, _utils.mergeStyle)(_FreezeLayerModule["default"], customStyle);
|
|
32
37
|
var _cssJSLogic = (0, _cssJSLogic2["default"])({
|
|
33
38
|
props: props,
|
|
@@ -42,6 +47,9 @@ function FreezeLayer(props) {
|
|
|
42
47
|
isActive = _useFreezeLayer.isActive,
|
|
43
48
|
isChildActive = _useFreezeLayer.isChildActive,
|
|
44
49
|
handleClick = _useFreezeLayer.handleClick;
|
|
50
|
+
(0, _useDragger["default"])({
|
|
51
|
+
ParentRef: createRef
|
|
52
|
+
});
|
|
45
53
|
return /*#__PURE__*/_react["default"].createElement(_VelocityAnimationGroup["default"], {
|
|
46
54
|
name: animationName && animationName,
|
|
47
55
|
isActive: isActive,
|
|
@@ -52,7 +60,7 @@ function FreezeLayer(props) {
|
|
|
52
60
|
} : {},
|
|
53
61
|
className: freezeClass,
|
|
54
62
|
onClick: handleClick,
|
|
55
|
-
ref:
|
|
63
|
+
ref: createRef
|
|
56
64
|
}, children && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, childAnimationName ? /*#__PURE__*/_react["default"].createElement(_VelocityAnimationGroup["default"], {
|
|
57
65
|
name: childAnimationName,
|
|
58
66
|
isActive: isChildActive,
|
|
@@ -568,9 +568,7 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
568
568
|
hoverType = _this$props12.hoverType,
|
|
569
569
|
palette = _this$props12.palette,
|
|
570
570
|
getFooter = _this$props12.getFooter,
|
|
571
|
-
customProps = _this$props12.customProps
|
|
572
|
-
needMultiLineText = _this$props12.needMultiLineText,
|
|
573
|
-
customClass = _this$props12.customClass;
|
|
571
|
+
customProps = _this$props12.customProps;
|
|
574
572
|
var _customProps$ToggleDr = customProps.ToggleDropDownProps,
|
|
575
573
|
ToggleDropDownProps = _customProps$ToggleDr === void 0 ? {} : _customProps$ToggleDr,
|
|
576
574
|
_customProps$DropBoxP = customProps.DropBoxProps,
|
|
@@ -581,8 +579,6 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
581
579
|
ListItemWithIconProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
582
580
|
_customProps$ListItem2 = customProps.ListItemProps,
|
|
583
581
|
ListItemProps = _customProps$ListItem2 === void 0 ? {} : _customProps$ListItem2;
|
|
584
|
-
var customDropBox = customClass.customDropBox,
|
|
585
|
-
customListBox = customClass.customListBox;
|
|
586
582
|
var isPopupOpen = needExternalPopupState ? isPopupActive && isOpen : isOpen;
|
|
587
583
|
var Component = isToggleStateNeeded ? children.type : null,
|
|
588
584
|
componentProps = isToggleStateNeeded ? children.props : null;
|
|
@@ -664,8 +660,7 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
664
660
|
isAnimate: true,
|
|
665
661
|
getRef: getContainerRef,
|
|
666
662
|
customClass: {
|
|
667
|
-
customDropBoxWrap: _ToggleDropDownModule["default"].dropBoxContainer
|
|
668
|
-
customDropBox: customDropBox
|
|
663
|
+
customDropBoxWrap: _ToggleDropDownModule["default"].dropBoxContainer
|
|
669
664
|
},
|
|
670
665
|
needResponsive: needResponsive,
|
|
671
666
|
isPadding: isPadding,
|
|
@@ -711,7 +706,7 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
711
706
|
scroll: "vertical",
|
|
712
707
|
preventParentScroll: "vertical",
|
|
713
708
|
dataId: "".concat(dataId, "_list"),
|
|
714
|
-
className: "".concat(tabletMode ? _ToggleDropDownModule["default"].responsivemaxHgt : _ToggleDropDownModule["default"].maxHgt
|
|
709
|
+
className: "".concat(tabletMode ? _ToggleDropDownModule["default"].responsivemaxHgt : _ToggleDropDownModule["default"].maxHgt),
|
|
715
710
|
eleRef: _this6.scrollContentRef,
|
|
716
711
|
onScroll: _this6.handleScroll,
|
|
717
712
|
role: isSearch ? 'listbox' : undefined,
|
|
@@ -762,7 +757,6 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
762
757
|
getRef: _this6.itemRef,
|
|
763
758
|
title: title ? title : item[keyName],
|
|
764
759
|
palette: palette,
|
|
765
|
-
needMultiLineText: needMultiLineText,
|
|
766
760
|
a11y: {
|
|
767
761
|
role: isSearch ? 'option' : 'menuitem',
|
|
768
762
|
ariaSelected: selectedId === item[idName],
|
|
@@ -785,7 +779,6 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
785
779
|
getRef: _this6.itemRef,
|
|
786
780
|
title: title ? title : item[keyName],
|
|
787
781
|
palette: palette,
|
|
788
|
-
needMultiLineText: needMultiLineText,
|
|
789
782
|
a11y: {
|
|
790
783
|
role: isSearch ? 'option' : 'menuitem',
|
|
791
784
|
ariaSelected: selectedId === item[idName],
|
|
@@ -833,7 +826,6 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
833
826
|
title: title ? title : item[keyName],
|
|
834
827
|
key: listIndex,
|
|
835
828
|
palette: palette,
|
|
836
|
-
needMultiLineText: needMultiLineText,
|
|
837
829
|
a11y: {
|
|
838
830
|
role: isSearch ? 'option' : 'menuitem',
|
|
839
831
|
ariaSelected: selectedId === item[idName],
|
|
@@ -856,7 +848,6 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
856
848
|
getRef: _this6.itemRef,
|
|
857
849
|
title: title ? title : item[keyName],
|
|
858
850
|
palette: palette,
|
|
859
|
-
needMultiLineText: needMultiLineText,
|
|
860
851
|
a11y: {
|
|
861
852
|
role: isSearch ? 'option' : 'menuitem',
|
|
862
853
|
ariaSelected: selectedId === item[idName],
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
visibility: visible;
|
|
41
41
|
}
|
|
42
42
|
.value {
|
|
43
|
-
composes: dotted
|
|
43
|
+
composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
|
|
44
|
+
composes: offSelection from '~@zohodesk/components/lib/common/common.module.css';
|
|
44
45
|
}
|
|
45
46
|
.search {
|
|
46
47
|
padding: var(--zd_size6) var(--zd_size20) 0;
|
|
@@ -74,7 +74,6 @@ var propTypes = {
|
|
|
74
74
|
ListItemWithIconProps: _propTypes["default"].object,
|
|
75
75
|
ListItemProps: _propTypes["default"].object
|
|
76
76
|
}),
|
|
77
|
-
preventPopupClose: _propTypes["default"].bool
|
|
78
|
-
needMultiLineText: _propTypes["default"].bool
|
|
77
|
+
preventPopupClose: _propTypes["default"].bool
|
|
79
78
|
};
|
|
80
79
|
exports.propTypes = propTypes;
|
|
@@ -326,8 +326,7 @@ var StatusDropdown = /*#__PURE__*/function (_React$Component) {
|
|
|
326
326
|
_this$props7$needExte = _this$props7.needExternalPopupState,
|
|
327
327
|
needExternalPopupState = _this$props7$needExte === void 0 ? false : _this$props7$needExte,
|
|
328
328
|
_this$props7$isPopupA = _this$props7.isPopupActive,
|
|
329
|
-
isPopupActive = _this$props7$isPopupA === void 0 ? false : _this$props7$isPopupA
|
|
330
|
-
needMultiLineText = _this$props7.needMultiLineText;
|
|
329
|
+
isPopupActive = _this$props7$isPopupA === void 0 ? false : _this$props7$isPopupA;
|
|
331
330
|
var isPopupOpen = needExternalPopupState ? isPopupActive && isOpen : isOpen;
|
|
332
331
|
var searchString = this.state.searchString;
|
|
333
332
|
var containerClass = "".concat(className ? className : '', " ").concat(isPopupReady ? activeStyle ? activeStyle : '' : showIconOnHover ? _StatusDropdownModule["default"].hoverIcon : '', " ").concat(isDisabled ? _commonModule["default"].disabled : isReadOnly ? _StatusDropdownModule["default"].readOnly : !isEditable ? _StatusDropdownModule["default"].cursorDefault : !showOnHover ? "".concat(_StatusDropdownModule["default"].cursor, " ").concat(hoverStyle ? hoverStyle : '') : "".concat(hoverStyle ? hoverStyle : '', " ").concat(_StatusDropdownModule["default"].cursorDefault));
|
|
@@ -444,7 +443,6 @@ var StatusDropdown = /*#__PURE__*/function (_React$Component) {
|
|
|
444
443
|
getRef: _this3.itemRef,
|
|
445
444
|
bulletColor: item[statusColor],
|
|
446
445
|
title: item[keyName],
|
|
447
|
-
needMultiLineText: needMultiLineText,
|
|
448
446
|
a11y: {
|
|
449
447
|
role: isSearch ? 'option' : 'menuitem',
|
|
450
448
|
ariaSelected: value === item[keyName]
|
|
@@ -28,5 +28,5 @@ var propTypes = (_propTypes = {
|
|
|
28
28
|
idName: _propTypes2["default"].string,
|
|
29
29
|
isArrow: _propTypes2["default"].bool,
|
|
30
30
|
isDataLoaded: _propTypes2["default"].bool
|
|
31
|
-
}, _defineProperty(_propTypes, "isDataLoaded", _propTypes2["default"].bool), _defineProperty(_propTypes, "isDisabled", _propTypes2["default"].bool), _defineProperty(_propTypes, "isEditable", _propTypes2["default"].bool), _defineProperty(_propTypes, "isNextOptions", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupActive", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupOpen", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupReady", _propTypes2["default"].bool), _defineProperty(_propTypes, "isReadOnly", _propTypes2["default"].bool), _defineProperty(_propTypes, "isSearch", _propTypes2["default"].bool), _defineProperty(_propTypes, "keyName", _propTypes2["default"].string), _defineProperty(_propTypes, "left", _propTypes2["default"].number), _defineProperty(_propTypes, "needExternalPopupState", _propTypes2["default"].bool), _defineProperty(_propTypes, "needResponsive", _propTypes2["default"].bool), _defineProperty(_propTypes, "needTick", _propTypes2["default"].bool), _defineProperty(_propTypes, "onClick", _propTypes2["default"].func), _defineProperty(_propTypes, "onTogglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "options", _propTypes2["default"].array.isRequired), _defineProperty(_propTypes, "placeHolderText", _propTypes2["default"].string), _defineProperty(_propTypes, "position", _propTypes2["default"].string), _defineProperty(_propTypes, "removeClose", _propTypes2["default"].func), _defineProperty(_propTypes, "right", _propTypes2["default"].number), _defineProperty(_propTypes, "searchBoxSize", _propTypes2["default"].oneOf(['small', 'medium', 'xmedium'])), _defineProperty(_propTypes, "searchEmptyHint", _propTypes2["default"].string), _defineProperty(_propTypes, "searchErrorText", _propTypes2["default"].string), _defineProperty(_propTypes, "showIconOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "showOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "statusColor", _propTypes2["default"].string), _defineProperty(_propTypes, "targetAlign", _propTypes2["default"].oneOf(['vertical', 'horizontal', 'both', 'top', 'right', 'bottom', 'left', 'between', 'around'])), _defineProperty(_propTypes, "title", _propTypes2["default"].string), _defineProperty(_propTypes, "togglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "value", _propTypes2["default"].node),
|
|
31
|
+
}, _defineProperty(_propTypes, "isDataLoaded", _propTypes2["default"].bool), _defineProperty(_propTypes, "isDisabled", _propTypes2["default"].bool), _defineProperty(_propTypes, "isEditable", _propTypes2["default"].bool), _defineProperty(_propTypes, "isNextOptions", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupActive", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupOpen", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupReady", _propTypes2["default"].bool), _defineProperty(_propTypes, "isReadOnly", _propTypes2["default"].bool), _defineProperty(_propTypes, "isSearch", _propTypes2["default"].bool), _defineProperty(_propTypes, "keyName", _propTypes2["default"].string), _defineProperty(_propTypes, "left", _propTypes2["default"].number), _defineProperty(_propTypes, "needExternalPopupState", _propTypes2["default"].bool), _defineProperty(_propTypes, "needResponsive", _propTypes2["default"].bool), _defineProperty(_propTypes, "needTick", _propTypes2["default"].bool), _defineProperty(_propTypes, "onClick", _propTypes2["default"].func), _defineProperty(_propTypes, "onTogglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "options", _propTypes2["default"].array.isRequired), _defineProperty(_propTypes, "placeHolderText", _propTypes2["default"].string), _defineProperty(_propTypes, "position", _propTypes2["default"].string), _defineProperty(_propTypes, "removeClose", _propTypes2["default"].func), _defineProperty(_propTypes, "right", _propTypes2["default"].number), _defineProperty(_propTypes, "searchBoxSize", _propTypes2["default"].oneOf(['small', 'medium', 'xmedium'])), _defineProperty(_propTypes, "searchEmptyHint", _propTypes2["default"].string), _defineProperty(_propTypes, "searchErrorText", _propTypes2["default"].string), _defineProperty(_propTypes, "showIconOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "showOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "statusColor", _propTypes2["default"].string), _defineProperty(_propTypes, "targetAlign", _propTypes2["default"].oneOf(['vertical', 'horizontal', 'both', 'top', 'right', 'bottom', 'left', 'between', 'around'])), _defineProperty(_propTypes, "title", _propTypes2["default"].string), _defineProperty(_propTypes, "togglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "value", _propTypes2["default"].node), _propTypes);
|
|
32
32
|
exports.propTypes = propTypes;
|
|
@@ -87,8 +87,7 @@ var StatusListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
87
87
|
needBorder = _this$props4.needBorder,
|
|
88
88
|
isDisabled = _this$props4.isDisabled,
|
|
89
89
|
bulletColor = _this$props4.bulletColor,
|
|
90
|
-
a11y = _this$props4.a11y
|
|
91
|
-
needMultiLineText = _this$props4.needMultiLineText;
|
|
90
|
+
a11y = _this$props4.a11y;
|
|
92
91
|
var options = {};
|
|
93
92
|
var role = a11y.role,
|
|
94
93
|
ariaSelected = a11y.ariaSelected,
|
|
@@ -102,7 +101,7 @@ var StatusListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
102
101
|
role: role,
|
|
103
102
|
"aria-selected": ariaSelected,
|
|
104
103
|
isCover: false,
|
|
105
|
-
align: "
|
|
104
|
+
align: "vertical",
|
|
106
105
|
alignBox: "row",
|
|
107
106
|
className: "".concat(_StatusListItemModule["default"].list, " ").concat(_StatusListItemModule["default"][size], " ").concat(_StatusListItemModule["default"][palette], " ").concat(active ? _StatusListItemModule["default"].active : highlight && !isDisabled ? _StatusListItemModule["default"].hover : '', " ").concat(autoHover && !isDisabled ? _StatusListItemModule["default"].effect : '', " ").concat(needTick ? _StatusListItemModule["default"].withTick : '', " ").concat(isDisabled ? (0, _CssProvider["default"])('isDisable') : '', " ").concat(needBorder ? _StatusListItemModule["default"].withBorder : ''),
|
|
108
107
|
dataId: String(value).replace("'", '_'),
|
|
@@ -118,7 +117,7 @@ var StatusListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
118
117
|
"data-title": isDisabled ? null : title,
|
|
119
118
|
flexible: true,
|
|
120
119
|
shrink: true,
|
|
121
|
-
className:
|
|
120
|
+
className: _StatusListItemModule["default"].value
|
|
122
121
|
}, value), needTick && active ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
123
122
|
className: _StatusListItemModule["default"].tickIcon,
|
|
124
123
|
"aria-hidden": ariaHidden
|
|
@@ -33,14 +33,11 @@
|
|
|
33
33
|
.value {
|
|
34
34
|
composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
word-break: break-word;
|
|
38
|
-
line-height: var(--zd_size20);
|
|
39
|
-
composes: clamp from '~@zohodesk/components/lib/common/common.module.css';
|
|
40
|
-
}
|
|
36
|
+
|
|
41
37
|
[dir=ltr] .withBorder.active {
|
|
42
38
|
border-left-color: var(--zdt_statuslistitem_default_active_border);
|
|
43
39
|
}
|
|
40
|
+
|
|
44
41
|
[dir=rtl] .withBorder.active {
|
|
45
42
|
border-right-color: var(--zdt_statuslistitem_default_active_border);
|
|
46
43
|
}
|
|
@@ -27,7 +27,6 @@ var propTypes = {
|
|
|
27
27
|
target: _propTypes["default"].oneOf(['blank', 'self']),
|
|
28
28
|
title: _propTypes["default"].string,
|
|
29
29
|
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]).isRequired,
|
|
30
|
-
needMultiLineText: _propTypes["default"].bool,
|
|
31
30
|
a11y: _propTypes["default"].shape({
|
|
32
31
|
role: _propTypes["default"].string,
|
|
33
32
|
ariaSelected: _propTypes["default"].bool,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DragPosCalc = DragPosCalc;
|
|
8
|
+
exports.elementFinder = void 0;
|
|
9
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
function DragPosCalc(_ref) {
|
|
13
|
+
var x = _ref.x,
|
|
14
|
+
y = _ref.y,
|
|
15
|
+
elmnt = _ref.elmnt,
|
|
16
|
+
dragwrpper = _ref.dragwrpper;
|
|
17
|
+
if (x < 0) {
|
|
18
|
+
x = 0;
|
|
19
|
+
}
|
|
20
|
+
if (x > dragwrpper.offsetWidth - elmnt.offsetWidth) {
|
|
21
|
+
x = dragwrpper.offsetWidth - elmnt.offsetWidth;
|
|
22
|
+
}
|
|
23
|
+
console.log(dragwrpper.offsetHeight, elmnt.offsetHeight, 'y');
|
|
24
|
+
if (y < 0) {
|
|
25
|
+
y = 0;
|
|
26
|
+
}
|
|
27
|
+
if (y > dragwrpper.offsetHeight - elmnt.offsetHeight) {
|
|
28
|
+
y = dragwrpper.offsetHeight - elmnt.offsetHeight;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
x: x,
|
|
32
|
+
y: y
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
var elementFinder = /*#__PURE__*/function () {
|
|
36
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(Parent, selector) {
|
|
37
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
|
+
while (1) switch (_context.prev = _context.next) {
|
|
39
|
+
case 0:
|
|
40
|
+
if (!(Parent && Parent.querySelector(selector) === null)) {
|
|
41
|
+
_context.next = 5;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
_context.next = 3;
|
|
45
|
+
return new Promise(function (resolve) {
|
|
46
|
+
return requestAnimationFrame(resolve);
|
|
47
|
+
});
|
|
48
|
+
case 3:
|
|
49
|
+
_context.next = 0;
|
|
50
|
+
break;
|
|
51
|
+
case 5:
|
|
52
|
+
return _context.abrupt("return", Parent && Parent.querySelector(selector));
|
|
53
|
+
case 6:
|
|
54
|
+
case "end":
|
|
55
|
+
return _context.stop();
|
|
56
|
+
}
|
|
57
|
+
}, _callee);
|
|
58
|
+
}));
|
|
59
|
+
return function elementFinder(_x, _x2) {
|
|
60
|
+
return _ref2.apply(this, arguments);
|
|
61
|
+
};
|
|
62
|
+
}();
|
|
63
|
+
exports.elementFinder = elementFinder;
|
|
@@ -2,25 +2,32 @@
|
|
|
2
2
|
font-size: var(--zd_font_size16);
|
|
3
3
|
padding-bottom: var(--zd_size10);
|
|
4
4
|
}
|
|
5
|
+
|
|
5
6
|
.box {
|
|
6
7
|
position: relative;
|
|
7
8
|
height: 100%;
|
|
8
9
|
width: 100%;
|
|
9
10
|
margin: auto;
|
|
11
|
+
|
|
10
12
|
}
|
|
13
|
+
|
|
11
14
|
/* Size */
|
|
12
15
|
.smallSize {
|
|
13
16
|
max-width: var(--zd_size470);
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
.xmediumSize {
|
|
16
20
|
max-width: var(--zd_size620);
|
|
17
21
|
}
|
|
22
|
+
|
|
18
23
|
.mediumSize {
|
|
19
24
|
max-width: var(--zd_size840);
|
|
20
25
|
}
|
|
26
|
+
|
|
21
27
|
.largeSize {
|
|
22
28
|
max-width: 70%;
|
|
23
29
|
}
|
|
30
|
+
|
|
24
31
|
.fullSize {
|
|
25
32
|
max-width: 90%;
|
|
26
|
-
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useDragger;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _DraggerUtil = require("./DraggerUtil");
|
|
9
|
+
function useDragger(_ref) {
|
|
10
|
+
var _ref$ParentRef = _ref.ParentRef,
|
|
11
|
+
ParentRef = _ref$ParentRef === void 0 ? null : _ref$ParentRef;
|
|
12
|
+
var dragableEle = (0, _react.useRef)(null); //To set the Dragable Element
|
|
13
|
+
var parentEle = (0, _react.useRef)(null); // Eo set the Parent Boundary Element
|
|
14
|
+
var offset = (0, _react.useRef)({
|
|
15
|
+
x: 0,
|
|
16
|
+
y: 0
|
|
17
|
+
}); //To set the x and y Positions
|
|
18
|
+
var dragable = (0, _react.useRef)(false); // To get track of dragable
|
|
19
|
+
|
|
20
|
+
var elementDrag = function elementDrag(e) {
|
|
21
|
+
e = e || window.event;
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
if (dragable.current) {
|
|
24
|
+
var left = offset.current.x + e.clientX;
|
|
25
|
+
var top = offset.current.y + e.clientY;
|
|
26
|
+
if (parentEle.current) {
|
|
27
|
+
var calcValue = (0, _DraggerUtil.DragPosCalc)({
|
|
28
|
+
x: left,
|
|
29
|
+
y: top,
|
|
30
|
+
dragwrpper: parentEle.current,
|
|
31
|
+
elmnt: dragableEle.current
|
|
32
|
+
});
|
|
33
|
+
dragableEle.current.style.left = calcValue.x + "px";
|
|
34
|
+
dragableEle.current.style.top = calcValue.y + "px";
|
|
35
|
+
} else {
|
|
36
|
+
dragableEle.current.style.left = left + "px";
|
|
37
|
+
dragableEle.current.style.top = top + "px";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var closeDragElement = function closeDragElement() {
|
|
42
|
+
document.removeEventListener("mouseup", closeDragElement);
|
|
43
|
+
document.removeEventListener("mousemove", elementDrag);
|
|
44
|
+
};
|
|
45
|
+
var dragMouseDown = function dragMouseDown(e) {
|
|
46
|
+
//Initial position
|
|
47
|
+
requestAnimationFrame(function () {
|
|
48
|
+
var dragableEleRect = dragableEle.current.getBoundingClientRect();
|
|
49
|
+
e = e || window.event;
|
|
50
|
+
// e.preventDefault();
|
|
51
|
+
dragableEle.current.style.top = dragableEleRect.top + "px";
|
|
52
|
+
dragableEle.current.style.left = dragableEleRect.left + "px";
|
|
53
|
+
dragableEle.current.style.width = dragableEleRect.width + "px";
|
|
54
|
+
dragableEle.current.style.position = "fixed";
|
|
55
|
+
offset.current.x = dragableEle.current.offsetLeft - e.clientX;
|
|
56
|
+
offset.current.y = dragableEle.current.offsetTop - e.clientY;
|
|
57
|
+
dragable.current = true;
|
|
58
|
+
document.addEventListener("mouseup", closeDragElement);
|
|
59
|
+
document.addEventListener("mousemove", elementDrag);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
(0, _react.useEffect)(function () {
|
|
63
|
+
(0, _DraggerUtil.elementFinder)(ParentRef.current, "[isdraggable=true]").then(function (dragableElement) {
|
|
64
|
+
dragableEle.current = dragableElement;
|
|
65
|
+
parentEle.current = ParentRef.current;
|
|
66
|
+
var dragController = dragableEle.current && dragableEle.current.querySelector("[isdrag-header=true]") ? dragableEle.current.querySelector("[isdrag-header=true]") : dragableEle.current;
|
|
67
|
+
dragController && dragController.addEventListener("mousedown", dragMouseDown);
|
|
68
|
+
});
|
|
69
|
+
}, [ParentRef.current]);
|
|
70
|
+
}
|
|
@@ -38,6 +38,7 @@ var Section = /*#__PURE__*/function (_Component) {
|
|
|
38
38
|
alignBox = _this$props.alignBox,
|
|
39
39
|
className = _this$props.className;
|
|
40
40
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
41
|
+
isdraggable: "true",
|
|
41
42
|
alignBox: alignBox,
|
|
42
43
|
className: "".concat(_LookupSectionModule["default"].section, " ").concat(className ? className : '')
|
|
43
44
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
@@ -53,7 +53,8 @@ var AlertHeader = /*#__PURE__*/function (_Component) {
|
|
|
53
53
|
alignBox: "row",
|
|
54
54
|
className: "".concat(_AlertHeaderNewModule["default"].container, " ").concat(headerElement ? _AlertHeaderNewModule["default"].headerLayout : '', " ").concat(_AlertHeaderNewModule["default"][type]),
|
|
55
55
|
isCover: false,
|
|
56
|
-
wrap: "wrap"
|
|
56
|
+
wrap: "wrap",
|
|
57
|
+
"isdrag-header": "true"
|
|
57
58
|
}, needIcon ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
58
59
|
className: _AlertHeaderNewModule["default"].iconContainer
|
|
59
60
|
}, /*#__PURE__*/_react["default"].createElement(_AlertIcons["default"], {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
border-style: solid;
|
|
9
9
|
border-color: var(--commonalert_border_color);
|
|
10
10
|
border-width: 2px 0 0 0;
|
|
11
|
+
cursor: move;
|
|
11
12
|
}
|
|
12
13
|
.headerLayout {
|
|
13
14
|
min-height: var(--zd_size54);
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
font-family: var(--zd_bold);
|
|
60
61
|
composes: ftsmooth wbreak from '~@zohodesk/components/lib/common/common.module.css';
|
|
61
62
|
vertical-align: middle;
|
|
63
|
+
cursor: default;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
[dir=ltr] .title {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/dot",
|
|
3
|
-
"version": "1.0.0-temp-
|
|
3
|
+
"version": "1.0.0-temp-141",
|
|
4
4
|
"main": "lib/index",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"velocity-react": "1.4.3",
|
|
45
45
|
"@zohodesk/variables": "1.0.0-beta.30",
|
|
46
46
|
"@zohodesk/i18n": "1.0.0-beta.7",
|
|
47
|
-
"@zohodesk/components": "1.0.0-alpha-
|
|
47
|
+
"@zohodesk/components": "1.0.0-alpha-261",
|
|
48
48
|
"@zohodesk/icons": "1.0.0-beta.119",
|
|
49
49
|
"@zohodesk/svg": "1.0.0-beta.54",
|
|
50
50
|
"@zohodesk/virtualizer": "1.0.3",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"velocity-react": "1.4.3",
|
|
56
56
|
"@zohodesk/variables": "1.0.0-beta.30",
|
|
57
57
|
"@zohodesk/i18n": "1.0.0-beta.7",
|
|
58
|
-
"@zohodesk/components": "1.0.0-alpha-
|
|
58
|
+
"@zohodesk/components": "1.0.0-alpha-261",
|
|
59
59
|
"@zohodesk/icons": "1.0.0-beta.119",
|
|
60
60
|
"@zohodesk/svg": "1.0.0-beta.54",
|
|
61
61
|
"@zohodesk/virtualizer": "1.0.3",
|