@zohodesk/dot 1.0.0-beta.262 → 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 +23 -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/layout/SetupDetailLayout/SetupDetailLayout.js +15 -2
- package/es/layout/SetupDetailLayout/props/defaultProps.js +4 -2
- package/es/layout/SetupDetailLayout/props/propTypes.js +9 -2
- 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/layout/SetupDetailLayout/SetupDetailLayout.js +14 -2
- package/lib/layout/SetupDetailLayout/props/defaultProps.js +4 -2
- package/lib/layout/SetupDetailLayout/props/propTypes.js +9 -2
- 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,22 @@
|
|
|
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
|
+
|
|
17
|
+
# 1.0.0-beta.263
|
|
18
|
+
|
|
19
|
+
- **SetupDetailLayout** - i18nKeys added.
|
|
20
|
+
|
|
5
21
|
# 1.0.0-beta.262
|
|
6
22
|
|
|
7
23
|
- **TextEditor** - pre tag css style added.
|
|
@@ -9,6 +25,7 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
9
25
|
# 1.0.0-beta.261
|
|
10
26
|
|
|
11
27
|
- **TextEditor** - pre tag css style reverted.
|
|
28
|
+
|
|
12
29
|
- **FreezeLayer** - useDragger implementation reverted.
|
|
13
30
|
|
|
14
31
|
# 1.0.0-beta.260
|
|
@@ -17,7 +34,8 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
17
34
|
|
|
18
35
|
# 1.0.0-beta.259
|
|
19
36
|
|
|
20
|
-
- **Drag Hook** - useDragger boundary calculation added for custom boundary elements
|
|
37
|
+
- **Drag Hook** - useDragger boundary calculation added for custom boundary elements.
|
|
38
|
+
|
|
21
39
|
- **TagWithIcon** - Contrast issue fix
|
|
22
40
|
|
|
23
41
|
# 1.0.0-beta.258
|
|
@@ -26,9 +44,12 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
26
44
|
|
|
27
45
|
# 1.0.0-beta.257
|
|
28
46
|
|
|
29
|
-
- **Drag Hook** - useDragger hook added
|
|
47
|
+
- **Drag Hook** - useDragger hook added.
|
|
48
|
+
|
|
30
49
|
- **FreezeLayer** - useDragger implemented
|
|
50
|
+
|
|
31
51
|
- **Alert Header** - useDragger based attributes added
|
|
52
|
+
|
|
32
53
|
- **Section** - useDragger based attributes added
|
|
33
54
|
|
|
34
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
|
+
}
|
|
@@ -29,8 +29,12 @@ export default class SetupDetailLayout extends React.Component {
|
|
|
29
29
|
needHelpInfo,
|
|
30
30
|
getHelpInfo,
|
|
31
31
|
helpInfoTitle,
|
|
32
|
-
dataId
|
|
32
|
+
dataId,
|
|
33
|
+
i18nKeys
|
|
33
34
|
} = this.props;
|
|
35
|
+
const {
|
|
36
|
+
closeText = 'Close'
|
|
37
|
+
} = i18nKeys;
|
|
34
38
|
return /*#__PURE__*/React.createElement(Container, {
|
|
35
39
|
isScrollAttribute: true,
|
|
36
40
|
dataId: dataId
|
|
@@ -59,6 +63,7 @@ export default class SetupDetailLayout extends React.Component {
|
|
|
59
63
|
}, helpInfoTitle), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement("span", {
|
|
60
64
|
onClick: this.toggleHelpInfo,
|
|
61
65
|
className: style.infoClose,
|
|
66
|
+
"data-title": closeText,
|
|
62
67
|
"data-id": `${dataId}_close`
|
|
63
68
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
64
69
|
name: "ZD-close"
|
|
@@ -96,8 +101,13 @@ export class SetupHeader extends Component {
|
|
|
96
101
|
rightClassName,
|
|
97
102
|
isCustomizedHeader,
|
|
98
103
|
headerCustomStyle,
|
|
99
|
-
dataId
|
|
104
|
+
dataId,
|
|
105
|
+
i18nKeys
|
|
100
106
|
} = this.props;
|
|
107
|
+
const {
|
|
108
|
+
infoText = 'Help',
|
|
109
|
+
backText = 'Back'
|
|
110
|
+
} = i18nKeys;
|
|
101
111
|
return /*#__PURE__*/React.createElement(Box, {
|
|
102
112
|
className: isCustomizedHeader === true ? headerCustomStyle : style.header,
|
|
103
113
|
dataId: dataId
|
|
@@ -109,6 +119,7 @@ export class SetupHeader extends Component {
|
|
|
109
119
|
}, needBack ? /*#__PURE__*/React.createElement("span", {
|
|
110
120
|
className: style.backIcon,
|
|
111
121
|
onClick: onBackClick,
|
|
122
|
+
"data-title": backText,
|
|
112
123
|
"data-id": `${dataId}_back`
|
|
113
124
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
114
125
|
name: "ZD-back"
|
|
@@ -138,12 +149,14 @@ export class SetupHeader extends Component {
|
|
|
138
149
|
}, /*#__PURE__*/React.createElement("span", {
|
|
139
150
|
className: style.helpInfo,
|
|
140
151
|
onClick: openHelpInfo,
|
|
152
|
+
"data-title": infoText,
|
|
141
153
|
"data-id": `${dataId}_info`
|
|
142
154
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
143
155
|
name: "ZD-info31"
|
|
144
156
|
}))) : /*#__PURE__*/React.createElement("span", {
|
|
145
157
|
className: `${style.helpInfo} ${style.mr15}`,
|
|
146
158
|
onClick: openHelpInfo,
|
|
159
|
+
"data-title": infoText,
|
|
147
160
|
"data-id": `${dataId}_info`
|
|
148
161
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
149
162
|
name: "ZD-info31"
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export const SetupDetailLayout_defaultProps = {
|
|
2
2
|
helpInfoTitle: 'Page Tips',
|
|
3
3
|
needHelpInfo: false,
|
|
4
|
-
dataId: 'SetupDetailLayout'
|
|
4
|
+
dataId: 'SetupDetailLayout',
|
|
5
|
+
i18nKeys: {}
|
|
5
6
|
};
|
|
6
7
|
export const SetupHeader_defaultProps = {
|
|
7
8
|
needBack: false,
|
|
8
9
|
needHelpInfo: false,
|
|
9
10
|
needHelpInfoWrapper: false,
|
|
10
|
-
dataId: 'SetupHeader'
|
|
11
|
+
dataId: 'SetupHeader',
|
|
12
|
+
i18nKeys: {}
|
|
11
13
|
};
|
|
12
14
|
export const SetupContent_defaultProps = {
|
|
13
15
|
needPadding: true,
|
|
@@ -4,7 +4,10 @@ export const SetupDetailLayout_propTypes = {
|
|
|
4
4
|
dataId: PropTypes.string,
|
|
5
5
|
getHelpInfo: PropTypes.func,
|
|
6
6
|
helpInfoTitle: PropTypes.string,
|
|
7
|
-
needHelpInfo: PropTypes.bool
|
|
7
|
+
needHelpInfo: PropTypes.bool,
|
|
8
|
+
i18nKeys: PropTypes.shape({
|
|
9
|
+
closeText: PropTypes.string
|
|
10
|
+
})
|
|
8
11
|
};
|
|
9
12
|
export const SetupHeader_propTypes = {
|
|
10
13
|
dataId: PropTypes.string,
|
|
@@ -19,7 +22,11 @@ export const SetupHeader_propTypes = {
|
|
|
19
22
|
onBackClick: PropTypes.func,
|
|
20
23
|
openHelpInfo: PropTypes.func,
|
|
21
24
|
rightClassName: PropTypes.string,
|
|
22
|
-
title: PropTypes.string
|
|
25
|
+
title: PropTypes.string,
|
|
26
|
+
i18nKeys: PropTypes.shape({
|
|
27
|
+
infoText: PropTypes.string,
|
|
28
|
+
backText: PropTypes.string
|
|
29
|
+
})
|
|
23
30
|
};
|
|
24
31
|
export const SetupContent_propTypes = {
|
|
25
32
|
children: PropTypes.element,
|
|
@@ -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
|
};
|