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