orc-shared 5.10.1-dev.7 → 5.10.1-dev.9
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/dist/components/Authenticate.js +41 -17
- package/dist/components/ErrorPlaceholder.js +8 -24
- package/dist/components/{Icon.js → Form/Inputs/MultiSelector.js} +33 -20
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/LoadingIcon.js +6 -16
- package/dist/components/MaterialUI/Inputs/Select.js +10 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +115 -56
- package/dist/components/Scope/ScopeNode.js +68 -45
- package/dist/components/Sidepanel.js +57 -23
- package/dist/components/Spritesheet.js +33 -17
- package/dist/components/Text.js +1 -60
- package/dist/components/Treeview/Branch.js +82 -20
- package/dist/components/Treeview/Label.js +108 -31
- package/dist/components/Treeview/Leaf.js +56 -12
- package/dist/components/Treeview/Node.js +22 -9
- package/dist/components/Treeview/index.js +7 -1
- package/dist/components/Treeview/settings.js +7 -5
- package/dist/utils/index.js +0 -4
- package/dist/utils/testUtils.js +1 -12
- package/package.json +1 -1
- package/src/components/ApplicationModuleLoader.test.js +14 -27
- package/src/components/Authenticate.js +29 -21
- package/src/components/Authenticate.test.js +18 -27
- package/src/components/ErrorPlaceholder.js +4 -21
- package/src/components/ErrorPlaceholder.test.js +7 -14
- package/src/components/Form/InputField.test.js +2 -1
- package/src/components/Form/Inputs/MultiSelector.js +23 -0
- package/src/components/Form/Inputs/MultiSelector.test.js +112 -0
- package/src/components/Form/Inputs/index.js +1 -1
- package/src/components/Loader.test.js +21 -33
- package/src/components/LoadingIcon.js +2 -15
- package/src/components/LoadingIcon.test.js +2 -20
- package/src/components/MaterialUI/DataDisplay/Table.test.js +1 -1
- package/src/components/MaterialUI/Inputs/Select.js +7 -0
- package/src/components/MaterialUI/Inputs/Select.test.js +45 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
- package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
- package/src/components/Navigation/Navigation.test.js +0 -5
- package/src/components/Navigation/useNavigationState.test.js +79 -222
- package/src/components/Provision.js +36 -42
- package/src/components/Provision.test.js +10 -26
- package/src/components/Routing/SegmentPage.js +68 -52
- package/src/components/Routing/SegmentPage.test.js +4 -12
- package/src/components/Scope/ScopeNode.js +61 -54
- package/src/components/Scope/ScopeNode.test.js +61 -154
- package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
- package/src/components/Sidepanel.js +38 -32
- package/src/components/Sidepanel.test.js +49 -27
- package/src/components/Spritesheet.js +23 -21
- package/src/components/Spritesheet.test.js +10 -10
- package/src/components/Text.js +0 -49
- package/src/components/Treeview/Branch.js +63 -45
- package/src/components/Treeview/Branch.test.js +21 -24
- package/src/components/Treeview/Label.js +66 -52
- package/src/components/Treeview/Label.test.js +42 -60
- package/src/components/Treeview/Leaf.js +41 -22
- package/src/components/Treeview/Leaf.test.js +15 -10
- package/src/components/Treeview/Node.js +16 -9
- package/src/components/Treeview/Node.test.js +269 -200
- package/src/components/Treeview/Treeview.test.js +248 -248
- package/src/components/Treeview/index.js +6 -0
- package/src/components/Treeview/settings.js +7 -6
- package/src/utils/index.js +0 -4
- package/src/utils/testUtils.js +0 -10
- package/src/utils/testUtils.test.js +0 -68
- package/dist/components/Button.js +0 -70
- package/dist/components/Checkbox.js +0 -103
- package/dist/components/IconButton.js +0 -80
- package/dist/components/Input.js +0 -101
- package/dist/components/Modal/Background.js +0 -55
- package/dist/components/Modal/Dialog.js +0 -75
- package/dist/components/Modal/Wrapper.js +0 -69
- package/dist/components/Modal/index.js +0 -86
- package/dist/components/MultiSelector.js +0 -187
- package/dist/components/Navigation/Bar.js +0 -293
- package/dist/components/Navigation/Tab.js +0 -182
- package/dist/components/Placeholder.js +0 -114
- package/dist/components/Scope/Selector.js +0 -123
- package/dist/components/Selector.js +0 -185
- package/dist/components/Switch.js +0 -128
- package/dist/components/Toolbar.js +0 -227
- package/dist/components/Tooltip.js +0 -66
- package/dist/getTheme.js +0 -153
- package/dist/getThemeOverrides.js +0 -93
- package/dist/hocs/withAuthentication.js +0 -72
- package/dist/utils/styledPropFuncs.js +0 -88
- package/src/components/Button.js +0 -90
- package/src/components/Button.test.js +0 -49
- package/src/components/Checkbox.js +0 -63
- package/src/components/Checkbox.test.js +0 -122
- package/src/components/Icon.js +0 -18
- package/src/components/IconButton.js +0 -30
- package/src/components/IconButton.test.js +0 -61
- package/src/components/Input.js +0 -35
- package/src/components/Input.test.js +0 -34
- package/src/components/Modal/Background.js +0 -10
- package/src/components/Modal/Dialog.js +0 -27
- package/src/components/Modal/Dialog.test.js +0 -20
- package/src/components/Modal/Modal.test.js +0 -52
- package/src/components/Modal/Wrapper.js +0 -32
- package/src/components/Modal/Wrapper.test.js +0 -55
- package/src/components/Modal/index.js +0 -22
- package/src/components/MultiSelector.js +0 -104
- package/src/components/MultiSelector.test.js +0 -348
- package/src/components/Navigation/Bar.js +0 -212
- package/src/components/Navigation/Bar.test.js +0 -552
- package/src/components/Navigation/Tab.js +0 -156
- package/src/components/Navigation/Tab.test.js +0 -404
- package/src/components/Placeholder.js +0 -61
- package/src/components/Placeholder.test.js +0 -106
- package/src/components/Scope/Selector.js +0 -70
- package/src/components/Scope/Selector.test.js +0 -138
- package/src/components/Selector.js +0 -191
- package/src/components/Selector.test.js +0 -157
- package/src/components/Switch.js +0 -112
- package/src/components/Switch.test.js +0 -130
- package/src/components/Text.test.js +0 -132
- package/src/components/Toolbar.js +0 -178
- package/src/components/Toolbar.test.js +0 -478
- package/src/components/Tooltip.js +0 -51
- package/src/components/Tooltip.test.js +0 -21
- package/src/getTheme.js +0 -98
- package/src/getTheme.test.js +0 -92
- package/src/getThemeOverrides.js +0 -27
- package/src/hocs/withAuthentication.js +0 -18
- package/src/hocs/withAuthentication.test.js +0 -120
- package/src/utils/styledPropFuncs.js +0 -20
- package/src/utils/styledPropFuncs.test.js +0 -166
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { useHistory } from "react-router-dom";
|
|
4
|
-
import { ifFlag, getThemeProp, safeGet } from "../../utils";
|
|
5
|
-
import DropMenu from "../DropMenu";
|
|
6
|
-
import IconButton from "../IconButton";
|
|
7
|
-
import Tab from "./Tab";
|
|
8
|
-
|
|
9
|
-
export const TabBar = styled.div`
|
|
10
|
-
flex: 0 0 10px;
|
|
11
|
-
max-height: 0px;
|
|
12
|
-
padding: 0 0 0 10px;
|
|
13
|
-
margin: 0 200px 0 0;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: flex-end;
|
|
16
|
-
width: calc(100% - 210px);
|
|
17
|
-
font-family: ${getThemeProp(["fonts", "header"], "sans-serif")};
|
|
18
|
-
font-size: 13px;
|
|
19
|
-
text-transform: uppercase;
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
export const InnerBar = styled.div`
|
|
23
|
-
position: relative;
|
|
24
|
-
flex: 0 1 100%;
|
|
25
|
-
margin-left: -10px;
|
|
26
|
-
padding-left: 10px;
|
|
27
|
-
z-index: 0;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
min-width: 0;
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
height: 50px;
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: flex-end;
|
|
34
|
-
scroll-behavior: smooth;
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const Fade = styled.div`
|
|
38
|
-
position: absolute;
|
|
39
|
-
left: 0;
|
|
40
|
-
bottom: 11px;
|
|
41
|
-
height: 38px;
|
|
42
|
-
width: 10px;
|
|
43
|
-
z-index: 1;
|
|
44
|
-
background-color: red;
|
|
45
|
-
box-shadow: 0px 0 5px 5px #fff;
|
|
46
|
-
clip-path: polygon(-10px 0, -10px 100%, 30px 100%, 30px 0);
|
|
47
|
-
visibility: ${ifFlag("scroll", "visible", "hidden")};
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
export const ScrollableBar = React.forwardRef(({ children }, ref) => {
|
|
51
|
-
return (
|
|
52
|
-
<>
|
|
53
|
-
<Fade scroll={0} />
|
|
54
|
-
<InnerBar id="navigationPageTabs" ref={ref}>
|
|
55
|
-
{children}
|
|
56
|
-
</InnerBar>
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const getTabEdges = (pages, tabRefs) => {
|
|
62
|
-
let lastWidth = 0;
|
|
63
|
-
return pages.map(({ href }) => {
|
|
64
|
-
const tabWidth = safeGet(tabRefs, href, "offsetWidth") || 0;
|
|
65
|
-
lastWidth += tabWidth;
|
|
66
|
-
return lastWidth;
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const useTabScroll = (pages, debug = false, refs) => {
|
|
71
|
-
let barRef = useRef(null);
|
|
72
|
-
let tabRefs = useRef({});
|
|
73
|
-
if (debug) {
|
|
74
|
-
barRef = refs.barRef;
|
|
75
|
-
tabRefs = refs.tabRefs;
|
|
76
|
-
}
|
|
77
|
-
const [barWidth, setBarWidth] = useState(0);
|
|
78
|
-
const [tabEdges, setTabEdges] = useState([]);
|
|
79
|
-
const setWidthOfBar = useCallback(() => {
|
|
80
|
-
setBarWidth(safeGet(barRef, "current", "offsetWidth") || 0);
|
|
81
|
-
}, [barRef, setBarWidth]);
|
|
82
|
-
const setEdgesOfTabs = useCallback(() => {
|
|
83
|
-
setTabEdges(getTabEdges(pages, tabRefs.current));
|
|
84
|
-
}, [pages, tabRefs, setTabEdges]);
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
setWidthOfBar();
|
|
87
|
-
window.addEventListener("resize", setWidthOfBar);
|
|
88
|
-
return () => window.removeEventListener("resize", setWidthOfBar);
|
|
89
|
-
}, [pages, setWidthOfBar]);
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
setEdgesOfTabs(pages);
|
|
92
|
-
window.addEventListener("resize", setEdgesOfTabs);
|
|
93
|
-
return () => window.removeEventListener("resize", setEdgesOfTabs);
|
|
94
|
-
}, [pages, setEdgesOfTabs]);
|
|
95
|
-
|
|
96
|
-
const lastActiveIndex = useRef(-1);
|
|
97
|
-
let activeIndex = pages.findIndex(page => page.active);
|
|
98
|
-
if (activeIndex === -1) {
|
|
99
|
-
activeIndex = lastActiveIndex.current;
|
|
100
|
-
} else {
|
|
101
|
-
lastActiveIndex.current = activeIndex;
|
|
102
|
-
}
|
|
103
|
-
const [lastShownTab, setLastShown] = useState(pages.length);
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
const barElem = barRef.current;
|
|
106
|
-
/* istanbul ignore if */
|
|
107
|
-
if (!barElem) return;
|
|
108
|
-
const activeEdge = tabEdges[activeIndex + 1] || tabEdges[activeIndex] || 0;
|
|
109
|
-
let scrollEdge = Math.max(activeEdge - barWidth + 7, 0);
|
|
110
|
-
barElem.scrollLeft = scrollEdge;
|
|
111
|
-
const edgeIndex = tabEdges.findIndex(edge => edge > barWidth + barElem.scrollLeft - 10) - 1;
|
|
112
|
-
if (tabEdges[tabEdges.length - 1] <= barWidth) {
|
|
113
|
-
setLastShown(pages.length);
|
|
114
|
-
} else if (edgeIndex > activeIndex) {
|
|
115
|
-
setLastShown(edgeIndex);
|
|
116
|
-
} else {
|
|
117
|
-
setLastShown(activeIndex + 1);
|
|
118
|
-
}
|
|
119
|
-
}, [setLastShown, pages, barRef, barWidth, tabEdges, activeIndex]);
|
|
120
|
-
const history = useHistory();
|
|
121
|
-
return {
|
|
122
|
-
...(debug ? { barWidth, tabEdges } : {}),
|
|
123
|
-
hiddenTabs: barWidth < tabEdges[tabEdges.length - 1],
|
|
124
|
-
lastShownTab,
|
|
125
|
-
tabMenuItems: pages.map(({ label, href }) => ({
|
|
126
|
-
id: href,
|
|
127
|
-
label,
|
|
128
|
-
handler: () => {
|
|
129
|
-
history.push(href);
|
|
130
|
-
},
|
|
131
|
-
})),
|
|
132
|
-
getTabRef: useCallback(
|
|
133
|
-
node => {
|
|
134
|
-
/* istanbul ignore else */
|
|
135
|
-
if (node) {
|
|
136
|
-
const href = safeGet(node, "dataset", "href");
|
|
137
|
-
tabRefs.current[href] = node;
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
[tabRefs],
|
|
141
|
-
),
|
|
142
|
-
getBarRef: useCallback(
|
|
143
|
-
node => {
|
|
144
|
-
/* istanbul ignore else */
|
|
145
|
-
if (node && node !== barRef.current) {
|
|
146
|
-
barRef.current = node;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
[barRef],
|
|
150
|
-
),
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export const StyledMenu = styled(DropMenu).attrs(() => ({ alignRight: true }))`
|
|
155
|
-
position: absolute;
|
|
156
|
-
top: 10px;
|
|
157
|
-
right: 140px;
|
|
158
|
-
text-transform: none;
|
|
159
|
-
`;
|
|
160
|
-
|
|
161
|
-
export const MenuButton = styled(IconButton).attrs(props => ({
|
|
162
|
-
icon: ifFlag(
|
|
163
|
-
"open",
|
|
164
|
-
getThemeProp(["icons", "indicators", "more"], "arrow-more"),
|
|
165
|
-
getThemeProp(["icons", "indicators", "more"], "arrow-more"),
|
|
166
|
-
)(props),
|
|
167
|
-
}))``;
|
|
168
|
-
|
|
169
|
-
const Bar = ({ module, pages }) => {
|
|
170
|
-
const { hiddenTabs, tabMenuItems, lastShownTab, getTabRef, getBarRef } = useTabScroll(pages);
|
|
171
|
-
return (
|
|
172
|
-
<TabBar>
|
|
173
|
-
<Tab
|
|
174
|
-
module
|
|
175
|
-
icon={module.icon}
|
|
176
|
-
href={module.href}
|
|
177
|
-
mappedFrom={module.mappedFrom}
|
|
178
|
-
label={module.label}
|
|
179
|
-
active={module.active}
|
|
180
|
-
/>
|
|
181
|
-
<ScrollableBar ref={getBarRef}>
|
|
182
|
-
{pages.map(
|
|
183
|
-
({ href, mappedFrom, label, mustTruncate, active, icon, outsideScope, scopeNotSupported, close }, index) => {
|
|
184
|
-
return (
|
|
185
|
-
<Tab
|
|
186
|
-
ref={getTabRef}
|
|
187
|
-
key={href}
|
|
188
|
-
icon={icon}
|
|
189
|
-
href={href}
|
|
190
|
-
mappedFrom={mappedFrom}
|
|
191
|
-
label={label}
|
|
192
|
-
mustTruncate={mustTruncate}
|
|
193
|
-
active={active}
|
|
194
|
-
close={close}
|
|
195
|
-
outsideScope={outsideScope}
|
|
196
|
-
scopeNotSupported={scopeNotSupported}
|
|
197
|
-
hide={index > lastShownTab}
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
},
|
|
201
|
-
)}
|
|
202
|
-
</ScrollableBar>
|
|
203
|
-
{hiddenTabs ? (
|
|
204
|
-
<StyledMenu id="navigationTabs" menuItems={tabMenuItems}>
|
|
205
|
-
<MenuButton />
|
|
206
|
-
</StyledMenu>
|
|
207
|
-
) : null}
|
|
208
|
-
</TabBar>
|
|
209
|
-
);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export default Bar;
|