@aarhus-university/au-lib-react-components 8.20.0 → 8.80.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/.eslintrc.js +44 -0
- package/README.md +19 -20
- package/babel.config.js +7 -0
- package/build/umd/all.css +1 -2
- package/build/umd/all.css.map +1 -1
- package/build/umd/all.js +1 -1
- package/build/umd/all.js.map +1 -1
- package/build/umd/alphabox.js +1 -1
- package/build/umd/alphabox.js.map +1 -1
- package/build/umd/databox.js +1 -6
- package/build/umd/databox.js.map +1 -1
- package/build/umd/diagramme.js +1 -1
- package/build/umd/diagramme.js.map +1 -1
- package/build/umd/flowbox.js +1 -1
- package/build/umd/flowbox.js.map +1 -1
- package/build/umd/universe.js +1 -1
- package/build/umd/universe.js.map +1 -1
- package/package.json +66 -65
- package/src/components/AUAlertComponent.tsx +70 -0
- package/src/components/{AutoSuggestComponent.js → AUAutoSuggestComponent.js} +45 -19
- package/src/components/AUCalendarComponent.tsx +493 -0
- package/src/components/AUContentToggleComponent.tsx +33 -0
- package/src/components/AUDatepickerComponent.tsx +117 -0
- package/src/components/AUMobilePrefixComponent.tsx +15 -0
- package/src/components/{delphinus/AUModalComponent.js → AUModalComponent.tsx} +78 -76
- package/src/components/{form/AUReceiptComponent.js → AUReceiptComponent.tsx} +33 -40
- package/src/components/AUSpinnerComponent.tsx +64 -0
- package/src/components/{delphinus/AUSubNavComponent.js → AUSubNavComponent.tsx} +38 -53
- package/src/components/{form/AUSubmitButtonContainerComponent.js → AUSubmitButtonContainerComponent.tsx} +31 -39
- package/src/components/AUTabbedContentComponent.tsx +145 -0
- package/src/components/{delphinus/AUTableComponent.js → AUTableComponent.tsx} +24 -28
- package/src/components/{delphinus/AUToastComponent.js → AUToastComponent.tsx} +104 -91
- package/src/components/{delphinus/AUToolbarComponent.js → AUToolbarComponent.tsx} +45 -48
- package/src/components/profile/AUProfileActions.js +128 -113
- package/src/components/profile/AUProfileAvatarComponent.js +83 -83
- package/src/components/profile/AUProfileAvatarV2Component.js +91 -0
- package/src/components/profile/AUProfileAvatarV3Component.js +80 -0
- package/src/components/profile/AUProfileContainerComponent.js +283 -285
- package/src/components/profile/AUProfileHooks.js +30 -30
- package/src/components/profile/AUProfileItemComponent.js +54 -54
- package/src/components/profile/AUProfileLanguageComponent.js +131 -131
- package/src/components/profile/AUProfileLoginComponent.js +0 -2
- package/src/components/profile/AUProfileMailComponent.js +307 -299
- package/src/components/profile/AUProfileMobileComponent.js +164 -164
- package/src/components/profile/AUProfileNameComponent.js +253 -253
- package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
- package/src/components/profile/AUProfileReducer.js +230 -210
- package/src/components/profile/AUProfileWidgetComponent.js +95 -95
- package/src/components/profile/AUProfileWidgetV2Component.js +116 -0
- package/src/components/profile/AUProfileWidgetV3Component.js +130 -0
- package/src/components/wrapping/AUEmbedComponent.js +47 -47
- package/src/{components → layout-2016/components}/alphabox/AlphaBoxComponent.js +29 -28
- package/src/{components → layout-2016/components}/alphabox/AlphaBoxContentComponent.js +25 -14
- package/src/{components → layout-2016/components/common}/AUCollapsibleComponent.js +1 -22
- package/src/{components → layout-2016/components/common}/AUSpinnerComponent.js +2 -24
- package/src/{components → layout-2016/components}/databox/DataBoxAlphabetComponent.js +1 -1
- package/src/{components → layout-2016/components}/databox/DataBoxAssociationComponent.js +2 -2
- package/src/{components → layout-2016/components}/databox/DataBoxButtonComponent.js +7 -3
- package/src/{components → layout-2016/components}/databox/DataBoxComponent.js +2 -2
- package/src/{components → layout-2016/components}/databox/DataBoxGroupingComponent.js +2 -0
- package/src/{components → layout-2016/components}/databox/DataBoxSearchResultComponent.js +1 -5
- package/src/{components → layout-2016/components}/databox/DataBoxStackedAssociationComponent.js +1 -5
- package/src/{components → layout-2016/components}/databox/DataBoxSuggestionComponent.js +0 -0
- package/src/{components → layout-2016/components/diagramme}/AUDiagrammeComponent.js +5 -6
- package/src/{components → layout-2016/components}/flowbox/FlowBoxComponent.js +8 -8
- package/src/{components → layout-2016/components}/flowbox/FlowBoxPhoneComponent.js +3 -5
- package/src/{components → layout-2016/components}/profile/AUProfileAvatar2016Component.js +6 -2
- package/src/{components → layout-2016/components}/universe/StaffTopComponent.js +4 -3
- package/src/{components → layout-2016/components}/universe/StudentTopComponent.js +0 -0
- package/src/{components → layout-2016/components}/universe/UniverseContainerComponent.js +11 -8
- package/src/layout-2016/lib/all.js +3 -0
- package/src/{lib → layout-2016/lib}/au-alphabox.js +1 -3
- package/src/{lib → layout-2016/lib}/au-databox.js +6 -9
- package/src/{lib → layout-2016/lib}/au-diagramme.js +2 -4
- package/src/{lib → layout-2016/lib}/au-flowbox.js +1 -3
- package/src/{lib → layout-2016/lib}/universe.js +0 -0
- package/src/lib/{helpers.js → helpers.ts} +40 -66
- package/src/lib/hooks.ts +33 -0
- package/src/lib/{i18n.js → i18n.ts} +600 -595
- package/src/lib/tracking.ts +69 -0
- package/src/lib/{wrapping.js → wrapping.ts} +21 -16
- package/src/styles/_settings.scss +11 -11
- package/src/styles/alphabox.scss +222 -209
- package/src/styles/app.scss +7 -12
- package/src/styles/autosuggest.scss +57 -57
- package/src/styles/databox.scss +563 -563
- package/src/styles/diagramme.scss +119 -119
- package/src/styles/flowbox.scss +72 -72
- package/src/styles/maps.scss +396 -0
- package/tsconfig.json +47 -0
- package/types/common/interfaces.d.ts +64 -0
- package/types/common/main.d.ts +4 -0
- package/types/common/package.json +5 -0
- package/types/common/payloads.d.ts +0 -0
- package/types/common/props.d.ts +138 -0
- package/webpack.config.js +89 -0
- package/.eslintrc +0 -19
- package/DOCUMENTATION.md +0 -369
- package/build/cjs/auAuth.js +0 -2
- package/build/cjs/auAuth.js.map +0 -1
- package/build/dev.html +0 -329
- package/build/umd/auAuth.js +0 -2
- package/build/umd/auAuth.js.map +0 -1
- package/build/umd/news.js +0 -2
- package/build/umd/news.js.map +0 -1
- package/src/all.js +0 -3
- package/src/app.js +0 -263
- package/src/components/AUAlertComponent.js +0 -158
- package/src/components/AUAmountComponent.js +0 -84
- package/src/components/AUBannerComponent.js +0 -99
- package/src/components/AUCalendarComponent.js +0 -393
- package/src/components/AUDatepickerComponent.js +0 -105
- package/src/components/AUFilterCheckboxComponent.js +0 -122
- package/src/components/AUFocusComponent.js +0 -55
- package/src/components/AUModalComponent.js +0 -94
- package/src/components/AUPaginationComponent.js +0 -103
- package/src/components/context/AUUserContextComponent.js +0 -91
- package/src/components/context/ImpersonateComponent.js +0 -54
- package/src/components/delphinus/AUCalendarComponent.js +0 -422
- package/src/components/delphinus/AUContentToggleComponent.js +0 -32
- package/src/components/delphinus/AUDatepickerComponent.js +0 -113
- package/src/components/delphinus/AULoginComponent.js +0 -65
- package/src/components/delphinus/AUSpinnerComponent.js +0 -114
- package/src/components/delphinus/AUTabbedContentComponent.js +0 -53
- package/src/components/delphinus/hooks.js +0 -25
- package/src/components/form/AUMobilePrefixComponent.js +0 -18
- package/src/components/news/EventLayout1Component.js +0 -94
- package/src/components/news/EventLayout2Component.js +0 -90
- package/src/components/news/EventLayout3Component.js +0 -68
- package/src/components/news/NewsCategoriesComponent.js +0 -21
- package/src/components/news/NewsCollageBannerComponent.js +0 -71
- package/src/components/news/NewsColumnsComponent.js +0 -125
- package/src/components/news/NewsLanguageChangeComponent.js +0 -74
- package/src/components/news/NewsLayout1Component.js +0 -80
- package/src/components/news/NewsLayout2Component.js +0 -80
- package/src/components/news/NewsLayout3Component.js +0 -81
- package/src/components/news/NewsLayout4Component.js +0 -80
- package/src/components/news/NewsLayout5Component.js +0 -61
- package/src/components/news/NewsLayout6Component.js +0 -55
- package/src/components/news/NewsLayout7Component.js +0 -58
- package/src/components/news/NewsLayout8Component.js +0 -57
- package/src/components/news/NewsListComponent.js +0 -291
- package/src/components/news/NewsPopUpComponent.js +0 -591
- package/src/components/news/NewsRSSComponent.js +0 -74
- package/src/components/news/NewsSocialComponent.js +0 -104
- package/src/components/news/NewsSubHeaderComponent.js +0 -19
- package/src/components/password/AUChangePasswordComponent.js +0 -177
- package/src/components/password/AUCurrentPasswordComponent.js +0 -72
- package/src/components/password/AUNewPasswordComponent.js +0 -143
- package/src/components/password/AUPasswordActions.js +0 -101
- package/src/components/password/AUPasswordHooks.js +0 -47
- package/src/components/password/AUPasswordReducer.js +0 -78
- package/src/components/password/AUPasswordRequirementsComponent.js +0 -29
- package/src/config/webpack.cjs.config.js +0 -75
- package/src/config/webpack.dev.config.js +0 -61
- package/src/config/webpack.umd.config.js +0 -107
- package/src/index.js +0 -6
- package/src/lib/au-auth.js +0 -221
- package/src/lib/au-news.js +0 -306
- package/src/lib/menu.js +0 -10
- package/src/lib/urlHandler.js +0 -63
- package/src/lib/validation.js +0 -181
- package/src/styles/alert.scss +0 -39
- package/src/styles/calendar.scss +0 -112
- package/src/styles/filtercheckbox.scss +0 -5
- package/src/styles/modal.scss +0 -35
- package/src/styles/pagination.scss +0 -11
- package/src/styles/spinner.scss +0 -30
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
|
+
const ESLintPlugin = require('eslint-webpack-plugin');
|
|
4
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
5
|
+
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
// https://github.com/webpack/webpack/issues/4453
|
|
9
|
+
|
|
10
|
+
const entries = {
|
|
11
|
+
all: './src/layout-2016/lib/all',
|
|
12
|
+
alphabox: './src/layout-2016/lib/au-alphabox',
|
|
13
|
+
databox: './src/layout-2016/lib/au-databox',
|
|
14
|
+
diagramme: './src/layout-2016/lib/au-diagramme',
|
|
15
|
+
flowbox: './src/layout-2016/lib/au-flowbox',
|
|
16
|
+
universe: './src/layout-2016/lib/universe',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
module.exports = Object.entries(entries).map((entry) => ({
|
|
20
|
+
mode: 'production',
|
|
21
|
+
devtool: 'source-map',
|
|
22
|
+
entry: {
|
|
23
|
+
[entry[0]]: entry[1],
|
|
24
|
+
},
|
|
25
|
+
output: {
|
|
26
|
+
path: path.resolve(__dirname, './build/umd'),
|
|
27
|
+
filename: '[name].js',
|
|
28
|
+
libraryTarget: 'umd', // https://webpack.js.org/configuration/output/#output-librarytarget
|
|
29
|
+
},
|
|
30
|
+
plugins: [
|
|
31
|
+
new ESLintPlugin({
|
|
32
|
+
fix: true,
|
|
33
|
+
}),
|
|
34
|
+
new MiniCssExtractPlugin({
|
|
35
|
+
filename: 'all.css',
|
|
36
|
+
chunkFilename: '[id].css',
|
|
37
|
+
}),
|
|
38
|
+
new ForkTsCheckerWebpackPlugin(),
|
|
39
|
+
],
|
|
40
|
+
resolve: {
|
|
41
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
42
|
+
},
|
|
43
|
+
module: {
|
|
44
|
+
rules: [
|
|
45
|
+
{
|
|
46
|
+
test: /\.(ts|js)x?$/,
|
|
47
|
+
include: path.resolve(__dirname, '.'),
|
|
48
|
+
exclude: /(node_modules)/,
|
|
49
|
+
use: {
|
|
50
|
+
loader: 'babel-loader',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
test: /\.js$/,
|
|
55
|
+
include: path.resolve(__dirname, './node_modules/@aarhus-university/au-designsystem-delphinus/source'),
|
|
56
|
+
use: {
|
|
57
|
+
loader: 'babel-loader',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
test: /\.scss/,
|
|
62
|
+
include: path.resolve(__dirname, './src/styles'),
|
|
63
|
+
sideEffects: true,
|
|
64
|
+
use: [
|
|
65
|
+
MiniCssExtractPlugin.loader,
|
|
66
|
+
{ loader: 'css-loader' },
|
|
67
|
+
{ loader: 'sass-loader' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
externals: {
|
|
73
|
+
moment: 'moment',
|
|
74
|
+
react: {
|
|
75
|
+
root: 'React',
|
|
76
|
+
commonjs2: 'react',
|
|
77
|
+
commonjs: 'react',
|
|
78
|
+
amd: 'react',
|
|
79
|
+
umd: 'react',
|
|
80
|
+
},
|
|
81
|
+
'react-dom': {
|
|
82
|
+
root: 'ReactDOM',
|
|
83
|
+
commonjs2: 'react-dom',
|
|
84
|
+
commonjs: 'react-dom',
|
|
85
|
+
amd: 'react-dom',
|
|
86
|
+
umd: 'react-dom',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
}));
|
package/.eslintrc
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "airbnb",
|
|
3
|
-
"plugins": [
|
|
4
|
-
"react"
|
|
5
|
-
],
|
|
6
|
-
"parser": "babel-eslint",
|
|
7
|
-
"rules": {
|
|
8
|
-
"react/jsx-filename-extension": [0],
|
|
9
|
-
"react/no-did-mount-set-state": [0],
|
|
10
|
-
"import/no-cycle": [0],
|
|
11
|
-
"react/no-danger": [0]
|
|
12
|
-
},
|
|
13
|
-
"globals": {
|
|
14
|
-
"google": true,
|
|
15
|
-
"$": true,
|
|
16
|
-
"AU": true,
|
|
17
|
-
"Msal": true
|
|
18
|
-
}
|
|
19
|
-
}
|
package/DOCUMENTATION.md
DELETED
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
Components
|
|
2
|
-
----------
|
|
3
|
-
|
|
4
|
-
**src/components/AUAlertComponent.js**
|
|
5
|
-
|
|
6
|
-
### 1. AUAlertComponent
|
|
7
|
-
|
|
8
|
-
AU Alert Komponent
|
|
9
|
-
Bliver brugt til elementer der kræver bekræftelse eller advarsel
|
|
10
|
-
|
|
11
|
-
Eksempel:
|
|
12
|
-
```jsx
|
|
13
|
-
<AUAlertComponent
|
|
14
|
-
alert={this.state.alert}
|
|
15
|
-
message="Er du sikker?"
|
|
16
|
-
onConfirm={() => {
|
|
17
|
-
this.setState({
|
|
18
|
-
alert: false,
|
|
19
|
-
});
|
|
20
|
-
}}
|
|
21
|
-
onCancel={() => {
|
|
22
|
-
this.setState({
|
|
23
|
-
alert: false,
|
|
24
|
-
});
|
|
25
|
-
}}
|
|
26
|
-
>
|
|
27
|
-
<button
|
|
28
|
-
className="button"
|
|
29
|
-
onClick={() => {
|
|
30
|
-
this.setState({
|
|
31
|
-
alert: true,
|
|
32
|
-
});
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
Alert!
|
|
36
|
-
</button>
|
|
37
|
-
</AUAlertComponent>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Property | Type | Required | Default value | Description
|
|
44
|
-
:--- | :--- | :--- | :--- | :---
|
|
45
|
-
message|string|yes||Beskeden der vises i popup
|
|
46
|
-
alert|bool|yes||True når beskeden skal vises
|
|
47
|
-
children|element|no|null|Det element der trigger beskeden
|
|
48
|
-
content|element|no|null|Det samme som children
|
|
49
|
-
classNames|string|no|<See the source code>|Hvis der skal tilføjes ekstra klasser til alert-komponentet
|
|
50
|
-
onConfirm|func|no|null|Kaldes ved confirm
|
|
51
|
-
onCancel|func|no|null|Kaldes ved cancel
|
|
52
|
-
-----
|
|
53
|
-
**src/components/AUBannerComponent.js**
|
|
54
|
-
|
|
55
|
-
### 1. AUBannerComponent
|
|
56
|
-
|
|
57
|
-
AU Banner Komponent
|
|
58
|
-
|
|
59
|
-
Eksempel:
|
|
60
|
-
```jsx
|
|
61
|
-
<AUBannerComponent
|
|
62
|
-
url="http://ps.au.dk/uddannelser"
|
|
63
|
-
header="Bachelor- og kandidatuddannelser"
|
|
64
|
-
text="Læs mere om, hvilke uddannelser vi udbyder på Institut for Statskundskab"
|
|
65
|
-
image="http://ps.au.dk/uploads/tx_gridelements/Bacheloruddannelse_04.jpg"
|
|
66
|
-
classNames="hastext aubanner-2"
|
|
67
|
-
/>
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Property | Type | Required | Default value | Description
|
|
74
|
-
:--- | :--- | :--- | :--- | :---
|
|
75
|
-
header|string|no|<See the source code>|
|
|
76
|
-
text|string|no|<See the source code>|
|
|
77
|
-
image|string|no|null|
|
|
78
|
-
url|string|no|<See the source code>|
|
|
79
|
-
classNames|string|no|<See the source code>|
|
|
80
|
-
-----
|
|
81
|
-
**src/components/AUCalendarComponent.js**
|
|
82
|
-
|
|
83
|
-
### 1. AUCalendarComponent
|
|
84
|
-
|
|
85
|
-
AU Kalender Komponent
|
|
86
|
-
|
|
87
|
-
Eksempel:
|
|
88
|
-
```jsx
|
|
89
|
-
<AUCalendarComponent />
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Property | Type | Required | Default value | Description
|
|
96
|
-
:--- | :--- | :--- | :--- | :---
|
|
97
|
-
date|instanceOf|no|<See the source code>|
|
|
98
|
-
-----
|
|
99
|
-
**src/components/AUCollapsibleComponent.js**
|
|
100
|
-
|
|
101
|
-
### 1. AUCollapsibleComponent
|
|
102
|
-
|
|
103
|
-
AU Kollapserbart Komponent
|
|
104
|
-
|
|
105
|
-
Eksempel:
|
|
106
|
-
```jsx
|
|
107
|
-
<AUCollapsibleComponent
|
|
108
|
-
key="collapse"
|
|
109
|
-
collapsed
|
|
110
|
-
header="Collapsible element"
|
|
111
|
-
level={2}
|
|
112
|
-
className="hide-for-small-only"
|
|
113
|
-
onClick={(collapsed, node) => {
|
|
114
|
-
this.setState({
|
|
115
|
-
spinnerVisible: !collapsed,
|
|
116
|
-
});
|
|
117
|
-
}}
|
|
118
|
-
>
|
|
119
|
-
<h1>Test</h1>
|
|
120
|
-
</AUCollapsibleComponent>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Property | Type | Required | Default value | Description
|
|
127
|
-
:--- | :--- | :--- | :--- | :---
|
|
128
|
-
dataID|string|no|null|
|
|
129
|
-
children|element|no|null|
|
|
130
|
-
collapsed|bool|yes||
|
|
131
|
-
header|string|no|<See the source code>|
|
|
132
|
-
level|number|no|1|
|
|
133
|
-
content|element|no|null|
|
|
134
|
-
classNames|string|no|<See the source code>|
|
|
135
|
-
onClick|func|no|<See the source code>|
|
|
136
|
-
-----
|
|
137
|
-
**src/components/AUFocusComponent.js**
|
|
138
|
-
|
|
139
|
-
### 1. AUFocusComponent
|
|
140
|
-
|
|
141
|
-
AU Focus Komponent
|
|
142
|
-
|
|
143
|
-
Eksempel:
|
|
144
|
-
```jsx
|
|
145
|
-
<AUFocusComponent
|
|
146
|
-
key="focus"
|
|
147
|
-
header={<h1>Fokusfelt</h1>}
|
|
148
|
-
text={<p>Noget tekst</p>}
|
|
149
|
-
links={<ul><li style={{ backgroundColor: 'rgba(0, 61, 133, .75)' }}><a href="http://www.au.dk">Link</a></li></ul>}
|
|
150
|
-
style={{
|
|
151
|
-
backgroundImage: 'url(http://ps.au.dk/uploads/tx_templavoila/BSS_Foto_outdoor-51_fokusfelt_72ppi_04.jpg)',
|
|
152
|
-
height: '270px',
|
|
153
|
-
}}
|
|
154
|
-
/>
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
Property | Type | Required | Default value | Description
|
|
161
|
-
:--- | :--- | :--- | :--- | :---
|
|
162
|
-
header|element|no|null|
|
|
163
|
-
text|element|no|null|
|
|
164
|
-
style|shape|yes||
|
|
165
|
-
links|element|no|null|
|
|
166
|
-
-----
|
|
167
|
-
**src/components/AUModalComponent.js**
|
|
168
|
-
|
|
169
|
-
### 1. AUModalComponent
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
Property | Type | Required | Default value | Description
|
|
175
|
-
:--- | :--- | :--- | :--- | :---
|
|
176
|
-
show|bool|yes||True når modalen skal vises
|
|
177
|
-
children|element|no|null|Det element der trigger beskeden
|
|
178
|
-
content|element|no|null|Det samme som children
|
|
179
|
-
classNames|string|no|<See the source code>|Hvis der skal tilføjes ekstra klasser til alert-komponentet
|
|
180
|
-
onClose|func|no|null|Kaldes ved luk
|
|
181
|
-
-----
|
|
182
|
-
**src/components/AUSpinnerComponent.js**
|
|
183
|
-
|
|
184
|
-
### 1. AUSpinnerComponent
|
|
185
|
-
|
|
186
|
-
AU Spinner Komponent
|
|
187
|
-
Bliver brugt til lazy-loading af elementer, der først skal indlæses når de er synlige.
|
|
188
|
-
|
|
189
|
-
Eksempel:
|
|
190
|
-
```jsx
|
|
191
|
-
<AUSpinnerComponent
|
|
192
|
-
domID={spinnerID}
|
|
193
|
-
visible={this.state.spinnerVisible}
|
|
194
|
-
columns="large-12 medium-12 small-12"
|
|
195
|
-
content={<h1>Hej</h1>}
|
|
196
|
-
loaded={this.state.spinnerLoaded}
|
|
197
|
-
loadingCondition
|
|
198
|
-
onLoad={() => {
|
|
199
|
-
setTimeout(() => {
|
|
200
|
-
this.setState({
|
|
201
|
-
spinnerLoaded: true,
|
|
202
|
-
});
|
|
203
|
-
}, 2000);
|
|
204
|
-
}}
|
|
205
|
-
/>
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Property | Type | Required | Default value | Description
|
|
212
|
-
:--- | :--- | :--- | :--- | :---
|
|
213
|
-
domID|string|no|<See the source code>|Relevant ved mere end en spinner per side
|
|
214
|
-
visible|bool|no|false|Om den er synlig på skærmen ved indlæsning
|
|
215
|
-
columns|string|no|<See the source code>|
|
|
216
|
-
content|element|no|null|
|
|
217
|
-
children|element|no|null|
|
|
218
|
-
loaded|bool|yes||
|
|
219
|
-
loadingCondition|bool|yes||
|
|
220
|
-
onLoad|func|no|<See the source code>|
|
|
221
|
-
-----
|
|
222
|
-
**src/components/AutoSuggestComponent.js**
|
|
223
|
-
|
|
224
|
-
### 1. AutoSuggestComponent
|
|
225
|
-
|
|
226
|
-
AU AutoSuggest Komponent
|
|
227
|
-
|
|
228
|
-
Eksempel:
|
|
229
|
-
```jsx
|
|
230
|
-
<AutoSuggestComponent
|
|
231
|
-
placeholder={this.props.box.search.placeHolder}
|
|
232
|
-
setQuery={() => { }}
|
|
233
|
-
setResults={(items) => {
|
|
234
|
-
if (items.length === 1 && items[0].url) {
|
|
235
|
-
window.location.href = items[0].url;
|
|
236
|
-
}
|
|
237
|
-
}}
|
|
238
|
-
collection={[]}
|
|
239
|
-
getSuggestions={this.props.getSuggestions}
|
|
240
|
-
getSuggestionValue={suggestion => suggestion.name}
|
|
241
|
-
renderSuggestion={suggestion => <DataBoxSuggestionComponent item={suggestion} />}
|
|
242
|
-
/>
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
Property | Type | Required | Default value | Description
|
|
249
|
-
:--- | :--- | :--- | :--- | :---
|
|
250
|
-
setQuery|func|yes||
|
|
251
|
-
getSuggestions|func|yes||
|
|
252
|
-
getSuggestionValue|func|yes||
|
|
253
|
-
renderSuggestion|func|yes||
|
|
254
|
-
setResults|func|yes||
|
|
255
|
-
collection|arrayOf|yes||
|
|
256
|
-
placeholder|string|yes||
|
|
257
|
-
-----
|
|
258
|
-
**src/components/databox/DataBoxAlphabetComponent.js**
|
|
259
|
-
|
|
260
|
-
### 1. DataBoxAlphabetComponent
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
Property | Type | Required | Default value | Description
|
|
266
|
-
:--- | :--- | :--- | :--- | :---
|
|
267
|
-
initLetter|string|yes||
|
|
268
|
-
items|arrayOf|yes||
|
|
269
|
-
linkColor|string|yes||
|
|
270
|
-
rememberState|bool|yes||
|
|
271
|
-
boxID|number|yes||
|
|
272
|
-
-----
|
|
273
|
-
**src/components/databox/DataBoxAssociationComponent.js**
|
|
274
|
-
|
|
275
|
-
### 1. DataBoxAssociationComponent
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
Property | Type | Required | Default value | Description
|
|
281
|
-
:--- | :--- | :--- | :--- | :---
|
|
282
|
-
boxID|number|yes||
|
|
283
|
-
grouping|number|yes||
|
|
284
|
-
assoc|shape|yes||
|
|
285
|
-
index|number|yes||
|
|
286
|
-
open|bool|yes||
|
|
287
|
-
rememberState|bool|yes||
|
|
288
|
-
-----
|
|
289
|
-
**src/components/databox/DataBoxButtonComponent.js**
|
|
290
|
-
|
|
291
|
-
### 1. DataBoxButtonComponent
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
Property | Type | Required | Default value | Description
|
|
297
|
-
:--- | :--- | :--- | :--- | :---
|
|
298
|
-
active|bool|yes||
|
|
299
|
-
index|number|yes||
|
|
300
|
-
searchValue|string|no|<See the source code>|
|
|
301
|
-
setActive|func|yes||
|
|
302
|
-
setSearchValue|func|yes||
|
|
303
|
-
button|shape|yes||
|
|
304
|
-
box|shape|yes||
|
|
305
|
-
getSuggestions|func|yes||
|
|
306
|
-
-----
|
|
307
|
-
**src/components/databox/DataBoxComponent.js**
|
|
308
|
-
|
|
309
|
-
### 1. DataBoxComponent
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
Property | Type | Required | Default value | Description
|
|
315
|
-
:--- | :--- | :--- | :--- | :---
|
|
316
|
-
box|shape|yes||
|
|
317
|
-
parse|func|yes||
|
|
318
|
-
-----
|
|
319
|
-
**src/components/databox/DataBoxGroupingComponent.js**
|
|
320
|
-
|
|
321
|
-
### 1. DataBoxGroupingComponent
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
Property | Type | Required | Default value | Description
|
|
327
|
-
:--- | :--- | :--- | :--- | :---
|
|
328
|
-
boxID|number|yes||
|
|
329
|
-
stacked|bool|yes||
|
|
330
|
-
expand|bool|yes||
|
|
331
|
-
rememberState|bool|yes||
|
|
332
|
-
grouping|shape|yes||
|
|
333
|
-
-----
|
|
334
|
-
**src/components/databox/DataBoxSearchResultComponent.js**
|
|
335
|
-
|
|
336
|
-
### 1. DataBoxSearchResultComponent
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
Property | Type | Required | Default value | Description
|
|
342
|
-
:--- | :--- | :--- | :--- | :---
|
|
343
|
-
items|shape|yes||
|
|
344
|
-
searchValue|string|yes||
|
|
345
|
-
-----
|
|
346
|
-
**src/components/databox/DataBoxStackedAssociationComponent.js**
|
|
347
|
-
|
|
348
|
-
### 1. DataBoxStackedAssociationComponent
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
Property | Type | Required | Default value | Description
|
|
354
|
-
:--- | :--- | :--- | :--- | :---
|
|
355
|
-
assoc|shape|yes||
|
|
356
|
-
-----
|
|
357
|
-
**src/components/databox/DataBoxSuggestionComponent.js**
|
|
358
|
-
|
|
359
|
-
### 1. DataBoxSuggestionComponent
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
Property | Type | Required | Default value | Description
|
|
365
|
-
:--- | :--- | :--- | :--- | :---
|
|
366
|
-
item|shape|yes||
|
|
367
|
-
-----
|
|
368
|
-
|
|
369
|
-
<sub>This document was generated by the <a href="https://github.com/marborkowski/react-doc-generator" target="_blank">**React DOC Generator v1.2.5**</a>.</sub>
|
package/build/cjs/auAuth.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function o(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t){window.auAuth=new class{constructor(){var e,t,o;o=void 0,(t="config")in(e=this)?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,this.config={auth:{clientId:"ff2a564d-47a4-4596-aa44-95e5d38f3029",authority:"https://login.microsoftonline.com/AarhusUniversitet.onmicrosoft.com",redirectUri:"https://auuserauthtest.azurewebsites.net",navigateToLoginRequestUrl:!0,postLogoutRedirectUri:window.location.href}},this.msal=new Msal.UserAgentApplication(this.config),this.msal.handleRedirectCallback(e=>{e&&e.errorMessage&&console.log(`Token error during login: ${e.errorMessage}`)}),this.fetching=!1}login(){this.msal.loginRedirect({authority:this.config.auth.authority,state:window.location.href})}logout(){this.msal.logout()}setUserContext(e=0,t){if(!this.fetching){this.fetching=!0;let o=`${window.clientServiceProfile}/v1/person/getperson`;this.getAccessToken([window.serviceScopeProfile]).then(async({accessToken:i})=>{let n=await fetch(o,{headers:{Authorization:`Bearer ${i}`}});const s=await n.json();this.getAccessToken(["https://AarhusUniversitet.onmicrosoft.com/17bc1604-f023-43df-8160-a1c97326244e/user_impersonation"]).then(async({accessToken:i})=>{o="/api/User/GetUser",e>0&&(o=`${o}?auId=${e}`),window.pointInTime&&window.lastLogin&&(o=`${o}${e>0?"&":"?"}pointInTime=${window.pointInTime}&lastLogin=${window.lastLogin}`),window.disregardEnded&&(o=`${o}&disregardEnded=true`),window.redirectUser||(o=e>0?`${o}&redirectUser=false`:`${o}?redirectUser=false`),n=await fetch(o,{headers:{Authorization:`Bearer ${i}`}});const r=await n.json();t({basic:s,full:r})})})}}getUser(){const e=this.msal.getAccount();return null==e?null:{name:e.name,userId:e.accountIdentifier,auid:e.userName}}getIdToken(){return this.msal.acquireTokenSilent({scopes:[this.config.auth.clientId],authority:this.config.auth.authority})}getAccessToken(e){const t={scopes:e,authority:this.config.auth.authority,state:window.location.href},o=()=>{const e=JSON.stringify({thisIsCachedSafariAccessToken:!0,authority:t.authority,clientId:this.config.auth.clientId,scopes:t.scopes,homeAccountIdentifier:this.msal.getAccount().homeAccountIdentifier}),o=sessionStorage.getItem(e);if(null!==o&&void 0!==o){const e=JSON.parse(o);if(e.expiresOn&&new Date(e.expiresOn)>new Date&&e.accessToken)return new Promise(t=>t(e))}return this.msal.acquireTokenPopup(t).then(t=>{sessionStorage.setItem(e,JSON.stringify(t))}).catch(()=>{if(!window.safari)throw alert("This site needs to show popups, but your browser blocks popups from this site.\nYou need to allow popups from this site, then reload the page."),new Error("Popups disabled");alert("This site needs to show popups, when browsed in the Safari browser.\nYou need to change the Safari preferences to allow popups from this site, then reload the page.")})};return void 0!==window.safari?o():this.msal.acquireTokenSilent(t).catch(()=>o())}}}]);
|
|
2
|
-
//# sourceMappingURL=auAuth.js.map
|
package/build/cjs/auAuth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/lib/au-auth.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","object","property","prototype","hasOwnProperty","p","s","window","auAuth","constructor","this","config","auth","clientId","authority","redirectUri","navigateToLoginRequestUrl","postLogoutRedirectUri","location","href","msal","Msal","UserAgentApplication","handleRedirectCallback","err","errorMessage","console","log","fetching","login","loginRedirect","state","logout","setUserContext","auId","callback","url","clientServiceProfile","getAccessToken","serviceScopeProfile","then","async","accessToken","response","fetch","headers","Authorization","basic","json","accessToken2","pointInTime","lastLogin","disregardEnded","redirectUser","full","getUser","msalUser","getAccount","userId","accountIdentifier","auid","userName","getIdToken","acquireTokenSilent","scopes","req","popupFallback","key","JSON","stringify","thisIsCachedSafariAccessToken","homeAccountIdentifier","token","sessionStorage","getItem","undefined","parsed","parse","expiresOn","Date","Promise","resolve","acquireTokenPopup","setItem","catch","safari","alert","Error"],"mappings":"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","file":"auAuth.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/* eslint-disable import/prefer-default-export */\n/* eslint-env browser */\n// AuAuth\n//\n// Common module to handle auth/login/logout of AzureAD in AU.\n//\nclass AuAuth {\n config;\n\n constructor() {\n this.config = {\n auth: {\n clientId: 'ff2a564d-47a4-4596-aa44-95e5d38f3029', // Generic Au client id\n authority: 'https://login.microsoftonline.com/AarhusUniversitet.onmicrosoft.com',\n redirectUri: 'https://auuserauthtest.azurewebsites.net',\n navigateToLoginRequestUrl: true,\n postLogoutRedirectUri: window.location.href,\n },\n };\n\n this.msal = new Msal.UserAgentApplication(this.config);\n\n // Callback used when a token is obtained from the query string\n const authCallback = (err) => {\n if (err && err.errorMessage) {\n console.log(`Token error during login: ${err.errorMessage}`);\n }\n };\n\n this.msal.handleRedirectCallback(authCallback);\n this.fetching = false;\n }\n\n login() {\n this.msal.loginRedirect({\n authority: this.config.auth.authority,\n state: window.location.href,\n });\n }\n\n logout() {\n this.msal.logout();\n }\n\n /* to be refactored */\n setUserContext(auId = 0, callback) {\n if (!this.fetching) {\n this.fetching = true;\n let url = `${window.clientServiceProfile}/v1/person/getperson`;\n this.getAccessToken([window.serviceScopeProfile]).then(async ({ accessToken }) => {\n let response = await fetch(url, {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n });\n const basic = await response.json();\n this.getAccessToken(['https://AarhusUniversitet.onmicrosoft.com/17bc1604-f023-43df-8160-a1c97326244e/user_impersonation']).then(async ({ accessToken: accessToken2 }) => {\n url = '/api/User/GetUser';\n if (auId > 0) {\n url = `${url}?auId=${auId}`;\n }\n if (window.pointInTime && window.lastLogin) {\n url = `${url}${auId > 0 ? '&' : '?'}pointInTime=${window.pointInTime}&lastLogin=${window.lastLogin}`;\n }\n if (window.disregardEnded) {\n url = `${url}&disregardEnded=true`;\n }\n if (!window.redirectUser) {\n if (auId > 0) {\n url = `${url}&redirectUser=false`;\n } else {\n url = `${url}?redirectUser=false`;\n }\n }\n\n response = await fetch(url, {\n headers: {\n Authorization: `Bearer ${accessToken2}`,\n },\n });\n\n const full = await response.json();\n callback({\n basic,\n full,\n });\n });\n });\n }\n }\n\n getUser() {\n const msalUser = this.msal.getAccount();\n if (msalUser == null) {\n return null;\n }\n return {\n name: msalUser.name,\n userId: msalUser.accountIdentifier,\n auid: msalUser.userName,\n };\n }\n\n getIdToken() {\n return this.msal.acquireTokenSilent({\n scopes: [this.config.auth.clientId],\n authority: this.config.auth.authority,\n });\n }\n\n getAccessToken(scopes) {\n const req = {\n scopes,\n authority: this.config.auth.authority,\n state: window.location.href,\n };\n\n const popupFallback = () => {\n // Need to explicitly implement caching, because Msal has chosen to\n // only implement caching when using silent token retrieval.\n\n // Key similar to how Msal does it internally, except first prop, to avoid collisions.\n const key = JSON.stringify({\n thisIsCachedSafariAccessToken: true,\n authority: req.authority,\n clientId: this.config.auth.clientId,\n scopes: req.scopes,\n homeAccountIdentifier: this.msal.getAccount().homeAccountIdentifier,\n });\n const token = sessionStorage.getItem(key);\n if (token !== null && token !== undefined) {\n const parsed = JSON.parse(token);\n if (parsed.expiresOn && (new Date(parsed.expiresOn) > new Date()) && parsed.accessToken) {\n return new Promise(resolve => resolve(parsed));\n }\n }\n\n return this.msal.acquireTokenPopup(req)\n .then((accessToken) => {\n sessionStorage.setItem(key, JSON.stringify(accessToken));\n })\n .catch(() => {\n if (window.safari) {\n alert('This site needs to show popups, when browsed in the Safari browser.\\nYou need to change the Safari preferences to allow popups from this site, then reload the page.');\n } else {\n alert('This site needs to show popups, but your browser blocks popups from this site.\\nYou need to allow popups from this site, then reload the page.');\n throw new Error('Popups disabled');\n }\n });\n };\n\n // Safari desktop fallback to popups because of eradic Safari bugs using silent/iframe.\n if (window.safari !== undefined) {\n return popupFallback();\n }\n\n return this.msal.acquireTokenSilent(req)\n .catch(() => popupFallback());\n }\n}\n\n// Export as singleton instance\nwindow.auAuth = new AuAuth();\n"],"sourceRoot":""}
|