@aarhus-university/au-lib-react-components 10.1.0 → 10.2.2
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/build/umd/all.css +2 -2
- package/build/umd/all.js +1 -1
- package/build/umd/alphabox.js +1 -1
- package/build/umd/databox.js +1 -1
- package/build/umd/diagramme.js +1 -1
- package/build/umd/flowbox.js +1 -1
- package/build/umd/universe.js +1 -1
- package/package.json +4 -4
- package/src/components/AUAutoSuggestComponent.js +158 -158
- package/src/components/AUTabbedContentComponent.tsx +1 -1
- package/src/components/AUToastComponent.tsx +12 -13
- package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
- package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
- package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
- package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
- package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
- package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
- package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
- package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
- package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
- package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
- package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
- package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
- package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
- package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
- package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
- package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
- package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
- package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
- package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
- package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
- package/src/layout-2016/lib/all.js +3 -3
- package/src/layout-2016/lib/au-alphabox.js +100 -100
- package/src/layout-2016/lib/au-databox.js +400 -400
- package/src/layout-2016/lib/au-diagramme.js +85 -85
- package/src/layout-2016/lib/au-flowbox.js +93 -93
- package/src/layout-2016/lib/universe.js +9 -9
- package/src/lib/helpers.ts +194 -194
- package/tsconfig.json +46 -46
- package/types/common/interfaces/gui.d.ts +2 -1
- package/types/common/interfaces/model.d.ts +29 -29
- package/types/common/props.d.ts +166 -165
- package/webpack.config.js +89 -89
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
-
/* eslint-env browser */
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import AUAutoSuggestComponent from '../../../components/AUAutoSuggestComponent';
|
|
6
|
-
import DataBoxSuggestionComponent from './DataBoxSuggestionComponent';
|
|
7
|
-
|
|
8
|
-
class DataBoxButtonComponent extends React.Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
|
|
12
|
-
this.handleClick = this.handleClick.bind(this);
|
|
13
|
-
this.handleChange = this.handleChange.bind(this);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
handleClick() {
|
|
17
|
-
const { setActive, active, index } = this.props;
|
|
18
|
-
setActive(active ? 0 : index + 1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
handleChange(e) {
|
|
22
|
-
const { value } = e.target;
|
|
23
|
-
const { setSearchValue } = this.props;
|
|
24
|
-
const newHistory = `${[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}?initval=${value}`;
|
|
25
|
-
window.history.replaceState({
|
|
26
|
-
initVal: value,
|
|
27
|
-
}, document.title, newHistory);
|
|
28
|
-
setSearchValue(value);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
render() {
|
|
32
|
-
const {
|
|
33
|
-
button: b,
|
|
34
|
-
index, box,
|
|
35
|
-
active,
|
|
36
|
-
getSuggestions,
|
|
37
|
-
searchValue,
|
|
38
|
-
} = this.props;
|
|
39
|
-
const i = index + 1;
|
|
40
|
-
const bg = box.background;
|
|
41
|
-
|
|
42
|
-
let classNames = `db-button button-${i}`;
|
|
43
|
-
const search = box.search.index === i;
|
|
44
|
-
|
|
45
|
-
if (bg.overlay) {
|
|
46
|
-
classNames += ' overlay';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (search) {
|
|
50
|
-
classNames += ' db-search';
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (active && !search) {
|
|
54
|
-
classNames += ' active';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (search) {
|
|
58
|
-
if (box.search.autocomplete) {
|
|
59
|
-
return (
|
|
60
|
-
<div className={classNames} key={i}>
|
|
61
|
-
<span dangerouslySetInnerHTML={{ __html: b.text }} />
|
|
62
|
-
<AUAutoSuggestComponent
|
|
63
|
-
placeholder={box.search.placeHolder}
|
|
64
|
-
setQuery={() => { }}
|
|
65
|
-
setResults={(items) => {
|
|
66
|
-
if (items.length === 1 && items[0].url) {
|
|
67
|
-
window.location.href = items[0].url;
|
|
68
|
-
}
|
|
69
|
-
}}
|
|
70
|
-
collection={[]}
|
|
71
|
-
getSuggestions={getSuggestions}
|
|
72
|
-
getSuggestionValue={(suggestion) => suggestion.name}
|
|
73
|
-
renderSuggestion={(suggestion) => <DataBoxSuggestionComponent item={suggestion} />}
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
return (
|
|
79
|
-
<div className={classNames} key={i}>
|
|
80
|
-
<span>
|
|
81
|
-
{b.text}
|
|
82
|
-
</span>
|
|
83
|
-
<input type="text" value={searchValue} placeholder={box.search.placeHolder} onChange={this.handleChange} />
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (b.link !== '') {
|
|
89
|
-
return (
|
|
90
|
-
<div
|
|
91
|
-
key={i}
|
|
92
|
-
role="button"
|
|
93
|
-
tabIndex="0"
|
|
94
|
-
onClick={this.handleClick}
|
|
95
|
-
onKeyUp={() => { }}
|
|
96
|
-
className={classNames}
|
|
97
|
-
>
|
|
98
|
-
<span>
|
|
99
|
-
<a href={b.link}>
|
|
100
|
-
{b.text}
|
|
101
|
-
</a>
|
|
102
|
-
</span>
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<div
|
|
109
|
-
key={i}
|
|
110
|
-
role="button"
|
|
111
|
-
tabIndex="0"
|
|
112
|
-
onClick={this.handleClick}
|
|
113
|
-
onKeyUp={() => { }}
|
|
114
|
-
className={classNames}
|
|
115
|
-
>
|
|
116
|
-
<span>
|
|
117
|
-
{b.text}
|
|
118
|
-
</span>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
DataBoxButtonComponent.defaultProps = {
|
|
125
|
-
searchValue: '',
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
DataBoxButtonComponent.propTypes = {
|
|
129
|
-
active: PropTypes.bool.isRequired,
|
|
130
|
-
index: PropTypes.number.isRequired,
|
|
131
|
-
searchValue: PropTypes.string,
|
|
132
|
-
setActive: PropTypes.func.isRequired,
|
|
133
|
-
setSearchValue: PropTypes.func.isRequired,
|
|
134
|
-
button: PropTypes.shape({
|
|
135
|
-
text: PropTypes.string.isRequired,
|
|
136
|
-
link: PropTypes.string.isRequired,
|
|
137
|
-
}).isRequired,
|
|
138
|
-
box: PropTypes.shape({
|
|
139
|
-
background: PropTypes.shape({
|
|
140
|
-
color: PropTypes.string.isRequired,
|
|
141
|
-
linkColor: PropTypes.string.isRequired,
|
|
142
|
-
src: PropTypes.string.isRequired,
|
|
143
|
-
height: PropTypes.number.isRequired,
|
|
144
|
-
text: PropTypes.string.isRequired,
|
|
145
|
-
overlay: PropTypes.bool.isRequired,
|
|
146
|
-
}).isRequired,
|
|
147
|
-
search: PropTypes.shape({
|
|
148
|
-
index: PropTypes.number.isRequired,
|
|
149
|
-
autocomplete: PropTypes.bool.isRequired,
|
|
150
|
-
placeHolder: PropTypes.string.isRequired,
|
|
151
|
-
}).isRequired,
|
|
152
|
-
}).isRequired,
|
|
153
|
-
getSuggestions: PropTypes.func.isRequired,
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
DataBoxButtonComponent.displayName = 'DataBoxButtonComponent';
|
|
157
|
-
export default DataBoxButtonComponent;
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
+
/* eslint-env browser */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import AUAutoSuggestComponent from '../../../components/AUAutoSuggestComponent';
|
|
6
|
+
import DataBoxSuggestionComponent from './DataBoxSuggestionComponent';
|
|
7
|
+
|
|
8
|
+
class DataBoxButtonComponent extends React.Component {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super(props);
|
|
11
|
+
|
|
12
|
+
this.handleClick = this.handleClick.bind(this);
|
|
13
|
+
this.handleChange = this.handleChange.bind(this);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
handleClick() {
|
|
17
|
+
const { setActive, active, index } = this.props;
|
|
18
|
+
setActive(active ? 0 : index + 1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
handleChange(e) {
|
|
22
|
+
const { value } = e.target;
|
|
23
|
+
const { setSearchValue } = this.props;
|
|
24
|
+
const newHistory = `${[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}?initval=${value}`;
|
|
25
|
+
window.history.replaceState({
|
|
26
|
+
initVal: value,
|
|
27
|
+
}, document.title, newHistory);
|
|
28
|
+
setSearchValue(value);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
const {
|
|
33
|
+
button: b,
|
|
34
|
+
index, box,
|
|
35
|
+
active,
|
|
36
|
+
getSuggestions,
|
|
37
|
+
searchValue,
|
|
38
|
+
} = this.props;
|
|
39
|
+
const i = index + 1;
|
|
40
|
+
const bg = box.background;
|
|
41
|
+
|
|
42
|
+
let classNames = `db-button button-${i}`;
|
|
43
|
+
const search = box.search.index === i;
|
|
44
|
+
|
|
45
|
+
if (bg.overlay) {
|
|
46
|
+
classNames += ' overlay';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (search) {
|
|
50
|
+
classNames += ' db-search';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (active && !search) {
|
|
54
|
+
classNames += ' active';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (search) {
|
|
58
|
+
if (box.search.autocomplete) {
|
|
59
|
+
return (
|
|
60
|
+
<div className={classNames} key={i}>
|
|
61
|
+
<span dangerouslySetInnerHTML={{ __html: b.text }} />
|
|
62
|
+
<AUAutoSuggestComponent
|
|
63
|
+
placeholder={box.search.placeHolder}
|
|
64
|
+
setQuery={() => { }}
|
|
65
|
+
setResults={(items) => {
|
|
66
|
+
if (items.length === 1 && items[0].url) {
|
|
67
|
+
window.location.href = items[0].url;
|
|
68
|
+
}
|
|
69
|
+
}}
|
|
70
|
+
collection={[]}
|
|
71
|
+
getSuggestions={getSuggestions}
|
|
72
|
+
getSuggestionValue={(suggestion) => suggestion.name}
|
|
73
|
+
renderSuggestion={(suggestion) => <DataBoxSuggestionComponent item={suggestion} />}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return (
|
|
79
|
+
<div className={classNames} key={i}>
|
|
80
|
+
<span>
|
|
81
|
+
{b.text}
|
|
82
|
+
</span>
|
|
83
|
+
<input type="text" value={searchValue} placeholder={box.search.placeHolder} onChange={this.handleChange} />
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (b.link !== '') {
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
key={i}
|
|
92
|
+
role="button"
|
|
93
|
+
tabIndex="0"
|
|
94
|
+
onClick={this.handleClick}
|
|
95
|
+
onKeyUp={() => { }}
|
|
96
|
+
className={classNames}
|
|
97
|
+
>
|
|
98
|
+
<span>
|
|
99
|
+
<a href={b.link}>
|
|
100
|
+
{b.text}
|
|
101
|
+
</a>
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div
|
|
109
|
+
key={i}
|
|
110
|
+
role="button"
|
|
111
|
+
tabIndex="0"
|
|
112
|
+
onClick={this.handleClick}
|
|
113
|
+
onKeyUp={() => { }}
|
|
114
|
+
className={classNames}
|
|
115
|
+
>
|
|
116
|
+
<span>
|
|
117
|
+
{b.text}
|
|
118
|
+
</span>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
DataBoxButtonComponent.defaultProps = {
|
|
125
|
+
searchValue: '',
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
DataBoxButtonComponent.propTypes = {
|
|
129
|
+
active: PropTypes.bool.isRequired,
|
|
130
|
+
index: PropTypes.number.isRequired,
|
|
131
|
+
searchValue: PropTypes.string,
|
|
132
|
+
setActive: PropTypes.func.isRequired,
|
|
133
|
+
setSearchValue: PropTypes.func.isRequired,
|
|
134
|
+
button: PropTypes.shape({
|
|
135
|
+
text: PropTypes.string.isRequired,
|
|
136
|
+
link: PropTypes.string.isRequired,
|
|
137
|
+
}).isRequired,
|
|
138
|
+
box: PropTypes.shape({
|
|
139
|
+
background: PropTypes.shape({
|
|
140
|
+
color: PropTypes.string.isRequired,
|
|
141
|
+
linkColor: PropTypes.string.isRequired,
|
|
142
|
+
src: PropTypes.string.isRequired,
|
|
143
|
+
height: PropTypes.number.isRequired,
|
|
144
|
+
text: PropTypes.string.isRequired,
|
|
145
|
+
overlay: PropTypes.bool.isRequired,
|
|
146
|
+
}).isRequired,
|
|
147
|
+
search: PropTypes.shape({
|
|
148
|
+
index: PropTypes.number.isRequired,
|
|
149
|
+
autocomplete: PropTypes.bool.isRequired,
|
|
150
|
+
placeHolder: PropTypes.string.isRequired,
|
|
151
|
+
}).isRequired,
|
|
152
|
+
}).isRequired,
|
|
153
|
+
getSuggestions: PropTypes.func.isRequired,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
DataBoxButtonComponent.displayName = 'DataBoxButtonComponent';
|
|
157
|
+
export default DataBoxButtonComponent;
|