@zohodesk/dot 1.0.0-beta.263 → 1.0.0-beta.264
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 +19 -2
- package/es/FreezeLayer/FreezeLayer.js +2 -5
- package/es/Hooks/Dragger/props/defaultProps.js +10 -0
- package/es/Hooks/Dragger/props/propTypes.js +11 -0
- package/es/Hooks/Dragger/useDragger.js +93 -66
- package/es/Hooks/Dragger/utils/DraggerUtil.js +3 -42
- package/es/version2/lookup/AlertHeader/AlertHeader.js +75 -58
- package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +20 -0
- package/es/version2/lookup/AlertHeader/props/defaultProps.js +8 -2
- package/es/version2/lookup/AlertHeader/props/propTypes.js +9 -2
- package/lib/FreezeLayer/FreezeLayer.js +2 -8
- package/lib/Hooks/Dragger/props/defaultProps.js +17 -0
- package/lib/Hooks/Dragger/props/propTypes.js +19 -0
- package/lib/Hooks/Dragger/useDragger.js +91 -62
- package/lib/Hooks/Dragger/utils/DraggerUtil.js +3 -44
- package/lib/version2/lookup/AlertHeader/AlertHeader.js +77 -81
- package/lib/version2/lookup/AlertHeader/css/cssJSLogic.js +23 -0
- package/lib/version2/lookup/AlertHeader/props/defaultProps.js +10 -4
- package/lib/version2/lookup/AlertHeader/props/propTypes.js +11 -4
- package/package.json +1 -1
- /package/es/version2/lookup/AlertHeader/{AlertHeaderNew.module.css → css/AlertHeaderNew.module.css} +0 -0
- /package/lib/version2/lookup/AlertHeader/{AlertHeaderNew.module.css → css/AlertHeaderNew.module.css} +0 -0
package/README.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
# 1.0.0-beta.264
|
|
6
|
+
|
|
7
|
+
- **useDragger** - useDragger Hook Fixed.
|
|
8
|
+
|
|
9
|
+
- **FreezeLayer** - `data-dragParent` attribute added.
|
|
10
|
+
|
|
11
|
+
- **AlertHeader**
|
|
12
|
+
|
|
13
|
+
AlertHeader changed to `rfc` and convert to a `ucl` structure.
|
|
14
|
+
|
|
15
|
+
`useDragger` implemented in this component and `dragBoundaryLimit` prop added for drag case.
|
|
16
|
+
|
|
5
17
|
# 1.0.0-beta.263
|
|
6
18
|
|
|
7
19
|
- **SetupDetailLayout** - i18nKeys added.
|
|
@@ -13,6 +25,7 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
13
25
|
# 1.0.0-beta.261
|
|
14
26
|
|
|
15
27
|
- **TextEditor** - pre tag css style reverted.
|
|
28
|
+
|
|
16
29
|
- **FreezeLayer** - useDragger implementation reverted.
|
|
17
30
|
|
|
18
31
|
# 1.0.0-beta.260
|
|
@@ -21,7 +34,8 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
21
34
|
|
|
22
35
|
# 1.0.0-beta.259
|
|
23
36
|
|
|
24
|
-
- **Drag Hook** - useDragger boundary calculation added for custom boundary elements
|
|
37
|
+
- **Drag Hook** - useDragger boundary calculation added for custom boundary elements.
|
|
38
|
+
|
|
25
39
|
- **TagWithIcon** - Contrast issue fix
|
|
26
40
|
|
|
27
41
|
# 1.0.0-beta.258
|
|
@@ -30,9 +44,12 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
30
44
|
|
|
31
45
|
# 1.0.0-beta.257
|
|
32
46
|
|
|
33
|
-
- **Drag Hook** - useDragger hook added
|
|
47
|
+
- **Drag Hook** - useDragger hook added.
|
|
48
|
+
|
|
34
49
|
- **FreezeLayer** - useDragger implemented
|
|
50
|
+
|
|
35
51
|
- **Alert Header** - useDragger based attributes added
|
|
52
|
+
|
|
36
53
|
- **Section** - useDragger based attributes added
|
|
37
54
|
|
|
38
55
|
# 1.0.0-beta.256
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React 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,7 +8,6 @@ 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 '../Hooks/Dragger/useDragger';
|
|
12
11
|
export default function FreezeLayer(props) {
|
|
13
12
|
let {
|
|
14
13
|
isActive: propsActive,
|
|
@@ -25,7 +24,6 @@ export default function FreezeLayer(props) {
|
|
|
25
24
|
customStyle
|
|
26
25
|
} = props;
|
|
27
26
|
const finalStyle = mergeStyle(style, customStyle);
|
|
28
|
-
// const dragRef = useRef(null);
|
|
29
27
|
const {
|
|
30
28
|
freezeClass
|
|
31
29
|
} = cssJSLogic({
|
|
@@ -41,8 +39,6 @@ export default function FreezeLayer(props) {
|
|
|
41
39
|
isActive: propsActive,
|
|
42
40
|
onClick
|
|
43
41
|
});
|
|
44
|
-
// let refEle = forwardRef || dragRef;
|
|
45
|
-
// useDragger({ ParentRef: refEle, boundaryLimit: { top: 0, left: 50, right: 50, bottom: 50 } });
|
|
46
42
|
return /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
|
|
47
43
|
name: animationName && animationName,
|
|
48
44
|
isActive: isActive,
|
|
@@ -53,6 +49,7 @@ export default function FreezeLayer(props) {
|
|
|
53
49
|
} : {},
|
|
54
50
|
className: freezeClass,
|
|
55
51
|
onClick: handleClick,
|
|
52
|
+
"data-dragParent": true,
|
|
56
53
|
ref: forwardRef
|
|
57
54
|
}, children && /*#__PURE__*/React.createElement(React.Fragment, null, childAnimationName ? /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
|
|
58
55
|
name: childAnimationName,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export default {
|
|
3
|
+
isActive: PropTypes.bool,
|
|
4
|
+
childRef: PropTypes.object,
|
|
5
|
+
boundaryLimit: PropTypes.shape({
|
|
6
|
+
top: PropTypes.number,
|
|
7
|
+
left: PropTypes.number,
|
|
8
|
+
right: PropTypes.number,
|
|
9
|
+
bottom: PropTypes.number
|
|
10
|
+
})
|
|
11
|
+
};
|
|
@@ -1,82 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
1
|
+
//Hooks from React
|
|
2
|
+
import { useEffect, useRef, useCallback } from "react";
|
|
3
|
+
//CustomFunction
|
|
4
|
+
import { DragPosCalc } from "./utils/DraggerUtil";
|
|
5
|
+
//GlobalConfig
|
|
6
|
+
import { getDotLibraryConfig } from "../../Provider/Config";
|
|
7
|
+
//Props
|
|
8
|
+
import defaultProps from "./props/defaultProps";
|
|
9
|
+
import propTypes from "./props/propTypes";
|
|
10
|
+
//CSS
|
|
11
|
+
import style from "./css/Dragger.module.css";
|
|
5
12
|
export default function useDragger(_ref) {
|
|
6
13
|
let {
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
isActive,
|
|
15
|
+
ChildRef,
|
|
16
|
+
boundaryLimit = getDotLibraryConfig("boundaryLimit")
|
|
9
17
|
} = _ref;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
const draggableEle = useRef(null);
|
|
19
|
+
const parentEle = useRef(null);
|
|
20
|
+
const offset = useRef({
|
|
13
21
|
x: 0,
|
|
14
22
|
y: 0
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
});
|
|
24
|
+
const draggable = useRef(false);
|
|
18
25
|
useEffect(() => {
|
|
19
|
-
parentEle.current =
|
|
20
|
-
}, [
|
|
21
|
-
|
|
26
|
+
parentEle.current = ChildRef.current.closest("[data-dragParent=true]") || getDotLibraryConfig("draggerBoundary") || document.body;
|
|
27
|
+
}, []); //did Mount
|
|
28
|
+
|
|
29
|
+
//calculateDragPosition --> To sperate Dom action
|
|
30
|
+
const calculateDragPosition = useCallback((x, y) => {
|
|
31
|
+
if (parentEle.current) {
|
|
32
|
+
return DragPosCalc({
|
|
33
|
+
x,
|
|
34
|
+
y,
|
|
35
|
+
dragWrapper: parentEle.current,
|
|
36
|
+
element: draggableEle.current,
|
|
37
|
+
boundaryLimit
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
return {
|
|
41
|
+
x,
|
|
42
|
+
y
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
|
+
const elementDrag = useCallback(e => {
|
|
22
47
|
e = e || window.event;
|
|
23
48
|
e.preventDefault();
|
|
24
49
|
if (draggable.current) {
|
|
25
50
|
const left = offset.current.x + e.clientX;
|
|
26
51
|
const top = offset.current.y + e.clientY;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
boundaryLimit
|
|
34
|
-
});
|
|
35
|
-
draggableEle.current.style.left = calcValue.x + 'px';
|
|
36
|
-
draggableEle.current.style.top = calcValue.y + 'px';
|
|
37
|
-
} else {
|
|
38
|
-
draggableEle.current.style.left = left + 'px';
|
|
39
|
-
draggableEle.current.style.top = top + 'px';
|
|
40
|
-
}
|
|
52
|
+
const {
|
|
53
|
+
x,
|
|
54
|
+
y
|
|
55
|
+
} = calculateDragPosition(left, top);
|
|
56
|
+
draggableEle.current.style.left = x + "px";
|
|
57
|
+
draggableEle.current.style.top = y + "px";
|
|
41
58
|
}
|
|
42
|
-
};
|
|
43
|
-
const closeDragElement = () => {
|
|
44
|
-
document.removeEventListener(
|
|
45
|
-
document.removeEventListener(
|
|
46
|
-
};
|
|
47
|
-
const dragMouseDown = e => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
}, [calculateDragPosition]);
|
|
60
|
+
const closeDragElement = useCallback(() => {
|
|
61
|
+
document.removeEventListener("mouseup", closeDragElement);
|
|
62
|
+
document.removeEventListener("mousemove", elementDrag);
|
|
63
|
+
}, []);
|
|
64
|
+
const dragMouseDown = useCallback(e => {
|
|
65
|
+
e = e || window.event;
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
const draggableEleRect = draggableEle.current.getBoundingClientRect();
|
|
68
|
+
const style = draggableEle.current.style;
|
|
69
|
+
const {
|
|
70
|
+
top,
|
|
71
|
+
left,
|
|
72
|
+
width
|
|
73
|
+
} = draggableEleRect;
|
|
74
|
+
style.top = `${top}px`;
|
|
75
|
+
style.left = `${left}px`;
|
|
76
|
+
style.width = `${width}px`;
|
|
77
|
+
style.position = "fixed";
|
|
78
|
+
offset.current.x = draggableEle.current.offsetLeft - e.clientX;
|
|
79
|
+
offset.current.y = draggableEle.current.offsetTop - e.clientY;
|
|
80
|
+
draggable.current = true;
|
|
81
|
+
document.addEventListener("mouseup", closeDragElement);
|
|
82
|
+
document.addEventListener("mousemove", elementDrag);
|
|
83
|
+
}, []);
|
|
84
|
+
const removeListener = useCallback(draggableEle => {
|
|
85
|
+
let dragController = draggableEle.current.querySelector("[data-drag-hook=true]");
|
|
86
|
+
if (dragController) {
|
|
87
|
+
dragController.removeEventListener("mousedown", dragMouseDown);
|
|
88
|
+
draggableEle.current = null;
|
|
89
|
+
}
|
|
90
|
+
}, []);
|
|
69
91
|
useEffect(() => {
|
|
70
|
-
|
|
71
|
-
draggableEle.current =
|
|
72
|
-
let dragController = draggableEle.current && draggableEle.current.querySelector(
|
|
73
|
-
|
|
74
|
-
// : draggableEle.current;
|
|
75
|
-
dragController && dragController.addEventListener('mousedown', dragMouseDown);
|
|
92
|
+
if (isActive) {
|
|
93
|
+
draggableEle.current = ChildRef.current.closest("[data-drag-container=true]");
|
|
94
|
+
let dragController = draggableEle.current && draggableEle.current.querySelector("[data-drag-hook=true]");
|
|
95
|
+
dragController && dragController.addEventListener("mousedown", dragMouseDown);
|
|
76
96
|
dragController && dragController.classList.add(style.dragCursor);
|
|
77
|
-
}
|
|
78
|
-
|
|
97
|
+
} else {
|
|
98
|
+
removeListener(draggableEle);
|
|
99
|
+
}
|
|
100
|
+
return () => {
|
|
101
|
+
removeListener(draggableEle);
|
|
102
|
+
};
|
|
103
|
+
}, [ChildRef.current, isActive]);
|
|
104
|
+
return null;
|
|
79
105
|
}
|
|
80
106
|
|
|
81
|
-
//
|
|
82
|
-
|
|
107
|
+
//Props
|
|
108
|
+
useDragger.propTypes = propTypes;
|
|
109
|
+
useDragger.defaultProps = defaultProps;
|
|
@@ -6,8 +6,6 @@ export function DragPosCalc(_ref) {
|
|
|
6
6
|
dragWrapper,
|
|
7
7
|
boundaryLimit
|
|
8
8
|
} = _ref;
|
|
9
|
-
//percent = 50%
|
|
10
|
-
// const percentobj = { top: 0, left: 10, right: 2, bottom: 90 };
|
|
11
9
|
let {
|
|
12
10
|
top,
|
|
13
11
|
left,
|
|
@@ -20,47 +18,10 @@ export function DragPosCalc(_ref) {
|
|
|
20
18
|
const leftOffset = left ? offsetWidth - left : 0;
|
|
21
19
|
const rightOffset = right ? offsetWidth - right : 0;
|
|
22
20
|
const bottomOffset = bottom ? offsetHeight - bottom : 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
x = -leftOffset;
|
|
26
|
-
}
|
|
27
|
-
if (x > dragWrapper.offsetWidth - element.offsetWidth + rightOffset) {
|
|
28
|
-
//RIGHT
|
|
29
|
-
x = dragWrapper.offsetWidth - element.offsetWidth + rightOffset;
|
|
30
|
-
}
|
|
31
|
-
if (y < -topOffset) {
|
|
32
|
-
//TOP
|
|
33
|
-
y = -topOffset;
|
|
34
|
-
}
|
|
35
|
-
if (y > dragWrapper.offsetHeight - element.offsetHeight + bottomOffset) {
|
|
36
|
-
//BOTTOM
|
|
37
|
-
y = dragWrapper.offsetHeight - element.offsetHeight + bottomOffset;
|
|
38
|
-
}
|
|
21
|
+
x = Math.max(-leftOffset, Math.min(x, dragWrapper.offsetWidth - element.offsetWidth + rightOffset));
|
|
22
|
+
y = Math.max(-topOffset, Math.min(y, dragWrapper.offsetHeight - element.offsetHeight + bottomOffset));
|
|
39
23
|
return {
|
|
40
24
|
x,
|
|
41
25
|
y
|
|
42
26
|
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// export const elementFinder = async (Parent, selector) => {
|
|
46
|
-
// while (Parent && Parent.querySelector(selector) === null) {
|
|
47
|
-
// await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
48
|
-
// }
|
|
49
|
-
// return Parent && Parent.querySelector(selector);
|
|
50
|
-
// };
|
|
51
|
-
|
|
52
|
-
export const elementFinder = (Parent, selector) => {
|
|
53
|
-
return new Promise(resolve => {
|
|
54
|
-
const observer = new MutationObserver(mutations => {
|
|
55
|
-
const element = Parent.querySelector(selector);
|
|
56
|
-
if (element) {
|
|
57
|
-
observer.disconnect();
|
|
58
|
-
resolve(element);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
observer.observe(Parent, {
|
|
62
|
-
childList: true,
|
|
63
|
-
subtree: true
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
27
|
+
}
|
|
@@ -1,63 +1,80 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
3
|
-
import { propTypes } from './props/propTypes';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
//AlertDependencies
|
|
4
3
|
import { Container, Box } from '@zohodesk/components/lib/Layout';
|
|
5
4
|
import AlertClose from '../../AlertClose/AlertClose';
|
|
6
5
|
import AlertIcons from '../../alertIcons/AlertIcons';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
6
|
+
//CSS
|
|
7
|
+
import style from './css/AlertHeaderNew.module.css';
|
|
8
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
9
|
+
import { mergeStyle } from '@zohodesk/components/es/utils';
|
|
10
|
+
//customHooks
|
|
11
|
+
import useDragger from '../../../Hooks/Dragger/useDragger';
|
|
12
|
+
//Props
|
|
13
|
+
import defaultProps from './props/defaultProps';
|
|
14
|
+
import propTypes from './props/propTypes';
|
|
15
|
+
export default function AlertHeader(props) {
|
|
16
|
+
const {
|
|
17
|
+
title,
|
|
18
|
+
needIcon,
|
|
19
|
+
onClose,
|
|
20
|
+
closeTitle,
|
|
21
|
+
children,
|
|
22
|
+
breakChildren,
|
|
23
|
+
dataId,
|
|
24
|
+
type,
|
|
25
|
+
htmlId,
|
|
26
|
+
customStyle,
|
|
27
|
+
dragBoundaryLimit
|
|
28
|
+
} = props;
|
|
29
|
+
const finalStyle = mergeStyle(style, customStyle);
|
|
30
|
+
const {
|
|
31
|
+
alertHeaderContainerClass
|
|
32
|
+
} = cssJSLogic({
|
|
33
|
+
props,
|
|
34
|
+
style: finalStyle
|
|
35
|
+
});
|
|
36
|
+
const dragRef = useRef(null); //dragRef
|
|
37
|
+
|
|
38
|
+
useDragger({
|
|
39
|
+
isActive: true,
|
|
40
|
+
ChildRef: dragRef,
|
|
41
|
+
boundaryLimit: dragBoundaryLimit
|
|
42
|
+
}); //custom Hook
|
|
43
|
+
|
|
44
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
45
|
+
align: "vertical",
|
|
46
|
+
alignBox: "row",
|
|
47
|
+
className: `${alertHeaderContainerClass}`,
|
|
48
|
+
isCover: false,
|
|
49
|
+
wrap: "wrap",
|
|
50
|
+
"data-drag-hook": "true",
|
|
51
|
+
eleRef: dragRef
|
|
52
|
+
}, needIcon && /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: finalStyle.iconContainer
|
|
54
|
+
}, /*#__PURE__*/React.createElement(AlertIcons, {
|
|
55
|
+
type: type
|
|
56
|
+
})), (title || children) && /*#__PURE__*/React.createElement(Box, {
|
|
57
|
+
flexible: true
|
|
58
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
59
|
+
alignBox: "row",
|
|
60
|
+
wrap: breakChildren ? 'wrap' : null
|
|
61
|
+
}, title && /*#__PURE__*/React.createElement(Box, {
|
|
62
|
+
className: finalStyle.title,
|
|
63
|
+
shrink: true,
|
|
64
|
+
id: htmlId
|
|
65
|
+
}, title), children && /*#__PURE__*/React.createElement(Box, {
|
|
66
|
+
adjust: true,
|
|
67
|
+
flexible: true
|
|
68
|
+
}, children))), onClose && /*#__PURE__*/React.createElement(Box, {
|
|
69
|
+
className: style.close
|
|
70
|
+
}, /*#__PURE__*/React.createElement(AlertClose, {
|
|
71
|
+
onClose: onClose,
|
|
72
|
+
dataTitle: closeTitle,
|
|
73
|
+
dataId: `${dataId}_close`,
|
|
74
|
+
type: "light"
|
|
75
|
+
})));
|
|
54
76
|
}
|
|
55
|
-
AlertHeader.propTypes = propTypes;
|
|
56
|
-
AlertHeader.defaultProps = defaultProps;
|
|
57
77
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// folderName: 'Alert'
|
|
62
|
-
// };
|
|
63
|
-
// }
|
|
78
|
+
//Props
|
|
79
|
+
AlertHeader.propTypes = propTypes;
|
|
80
|
+
AlertHeader.defaultProps = defaultProps;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/components/es/utils';
|
|
2
|
+
export default function cssJSLogic(_ref) {
|
|
3
|
+
let {
|
|
4
|
+
props,
|
|
5
|
+
style
|
|
6
|
+
} = _ref;
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
type,
|
|
10
|
+
title
|
|
11
|
+
} = props;
|
|
12
|
+
let alertHeaderContainerClass = compileClassNames({
|
|
13
|
+
[style.container]: true,
|
|
14
|
+
[style.headerLayout]: !!title || !!children,
|
|
15
|
+
[style[type]]: !!type
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
alertHeaderContainerClass
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
export
|
|
2
|
+
export default {
|
|
3
3
|
breakChildren: PropTypes.bool,
|
|
4
4
|
children: PropTypes.node,
|
|
5
5
|
closeTitle: PropTypes.string,
|
|
@@ -8,5 +8,12 @@ export const propTypes = {
|
|
|
8
8
|
onClose: PropTypes.func,
|
|
9
9
|
title: PropTypes.string,
|
|
10
10
|
type: PropTypes.oneOf(['success', 'error', 'danger', 'warning', 'info', 'notification']),
|
|
11
|
-
htmlId: PropTypes.string
|
|
11
|
+
htmlId: PropTypes.string,
|
|
12
|
+
customStyle: PropTypes.object,
|
|
13
|
+
dragBoundaryLimit: PropTypes.shape({
|
|
14
|
+
top: PropTypes.number,
|
|
15
|
+
left: PropTypes.number,
|
|
16
|
+
right: PropTypes.number,
|
|
17
|
+
bottom: PropTypes.number
|
|
18
|
+
})
|
|
12
19
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports["default"] = FreezeLayer;
|
|
8
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _defaultProps = require("./props/defaultProps");
|
|
10
9
|
var _propTypes = require("./props/propTypes");
|
|
11
10
|
var _Layout = require("@zohodesk/components/lib/Layout");
|
|
@@ -16,9 +15,6 @@ var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
|
16
15
|
var _useFreezeLayer2 = _interopRequireDefault(require("./useFreezeLayer"));
|
|
17
16
|
var _FreezeLayerModule = _interopRequireDefault(require("./css/FreezeLayer.module.css"));
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
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); }
|
|
20
|
-
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; }
|
|
21
|
-
// import useDragger from '../Hooks/Dragger/useDragger';
|
|
22
18
|
function FreezeLayer(props) {
|
|
23
19
|
var propsActive = props.isActive,
|
|
24
20
|
children = props.children,
|
|
@@ -33,7 +29,6 @@ function FreezeLayer(props) {
|
|
|
33
29
|
needAutoZindex = props.needAutoZindex,
|
|
34
30
|
customStyle = props.customStyle;
|
|
35
31
|
var finalStyle = (0, _utils.mergeStyle)(_FreezeLayerModule["default"], customStyle);
|
|
36
|
-
// const dragRef = useRef(null);
|
|
37
32
|
var _cssJSLogic = (0, _cssJSLogic2["default"])({
|
|
38
33
|
props: props,
|
|
39
34
|
style: finalStyle
|
|
@@ -47,8 +42,6 @@ function FreezeLayer(props) {
|
|
|
47
42
|
isActive = _useFreezeLayer.isActive,
|
|
48
43
|
isChildActive = _useFreezeLayer.isChildActive,
|
|
49
44
|
handleClick = _useFreezeLayer.handleClick;
|
|
50
|
-
// let refEle = forwardRef || dragRef;
|
|
51
|
-
// useDragger({ ParentRef: refEle, boundaryLimit: { top: 0, left: 50, right: 50, bottom: 50 } });
|
|
52
45
|
return /*#__PURE__*/_react["default"].createElement(_VelocityAnimationGroup["default"], {
|
|
53
46
|
name: animationName && animationName,
|
|
54
47
|
isActive: isActive,
|
|
@@ -59,6 +52,7 @@ function FreezeLayer(props) {
|
|
|
59
52
|
} : {},
|
|
60
53
|
className: freezeClass,
|
|
61
54
|
onClick: handleClick,
|
|
55
|
+
"data-dragParent": true,
|
|
62
56
|
ref: forwardRef
|
|
63
57
|
}, children && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, childAnimationName ? /*#__PURE__*/_react["default"].createElement(_VelocityAnimationGroup["default"], {
|
|
64
58
|
name: childAnimationName,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
isActive: false,
|
|
9
|
+
childRef: null,
|
|
10
|
+
boundaryLimit: {
|
|
11
|
+
top: 0,
|
|
12
|
+
left: 50,
|
|
13
|
+
right: 50,
|
|
14
|
+
bottom: 50
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
var _default = {
|
|
10
|
+
isActive: _propTypes["default"].bool,
|
|
11
|
+
childRef: _propTypes["default"].object,
|
|
12
|
+
boundaryLimit: _propTypes["default"].shape({
|
|
13
|
+
top: _propTypes["default"].number,
|
|
14
|
+
left: _propTypes["default"].number,
|
|
15
|
+
right: _propTypes["default"].number,
|
|
16
|
+
bottom: _propTypes["default"].number
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
exports["default"] = _default;
|
|
@@ -5,84 +5,113 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = useDragger;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _Config = require("../../Provider/Config");
|
|
9
8
|
var _DraggerUtil = require("./utils/DraggerUtil");
|
|
9
|
+
var _Config = require("../../Provider/Config");
|
|
10
|
+
var _defaultProps = _interopRequireDefault(require("./props/defaultProps"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("./props/propTypes"));
|
|
10
12
|
var _DraggerModule = _interopRequireDefault(require("./css/Dragger.module.css"));
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
+
//Hooks from React
|
|
15
|
+
|
|
16
|
+
//CustomFunction
|
|
17
|
+
|
|
18
|
+
//GlobalConfig
|
|
19
|
+
|
|
20
|
+
//Props
|
|
21
|
+
|
|
22
|
+
//CSS
|
|
23
|
+
|
|
12
24
|
function useDragger(_ref) {
|
|
13
|
-
var
|
|
25
|
+
var isActive = _ref.isActive,
|
|
26
|
+
ChildRef = _ref.ChildRef,
|
|
14
27
|
_ref$boundaryLimit = _ref.boundaryLimit,
|
|
15
|
-
boundaryLimit = _ref$boundaryLimit === void 0 ? (0, _Config.getDotLibraryConfig)(
|
|
16
|
-
var draggableEle = (0, _react.useRef)(null);
|
|
17
|
-
var parentEle = (0, _react.useRef)(null);
|
|
28
|
+
boundaryLimit = _ref$boundaryLimit === void 0 ? (0, _Config.getDotLibraryConfig)("boundaryLimit") : _ref$boundaryLimit;
|
|
29
|
+
var draggableEle = (0, _react.useRef)(null);
|
|
30
|
+
var parentEle = (0, _react.useRef)(null);
|
|
18
31
|
var offset = (0, _react.useRef)({
|
|
19
32
|
x: 0,
|
|
20
33
|
y: 0
|
|
21
|
-
});
|
|
22
|
-
var draggable = (0, _react.useRef)(false);
|
|
23
|
-
|
|
34
|
+
});
|
|
35
|
+
var draggable = (0, _react.useRef)(false);
|
|
24
36
|
(0, _react.useEffect)(function () {
|
|
25
|
-
parentEle.current =
|
|
26
|
-
}, [
|
|
27
|
-
|
|
37
|
+
parentEle.current = ChildRef.current.closest("[data-dragParent=true]") || (0, _Config.getDotLibraryConfig)("draggerBoundary") || document.body;
|
|
38
|
+
}, []); //did Mount
|
|
39
|
+
|
|
40
|
+
//calculateDragPosition --> To sperate Dom action
|
|
41
|
+
var calculateDragPosition = (0, _react.useCallback)(function (x, y) {
|
|
42
|
+
if (parentEle.current) {
|
|
43
|
+
return (0, _DraggerUtil.DragPosCalc)({
|
|
44
|
+
x: x,
|
|
45
|
+
y: y,
|
|
46
|
+
dragWrapper: parentEle.current,
|
|
47
|
+
element: draggableEle.current,
|
|
48
|
+
boundaryLimit: boundaryLimit
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
return {
|
|
52
|
+
x: x,
|
|
53
|
+
y: y
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}, []);
|
|
57
|
+
var elementDrag = (0, _react.useCallback)(function (e) {
|
|
28
58
|
e = e || window.event;
|
|
29
59
|
e.preventDefault();
|
|
30
60
|
if (draggable.current) {
|
|
31
61
|
var left = offset.current.x + e.clientX;
|
|
32
62
|
var top = offset.current.y + e.clientY;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
element: draggableEle.current,
|
|
39
|
-
boundaryLimit: boundaryLimit
|
|
40
|
-
});
|
|
41
|
-
draggableEle.current.style.left = calcValue.x + 'px';
|
|
42
|
-
draggableEle.current.style.top = calcValue.y + 'px';
|
|
43
|
-
} else {
|
|
44
|
-
draggableEle.current.style.left = left + 'px';
|
|
45
|
-
draggableEle.current.style.top = top + 'px';
|
|
46
|
-
}
|
|
63
|
+
var _calculateDragPositio = calculateDragPosition(left, top),
|
|
64
|
+
x = _calculateDragPositio.x,
|
|
65
|
+
y = _calculateDragPositio.y;
|
|
66
|
+
draggableEle.current.style.left = x + "px";
|
|
67
|
+
draggableEle.current.style.top = y + "px";
|
|
47
68
|
}
|
|
48
|
-
};
|
|
49
|
-
var closeDragElement = function
|
|
50
|
-
document.removeEventListener(
|
|
51
|
-
document.removeEventListener(
|
|
52
|
-
};
|
|
53
|
-
var dragMouseDown = function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
}, [calculateDragPosition]);
|
|
70
|
+
var closeDragElement = (0, _react.useCallback)(function () {
|
|
71
|
+
document.removeEventListener("mouseup", closeDragElement);
|
|
72
|
+
document.removeEventListener("mousemove", elementDrag);
|
|
73
|
+
}, []);
|
|
74
|
+
var dragMouseDown = (0, _react.useCallback)(function (e) {
|
|
75
|
+
e = e || window.event;
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
var draggableEleRect = draggableEle.current.getBoundingClientRect();
|
|
78
|
+
var style = draggableEle.current.style;
|
|
79
|
+
var top = draggableEleRect.top,
|
|
80
|
+
left = draggableEleRect.left,
|
|
81
|
+
width = draggableEleRect.width;
|
|
82
|
+
style.top = "".concat(top, "px");
|
|
83
|
+
style.left = "".concat(left, "px");
|
|
84
|
+
style.width = "".concat(width, "px");
|
|
85
|
+
style.position = "fixed";
|
|
86
|
+
offset.current.x = draggableEle.current.offsetLeft - e.clientX;
|
|
87
|
+
offset.current.y = draggableEle.current.offsetTop - e.clientY;
|
|
88
|
+
draggable.current = true;
|
|
89
|
+
document.addEventListener("mouseup", closeDragElement);
|
|
90
|
+
document.addEventListener("mousemove", elementDrag);
|
|
91
|
+
}, []);
|
|
92
|
+
var removeListener = (0, _react.useCallback)(function (draggableEle) {
|
|
93
|
+
var dragController = draggableEle.current.querySelector("[data-drag-hook=true]");
|
|
94
|
+
if (dragController) {
|
|
95
|
+
dragController.removeEventListener("mousedown", dragMouseDown);
|
|
96
|
+
draggableEle.current = null;
|
|
97
|
+
}
|
|
98
|
+
}, []);
|
|
75
99
|
(0, _react.useEffect)(function () {
|
|
76
|
-
|
|
77
|
-
draggableEle.current =
|
|
78
|
-
var dragController = draggableEle.current && draggableEle.current.querySelector(
|
|
79
|
-
|
|
80
|
-
// : draggableEle.current;
|
|
81
|
-
dragController && dragController.addEventListener('mousedown', dragMouseDown);
|
|
100
|
+
if (isActive) {
|
|
101
|
+
draggableEle.current = ChildRef.current.closest("[data-drag-container=true]");
|
|
102
|
+
var dragController = draggableEle.current && draggableEle.current.querySelector("[data-drag-hook=true]");
|
|
103
|
+
dragController && dragController.addEventListener("mousedown", dragMouseDown);
|
|
82
104
|
dragController && dragController.classList.add(_DraggerModule["default"].dragCursor);
|
|
83
|
-
}
|
|
84
|
-
|
|
105
|
+
} else {
|
|
106
|
+
removeListener(draggableEle);
|
|
107
|
+
}
|
|
108
|
+
return function () {
|
|
109
|
+
removeListener(draggableEle);
|
|
110
|
+
};
|
|
111
|
+
}, [ChildRef.current, isActive]);
|
|
112
|
+
return null;
|
|
85
113
|
}
|
|
86
114
|
|
|
87
|
-
//
|
|
88
|
-
|
|
115
|
+
//Props
|
|
116
|
+
useDragger.propTypes = _propTypes["default"];
|
|
117
|
+
useDragger.defaultProps = _defaultProps["default"];
|
|
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DragPosCalc = DragPosCalc;
|
|
7
|
-
exports.elementFinder = void 0;
|
|
8
7
|
function DragPosCalc(_ref) {
|
|
9
8
|
var x = _ref.x,
|
|
10
9
|
y = _ref.y,
|
|
11
10
|
element = _ref.element,
|
|
12
11
|
dragWrapper = _ref.dragWrapper,
|
|
13
12
|
boundaryLimit = _ref.boundaryLimit;
|
|
14
|
-
//percent = 50%
|
|
15
|
-
// const percentobj = { top: 0, left: 10, right: 2, bottom: 90 };
|
|
16
13
|
var top = boundaryLimit.top,
|
|
17
14
|
left = boundaryLimit.left,
|
|
18
15
|
right = boundaryLimit.right,
|
|
@@ -23,48 +20,10 @@ function DragPosCalc(_ref) {
|
|
|
23
20
|
var leftOffset = left ? offsetWidth - left : 0;
|
|
24
21
|
var rightOffset = right ? offsetWidth - right : 0;
|
|
25
22
|
var bottomOffset = bottom ? offsetHeight - bottom : 0;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
x = -leftOffset;
|
|
29
|
-
}
|
|
30
|
-
if (x > dragWrapper.offsetWidth - element.offsetWidth + rightOffset) {
|
|
31
|
-
//RIGHT
|
|
32
|
-
x = dragWrapper.offsetWidth - element.offsetWidth + rightOffset;
|
|
33
|
-
}
|
|
34
|
-
if (y < -topOffset) {
|
|
35
|
-
//TOP
|
|
36
|
-
y = -topOffset;
|
|
37
|
-
}
|
|
38
|
-
if (y > dragWrapper.offsetHeight - element.offsetHeight + bottomOffset) {
|
|
39
|
-
//BOTTOM
|
|
40
|
-
y = dragWrapper.offsetHeight - element.offsetHeight + bottomOffset;
|
|
41
|
-
}
|
|
23
|
+
x = Math.max(-leftOffset, Math.min(x, dragWrapper.offsetWidth - element.offsetWidth + rightOffset));
|
|
24
|
+
y = Math.max(-topOffset, Math.min(y, dragWrapper.offsetHeight - element.offsetHeight + bottomOffset));
|
|
42
25
|
return {
|
|
43
26
|
x: x,
|
|
44
27
|
y: y
|
|
45
28
|
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// export const elementFinder = async (Parent, selector) => {
|
|
49
|
-
// while (Parent && Parent.querySelector(selector) === null) {
|
|
50
|
-
// await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
51
|
-
// }
|
|
52
|
-
// return Parent && Parent.querySelector(selector);
|
|
53
|
-
// };
|
|
54
|
-
|
|
55
|
-
var elementFinder = function elementFinder(Parent, selector) {
|
|
56
|
-
return new Promise(function (resolve) {
|
|
57
|
-
var observer = new MutationObserver(function (mutations) {
|
|
58
|
-
var element = Parent.querySelector(selector);
|
|
59
|
-
if (element) {
|
|
60
|
-
observer.disconnect();
|
|
61
|
-
resolve(element);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
observer.observe(Parent, {
|
|
65
|
-
childList: true,
|
|
66
|
-
subtree: true
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
exports.elementFinder = elementFinder;
|
|
29
|
+
}
|
|
@@ -4,92 +4,88 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports["default"] =
|
|
7
|
+
exports["default"] = AlertHeader;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _defaultProps = require("./props/defaultProps");
|
|
10
|
-
var _propTypes = require("./props/propTypes");
|
|
11
9
|
var _Layout = require("@zohodesk/components/lib/Layout");
|
|
12
10
|
var _AlertClose = _interopRequireDefault(require("../../AlertClose/AlertClose"));
|
|
13
11
|
var _AlertIcons = _interopRequireDefault(require("../../alertIcons/AlertIcons"));
|
|
14
|
-
var _AlertHeaderNewModule = _interopRequireDefault(require("./AlertHeaderNew.module.css"));
|
|
12
|
+
var _AlertHeaderNewModule = _interopRequireDefault(require("./css/AlertHeaderNew.module.css"));
|
|
13
|
+
var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
14
|
+
var _utils = require("@zohodesk/components/es/utils");
|
|
15
|
+
var _useDragger = _interopRequireDefault(require("../../../Hooks/Dragger/useDragger"));
|
|
16
|
+
var _defaultProps = _interopRequireDefault(require("./props/defaultProps"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("./props/propTypes"));
|
|
15
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
19
|
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); }
|
|
17
20
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
}(_react.Component);
|
|
86
|
-
exports["default"] = AlertHeader;
|
|
87
|
-
AlertHeader.propTypes = _propTypes.propTypes;
|
|
88
|
-
AlertHeader.defaultProps = _defaultProps.defaultProps;
|
|
21
|
+
//AlertDependencies
|
|
22
|
+
|
|
23
|
+
//CSS
|
|
24
|
+
|
|
25
|
+
//customHooks
|
|
26
|
+
|
|
27
|
+
//Props
|
|
28
|
+
|
|
29
|
+
function AlertHeader(props) {
|
|
30
|
+
var title = props.title,
|
|
31
|
+
needIcon = props.needIcon,
|
|
32
|
+
onClose = props.onClose,
|
|
33
|
+
closeTitle = props.closeTitle,
|
|
34
|
+
children = props.children,
|
|
35
|
+
breakChildren = props.breakChildren,
|
|
36
|
+
dataId = props.dataId,
|
|
37
|
+
type = props.type,
|
|
38
|
+
htmlId = props.htmlId,
|
|
39
|
+
customStyle = props.customStyle,
|
|
40
|
+
dragBoundaryLimit = props.dragBoundaryLimit;
|
|
41
|
+
var finalStyle = (0, _utils.mergeStyle)(_AlertHeaderNewModule["default"], customStyle);
|
|
42
|
+
var _cssJSLogic = (0, _cssJSLogic2["default"])({
|
|
43
|
+
props: props,
|
|
44
|
+
style: finalStyle
|
|
45
|
+
}),
|
|
46
|
+
alertHeaderContainerClass = _cssJSLogic.alertHeaderContainerClass;
|
|
47
|
+
var dragRef = (0, _react.useRef)(null); //dragRef
|
|
48
|
+
|
|
49
|
+
(0, _useDragger["default"])({
|
|
50
|
+
isActive: true,
|
|
51
|
+
ChildRef: dragRef,
|
|
52
|
+
boundaryLimit: dragBoundaryLimit
|
|
53
|
+
}); //custom Hook
|
|
54
|
+
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
56
|
+
align: "vertical",
|
|
57
|
+
alignBox: "row",
|
|
58
|
+
className: "".concat(alertHeaderContainerClass),
|
|
59
|
+
isCover: false,
|
|
60
|
+
wrap: "wrap",
|
|
61
|
+
"data-drag-hook": "true",
|
|
62
|
+
eleRef: dragRef
|
|
63
|
+
}, needIcon && /*#__PURE__*/_react["default"].createElement("div", {
|
|
64
|
+
className: finalStyle.iconContainer
|
|
65
|
+
}, /*#__PURE__*/_react["default"].createElement(_AlertIcons["default"], {
|
|
66
|
+
type: type
|
|
67
|
+
})), (title || children) && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
68
|
+
flexible: true
|
|
69
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
70
|
+
alignBox: "row",
|
|
71
|
+
wrap: breakChildren ? 'wrap' : null
|
|
72
|
+
}, title && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
73
|
+
className: finalStyle.title,
|
|
74
|
+
shrink: true,
|
|
75
|
+
id: htmlId
|
|
76
|
+
}, title), children && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
77
|
+
adjust: true,
|
|
78
|
+
flexible: true
|
|
79
|
+
}, children))), onClose && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
80
|
+
className: _AlertHeaderNewModule["default"].close
|
|
81
|
+
}, /*#__PURE__*/_react["default"].createElement(_AlertClose["default"], {
|
|
82
|
+
onClose: onClose,
|
|
83
|
+
dataTitle: closeTitle,
|
|
84
|
+
dataId: "".concat(dataId, "_close"),
|
|
85
|
+
type: "light"
|
|
86
|
+
})));
|
|
87
|
+
}
|
|
89
88
|
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// folderName: 'Alert'
|
|
94
|
-
// };
|
|
95
|
-
// }
|
|
89
|
+
//Props
|
|
90
|
+
AlertHeader.propTypes = _propTypes["default"];
|
|
91
|
+
AlertHeader.defaultProps = _defaultProps["default"];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = cssJSLogic;
|
|
7
|
+
var _utils = require("@zohodesk/components/es/utils");
|
|
8
|
+
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); }
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
|
+
function cssJSLogic(_ref) {
|
|
13
|
+
var _compileClassNames;
|
|
14
|
+
var props = _ref.props,
|
|
15
|
+
style = _ref.style;
|
|
16
|
+
var children = props.children,
|
|
17
|
+
type = props.type,
|
|
18
|
+
title = props.title;
|
|
19
|
+
var alertHeaderContainerClass = (0, _utils.compileClassNames)((_compileClassNames = {}, _defineProperty(_compileClassNames, style.container, true), _defineProperty(_compileClassNames, style.headerLayout, !!title || !!children), _defineProperty(_compileClassNames, style[type], !!type), _compileClassNames));
|
|
20
|
+
return {
|
|
21
|
+
alertHeaderContainerClass: alertHeaderContainerClass
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
8
|
needIcon: true,
|
|
9
9
|
type: 'danger',
|
|
10
10
|
breakChildren: false,
|
|
11
|
-
dataId: 'alertHeader'
|
|
11
|
+
dataId: 'alertHeader',
|
|
12
|
+
dragBoundaryLimit: {
|
|
13
|
+
top: 0,
|
|
14
|
+
left: 50,
|
|
15
|
+
right: 50,
|
|
16
|
+
bottom: 50
|
|
17
|
+
}
|
|
12
18
|
};
|
|
13
|
-
exports
|
|
19
|
+
exports["default"] = _default;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
-
var
|
|
9
|
+
var _default = {
|
|
10
10
|
breakChildren: _propTypes["default"].bool,
|
|
11
11
|
children: _propTypes["default"].node,
|
|
12
12
|
closeTitle: _propTypes["default"].string,
|
|
@@ -15,6 +15,13 @@ var propTypes = {
|
|
|
15
15
|
onClose: _propTypes["default"].func,
|
|
16
16
|
title: _propTypes["default"].string,
|
|
17
17
|
type: _propTypes["default"].oneOf(['success', 'error', 'danger', 'warning', 'info', 'notification']),
|
|
18
|
-
htmlId: _propTypes["default"].string
|
|
18
|
+
htmlId: _propTypes["default"].string,
|
|
19
|
+
customStyle: _propTypes["default"].object,
|
|
20
|
+
dragBoundaryLimit: _propTypes["default"].shape({
|
|
21
|
+
top: _propTypes["default"].number,
|
|
22
|
+
left: _propTypes["default"].number,
|
|
23
|
+
right: _propTypes["default"].number,
|
|
24
|
+
bottom: _propTypes["default"].number
|
|
25
|
+
})
|
|
19
26
|
};
|
|
20
|
-
exports
|
|
27
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
/package/es/version2/lookup/AlertHeader/{AlertHeaderNew.module.css → css/AlertHeaderNew.module.css}
RENAMED
|
File without changes
|
/package/lib/version2/lookup/AlertHeader/{AlertHeaderNew.module.css → css/AlertHeaderNew.module.css}
RENAMED
|
File without changes
|