@aarhus-university/au-lib-react-components 9.11.18 → 10.0.1
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 -6
- package/build/umd/all.css +1 -1
- 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 -2
- 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 -60
- package/src/components/{delphinus/AUAlertComponent.js → AUAlertComponent.tsx} +70 -85
- 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} +80 -94
- package/src/components/{form/AUReceiptComponent.js → AUReceiptComponent.tsx} +33 -40
- package/src/components/AUSpinnerComponent.tsx +67 -0
- package/src/components/{delphinus/AUSubNavComponent.js → AUSubNavComponent.tsx} +38 -53
- package/src/components/{form/AUSubmitButtonContainerComponent.js → AUSubmitButtonContainerComponent.tsx} +31 -39
- package/src/components/{delphinus/AUTabbedContentComponent.js → AUTabbedContentComponent.tsx} +145 -150
- 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 -128
- package/src/components/profile/AUProfileAvatarComponent.js +83 -83
- package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
- package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -0
- package/src/components/profile/AUProfileContainerComponent.js +283 -283
- 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 → AUProfileLoginComponent.tsx} +3 -18
- package/src/components/profile/AUProfileMailComponent.js +307 -307
- 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 -230
- package/src/components/profile/AUProfileWidgetComponent.js +95 -95
- package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
- package/src/components/profile/{AUProfileWidgetV3Component.js → AUProfileWidgetV3Component.tsx} +122 -130
- package/src/components/wrapping/AUEmbedComponent.js +47 -47
- package/src/{components → layout-2016/components}/alphabox/AlphaBoxComponent.js +28 -25
- 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} +33 -58
- package/src/{components/delphinus/hooks.js → lib/hooks.ts} +33 -28
- package/src/lib/{i18n.js → i18n.ts} +600 -601
- package/src/lib/{tracking.js → tracking.ts} +69 -65
- package/src/lib/{wrapping.js → wrapping.ts} +21 -16
- package/src/styles/_settings.scss +10 -10
- package/src/styles/alphabox.scss +222 -208
- package/src/styles/app.scss +7 -13
- 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 +395 -395
- package/tsconfig.json +47 -0
- package/types/common/interfaces/gui.d.ts +52 -0
- package/types/common/interfaces/model.d.ts +29 -0
- package/types/common/main.d.ts +5 -0
- package/types/common/package.json +5 -0
- package/types/common/payloads.d.ts +0 -0
- package/types/common/props.d.ts +165 -0
- package/{src/config/webpack.umd.config.js → webpack.config.js} +20 -16
- package/.eslintrc +0 -19
- package/build/dev.html +0 -329
- package/build/umd/auAuth.js +0 -2
- package/build/umd/auAuth.js.map +0 -1
- package/build/umd/databox.js.LICENSE.txt +0 -5
- 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 -487
- package/src/components/delphinus/AUContentToggleComponent.js +0 -32
- package/src/components/delphinus/AUDatepickerComponent.js +0 -164
- package/src/components/delphinus/AULoginComponent.js +0 -65
- package/src/components/delphinus/AUSpinnerComponent.js +0 -114
- 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/NewsCollageBannerRSSComponent.js +0 -79
- 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/components/profile/AUProfileAvatarV3Component.js +0 -80
- package/src/config/webpack.dev.config.js +0 -47
- package/src/index.js +0 -6
- package/src/lib/au-auth.js +0 -227
- package/src/lib/au-news.js +0 -371
- 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
package/src/lib/au-news.js
DELETED
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
/* eslint max-classes-per-file: 0 */
|
|
3
|
-
/* eslint class-methods-use-this: 0 */
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import ReactDOM from 'react-dom';
|
|
6
|
-
import NewsListComponent from '../components/news/NewsListComponent';
|
|
7
|
-
import NewsPopUpComponent from '../components/news/NewsPopUpComponent';
|
|
8
|
-
import NewsCollageBannerComponent from '../components/news/NewsCollageBannerComponent';
|
|
9
|
-
import NewsCollageBannerRSSComponent from '../components/news/NewsCollageBannerRSSComponent';
|
|
10
|
-
import { isElementInViewport } from './helpers';
|
|
11
|
-
|
|
12
|
-
const AUNewsConfig = {
|
|
13
|
-
server: window.newsServer || '//news.au.dk',
|
|
14
|
-
newsUrl: `${window.location.href.replace(window.location.hash, '').replace('#', '')}#news-`,
|
|
15
|
-
useOverlay: !(typeof window.useOverlay !== 'undefined' && !window.useOverlay),
|
|
16
|
-
useSyndication: !(typeof window.useSyndication !== 'undefined' && !window.useSyndication),
|
|
17
|
-
tagStrip: new RegExp(/<(?!\/?sub|sup(?=>|\s.*>))\/?.*?>/ig),
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
class AUNewsHelpers {
|
|
21
|
-
static typeIdToText(_id) {
|
|
22
|
-
let id = _id;
|
|
23
|
-
id = parseInt(id, 10);
|
|
24
|
-
if (id === 0 || id === 2) {
|
|
25
|
-
return 'news';
|
|
26
|
-
}
|
|
27
|
-
if (id === 4 || id === 7) {
|
|
28
|
-
return 'event';
|
|
29
|
-
}
|
|
30
|
-
if (id === 9) {
|
|
31
|
-
return 'notice';
|
|
32
|
-
}
|
|
33
|
-
return '';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static getEventDates(item, lang) {
|
|
37
|
-
const fromDateSplit = item.event_from.date.split('.');
|
|
38
|
-
let fromDate;
|
|
39
|
-
if (lang === 'en') {
|
|
40
|
-
fromDate = new Date(
|
|
41
|
-
parseInt(fromDateSplit[0], 10),
|
|
42
|
-
parseInt(fromDateSplit[1], 10) - 1,
|
|
43
|
-
parseInt(fromDateSplit[2], 10),
|
|
44
|
-
);
|
|
45
|
-
} else {
|
|
46
|
-
fromDate = new Date(
|
|
47
|
-
parseInt(fromDateSplit[2], 10),
|
|
48
|
-
parseInt(fromDateSplit[1], 10) - 1,
|
|
49
|
-
parseInt(fromDateSplit[0], 10),
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const toDateSplit = item.event_to.date.split('.');
|
|
54
|
-
let toDate;
|
|
55
|
-
if (lang === 'en') {
|
|
56
|
-
toDate = new Date(
|
|
57
|
-
parseInt(toDateSplit[0], 10),
|
|
58
|
-
parseInt(toDateSplit[1], 10) - 1,
|
|
59
|
-
parseInt(toDateSplit[2], 10),
|
|
60
|
-
);
|
|
61
|
-
} else {
|
|
62
|
-
toDate = new Date(
|
|
63
|
-
parseInt(toDateSplit[2], 10),
|
|
64
|
-
parseInt(toDateSplit[1], 10) - 1,
|
|
65
|
-
parseInt(toDateSplit[0], 10),
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
fromDate,
|
|
71
|
-
toDate,
|
|
72
|
-
fromDateSplit,
|
|
73
|
-
toDateSplit,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
static setExternal(_item) {
|
|
78
|
-
const item = _item;
|
|
79
|
-
const ttType = parseInt(item.type, 10);
|
|
80
|
-
item.external = ttType !== 0 && ttType !== 4 && ttType !== 9;
|
|
81
|
-
// "News" eller "Event" eller "Notice"
|
|
82
|
-
item.url = !item.external
|
|
83
|
-
&& AUNewsConfig.useOverlay ? (AUNewsConfig.newsUrl + item.id) : item.permalink;
|
|
84
|
-
return item;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
static getNewsID(search) {
|
|
88
|
-
const reNewsId = /^#?news-(.*)$/;
|
|
89
|
-
const match = search.match(reNewsId);
|
|
90
|
-
if (match !== null) {
|
|
91
|
-
return match[1];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return -1;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
static isiPad() {
|
|
98
|
-
return (/iPad/i).test(navigator.userAgent);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
class AUNews {
|
|
103
|
-
constructor(lang, feeds) {
|
|
104
|
-
this.lang = lang;
|
|
105
|
-
this.feeds = feeds || [];
|
|
106
|
-
this.item = null;
|
|
107
|
-
this.setItem = this.setItem.bind(this);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
setItem(item) {
|
|
111
|
-
this.item = item;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
setPopUp() {
|
|
115
|
-
const qsNewsPrint = AU.helpers.getQuerystring('newsprint');
|
|
116
|
-
const print = qsNewsPrint !== '';
|
|
117
|
-
const openPopUp = () => {
|
|
118
|
-
const newsID = AUNewsHelpers.getNewsID(window.location.hash);
|
|
119
|
-
let mountNode = document.getElementById('au_news_popup');
|
|
120
|
-
if (print) {
|
|
121
|
-
mountNode = document.querySelector('body');
|
|
122
|
-
}
|
|
123
|
-
if (parseInt(newsID, 10) > -1) {
|
|
124
|
-
if (this.item != null) {
|
|
125
|
-
const trackerLink = `/virtual/news/${AUNewsHelpers.typeIdToText(this.item.type)}/open-list/id-${this.item.id}/${this.item.permalink}`;
|
|
126
|
-
AU.tracking.trackSingle(trackerLink);
|
|
127
|
-
}
|
|
128
|
-
// Would like to use portal here, but it won't work "standalone"
|
|
129
|
-
ReactDOM.render(
|
|
130
|
-
<NewsPopUpComponent
|
|
131
|
-
id={newsID}
|
|
132
|
-
item={this.item}
|
|
133
|
-
lang={this.lang}
|
|
134
|
-
print={print}
|
|
135
|
-
/>,
|
|
136
|
-
mountNode,
|
|
137
|
-
);
|
|
138
|
-
} else if (window.location.hash === '' || window.location.hash === '#') { // Thx IE!
|
|
139
|
-
ReactDOM.unmountComponentAtNode(mountNode);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
openPopUp();
|
|
144
|
-
|
|
145
|
-
window.addEventListener('hashchange', () => {
|
|
146
|
-
openPopUp();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
const fade = document.getElementById('fade');
|
|
150
|
-
fade.addEventListener('click', () => {
|
|
151
|
-
window.location.hash = '';
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
init() {
|
|
156
|
-
this.setPopUp();
|
|
157
|
-
this.feeds.forEach((f) => {
|
|
158
|
-
const list = f;
|
|
159
|
-
list.container = document.querySelector(`#au_news-list_${list.id}`);
|
|
160
|
-
list.items = [];
|
|
161
|
-
list.page = 1;
|
|
162
|
-
const elements = AUNews.getElementFormatArray(list);
|
|
163
|
-
const mountNode = list.container;
|
|
164
|
-
if (mountNode) {
|
|
165
|
-
ReactDOM.render(
|
|
166
|
-
<NewsListComponent
|
|
167
|
-
lang={this.lang}
|
|
168
|
-
list={list}
|
|
169
|
-
elements={elements}
|
|
170
|
-
setItem={this.setItem}
|
|
171
|
-
/>,
|
|
172
|
-
mountNode,
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
static getElementFormatArray(_list) {
|
|
179
|
-
const list = _list;
|
|
180
|
-
const elements = [];
|
|
181
|
-
const rowSplit = list.format.split(',');
|
|
182
|
-
let formatCount = 0;
|
|
183
|
-
for (let r = 0; r < rowSplit.length; r += 1) {
|
|
184
|
-
const element = rowSplit[r];
|
|
185
|
-
if (element !== '|') {
|
|
186
|
-
if (element.indexOf('|') > -1) {
|
|
187
|
-
const columns = [];
|
|
188
|
-
const columnSplit = element.split('|');
|
|
189
|
-
for (let c = 0; c < columnSplit.length; c += 1) {
|
|
190
|
-
const columnElements = [];
|
|
191
|
-
const columnElementsSplit = columnSplit[c].split(';');
|
|
192
|
-
for (let e = 0; e < columnElementsSplit.length; e += 1) {
|
|
193
|
-
columnElements.push(columnElementsSplit[e]);
|
|
194
|
-
list.lastelement = columnElementsSplit[e];
|
|
195
|
-
list.lastiscolumn = true;
|
|
196
|
-
formatCount += 1;
|
|
197
|
-
}
|
|
198
|
-
columns.push(columnElements);
|
|
199
|
-
}
|
|
200
|
-
elements.push(columns);
|
|
201
|
-
} else {
|
|
202
|
-
elements.push(element);
|
|
203
|
-
list.lastiscolumn = false;
|
|
204
|
-
list.lastelement = element;
|
|
205
|
-
formatCount += 1;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (list.page === 1) {
|
|
211
|
-
list.amount = formatCount;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return elements;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
class AUNewsCollage {
|
|
219
|
-
constructor(lang, element) {
|
|
220
|
-
this.element = element;
|
|
221
|
-
this.loaded = false;
|
|
222
|
-
this.lang = lang;
|
|
223
|
-
window.addEventListener('scroll', () => {
|
|
224
|
-
this.init();
|
|
225
|
-
this.initRSS();
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
loadData(key, callback) {
|
|
230
|
-
const url = `${AUNewsConfig.server}/index.php?eID=getAuNewsFeed&mode=key&key=${key}&index=0&amount=4&noPageBrowser=1&lang=${this.lang}&callback=?`;
|
|
231
|
-
$.ajax({
|
|
232
|
-
url,
|
|
233
|
-
dataType: 'json',
|
|
234
|
-
jsonpCallback: url.hashCode(),
|
|
235
|
-
jsonp: true,
|
|
236
|
-
cache: true,
|
|
237
|
-
success: (data) => {
|
|
238
|
-
if (typeof callback === 'function') {
|
|
239
|
-
callback(data);
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
loadDataRSS(url, callback) {
|
|
246
|
-
fetch(url).then((response) => response.json()).then((data) => callback(data.Items));
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
init() {
|
|
250
|
-
if (!this.loaded && isElementInViewport(this.element) && typeof window.newsCollageRSS === 'undefined') {
|
|
251
|
-
const newsElements = [
|
|
252
|
-
document.querySelector('#news1'),
|
|
253
|
-
document.querySelector('#news2'),
|
|
254
|
-
document.querySelector('#news3'),
|
|
255
|
-
document.querySelector('#news4'),
|
|
256
|
-
];
|
|
257
|
-
|
|
258
|
-
const eventElements = [
|
|
259
|
-
document.querySelector('#event1'),
|
|
260
|
-
document.querySelector('#event2'),
|
|
261
|
-
document.querySelector('#event3'),
|
|
262
|
-
];
|
|
263
|
-
|
|
264
|
-
// News
|
|
265
|
-
const newsFeedKey = this.lang === 'da' ? 'b73f5e9759ac3592043449c02dcffa56' : '400bcbb4807a5a722df5e2045fa7966f';
|
|
266
|
-
this.loadData(newsFeedKey, (data) => {
|
|
267
|
-
newsElements.forEach((e, i) => {
|
|
268
|
-
if (data[i]) {
|
|
269
|
-
ReactDOM.render(
|
|
270
|
-
<NewsCollageBannerComponent
|
|
271
|
-
type="news"
|
|
272
|
-
item={AUNewsHelpers.setExternal(data[i])}
|
|
273
|
-
title={this.lang === 'da' ? 'Nyhed' : 'News'}
|
|
274
|
-
lang={this.lang}
|
|
275
|
-
/>,
|
|
276
|
-
e,
|
|
277
|
-
);
|
|
278
|
-
} else {
|
|
279
|
-
e.style.display = 'none';
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
// Events
|
|
284
|
-
const eventFeedKey = this.lang === 'da' ? '003383f99d8ae70cde9110294ab39727' : '19a8aa9cc30143d2e41cfbdb4123541e';
|
|
285
|
-
this.loadData(eventFeedKey, (data) => {
|
|
286
|
-
eventElements.forEach((e, i) => {
|
|
287
|
-
if (data[i]) {
|
|
288
|
-
ReactDOM.render(
|
|
289
|
-
<NewsCollageBannerComponent
|
|
290
|
-
type="events"
|
|
291
|
-
item={AUNewsHelpers.setExternal(data[i])}
|
|
292
|
-
title={this.lang === 'da' ? 'Arrangement' : 'Event'}
|
|
293
|
-
lang={this.lang}
|
|
294
|
-
/>,
|
|
295
|
-
e,
|
|
296
|
-
);
|
|
297
|
-
} else {
|
|
298
|
-
e.style.display = 'none';
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
this.loaded = true;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
initRSS() {
|
|
308
|
-
if (!this.loaded && isElementInViewport(this.element) && typeof window.newsCollageRSS !== 'undefined' && window.newsCollageRSS) {
|
|
309
|
-
const newsElements = [
|
|
310
|
-
document.querySelector('#news1'),
|
|
311
|
-
document.querySelector('#news2'),
|
|
312
|
-
document.querySelector('#news3'),
|
|
313
|
-
document.querySelector('#news4'),
|
|
314
|
-
];
|
|
315
|
-
|
|
316
|
-
const eventElements = [
|
|
317
|
-
document.querySelector('#event1'),
|
|
318
|
-
document.querySelector('#event2'),
|
|
319
|
-
document.querySelector('#event3'),
|
|
320
|
-
];
|
|
321
|
-
|
|
322
|
-
// News
|
|
323
|
-
const newsFeedKey = `https://webtools.au.dk/api/news/getlist?url=${window.newsFeedRssUri}`;
|
|
324
|
-
this.loadDataRSS(newsFeedKey, (data) => {
|
|
325
|
-
newsElements.forEach((e, i) => {
|
|
326
|
-
if (data[i]) {
|
|
327
|
-
ReactDOM.render(
|
|
328
|
-
<NewsCollageBannerRSSComponent
|
|
329
|
-
type="news"
|
|
330
|
-
item={data[i]}
|
|
331
|
-
title={this.lang === 'da' ? 'Nyhed' : 'News'}
|
|
332
|
-
lang={this.lang}
|
|
333
|
-
/>,
|
|
334
|
-
e,
|
|
335
|
-
);
|
|
336
|
-
} else {
|
|
337
|
-
e.style.display = 'none';
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
// Events
|
|
342
|
-
const eventFeedKey = `https://webtools.au.dk/api/news/getlist?url=${window.eventFeedRssUri}`;
|
|
343
|
-
this.loadDataRSS(eventFeedKey, (data) => {
|
|
344
|
-
eventElements.forEach((e, i) => {
|
|
345
|
-
if (data[i]) {
|
|
346
|
-
ReactDOM.render(
|
|
347
|
-
<NewsCollageBannerRSSComponent
|
|
348
|
-
type="events"
|
|
349
|
-
item={data[i]}
|
|
350
|
-
title={this.lang === 'da' ? 'Arrangement' : 'Event'}
|
|
351
|
-
lang={this.lang}
|
|
352
|
-
/>,
|
|
353
|
-
e,
|
|
354
|
-
);
|
|
355
|
-
} else {
|
|
356
|
-
e.style.display = 'none';
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
this.loaded = true;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
window.AUNews = AUNews;
|
|
367
|
-
window.AUNewsCollage = AUNewsCollage;
|
|
368
|
-
export {
|
|
369
|
-
AUNewsConfig,
|
|
370
|
-
AUNewsHelpers,
|
|
371
|
-
};
|
package/src/lib/menu.js
DELETED
package/src/lib/urlHandler.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
/* eslint no-restricted-syntax: 0 */
|
|
3
|
-
/* eslint no-prototype-builtins: 0 */
|
|
4
|
-
class AUUrlHandler {
|
|
5
|
-
constructor(onPopState, useHistory = true) {
|
|
6
|
-
this.useHistory = useHistory;
|
|
7
|
-
|
|
8
|
-
if (typeof onPopState === 'function') {
|
|
9
|
-
window.onpopstate = (event) => {
|
|
10
|
-
onPopState(event);
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static getQuery(index = 1) {
|
|
16
|
-
return window.location.search.substring(index); // 1 = without ?
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static parse() {
|
|
20
|
-
const query = AUUrlHandler.getQuery();
|
|
21
|
-
if (query === '') {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
const objString = `{"${query.replace(/&/g, '","').replace(/=/g, '":"')}"}`;
|
|
25
|
-
return JSON.parse(objString, (key, value) => (key === '' ? value : decodeURIComponent(value)));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static serialize(obj) {
|
|
29
|
-
const str = [];
|
|
30
|
-
for (const p in obj) {
|
|
31
|
-
if (obj.hasOwnProperty(p) && obj[p] !== '') {
|
|
32
|
-
str.push(`${encodeURIComponent(p)}=${encodeURIComponent(obj[p])}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return str.join('&');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
set(query, append = true, title = '') {
|
|
39
|
-
const { key, value } = query;
|
|
40
|
-
|
|
41
|
-
const current = AUUrlHandler.parse() || {};
|
|
42
|
-
current[key] = value;
|
|
43
|
-
|
|
44
|
-
const { location: { protocol, host, pathname } } = window;
|
|
45
|
-
let next = `?${AUUrlHandler.serialize(current)}`;
|
|
46
|
-
if (next === '?') {
|
|
47
|
-
next = `${protocol}//${host}${pathname}`;
|
|
48
|
-
} else {
|
|
49
|
-
next = `${pathname}${next}`;
|
|
50
|
-
}
|
|
51
|
-
if (this.useHistory) {
|
|
52
|
-
if (append) {
|
|
53
|
-
window.history.pushState('', title, next);
|
|
54
|
-
} else {
|
|
55
|
-
window.history.replaceState('', title, next);
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
window.location.search = next;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default AUUrlHandler;
|
package/src/lib/validation.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { passwordLabels } from './i18n';
|
|
3
|
-
|
|
4
|
-
const emailRegex = /^(?=.{6,320}$)([0-9A-Za-z]([0-9A-Za-z\x21\x23\x24\x25\x26\x27\x2a\x2b\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e\x2d\x2e]{0,62}[0-9A-Za-z])?\x40(?=.{4,255}$)(([0-9A-Za-z]([0-9A-Za-z\x2d]{0,254}[0-9A-Za-z])?\x2e)+[0-9A-Za-z]([0-9A-Za-z\x2d]{0,254}[0-9A-Za-z])?))$/;
|
|
5
|
-
const studentRegistrationNumberRegex = /^[a-zA-Z0-9]{3,12}$/;
|
|
6
|
-
const auIdRegex = /^au[1-9]([0-9]{0,8})$/;
|
|
7
|
-
|
|
8
|
-
const renderValidation = (messages) => messages.map(
|
|
9
|
-
(message) => <span key={message} className="form-info__message">{message}</span>,
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const validateForm = (lang, fieldValue, rulesAndMessages = []) => {
|
|
13
|
-
let valid = true;
|
|
14
|
-
const validationMessages = [];
|
|
15
|
-
rulesAndMessages.forEach((rm) => {
|
|
16
|
-
if (!rm.rule(fieldValue)) {
|
|
17
|
-
valid = false;
|
|
18
|
-
validationMessages.push(rm.message);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
if (valid) {
|
|
23
|
-
validationMessages.push(passwordLabels[lang].allGood);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return [valid, validationMessages];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const validatePassword = (lang, newPassword, confirmPassword, blur = false, submit = false) => {
|
|
30
|
-
const length = 12;
|
|
31
|
-
const lowerLetters = /([a-z])/g;
|
|
32
|
-
const upperLetters = /([A-Z])/g;
|
|
33
|
-
const invalidLetters = /([æøåÆØÅ])/g;
|
|
34
|
-
const numbers = /([0-9])/g;
|
|
35
|
-
const special = /~|!|@|#|\$|%|\^|&|\*|_|-|\+|=|`|\||\(|\)|{|}|\[|\]|:|;|"|'|<|>|,|\.|\?|\//g;
|
|
36
|
-
const spaces = /\s/g;
|
|
37
|
-
const all = new RegExp(`${lowerLetters.source}|${upperLetters.source}|${invalidLetters.source}|${numbers.source}|${special.source}|${spaces.source}`);
|
|
38
|
-
|
|
39
|
-
let newPasswordValid = false;
|
|
40
|
-
const newPasswordMessages = [];
|
|
41
|
-
let confirmPasswordValid = false;
|
|
42
|
-
const confirmPasswordMessages = [];
|
|
43
|
-
|
|
44
|
-
const map = new Map();
|
|
45
|
-
Object.entries(passwordLabels[lang].rules).forEach((label) => {
|
|
46
|
-
map.set(label[0], label[1].replace('###LENGTH###', length));
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
let key = '';
|
|
50
|
-
|
|
51
|
-
if (newPassword.length > 0) {
|
|
52
|
-
if (newPassword.length >= length || blur) {
|
|
53
|
-
newPasswordValid = true;
|
|
54
|
-
if (newPassword.match(invalidLetters)) {
|
|
55
|
-
newPasswordMessages.push(map.get('invalid'));
|
|
56
|
-
newPasswordValid = false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (newPassword.match(spaces)) {
|
|
60
|
-
newPasswordMessages.push(map.get('spaces'));
|
|
61
|
-
newPasswordValid = false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
let invalidSpecialFound = false;
|
|
65
|
-
newPassword.split('').forEach((char) => {
|
|
66
|
-
if (!char.match(all)) {
|
|
67
|
-
invalidSpecialFound = true;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (invalidSpecialFound) {
|
|
72
|
-
newPasswordMessages.push(map.get('specialchars'));
|
|
73
|
-
newPasswordValid = false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
let cases = 0;
|
|
77
|
-
if (!newPassword.match(lowerLetters)) {
|
|
78
|
-
key = `${key}lower`;
|
|
79
|
-
cases += 1;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (!newPassword.match(upperLetters)) {
|
|
83
|
-
key = `${key}upper`;
|
|
84
|
-
cases += 1;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!newPassword.match(numbers)) {
|
|
88
|
-
key = `${key}numbers`;
|
|
89
|
-
cases += 1;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (!newPassword.match(special)) {
|
|
93
|
-
key = `${key}special`;
|
|
94
|
-
cases += 1;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (cases > 1) {
|
|
98
|
-
newPasswordValid = false;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (newPassword.length < length) {
|
|
102
|
-
newPasswordMessages.push(map.get('length'));
|
|
103
|
-
newPasswordValid = false;
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
if (newPassword.match(invalidLetters)) {
|
|
107
|
-
newPasswordMessages.push(map.get('invalid'));
|
|
108
|
-
newPasswordValid = false;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (newPassword.match(spaces)) {
|
|
112
|
-
newPasswordMessages.push(map.get('spaces'));
|
|
113
|
-
newPasswordValid = false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let invalidSpecialFound = false;
|
|
117
|
-
newPassword.split('').forEach((char) => {
|
|
118
|
-
if (!char.match(all)) {
|
|
119
|
-
invalidSpecialFound = true;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (invalidSpecialFound) {
|
|
124
|
-
newPasswordMessages.push(map.get('specialchars'));
|
|
125
|
-
newPasswordValid = false;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (newPassword.length < length && blur) {
|
|
129
|
-
newPasswordMessages.push(map.get('length'));
|
|
130
|
-
newPasswordValid = false;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
console.log(key);
|
|
135
|
-
|
|
136
|
-
const mapKey = map.get(key);
|
|
137
|
-
if (typeof mapKey !== 'undefined') {
|
|
138
|
-
newPasswordMessages.push(mapKey);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (newPasswordValid) {
|
|
142
|
-
newPasswordMessages.push(passwordLabels[lang].allRequirements);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (confirmPassword.length >= newPassword.length
|
|
146
|
-
|| ((blur || submit) && confirmPassword.length > 0)) {
|
|
147
|
-
if (confirmPassword === newPassword) {
|
|
148
|
-
confirmPasswordMessages.push(passwordLabels[lang].passwordsEqual);
|
|
149
|
-
confirmPasswordValid = true;
|
|
150
|
-
} else {
|
|
151
|
-
confirmPasswordMessages.push(passwordLabels[lang].passwordsNotEqual);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (submit) {
|
|
157
|
-
if (newPassword === '') {
|
|
158
|
-
newPasswordValid = false;
|
|
159
|
-
newPasswordMessages.push(passwordLabels[lang].typeNew);
|
|
160
|
-
} else if (confirmPassword === '') {
|
|
161
|
-
confirmPasswordValid = false;
|
|
162
|
-
confirmPasswordMessages.push(passwordLabels[lang].repeatNew);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
newPasswordValid,
|
|
168
|
-
newPasswordMessages,
|
|
169
|
-
confirmPasswordValid,
|
|
170
|
-
confirmPasswordMessages,
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export {
|
|
175
|
-
emailRegex,
|
|
176
|
-
studentRegistrationNumberRegex,
|
|
177
|
-
auIdRegex,
|
|
178
|
-
renderValidation,
|
|
179
|
-
validatePassword,
|
|
180
|
-
validateForm,
|
|
181
|
-
};
|
package/src/styles/alert.scss
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* alert */
|
|
2
|
-
.au-alert {
|
|
3
|
-
position: fixed;
|
|
4
|
-
z-index: 100;
|
|
5
|
-
left: 50%;
|
|
6
|
-
top: 50%;
|
|
7
|
-
transform: translate(-50%, -50%);
|
|
8
|
-
width: 300px;
|
|
9
|
-
background-color: #fff;
|
|
10
|
-
padding: 1.3636364rem;
|
|
11
|
-
|
|
12
|
-
button {
|
|
13
|
-
margin-top: 1rem;
|
|
14
|
-
margin-bottom: 0;
|
|
15
|
-
padding: .65rem 2rem;
|
|
16
|
-
|
|
17
|
-
&.confirm {
|
|
18
|
-
background-color: $alert-confirm-color;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&.cancel {
|
|
22
|
-
background-color: $alert-cancel-color;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&:first-of-type {
|
|
26
|
-
margin-right: 1rem;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.au-alert-overlay, .au-modal-overlay {
|
|
32
|
-
position: fixed;
|
|
33
|
-
top: 0;
|
|
34
|
-
right: 0;
|
|
35
|
-
bottom: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
background-color: rgba(0, 0, 0, .6);
|
|
38
|
-
z-index: 99;
|
|
39
|
-
}
|