@eui/base 18.0.0-next.76 → 18.0.0-next.78
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/docs/dependencies.html +2 -2
- package/docs/js/search/search_index.js +2 -2
- package/fesm2022/eui-base.mjs +1192 -1178
- package/fesm2022/eui-base.mjs.map +1 -7
- package/package.json +1 -1
package/fesm2022/eui-base.mjs
CHANGED
|
@@ -1,1247 +1,1261 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { coerceBooleanProperty, coerceArray as coerceArray$1, coerceCssPixelValue, coerceElement as coerceElement$1, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { createSelector } from 'reselect';
|
|
4
|
+
import { filter, switchMap } from 'rxjs/operators';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
|
|
7
|
+
const isObject = (item) => item && typeof item === 'object' && !Array.isArray(item);
|
|
3
8
|
function merge(target, ...sources) {
|
|
4
|
-
|
|
9
|
+
return mergeDeep(target, ...sources);
|
|
5
10
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
/* eslint-enable */
|
|
12
|
+
/**
|
|
13
|
+
* deep merge of two or more objects
|
|
14
|
+
*
|
|
15
|
+
* @param target immutable target
|
|
16
|
+
* @param sources immutable sources to apply to target
|
|
17
|
+
* @returns a new merged object
|
|
18
|
+
*/
|
|
19
|
+
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
const mergeDeep = (target, ...sources) => {
|
|
22
|
+
const output = Object.assign({}, target);
|
|
23
|
+
if (!sources.length) {
|
|
24
|
+
return output;
|
|
25
|
+
}
|
|
26
|
+
const source = sources.shift();
|
|
27
|
+
if (isObject(target) && isObject(source)) {
|
|
28
|
+
Object.keys(source).forEach((key) => {
|
|
29
|
+
if (isObject(source[key])) {
|
|
30
|
+
if (!(key in target)) {
|
|
31
|
+
/* istanbul ignore next */
|
|
32
|
+
Object.assign(output, { [key]: source[key] });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
output[key] = mergeDeep(target[key], source[key]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
Object.assign(output, { [key]: source[key] });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return mergeDeep(output, ...sources);
|
|
26
44
|
};
|
|
27
|
-
|
|
45
|
+
/* istanbul ignore next */
|
|
46
|
+
const mergeAll = (array) => array.reduce((prev, next) => mergeDeep(prev, next), {});
|
|
28
47
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Default xhr configuration
|
|
50
|
+
*/
|
|
51
|
+
const DEFAULT_XHR_CONFIG = {
|
|
52
|
+
url: null,
|
|
53
|
+
method: 'GET',
|
|
54
|
+
responseType: 'json',
|
|
55
|
+
headers: {},
|
|
56
|
+
body: null,
|
|
57
|
+
withCredentials: false,
|
|
58
|
+
timeout: 0,
|
|
38
59
|
};
|
|
39
60
|
async function xhr(urlOrConfig) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
// create the configuration and apply the default values
|
|
62
|
+
let config = typeof urlOrConfig === 'string' ? { url: urlOrConfig } : urlOrConfig;
|
|
63
|
+
config = Object.assign({}, DEFAULT_XHR_CONFIG, config);
|
|
64
|
+
// create the promise
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
// configure and open the request
|
|
67
|
+
const request = new XMLHttpRequest();
|
|
68
|
+
request.open(config.method, config.url, true);
|
|
69
|
+
request.responseType = config.responseType;
|
|
70
|
+
Object.keys(config.headers || {}).map((name) => request.setRequestHeader(name, config.headers[name]));
|
|
71
|
+
request.withCredentials = config.withCredentials;
|
|
72
|
+
request.timeout = config.timeout;
|
|
73
|
+
// called in case of timeout
|
|
74
|
+
request.ontimeout = function () {
|
|
75
|
+
reject(`Request timeout after ${request.timeout} milliseconds`);
|
|
76
|
+
};
|
|
77
|
+
// called after the response is received
|
|
78
|
+
request.onload = function () {
|
|
79
|
+
if (request.status === 200) {
|
|
80
|
+
// the response is loaded properly
|
|
81
|
+
resolve(request.response);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// status error
|
|
85
|
+
reject(`Request failed with status ${request.status} (${request.statusText})`);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
// called in case of generic error
|
|
89
|
+
request.onerror = function () {
|
|
90
|
+
reject(`Request failed`);
|
|
91
|
+
};
|
|
92
|
+
// send the request
|
|
93
|
+
request.send(config.body);
|
|
94
|
+
});
|
|
64
95
|
}
|
|
96
|
+
/* eslint-enable */
|
|
65
97
|
|
|
66
|
-
|
|
98
|
+
/* eslint-disable */
|
|
67
99
|
function coerce(coerceFn, afterFn) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
100
|
+
return function (target, propertyKey) {
|
|
101
|
+
const _key = Symbol();
|
|
102
|
+
target[_key] = target[propertyKey];
|
|
103
|
+
Object.defineProperty(target, propertyKey, {
|
|
104
|
+
get: function () {
|
|
105
|
+
return this[_key];
|
|
106
|
+
},
|
|
107
|
+
set: afterFn ?
|
|
108
|
+
/* istanbul ignore next */
|
|
109
|
+
function (v) {
|
|
110
|
+
this[_key] = coerceFn.call(this, v, this);
|
|
111
|
+
afterFn.call(this, this[_key], this);
|
|
112
|
+
}
|
|
113
|
+
: function (v) {
|
|
114
|
+
this[_key] = coerceFn.call(this, v, this);
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
};
|
|
86
118
|
}
|
|
87
119
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var coerceElement = coerce(coerceElementProperty);
|
|
94
|
-
var coerceNumber = coerce(coerceNumberProperty);
|
|
120
|
+
const coerceBoolean = coerce(coerceBooleanProperty);
|
|
121
|
+
const coerceArray = coerce(coerceArray$1);
|
|
122
|
+
const coercePixel = coerce(coerceCssPixelValue);
|
|
123
|
+
const coerceElement = coerce(coerceElement$1);
|
|
124
|
+
const coerceNumber = coerce(coerceNumberProperty);
|
|
95
125
|
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
Object.assign(this, { ...info }, { ...errorFeedback }, { subErrors }, { errGroupMap });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
getFeedBacks(byKey) {
|
|
107
|
-
if (this.subErrors) {
|
|
108
|
-
return this.subErrors.filter((err) => {
|
|
109
|
-
if (err instanceof UxValidationErrorClass) {
|
|
110
|
-
if (byKey && err.attributes) {
|
|
111
|
-
return this.checkAttribute(byKey, err.attributes);
|
|
112
|
-
} else if (byKey && !err.attributes) {
|
|
113
|
-
return false;
|
|
114
|
-
} else if (!byKey) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
126
|
+
// TODO: on v18 replace any with no object as a type and declare it as breaking change
|
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
128
|
+
class UxErrorOutput {
|
|
129
|
+
constructor(info, errorFeedback, subErrors, errGroupMap) {
|
|
130
|
+
this.severity = UxMessageSeverity.danger;
|
|
131
|
+
if (!subErrors) {
|
|
132
|
+
Object.assign(this, { ...info }, { ...errorFeedback });
|
|
117
133
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
else {
|
|
135
|
+
Object.assign(this, { ...info }, { ...errorFeedback }, { subErrors }, { errGroupMap });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
getFeedBacks(byKey) {
|
|
139
|
+
if (this.subErrors) {
|
|
140
|
+
return this.subErrors
|
|
141
|
+
.filter((err) => {
|
|
142
|
+
if (err instanceof UxValidationErrorClass) {
|
|
143
|
+
if (byKey && err.attributes) {
|
|
144
|
+
return this.checkAttribute(byKey, err.attributes);
|
|
145
|
+
}
|
|
146
|
+
else if (byKey && !err.attributes) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
else if (!byKey) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
.map((err) => ({
|
|
155
|
+
msgId: err.msgId,
|
|
156
|
+
description: err.description,
|
|
157
|
+
severity: err.severity,
|
|
158
|
+
attributes: err.attributes,
|
|
159
|
+
errGroupId: err.errGroupId,
|
|
160
|
+
br: err.br,
|
|
161
|
+
doc: err.doc,
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
if (!byKey) {
|
|
166
|
+
return [{ msgId: this.msgId, description: this.description, severity: this.severity, doc: this.doc }];
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
checkAttribute(key, attributes) {
|
|
174
|
+
return attributes.some((attr) => key === attr.key);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
class UxErrorGroupOnClickEvent {
|
|
178
|
+
constructor(groupId, err) {
|
|
179
|
+
this.groupId = groupId;
|
|
180
|
+
this.err = err;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
145
183
|
var UxMessageSeverity;
|
|
146
|
-
(function(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
184
|
+
(function (UxMessageSeverity) {
|
|
185
|
+
UxMessageSeverity["info"] = "info";
|
|
186
|
+
UxMessageSeverity["warning"] = "warning";
|
|
187
|
+
UxMessageSeverity["danger"] = "danger";
|
|
188
|
+
UxMessageSeverity["success"] = "success";
|
|
151
189
|
})(UxMessageSeverity || (UxMessageSeverity = {}));
|
|
152
190
|
var UxMessageSeverityMetrics;
|
|
153
|
-
(function(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
191
|
+
(function (UxMessageSeverityMetrics) {
|
|
192
|
+
UxMessageSeverityMetrics[UxMessageSeverityMetrics["info"] = 0] = "info";
|
|
193
|
+
UxMessageSeverityMetrics[UxMessageSeverityMetrics["warning"] = 1] = "warning";
|
|
194
|
+
UxMessageSeverityMetrics[UxMessageSeverityMetrics["danger"] = 2] = "danger";
|
|
195
|
+
UxMessageSeverityMetrics[UxMessageSeverityMetrics["success"] = 3] = "success";
|
|
158
196
|
})(UxMessageSeverityMetrics || (UxMessageSeverityMetrics = {}));
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
};
|
|
170
|
-
var UxPublishErrorFeedbackEvent = class {
|
|
171
|
-
constructor(err, id, groupId, accumulate) {
|
|
172
|
-
this.err = err;
|
|
173
|
-
this.id = id;
|
|
174
|
-
this.groupId = groupId;
|
|
175
|
-
this.accumulate = accumulate;
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
var UxClearErrorFeedbackEvent = class {
|
|
179
|
-
constructor(id, groupId) {
|
|
180
|
-
this.id = id;
|
|
181
|
-
this.groupId = groupId;
|
|
182
|
-
}
|
|
197
|
+
class UxValidationErrorClass {
|
|
198
|
+
constructor(data) {
|
|
199
|
+
this.severity = UxMessageSeverity.danger;
|
|
200
|
+
Object.assign(this, data);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const transformToUxHttpResponse = (resp, mapper) => {
|
|
204
|
+
const updatedErr = resp;
|
|
205
|
+
updatedErr.uxHttpErrorOutput = mapper(resp.error);
|
|
206
|
+
return updatedErr;
|
|
183
207
|
};
|
|
208
|
+
class UxPublishErrorFeedbackEvent {
|
|
209
|
+
constructor(err, id, groupId, accumulate) {
|
|
210
|
+
this.err = err;
|
|
211
|
+
this.id = id;
|
|
212
|
+
this.groupId = groupId;
|
|
213
|
+
this.accumulate = accumulate;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
class UxClearErrorFeedbackEvent {
|
|
217
|
+
constructor(id, groupId) {
|
|
218
|
+
this.id = id;
|
|
219
|
+
this.groupId = groupId;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
184
222
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
223
|
+
class UxBadgeLegacy {
|
|
224
|
+
constructor(values = {}) {
|
|
225
|
+
this.typeClass = 'secondary';
|
|
226
|
+
Object.assign(this, values);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// TODO: on v18 replace any with no object as a type and declare it as breaking change
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
231
|
+
class UxLinkLegacy {
|
|
232
|
+
constructor(values = {}) {
|
|
233
|
+
this.urlExternalTarget = '_blank';
|
|
234
|
+
this.disabled = false;
|
|
235
|
+
this.hasIconBg = false;
|
|
236
|
+
this.active = false;
|
|
237
|
+
this.visible = true;
|
|
238
|
+
this.expanded = false;
|
|
239
|
+
this.hasMarker = false;
|
|
240
|
+
this.hasTag = false;
|
|
241
|
+
this.badgeTypeClass = 'secondary';
|
|
242
|
+
this.isHome = false;
|
|
243
|
+
this.isSeparator = false;
|
|
244
|
+
this.isScreenReaderClickable = false;
|
|
245
|
+
this.selected = false;
|
|
246
|
+
this.indeterminate = false;
|
|
247
|
+
Object.assign(this, values);
|
|
248
|
+
if (this.id === null || this.id === undefined) {
|
|
249
|
+
this.id = 'no_id';
|
|
250
|
+
}
|
|
251
|
+
this.e2eAttr = 'ux-link-e2e-' + this.id;
|
|
252
|
+
}
|
|
253
|
+
get hasChildren() {
|
|
254
|
+
return this.children != null;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
218
257
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
var getLocaleState = (state) => state.locale;
|
|
258
|
+
const getAppState = (state) => state.app;
|
|
259
|
+
const getUserState = (state) => state.user;
|
|
260
|
+
const getNotificationsState = (state) => state.notifications;
|
|
261
|
+
const getI18nState = (state) => state.i18n;
|
|
262
|
+
const getLocaleState = (state) => state.locale;
|
|
225
263
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
var getApiQueue = createSelector(getAppState, (state) => state.apiQueue);
|
|
235
|
-
var getApiQueueItem = (itemId) => createSelector(getAppState, (state) => state.apiQueue[itemId]);
|
|
264
|
+
const getAppVersion = createSelector(getAppState, (state) => state.version);
|
|
265
|
+
const getAppConnection = createSelector(getAppState, (state) => state.connected);
|
|
266
|
+
const getAppLoadedConfigModules = createSelector(getAppState, (state) => state.loadedConfigModules);
|
|
267
|
+
const getLastAddedModule = createSelector(getAppState, (state) => state.loadedConfigModules.lastAddedModule);
|
|
268
|
+
const getAppStatus = createSelector(getAppState, (state) => state.status);
|
|
269
|
+
const getCurrentModule = createSelector(getAppState, (state) => state.currentModule);
|
|
270
|
+
const getApiQueue = createSelector(getAppState, (state) => state.apiQueue);
|
|
271
|
+
const getApiQueueItem = (itemId) => createSelector(getAppState, (state) => state.apiQueue[itemId]);
|
|
236
272
|
|
|
237
|
-
|
|
238
|
-
import { createSelector as createSelector2 } from "reselect";
|
|
239
|
-
var getActiveLang = createSelector2(getI18nState, (state) => state.activeLang);
|
|
273
|
+
const getActiveLang = createSelector(getI18nState, (state) => state.activeLang);
|
|
240
274
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
275
|
+
const getUserDetails = createSelector(getUserState, (state) => state);
|
|
276
|
+
const getUserPreferences = createSelector(getUserState, (state) => state.preferences);
|
|
277
|
+
const getUserId = createSelector(getUserDetails, (state) => state.userId);
|
|
278
|
+
const getUserFirstName = createSelector(getUserDetails, (state) => state.firstName);
|
|
279
|
+
const getUserLastName = createSelector(getUserDetails, (state) => state.lastName);
|
|
280
|
+
const getUserFullName = createSelector(getUserDetails, (state) => state.fullName);
|
|
281
|
+
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
282
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
283
|
+
const getUserLocale = createSelector(getUserPreferences, (state) => state.locale);
|
|
284
|
+
const getUserLang = createSelector(getUserPreferences, (state) => state.lang);
|
|
285
|
+
const getUserRights = createSelector(getUserState, (state) => state.rights);
|
|
286
|
+
const getUserRight = (rightId) => createSelector(getUserRights, (state) => state.find((right) => right && right.id === rightId));
|
|
287
|
+
const getUserRightPermissions = (rightId) => createSelector(getUserRight(rightId), (state) => state && state.permissions);
|
|
288
|
+
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
289
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
290
|
+
const getUserDashboard = createSelector(getUserPreferences, (state) => state.dashboard);
|
|
255
291
|
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
|
|
292
|
+
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
293
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
294
|
+
const getNotificationsList = createSelector(getNotificationsState, (state) => state.list);
|
|
259
295
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
296
|
+
class EuiService {
|
|
297
|
+
constructor(defaultState) {
|
|
298
|
+
this.onStateChange = new Subject();
|
|
299
|
+
this.stateInstance = defaultState;
|
|
300
|
+
}
|
|
301
|
+
initEuiService() {
|
|
302
|
+
this.unSubscribe();
|
|
303
|
+
this.$stateSubs = this.getState().subscribe((newState) => {
|
|
304
|
+
// set previous state of service
|
|
305
|
+
this.prevStateInstance = this.copy(this.stateInstance);
|
|
306
|
+
// update state before emit event
|
|
307
|
+
this.stateInstance = this.copy(newState);
|
|
308
|
+
// inform about state change
|
|
309
|
+
this.onStateChange.next(newState);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
// updateStateProperty(property: keyof T, newVal) {
|
|
313
|
+
// if (typeof this.stateInstance === 'object') {
|
|
314
|
+
// this.updateState({
|
|
315
|
+
// ...this.stateInstance,
|
|
316
|
+
// [property]: {
|
|
317
|
+
// ...this.stateInstance[property],
|
|
318
|
+
// ...newVal,
|
|
319
|
+
// },
|
|
320
|
+
// });
|
|
321
|
+
// } else {
|
|
322
|
+
// console.log('This helper method can not be used except for objects');
|
|
323
|
+
// }
|
|
324
|
+
// }
|
|
325
|
+
unSubscribe() {
|
|
326
|
+
if (this.$stateSubs && this.$stateSubs.unsubscribe) {
|
|
327
|
+
this.$stateSubs.unsubscribe();
|
|
328
|
+
}
|
|
329
|
+
if (this.$stateLazyLoadSubs && this.$stateLazyLoadSubs.unsubscribe) {
|
|
330
|
+
this.$stateLazyLoadSubs.unsubscribe();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* returns a copy of the given value whether this value is object or primitive. For the arrays it will cover
|
|
335
|
+
* multidimensional arrays, but it will not cover an object that contain functions. JSON.parse and JSON.stringify
|
|
336
|
+
* might have performance issues on large scale objects but that's an edge case scenario. In case that happens in
|
|
337
|
+
* the future follow the technique of NGRX with function caching.
|
|
338
|
+
*
|
|
339
|
+
* @param state
|
|
340
|
+
*/
|
|
341
|
+
copy(state) {
|
|
342
|
+
if (typeof state === 'undefined') {
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
return JSON.parse(JSON.stringify(state));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
class EuiLazyService extends EuiService {
|
|
349
|
+
constructor(defaultState) {
|
|
350
|
+
super(defaultState);
|
|
351
|
+
}
|
|
352
|
+
// todo it should use abstract store service
|
|
353
|
+
initEuiService(storeForLazyLoad) {
|
|
354
|
+
super.initEuiService();
|
|
355
|
+
if (storeForLazyLoad) {
|
|
356
|
+
this.$stateLazyLoadSubs = storeForLazyLoad
|
|
357
|
+
.select(getAppLoadedConfigModules)
|
|
358
|
+
.pipe(filter((loadedConfigModules) => loadedConfigModules?.modulesConfig?.[loadedConfigModules.lastAddedModule] ? true : false), switchMap((loadedConfigModules) => this.lazyLoadInit(loadedConfigModules.modulesConfig[loadedConfigModules.lastAddedModule], loadedConfigModules.lastAddedModule)))
|
|
359
|
+
.subscribe(null);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
324
363
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
364
|
+
/**
|
|
365
|
+
* Abstract Log Appender
|
|
366
|
+
*/
|
|
367
|
+
class LogAppender {
|
|
368
|
+
constructor(config, injector = null) {
|
|
369
|
+
this.config = config;
|
|
370
|
+
this.injector = injector;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Gets the config
|
|
374
|
+
*
|
|
375
|
+
* @returns the config
|
|
376
|
+
*/
|
|
377
|
+
getConfig() {
|
|
378
|
+
return this.config;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
340
381
|
|
|
341
|
-
|
|
382
|
+
/** Log level */
|
|
342
383
|
var LogLevel;
|
|
343
|
-
(function(
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
384
|
+
(function (LogLevel) {
|
|
385
|
+
LogLevel[LogLevel["OFF"] = 0] = "OFF";
|
|
386
|
+
LogLevel[LogLevel["FATAL"] = 1] = "FATAL";
|
|
387
|
+
LogLevel[LogLevel["ERROR"] = 2] = "ERROR";
|
|
388
|
+
LogLevel[LogLevel["WARN"] = 3] = "WARN";
|
|
389
|
+
LogLevel[LogLevel["INFO"] = 4] = "INFO";
|
|
390
|
+
LogLevel[LogLevel["DEBUG"] = 5] = "DEBUG";
|
|
391
|
+
LogLevel[LogLevel["TRACE"] = 6] = "TRACE";
|
|
392
|
+
LogLevel[LogLevel["ALL"] = 7] = "ALL";
|
|
352
393
|
})(LogLevel || (LogLevel = {}));
|
|
394
|
+
/** Associated log level names */
|
|
353
395
|
var LogLevelName;
|
|
354
|
-
(function(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
396
|
+
(function (LogLevelName) {
|
|
397
|
+
LogLevelName["FATAL"] = "FATAL";
|
|
398
|
+
LogLevelName["ERROR"] = "ERROR";
|
|
399
|
+
LogLevelName["WARN"] = "WARNING";
|
|
400
|
+
LogLevelName["INFO"] = "INFO";
|
|
401
|
+
LogLevelName["DEBUG"] = "DEBUG";
|
|
402
|
+
LogLevelName["TRACE"] = "TRACE";
|
|
361
403
|
})(LogLevelName || (LogLevelName = {}));
|
|
362
404
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
};
|
|
370
|
-
var ConsoleAppender = class extends LogAppender {
|
|
371
|
-
constructor(config = {}) {
|
|
372
|
-
super(config);
|
|
373
|
-
this.config = config;
|
|
374
|
-
config.prefixConverters = Object.assign({}, DEFAULT_CONSOLE_APPENDER_PREFIX_CONVERTERS, config.prefixConverters);
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Logs an event in the console
|
|
378
|
-
*/
|
|
379
|
-
append(event) {
|
|
380
|
-
const prefix = this.getPrefix(event);
|
|
381
|
-
const messages = prefix ? [prefix, ...event.messages] : event.messages;
|
|
382
|
-
switch (event.level) {
|
|
383
|
-
case LogLevel.FATAL:
|
|
384
|
-
case LogLevel.ERROR:
|
|
385
|
-
console.error(...messages);
|
|
386
|
-
break;
|
|
387
|
-
case LogLevel.WARN:
|
|
388
|
-
console.warn(...messages);
|
|
389
|
-
break;
|
|
390
|
-
default:
|
|
391
|
-
console.log(...messages);
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Returns the prefix to be added to the messages
|
|
397
|
-
*
|
|
398
|
-
* @param event the log event
|
|
399
|
-
* @returns the formatted prefix, as string
|
|
400
|
-
*/
|
|
401
|
-
getPrefix(event) {
|
|
402
|
-
if (!this.config || !this.config.prefixFormat) {
|
|
403
|
-
return null;
|
|
404
|
-
}
|
|
405
|
-
let prefix = this.config.prefixFormat;
|
|
406
|
-
Object.keys(this.config.prefixConverters).forEach((key) => {
|
|
407
|
-
prefix = this.convert(prefix, key, this.config.prefixConverters[key](event));
|
|
408
|
-
});
|
|
409
|
-
return prefix;
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Utility method to replace a placeholder
|
|
413
|
-
*
|
|
414
|
-
* @param str the string with placeholders
|
|
415
|
-
* @param find the placeholder
|
|
416
|
-
* @param replace the string to replace the placeholder
|
|
417
|
-
* @returns the converted string
|
|
418
|
-
*/
|
|
419
|
-
convert(str, find, replace) {
|
|
420
|
-
return str.replace(new RegExp(find, "g"), replace);
|
|
421
|
-
}
|
|
405
|
+
/** Default console prefix converters */
|
|
406
|
+
const DEFAULT_CONSOLE_APPENDER_PREFIX_CONVERTERS = {
|
|
407
|
+
'{level}': (event) => event.levelName,
|
|
408
|
+
'{logger}': (event) => event.loggerName,
|
|
409
|
+
'{date}': (event) => event.timestamp.toLocaleDateString(),
|
|
410
|
+
'{time}': (event) => event.timestamp.toLocaleTimeString(),
|
|
422
411
|
};
|
|
412
|
+
/**
|
|
413
|
+
* Console Appender
|
|
414
|
+
*/
|
|
415
|
+
class ConsoleAppender extends LogAppender {
|
|
416
|
+
constructor(config = {}) {
|
|
417
|
+
super(config);
|
|
418
|
+
this.config = config;
|
|
419
|
+
// apply the default prefix converters
|
|
420
|
+
config.prefixConverters = Object.assign({}, DEFAULT_CONSOLE_APPENDER_PREFIX_CONVERTERS, config.prefixConverters);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Logs an event in the console
|
|
424
|
+
*/
|
|
425
|
+
append(event) {
|
|
426
|
+
// retrieve the prefix
|
|
427
|
+
const prefix = this.getPrefix(event);
|
|
428
|
+
// append it to the message array
|
|
429
|
+
const messages = prefix ? [prefix, ...event.messages] : event.messages;
|
|
430
|
+
// log the event in the console
|
|
431
|
+
switch (event.level) {
|
|
432
|
+
case LogLevel.FATAL:
|
|
433
|
+
case LogLevel.ERROR:
|
|
434
|
+
console.error(...messages);
|
|
435
|
+
break;
|
|
436
|
+
case LogLevel.WARN:
|
|
437
|
+
console.warn(...messages);
|
|
438
|
+
break;
|
|
439
|
+
default:
|
|
440
|
+
console.log(...messages);
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Returns the prefix to be added to the messages
|
|
446
|
+
*
|
|
447
|
+
* @param event the log event
|
|
448
|
+
* @returns the formatted prefix, as string
|
|
449
|
+
*/
|
|
450
|
+
getPrefix(event) {
|
|
451
|
+
// in case of no prefixFormat, return null
|
|
452
|
+
if (!this.config || !this.config.prefixFormat) {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
// start creating the prefix from the format
|
|
456
|
+
let prefix = this.config.prefixFormat;
|
|
457
|
+
// apply the prefix converters
|
|
458
|
+
Object.keys(this.config.prefixConverters).forEach((key) => {
|
|
459
|
+
prefix = this.convert(prefix, key, this.config.prefixConverters[key](event));
|
|
460
|
+
});
|
|
461
|
+
return prefix;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Utility method to replace a placeholder
|
|
465
|
+
*
|
|
466
|
+
* @param str the string with placeholders
|
|
467
|
+
* @param find the placeholder
|
|
468
|
+
* @param replace the string to replace the placeholder
|
|
469
|
+
* @returns the converted string
|
|
470
|
+
*/
|
|
471
|
+
convert(str, find, replace) {
|
|
472
|
+
return str.replace(new RegExp(find, 'g'), replace);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
423
475
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
476
|
+
/**
|
|
477
|
+
* Logger
|
|
478
|
+
*/
|
|
479
|
+
class Logger {
|
|
480
|
+
constructor(name, level, appenders) {
|
|
481
|
+
this.name = name;
|
|
482
|
+
this.level = level;
|
|
483
|
+
this.appenders = appenders;
|
|
484
|
+
this.isDisabled = () => this.level === LogLevel.OFF;
|
|
485
|
+
this.isEnabledFor = (level) => Logger.isEnabledFor(this.level, level);
|
|
486
|
+
this.isFatalEnabled = () => this.isEnabledFor(LogLevel.FATAL);
|
|
487
|
+
this.isErrorEnabled = () => this.isEnabledFor(LogLevel.ERROR);
|
|
488
|
+
this.isWarnEnabled = () => this.isEnabledFor(LogLevel.WARN);
|
|
489
|
+
this.isInfoEnabled = () => this.isEnabledFor(LogLevel.INFO);
|
|
490
|
+
this.isDebugEnabled = () => this.isEnabledFor(LogLevel.DEBUG);
|
|
491
|
+
this.isTraceEnabled = () => this.isEnabledFor(LogLevel.TRACE);
|
|
492
|
+
this.isAllEnabled = () => this.isEnabledFor(LogLevel.ALL);
|
|
493
|
+
}
|
|
494
|
+
static isEnabledFor(enabledFromLevel, level) {
|
|
495
|
+
return enabledFromLevel >= level;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Gets the logger name
|
|
499
|
+
*
|
|
500
|
+
* @returns the logger name
|
|
501
|
+
*/
|
|
502
|
+
getName() {
|
|
503
|
+
return this.name;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Gets the log level
|
|
507
|
+
*
|
|
508
|
+
* @returns the log level
|
|
509
|
+
*/
|
|
510
|
+
getLevel() {
|
|
511
|
+
return this.level;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Sets the log level
|
|
515
|
+
*
|
|
516
|
+
* @param level log level
|
|
517
|
+
*/
|
|
518
|
+
setLevel(level) {
|
|
519
|
+
this.level = level;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Fatal log
|
|
523
|
+
*
|
|
524
|
+
* @param message mandatory message
|
|
525
|
+
* @param additionalMessages optional messages
|
|
526
|
+
*/
|
|
527
|
+
fatal(message, ...additionalMessages) {
|
|
528
|
+
return this.log({
|
|
529
|
+
level: LogLevel.FATAL,
|
|
530
|
+
levelName: LogLevelName.FATAL,
|
|
531
|
+
loggerName: this.name,
|
|
532
|
+
timestamp: new Date(),
|
|
533
|
+
messages: [message, ...additionalMessages],
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Error log
|
|
538
|
+
*
|
|
539
|
+
* @param message mandatory message
|
|
540
|
+
* @param additionalMessages optional messages
|
|
541
|
+
*/
|
|
542
|
+
error(message, ...additionalMessages) {
|
|
543
|
+
return this.log({
|
|
544
|
+
level: LogLevel.ERROR,
|
|
545
|
+
levelName: LogLevelName.ERROR,
|
|
546
|
+
loggerName: this.name,
|
|
547
|
+
timestamp: new Date(),
|
|
548
|
+
messages: [message, ...additionalMessages],
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Warning log
|
|
553
|
+
*
|
|
554
|
+
* @param message mandatory message
|
|
555
|
+
* @param additionalMessages optional messages
|
|
556
|
+
*/
|
|
557
|
+
warn(message, ...additionalMessages) {
|
|
558
|
+
return this.log({
|
|
559
|
+
level: LogLevel.WARN,
|
|
560
|
+
levelName: LogLevelName.WARN,
|
|
561
|
+
loggerName: this.name,
|
|
562
|
+
timestamp: new Date(),
|
|
563
|
+
messages: [message, ...additionalMessages],
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Info log
|
|
568
|
+
*
|
|
569
|
+
* @param message mandatory message
|
|
570
|
+
* @param additionalMessages optional messages
|
|
571
|
+
*/
|
|
572
|
+
info(message, ...additionalMessages) {
|
|
573
|
+
return this.log({
|
|
574
|
+
level: LogLevel.INFO,
|
|
575
|
+
levelName: LogLevelName.INFO,
|
|
576
|
+
loggerName: this.name,
|
|
577
|
+
timestamp: new Date(),
|
|
578
|
+
messages: [message, ...additionalMessages],
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Debug log
|
|
583
|
+
*
|
|
584
|
+
* @param message mandatory message
|
|
585
|
+
* @param additionalMessages optional messages
|
|
586
|
+
*/
|
|
587
|
+
debug(message, ...additionalMessages) {
|
|
588
|
+
return this.log({
|
|
589
|
+
level: LogLevel.DEBUG,
|
|
590
|
+
levelName: LogLevelName.DEBUG,
|
|
591
|
+
loggerName: this.name,
|
|
592
|
+
timestamp: new Date(),
|
|
593
|
+
messages: [message, ...additionalMessages],
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Trace log
|
|
598
|
+
*
|
|
599
|
+
* @param message mandatory message
|
|
600
|
+
* @param additionalMessages optional messages
|
|
601
|
+
*/
|
|
602
|
+
trace(message, ...additionalMessages) {
|
|
603
|
+
return this.log({
|
|
604
|
+
level: LogLevel.TRACE,
|
|
605
|
+
levelName: LogLevelName.TRACE,
|
|
606
|
+
loggerName: this.name,
|
|
607
|
+
timestamp: new Date(),
|
|
608
|
+
messages: [message, ...additionalMessages],
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Generic log method, checking the log level and calling the specified appenders
|
|
613
|
+
*
|
|
614
|
+
* @param event the log event
|
|
615
|
+
*/
|
|
616
|
+
log(event) {
|
|
617
|
+
this.appenders
|
|
618
|
+
// filter the appender by their custom logLevel or the logger (main) logLevel
|
|
619
|
+
.filter((appender) => Logger.isEnabledFor(appender.getConfig().logLevel || this.level, event.level), this)
|
|
620
|
+
// execute the remaining appenders
|
|
621
|
+
.forEach((appender) => appender.append(event));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
566
624
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
625
|
+
class LoggerMock extends Logger {
|
|
626
|
+
constructor() {
|
|
627
|
+
super(null, null, null);
|
|
628
|
+
this.isDisabled = () => false;
|
|
629
|
+
this.isEnabledFor = () => false;
|
|
630
|
+
this.isFatalEnabled = () => false;
|
|
631
|
+
this.isErrorEnabled = () => false;
|
|
632
|
+
this.isWarnEnabled = () => false;
|
|
633
|
+
this.isInfoEnabled = () => false;
|
|
634
|
+
this.isDebugEnabled = () => false;
|
|
635
|
+
this.isTraceEnabled = () => false;
|
|
636
|
+
this.isAllEnabled = () => false;
|
|
637
|
+
}
|
|
638
|
+
getLevel() {
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
641
|
+
setLevel() {
|
|
642
|
+
/* empty */
|
|
643
|
+
}
|
|
644
|
+
fatal() {
|
|
645
|
+
/* empty */
|
|
646
|
+
}
|
|
647
|
+
error() {
|
|
648
|
+
/* empty */
|
|
649
|
+
}
|
|
650
|
+
warn() {
|
|
651
|
+
/* empty */
|
|
652
|
+
}
|
|
653
|
+
info() {
|
|
654
|
+
/* empty */
|
|
655
|
+
}
|
|
656
|
+
debug() {
|
|
657
|
+
/* empty */
|
|
658
|
+
}
|
|
659
|
+
trace() {
|
|
660
|
+
/* empty */
|
|
661
|
+
}
|
|
662
|
+
}
|
|
599
663
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Logs an event to a server
|
|
614
|
-
*/
|
|
615
|
-
append(event) {
|
|
616
|
-
if (this.http) {
|
|
617
|
-
this.http.post(this.config.url, this.toUrlEvent(event)).subscribe();
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
/**
|
|
621
|
-
* Maps a LogEvent into a UrlLogEvent
|
|
622
|
-
*/
|
|
623
|
-
toUrlEvent(event) {
|
|
624
|
-
const toUrlEvent = this.config.detailedEventFromLevel && Logger.isEnabledFor(this.config.detailedEventFromLevel, event.level);
|
|
625
|
-
return toUrlEvent ? Object.assign({}, this.filterErrorType(event), {
|
|
626
|
-
position: this.getPosition(),
|
|
627
|
-
location: this.getLocation()
|
|
628
|
-
}) : event;
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* returns the code position from where the log has been triggered
|
|
632
|
-
*/
|
|
633
|
-
getPosition() {
|
|
634
|
-
const error = new Error();
|
|
635
|
-
try {
|
|
636
|
-
throw error;
|
|
637
|
-
} catch (e) {
|
|
638
|
-
try {
|
|
639
|
-
let stackLine = error.stack.split("\n")[3].trim();
|
|
640
|
-
if (stackLine.startsWith("at ")) {
|
|
641
|
-
stackLine = stackLine.substring("at ".length);
|
|
664
|
+
/**
|
|
665
|
+
* Url Appender
|
|
666
|
+
*/
|
|
667
|
+
class UrlAppender extends LogAppender {
|
|
668
|
+
constructor(config, injector) {
|
|
669
|
+
super(config, injector);
|
|
670
|
+
this.config = config;
|
|
671
|
+
this.injector = injector;
|
|
672
|
+
// set the http client
|
|
673
|
+
this.http = injector && injector.get(HttpClient, null);
|
|
674
|
+
if (!this.http) {
|
|
675
|
+
console.error('UrlAppender needs HttpClient service to be defined as a provider.');
|
|
642
676
|
}
|
|
643
|
-
|
|
644
|
-
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Logs an event to a server
|
|
680
|
+
*/
|
|
681
|
+
append(event) {
|
|
682
|
+
// eventual http errors will be caught by the HttpErrorHandlerInterceptor
|
|
683
|
+
if (this.http) {
|
|
684
|
+
this.http.post(this.config.url, this.toUrlEvent(event)).subscribe();
|
|
645
685
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Maps a LogEvent into a UrlLogEvent
|
|
689
|
+
*/
|
|
690
|
+
toUrlEvent(event) {
|
|
691
|
+
// check if the urlEventFromLevel allows the mapping to url log event
|
|
692
|
+
const toUrlEvent = this.config.detailedEventFromLevel && Logger.isEnabledFor(this.config.detailedEventFromLevel, event.level);
|
|
693
|
+
// returns the url event or the regular log event
|
|
694
|
+
return toUrlEvent
|
|
695
|
+
? Object.assign({}, this.filterErrorType(event), {
|
|
696
|
+
position: this.getPosition(),
|
|
697
|
+
location: this.getLocation(),
|
|
698
|
+
})
|
|
699
|
+
: event;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* returns the code position from where the log has been triggered
|
|
703
|
+
*/
|
|
704
|
+
getPosition() {
|
|
705
|
+
// create a dummy error, just for the stack trace
|
|
706
|
+
const error = new Error();
|
|
707
|
+
try {
|
|
708
|
+
// throw it ...
|
|
709
|
+
throw error;
|
|
653
710
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
711
|
+
catch (e) {
|
|
712
|
+
// ... and catch it
|
|
713
|
+
try {
|
|
714
|
+
// extract the correct stack line
|
|
715
|
+
let stackLine = error.stack.split('\n')[3].trim();
|
|
716
|
+
if (stackLine.startsWith('at ')) {
|
|
717
|
+
stackLine = stackLine.substring('at '.length);
|
|
718
|
+
}
|
|
719
|
+
// if the path is specified in parentheses
|
|
720
|
+
if (stackLine.lastIndexOf('(') > 0) {
|
|
721
|
+
stackLine = stackLine.substring(stackLine.lastIndexOf('(') + 1, stackLine.indexOf(')'));
|
|
722
|
+
}
|
|
723
|
+
// strip base path, then parse file, line and column
|
|
724
|
+
const data = stackLine.substring(stackLine.lastIndexOf('/') + 1).split(':');
|
|
725
|
+
// if the data is parsed correctly
|
|
726
|
+
if (data.length === 3) {
|
|
727
|
+
return {
|
|
728
|
+
file: data[0],
|
|
729
|
+
line: +data[1],
|
|
730
|
+
column: +data[2],
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
catch (err) {
|
|
735
|
+
/* empty */
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
/* istanbul ignore next */
|
|
739
|
+
return null;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* returns the url of the current page
|
|
743
|
+
*/
|
|
744
|
+
getLocation() {
|
|
745
|
+
return window && window.location && window.location.href;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* check messages if object type is Error and make its properties enumerable
|
|
749
|
+
*/
|
|
750
|
+
filterErrorType(event) {
|
|
751
|
+
event.messages = event.messages.map((m) => (m instanceof Error ? Object.getOwnPropertyDescriptors(m) : m));
|
|
752
|
+
return event;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
673
755
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return { languages, defaultLanguage };
|
|
756
|
+
const getI18nServiceConfigFromBase = (baseGlobalConfig) => {
|
|
757
|
+
if (!baseGlobalConfig)
|
|
758
|
+
throw new Error('baseGlobalConfig is required');
|
|
759
|
+
const i18nServiceConfig = baseGlobalConfig && baseGlobalConfig.i18n && baseGlobalConfig.i18n.i18nService;
|
|
760
|
+
const { languages, defaultLanguage } = getI18nServiceConfig(i18nServiceConfig);
|
|
761
|
+
return { languages, defaultLanguage };
|
|
681
762
|
};
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
763
|
+
const getI18nServiceConfig = (config) => Object.assign({}, config);
|
|
764
|
+
const getI18nLoaderConfig = (config) => {
|
|
765
|
+
const { i18nFolders, i18nServices, i18nResources } = Object.assign({}, config);
|
|
766
|
+
return { i18nFolders, i18nServices, i18nResources };
|
|
686
767
|
};
|
|
687
|
-
|
|
688
|
-
|
|
768
|
+
/**
|
|
769
|
+
* returns a language code based on https://tools.ietf.org/rfc/bcp/bcp47.txt specification. To get the Browser's
|
|
770
|
+
* it's using the navigator.language, splits by hyphen and get the first part.
|
|
771
|
+
*/
|
|
772
|
+
const getBrowserDefaultLanguage = () => navigator.language.split('-')[0];
|
|
773
|
+
/**
|
|
774
|
+
* returns an array of DOMStrings representing the user's preferred languages. The language is described using BCP 47
|
|
775
|
+
* language tags. In the returned array they are ordered by preference with the most preferred language first.
|
|
776
|
+
* The array languages will be lower cased 2 char code.
|
|
777
|
+
*/
|
|
778
|
+
const getBrowserPreferredLanguages = () => navigator.languages.map((lang) => lang.split('-')[0]);
|
|
689
779
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
780
|
+
/**
|
|
781
|
+
* responsible to extract the attributes "available" and "id" from the locale configuration
|
|
782
|
+
*/
|
|
783
|
+
const getLocaleServiceConfigFromBase = (baseGlobalConfig) => {
|
|
784
|
+
const { available, id, bindWithTranslate, affectGlobalLocale } = baseGlobalConfig.locale;
|
|
785
|
+
return { available, id, bindWithTranslate, affectGlobalLocale };
|
|
694
786
|
};
|
|
695
787
|
|
|
696
|
-
//
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
788
|
+
// TODO: move this to externals since Dashboard functionality moved there
|
|
789
|
+
// export interface UserDashboard extends WidgetDashboard {}
|
|
790
|
+
const initialUserPreferences = Object.assign({}, {
|
|
791
|
+
lang: null,
|
|
792
|
+
dashboard: null,
|
|
700
793
|
});
|
|
701
794
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
apiQueue: {}
|
|
795
|
+
const initialAppState = Object.assign({}, {
|
|
796
|
+
version: '0.0.0',
|
|
797
|
+
connected: true,
|
|
798
|
+
loadedConfigModules: {
|
|
799
|
+
modulesConfig: {},
|
|
800
|
+
},
|
|
801
|
+
status: 'idle',
|
|
802
|
+
currentModule: '',
|
|
803
|
+
apiQueue: {},
|
|
712
804
|
});
|
|
713
805
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
rights: []
|
|
806
|
+
const initialUserState = Object.assign({}, {
|
|
807
|
+
userId: '',
|
|
808
|
+
firstName: '',
|
|
809
|
+
lastName: '',
|
|
810
|
+
fullName: '',
|
|
811
|
+
preferences: initialUserPreferences,
|
|
812
|
+
rights: [],
|
|
722
813
|
});
|
|
723
814
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
list: []
|
|
815
|
+
const initialNotificationsState = {
|
|
816
|
+
list: [],
|
|
727
817
|
};
|
|
728
818
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
activeLang: null
|
|
819
|
+
const initialI18nState = {
|
|
820
|
+
activeLang: null,
|
|
732
821
|
};
|
|
733
822
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
id: "en"
|
|
823
|
+
const initialLocaleState = {
|
|
824
|
+
id: 'en',
|
|
737
825
|
};
|
|
738
826
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
locale: initialLocaleState
|
|
827
|
+
const initialCoreState = Object.assign({}, {
|
|
828
|
+
app: initialAppState,
|
|
829
|
+
user: initialUserState,
|
|
830
|
+
notifications: initialNotificationsState,
|
|
831
|
+
i18n: initialI18nState,
|
|
832
|
+
locale: initialLocaleState,
|
|
746
833
|
});
|
|
747
834
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
pageWindowSize: 5
|
|
754
|
-
};
|
|
755
|
-
var EuiPagination = class _EuiPagination {
|
|
756
|
-
constructor(totalItems = DefaultConfig.totalItems, pageSize = DefaultConfig.pageSize, currentPage = DefaultConfig.currentPage, pageWindowSize = DefaultConfig.pageWindowSize) {
|
|
757
|
-
this.totalItems = totalItems;
|
|
758
|
-
this.pageSize = pageSize;
|
|
759
|
-
this.currentPage = currentPage;
|
|
760
|
-
this.pageWindowSize = pageWindowSize;
|
|
761
|
-
}
|
|
762
|
-
static create(config = DefaultConfig) {
|
|
763
|
-
if (config.totalItems < 0) {
|
|
764
|
-
throw new Error("total items cannot be negative");
|
|
765
|
-
}
|
|
766
|
-
if (config.pageSize <= 0) {
|
|
767
|
-
throw new Error("page size must be bigger than zero");
|
|
768
|
-
}
|
|
769
|
-
if (config.pageWindowSize <= 0) {
|
|
770
|
-
throw new Error("page window size must be bigger than zero");
|
|
771
|
-
}
|
|
772
|
-
return new _EuiPagination(config.totalItems, config.pageSize, config.currentPage, config.pageWindowSize);
|
|
773
|
-
}
|
|
774
|
-
getFirstPage() {
|
|
775
|
-
return 1;
|
|
776
|
-
}
|
|
777
|
-
getLastPage() {
|
|
778
|
-
return this.getPagesCount();
|
|
779
|
-
}
|
|
780
|
-
isFirstPageActive() {
|
|
781
|
-
return this.getCurrentPage() === 1;
|
|
782
|
-
}
|
|
783
|
-
isLastPageActive() {
|
|
784
|
-
return this.getCurrentPage() === this.getPagesCount();
|
|
785
|
-
}
|
|
786
|
-
hasItems() {
|
|
787
|
-
return this.getTotalItems() > 0;
|
|
788
|
-
}
|
|
789
|
-
getPagesCount() {
|
|
790
|
-
const pagesCount = Math.ceil(this.totalItems / this.pageSize);
|
|
791
|
-
return Math.max(pagesCount, 1);
|
|
792
|
-
}
|
|
793
|
-
getPages() {
|
|
794
|
-
const pageWindowSize = this.getPageWindowSize();
|
|
795
|
-
const pagesCount = this.getPagesCount();
|
|
796
|
-
const currentPage = this.getCurrentPage();
|
|
797
|
-
let leftPageWindowSize;
|
|
798
|
-
let rightPageWindowSize;
|
|
799
|
-
let startPage;
|
|
800
|
-
let endPage;
|
|
801
|
-
const truncatedPageWindowSize = Math.min(...[this.getPageWindowSize(), this.getPagesCount()]);
|
|
802
|
-
if (truncatedPageWindowSize % 2 === 0) {
|
|
803
|
-
leftPageWindowSize = truncatedPageWindowSize / 2 - 1;
|
|
804
|
-
rightPageWindowSize = leftPageWindowSize + 1;
|
|
805
|
-
} else {
|
|
806
|
-
leftPageWindowSize = rightPageWindowSize = Math.floor(pageWindowSize / 2);
|
|
807
|
-
}
|
|
808
|
-
if (currentPage <= leftPageWindowSize) {
|
|
809
|
-
startPage = 1;
|
|
810
|
-
endPage = truncatedPageWindowSize;
|
|
811
|
-
} else if (currentPage > pagesCount - rightPageWindowSize) {
|
|
812
|
-
startPage = pagesCount - truncatedPageWindowSize + 1;
|
|
813
|
-
endPage = pagesCount;
|
|
814
|
-
} else {
|
|
815
|
-
startPage = currentPage - leftPageWindowSize;
|
|
816
|
-
endPage = currentPage + rightPageWindowSize;
|
|
817
|
-
}
|
|
818
|
-
return range(startPage, endPage + 1);
|
|
819
|
-
}
|
|
820
|
-
goToPage(page) {
|
|
821
|
-
const pagesCount = this.getPagesCount();
|
|
822
|
-
const upperTrunc = Math.min(...[page, pagesCount]);
|
|
823
|
-
const truncated = Math.max(...[upperTrunc, 1]);
|
|
824
|
-
this.currentPage = truncated;
|
|
825
|
-
}
|
|
826
|
-
goToFirstPage() {
|
|
827
|
-
this.goToPage(1);
|
|
828
|
-
}
|
|
829
|
-
goToLastPage() {
|
|
830
|
-
const lastPage = this.getPagesCount();
|
|
831
|
-
this.goToPage(lastPage);
|
|
832
|
-
}
|
|
833
|
-
goToNextPage() {
|
|
834
|
-
const nextPage = this.getCurrentPage() + 1;
|
|
835
|
-
this.goToPage(nextPage);
|
|
836
|
-
}
|
|
837
|
-
goToPreviousPage() {
|
|
838
|
-
const previousPage = this.getCurrentPage() - 1;
|
|
839
|
-
this.goToPage(previousPage);
|
|
840
|
-
}
|
|
841
|
-
hasPreviousPage() {
|
|
842
|
-
return this.getCurrentPage() > 1;
|
|
843
|
-
}
|
|
844
|
-
hasNextPage() {
|
|
845
|
-
return this.getCurrentPage() < this.getPagesCount();
|
|
846
|
-
}
|
|
847
|
-
getTotalItems() {
|
|
848
|
-
return this.totalItems;
|
|
849
|
-
}
|
|
850
|
-
getPageSize() {
|
|
851
|
-
return this.pageSize;
|
|
852
|
-
}
|
|
853
|
-
setPageSize(size) {
|
|
854
|
-
const truncated = Math.max(...[size, 1]);
|
|
855
|
-
this.pageSize = truncated;
|
|
856
|
-
}
|
|
857
|
-
getCurrentPage() {
|
|
858
|
-
return this.currentPage;
|
|
859
|
-
}
|
|
860
|
-
getPageWindowSize() {
|
|
861
|
-
return this.pageWindowSize;
|
|
862
|
-
}
|
|
863
|
-
setPageWindowSize(size) {
|
|
864
|
-
const truncated = Math.max(...[size, 1]);
|
|
865
|
-
this.pageWindowSize = truncated;
|
|
866
|
-
}
|
|
867
|
-
getShowingFrom() {
|
|
868
|
-
const startingIndex = (this.getCurrentPage() - 1) * this.getPageSize();
|
|
869
|
-
let startingPage = startingIndex + 1;
|
|
870
|
-
if (!this.hasItems()) {
|
|
871
|
-
startingPage = 0;
|
|
872
|
-
}
|
|
873
|
-
return startingPage;
|
|
874
|
-
}
|
|
875
|
-
getShowingTo() {
|
|
876
|
-
const displayStartItem = this.getShowingFrom();
|
|
877
|
-
const pageSize = this.getPageSize();
|
|
878
|
-
const totalItems = this.getTotalItems();
|
|
879
|
-
if (!this.hasItems()) {
|
|
880
|
-
return 0;
|
|
881
|
-
}
|
|
882
|
-
const pageEnd = Math.min(...[displayStartItem + pageSize - 1, totalItems]);
|
|
883
|
-
return pageEnd;
|
|
884
|
-
}
|
|
835
|
+
const DefaultConfig = {
|
|
836
|
+
totalItems: 0,
|
|
837
|
+
pageSize: 10,
|
|
838
|
+
currentPage: 1,
|
|
839
|
+
pageWindowSize: 5,
|
|
885
840
|
};
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
841
|
+
class EuiPagination {
|
|
842
|
+
constructor(totalItems = DefaultConfig.totalItems, pageSize = DefaultConfig.pageSize, currentPage = DefaultConfig.currentPage, pageWindowSize = DefaultConfig.pageWindowSize) {
|
|
843
|
+
this.totalItems = totalItems;
|
|
844
|
+
this.pageSize = pageSize;
|
|
845
|
+
this.currentPage = currentPage;
|
|
846
|
+
this.pageWindowSize = pageWindowSize;
|
|
847
|
+
}
|
|
848
|
+
static create(config = DefaultConfig) {
|
|
849
|
+
if (config.totalItems < 0) {
|
|
850
|
+
throw new Error('total items cannot be negative');
|
|
851
|
+
}
|
|
852
|
+
if (config.pageSize <= 0) {
|
|
853
|
+
throw new Error('page size must be bigger than zero');
|
|
854
|
+
}
|
|
855
|
+
if (config.pageWindowSize <= 0) {
|
|
856
|
+
throw new Error('page window size must be bigger than zero');
|
|
857
|
+
}
|
|
858
|
+
return new EuiPagination(config.totalItems, config.pageSize, config.currentPage, config.pageWindowSize);
|
|
859
|
+
}
|
|
860
|
+
getFirstPage() {
|
|
861
|
+
return 1;
|
|
862
|
+
}
|
|
863
|
+
getLastPage() {
|
|
864
|
+
return this.getPagesCount();
|
|
865
|
+
}
|
|
866
|
+
isFirstPageActive() {
|
|
867
|
+
return this.getCurrentPage() === 1;
|
|
868
|
+
}
|
|
869
|
+
isLastPageActive() {
|
|
870
|
+
return this.getCurrentPage() === this.getPagesCount();
|
|
871
|
+
}
|
|
872
|
+
hasItems() {
|
|
873
|
+
return this.getTotalItems() > 0;
|
|
874
|
+
}
|
|
875
|
+
getPagesCount() {
|
|
876
|
+
const pagesCount = Math.ceil(this.totalItems / this.pageSize);
|
|
877
|
+
return Math.max(pagesCount, 1);
|
|
878
|
+
}
|
|
879
|
+
getPages() {
|
|
880
|
+
const pageWindowSize = this.getPageWindowSize();
|
|
881
|
+
const pagesCount = this.getPagesCount();
|
|
882
|
+
const currentPage = this.getCurrentPage();
|
|
883
|
+
let leftPageWindowSize;
|
|
884
|
+
let rightPageWindowSize;
|
|
885
|
+
let startPage;
|
|
886
|
+
let endPage;
|
|
887
|
+
// should not be bigger than pages count
|
|
888
|
+
const truncatedPageWindowSize = Math.min(...[this.getPageWindowSize(), this.getPagesCount()]);
|
|
889
|
+
if (truncatedPageWindowSize % 2 === 0) {
|
|
890
|
+
// nonsymetrical pager (...*....)
|
|
891
|
+
leftPageWindowSize = truncatedPageWindowSize / 2 - 1;
|
|
892
|
+
rightPageWindowSize = leftPageWindowSize + 1;
|
|
893
|
+
}
|
|
894
|
+
else {
|
|
895
|
+
// symmetrical pager (...*...)
|
|
896
|
+
leftPageWindowSize = rightPageWindowSize = Math.floor(pageWindowSize / 2);
|
|
897
|
+
}
|
|
898
|
+
if (currentPage <= leftPageWindowSize) {
|
|
899
|
+
// start
|
|
900
|
+
startPage = 1;
|
|
901
|
+
endPage = truncatedPageWindowSize;
|
|
902
|
+
}
|
|
903
|
+
else if (currentPage > pagesCount - rightPageWindowSize) {
|
|
904
|
+
// end
|
|
905
|
+
startPage = pagesCount - truncatedPageWindowSize + 1;
|
|
906
|
+
endPage = pagesCount;
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
// middle
|
|
910
|
+
startPage = currentPage - leftPageWindowSize;
|
|
911
|
+
endPage = currentPage + rightPageWindowSize;
|
|
912
|
+
}
|
|
913
|
+
return range(startPage, endPage + 1);
|
|
914
|
+
}
|
|
915
|
+
goToPage(page) {
|
|
916
|
+
const pagesCount = this.getPagesCount();
|
|
917
|
+
const upperTrunc = Math.min(...[page, pagesCount]);
|
|
918
|
+
const truncated = Math.max(...[upperTrunc, 1]);
|
|
919
|
+
this.currentPage = truncated;
|
|
920
|
+
}
|
|
921
|
+
goToFirstPage() {
|
|
922
|
+
this.goToPage(1);
|
|
923
|
+
}
|
|
924
|
+
goToLastPage() {
|
|
925
|
+
const lastPage = this.getPagesCount();
|
|
926
|
+
this.goToPage(lastPage);
|
|
927
|
+
}
|
|
928
|
+
goToNextPage() {
|
|
929
|
+
const nextPage = this.getCurrentPage() + 1;
|
|
930
|
+
this.goToPage(nextPage);
|
|
931
|
+
}
|
|
932
|
+
goToPreviousPage() {
|
|
933
|
+
const previousPage = this.getCurrentPage() - 1;
|
|
934
|
+
this.goToPage(previousPage);
|
|
935
|
+
}
|
|
936
|
+
hasPreviousPage() {
|
|
937
|
+
return this.getCurrentPage() > 1;
|
|
938
|
+
}
|
|
939
|
+
hasNextPage() {
|
|
940
|
+
return this.getCurrentPage() < this.getPagesCount();
|
|
941
|
+
}
|
|
942
|
+
getTotalItems() {
|
|
943
|
+
return this.totalItems;
|
|
944
|
+
}
|
|
945
|
+
getPageSize() {
|
|
946
|
+
return this.pageSize;
|
|
947
|
+
}
|
|
948
|
+
setPageSize(size) {
|
|
949
|
+
const truncated = Math.max(...[size, 1]);
|
|
950
|
+
this.pageSize = truncated;
|
|
951
|
+
}
|
|
952
|
+
getCurrentPage() {
|
|
953
|
+
return this.currentPage;
|
|
954
|
+
}
|
|
955
|
+
getPageWindowSize() {
|
|
956
|
+
return this.pageWindowSize;
|
|
957
|
+
}
|
|
958
|
+
setPageWindowSize(size) {
|
|
959
|
+
const truncated = Math.max(...[size, 1]);
|
|
960
|
+
this.pageWindowSize = truncated;
|
|
961
|
+
}
|
|
962
|
+
getShowingFrom() {
|
|
963
|
+
const startingIndex = (this.getCurrentPage() - 1) * this.getPageSize();
|
|
964
|
+
let startingPage = startingIndex + 1;
|
|
965
|
+
if (!this.hasItems()) {
|
|
966
|
+
startingPage = 0;
|
|
967
|
+
}
|
|
968
|
+
return startingPage;
|
|
969
|
+
}
|
|
970
|
+
getShowingTo() {
|
|
971
|
+
const displayStartItem = this.getShowingFrom();
|
|
972
|
+
const pageSize = this.getPageSize();
|
|
973
|
+
const totalItems = this.getTotalItems();
|
|
974
|
+
if (!this.hasItems()) {
|
|
975
|
+
return 0;
|
|
976
|
+
}
|
|
977
|
+
const pageEnd = Math.min(...[displayStartItem + pageSize - 1, totalItems]);
|
|
978
|
+
return pageEnd;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
const range = (start, end, step = 1) => {
|
|
982
|
+
const output = [];
|
|
983
|
+
if (typeof end === 'undefined') {
|
|
984
|
+
end = start;
|
|
985
|
+
start = 0;
|
|
986
|
+
}
|
|
987
|
+
for (let i = start; i < end; i += step) {
|
|
988
|
+
output.push(i);
|
|
989
|
+
}
|
|
990
|
+
return output;
|
|
896
991
|
};
|
|
897
992
|
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
greyLightester2: "#fafafa"
|
|
993
|
+
const EUI_COLORS = {
|
|
994
|
+
text: '#333333',
|
|
995
|
+
default: '#333333',
|
|
996
|
+
black: '#000000',
|
|
997
|
+
white: '#ffffff',
|
|
998
|
+
primary: '#004494',
|
|
999
|
+
primaryDark: '#003e8c',
|
|
1000
|
+
primaryDarker: '#003581',
|
|
1001
|
+
primaryDarkest: '#002d77',
|
|
1002
|
+
primaryDarkester: '#001f65',
|
|
1003
|
+
primaryDarkester2: '#00174c',
|
|
1004
|
+
primaryLight: '#2660a4',
|
|
1005
|
+
primaryLighter: '#4d7cb4',
|
|
1006
|
+
primaryLightest: '#80a2ca',
|
|
1007
|
+
primaryLightester: '#b3c7df',
|
|
1008
|
+
primaryLightester2: '#e0e9f2 ',
|
|
1009
|
+
accent: '#ffeb3b',
|
|
1010
|
+
accentDark: '#ffd114',
|
|
1011
|
+
accentDarker: '#fc1',
|
|
1012
|
+
accentDarkest: '#ffc60d',
|
|
1013
|
+
accentDarkester: '#ffbc07',
|
|
1014
|
+
accentDarkester2: '#edad00',
|
|
1015
|
+
accentLight: '#ffdc3a',
|
|
1016
|
+
accentLighter: '#ffe25d',
|
|
1017
|
+
accentLightest: '#ffeb8b',
|
|
1018
|
+
accentLightester: '#fff3b9',
|
|
1019
|
+
accentLightester2: '#fffae3',
|
|
1020
|
+
info: '#03a9f4',
|
|
1021
|
+
infoDark: '#039be5',
|
|
1022
|
+
infoDarker: '#0288d1',
|
|
1023
|
+
infoDarkest: '#0277bd',
|
|
1024
|
+
infoDarkester: '#01579b',
|
|
1025
|
+
infoDarkester2: '#003473',
|
|
1026
|
+
infoLight: '#29b6f6',
|
|
1027
|
+
infoLighter: '#4fc3f7',
|
|
1028
|
+
infoLightest: '#81d4fa',
|
|
1029
|
+
infoLightester: '#b3e5fc',
|
|
1030
|
+
infoLightester2: '#e0eef6',
|
|
1031
|
+
success: '#4caf50',
|
|
1032
|
+
successDark: '#3f7233',
|
|
1033
|
+
successDarker: '#37672c',
|
|
1034
|
+
successDarkest: '#2f5d24',
|
|
1035
|
+
successDarkester: '#204a17',
|
|
1036
|
+
successDarkester2: '#183711',
|
|
1037
|
+
successLight: '#628e57',
|
|
1038
|
+
successLighter: '#7ea274',
|
|
1039
|
+
successLightest: '#a3bd9c',
|
|
1040
|
+
successLightester: '#c8d7c4',
|
|
1041
|
+
successLightester2: '#e9efe7',
|
|
1042
|
+
warning: '#ff9800',
|
|
1043
|
+
warningDark: '#f08d23',
|
|
1044
|
+
warningDarker: '#ee821d',
|
|
1045
|
+
warningDarkest: '#ec7817',
|
|
1046
|
+
warningDarkester: '#e8670e',
|
|
1047
|
+
warningDarkester2: '#d05c0d',
|
|
1048
|
+
warningLight: '#f4a547',
|
|
1049
|
+
warningLighter: '#f6b568',
|
|
1050
|
+
warningLightest: '#f9ca93',
|
|
1051
|
+
warningLightester: '#fbdfbe',
|
|
1052
|
+
warningLightester2: '#fdf2e5',
|
|
1053
|
+
danger: '#f44336',
|
|
1054
|
+
dangerDark: '#d61d2b',
|
|
1055
|
+
dangerDarker: '#d01824',
|
|
1056
|
+
dangerDarkest: '#cb141e',
|
|
1057
|
+
dangerDarkester: '#c20b13',
|
|
1058
|
+
dangerDarkester2: '#aa0a11',
|
|
1059
|
+
dangerLight: '#e0424f',
|
|
1060
|
+
dangerLighter: '#e5646e',
|
|
1061
|
+
dangerLightest: '#ed9098',
|
|
1062
|
+
dangerLightester: '#f4bcc1',
|
|
1063
|
+
dangerLightester2: '#fbe4e6',
|
|
1064
|
+
grey: '#9e9e9e',
|
|
1065
|
+
greyDark: '#757575',
|
|
1066
|
+
greyDarker: '#616161',
|
|
1067
|
+
greyDarkest: '#424242',
|
|
1068
|
+
greyDarkester: '#212121',
|
|
1069
|
+
greyDarkester2: '#141414',
|
|
1070
|
+
greyLight: '#bdbdbd',
|
|
1071
|
+
greyLighter: '#d2d2d2',
|
|
1072
|
+
greyLightest: '#eeeeee',
|
|
1073
|
+
greyLightester: '#f5f5f5',
|
|
1074
|
+
greyLightester2: '#fafafa',
|
|
981
1075
|
};
|
|
982
1076
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
loginPageUrl: ""
|
|
1077
|
+
const EUI_DEFAULT_AUTH_CONFIG = {
|
|
1078
|
+
isLoggedIn: true,
|
|
1079
|
+
redirectUrl: '',
|
|
1080
|
+
loginPageUrl: '',
|
|
988
1081
|
};
|
|
989
1082
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
return array ? array.filter((lang) => Object.keys(this.languages).includes(lang.code)) : [];
|
|
1142
|
-
}
|
|
1143
|
-
};
|
|
1083
|
+
class EuiEuLanguages {
|
|
1084
|
+
static { this.languages = {
|
|
1085
|
+
bg: {
|
|
1086
|
+
code: 'bg',
|
|
1087
|
+
label: 'български',
|
|
1088
|
+
},
|
|
1089
|
+
cs: {
|
|
1090
|
+
code: 'cs',
|
|
1091
|
+
label: 'čeština',
|
|
1092
|
+
},
|
|
1093
|
+
da: {
|
|
1094
|
+
code: 'da',
|
|
1095
|
+
label: 'dansk',
|
|
1096
|
+
},
|
|
1097
|
+
de: {
|
|
1098
|
+
code: 'de',
|
|
1099
|
+
label: 'Deutsch',
|
|
1100
|
+
},
|
|
1101
|
+
et: {
|
|
1102
|
+
code: 'et',
|
|
1103
|
+
label: 'eesti keel',
|
|
1104
|
+
},
|
|
1105
|
+
el: {
|
|
1106
|
+
code: 'el',
|
|
1107
|
+
label: 'ελληνικά',
|
|
1108
|
+
},
|
|
1109
|
+
en: {
|
|
1110
|
+
code: 'en',
|
|
1111
|
+
label: 'English',
|
|
1112
|
+
},
|
|
1113
|
+
es: {
|
|
1114
|
+
code: 'es',
|
|
1115
|
+
label: 'español',
|
|
1116
|
+
},
|
|
1117
|
+
fr: {
|
|
1118
|
+
code: 'fr',
|
|
1119
|
+
label: 'français',
|
|
1120
|
+
},
|
|
1121
|
+
ga: {
|
|
1122
|
+
code: 'ga',
|
|
1123
|
+
label: 'Gaeilge',
|
|
1124
|
+
},
|
|
1125
|
+
hr: {
|
|
1126
|
+
code: 'hr',
|
|
1127
|
+
label: 'hrvatski',
|
|
1128
|
+
},
|
|
1129
|
+
it: {
|
|
1130
|
+
code: 'it',
|
|
1131
|
+
label: 'italiano',
|
|
1132
|
+
},
|
|
1133
|
+
lv: {
|
|
1134
|
+
code: 'lv',
|
|
1135
|
+
label: 'latviešu valoda',
|
|
1136
|
+
},
|
|
1137
|
+
lt: {
|
|
1138
|
+
code: 'lt',
|
|
1139
|
+
label: 'lietuvių kalba',
|
|
1140
|
+
},
|
|
1141
|
+
hu: {
|
|
1142
|
+
code: 'hu',
|
|
1143
|
+
label: 'magyar',
|
|
1144
|
+
},
|
|
1145
|
+
mt: {
|
|
1146
|
+
code: 'mt',
|
|
1147
|
+
label: 'Malti',
|
|
1148
|
+
},
|
|
1149
|
+
nl: {
|
|
1150
|
+
code: 'nl',
|
|
1151
|
+
label: 'Nederlands',
|
|
1152
|
+
},
|
|
1153
|
+
pl: {
|
|
1154
|
+
code: 'pl',
|
|
1155
|
+
label: 'polski',
|
|
1156
|
+
},
|
|
1157
|
+
pt: {
|
|
1158
|
+
code: 'pt',
|
|
1159
|
+
label: 'português',
|
|
1160
|
+
},
|
|
1161
|
+
ro: {
|
|
1162
|
+
code: 'ro',
|
|
1163
|
+
label: 'română',
|
|
1164
|
+
},
|
|
1165
|
+
sk: {
|
|
1166
|
+
code: 'sk',
|
|
1167
|
+
label: 'slovenčina',
|
|
1168
|
+
},
|
|
1169
|
+
sl: {
|
|
1170
|
+
code: 'sl',
|
|
1171
|
+
label: 'slovenščina',
|
|
1172
|
+
},
|
|
1173
|
+
fi: {
|
|
1174
|
+
code: 'fi',
|
|
1175
|
+
label: 'suomi',
|
|
1176
|
+
},
|
|
1177
|
+
sv: {
|
|
1178
|
+
code: 'sv',
|
|
1179
|
+
label: 'svenska',
|
|
1180
|
+
},
|
|
1181
|
+
}; }
|
|
1182
|
+
/**
|
|
1183
|
+
* Matches the given string array to the EU languages and returns a EuiLanguage array.
|
|
1184
|
+
* In case that no codes provided it returns the EU Languages array.
|
|
1185
|
+
*
|
|
1186
|
+
* @param codes A string array of 2 char codes
|
|
1187
|
+
*/
|
|
1188
|
+
static getLanguages(codes = Object.keys(this.languages)) {
|
|
1189
|
+
return this.filterInvalidLanguageCodes(codes).map((c) => (typeof c === 'string' ? this.languages[c] : c));
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* filters and removes language codes that are not part of the EULanguage
|
|
1193
|
+
* e.g. 'ko' does not map to any EULanguage code on the array.
|
|
1194
|
+
* { code: 'ko', label: 'whatever' } is valid though
|
|
1195
|
+
*
|
|
1196
|
+
* @param codes codes A string array of 2 char codescodes A string array of 2 char codes
|
|
1197
|
+
*/
|
|
1198
|
+
static filterInvalidLanguageCodes(codes) {
|
|
1199
|
+
return codes.filter((c) => (typeof c === 'string' ? Object.keys(this.languages).indexOf(c) !== -1 : true));
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* return the given list ordered based on the EULanguage order
|
|
1203
|
+
*
|
|
1204
|
+
* @param codes codes A string array of 2 char codes
|
|
1205
|
+
*/
|
|
1206
|
+
static getOrderedLanguages(codes = Object.keys(this.languages)) {
|
|
1207
|
+
return this.getLanguages(codes).sort((a, b) => Object.keys(this.languages).findIndex((c) => c === a.code) - Object.keys(this.languages).findIndex((c) => c === b.code));
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* retrieve language codes (string array) from a given array of string and EuiLanguage items
|
|
1211
|
+
*
|
|
1212
|
+
* @param array It can be an mixed array of string and EuiLanguage items
|
|
1213
|
+
*/
|
|
1214
|
+
static getLanguageCodes(array) {
|
|
1215
|
+
return array.map((language) => (typeof language === 'string' ? language : language.code));
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* filter non EU languages from given array
|
|
1219
|
+
*
|
|
1220
|
+
* @param array An array of EuiLanguage items
|
|
1221
|
+
*/
|
|
1222
|
+
static filterNonEULanguages(array) {
|
|
1223
|
+
return array ? array.filter((lang) => !Object.keys(this.languages).includes(lang.code)) : [];
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* filter EU Languages from given array
|
|
1227
|
+
*
|
|
1228
|
+
* @param array An array of EuiLanguage items
|
|
1229
|
+
*/
|
|
1230
|
+
static filterEULanguages(array) {
|
|
1231
|
+
return array ? array.filter((lang) => Object.keys(this.languages).includes(lang.code)) : [];
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1144
1234
|
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
};
|
|
1235
|
+
class EuiMenuItem {
|
|
1236
|
+
constructor(values = {}) {
|
|
1237
|
+
this.urlExternalTarget = '_blank';
|
|
1238
|
+
this.link = false;
|
|
1239
|
+
this.expanded = false;
|
|
1240
|
+
this.active = false;
|
|
1241
|
+
this.visible = true;
|
|
1242
|
+
this.filtered = true;
|
|
1243
|
+
Object.assign(this, values);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1157
1246
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
export
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
EuiEuLanguages,
|
|
1173
|
-
EuiLazyService,
|
|
1174
|
-
EuiMenuItem,
|
|
1175
|
-
EuiPagination,
|
|
1176
|
-
EuiService,
|
|
1177
|
-
EuiTimezones,
|
|
1178
|
-
LogAppender,
|
|
1179
|
-
LogLevel,
|
|
1180
|
-
LogLevelName,
|
|
1181
|
-
Logger,
|
|
1182
|
-
LoggerMock,
|
|
1183
|
-
UrlAppender,
|
|
1184
|
-
UxBadgeLegacy,
|
|
1185
|
-
UxClearErrorFeedbackEvent,
|
|
1186
|
-
UxErrorGroupOnClickEvent,
|
|
1187
|
-
UxErrorOutput,
|
|
1188
|
-
UxLinkLegacy,
|
|
1189
|
-
UxMessageSeverity,
|
|
1190
|
-
UxMessageSeverityMetrics,
|
|
1191
|
-
UxPublishErrorFeedbackEvent,
|
|
1192
|
-
UxValidationErrorClass,
|
|
1193
|
-
coerce,
|
|
1194
|
-
coerceArray,
|
|
1195
|
-
coerceBoolean,
|
|
1196
|
-
coerceElement,
|
|
1197
|
-
coerceNumber,
|
|
1198
|
-
coercePixel,
|
|
1199
|
-
getActiveLang,
|
|
1200
|
-
getApiQueue,
|
|
1201
|
-
getApiQueueItem,
|
|
1202
|
-
getAppConnection,
|
|
1203
|
-
getAppLoadedConfigModules,
|
|
1204
|
-
getAppState,
|
|
1205
|
-
getAppStatus,
|
|
1206
|
-
getAppVersion,
|
|
1207
|
-
getBrowserDefaultLanguage,
|
|
1208
|
-
getBrowserPreferredLanguages,
|
|
1209
|
-
getCurrentModule,
|
|
1210
|
-
getI18nLoaderConfig,
|
|
1211
|
-
getI18nServiceConfig,
|
|
1212
|
-
getI18nServiceConfigFromBase,
|
|
1213
|
-
getI18nState,
|
|
1214
|
-
getLastAddedModule,
|
|
1215
|
-
getLocaleServiceConfigFromBase,
|
|
1216
|
-
getLocaleState,
|
|
1217
|
-
getNotificationsList,
|
|
1218
|
-
getNotificationsState,
|
|
1219
|
-
getUserDashboard,
|
|
1220
|
-
getUserDetails,
|
|
1221
|
-
getUserFirstName,
|
|
1222
|
-
getUserFullName,
|
|
1223
|
-
getUserId,
|
|
1224
|
-
getUserLang,
|
|
1225
|
-
getUserLastName,
|
|
1226
|
-
getUserLocale,
|
|
1227
|
-
getUserPreferences,
|
|
1228
|
-
getUserRight,
|
|
1229
|
-
getUserRightPermissions,
|
|
1230
|
-
getUserRights,
|
|
1231
|
-
getUserState,
|
|
1232
|
-
initialAppState,
|
|
1233
|
-
initialCoreState,
|
|
1234
|
-
initialI18nState,
|
|
1235
|
-
initialLocaleState,
|
|
1236
|
-
initialNotificationsState,
|
|
1237
|
-
initialUserPreferences,
|
|
1238
|
-
initialUserState,
|
|
1239
|
-
isObject,
|
|
1240
|
-
merge,
|
|
1241
|
-
mergeAll,
|
|
1242
|
-
mergeDeep,
|
|
1243
|
-
range,
|
|
1244
|
-
transformToUxHttpResponse,
|
|
1245
|
-
xhr
|
|
1246
|
-
};
|
|
1247
|
+
class EuiTimezones {
|
|
1248
|
+
constructor() {
|
|
1249
|
+
this.primary = 'Europe/Brussels';
|
|
1250
|
+
this.secondary = 'Europe/Brussels';
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// export * from './lib/base.module';
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Generated bundle index. Do not edit.
|
|
1258
|
+
*/
|
|
1259
|
+
|
|
1260
|
+
export { ConsoleAppender, DEFAULT_CONSOLE_APPENDER_PREFIX_CONVERTERS, DEFAULT_XHR_CONFIG, DefaultConfig, EUI_COLORS, EUI_DEFAULT_AUTH_CONFIG, EuiEuLanguages, EuiLazyService, EuiMenuItem, EuiPagination, EuiService, EuiTimezones, LogAppender, LogLevel, LogLevelName, Logger, LoggerMock, UrlAppender, UxBadgeLegacy, UxClearErrorFeedbackEvent, UxErrorGroupOnClickEvent, UxErrorOutput, UxLinkLegacy, UxMessageSeverity, UxMessageSeverityMetrics, UxPublishErrorFeedbackEvent, UxValidationErrorClass, coerce, coerceArray, coerceBoolean, coerceElement, coerceNumber, coercePixel, getActiveLang, getApiQueue, getApiQueueItem, getAppConnection, getAppLoadedConfigModules, getAppState, getAppStatus, getAppVersion, getBrowserDefaultLanguage, getBrowserPreferredLanguages, getCurrentModule, getI18nLoaderConfig, getI18nServiceConfig, getI18nServiceConfigFromBase, getI18nState, getLastAddedModule, getLocaleServiceConfigFromBase, getLocaleState, getNotificationsList, getNotificationsState, getUserDashboard, getUserDetails, getUserFirstName, getUserFullName, getUserId, getUserLang, getUserLastName, getUserLocale, getUserPreferences, getUserRight, getUserRightPermissions, getUserRights, getUserState, initialAppState, initialCoreState, initialI18nState, initialLocaleState, initialNotificationsState, initialUserPreferences, initialUserState, isObject, merge, mergeAll, mergeDeep, range, transformToUxHttpResponse, xhr };
|
|
1247
1261
|
//# sourceMappingURL=eui-base.mjs.map
|