@capillarytech/cap-ui-utils 1.4.6-alpha4.0 → 1.4.6-alpha5.0
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/package.json
CHANGED
|
@@ -12,27 +12,52 @@ const ResizablePIP = ({
|
|
|
12
12
|
width = 400,
|
|
13
13
|
height = 260,
|
|
14
14
|
showMaximised = false,
|
|
15
|
-
|
|
15
|
+
handleShowMaximised,
|
|
16
16
|
minConstraints = [400, 260],
|
|
17
17
|
maxConstraints = [1404, 900],
|
|
18
18
|
closePIPContainer = () => {},
|
|
19
19
|
handleOpenInNew = () => {},
|
|
20
|
-
PIPPosition = '
|
|
20
|
+
PIPPosition = '',
|
|
21
21
|
}) => {
|
|
22
22
|
const [pipWidth, setPipWidth] = useState(width);
|
|
23
23
|
const [pipHeight, setPipHeight] = useState(height);
|
|
24
24
|
const handleMaximiseView = () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
if (!showMaximised) {
|
|
26
|
+
setPipWidth(1404);
|
|
27
|
+
setPipHeight(730);
|
|
28
|
+
} else {
|
|
29
|
+
setPipWidth(width);
|
|
30
|
+
setPipHeight(height);
|
|
31
|
+
}
|
|
32
|
+
handleShowMaximised(!showMaximised);
|
|
28
33
|
};
|
|
34
|
+
const positionStyle = {
|
|
35
|
+
position: 'relative',
|
|
36
|
+
}
|
|
37
|
+
switch (PIPPosition) {
|
|
38
|
+
case 'topLeft':
|
|
39
|
+
positionStyle.left = 8;
|
|
40
|
+
positionStyle.top = 8;
|
|
41
|
+
break;
|
|
42
|
+
case 'topRight':
|
|
43
|
+
positionStyle.right = '-70vw';
|
|
44
|
+
positionStyle.top = 8;
|
|
45
|
+
break;
|
|
46
|
+
case 'bottomLeft':
|
|
47
|
+
positionStyle.left = 8;
|
|
48
|
+
positionStyle.bottom = '-33vw';
|
|
49
|
+
break;
|
|
50
|
+
case 'bottomRight':
|
|
51
|
+
positionStyle.right = '-70vw';
|
|
52
|
+
positionStyle.bottom = '-33vw';
|
|
53
|
+
break;
|
|
54
|
+
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
29
58
|
return (
|
|
30
59
|
<div
|
|
31
|
-
style={
|
|
32
|
-
position: "absolute",
|
|
33
|
-
left: 8,
|
|
34
|
-
top: -56,
|
|
35
|
-
}}
|
|
60
|
+
style={positionStyle}
|
|
36
61
|
>
|
|
37
62
|
<Draggable>
|
|
38
63
|
<div
|
|
@@ -52,24 +77,20 @@ const ResizablePIP = ({
|
|
|
52
77
|
>
|
|
53
78
|
<CapRow>
|
|
54
79
|
<CapRow>
|
|
55
|
-
<CapColumn span={
|
|
80
|
+
<CapColumn span={showMaximised ? 2 : 5} offset={showMaximised ? 22 : 19}>
|
|
56
81
|
<CapIcon
|
|
57
82
|
onClick={handleMaximiseView}
|
|
58
|
-
style={{ marginTop:
|
|
83
|
+
style={{ marginTop: 8 }}
|
|
59
84
|
type="help"
|
|
60
85
|
/>
|
|
61
|
-
</CapColumn>
|
|
62
|
-
<CapColumn span={1} offset={1}>
|
|
63
86
|
<CapIcon
|
|
64
87
|
onClick={handleOpenInNew}
|
|
65
|
-
style={{ marginTop:
|
|
88
|
+
style={{ marginTop: 8, marginLeft: 4 }}
|
|
66
89
|
type="open-in-new"
|
|
67
90
|
/>
|
|
68
|
-
</CapColumn>
|
|
69
|
-
<CapColumn span={1} offset={1}>
|
|
70
91
|
<CapIcon
|
|
71
92
|
onClick={closePIPContainer}
|
|
72
|
-
style={{ marginTop:
|
|
93
|
+
style={{ marginTop: 8, marginLeft: 4 }}
|
|
73
94
|
type="close"
|
|
74
95
|
/>
|
|
75
96
|
</CapColumn>
|
|
@@ -108,7 +129,7 @@ ResizablePIP.propTypes = {
|
|
|
108
129
|
maxConstraints: PropTypes.array,
|
|
109
130
|
closePIPContainer: PropTypes.func,
|
|
110
131
|
handleOpenInNew: PropTypes.func,
|
|
111
|
-
|
|
132
|
+
handleShowMaximised: PropTypes.func,
|
|
112
133
|
showMaximised: PropTypes.bool,
|
|
113
134
|
PIPPosition: PropTypes.string,
|
|
114
135
|
};
|
|
@@ -48,7 +48,7 @@ const WithDemoVideosAndLinks = (props) => {
|
|
|
48
48
|
const { children, targetElements, locale = 'en'} = props;
|
|
49
49
|
const [showPIP, setShowPIP] = useState(false);
|
|
50
50
|
const [PIPContentLink, setPIPContentLink] = useState('');
|
|
51
|
-
const [PIPPosition, setPIPPosition] = useState('
|
|
51
|
+
const [PIPPosition, setPIPPosition] = useState('');
|
|
52
52
|
const [showMaximised, setShowMaximised] = useState(false);
|
|
53
53
|
const cssSelectors = [];
|
|
54
54
|
if (Object.keys(targetElements || {})?.length) {
|
|
@@ -71,8 +71,8 @@ const WithDemoVideosAndLinks = (props) => {
|
|
|
71
71
|
let matchedNodes = document.querySelectorAll(selector.cssSelector);
|
|
72
72
|
const handleOnClickVideoLink = () => {
|
|
73
73
|
setPIPContentLink(videoTargetUrl?.[locale]?.href);
|
|
74
|
-
setShowPIP(true);
|
|
75
74
|
setPIPPosition(videoPIPPosition);
|
|
75
|
+
setShowPIP(true);
|
|
76
76
|
};
|
|
77
77
|
const handleOpenSupportLink = () =>
|
|
78
78
|
window.open(linkTargetUrl?.[locale]?.href, '_blank');
|
|
@@ -136,10 +136,13 @@ const WithDemoVideosAndLinks = (props) => {
|
|
|
136
136
|
const handleOpenInNew = () => {
|
|
137
137
|
window.open(PIPContentLink, '_blank');
|
|
138
138
|
};
|
|
139
|
-
const handleShowMaximised =
|
|
140
|
-
setShowMaximised(
|
|
139
|
+
const handleShowMaximised = value => {
|
|
140
|
+
setShowMaximised(value);
|
|
141
141
|
};
|
|
142
|
-
const handleClosePIPContainer = () =>
|
|
142
|
+
const handleClosePIPContainer = () => {
|
|
143
|
+
setShowPIP(false);
|
|
144
|
+
setPIPPosition('');
|
|
145
|
+
}
|
|
143
146
|
|
|
144
147
|
return (
|
|
145
148
|
<div>
|