@eui/core 10.5.6-snapshot-1639737419096 → 10.5.6

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.
@@ -370,7 +370,12 @@
370
370
  routes: [],
371
371
  };
372
372
  var DEFAULT_GLOBAL_CONFIG = {
373
- showConnectionStatus: true,
373
+ showConnectionStatus: {
374
+ messageBox: {
375
+ lifespan: 0
376
+ },
377
+ enabled: true
378
+ },
374
379
  i18n: {
375
380
  i18nService: Object.assign({}, DEFAULT_I18N_SERVICE_CONFIG),
376
381
  i18nLoader: Object.assign({}, DEFAULT_I18N_LOADER_CONFIG),
@@ -407,6 +412,10 @@
407
412
  return Object.assign(DEFAULT_EUI_CONFIG.appConfig.global, appConfig && appConfig.global);
408
413
  }
409
414
  function getShowConnectionStatus(globalConfig) {
415
+ // TODO: remove on eUI 14
416
+ if (typeof (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.showConnectionStatus) === 'boolean') {
417
+ console.warn('Usage of showConnectionStatus as boolean is deprecated, please use ConnectionStatus type');
418
+ }
410
419
  return Object.assign({}, DEFAULT_EUI_CONFIG.appConfig.global.showConnectionStatus, globalConfig && globalConfig.showConnectionStatus);
411
420
  }
412
421
  function getModuleConfig(appConfig, moduleName) {
@@ -1811,8 +1820,8 @@
1811
1820
  this.growlMessages = [];
1812
1821
  }
1813
1822
  this.growlMessages = this.growlMessages.concat(msg);
1814
- msg.life = life;
1815
- msg.sticky = isSticky;
1823
+ msg.life = life || msg.life;
1824
+ msg.sticky = isSticky || msg.sticky;
1816
1825
  if (life === undefined || isNaN(life)) {
1817
1826
  if (msg.severity === 'danger') {
1818
1827
  isSticky = true;
@@ -2080,7 +2089,9 @@
2080
2089
  })();
2081
2090
 
2082
2091
  var CoreAppEffects = /** @class */ (function () {
2083
- function CoreAppEffects(actions, showConnectionStatus, translateService, asService) {
2092
+ function CoreAppEffects(actions,
2093
+ // TODO: remove on eUI 14
2094
+ showConnectionStatus, translateService, asService) {
2084
2095
  var _this = this;
2085
2096
  this.actions = actions;
2086
2097
  this.showConnectionStatus = showConnectionStatus;
@@ -2097,17 +2108,27 @@
2097
2108
  }));
2098
2109
  this.updateAppConnection = this.actions
2099
2110
  .pipe(i1$3.ofType(exports.CoreAppActionTypes.UPDATE_APP_CONNECTION), operators.map(function (action) { return action.payload; }), operators.tap(function (connected) {
2111
+ var _a, _b, _c;
2112
+ // TODO: for eUI 14, drop boolean support and refactor
2113
+ // check if feature is enabled
2114
+ var isFeatureEnabled = typeof _this.showConnectionStatus !== 'boolean' ? (_a = _this.showConnectionStatus) === null || _a === void 0 ? void 0 : _a.enabled : _this.showConnectionStatus;
2115
+ // extract lifespan if any
2116
+ var lifespan = typeof _this.showConnectionStatus !== 'boolean' ? ((_c = (_b = _this.showConnectionStatus) === null || _b === void 0 ? void 0 : _b.messageBox) === null || _c === void 0 ? void 0 : _c.lifespan) || 0 : 0;
2100
2117
  // if the user needs to be informed about the connection status
2101
2118
  if (_this.showConnectionStatus) {
2102
- if (connected) {
2103
- _this.translateService.get('eui.CONNECTED').subscribe(function (translation) {
2104
- _this.asService.growl({ severity: 'success', summary: 'MESSAGE', detail: translation }, true, false);
2105
- });
2106
- }
2107
- else {
2108
- _this.translateService.get('eui.NOTCONNECTED').subscribe(function (translation) {
2109
- _this.asService.growl({ severity: 'danger', summary: 'ERROR', detail: translation }, true, false);
2110
- });
2119
+ if (isFeatureEnabled) {
2120
+ if (connected) {
2121
+ _this.translateService.get('eui.CONNECTED').subscribe(function (translation) {
2122
+ // tslint:disable-next-line:max-line-length
2123
+ _this.asService.growl({ severity: 'success', summary: 'MESSAGE', detail: translation, life: lifespan }, lifespan < 1, false);
2124
+ });
2125
+ }
2126
+ else {
2127
+ _this.translateService.get('eui.NOTCONNECTED').subscribe(function (translation) {
2128
+ // tslint:disable-next-line:max-line-length
2129
+ _this.asService.growl({ severity: 'danger', summary: 'ERROR', detail: translation, life: lifespan }, lifespan < 1, false);
2130
+ });
2131
+ }
2111
2132
  }
2112
2133
  }
2113
2134
  }));