@eui/base 14.0.3 → 14.0.4-snapshot-1661163930913
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/assets/openid/openid-login.js +28 -4
- package/docs/classes/EuiService.html +3 -3
- package/docs/dependencies.html +40 -10
- package/docs/interfaces/EuiServiceModel.html +3 -3
- package/docs/js/search/search_index.js +2 -2
- package/docs/miscellaneous/functions.html +50 -689
- package/docs/miscellaneous/variables.html +305 -0
- package/esm2020/lib/eui-models/eui-config/i18n.config.mjs +8 -14
- package/esm2020/lib/eui-models/eui-config/locale.config.mjs +3 -3
- package/esm2020/lib/eui-models/eui-pagination/eui-pagination.model.mjs +4 -2
- package/esm2020/lib/eui-models/eui-service.model.mjs +1 -1
- package/esm2020/lib/eui-models/log/console.appender.mjs +3 -1
- package/esm2020/lib/eui-models/log/log.appender.mjs +2 -1
- package/esm2020/lib/eui-models/log/log.logger.mjs +11 -3
- package/esm2020/lib/eui-models/log/url.appender.mjs +2 -2
- package/esm2020/lib/util/coerce-decorator/coerce.mjs +2 -2
- package/esm2020/lib/util/coerce-decorator/coercions.mjs +2 -2
- package/esm2020/lib/util/merge.mjs +7 -9
- package/esm2020/lib/util/xhr.mjs +2 -1
- package/esm2020/lib/ux-models/ux-badge.model.mjs +1 -1
- package/esm2020/lib/ux-models/ux-error-feedback.model.mjs +4 -6
- package/esm2020/lib/ux-models/ux-eu-languages.model.mjs +8 -6
- package/esm2020/lib/ux-models/ux-link.model.mjs +1 -1
- package/fesm2015/eui-base.mjs +44 -38
- package/fesm2015/eui-base.mjs.map +1 -1
- package/fesm2020/eui-base.mjs +44 -38
- package/fesm2020/eui-base.mjs.map +1 -1
- package/lib/eui-models/eui-config/i18n.config.d.ts +6 -5
- package/lib/eui-models/eui-config/i18n.config.d.ts.map +1 -1
- package/lib/eui-models/eui-config/locale.config.d.ts +1 -1
- package/lib/eui-models/eui-config/locale.config.d.ts.map +1 -1
- package/lib/eui-models/eui-service.model.d.ts +2 -2
- package/lib/eui-models/log/console.appender.d.ts +2 -0
- package/lib/eui-models/log/console.appender.d.ts.map +1 -1
- package/lib/eui-models/log/log.appender.d.ts +2 -0
- package/lib/eui-models/log/log.appender.d.ts.map +1 -1
- package/lib/eui-models/log/log.logger.d.ts +10 -0
- package/lib/eui-models/log/log.logger.d.ts.map +1 -1
- package/lib/util/merge.d.ts +4 -3
- package/lib/util/merge.d.ts.map +1 -1
- package/lib/util/xhr.d.ts +1 -0
- package/lib/util/xhr.d.ts.map +1 -1
- package/lib/ux-models/ux-badge.model.d.ts +1 -1
- package/lib/ux-models/ux-error-feedback.model.d.ts +1 -1
- package/lib/ux-models/ux-error-feedback.model.d.ts.map +1 -1
- package/lib/ux-models/ux-eu-languages.model.d.ts +6 -0
- package/lib/ux-models/ux-eu-languages.model.d.ts.map +1 -1
- package/lib/ux-models/ux-link.model.d.ts +1 -1
- package/package.json +2 -2
package/fesm2015/eui-base.mjs
CHANGED
|
@@ -5,19 +5,19 @@ import { createSelector } from 'reselect';
|
|
|
5
5
|
import { tap, filter, switchMap } from 'rxjs/operators';
|
|
6
6
|
import { HttpClient } from '@angular/common/http';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
10
|
-
}
|
|
8
|
+
const isObject = (item) => (item && typeof item === 'object' && !Array.isArray(item));
|
|
11
9
|
function merge(target, ...sources) {
|
|
12
10
|
return mergeDeep(target, ...sources);
|
|
13
11
|
}
|
|
12
|
+
/* eslint-enable */
|
|
14
13
|
/**
|
|
15
14
|
* deep merge of two or more objects
|
|
15
|
+
*
|
|
16
16
|
* @param target immutable target
|
|
17
17
|
* @param sources immutable sources to apply to target
|
|
18
18
|
* @returns a new merged object
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
const mergeDeep = (target, ...sources) => {
|
|
21
21
|
const output = Object.assign({}, target);
|
|
22
22
|
if (!sources.length) {
|
|
23
23
|
return output;
|
|
@@ -39,10 +39,8 @@ function mergeDeep(target, ...sources) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return mergeDeep(output, ...sources);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return array.reduce((prev, next) => mergeDeep(prev, next), {});
|
|
45
|
-
}
|
|
42
|
+
};
|
|
43
|
+
const mergeAll = (array) => array.reduce((prev, next) => mergeDeep(prev, next), {});
|
|
46
44
|
|
|
47
45
|
/**
|
|
48
46
|
* Default xhr configuration
|
|
@@ -94,8 +92,9 @@ function xhr(urlOrConfig) {
|
|
|
94
92
|
});
|
|
95
93
|
});
|
|
96
94
|
}
|
|
95
|
+
/* eslint-enable */
|
|
97
96
|
|
|
98
|
-
/*
|
|
97
|
+
/* eslint-disable */
|
|
99
98
|
function coerce(coerceFn, afterFn) {
|
|
100
99
|
return function (target, propertyKey) {
|
|
101
100
|
const _key = Symbol();
|
|
@@ -179,9 +178,7 @@ class UxErrorOutput {
|
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
checkAttribute(key, attributes) {
|
|
182
|
-
return attributes.some((attr) =>
|
|
183
|
-
return key === attr.key;
|
|
184
|
-
});
|
|
181
|
+
return attributes.some((attr) => key === attr.key);
|
|
185
182
|
}
|
|
186
183
|
}
|
|
187
184
|
class UxErrorGroupOnClickEvent {
|
|
@@ -210,11 +207,11 @@ class UxValidationErrorClass {
|
|
|
210
207
|
Object.assign(this, data);
|
|
211
208
|
}
|
|
212
209
|
}
|
|
213
|
-
|
|
210
|
+
const transformToUxHttpResponse = (resp, mapper) => {
|
|
214
211
|
let updatedErr = resp;
|
|
215
212
|
updatedErr.uxHttpErrorOutput = mapper(resp.error);
|
|
216
213
|
return updatedErr;
|
|
217
|
-
}
|
|
214
|
+
};
|
|
218
215
|
class UxPublishErrorFeedbackEvent {
|
|
219
216
|
constructor(err, id, groupId, accumulate) {
|
|
220
217
|
this.err = err;
|
|
@@ -265,13 +262,12 @@ class UxTimezones {
|
|
|
265
262
|
}
|
|
266
263
|
|
|
267
264
|
class UxEuLanguages {
|
|
268
|
-
/* tslint:disable */
|
|
269
265
|
/**
|
|
270
266
|
* Matches the given string array to the EU languages and returns a UxLanguage array.
|
|
271
267
|
* In case that no codes provided it returns the EU Languages array.
|
|
268
|
+
*
|
|
272
269
|
* @param codes A string array of 2 char codes
|
|
273
270
|
*/
|
|
274
|
-
/* tslint:enable */
|
|
275
271
|
static getLanguages(codes = Object.keys(this.languages)) {
|
|
276
272
|
return this.filterInvalidLanguageCodes(codes)
|
|
277
273
|
.map((c) => (typeof c === 'string') ? this.languages[c] : c);
|
|
@@ -280,6 +276,7 @@ class UxEuLanguages {
|
|
|
280
276
|
* filters and removes language codes that are not part of the EULanguage
|
|
281
277
|
* e.g. 'ko' does not map to any EULanguage code on the array.
|
|
282
278
|
* { code: 'ko', label: 'whatever' } is valid though
|
|
279
|
+
*
|
|
283
280
|
* @param codes codes A string array of 2 char codescodes A string array of 2 char codes
|
|
284
281
|
*/
|
|
285
282
|
static filterInvalidLanguageCodes(codes) {
|
|
@@ -289,6 +286,7 @@ class UxEuLanguages {
|
|
|
289
286
|
}
|
|
290
287
|
/**
|
|
291
288
|
* return the given list ordered based on the EULanguage order
|
|
289
|
+
*
|
|
292
290
|
* @param codes codes A string array of 2 char codes
|
|
293
291
|
*/
|
|
294
292
|
static getOrderedLanguages(codes = Object.keys(this.languages)) {
|
|
@@ -296,15 +294,15 @@ class UxEuLanguages {
|
|
|
296
294
|
}
|
|
297
295
|
/**
|
|
298
296
|
* retrieve language codes (string array) from a given array of string and UxLanguage items
|
|
297
|
+
*
|
|
299
298
|
* @param array It can be an mixed array of string and UxLanguage items
|
|
300
299
|
*/
|
|
301
300
|
static getLanguageCodes(array) {
|
|
302
|
-
return array.map((language) =>
|
|
303
|
-
return (typeof language === 'string') ? language : language.code;
|
|
304
|
-
});
|
|
301
|
+
return array.map((language) => (typeof language === 'string') ? language : language.code);
|
|
305
302
|
}
|
|
306
303
|
/**
|
|
307
304
|
* filter non EU languages from given array
|
|
305
|
+
*
|
|
308
306
|
* @param array An array of UxLanguage items
|
|
309
307
|
*/
|
|
310
308
|
static filterNonEULanguages(array) {
|
|
@@ -312,6 +310,7 @@ class UxEuLanguages {
|
|
|
312
310
|
}
|
|
313
311
|
/**
|
|
314
312
|
* filter EU Languages from given array
|
|
313
|
+
*
|
|
315
314
|
* @param array An array of UxLanguage items
|
|
316
315
|
*/
|
|
317
316
|
static filterEULanguages(array) {
|
|
@@ -601,6 +600,7 @@ class LogAppender {
|
|
|
601
600
|
}
|
|
602
601
|
/**
|
|
603
602
|
* Gets the config
|
|
603
|
+
*
|
|
604
604
|
* @returns the config
|
|
605
605
|
*/
|
|
606
606
|
getConfig() {
|
|
@@ -672,6 +672,7 @@ class ConsoleAppender extends LogAppender {
|
|
|
672
672
|
}
|
|
673
673
|
/**
|
|
674
674
|
* Returns the prefix to be added to the messages
|
|
675
|
+
*
|
|
675
676
|
* @param event the log event
|
|
676
677
|
* @returns the formatted prefix, as string
|
|
677
678
|
*/
|
|
@@ -690,6 +691,7 @@ class ConsoleAppender extends LogAppender {
|
|
|
690
691
|
}
|
|
691
692
|
/**
|
|
692
693
|
* Utility method to replace a placeholder
|
|
694
|
+
*
|
|
693
695
|
* @param str the string with placeholders
|
|
694
696
|
* @param find the placeholder
|
|
695
697
|
* @param replace the string to replace the placeholder
|
|
@@ -723,6 +725,7 @@ class Logger {
|
|
|
723
725
|
}
|
|
724
726
|
/**
|
|
725
727
|
* Gets the logger name
|
|
728
|
+
*
|
|
726
729
|
* @returns the logger name
|
|
727
730
|
*/
|
|
728
731
|
getName() {
|
|
@@ -730,6 +733,7 @@ class Logger {
|
|
|
730
733
|
}
|
|
731
734
|
/**
|
|
732
735
|
* Gets the log level
|
|
736
|
+
*
|
|
733
737
|
* @returns the log level
|
|
734
738
|
*/
|
|
735
739
|
getLevel() {
|
|
@@ -737,6 +741,7 @@ class Logger {
|
|
|
737
741
|
}
|
|
738
742
|
/**
|
|
739
743
|
* Sets the log level
|
|
744
|
+
*
|
|
740
745
|
* @param level log level
|
|
741
746
|
*/
|
|
742
747
|
setLevel(level) {
|
|
@@ -744,6 +749,7 @@ class Logger {
|
|
|
744
749
|
}
|
|
745
750
|
/**
|
|
746
751
|
* Fatal log
|
|
752
|
+
*
|
|
747
753
|
* @param message mandatory message
|
|
748
754
|
* @param additionalMessages optional messages
|
|
749
755
|
*/
|
|
@@ -758,6 +764,7 @@ class Logger {
|
|
|
758
764
|
}
|
|
759
765
|
/**
|
|
760
766
|
* Error log
|
|
767
|
+
*
|
|
761
768
|
* @param message mandatory message
|
|
762
769
|
* @param additionalMessages optional messages
|
|
763
770
|
*/
|
|
@@ -772,6 +779,7 @@ class Logger {
|
|
|
772
779
|
}
|
|
773
780
|
/**
|
|
774
781
|
* Warning log
|
|
782
|
+
*
|
|
775
783
|
* @param message mandatory message
|
|
776
784
|
* @param additionalMessages optional messages
|
|
777
785
|
*/
|
|
@@ -786,6 +794,7 @@ class Logger {
|
|
|
786
794
|
}
|
|
787
795
|
/**
|
|
788
796
|
* Info log
|
|
797
|
+
*
|
|
789
798
|
* @param message mandatory message
|
|
790
799
|
* @param additionalMessages optional messages
|
|
791
800
|
*/
|
|
@@ -800,6 +809,7 @@ class Logger {
|
|
|
800
809
|
}
|
|
801
810
|
/**
|
|
802
811
|
* Debug log
|
|
812
|
+
*
|
|
803
813
|
* @param message mandatory message
|
|
804
814
|
* @param additionalMessages optional messages
|
|
805
815
|
*/
|
|
@@ -814,6 +824,7 @@ class Logger {
|
|
|
814
824
|
}
|
|
815
825
|
/**
|
|
816
826
|
* Trace log
|
|
827
|
+
*
|
|
817
828
|
* @param message mandatory message
|
|
818
829
|
* @param additionalMessages optional messages
|
|
819
830
|
*/
|
|
@@ -826,12 +837,11 @@ class Logger {
|
|
|
826
837
|
messages: [message, ...additionalMessages],
|
|
827
838
|
});
|
|
828
839
|
}
|
|
829
|
-
/* tslint:disable */
|
|
830
840
|
/**
|
|
831
841
|
* Generic log method, checking the log level and calling the specified appenders
|
|
842
|
+
*
|
|
832
843
|
* @param event the log event
|
|
833
844
|
*/
|
|
834
|
-
/* tslint:enable */
|
|
835
845
|
log(event) {
|
|
836
846
|
this.appenders
|
|
837
847
|
// filter the appender by their custom logLevel or the logger (main) logLevel
|
|
@@ -941,7 +951,7 @@ class UrlAppender extends LogAppender {
|
|
|
941
951
|
};
|
|
942
952
|
}
|
|
943
953
|
}
|
|
944
|
-
catch (
|
|
954
|
+
catch (err) {
|
|
945
955
|
}
|
|
946
956
|
}
|
|
947
957
|
return null;
|
|
@@ -961,41 +971,35 @@ class UrlAppender extends LogAppender {
|
|
|
961
971
|
}
|
|
962
972
|
}
|
|
963
973
|
|
|
964
|
-
|
|
974
|
+
const getI18nServiceConfigFromBase = (baseGlobalConfig) => {
|
|
965
975
|
const i18nServiceConfig = baseGlobalConfig && baseGlobalConfig.i18n && baseGlobalConfig.i18n.i18nService;
|
|
966
976
|
const { languages, defaultLanguage } = getI18nServiceConfig(i18nServiceConfig);
|
|
967
977
|
return { languages, defaultLanguage };
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
function getI18nLoaderConfig(config) {
|
|
978
|
+
};
|
|
979
|
+
const getI18nServiceConfig = (config) => Object.assign({}, config);
|
|
980
|
+
const getI18nLoaderConfig = (config) => {
|
|
973
981
|
const { i18nFolders, i18nServices, i18nResources } = Object.assign({}, config);
|
|
974
982
|
return { i18nFolders, i18nServices, i18nResources };
|
|
975
|
-
}
|
|
983
|
+
};
|
|
976
984
|
/**
|
|
977
985
|
* returns a language code based on https://tools.ietf.org/rfc/bcp/bcp47.txt specification. To get the Browser's
|
|
978
986
|
* it's using the navigator.language, splits by hyphen and get the first part.
|
|
979
987
|
*/
|
|
980
|
-
|
|
981
|
-
return navigator.language.split('-')[0];
|
|
982
|
-
}
|
|
988
|
+
const getBrowserDefaultLanguage = () => navigator.language.split('-')[0];
|
|
983
989
|
/**
|
|
984
990
|
* returns an array of DOMStrings representing the user's preferred languages. The language is described using BCP 47
|
|
985
991
|
* language tags. In the returned array they are ordered by preference with the most preferred language first.
|
|
986
992
|
* The array languages will be lower cased 2 char code.
|
|
987
993
|
*/
|
|
988
|
-
|
|
989
|
-
return navigator.languages.map(lang => lang.split('-')[0]);
|
|
990
|
-
}
|
|
994
|
+
const getBrowserPreferredLanguages = () => navigator.languages.map(lang => lang.split('-')[0]);
|
|
991
995
|
|
|
992
996
|
/**
|
|
993
997
|
* responsible to extract the attributes "available" and "id" from the locale configuration
|
|
994
998
|
*/
|
|
995
|
-
|
|
999
|
+
const getLocaleServiceConfigFromBase = (baseGlobalConfig) => {
|
|
996
1000
|
const { available, id, bindWithTranslate, affectGlobalLocale } = baseGlobalConfig === null || baseGlobalConfig === void 0 ? void 0 : baseGlobalConfig.locale;
|
|
997
1001
|
return { available, id, bindWithTranslate, affectGlobalLocale };
|
|
998
|
-
}
|
|
1002
|
+
};
|
|
999
1003
|
|
|
1000
1004
|
// TODO: move this to externals since Dashboard functionality moved there
|
|
1001
1005
|
// export interface UserDashboard extends WidgetDashboard {}
|
|
@@ -1126,7 +1130,9 @@ class EuiPagination {
|
|
|
1126
1130
|
return range(startPage, endPage + 1);
|
|
1127
1131
|
}
|
|
1128
1132
|
goToPage(page) {
|
|
1129
|
-
|
|
1133
|
+
let pagesCount;
|
|
1134
|
+
let upperTrunc;
|
|
1135
|
+
let truncated;
|
|
1130
1136
|
pagesCount = this.getPagesCount();
|
|
1131
1137
|
upperTrunc = Math.min(...[page, pagesCount]);
|
|
1132
1138
|
truncated = Math.max(...[upperTrunc, 1]);
|