From 7a53c702251a223da3be116e76104b1c5c52c71f Mon Sep 17 00:00:00 2001 From: Carlo Nomes Date: Fri, 22 Feb 2019 10:56:14 +0100 Subject: [PATCH] refactor(stark-all): update lodash usage This commit will refactor all used instances of `const (.*) = require("lodash/(.*)")` to `import (.*) from "lodash/(.*)"` ISSUES CLOSED: #150 --- .../common/translations/merge-translations.ts | 8 ++---- .../src/modules/http/services/http.service.ts | 14 ++++------ .../logging/services/logging.service.ts | 8 ++---- .../routing/services/routing.service.ts | 10 +++---- packages/stark-core/src/util/http.util.ts | 10 +++---- .../is-bban/is-bban.validator.fn.ts | 7 ++--- ...-establishment-unit-number.validator.fn.ts | 7 ++--- .../is-isin/is-isin.validator.fn.ts | 9 +++---- .../validators/is-nin/is-nin.validator.fn.ts | 7 ++--- .../src/common/message/message.entity.ts | 8 ++---- .../common/translations/merge-translations.ts | 8 ++---- .../components/date-picker.component.ts | 8 ++---- .../dropdown/components/dropdown.component.ts | 7 ++--- .../classes/abstract-form-component.ts | 18 ++++--------- .../generic-search.component.ts | 10 +++---- .../reducers/messages-pane.reducer.ts | 12 +++------ .../components/pagination.component.ts | 8 ++---- .../reducers/progress-indicator.reducer.ts | 16 +++++------- .../components/route-search.component.ts | 8 ++---- .../slider/components/slider.component.ts | 13 +++------- .../table/components/column.component.ts | 16 +++--------- .../stark-ui/src/util/form/form.util.spec.ts | 7 +++-- .../demo-generic-search-form.component.ts | 4 +-- .../demo-message-pane-page.component.ts | 26 +++++++++---------- .../in-memory-data.interceptor.ts | 13 +++++----- .../services/in-memory-data.service.ts | 6 ++--- .../effects/stark-error-handling.effects.ts | 8 ++---- .../examples/message-pane/message-pane.ts | 26 +++++++++---------- 28 files changed, 103 insertions(+), 199 deletions(-) diff --git a/packages/stark-core/src/common/translations/merge-translations.ts b/packages/stark-core/src/common/translations/merge-translations.ts index 32124926e0..0c69676820 100644 --- a/packages/stark-core/src/common/translations/merge-translations.ts +++ b/packages/stark-core/src/common/translations/merge-translations.ts @@ -1,11 +1,7 @@ import { TranslateService } from "@ngx-translate/core"; import { StarkLocale } from "./locale.intf"; import { commonCoreTranslations } from "./common-translations"; - -/** - * @ignore - */ -const _cloneDeep: Function = require("lodash/cloneDeep"); +import cloneDeep from "lodash-es/cloneDeep"; /** * This function can be used by Stark modules to merge their translations into existing translations, @@ -36,7 +32,7 @@ const _cloneDeep: Function = require("lodash/cloneDeep"); * mergeTranslations(this.translateService, english, french, dutch); */ export function mergeTranslations(translateService: TranslateService, ...localesToMerge: StarkLocale[]): void { - const currentTranslations: object = _cloneDeep(translateService.translations); + const currentTranslations: object = cloneDeep(translateService.translations); for (const locale of localesToMerge) { translateService.setTranslation(locale.languageCode, commonCoreTranslations[locale.languageCode], false); diff --git a/packages/stark-core/src/modules/http/services/http.service.ts b/packages/stark-core/src/modules/http/services/http.service.ts index 7d95224d28..048e2fbf2f 100644 --- a/packages/stark-core/src/modules/http/services/http.service.ts +++ b/packages/stark-core/src/modules/http/services/http.service.ts @@ -23,11 +23,7 @@ import { import { convertMapIntoObject } from "../../../util/util-helpers"; import { StarkHttpUtil } from "../../../util/http.util"; import { StarkHttpService, starkHttpServiceName } from "./http.service.intf"; - -/** - * @ignore - */ -const _cloneDeep: Function = require("lodash/cloneDeep"); +import cloneDeep from "lodash-es/cloneDeep"; /** * @ignore @@ -140,8 +136,8 @@ export class StarkHttpServiceImpl

implements StarkHttpS let requestCopy: StarkHttpRequest

= request; if (request.item) { - requestCopy = _cloneDeep(request); - const itemWithoutETag: P = _cloneDeep(

requestCopy.item); + requestCopy = cloneDeep(request); + const itemWithoutETag: P = cloneDeep(

requestCopy.item); delete itemWithoutETag.etag; requestCopy.item = itemWithoutETag; } @@ -157,7 +153,7 @@ export class StarkHttpServiceImpl

implements StarkHttpS public addDevAuthenticationHeaders(request: StarkHttpRequest

): StarkHttpRequest

{ this.logger.debug(starkHttpServiceName + ": Adding dev-authentication headers"); - const requestCopy: StarkHttpRequest

= _cloneDeep(request); + const requestCopy: StarkHttpRequest

= cloneDeep(request); // add the preAuthentication headers to the request headers this.sessionService.devAuthenticationHeaders.forEach((value: string | string[], header: string) => { @@ -175,7 +171,7 @@ export class StarkHttpServiceImpl

implements StarkHttpS public addCorrelationIdentifierHeader(request: StarkHttpRequest

): StarkHttpRequest

{ if (this.logger.correlationIdHttpHeaderName && this.logger.correlationIdHttpHeaderName.length > 0 && this.logger.correlationId) { this.logger.debug(starkHttpServiceName + ": Adding correlation identifier header"); - const requestCopy: StarkHttpRequest

= _cloneDeep(request); + const requestCopy: StarkHttpRequest

= cloneDeep(request); requestCopy.headers.set(this.logger.correlationIdHttpHeaderName, this.logger.correlationId); return requestCopy; } diff --git a/packages/stark-core/src/modules/logging/services/logging.service.ts b/packages/stark-core/src/modules/logging/services/logging.service.ts index 080e95d8bd..9481e3b4f4 100644 --- a/packages/stark-core/src/modules/logging/services/logging.service.ts +++ b/packages/stark-core/src/modules/logging/services/logging.service.ts @@ -17,11 +17,7 @@ import { StarkFlushLogMessages, StarkLogMessageAction } from "../actions"; import { selectStarkLogging } from "../reducers"; import { StarkError, StarkErrorImpl } from "../../../common/error"; import { StarkConfigurationUtil } from "../../../util/configuration.util"; - -/** - * @ignore - */ -const _noop: Function = require("lodash/noop"); +import noop from "lodash-es/noop"; const xsrfServiceNotFound: "not provided" = "not provided"; @@ -246,7 +242,7 @@ export class StarkLoggingServiceImpl implements StarkLoggingService { */ protected getConsole(type: string): Function { const console: any = window && window.console ? window.console : {}; - const logFn: Function = console[type] || console.log || _noop; + const logFn: Function = console[type] || console.log || noop; return (...args: any[]): any => { const consoleArgs: any[] = []; diff --git a/packages/stark-core/src/modules/routing/services/routing.service.ts b/packages/stark-core/src/modules/routing/services/routing.service.ts index e0de3d4ad3..af3b7b4fc1 100644 --- a/packages/stark-core/src/modules/routing/services/routing.service.ts +++ b/packages/stark-core/src/modules/routing/services/routing.service.ts @@ -42,11 +42,7 @@ import { StarkStateConfigWithParams } from "./state-config-with-params.intf"; import { StarkCoreApplicationState } from "../../../common/store"; import { StarkConfigurationUtil } from "../../../util/configuration.util"; import { starkAppExitStateName, starkAppInitStateName } from "../../session/constants"; - -/** - * @ignore - */ -const _isEmpty: Function = require("lodash/isEmpty"); +import isEmpty from "lodash-es/isEmpty"; /** * @ignore @@ -515,7 +511,7 @@ export class StarkRoutingServiceImpl implements StarkRoutingService { (pathNode.state === this.getCurrentState() || this.isParentState(pathNode.state)) ) { const resolvablesData: { [key: string]: any } = this.extractResolvablesData(pathNode.resolvables); - const stateResolves: any = _isEmpty(resolvablesData) ? undefined : resolvablesData; + const stateResolves: any = isEmpty(resolvablesData) ? undefined : resolvablesData; stateTreeResolves.set(pathNode.state.name, stateResolves); } } @@ -548,7 +544,7 @@ export class StarkRoutingServiceImpl implements StarkRoutingService { pathNode.state !== pathNode.state.root() && (pathNode.state === this.getCurrentState() || this.isParentState(pathNode.state)) ) { - const stateData: any = _isEmpty(pathNode.state.data) ? undefined : pathNode.state.data; + const stateData: any = isEmpty(pathNode.state.data) ? undefined : pathNode.state.data; stateTreeData.set(pathNode.state.name, stateData); } } diff --git a/packages/stark-core/src/util/http.util.ts b/packages/stark-core/src/util/http.util.ts index ef4c863474..e9aa611f94 100644 --- a/packages/stark-core/src/util/http.util.ts +++ b/packages/stark-core/src/util/http.util.ts @@ -2,11 +2,7 @@ import { HttpParameterCodec, HttpParams } from "@angular/common/http"; import { StarkQueryParam } from "../modules/http/entities/http-request.entity.intf"; import { StarkHttpParameterCodec } from "../modules/http/entities/http-parameter-codec"; import { convertMapIntoObject } from "./util-helpers"; - -/** - * @ignore - */ -const _reduce: Function = require("lodash/reduce"); +import reduce from "lodash-es/reduce"; /** * A custom implementation of HttpParameterCodec to correctly encode query parameters. @@ -23,7 +19,7 @@ export class StarkHttpUtil { * @param starkQueryParam - params to convert */ public static convertStarkQueryParamsIntoHttpParams(starkQueryParam: Map): HttpParams { - return _reduce( + return reduce( convertMapIntoObject(starkQueryParam), // convert to object (httpParams: HttpParams, value: StarkQueryParam, key: string) => typeof value === "undefined" @@ -31,7 +27,7 @@ export class StarkHttpUtil { httpParams.set(key, "") : Array.isArray(value) ? // append each string to the key when set to an array - _reduce(value, (acc: HttpParams, entry: string) => acc.append(key, entry), httpParams) + reduce(value, (acc: HttpParams, entry: string) => acc.append(key, entry), httpParams) : httpParams.set(key, value), new HttpParams({ encoder: STARK_HTTP_PARAM_ENCODER }) ); diff --git a/packages/stark-core/src/validation/validators/is-bban/is-bban.validator.fn.ts b/packages/stark-core/src/validation/validators/is-bban/is-bban.validator.fn.ts index e187f73621..13c03ef9bb 100644 --- a/packages/stark-core/src/validation/validators/is-bban/is-bban.validator.fn.ts +++ b/packages/stark-core/src/validation/validators/is-bban/is-bban.validator.fn.ts @@ -1,7 +1,4 @@ -/** - * @ignore - */ -const _floor: Function = require("lodash/floor"); +import floor from "lodash-es/floor"; import { isValidBBAN } from "ibantools"; @@ -42,7 +39,7 @@ export function starkIsBBAN(bban: string, countryCode: string = ""): boolean { */ function calculateCheckDigit(bbanNumber: string): number { const firstPart: number = parseInt(bbanNumber.substring(0, bbanNumber.length - 2), 10); - let checkDigit: number = _floor(firstPart % 97); + let checkDigit: number = floor(firstPart % 97); if (checkDigit === 0) { checkDigit = 97; } diff --git a/packages/stark-core/src/validation/validators/is-establishment-unit-number/is-establishment-unit-number.validator.fn.ts b/packages/stark-core/src/validation/validators/is-establishment-unit-number/is-establishment-unit-number.validator.fn.ts index 952b171309..a59c4c328d 100644 --- a/packages/stark-core/src/validation/validators/is-establishment-unit-number/is-establishment-unit-number.validator.fn.ts +++ b/packages/stark-core/src/validation/validators/is-establishment-unit-number/is-establishment-unit-number.validator.fn.ts @@ -1,7 +1,4 @@ -/** - * @ignore - */ -const _floor: Function = require("lodash/floor"); +import floor from "lodash-es/floor"; /** * @ignore @@ -36,7 +33,7 @@ export function starkIsEstablishmentUnitNumber(establishmentNumber: string): boo const numberToCheck: number = parseInt(enterpriseNumber.substring(0, controlNumberBeginIndex), 10); // We validate 8 first digits with a mod-97 checksum algorithm - isValid = 97 - _floor(numberToCheck % 97) === controlNumber; + isValid = 97 - floor(numberToCheck % 97) === controlNumber; } return isValid; diff --git a/packages/stark-core/src/validation/validators/is-isin/is-isin.validator.fn.ts b/packages/stark-core/src/validation/validators/is-isin/is-isin.validator.fn.ts index 6cab084f6d..a6557e1b96 100644 --- a/packages/stark-core/src/validation/validators/is-isin/is-isin.validator.fn.ts +++ b/packages/stark-core/src/validation/validators/is-isin/is-isin.validator.fn.ts @@ -1,7 +1,4 @@ -/** - * @ignore - */ -const _floor: Function = require("lodash/floor"); +import floor from "lodash-es/floor"; /** * @ignore @@ -45,12 +42,12 @@ export function starkIsISIN(isin: string): boolean { digit *= 2; } - sum += _floor(digit / modulo); + sum += floor(digit / modulo); sum += digit % modulo; } const currentCheckDigit: number = parseInt(isin[lengthWithoutCheckDigit], base); - const expectedCheckDigit: number = sum % modulo === 0 ? 0 : (_floor(sum / modulo) + 1) * modulo - sum; + const expectedCheckDigit: number = sum % modulo === 0 ? 0 : (floor(sum / modulo) + 1) * modulo - sum; isValid = currentCheckDigit === expectedCheckDigit; } return isValid; diff --git a/packages/stark-core/src/validation/validators/is-nin/is-nin.validator.fn.ts b/packages/stark-core/src/validation/validators/is-nin/is-nin.validator.fn.ts index 2247290e78..53aa9b718a 100644 --- a/packages/stark-core/src/validation/validators/is-nin/is-nin.validator.fn.ts +++ b/packages/stark-core/src/validation/validators/is-nin/is-nin.validator.fn.ts @@ -1,7 +1,4 @@ -/** - * @ignore - */ -const _floor: Function = require("lodash/floor"); +import floor from "lodash-es/floor"; /** * @ignore @@ -79,7 +76,7 @@ function isValidBelgianNin(nin: string): boolean { const numberToCheck19thCentury: number = parseInt(getBirthDate(nin) + getOrder(nin), 10); const numberToCheck20thCentury: number = parseInt("2" + getBirthDate(nin) + getOrder(nin), 10); - return 97 - _floor(numberToCheck19thCentury % 97) === checkDigits || 97 - _floor(numberToCheck20thCentury % 97) === checkDigits; + return 97 - floor(numberToCheck19thCentury % 97) === checkDigits || 97 - floor(numberToCheck20thCentury % 97) === checkDigits; } } diff --git a/packages/stark-ui/src/common/message/message.entity.ts b/packages/stark-ui/src/common/message/message.entity.ts index 7a09b0da8f..c3155c78d7 100644 --- a/packages/stark-ui/src/common/message/message.entity.ts +++ b/packages/stark-ui/src/common/message/message.entity.ts @@ -1,10 +1,6 @@ import { StarkMessage } from "./message.intf"; import { StarkMessageType } from "./message-type.intf"; - -/** - * @ignore - */ -const _uniqueId: any = require("lodash/uniqueId"); +import uniqueId from "lodash-es/uniqueId"; /** * @ignore @@ -18,6 +14,6 @@ export class StarkMessageImpl implements StarkMessage { public constructor() { // set random id - this.id = _uniqueId(); + this.id = uniqueId(); } } diff --git a/packages/stark-ui/src/common/translations/merge-translations.ts b/packages/stark-ui/src/common/translations/merge-translations.ts index 8476a32a0a..22dc2ba753 100644 --- a/packages/stark-ui/src/common/translations/merge-translations.ts +++ b/packages/stark-ui/src/common/translations/merge-translations.ts @@ -1,12 +1,8 @@ +import merge from "lodash-es/merge"; import { TranslateService } from "@ngx-translate/core"; import { mergeTranslations, StarkLocale } from "@nationalbankbelgium/stark-core"; import { commonUiTranslations } from "./common-translations"; -/** - * @ignore - */ -const _merge: Function = require("lodash/merge"); - /** * This function can be used by Stark UI modules to merge their translations into existing translations, * without losing any existing translations. @@ -26,7 +22,7 @@ export function mergeUiTranslations(translateService: TranslateService, ...local for (const locale of localesToMerge) { allLocalesToMerge.push({ languageCode: locale.languageCode, - translations: _merge({}, commonUiTranslations[locale.languageCode], locale.translations) + translations: merge({}, commonUiTranslations[locale.languageCode], locale.translations) }); } diff --git a/packages/stark-ui/src/modules/date-picker/components/date-picker.component.ts b/packages/stark-ui/src/modules/date-picker/components/date-picker.component.ts index 06278e3964..b1803c3f7c 100644 --- a/packages/stark-ui/src/modules/date-picker/components/date-picker.component.ts +++ b/packages/stark-ui/src/modules/date-picker/components/date-picker.component.ts @@ -29,6 +29,7 @@ import { Subject, Subscription } from "rxjs"; import { FocusMonitor, FocusOrigin } from "@angular/cdk/a11y"; import { coerceBooleanProperty } from "@angular/cdk/coercion"; import { TranslateService } from "@ngx-translate/core"; +import isEqual from "lodash-es/isEqual"; /** * Type expected by `dateFilter` @Input. @@ -40,11 +41,6 @@ export type StarkDatePickerFilter = "OnlyWeekends" | "OnlyWeekdays" | ((date: Da */ export type StarkDatePickerMaskConfig = StarkTimestampMaskConfig | boolean | undefined; -/** - * @ignore - */ -const _isEqual: Function = require("lodash/isEqual"); - /** * Default DateMask configuration */ @@ -182,7 +178,7 @@ export class StarkDatePickerComponent extends AbstractStarkUiComponent } public set value(value: Date | null) { - if (!_isEqual(this._value, value)) { + if (!isEqual(this._value, value)) { this._value = value; this.stateChanges.next(); } diff --git a/packages/stark-ui/src/modules/dropdown/components/dropdown.component.ts b/packages/stark-ui/src/modules/dropdown/components/dropdown.component.ts index 961752154d..b32147f163 100644 --- a/packages/stark-ui/src/modules/dropdown/components/dropdown.component.ts +++ b/packages/stark-ui/src/modules/dropdown/components/dropdown.component.ts @@ -25,11 +25,8 @@ import { FocusMonitor, FocusOrigin } from "@angular/cdk/a11y"; import { MatSelectChange } from "@angular/material/select"; import { coerceBooleanProperty } from "@angular/cdk/coercion"; import { TranslateService } from "@ngx-translate/core"; +import isEqual from "lodash-es/isEqual"; -/** - * @ignore - */ -const _isEqual: Function = require("lodash/isEqual"); /** * Name of the component @@ -160,7 +157,7 @@ export class StarkDropdownComponent extends AbstractStarkUiComponent } public set value(value: any | any[]) { - if (!_isEqual(this._value, value)) { + if (!isEqual(this._value, value)) { this._value = value; this.stateChanges.next(); } diff --git a/packages/stark-ui/src/modules/generic-search/classes/abstract-form-component.ts b/packages/stark-ui/src/modules/generic-search/classes/abstract-form-component.ts index e568727446..79e287477c 100644 --- a/packages/stark-ui/src/modules/generic-search/classes/abstract-form-component.ts +++ b/packages/stark-ui/src/modules/generic-search/classes/abstract-form-component.ts @@ -1,14 +1,6 @@ import { StarkLoggingService } from "@nationalbankbelgium/stark-core"; - -/** - * @ignore - */ -const _cloneDeep: Function = require("lodash/cloneDeep"); - -/** - * @ignore - */ -const _isEqual: Function = require("lodash/isEqual"); +import cloneDeep from "lodash-es/cloneDeep"; +import isEqual from "lodash-es/isEqual"; /** * Abstract class defining the source model to bind to form components in Stark (i.e. {@link AbstractStarkSearchComponent}) @@ -37,14 +29,14 @@ export abstract class AbstractStarkFormComponent { */ protected setOriginalCopy(originalCopy: CriteriaType = {}): void { this.originalCopy = originalCopy; - this.workingCopy = _cloneDeep(this.originalCopy); + this.workingCopy = cloneDeep(this.originalCopy); } /** * Revert the form's working copy back to the original copy (a deep clone copy) */ protected reset(): void { - this.workingCopy = _cloneDeep(this.originalCopy); + this.workingCopy = cloneDeep(this.originalCopy); } /** @@ -52,6 +44,6 @@ export abstract class AbstractStarkFormComponent { * Performs a deep comparison between the two objects to determine if they are equivalent. */ protected isDirty(): boolean { - return !_isEqual(this.workingCopy, this.originalCopy); + return !isEqual(this.workingCopy, this.originalCopy); } } diff --git a/packages/stark-ui/src/modules/generic-search/components/generic-search/generic-search.component.ts b/packages/stark-ui/src/modules/generic-search/components/generic-search/generic-search.component.ts index c606d601c3..b0f8a3da6a 100644 --- a/packages/stark-ui/src/modules/generic-search/components/generic-search/generic-search.component.ts +++ b/packages/stark-ui/src/modules/generic-search/components/generic-search/generic-search.component.ts @@ -31,11 +31,7 @@ import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium import { FormGroup } from "@angular/forms"; import { animate, AnimationTriggerMetadata, state, style, transition, trigger } from "@angular/animations"; import { AbstractStarkUiComponent } from "../../../../common/classes/abstract-component"; - -/** - * @ignore - */ -const _isEqual: Function = require("lodash/isEqual"); +import isEqual from "lodash-es/isEqual"; /** * Name of the component @@ -262,7 +258,7 @@ export class StarkGenericSearchComponent extends AbstractStarkUiComponent implem if ( changesObj["formButtonsConfig"] && !changesObj["formButtonsConfig"].isFirstChange() && - !_isEqual(this.formButtonsConfig, this.normalizedFormButtonsConfig) + !isEqual(this.formButtonsConfig, this.normalizedFormButtonsConfig) ) { this.normalizedFormButtonsConfig = this.normalizeFormButtonsConfig(this.formButtonsConfig); } @@ -270,7 +266,7 @@ export class StarkGenericSearchComponent extends AbstractStarkUiComponent implem if ( changesObj["formActionBarConfig"] && !changesObj["formActionBarConfig"].isFirstChange() && - !_isEqual(this.formActionBarConfig, this.normalizedFormActionBarConfig) + !isEqual(this.formActionBarConfig, this.normalizedFormActionBarConfig) ) { this.normalizedFormActionBarConfig = this.normalizeFormActionBarConfig(this.formActionBarConfig); this.actionBarConfig = this.buildActionBarConfig(this.normalizedFormActionBarConfig); diff --git a/packages/stark-ui/src/modules/message-pane/reducers/messages-pane.reducer.ts b/packages/stark-ui/src/modules/message-pane/reducers/messages-pane.reducer.ts index c311dbd361..3811be39f2 100644 --- a/packages/stark-ui/src/modules/message-pane/reducers/messages-pane.reducer.ts +++ b/packages/stark-ui/src/modules/message-pane/reducers/messages-pane.reducer.ts @@ -2,11 +2,7 @@ import { StarkMessage, StarkMessageType } from "../../../common/message"; import { StarkMessageCollection } from "../entities"; import { StarkMessagePaneActions, StarkMessagePaneActionTypes } from "../actions"; import { StarkAddMessages, StarkRemoveMessages } from "../actions/message-pane.actions"; - -/** - * @ignore - */ -const _findIndex: Function = require("lodash/findIndex"); +import findIndex from "lodash-es/findIndex"; /** * Initial state of the store @@ -110,21 +106,21 @@ function removeMessages(state: Readonly, action: Readonl switch (messageToRemove.type) { case StarkMessageType.INFO: - idx = _findIndex(mutableState.infoMessages, ["id", messageToRemove.id]); + idx = findIndex(mutableState.infoMessages, ["id", messageToRemove.id]); if (idx !== -1) { mutableState.infoMessages.splice(idx, 1); newStateAfterRemoval.infoMessages = mutableState.infoMessages; } break; case StarkMessageType.WARNING: - idx = _findIndex(mutableState.warningMessages, ["id", messageToRemove.id]); + idx = findIndex(mutableState.warningMessages, ["id", messageToRemove.id]); if (idx !== -1) { mutableState.warningMessages.splice(idx, 1); newStateAfterRemoval.warningMessages = mutableState.warningMessages; } break; case StarkMessageType.ERROR: - idx = _findIndex(mutableState.errorMessages, ["id", messageToRemove.id]); + idx = findIndex(mutableState.errorMessages, ["id", messageToRemove.id]); if (idx !== -1) { mutableState.errorMessages.splice(idx, 1); newStateAfterRemoval.errorMessages = mutableState.errorMessages; diff --git a/packages/stark-ui/src/modules/pagination/components/pagination.component.ts b/packages/stark-ui/src/modules/pagination/components/pagination.component.ts index 0c1d4e5c87..b8c088a491 100644 --- a/packages/stark-ui/src/modules/pagination/components/pagination.component.ts +++ b/packages/stark-ui/src/modules/pagination/components/pagination.component.ts @@ -18,11 +18,7 @@ import { MatPaginator, MatPaginatorIntl, PageEvent } from "@angular/material/pag import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; import { StarkPaginationConfig } from "./pagination-config.intf"; import { StarkPaginateEvent } from "./paginate-event.intf"; - -/** - * @ignore - */ -const _isEqual: Function = require("lodash/isEqual"); +import isEqual from "lodash-es/isEqual"; /** * Name of the component @@ -151,7 +147,7 @@ export class StarkPaginationComponent extends MatPaginator implements OnInit, On ) { this.onChangePagination(); } else if ( - !_isEqual(paginationConfigOriginalChange, changesObj["paginationConfig"].previousValue) || + !isEqual(paginationConfigOriginalChange, changesObj["paginationConfig"].previousValue) || paginationConfigOriginalChange.totalItems !== this.paginationConfig.totalItems || paginationConfigOriginalChange.itemsPerPageOptions !== this.paginationConfig.itemsPerPageOptions ) { diff --git a/packages/stark-ui/src/modules/progress-indicator/reducers/progress-indicator.reducer.ts b/packages/stark-ui/src/modules/progress-indicator/reducers/progress-indicator.reducer.ts index b2edb99a47..c4f4c07f19 100644 --- a/packages/stark-ui/src/modules/progress-indicator/reducers/progress-indicator.reducer.ts +++ b/packages/stark-ui/src/modules/progress-indicator/reducers/progress-indicator.reducer.ts @@ -1,10 +1,6 @@ import { StarkProgressIndicatorConfig } from "../entities"; import { StarkProgressIndicatorActions, StarkProgressIndicatorActionTypes } from "../actions/progress-indicator.actions"; - -/** - * @ignore - */ -const _cloneDeep: Function = require("lodash/cloneDeep"); +import cloneDeep from "lodash-es/cloneDeep"; /** * Initial state of the reducer @@ -24,7 +20,7 @@ export function progressIndicatorReducer( action: StarkProgressIndicatorActions ): Map { // the new state will be calculated from the data coming in the actions - let newState: Map = _cloneDeep(state); + let newState: Map = cloneDeep(state); let topic: string; @@ -34,7 +30,7 @@ export function progressIndicatorReducer( topic = payload.topic; if (newState.has(topic)) { - const progressIndicatorConfig: StarkProgressIndicatorConfig = _cloneDeep(newState.get(topic)); + const progressIndicatorConfig: StarkProgressIndicatorConfig = cloneDeep(newState.get(topic)); progressIndicatorConfig.listenersCount = progressIndicatorConfig.listenersCount + 1; newState = newState.set(topic, progressIndicatorConfig); } else { @@ -47,7 +43,7 @@ export function progressIndicatorReducer( topic = action.payload; if (newState.has(topic)) { - const progressIndicatorConfig: StarkProgressIndicatorConfig = _cloneDeep(newState.get(topic)); + const progressIndicatorConfig: StarkProgressIndicatorConfig = cloneDeep(newState.get(topic)); progressIndicatorConfig.listenersCount = progressIndicatorConfig.listenersCount - 1; @@ -64,7 +60,7 @@ export function progressIndicatorReducer( topic = action.payload; if (newState.has(topic)) { - const progressIndicatorConfig: StarkProgressIndicatorConfig = _cloneDeep(newState.get(topic)); + const progressIndicatorConfig: StarkProgressIndicatorConfig = cloneDeep(newState.get(topic)); progressIndicatorConfig.visible = true; progressIndicatorConfig.pendingListenersCount = progressIndicatorConfig.pendingListenersCount + 1; newState = newState.set(topic, progressIndicatorConfig); @@ -76,7 +72,7 @@ export function progressIndicatorReducer( topic = action.payload; if (newState.has(topic)) { - const progressIndicatorConfig: StarkProgressIndicatorConfig = _cloneDeep(newState.get(topic)); + const progressIndicatorConfig: StarkProgressIndicatorConfig = cloneDeep(newState.get(topic)); if (progressIndicatorConfig.pendingListenersCount > 0) { progressIndicatorConfig.pendingListenersCount = progressIndicatorConfig.pendingListenersCount - 1; diff --git a/packages/stark-ui/src/modules/route-search/components/route-search.component.ts b/packages/stark-ui/src/modules/route-search/components/route-search.component.ts index cc3270669f..be43db6ff7 100644 --- a/packages/stark-ui/src/modules/route-search/components/route-search.component.ts +++ b/packages/stark-ui/src/modules/route-search/components/route-search.component.ts @@ -15,11 +15,7 @@ import { import { AbstractStarkUiComponent } from "../../../common/classes/abstract-component"; import { StarkRouteSearchEntry } from "../components/route-search-entry.intf"; import { StarkMenuConfig, StarkMenuGroup } from "../../app-menu/components"; - -/** - * @ignore - */ -const _sortBy: Function = require("lodash/sortBy"); +import sortBy from "lodash-es/sortBy"; /** * Name of the component @@ -298,7 +294,7 @@ export class StarkRouteSearchComponent extends AbstractStarkUiComponent implemen * @returns the sorted array of {@link StarkRouteSearchEntry} objects */ public sortRoutesLabels(routeEntries: StarkRouteSearchEntry[]): StarkRouteSearchEntry[] { - routeEntries = _sortBy(routeEntries, ["label"]); + routeEntries = sortBy(routeEntries, ["label"]); return routeEntries; } diff --git a/packages/stark-ui/src/modules/slider/components/slider.component.ts b/packages/stark-ui/src/modules/slider/components/slider.component.ts index 8d0adda7c6..90c8f03fac 100644 --- a/packages/stark-ui/src/modules/slider/components/slider.component.ts +++ b/packages/stark-ui/src/modules/slider/components/slider.component.ts @@ -1,3 +1,4 @@ +import isEqual from "lodash-es/isEqual"; import { AfterViewInit, Component, @@ -12,20 +13,12 @@ import { SimpleChanges, ViewEncapsulation } from "@angular/core"; - import * as noUiSliderLibrary from "nouislider"; - import { STARK_LOGGING_SERVICE, STARK_ROUTING_SERVICE, StarkLoggingService, StarkRoutingService } from "@nationalbankbelgium/stark-core"; - import { StarkDOMUtil } from "../../../util/dom/dom.util"; import { StarkSliderConfig } from "./slider-config.intf"; import { AbstractStarkUiComponent } from "../../../common/classes/abstract-component"; -/** - * @ignore - */ -const _isEqual: Function = require("lodash/isEqual"); - /** * Name of the component */ @@ -135,7 +128,7 @@ export class StarkSliderComponent extends AbstractStarkUiComponent implements Af */ public ngOnChanges(onChangesObj: SimpleChanges): void { // cannot compare using slider.get() method because it returns the current formatted values (we need to compare the unencoded values) - if (onChangesObj["values"] && !onChangesObj["values"].isFirstChange() && !_isEqual(this.latestUnencodedValues, this.values)) { + if (onChangesObj["values"] && !onChangesObj["values"].isFirstChange() && !isEqual(this.latestUnencodedValues, this.values)) { this.updateSliderInstanceValues(); } } @@ -158,7 +151,7 @@ export class StarkSliderComponent extends AbstractStarkUiComponent implements Af */ public attachSliderInstanceUpdateHandler(): void { this.slider.on("update", (_values: string[], _handle: number, unencodedValues: number[]) => { - if (!_isEqual(this.values, unencodedValues)) { + if (!isEqual(this.values, unencodedValues)) { this.values = unencodedValues; this.latestUnencodedValues = unencodedValues; diff --git a/packages/stark-ui/src/modules/table/components/column.component.ts b/packages/stark-ui/src/modules/table/components/column.component.ts index e441221d4c..29a4c7fe8f 100644 --- a/packages/stark-ui/src/modules/table/components/column.component.ts +++ b/packages/stark-ui/src/modules/table/components/column.component.ts @@ -18,18 +18,10 @@ import { TranslateService } from "@ngx-translate/core"; import { AbstractStarkUiComponent } from "../../../common/classes/abstract-component"; import { FormControl } from "@angular/forms"; import { distinctUntilChanged } from "rxjs/operators"; +import isEqual from "lodash-es/isEqual"; +import get from "lodash-es/get"; import { StarkColumnFilterChangedOutput, StarkColumnSortChangedOutput, StarkTableColumnSortingDirection } from "../entities"; -/** - * @ignore - */ -const _isEqual: Function = require("lodash/isEqual"); - -/** - * @ignore - */ -const _get: Function = require("lodash/get"); - /** * Component to display a column inside the StarkTableComponent */ @@ -215,7 +207,7 @@ export class StarkTableColumnComponent extends AbstractStarkUiComponent implemen if ( simpleChanges["filterValue"] && !simpleChanges["filterValue"].isFirstChange() && - !_isEqual(simpleChanges["filterValue"].previousValue, simpleChanges["filterValue"].currentValue) + !isEqual(simpleChanges["filterValue"].previousValue, simpleChanges["filterValue"].currentValue) ) { this._filterFormCtrl.setValue(this.filterValue); } @@ -234,7 +226,7 @@ export class StarkTableColumnComponent extends AbstractStarkUiComponent implemen * @returns The raw value of the property from the given row item */ public getRawValue(row: object): any | undefined { - let rawValue: any | undefined = _get(row, this.name); + let rawValue: any | undefined = get(row, this.name); if (this.dataAccessor) { rawValue = this.dataAccessor(row, this.name); diff --git a/packages/stark-ui/src/util/form/form.util.spec.ts b/packages/stark-ui/src/util/form/form.util.spec.ts index 4a5db0909b..957ca7ab43 100644 --- a/packages/stark-ui/src/util/form/form.util.spec.ts +++ b/packages/stark-ui/src/util/form/form.util.spec.ts @@ -1,8 +1,7 @@ /* tslint:disable:completed-docs no-identical-functions */ import { StarkFormControlState, StarkFormUtil } from "./form.util"; import { FormControl, FormGroup } from "@angular/forms"; - -const _startCase: Function = require("lodash/startCase"); +import startCase from "lodash-es/startCase"; /* tslint:disable:no-big-function */ describe("Util: FormUtil", () => { @@ -28,14 +27,14 @@ describe("Util: FormUtil", () => { function assertFormControl(formItem: FormControl, newState?: string): void { if (newState) { - const newStateSetter: string = "markAs" + _startCase(newState); + const newStateSetter: string = "markAs" + startCase(newState); expect(formItem[newStateSetter]).toHaveBeenCalledTimes(1); } // check that the setters for other states where not called const nonUsedStates: string[] = formItemStates.filter((state: string) => state !== newState); for (const nonUsedState of nonUsedStates) { - const nonUsedStateSetter: string = "markAs" + _startCase(nonUsedState); + const nonUsedStateSetter: string = "markAs" + startCase(nonUsedState); expect(formItem[nonUsedStateSetter]).not.toHaveBeenCalled(); } } diff --git a/showcase/src/app/demo-ui/pages/generic-search/components/demo-generic-search-form.component.ts b/showcase/src/app/demo-ui/pages/generic-search/components/demo-generic-search-form.component.ts index eab12febc6..2df4f48139 100644 --- a/showcase/src/app/demo-ui/pages/generic-search/components/demo-generic-search-form.component.ts +++ b/showcase/src/app/demo-ui/pages/generic-search/components/demo-generic-search-form.component.ts @@ -5,8 +5,8 @@ import { FormBuilder, FormGroup } from "@angular/forms"; import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; import { DemoGenericService } from "../services"; import { take } from "rxjs/operators"; +import isEqual from "lodash-es/isEqual"; -const _isEqual: Function = require("lodash/isEqual"); const componentName: string = "demo-generic-search-form"; @Component({ @@ -60,7 +60,7 @@ export class DemoGenericSearchFormComponent implements OnInit, OnChanges, StarkS if ( changes["searchCriteria"] && !changes["searchCriteria"].isFirstChange() && - !_isEqual(changes["searchCriteria"].previousValue, this.searchCriteria) + !isEqual(changes["searchCriteria"].previousValue, this.searchCriteria) ) { this.resetSearchForm(this.searchCriteria); } diff --git a/showcase/src/app/demo-ui/pages/message-pane/demo-message-pane-page.component.ts b/showcase/src/app/demo-ui/pages/message-pane/demo-message-pane-page.component.ts index ef5bddfef3..51d9e7b683 100644 --- a/showcase/src/app/demo-ui/pages/message-pane/demo-message-pane-page.component.ts +++ b/showcase/src/app/demo-ui/pages/message-pane/demo-message-pane-page.component.ts @@ -7,9 +7,9 @@ import { } from "@nationalbankbelgium/stark-ui"; import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; import { ReferenceLink } from "../../../shared/components"; +import uniqueId from "lodash-es/uniqueId"; const componentName: string = "demo-message-pane"; -const _uniqueId: any = require("lodash/uniqueId"); /** * @ngdoc component @@ -49,7 +49,7 @@ export class DemoMessagePanePageComponent implements OnInit { public notifyMessages(): void { this.starkMessagePaneService.add([ { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.ERRORS.ERROR_1", interpolateValues: { priority: "priority = 500" }, code: "54987", @@ -57,7 +57,7 @@ export class DemoMessagePanePageComponent implements OnInit { priority: 500 }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.ERRORS.ERROR_2", interpolateValues: { priority: "priority = 10" }, code: "333", @@ -65,7 +65,7 @@ export class DemoMessagePanePageComponent implements OnInit { priority: 10 }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.ERRORS.ERROR_3", interpolateValues: { priority: "priority = 200" }, code: "777", @@ -73,7 +73,7 @@ export class DemoMessagePanePageComponent implements OnInit { priority: 200 }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.WARNINGS.WARNING_1", interpolateValues: { priority: "priority = 1" }, code: "", @@ -81,21 +81,21 @@ export class DemoMessagePanePageComponent implements OnInit { priority: 1 }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.WARNINGS.WARNING_2", interpolateValues: { priority: "priority = undefined" }, code: "PMO", type: StarkMessageType.WARNING }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.INFOS.INFO_1", interpolateValues: { priority: "priority = undefined" }, code: "54987", type: StarkMessageType.INFO }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.INFOS.INFO_2", interpolateValues: { priority: "priority = 998" }, code: "333", @@ -113,35 +113,35 @@ export class DemoMessagePanePageComponent implements OnInit { this.starkMessagePaneService.clearAll(); this.starkMessagePaneService.add([ { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.ERRORS.NEW_ERROR_1", interpolateValues: {}, code: "54987", type: StarkMessageType.ERROR }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.ERRORS.NEW_ERROR_2", interpolateValues: {}, code: "333", type: StarkMessageType.ERROR }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.WARNINGS.NEW_WARNING_1", interpolateValues: {}, code: "", type: StarkMessageType.WARNING }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.INFOS.NEW_INFO_1", interpolateValues: {}, code: "54987", type: StarkMessageType.INFO }, { - id: _uniqueId(), + id: uniqueId(), key: "SHOWCASE.DEMO.MESSAGE_PANE.MESSAGES.INFOS.NEW_INFO_2", interpolateValues: {}, code: "333", diff --git a/showcase/src/app/in-memory-data/interceptors/in-memory-data.interceptor.ts b/showcase/src/app/in-memory-data/interceptors/in-memory-data.interceptor.ts index 28c7808f2a..50b58229b7 100644 --- a/showcase/src/app/in-memory-data/interceptors/in-memory-data.interceptor.ts +++ b/showcase/src/app/in-memory-data/interceptors/in-memory-data.interceptor.ts @@ -2,9 +2,8 @@ import { Injectable } from "@angular/core"; import { HttpEvent, HttpHandler, HttpHeaders, HttpInterceptor, HttpRequest, HttpResponse } from "@angular/common/http"; import { Observable } from "rxjs"; import { map } from "rxjs/operators"; - -const _cloneDeep: Function = require("lodash/cloneDeep"); -const _uniqueId: Function = require("lodash/uniqueId"); +import cloneDeep from "lodash-es/cloneDeep"; +import uniqueId from "lodash-es/uniqueId"; export interface HostUrlParts { protocol?: string; @@ -89,7 +88,7 @@ export class InMemoryDataHttpInterceptor implements HttpInterceptor { let modifiedRequest: HttpRequest; // add a unique Id to the new item(s) if they don't have any - const normalizedBody: any = _cloneDeep(request.body); + const normalizedBody: any = cloneDeep(request.body); this.deepSetUniqueId(normalizedBody, "id"); modifiedRequest = request.clone({ @@ -129,7 +128,7 @@ export class InMemoryDataHttpInterceptor implements HttpInterceptor { let modifiedResponse: HttpResponse = httpResponse; if (httpResponse.body instanceof Array) { - const normalizedBody: any = _cloneDeep(httpResponse.body); + const normalizedBody: any = cloneDeep(httpResponse.body); modifiedResponse = httpResponse.clone({ body: { items: normalizedBody, metadata: {} } // TODO: collection metadata @@ -154,7 +153,7 @@ export class InMemoryDataHttpInterceptor implements HttpInterceptor { } } else if (typeof item === "object") { if (!item.hasOwnProperty(idProperty)) { - item[idProperty] = _uniqueId(); + item[idProperty] = uniqueId(); } Object.keys(item).forEach((subItem: any) => { @@ -194,6 +193,6 @@ export class InMemoryDataHttpInterceptor implements HttpInterceptor { } protected generateXSRFToken(): string { - return _uniqueId("xsrf-token-"); + return uniqueId("xsrf-token-"); } } diff --git a/showcase/src/app/in-memory-data/services/in-memory-data.service.ts b/showcase/src/app/in-memory-data/services/in-memory-data.service.ts index bbc88ee178..4405d68a02 100644 --- a/showcase/src/app/in-memory-data/services/in-memory-data.service.ts +++ b/showcase/src/app/in-memory-data/services/in-memory-data.service.ts @@ -1,5 +1,6 @@ import { Inject, Injectable } from "@angular/core"; import { Observable } from "rxjs"; +import cloneDeep from "lodash-es/cloneDeep"; // using the full path to import the "angular-in-memory-web-api" interfaces to avoid adding "@angular/http" to Showcase npm dependencies! // see https://github.com/angular/in-memory-web-api/issues/215 import { @@ -11,7 +12,6 @@ import { } from "angular-in-memory-web-api/interfaces"; import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; -const _cloneDeep: Function = require("lodash/cloneDeep"); const mockData: object = require("../../../../config/json-server/data.json"); @Injectable() @@ -29,7 +29,7 @@ export class InMemoryDataService implements InMemoryDbService { */ public createDb(_reqInfo?: RequestInfo): {} | Observable<{}> | Promise<{}> { // replace the "uuid" field defined in the mock data by the "id" field expected by the in-memory-db - const normalizedMockData: object = _cloneDeep(mockData); // avoid modifying the original mock data + const normalizedMockData: object = cloneDeep(mockData); // avoid modifying the original mock data this.deepReplaceProperty(normalizedMockData, "uuid", "id"); // IMPORTANT: cannot mock "logging" and "logout" requests since they are performed via XHR and not via Angular @@ -95,7 +95,7 @@ export class InMemoryDataService implements InMemoryDbService { // a full copy of the database can be retrieved by calling _requestInfo.utils.getDb()) // replace the "id" field coming from the in-memory-db by the "uuid" field expected by the application - const normalizedBody: any = _cloneDeep(response.body); + const normalizedBody: any = cloneDeep(response.body); this.deepReplaceProperty(normalizedBody, "id", "uuid"); response.body = normalizedBody; diff --git a/showcase/src/app/shared/effects/stark-error-handling.effects.ts b/showcase/src/app/shared/effects/stark-error-handling.effects.ts index 2ee335c377..41abe12c0c 100644 --- a/showcase/src/app/shared/effects/stark-error-handling.effects.ts +++ b/showcase/src/app/shared/effects/stark-error-handling.effects.ts @@ -4,11 +4,7 @@ import { map } from "rxjs/operators"; import { Observable } from "rxjs"; import { STARK_TOAST_NOTIFICATION_SERVICE, StarkMessageType, StarkToastNotificationService } from "@nationalbankbelgium/stark-ui"; import { StarkErrorHandlingActionTypes, StarkUnhandledError } from "@nationalbankbelgium/stark-core"; - -/** - * Unique Id of the displayed toaster - */ -const _uniqueId: Function = require("lodash/uniqueId"); +import uniqueId from "lodash-es/uniqueId"; /** * This class is used to determine what to do with an error @@ -33,7 +29,7 @@ export class StarkErrorHandlingEffects { this.zone.run(() => { this.toastNotificationService .show({ - id: _uniqueId(), + id: uniqueId(), type: StarkMessageType.ERROR, key: action.error.toString(), code: "Unhandled error - no code" diff --git a/showcase/src/assets/examples/message-pane/message-pane.ts b/showcase/src/assets/examples/message-pane/message-pane.ts index b0d4d0a642..f12dfb88d4 100644 --- a/showcase/src/assets/examples/message-pane/message-pane.ts +++ b/showcase/src/assets/examples/message-pane/message-pane.ts @@ -6,9 +6,9 @@ import { StarkMessageType } from "@nationalbankbelgium/stark-ui"; import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; +import uniqueId from "lodash-es/uniqueId"; const componentName: string = "demo-message-pane"; -const _uniqueId: any = require("lodash/uniqueId"); /** * @ngdoc component @@ -40,7 +40,7 @@ export class DemoMessagePaneComponent implements OnInit { public notifyMessages(): void { this.starkMessagePaneService.add([ { - id: _uniqueId(), + id: uniqueId(), key: "Error 1: Too many fingers on the keyboard - priority 500", interpolateValues: { priority: "priority = 500" }, code: "54987", @@ -48,7 +48,7 @@ export class DemoMessagePaneComponent implements OnInit { priority: 500 }, { - id: _uniqueId(), + id: uniqueId(), key: "Error 2: priority 10", interpolateValues: { priority: "priority = 10" }, code: "333", @@ -56,7 +56,7 @@ export class DemoMessagePaneComponent implements OnInit { priority: 10 }, { - id: _uniqueId(), + id: uniqueId(), key: "Error 3: priority 200", interpolateValues: { priority: "priority = 200" }, code: "777", @@ -64,7 +64,7 @@ export class DemoMessagePaneComponent implements OnInit { priority: 200 }, { - id: _uniqueId(), + id: uniqueId(), key: "Warning 1: priority 1", interpolateValues: { priority: "priority = 1" }, code: "", @@ -72,21 +72,21 @@ export class DemoMessagePaneComponent implements OnInit { priority: 1 }, { - id: _uniqueId(), + id: uniqueId(), key: "Warning 2: priority undefined", interpolateValues: { priority: "priority = undefined" }, code: "PMO", type: StarkMessageType.WARNING }, { - id: _uniqueId(), + id: uniqueId(), key: "Info 1: priority undefined", interpolateValues: { priority: "priority = undefined" }, code: "54987", type: StarkMessageType.INFO }, { - id: _uniqueId(), + id: uniqueId(), key: "Info 2: priority 998", interpolateValues: { priority: "priority = 998" }, code: "333", @@ -104,35 +104,35 @@ export class DemoMessagePaneComponent implements OnInit { this.starkMessagePaneService.clearAll(); this.starkMessagePaneService.add([ { - id: _uniqueId(), + id: uniqueId(), key: "New Error 1", interpolateValues: {}, code: "54987", type: StarkMessageType.ERROR }, { - id: _uniqueId(), + id: uniqueId(), key: "New Error 2", interpolateValues: {}, code: "333", type: StarkMessageType.ERROR }, { - id: _uniqueId(), + id: uniqueId(), key: "New warning 1", interpolateValues: {}, code: "", type: StarkMessageType.WARNING }, { - id: _uniqueId(), + id: uniqueId(), key: "New info 1", interpolateValues: {}, code: "54987", type: StarkMessageType.INFO }, { - id: _uniqueId(), + id: uniqueId(), key: "New info 2", interpolateValues: {}, code: "333",