@bravobit/bb-foundation 0.57.4 → 0.57.5
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/fesm2022/bravobit-bb-foundation-auth.mjs +22 -22
- package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-collections.mjs +43 -43
- package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs +25 -25
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dialog.mjs +34 -34
- package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-elements.mjs +102 -101
- package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-http.mjs +10 -10
- package/fesm2022/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-localize.mjs +16 -16
- package/fesm2022/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-masking.mjs +16 -16
- package/fesm2022/bravobit-bb-foundation-masking.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-notifications.mjs +13 -13
- package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-permissions.mjs +10 -10
- package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +10 -10
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-select.mjs +22 -22
- package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-storage.mjs +3 -3
- package/fesm2022/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-table.mjs +22 -22
- package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs +10 -10
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-utils.mjs +16 -16
- package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation.mjs +21 -21
- package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
- package/package.json +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bravobit-bb-foundation-masking.mjs","sources":["../../../projects/bb-foundation/masking/src/lib/input-mask.interface.ts","../../../projects/bb-foundation/masking/src/lib/directives/input-mask.directive.ts","../../../projects/bb-foundation/masking/src/lib/masking.service.ts","../../../projects/bb-foundation/masking/src/lib/directives/currency-mask.directive.ts","../../../projects/bb-foundation/masking/src/lib/directives/date-mask.directive.ts","../../../projects/bb-foundation/masking/src/lib/masking.module.ts","../../../projects/bb-foundation/masking/src/bravobit-bb-foundation-masking.ts"],"sourcesContent":["import type Inputmask from 'inputmask';\n\nexport type InputMaskOptions<T> = Inputmask.Options & {\n parser?: (value: any) => T;\n};\n\nexport type CurrencyMaskOptions = {\n symbol: string;\n symbolFormat: 'wide' | 'narrow';\n spacer: string;\n digits: number;\n digitsOptional: boolean;\n decimalCharacter: string;\n groupCharacter: string;\n min: number;\n max: number;\n allowMinus: boolean;\n nullable: boolean;\n}\n\nexport type DateMaskFormat =\n 'day-month-year' |\n 'month-day-year' |\n 'year-month-day' |\n 'year-day-month';\n\nexport const createMask = <T>(options: string | InputMaskOptions<T>) => typeof options === 'string' ? {mask: options} : options;\n","import {Directive, ElementRef, HostListener, Input, NgZone, OnDestroy, OnInit, Optional, Renderer2, Self} from '@angular/core';\nimport {AbstractControl, ControlValueAccessor, NgControl, Validator} from '@angular/forms';\nimport {InputMaskOptions} from '../input-mask.interface';\nimport {fromEvent, merge, Subscription} from 'rxjs';\nimport {Platform} from '@angular/cdk/platform';\nimport type Inputmask from 'inputmask';\nimport _Inputmask from 'inputmask';\n\nconst InputmaskConstructor = (_Inputmask as unknown as { default?: Inputmask.Static }).default || _Inputmask;\n\n@Directive({\n selector: 'input[bbInputMask],input[bbCurrencyMask],input[bbDateMask]'\n})\nexport class BbInputMask<T = any> implements OnInit, OnDestroy, ControlValueAccessor, Validator {\n\n @Input('bbInputMask')\n set mask(mask: InputMaskOptions<T> | string | null | undefined) {\n if (!mask || typeof mask === 'string') {\n return;\n }\n\n this._inputMaskOptions = mask;\n this.updateMask();\n }\n\n // State.\n inputMaskPlugin: Inputmask.Instance | null = null;\n nativeInputElement: HTMLInputElement | null = null;\n eventsSubscription: Subscription | null = null;\n\n private _inputMaskOptions: InputMaskOptions<T> | null = null;\n private _onChange: (value: T | null) => void = () => ({});\n\n constructor(private _ngZone: NgZone,\n private _platform: Platform,\n private _renderer: Renderer2,\n private _elementRef: ElementRef<HTMLInputElement>,\n @Optional() @Self() private _control?: NgControl) {\n this.nativeInputElement = this._elementRef.nativeElement;\n if (this._control != null) {\n this._control.valueAccessor = this;\n }\n }\n\n @HostListener('input', ['$event.target.value'])\n onInput: (value: any) => void = (_: any) => ({});\n\n @HostListener('blur', ['$event.target.value'])\n onTouched: () => void = () => ({});\n\n ngOnInit() {\n const control = this._control?.control;\n if (!control) {\n return;\n }\n\n control?.setValidators(control.validator ? [control.validator, this.validate] : [this.validate]);\n control?.updateValueAndValidity();\n }\n\n ngOnDestroy() {\n this.destroyMask();\n }\n\n writeValue(value: string) {\n if (!this.nativeInputElement) {\n return;\n }\n this._renderer.setProperty(this.nativeInputElement, 'value', value ?? '');\n }\n\n registerOnChange(fn: (value: T | null) => void) {\n this._onChange = fn;\n const parser = this._inputMaskOptions?.parser;\n this.onInput = value => this._onChange(parser ? parser(value) : value);\n }\n\n registerOnTouched(fn: () => void) {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean) {\n if (!this.nativeInputElement) {\n return;\n }\n this._renderer.setProperty(this.nativeInputElement, 'disabled', isDisabled);\n }\n\n validate = (control: AbstractControl) => !control.value || !this.inputMaskPlugin || this.inputMaskPlugin?.isValid()\n ? null\n : {inputMask: true};\n\n private updateMask() {\n this.destroyMask();\n this.createMask();\n this.registerOnChange(this._onChange);\n }\n\n private createMask() {\n if (!this._platform.isBrowser || !this.nativeInputElement || this._inputMaskOptions === null || Object.keys(this._inputMaskOptions).length === 0) {\n return;\n }\n\n const {parser, ...options} = this._inputMaskOptions;\n this.inputMaskPlugin = this._ngZone.runOutsideAngular(() => new InputmaskConstructor(options).mask(this.nativeInputElement));\n\n const setValue$ = fromEvent(this.nativeInputElement, 'setvalue');\n const cleared$ = fromEvent(this.nativeInputElement, 'cleared');\n\n this.eventsSubscription = merge(setValue$, cleared$)\n .subscribe(event => this.onInput(event?.target?.['value']));\n\n const control = this._control?.control;\n if (!control) {\n return;\n }\n setTimeout(() => control?.updateValueAndValidity());\n }\n\n private destroyMask() {\n this.eventsSubscription?.unsubscribe();\n this.eventsSubscription = null;\n this.inputMaskPlugin?.remove();\n this.inputMaskPlugin = null;\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbInputMask: InputMaskOptions<any> | string | null | undefined;\n\n}\n","import {formatDate, getCurrencySymbol, getLocaleNumberSymbol, getNumberOfCurrencyDigits, NumberSymbol} from '@angular/common';\nimport {createMask, CurrencyMaskOptions, DateMaskFormat} from './input-mask.interface';\nimport {Localize} from '@bravobit/bb-foundation/localize';\nimport {Injectable, Optional} from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Masking {\n\n constructor(@Optional() private _localize?: Localize) {\n }\n\n date(format: DateMaskFormat, separator: string = '-') {\n const dateParts = this.getDateParts(format);\n const inputFormat = dateParts.join(separator);\n const outputFormat = 'yyyy-MM-dd';\n\n const escape = /[.*+?^${}()\\/|[\\]\\\\]/g;\n const escapedSeparator = separator.replace(escape, '\\\\$&');\n\n const inputFormatRegexString = dateParts\n .map(item => `(?<${item}>[0-9]{${item?.length}})`)\n .join(escapedSeparator);\n const inputFormatRegex = new RegExp(`^${inputFormatRegexString}$`);\n\n return createMask({\n alias: 'datetime',\n inputFormat: inputFormat.toLowerCase(),\n outputFormat: outputFormat.toLowerCase(),\n nullable: false,\n inputmode: 'numeric',\n onBeforeMask: (initialValue: string) => {\n return initialValue ? formatDate(initialValue, inputFormat, 'en-US') : null;\n },\n onBeforePaste: (value: string) => {\n return value;\n },\n parser: (value: string) => {\n if (!value || typeof value !== 'string' || !inputFormatRegex.test(value)) {\n return null;\n }\n const matches = value.match(inputFormatRegex);\n const year = +matches?.groups?.['yyyy'];\n const month = +matches?.groups?.['MM'] - 1;\n const day = +matches?.groups?.['dd'];\n const date = new Date(year, month, day);\n\n return date instanceof Date && !isNaN(<any>date)\n ? formatDate(date, outputFormat, 'en-US')\n : null;\n }\n });\n }\n\n currency(code: string, options?: Partial<CurrencyMaskOptions>) {\n const locale = this._localize?.current?.locale ?? 'en';\n const symbol = options?.symbol ?? getCurrencySymbol(code, options?.symbolFormat ?? 'narrow', locale);\n\n const decimal = options?.decimalCharacter ?? getLocaleNumberSymbol(locale, NumberSymbol.CurrencyDecimal);\n const group = options?.groupCharacter ?? getLocaleNumberSymbol(locale, NumberSymbol.CurrencyGroup);\n const digits = options?.digits ?? getNumberOfCurrencyDigits(code);\n const spacer = options?.spacer ?? ' ';\n\n return createMask({\n alias: 'numeric',\n inputType: 'number',\n digits: digits,\n allowMinus: options?.allowMinus ?? false,\n min: options?.min ?? 0,\n max: options?.max ?? Number.MAX_SAFE_INTEGER,\n prefix: `${symbol}${spacer}`,\n radixPoint: decimal ?? '.',\n groupSeparator: group ?? ',',\n digitsOptional: options?.digitsOptional ?? false,\n nullable: options?.nullable ?? true,\n autoUnmask: true,\n unmaskAsNumber: true,\n rightAlign: false,\n showMaskOnHover: false,\n showMaskOnFocus: false,\n inputmode: digits > 0 ? 'decimal' : 'numeric',\n parser: (value: string | number) => {\n if (value === '') {\n return null;\n }\n return value;\n }\n });\n }\n\n private getDateParts(format: DateMaskFormat) {\n switch (format) {\n case 'day-month-year':\n return ['dd', 'MM', 'yyyy'];\n case 'month-day-year':\n return ['MM', 'dd', 'yyyy'];\n case 'year-day-month':\n return ['yyyy', 'dd', 'MM'];\n case 'year-month-day':\n default:\n return ['yyyy', 'MM', 'dd'];\n }\n }\n\n}\n","import {Directive, Input, OnChanges, Self, SimpleChanges} from '@angular/core';\nimport {CurrencyMaskOptions} from '../input-mask.interface';\nimport {BbInputMask} from './input-mask.directive';\nimport {Masking} from '../masking.service';\n\n@Directive({\n selector: 'input[bbCurrencyMask]'\n})\nexport class BbCurrencyMask implements OnChanges {\n\n // Inputs.\n @Input('bbCurrencyMask') currencyCode: string | null = null;\n @Input('bbCurrencyMaskOptions') options: Partial<CurrencyMaskOptions> | null = null;\n\n constructor(private _masking: Masking,\n @Self() private _inputMask: BbInputMask) {\n }\n\n ngOnChanges(changes: SimpleChanges) {\n const currencyCode = changes?.['currencyCode']?.currentValue ?? this.currencyCode ?? 'USD';\n const options = changes?.['options']?.currentValue ?? this.options ?? {};\n\n this._inputMask.mask = this._masking.currency(currencyCode, options);\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbCurrencyMask: string | null | undefined;\n static ngAcceptInputType_bbCurrencyMaskOptions: Partial<CurrencyMaskOptions> | null | undefined;\n\n}\n","import {Directive, Input, OnChanges, Self, SimpleChanges} from '@angular/core';\nimport {DateMaskFormat} from '../input-mask.interface';\nimport {BbInputMask} from './input-mask.directive';\nimport {Masking} from '../masking.service';\n\n@Directive({\n selector: 'input[bbDateMask]'\n})\nexport class BbDateMask implements OnChanges {\n\n // Inputs.\n @Input('bbDateMask') format: DateMaskFormat | null = null;\n @Input('bbDateMaskSeparator') separator: string | null = null;\n\n constructor(private _masking: Masking,\n @Self() private _inputMask: BbInputMask) {\n }\n\n ngOnChanges(changes: SimpleChanges) {\n const format = changes?.['format']?.currentValue ?? this.format ?? null;\n const separator = changes?.['separator']?.currentValue ?? this.separator ?? '-';\n this._inputMask.mask = this._masking.date(format, separator);\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbDateMask: DateMaskFormat | null | undefined;\n static ngAcceptInputType_bbDateMaskSeparator: string | null | undefined;\n\n}\n","import {BbCurrencyMask} from './directives/currency-mask.directive';\nimport {BbInputMask} from './directives/input-mask.directive';\nimport {BbDateMask} from './directives/date-mask.directive';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [\n BbInputMask,\n BbCurrencyMask,\n BbDateMask\n ],\n exports: [\n BbInputMask,\n BbCurrencyMask,\n BbDateMask\n ]\n})\nexport class MaskingModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i1.Masking","i2.BbInputMask"],"mappings":";;;;;;;;;AA0BO,MAAM,UAAU,GAAG,CAAI,OAAqC,KAAK,OAAO,OAAO,KAAK,QAAQ,GAAG,EAAC,IAAI,EAAE,OAAO,EAAC,GAAG;;AClBxH,MAAM,oBAAoB,GAAI,UAAwD,CAAC,OAAO,IAAI,UAAU;MAK/F,WAAW,CAAA;AAoBA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACoB,IAAA,QAAA;IAtBxC,IACI,IAAI,CAAC,IAAqD,EAAA;QAC1D,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YACnC;;AAGJ,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI;QAC7B,IAAI,CAAC,UAAU,EAAE;;;IAIrB,eAAe,GAA8B,IAAI;IACjD,kBAAkB,GAA4B,IAAI;IAClD,kBAAkB,GAAwB,IAAI;IAEtC,iBAAiB,GAA+B,IAAI;AACpD,IAAA,SAAS,GAA8B,OAAO,EAAE,CAAC;IAEzD,WAAA,CAAoB,OAAe,EACf,SAAmB,EACnB,SAAoB,EACpB,WAAyC,EACrB,QAAoB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,CAAA,QAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,YAVlB,WAAW;YACX,cAAc;AACd,YAAA,UAAU,aAGV,WAAW;YACX,cAAc;YACd,UAAU,CAAA,EAAA,CAAA;wGAGL,aAAa,EAAA,CAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAZzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE;wBACL,WAAW;wBACX,cAAc;wBACd;AACH,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,WAAW;wBACX,cAAc;wBACd;AACH;AACJ,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bravobit-bb-foundation-masking.mjs","sources":["../../../projects/bb-foundation/masking/src/lib/input-mask.interface.ts","../../../projects/bb-foundation/masking/src/lib/directives/input-mask.directive.ts","../../../projects/bb-foundation/masking/src/lib/masking.service.ts","../../../projects/bb-foundation/masking/src/lib/directives/currency-mask.directive.ts","../../../projects/bb-foundation/masking/src/lib/directives/date-mask.directive.ts","../../../projects/bb-foundation/masking/src/lib/masking.module.ts","../../../projects/bb-foundation/masking/src/bravobit-bb-foundation-masking.ts"],"sourcesContent":["import type Inputmask from 'inputmask';\n\nexport type InputMaskOptions<T> = Inputmask.Options & {\n parser?: (value: any) => T;\n};\n\nexport type CurrencyMaskOptions = {\n symbol: string;\n symbolFormat: 'wide' | 'narrow';\n spacer: string;\n digits: number;\n digitsOptional: boolean;\n decimalCharacter: string;\n groupCharacter: string;\n min: number;\n max: number;\n allowMinus: boolean;\n nullable: boolean;\n}\n\nexport type DateMaskFormat =\n 'day-month-year' |\n 'month-day-year' |\n 'year-month-day' |\n 'year-day-month';\n\nexport const createMask = <T>(options: string | InputMaskOptions<T>) => typeof options === 'string' ? {mask: options} : options;\n","import {Directive, ElementRef, HostListener, Input, NgZone, OnDestroy, OnInit, Optional, Renderer2, Self} from '@angular/core';\nimport {AbstractControl, ControlValueAccessor, NgControl, Validator} from '@angular/forms';\nimport {InputMaskOptions} from '../input-mask.interface';\nimport {fromEvent, merge, Subscription} from 'rxjs';\nimport {Platform} from '@angular/cdk/platform';\nimport type Inputmask from 'inputmask';\nimport _Inputmask from 'inputmask';\n\nconst InputmaskConstructor = (_Inputmask as unknown as { default?: Inputmask.Static }).default || _Inputmask;\n\n@Directive({\n selector: 'input[bbInputMask],input[bbCurrencyMask],input[bbDateMask]'\n})\nexport class BbInputMask<T = any> implements OnInit, OnDestroy, ControlValueAccessor, Validator {\n\n @Input('bbInputMask')\n set mask(mask: InputMaskOptions<T> | string | null | undefined) {\n if (!mask || typeof mask === 'string') {\n return;\n }\n\n this._inputMaskOptions = mask;\n this.updateMask();\n }\n\n // State.\n inputMaskPlugin: Inputmask.Instance | null = null;\n nativeInputElement: HTMLInputElement | null = null;\n eventsSubscription: Subscription | null = null;\n\n private _inputMaskOptions: InputMaskOptions<T> | null = null;\n private _onChange: (value: T | null) => void = () => ({});\n\n constructor(private _ngZone: NgZone,\n private _platform: Platform,\n private _renderer: Renderer2,\n private _elementRef: ElementRef<HTMLInputElement>,\n @Optional() @Self() private _control?: NgControl) {\n this.nativeInputElement = this._elementRef.nativeElement;\n if (this._control != null) {\n this._control.valueAccessor = this;\n }\n }\n\n @HostListener('input', ['$event.target.value'])\n onInput: (value: any) => void = (_: any) => ({});\n\n @HostListener('blur', ['$event.target.value'])\n onTouched: () => void = () => ({});\n\n ngOnInit() {\n const control = this._control?.control;\n if (!control) {\n return;\n }\n\n control?.setValidators(control.validator ? [control.validator, this.validate] : [this.validate]);\n control?.updateValueAndValidity();\n }\n\n ngOnDestroy() {\n this.destroyMask();\n }\n\n writeValue(value: string) {\n if (!this.nativeInputElement) {\n return;\n }\n this._renderer.setProperty(this.nativeInputElement, 'value', value ?? '');\n }\n\n registerOnChange(fn: (value: T | null) => void) {\n this._onChange = fn;\n const parser = this._inputMaskOptions?.parser;\n this.onInput = value => this._onChange(parser ? parser(value) : value);\n }\n\n registerOnTouched(fn: () => void) {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean) {\n if (!this.nativeInputElement) {\n return;\n }\n this._renderer.setProperty(this.nativeInputElement, 'disabled', isDisabled);\n }\n\n validate = (control: AbstractControl) => !control.value || !this.inputMaskPlugin || this.inputMaskPlugin?.isValid()\n ? null\n : {inputMask: true};\n\n private updateMask() {\n this.destroyMask();\n this.createMask();\n this.registerOnChange(this._onChange);\n }\n\n private createMask() {\n if (!this._platform.isBrowser || !this.nativeInputElement || this._inputMaskOptions === null || Object.keys(this._inputMaskOptions).length === 0) {\n return;\n }\n\n const {parser, ...options} = this._inputMaskOptions;\n this.inputMaskPlugin = this._ngZone.runOutsideAngular(() => new InputmaskConstructor(options).mask(this.nativeInputElement));\n\n const setValue$ = fromEvent(this.nativeInputElement, 'setvalue');\n const cleared$ = fromEvent(this.nativeInputElement, 'cleared');\n\n this.eventsSubscription = merge(setValue$, cleared$)\n .subscribe(event => this.onInput(event?.target?.['value']));\n\n const control = this._control?.control;\n if (!control) {\n return;\n }\n setTimeout(() => control?.updateValueAndValidity());\n }\n\n private destroyMask() {\n this.eventsSubscription?.unsubscribe();\n this.eventsSubscription = null;\n this.inputMaskPlugin?.remove();\n this.inputMaskPlugin = null;\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbInputMask: InputMaskOptions<any> | string | null | undefined;\n\n}\n","import {formatDate, getCurrencySymbol, getLocaleNumberSymbol, getNumberOfCurrencyDigits, NumberSymbol} from '@angular/common';\nimport {createMask, CurrencyMaskOptions, DateMaskFormat} from './input-mask.interface';\nimport {Localize} from '@bravobit/bb-foundation/localize';\nimport {Injectable, Optional} from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Masking {\n\n constructor(@Optional() private _localize?: Localize) {\n }\n\n date(format: DateMaskFormat, separator: string = '-') {\n const dateParts = this.getDateParts(format);\n const inputFormat = dateParts.join(separator);\n const outputFormat = 'yyyy-MM-dd';\n\n const escape = /[.*+?^${}()\\/|[\\]\\\\]/g;\n const escapedSeparator = separator.replace(escape, '\\\\$&');\n\n const inputFormatRegexString = dateParts\n .map(item => `(?<${item}>[0-9]{${item?.length}})`)\n .join(escapedSeparator);\n const inputFormatRegex = new RegExp(`^${inputFormatRegexString}$`);\n\n return createMask({\n alias: 'datetime',\n inputFormat: inputFormat.toLowerCase(),\n outputFormat: outputFormat.toLowerCase(),\n nullable: false,\n inputmode: 'numeric',\n onBeforeMask: (initialValue: string) => {\n return initialValue ? formatDate(initialValue, inputFormat, 'en-US') : null;\n },\n onBeforePaste: (value: string) => {\n return value;\n },\n parser: (value: string) => {\n if (!value || typeof value !== 'string' || !inputFormatRegex.test(value)) {\n return null;\n }\n const matches = value.match(inputFormatRegex);\n const year = +matches?.groups?.['yyyy'];\n const month = +matches?.groups?.['MM'] - 1;\n const day = +matches?.groups?.['dd'];\n const date = new Date(year, month, day);\n\n return date instanceof Date && !isNaN(<any>date)\n ? formatDate(date, outputFormat, 'en-US')\n : null;\n }\n });\n }\n\n currency(code: string, options?: Partial<CurrencyMaskOptions>) {\n const locale = this._localize?.current?.locale ?? 'en';\n const symbol = options?.symbol ?? getCurrencySymbol(code, options?.symbolFormat ?? 'narrow', locale);\n\n const decimal = options?.decimalCharacter ?? getLocaleNumberSymbol(locale, NumberSymbol.CurrencyDecimal);\n const group = options?.groupCharacter ?? getLocaleNumberSymbol(locale, NumberSymbol.CurrencyGroup);\n const digits = options?.digits ?? getNumberOfCurrencyDigits(code);\n const spacer = options?.spacer ?? ' ';\n\n return createMask({\n alias: 'numeric',\n inputType: 'number',\n digits: digits,\n allowMinus: options?.allowMinus ?? false,\n min: options?.min ?? 0,\n max: options?.max ?? Number.MAX_SAFE_INTEGER,\n prefix: `${symbol}${spacer}`,\n radixPoint: decimal ?? '.',\n groupSeparator: group ?? ',',\n digitsOptional: options?.digitsOptional ?? false,\n nullable: options?.nullable ?? true,\n autoUnmask: true,\n unmaskAsNumber: true,\n rightAlign: false,\n showMaskOnHover: false,\n showMaskOnFocus: false,\n inputmode: digits > 0 ? 'decimal' : 'numeric',\n parser: (value: string | number) => {\n if (value === '') {\n return null;\n }\n return value;\n }\n });\n }\n\n private getDateParts(format: DateMaskFormat) {\n switch (format) {\n case 'day-month-year':\n return ['dd', 'MM', 'yyyy'];\n case 'month-day-year':\n return ['MM', 'dd', 'yyyy'];\n case 'year-day-month':\n return ['yyyy', 'dd', 'MM'];\n case 'year-month-day':\n default:\n return ['yyyy', 'MM', 'dd'];\n }\n }\n\n}\n","import {Directive, Input, OnChanges, Self, SimpleChanges} from '@angular/core';\nimport {CurrencyMaskOptions} from '../input-mask.interface';\nimport {BbInputMask} from './input-mask.directive';\nimport {Masking} from '../masking.service';\n\n@Directive({\n selector: 'input[bbCurrencyMask]'\n})\nexport class BbCurrencyMask implements OnChanges {\n\n // Inputs.\n @Input('bbCurrencyMask') currencyCode: string | null = null;\n @Input('bbCurrencyMaskOptions') options: Partial<CurrencyMaskOptions> | null = null;\n\n constructor(private _masking: Masking,\n @Self() private _inputMask: BbInputMask) {\n }\n\n ngOnChanges(changes: SimpleChanges) {\n const currencyCode = changes?.['currencyCode']?.currentValue ?? this.currencyCode ?? 'USD';\n const options = changes?.['options']?.currentValue ?? this.options ?? {};\n\n this._inputMask.mask = this._masking.currency(currencyCode, options);\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbCurrencyMask: string | null | undefined;\n static ngAcceptInputType_bbCurrencyMaskOptions: Partial<CurrencyMaskOptions> | null | undefined;\n\n}\n","import {Directive, Input, OnChanges, Self, SimpleChanges} from '@angular/core';\nimport {DateMaskFormat} from '../input-mask.interface';\nimport {BbInputMask} from './input-mask.directive';\nimport {Masking} from '../masking.service';\n\n@Directive({\n selector: 'input[bbDateMask]'\n})\nexport class BbDateMask implements OnChanges {\n\n // Inputs.\n @Input('bbDateMask') format: DateMaskFormat | null = null;\n @Input('bbDateMaskSeparator') separator: string | null = null;\n\n constructor(private _masking: Masking,\n @Self() private _inputMask: BbInputMask) {\n }\n\n ngOnChanges(changes: SimpleChanges) {\n const format = changes?.['format']?.currentValue ?? this.format ?? null;\n const separator = changes?.['separator']?.currentValue ?? this.separator ?? '-';\n this._inputMask.mask = this._masking.date(format, separator);\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbDateMask: DateMaskFormat | null | undefined;\n static ngAcceptInputType_bbDateMaskSeparator: string | null | undefined;\n\n}\n","import {BbCurrencyMask} from './directives/currency-mask.directive';\nimport {BbInputMask} from './directives/input-mask.directive';\nimport {BbDateMask} from './directives/date-mask.directive';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [\n BbInputMask,\n BbCurrencyMask,\n BbDateMask\n ],\n exports: [\n BbInputMask,\n BbCurrencyMask,\n BbDateMask\n ]\n})\nexport class MaskingModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i1.Masking","i2.BbInputMask"],"mappings":";;;;;;;;;AA0BO,MAAM,UAAU,GAAG,CAAI,OAAqC,KAAK,OAAO,OAAO,KAAK,QAAQ,GAAG,EAAC,IAAI,EAAE,OAAO,EAAC,GAAG;;AClBxH,MAAM,oBAAoB,GAAI,UAAwD,CAAC,OAAO,IAAI,UAAU;MAK/F,WAAW,CAAA;AAoBA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACoB,IAAA,QAAA;IAtBxC,IACI,IAAI,CAAC,IAAqD,EAAA;QAC1D,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YACnC;QACJ;AAEA,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI;QAC7B,IAAI,CAAC,UAAU,EAAE;IACrB;;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AA,EAAA,CAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE;AACb,iBAAA;;0BAQgB;yCAJQ,MAAM,EAAA,CAAA;sBAA1B,KAAK;uBAAC,YAAY;gBACW,SAAS,EAAA,CAAA;sBAAtC,KAAK;uBAAC,qBAAqB;;;MCKnB,aAAa,CAAA;uGAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,YAVlB,WAAW;YACX,cAAc;AACd,YAAA,UAAU,aAGV,WAAW;YACX,cAAc;YACd,UAAU,CAAA,EAAA,CAAA;wGAGL,aAAa,EAAA,CAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAZzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE;wBACL,WAAW;wBACX,cAAc;wBACd;AACH,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,WAAW;wBACX,cAAc;wBACd;AACH;AACJ,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
@@ -99,10 +99,10 @@ class BbNotificationsItem {
|
|
|
99
99
|
}
|
|
100
100
|
return this._window.setTimeout(method, timeout);
|
|
101
101
|
}
|
|
102
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
103
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
102
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: BbNotificationsItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
103
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: BbNotificationsItem, isStandalone: true, selector: "bb-notifications-item", inputs: { notification: "notification" }, host: { attributes: { "role": "alert" }, properties: { "class": "this.getClass" } }, viewQueries: [{ propertyName: "progressElementRef", first: true, predicate: ["progress"], descendants: true }], ngImport: i0, template: "<div class=\"notification-content-wrapper\">\n <div [style.color]=\"notification?.color\"\n [style.background-color]=\"notification?.backgroundColor\"\n class=\"notification-icon-wrapper\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 20\"\n class=\"notification-icon\">\n <path\n d=\"M8 20c1.1 0 2-.923 2-2.051H6C6 19.077 6.9 20 8 20Zm6-6.154V8.718c0-3.18-1.6-5.744-4.5-6.462v-.718C9.5.718 8.8 0 8 0S6.5.718 6.5 1.538v.718C3.6 2.974 2 5.538 2 8.718v5.128l-2 2.051v1.026h16v-1.026l-2-2.05Z\">\n </path>\n </svg>\n\n @if (notification?.timeout > 0) {\n <svg class=\"notification-progress-ring\"\n viewBox=\"0 0 40 40\"\n role=\"progressbar\">\n <circle #progress\n [attr.stroke-dasharray]=\"progressStrokeArray\"\n [attr.stroke-dashoffset]=\"progressStrokeOffset\"\n [style.stroke]=\"notification?.color\"\n class=\"notification-progress-circle\"\n stroke-width=\"2\"\n fill=\"transparent\"\n r=\"19\"\n cx=\"20\"\n cy=\"20\">\n </circle>\n </svg>\n }\n </div>\n\n <div class=\"notification-content\">\n <ng-template [bbTemplate]=\"notification?.content\">\n @if (notification?.localize) {\n {{ $any(notification?.content) | bbLocalize }}\n } @else {\n {{ notification?.content }}\n }\n </ng-template>\n </div>\n</div>\n\n@if (notification?.actions?.length > 0 || notification?.dismiss) {\n <div class=\"notification-actions\">\n @for (action of notification?.actions; track $index) {\n <button [class.destructive]=\"action?.type === 'cancel'\"\n (click)=\"callActionAndDestroy(notification, action)\"\n type=\"button\"\n class=\"notification-actions-button\">\n <span class=\"notification-actions-button-highlight\">\n @if (notification?.localize) {\n {{ action?.title | bbLocalize }}\n } @else {\n {{ action?.title }}\n }\n </span>\n </button>\n }\n @if (notification?.dismiss) {\n <button (click)=\"notification?.destroy()\"\n class=\"notification-actions-button destructive\"\n type=\"button\">\n <span\n class=\"notification-actions-button-highlight\">{{ notification?.dismissText ?? dismissText }}</span>\n </button>\n }\n </div>\n}\n", styles: [".bb-notifications-item{top:0;left:0;width:100%;display:flex;position:absolute;pointer-events:all;border-radius:.5rem;flex-direction:column;background-color:#fff;box-shadow:0 .375rem .375rem -.375rem #00000026;border:1px solid rgb(214.3982142857,218.6677857143,224.1017857143);transition:margin-top .2s cubic-bezier(0,0,.2,1),transform .2s cubic-bezier(0,0,.2,1);animation:bbNotificationItemEnter .2s cubic-bezier(0,0,.2,1) forwards}.bb-notifications-item.leaving{animation:bbNotificationItemLeave .2s cubic-bezier(0,0,.2,1)}.bb-notifications-item.success .notification-icon-wrapper{color:#2dc05d;background-color:#ebfaf0}.bb-notifications-item.success .notification-progress-circle{stroke:#36d068}.bb-notifications-item.error .notification-icon-wrapper{color:#f43e3e;background-color:#feeeee}.bb-notifications-item.error .notification-progress-circle{stroke:#f55656}.bb-notifications-item.warning .notification-icon-wrapper{color:#f1ae00;background-color:#fff8e7}.bb-notifications-item.warning .notification-progress-circle{stroke:#ffbc0b}.bb-notifications-item.info .notification-icon-wrapper{color:#099bf6;background-color:#e9f6fe}.bb-notifications-item.info .notification-progress-circle{stroke:#22a5f7}.bb-notifications-item.custom .notification-icon-wrapper{color:#657385;background-color:#f3f5f6}.bb-notifications-item.custom .notification-progress-circle{stroke:#657385}.notification-content-wrapper{gap:.75rem;display:flex;padding:.75rem;align-items:center}.notification-icon-wrapper{width:2rem;height:2rem;display:flex;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;justify-content:center;color:#657385;background-color:#f3f5f6}.notification-icon{width:100%;height:100%;padding:.5rem;fill:currentColor}.notification-content{flex:1;font-weight:400;line-height:1.8;font-size:.875rem;color:#121212}.notification-content,.notification-actions-button{font-family:inherit}.notification-actions{display:flex;margin:0 1.5rem;-webkit-user-select:none;user-select:none;border-top:1px solid rgb(243.3589285714,244.5830714286,246.1410714286)}.notification-actions-button{flex:1;border:none;color:#22a5f7;cursor:pointer;font-weight:500;text-align:center;font-size:.875rem;padding:.75rem .125rem;background-color:transparent}.notification-actions-button:hover>.notification-actions-button-highlight,.notification-actions-button:focus>.notification-actions-button-highlight{background-color:#22a5f71a}.notification-actions-button:active>.notification-actions-button-highlight{background-color:#22a5f733}.notification-actions-button.destructive{color:#f55656}.notification-actions-button.destructive:hover>.notification-actions-button-highlight,.notification-actions-button.destructive:focus>.notification-actions-button-highlight{background-color:#f556561a}.notification-actions-button.destructive:active>.notification-actions-button-highlight{background-color:#f5565633}.notification-actions-button-highlight{display:inline-flex;border-radius:.75rem;padding:.25rem .75rem;transition:background-color .2s cubic-bezier(0,0,.2,1)}.notification-progress-ring{inset:0;width:100%;height:100%;position:absolute}.notification-progress-circle{transform:rotate(-90deg);transform-origin:50% 50%;stroke:#657385}@keyframes bbNotificationItemEnter{0%{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:none}}@keyframes bbNotificationItemLeave{to{opacity:0}}\n"], dependencies: [{ kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "pipe", type: BbLocalize, name: "bbLocalize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
104
104
|
}
|
|
105
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: BbNotificationsItem, decorators: [{
|
|
106
106
|
type: Component,
|
|
107
107
|
args: [{ selector: 'bb-notifications-item', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'role': 'alert' }, imports: [BbLocalize, BbTemplate], template: "<div class=\"notification-content-wrapper\">\n <div [style.color]=\"notification?.color\"\n [style.background-color]=\"notification?.backgroundColor\"\n class=\"notification-icon-wrapper\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 20\"\n class=\"notification-icon\">\n <path\n d=\"M8 20c1.1 0 2-.923 2-2.051H6C6 19.077 6.9 20 8 20Zm6-6.154V8.718c0-3.18-1.6-5.744-4.5-6.462v-.718C9.5.718 8.8 0 8 0S6.5.718 6.5 1.538v.718C3.6 2.974 2 5.538 2 8.718v5.128l-2 2.051v1.026h16v-1.026l-2-2.05Z\">\n </path>\n </svg>\n\n @if (notification?.timeout > 0) {\n <svg class=\"notification-progress-ring\"\n viewBox=\"0 0 40 40\"\n role=\"progressbar\">\n <circle #progress\n [attr.stroke-dasharray]=\"progressStrokeArray\"\n [attr.stroke-dashoffset]=\"progressStrokeOffset\"\n [style.stroke]=\"notification?.color\"\n class=\"notification-progress-circle\"\n stroke-width=\"2\"\n fill=\"transparent\"\n r=\"19\"\n cx=\"20\"\n cy=\"20\">\n </circle>\n </svg>\n }\n </div>\n\n <div class=\"notification-content\">\n <ng-template [bbTemplate]=\"notification?.content\">\n @if (notification?.localize) {\n {{ $any(notification?.content) | bbLocalize }}\n } @else {\n {{ notification?.content }}\n }\n </ng-template>\n </div>\n</div>\n\n@if (notification?.actions?.length > 0 || notification?.dismiss) {\n <div class=\"notification-actions\">\n @for (action of notification?.actions; track $index) {\n <button [class.destructive]=\"action?.type === 'cancel'\"\n (click)=\"callActionAndDestroy(notification, action)\"\n type=\"button\"\n class=\"notification-actions-button\">\n <span class=\"notification-actions-button-highlight\">\n @if (notification?.localize) {\n {{ action?.title | bbLocalize }}\n } @else {\n {{ action?.title }}\n }\n </span>\n </button>\n }\n @if (notification?.dismiss) {\n <button (click)=\"notification?.destroy()\"\n class=\"notification-actions-button destructive\"\n type=\"button\">\n <span\n class=\"notification-actions-button-highlight\">{{ notification?.dismissText ?? dismissText }}</span>\n </button>\n }\n </div>\n}\n", styles: [".bb-notifications-item{top:0;left:0;width:100%;display:flex;position:absolute;pointer-events:all;border-radius:.5rem;flex-direction:column;background-color:#fff;box-shadow:0 .375rem .375rem -.375rem #00000026;border:1px solid rgb(214.3982142857,218.6677857143,224.1017857143);transition:margin-top .2s cubic-bezier(0,0,.2,1),transform .2s cubic-bezier(0,0,.2,1);animation:bbNotificationItemEnter .2s cubic-bezier(0,0,.2,1) forwards}.bb-notifications-item.leaving{animation:bbNotificationItemLeave .2s cubic-bezier(0,0,.2,1)}.bb-notifications-item.success .notification-icon-wrapper{color:#2dc05d;background-color:#ebfaf0}.bb-notifications-item.success .notification-progress-circle{stroke:#36d068}.bb-notifications-item.error .notification-icon-wrapper{color:#f43e3e;background-color:#feeeee}.bb-notifications-item.error .notification-progress-circle{stroke:#f55656}.bb-notifications-item.warning .notification-icon-wrapper{color:#f1ae00;background-color:#fff8e7}.bb-notifications-item.warning .notification-progress-circle{stroke:#ffbc0b}.bb-notifications-item.info .notification-icon-wrapper{color:#099bf6;background-color:#e9f6fe}.bb-notifications-item.info .notification-progress-circle{stroke:#22a5f7}.bb-notifications-item.custom .notification-icon-wrapper{color:#657385;background-color:#f3f5f6}.bb-notifications-item.custom .notification-progress-circle{stroke:#657385}.notification-content-wrapper{gap:.75rem;display:flex;padding:.75rem;align-items:center}.notification-icon-wrapper{width:2rem;height:2rem;display:flex;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;justify-content:center;color:#657385;background-color:#f3f5f6}.notification-icon{width:100%;height:100%;padding:.5rem;fill:currentColor}.notification-content{flex:1;font-weight:400;line-height:1.8;font-size:.875rem;color:#121212}.notification-content,.notification-actions-button{font-family:inherit}.notification-actions{display:flex;margin:0 1.5rem;-webkit-user-select:none;user-select:none;border-top:1px solid rgb(243.3589285714,244.5830714286,246.1410714286)}.notification-actions-button{flex:1;border:none;color:#22a5f7;cursor:pointer;font-weight:500;text-align:center;font-size:.875rem;padding:.75rem .125rem;background-color:transparent}.notification-actions-button:hover>.notification-actions-button-highlight,.notification-actions-button:focus>.notification-actions-button-highlight{background-color:#22a5f71a}.notification-actions-button:active>.notification-actions-button-highlight{background-color:#22a5f733}.notification-actions-button.destructive{color:#f55656}.notification-actions-button.destructive:hover>.notification-actions-button-highlight,.notification-actions-button.destructive:focus>.notification-actions-button-highlight{background-color:#f556561a}.notification-actions-button.destructive:active>.notification-actions-button-highlight{background-color:#f5565633}.notification-actions-button-highlight{display:inline-flex;border-radius:.75rem;padding:.25rem .75rem;transition:background-color .2s cubic-bezier(0,0,.2,1)}.notification-progress-ring{inset:0;width:100%;height:100%;position:absolute}.notification-progress-circle{transform:rotate(-90deg);transform-origin:50% 50%;stroke:#657385}@keyframes bbNotificationItemEnter{0%{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:none}}@keyframes bbNotificationItemLeave{to{opacity:0}}\n"] }]
|
|
108
108
|
}], propDecorators: { notification: [{
|
|
@@ -137,10 +137,10 @@ class BbNotificationsList {
|
|
|
137
137
|
});
|
|
138
138
|
}));
|
|
139
139
|
}
|
|
140
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
141
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
140
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: BbNotificationsList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
141
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: BbNotificationsList, isStandalone: true, selector: "bb-notifications-list", host: { attributes: { "role": "list" }, classAttribute: "bb-notifications-list" }, ngImport: i0, template: "@if (data$ | async; as data) {\n <div class=\"notifications-list-wrapper\">\n @for (item of data; track item?.notification?.id) {\n <bb-notifications-item [notification]=\"item?.notification\"\n [style.z-index]=\"item?.notification?.id\"\n [style.margin-top.rem]=\"item?.styles?.offset\"\n [style.transform]=\"item?.styles?.scale\"\n animate.leave=\"leaving\">\n </bb-notifications-item>\n }\n </div>\n}\n", styles: [".bb-notifications-list{inset:0;z-index:1100;display:flex;position:fixed;padding:.75rem;pointer-events:none;align-items:flex-start;justify-content:flex-end}.notifications-list-wrapper{width:100%;gap:.75rem;display:flex;max-width:24rem;position:relative;flex-direction:column}\n"], dependencies: [{ kind: "component", type: BbNotificationsItem, selector: "bb-notifications-item", inputs: ["notification"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
142
142
|
}
|
|
143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: BbNotificationsList, decorators: [{
|
|
144
144
|
type: Component,
|
|
145
145
|
args: [{ selector: 'bb-notifications-list', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
146
146
|
'class': 'bb-notifications-list',
|
|
@@ -246,10 +246,10 @@ class Notifications {
|
|
|
246
246
|
// Don't do anything, because it must've failed.
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
250
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
249
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Notifications, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
250
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Notifications, providedIn: 'root' });
|
|
251
251
|
}
|
|
252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Notifications, decorators: [{
|
|
253
253
|
type: Injectable,
|
|
254
254
|
args: [{
|
|
255
255
|
providedIn: 'root'
|
|
@@ -271,11 +271,11 @@ class NotificationsModule {
|
|
|
271
271
|
]
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
275
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
276
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
274
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: NotificationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
275
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: NotificationsModule });
|
|
276
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: NotificationsModule });
|
|
277
277
|
}
|
|
278
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: NotificationsModule, decorators: [{
|
|
279
279
|
type: NgModule
|
|
280
280
|
}] });
|
|
281
281
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bravobit-bb-foundation-notifications.mjs","sources":["../../../projects/bb-foundation/notifications/src/lib/notifications.interfaces.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-item/notifications-item.component.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-item/notifications-item.component.html","../../../projects/bb-foundation/notifications/src/lib/notifications-list/notifications-list.component.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-list/notifications-list.component.html","../../../projects/bb-foundation/notifications/src/lib/notifications.service.ts","../../../projects/bb-foundation/notifications/src/lib/notifications.config.ts","../../../projects/bb-foundation/notifications/src/lib/notifications.module.ts","../../../projects/bb-foundation/notifications/src/bravobit-bb-foundation-notifications.ts"],"sourcesContent":["import {InjectionToken, TemplateRef} from '@angular/core';\nimport {Observable} from 'rxjs';\n\nexport interface Notification {\n content: string | TemplateRef<any>;\n type: NotificationType;\n\n id?: number;\n\n timeout?: number;\n localize?: boolean;\n dismiss?: boolean;\n dismissText?: string;\n actions?: NotificationAction[];\n\n color?: string;\n backgroundColor?: string;\n\n destroy?: () => void;\n}\n\nexport interface NotificationAction {\n title: string;\n callback?: () => any;\n type?: 'default' | 'cancel';\n}\n\nexport enum NotificationType {\n Success = 'success',\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Custom = 'custom'\n}\n\nexport class NotificationsConfig {\n mode?: 'append' | 'prepend';\n timeout?: number;\n dismiss?: boolean;\n localize?: boolean;\n dismissText?: string;\n}\n\nexport const NOTIFICATIONS_DATA: InjectionToken<Observable<Notification[]>> = new InjectionToken('notifications data');\n\nexport const NOTIFICATIONS_CONFIG: InjectionToken<NotificationsConfig> = new InjectionToken('notifications config');\n","import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostBinding, inject, Input, NgZone, OnDestroy, OnInit, ViewChild, ViewEncapsulation} from '@angular/core';\nimport {Notification, NotificationAction, NotificationsConfig} from '../notifications.interfaces';\nimport {BbLocalize} from '@bravobit/bb-foundation/localize';\nimport {BbTemplate} from '@bravobit/bb-foundation/utils';\nimport {Platform} from '@angular/cdk/platform';\nimport {WINDOW} from '@bravobit/bb-foundation';\n\n@Component({\n selector: 'bb-notifications-item',\n templateUrl: './notifications-item.component.html',\n styleUrls: ['./notifications-item.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {'role': 'alert'},\n imports: [BbLocalize, BbTemplate]\n})\nexport class BbNotificationsItem implements OnInit, OnDestroy {\n\n // Dependencies.\n private readonly _zone: NgZone = inject(NgZone);\n private readonly _platform: Platform = inject(Platform);\n private readonly _changeDetection: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n // Dependencies.\n private readonly _config?: NotificationsConfig = inject(NotificationsConfig, {optional: true});\n private readonly _window?: Window = inject(WINDOW, {optional: true});\n\n // Readonly data.\n readonly dismissText: string = this._config?.dismissText ?? null;\n\n // Inputs.\n @Input() notification: Notification | null = null;\n\n // Elements.\n @ViewChild('progress', {static: false}) progressElementRef: ElementRef<SVGCircleElement>;\n\n // Data.\n private _progress: number = 0;\n private _count: number = 0;\n\n // Helper variables.\n private _steps: number;\n private _speed: number;\n private _timer: number;\n private _startTime: number;\n private _difference: number;\n\n // Data.\n private readonly _radius = 19;\n private readonly _circumference = this._radius * 2 * Math.PI;\n\n @HostBinding('class')\n get getClass() {\n return `bb-notifications-item ${this.notification.type}`;\n }\n\n get progressStrokeArray() {\n const value = Math.floor(this._circumference);\n return `${value}, ${value}`;\n }\n\n get progressStrokeOffset() {\n return Math.floor(this._circumference - this._progress / 100 * this._circumference);\n }\n\n ngOnInit() {\n // Check if the notification timeout is not 0 and the platform is a browser.\n if (this.notification.timeout <= 0 || !this._platform.isBrowser) {\n this.notification.dismiss = true;\n return;\n }\n\n // Start the timeout.\n this.startTimeout();\n }\n\n ngOnDestroy() {\n this._timer && this._window?.clearTimeout?.(this._timer);\n }\n\n callActionAndDestroy(notification: Notification, action: NotificationAction) {\n action?.callback?.();\n notification?.destroy?.();\n }\n\n private startTimeout() {\n this._steps = this.notification.timeout / 10;\n this._speed = this.notification.timeout / this._steps;\n this._startTime = Date.now();\n this._zone.runOutsideAngular(() => this._timer = this.setTimeout(this.instance, this._speed));\n }\n\n private instance = () => {\n this._difference = (Date.now() - this._startTime) - (this._count * this._speed);\n\n if (this._count++ === this._steps) {\n this.notification.destroy();\n }\n\n this._progress += 100 / this._steps;\n this._timer = this.setTimeout(this.instance, this._speed - this._difference);\n this._zone.run(() => this._changeDetection.detectChanges());\n };\n\n private setTimeout(method: () => void, timeout: number) {\n if (!this._window || !this._window.setTimeout) {\n return null;\n }\n\n return this._window.setTimeout(method, timeout);\n }\n\n}\n","<div class=\"notification-content-wrapper\">\n <div [style.color]=\"notification?.color\"\n [style.background-color]=\"notification?.backgroundColor\"\n class=\"notification-icon-wrapper\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 20\"\n class=\"notification-icon\">\n <path\n d=\"M8 20c1.1 0 2-.923 2-2.051H6C6 19.077 6.9 20 8 20Zm6-6.154V8.718c0-3.18-1.6-5.744-4.5-6.462v-.718C9.5.718 8.8 0 8 0S6.5.718 6.5 1.538v.718C3.6 2.974 2 5.538 2 8.718v5.128l-2 2.051v1.026h16v-1.026l-2-2.05Z\">\n </path>\n </svg>\n\n @if (notification?.timeout > 0) {\n <svg class=\"notification-progress-ring\"\n viewBox=\"0 0 40 40\"\n role=\"progressbar\">\n <circle #progress\n [attr.stroke-dasharray]=\"progressStrokeArray\"\n [attr.stroke-dashoffset]=\"progressStrokeOffset\"\n [style.stroke]=\"notification?.color\"\n class=\"notification-progress-circle\"\n stroke-width=\"2\"\n fill=\"transparent\"\n r=\"19\"\n cx=\"20\"\n cy=\"20\">\n </circle>\n </svg>\n }\n </div>\n\n <div class=\"notification-content\">\n <ng-template [bbTemplate]=\"notification?.content\">\n @if (notification?.localize) {\n {{ $any(notification?.content) | bbLocalize }}\n } @else {\n {{ notification?.content }}\n }\n </ng-template>\n </div>\n</div>\n\n@if (notification?.actions?.length > 0 || notification?.dismiss) {\n <div class=\"notification-actions\">\n @for (action of notification?.actions; track $index) {\n <button [class.destructive]=\"action?.type === 'cancel'\"\n (click)=\"callActionAndDestroy(notification, action)\"\n type=\"button\"\n class=\"notification-actions-button\">\n <span class=\"notification-actions-button-highlight\">\n @if (notification?.localize) {\n {{ action?.title | bbLocalize }}\n } @else {\n {{ action?.title }}\n }\n </span>\n </button>\n }\n @if (notification?.dismiss) {\n <button (click)=\"notification?.destroy()\"\n class=\"notification-actions-button destructive\"\n type=\"button\">\n <span\n class=\"notification-actions-button-highlight\">{{ notification?.dismissText ?? dismissText }}</span>\n </button>\n }\n </div>\n}\n","import {ChangeDetectionStrategy, Component, inject, OnInit, ViewEncapsulation} from '@angular/core';\nimport {BbNotificationsItem} from '../notifications-item/notifications-item.component';\nimport {Notification, NOTIFICATIONS_DATA} from '../notifications.interfaces';\nimport {AsyncPipe} from '@angular/common';\nimport {map} from 'rxjs/operators';\nimport {Observable} from 'rxjs';\n\n@Component({\n selector: 'bb-notifications-list',\n templateUrl: './notifications-list.component.html',\n styleUrls: ['./notifications-list.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n 'class': 'bb-notifications-list',\n 'role': 'list'\n },\n imports: [AsyncPipe, BbNotificationsItem]\n})\nexport class BbNotificationsList implements OnInit {\n\n // Dependencies.\n private readonly _data$: Observable<Notification[]> = inject(NOTIFICATIONS_DATA);\n\n // Data.\n data$: Observable<{\n notification?: Notification,\n styles?: { offset?: number, scale?: string }\n }[]>;\n\n ngOnInit() {\n this.setData();\n }\n\n private setData() {\n this.data$ = this._data$.pipe(\n map(notifications => {\n return notifications.map((notification, index) => {\n const scale = Math.max(0.9, 1 - (index * 0.02));\n return {\n notification,\n styles: {\n offset: Math.min(index, 5),\n scale: `scale(${scale})`\n }\n };\n });\n })\n );\n }\n\n}\n","@if (data$ | async; as data) {\n <div class=\"notifications-list-wrapper\">\n @for (item of data; track item?.notification?.id) {\n <bb-notifications-item [notification]=\"item?.notification\"\n [style.z-index]=\"item?.notification?.id\"\n [style.margin-top.rem]=\"item?.styles?.offset\"\n [style.transform]=\"item?.styles?.scale\"\n animate.leave=\"leaving\">\n </bb-notifications-item>\n }\n </div>\n}\n","import {ApplicationRef, ComponentRef, createComponent, createEnvironmentInjector, EnvironmentInjector, inject, Injectable, TemplateRef, DOCUMENT} from '@angular/core';\nimport {Notification, NotificationAction, NOTIFICATIONS_CONFIG, NOTIFICATIONS_DATA, NotificationsConfig, NotificationType} from './notifications.interfaces';\nimport {BbNotificationsList} from './notifications-list/notifications-list.component';\nimport {Localize} from '@bravobit/bb-foundation/localize';\nimport {Platform} from '@angular/cdk/platform';\nimport {BehaviorSubject} from 'rxjs';\n\nlet nextUniqueId = 0;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Notifications {\n\n // Dependencies.\n private _platform: Platform = inject(Platform);\n private _applicationRef: ApplicationRef = inject(ApplicationRef);\n private _environmentInjector: EnvironmentInjector = inject(EnvironmentInjector);\n private _localize?: Localize = inject(Localize, {optional: true});\n private _config?: NotificationsConfig = inject(NOTIFICATIONS_CONFIG, {optional: true});\n private _document?: Document = inject(DOCUMENT, {optional: true});\n\n // Reference to the list.\n private _componentRef: ComponentRef<BbNotificationsList>;\n\n // The default settings for the notifications.\n private readonly _defaultMode: 'prepend' | 'append' = this._config?.mode ?? 'prepend';\n private readonly _defaultTimeout: number = this._config?.timeout ?? 8_000;\n private readonly _defaultLocalize: boolean = this._config?.localize ?? false;\n private readonly _defaultDismiss: boolean = this._config?.dismiss ?? true;\n private readonly _defaultDismissText: string = this._config?.dismissText ?? 'Dismiss';\n\n // The data containing the notifications.\n private _notifications$ = new BehaviorSubject<Notification[]>([]);\n\n constructor() {\n this.createElement();\n }\n\n success(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Success});\n }\n\n error(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Error});\n }\n\n warn(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Warning});\n }\n\n info(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Info});\n }\n\n create(notification: Notification) {\n const item = this.compose(notification);\n item.destroy = () => this.pull(item);\n return this.push(item);\n }\n\n private push(notification: Notification) {\n // Get the current list.\n const oldList = this._notifications$.getValue();\n\n // Check which mode is activated.\n let newList: Notification[];\n switch (this._defaultMode) {\n case 'append':\n newList = [...oldList, notification];\n break;\n case 'prepend':\n default:\n newList = [notification, ...oldList];\n }\n\n // Push the new notifications.\n this._notifications$.next(newList);\n\n // Return the notification for further use.\n return notification;\n }\n\n private pull(notification: Notification) {\n // Get the current list.\n const newList = this._notifications$\n .getValue()\n .filter(item => item?.id !== notification?.id);\n\n // Push a new list.\n this._notifications$.next(newList);\n }\n\n private compose(notification: Notification) {\n // Attach a random id to the notification.\n notification.id = ++nextUniqueId % 99999;\n\n // Set all properties.\n notification.type = notification?.type ?? NotificationType.Custom;\n notification.content = notification?.content ?? null;\n notification.timeout = notification?.timeout ?? this._defaultTimeout;\n notification.localize = notification?.localize ?? this._defaultLocalize;\n notification.dismiss = notification?.dismiss ?? this._defaultDismiss;\n\n // Dismiss text localization.\n const dismissText = notification.dismissText ?? this._defaultDismissText;\n notification.dismissText = this._defaultLocalize && this._localize\n ? this._localize.translate(dismissText)\n : dismissText;\n\n // Return the composed notification.\n return notification;\n }\n\n private createElement() {\n const environmentInjector = createEnvironmentInjector([\n {provide: NOTIFICATIONS_DATA, useValue: this._notifications$}\n ], this._environmentInjector);\n\n this._componentRef = createComponent(BbNotificationsList, {environmentInjector});\n this._applicationRef.attachView(this._componentRef.hostView);\n\n if (!this._platform.isBrowser) {\n return;\n }\n\n try {\n this._document.body.appendChild(this._componentRef?.location?.nativeElement);\n } catch {\n // Don't do anything, because it must've failed.\n }\n }\n\n}\n","import {NOTIFICATIONS_CONFIG, NotificationsConfig} from './notifications.interfaces';\nimport {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\n\nexport function provideNotificationsConfig(config: NotificationsConfig): EnvironmentProviders {\n return makeEnvironmentProviders([\n {provide: NOTIFICATIONS_CONFIG, useValue: config ?? {}}\n ]);\n}\n","import {provideNotificationsConfig} from './notifications.config';\nimport {NotificationsConfig} from './notifications.interfaces';\nimport {ModuleWithProviders, NgModule} from '@angular/core';\n\n@NgModule()\nexport class NotificationsModule {\n\n static forRoot(config?: NotificationsConfig): ModuleWithProviders<NotificationsModule> {\n return {\n ngModule: NotificationsModule,\n providers: [\n provideNotificationsConfig(config)\n ]\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;IA2BY;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AACxB,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACrB,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;MAQf,mBAAmB,CAAA;AAC5B,IAAA,IAAI;AACJ,IAAA,OAAO;AACP,IAAA,OAAO;AACP,IAAA,QAAQ;AACR,IAAA,WAAW;AACd;MAEY,kBAAkB,GAA+C,IAAI,cAAc,CAAC,oBAAoB;MAExG,oBAAoB,GAAwC,IAAI,cAAc,CAAC,sBAAsB;;MC7BrG,mBAAmB,CAAA;;AAGX,IAAA,KAAK,GAAW,MAAM,CAAC,MAAM,CAAC;AAC9B,IAAA,SAAS,GAAa,MAAM,CAAC,QAAQ,CAAC;AACtC,IAAA,gBAAgB,GAAsB,MAAM,CAAC,iBAAiB,CAAC;;IAG/D,OAAO,GAAyB,MAAM,CAAC,mBAAmB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;IAC7E,OAAO,GAAY,MAAM,CAAC,MAAM,EAAE,EAAC,QA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,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cAFV,MAAM,EAAA,CAAA;;2FAET,aAAa,EAAA,UAAA,EAAA,CAAA;kBAHzB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACRK,SAAU,0BAA0B,CAAC,MAA2B,EAAA;AAClE,IAAA,OAAO,wBAAwB,CAAC;QAC5B,EAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE;AACzD,KAAA,CAAC;AACN;;MCFa,mBAAmB,CAAA;IAE5B,OAAO,OAAO,CAAC,MAA4B,EAAA;QACvC,OAAO;AACH,YAAA,QAAQ,EAAE,mBAAmB;AAC7B,YAAA,SAAS,EAAE;gBACP,0BAA0B,CAAC,MAAM;AACpC;SACJ;;uGARI,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAnB,mBAAmB,EAAA,CAAA;wGAAnB,mBAAmB,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B;;;ACJD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bravobit-bb-foundation-notifications.mjs","sources":["../../../projects/bb-foundation/notifications/src/lib/notifications.interfaces.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-item/notifications-item.component.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-item/notifications-item.component.html","../../../projects/bb-foundation/notifications/src/lib/notifications-list/notifications-list.component.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-list/notifications-list.component.html","../../../projects/bb-foundation/notifications/src/lib/notifications.service.ts","../../../projects/bb-foundation/notifications/src/lib/notifications.config.ts","../../../projects/bb-foundation/notifications/src/lib/notifications.module.ts","../../../projects/bb-foundation/notifications/src/bravobit-bb-foundation-notifications.ts"],"sourcesContent":["import {InjectionToken, TemplateRef} from '@angular/core';\nimport {Observable} from 'rxjs';\n\nexport interface Notification {\n content: string | TemplateRef<any>;\n type: NotificationType;\n\n id?: number;\n\n timeout?: number;\n localize?: boolean;\n dismiss?: boolean;\n dismissText?: string;\n actions?: NotificationAction[];\n\n color?: string;\n backgroundColor?: string;\n\n destroy?: () => void;\n}\n\nexport interface NotificationAction {\n title: string;\n callback?: () => any;\n type?: 'default' | 'cancel';\n}\n\nexport enum NotificationType {\n Success = 'success',\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Custom = 'custom'\n}\n\nexport class NotificationsConfig {\n mode?: 'append' | 'prepend';\n timeout?: number;\n dismiss?: boolean;\n localize?: boolean;\n dismissText?: string;\n}\n\nexport const NOTIFICATIONS_DATA: InjectionToken<Observable<Notification[]>> = new InjectionToken('notifications data');\n\nexport const NOTIFICATIONS_CONFIG: InjectionToken<NotificationsConfig> = new InjectionToken('notifications config');\n","import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostBinding, inject, Input, NgZone, OnDestroy, OnInit, ViewChild, ViewEncapsulation} from '@angular/core';\nimport {Notification, NotificationAction, NotificationsConfig} from '../notifications.interfaces';\nimport {BbLocalize} from '@bravobit/bb-foundation/localize';\nimport {BbTemplate} from '@bravobit/bb-foundation/utils';\nimport {Platform} from '@angular/cdk/platform';\nimport {WINDOW} from '@bravobit/bb-foundation';\n\n@Component({\n selector: 'bb-notifications-item',\n templateUrl: './notifications-item.component.html',\n styleUrls: ['./notifications-item.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {'role': 'alert'},\n imports: [BbLocalize, BbTemplate]\n})\nexport class BbNotificationsItem implements OnInit, OnDestroy {\n\n // Dependencies.\n private readonly _zone: NgZone = inject(NgZone);\n private readonly _platform: Platform = inject(Platform);\n private readonly _changeDetection: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n // Dependencies.\n private readonly _config?: NotificationsConfig = inject(NotificationsConfig, {optional: true});\n private readonly _window?: Window = inject(WINDOW, {optional: true});\n\n // Readonly data.\n readonly dismissText: string = this._config?.dismissText ?? null;\n\n // Inputs.\n @Input() notification: Notification | null = null;\n\n // Elements.\n @ViewChild('progress', {static: false}) progressElementRef: ElementRef<SVGCircleElement>;\n\n // Data.\n private _progress: number = 0;\n private _count: number = 0;\n\n // Helper variables.\n private _steps: number;\n private _speed: number;\n private _timer: number;\n private _startTime: number;\n private _difference: number;\n\n // Data.\n private readonly _radius = 19;\n private readonly _circumference = this._radius * 2 * Math.PI;\n\n @HostBinding('class')\n get getClass() {\n return `bb-notifications-item ${this.notification.type}`;\n }\n\n get progressStrokeArray() {\n const value = Math.floor(this._circumference);\n return `${value}, ${value}`;\n }\n\n get progressStrokeOffset() {\n return Math.floor(this._circumference - this._progress / 100 * this._circumference);\n }\n\n ngOnInit() {\n // Check if the notification timeout is not 0 and the platform is a browser.\n if (this.notification.timeout <= 0 || !this._platform.isBrowser) {\n this.notification.dismiss = true;\n return;\n }\n\n // Start the timeout.\n this.startTimeout();\n }\n\n ngOnDestroy() {\n this._timer && this._window?.clearTimeout?.(this._timer);\n }\n\n callActionAndDestroy(notification: Notification, action: NotificationAction) {\n action?.callback?.();\n notification?.destroy?.();\n }\n\n private startTimeout() {\n this._steps = this.notification.timeout / 10;\n this._speed = this.notification.timeout / this._steps;\n this._startTime = Date.now();\n this._zone.runOutsideAngular(() => this._timer = this.setTimeout(this.instance, this._speed));\n }\n\n private instance = () => {\n this._difference = (Date.now() - this._startTime) - (this._count * this._speed);\n\n if (this._count++ === this._steps) {\n this.notification.destroy();\n }\n\n this._progress += 100 / this._steps;\n this._timer = this.setTimeout(this.instance, this._speed - this._difference);\n this._zone.run(() => this._changeDetection.detectChanges());\n };\n\n private setTimeout(method: () => void, timeout: number) {\n if (!this._window || !this._window.setTimeout) {\n return null;\n }\n\n return this._window.setTimeout(method, timeout);\n }\n\n}\n","<div class=\"notification-content-wrapper\">\n <div [style.color]=\"notification?.color\"\n [style.background-color]=\"notification?.backgroundColor\"\n class=\"notification-icon-wrapper\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 20\"\n class=\"notification-icon\">\n <path\n d=\"M8 20c1.1 0 2-.923 2-2.051H6C6 19.077 6.9 20 8 20Zm6-6.154V8.718c0-3.18-1.6-5.744-4.5-6.462v-.718C9.5.718 8.8 0 8 0S6.5.718 6.5 1.538v.718C3.6 2.974 2 5.538 2 8.718v5.128l-2 2.051v1.026h16v-1.026l-2-2.05Z\">\n </path>\n </svg>\n\n @if (notification?.timeout > 0) {\n <svg class=\"notification-progress-ring\"\n viewBox=\"0 0 40 40\"\n role=\"progressbar\">\n <circle #progress\n [attr.stroke-dasharray]=\"progressStrokeArray\"\n [attr.stroke-dashoffset]=\"progressStrokeOffset\"\n [style.stroke]=\"notification?.color\"\n class=\"notification-progress-circle\"\n stroke-width=\"2\"\n fill=\"transparent\"\n r=\"19\"\n cx=\"20\"\n cy=\"20\">\n </circle>\n </svg>\n }\n </div>\n\n <div class=\"notification-content\">\n <ng-template [bbTemplate]=\"notification?.content\">\n @if (notification?.localize) {\n {{ $any(notification?.content) | bbLocalize }}\n } @else {\n {{ notification?.content }}\n }\n </ng-template>\n </div>\n</div>\n\n@if (notification?.actions?.length > 0 || notification?.dismiss) {\n <div class=\"notification-actions\">\n @for (action of notification?.actions; track $index) {\n <button [class.destructive]=\"action?.type === 'cancel'\"\n (click)=\"callActionAndDestroy(notification, action)\"\n type=\"button\"\n class=\"notification-actions-button\">\n <span class=\"notification-actions-button-highlight\">\n @if (notification?.localize) {\n {{ action?.title | bbLocalize }}\n } @else {\n {{ action?.title }}\n }\n </span>\n </button>\n }\n @if (notification?.dismiss) {\n <button (click)=\"notification?.destroy()\"\n class=\"notification-actions-button destructive\"\n type=\"button\">\n <span\n class=\"notification-actions-button-highlight\">{{ notification?.dismissText ?? dismissText }}</span>\n </button>\n }\n </div>\n}\n","import {ChangeDetectionStrategy, Component, inject, OnInit, ViewEncapsulation} from '@angular/core';\nimport {BbNotificationsItem} from '../notifications-item/notifications-item.component';\nimport {Notification, NOTIFICATIONS_DATA} from '../notifications.interfaces';\nimport {AsyncPipe} from '@angular/common';\nimport {map} from 'rxjs/operators';\nimport {Observable} from 'rxjs';\n\n@Component({\n selector: 'bb-notifications-list',\n templateUrl: './notifications-list.component.html',\n styleUrls: ['./notifications-list.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n 'class': 'bb-notifications-list',\n 'role': 'list'\n },\n imports: [AsyncPipe, BbNotificationsItem]\n})\nexport class BbNotificationsList implements OnInit {\n\n // Dependencies.\n private readonly _data$: Observable<Notification[]> = inject(NOTIFICATIONS_DATA);\n\n // Data.\n data$: Observable<{\n notification?: Notification,\n styles?: { offset?: number, scale?: string }\n }[]>;\n\n ngOnInit() {\n this.setData();\n }\n\n private setData() {\n this.data$ = this._data$.pipe(\n map(notifications => {\n return notifications.map((notification, index) => {\n const scale = Math.max(0.9, 1 - (index * 0.02));\n return {\n notification,\n styles: {\n offset: Math.min(index, 5),\n scale: `scale(${scale})`\n }\n };\n });\n })\n );\n }\n\n}\n","@if (data$ | async; as data) {\n <div class=\"notifications-list-wrapper\">\n @for (item of data; track item?.notification?.id) {\n <bb-notifications-item [notification]=\"item?.notification\"\n [style.z-index]=\"item?.notification?.id\"\n [style.margin-top.rem]=\"item?.styles?.offset\"\n [style.transform]=\"item?.styles?.scale\"\n animate.leave=\"leaving\">\n </bb-notifications-item>\n }\n </div>\n}\n","import {ApplicationRef, ComponentRef, createComponent, createEnvironmentInjector, EnvironmentInjector, inject, Injectable, TemplateRef, DOCUMENT} from '@angular/core';\nimport {Notification, NotificationAction, NOTIFICATIONS_CONFIG, NOTIFICATIONS_DATA, NotificationsConfig, NotificationType} from './notifications.interfaces';\nimport {BbNotificationsList} from './notifications-list/notifications-list.component';\nimport {Localize} from '@bravobit/bb-foundation/localize';\nimport {Platform} from '@angular/cdk/platform';\nimport {BehaviorSubject} from 'rxjs';\n\nlet nextUniqueId = 0;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Notifications {\n\n // Dependencies.\n private _platform: Platform = inject(Platform);\n private _applicationRef: ApplicationRef = inject(ApplicationRef);\n private _environmentInjector: EnvironmentInjector = inject(EnvironmentInjector);\n private _localize?: Localize = inject(Localize, {optional: true});\n private _config?: NotificationsConfig = inject(NOTIFICATIONS_CONFIG, {optional: true});\n private _document?: Document = inject(DOCUMENT, {optional: true});\n\n // Reference to the list.\n private _componentRef: ComponentRef<BbNotificationsList>;\n\n // The default settings for the notifications.\n private readonly _defaultMode: 'prepend' | 'append' = this._config?.mode ?? 'prepend';\n private readonly _defaultTimeout: number = this._config?.timeout ?? 8_000;\n private readonly _defaultLocalize: boolean = this._config?.localize ?? false;\n private readonly _defaultDismiss: boolean = this._config?.dismiss ?? true;\n private readonly _defaultDismissText: string = this._config?.dismissText ?? 'Dismiss';\n\n // The data containing the notifications.\n private _notifications$ = new BehaviorSubject<Notification[]>([]);\n\n constructor() {\n this.createElement();\n }\n\n success(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Success});\n }\n\n error(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Error});\n }\n\n warn(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Warning});\n }\n\n info(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n return this.create({content, timeout, actions, type: NotificationType.Info});\n }\n\n create(notification: Notification) {\n const item = this.compose(notification);\n item.destroy = () => this.pull(item);\n return this.push(item);\n }\n\n private push(notification: Notification) {\n // Get the current list.\n const oldList = this._notifications$.getValue();\n\n // Check which mode is activated.\n let newList: Notification[];\n switch (this._defaultMode) {\n case 'append':\n newList = [...oldList, notification];\n break;\n case 'prepend':\n default:\n newList = [notification, ...oldList];\n }\n\n // Push the new notifications.\n this._notifications$.next(newList);\n\n // Return the notification for further use.\n return notification;\n }\n\n private pull(notification: Notification) {\n // Get the current list.\n const newList = this._notifications$\n .getValue()\n .filter(item => item?.id !== notification?.id);\n\n // Push a new list.\n this._notifications$.next(newList);\n }\n\n private compose(notification: Notification) {\n // Attach a random id to the notification.\n notification.id = ++nextUniqueId % 99999;\n\n // Set all properties.\n notification.type = notification?.type ?? NotificationType.Custom;\n notification.content = notification?.content ?? null;\n notification.timeout = notification?.timeout ?? this._defaultTimeout;\n notification.localize = notification?.localize ?? this._defaultLocalize;\n notification.dismiss = notification?.dismiss ?? this._defaultDismiss;\n\n // Dismiss text localization.\n const dismissText = notification.dismissText ?? this._defaultDismissText;\n notification.dismissText = this._defaultLocalize && this._localize\n ? this._localize.translate(dismissText)\n : dismissText;\n\n // Return the composed notification.\n return notification;\n }\n\n private createElement() {\n const environmentInjector = createEnvironmentInjector([\n {provide: NOTIFICATIONS_DATA, useValue: this._notifications$}\n ], this._environmentInjector);\n\n this._componentRef = createComponent(BbNotificationsList, {environmentInjector});\n this._applicationRef.attachView(this._componentRef.hostView);\n\n if (!this._platform.isBrowser) {\n return;\n }\n\n try {\n this._document.body.appendChild(this._componentRef?.location?.nativeElement);\n } catch {\n // Don't do anything, because it must've failed.\n }\n }\n\n}\n","import {NOTIFICATIONS_CONFIG, NotificationsConfig} from './notifications.interfaces';\nimport {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\n\nexport function provideNotificationsConfig(config: NotificationsConfig): EnvironmentProviders {\n return makeEnvironmentProviders([\n {provide: NOTIFICATIONS_CONFIG, useValue: config ?? {}}\n ]);\n}\n","import {provideNotificationsConfig} from './notifications.config';\nimport {NotificationsConfig} from './notifications.interfaces';\nimport {ModuleWithProviders, NgModule} from '@angular/core';\n\n@NgModule()\nexport class NotificationsModule {\n\n static forRoot(config?: NotificationsConfig): ModuleWithProviders<NotificationsModule> {\n return {\n ngModule: NotificationsModule,\n providers: [\n provideNotificationsConfig(config)\n ]\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;IA2BY;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AACxB,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACrB,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;MAQf,mBAAmB,CAAA;AAC5B,IAAA,IAAI;AACJ,IAAA,OAAO;AACP,IAAA,OAAO;AACP,IAAA,QAAQ;AACR,IAAA,WAAW;AACd;MAEY,kBAAkB,GAA+C,IAAI,cAAc,CAAC,oBAAoB;MAExG,oBAAoB,GAAwC,IAAI,cAAc,CAAC,sBAAsB;;MC7BrG,mBAAmB,CAAA;;AAGX,IAAA,KAAK,GAAW,MAAM,CAAC,MAAM,CAAC;AAC9B,IAAA,SAAS,GAAa,MAAM,CAAC,QAAQ,CAAC;AACtC,IAAA,gBAAgB,GAAsB,MAAM,CAAC,iBAAiB,CAAC;;IAG/D,OAAO,GAAyB,MAAM,CAAC,mBAAmB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;IAC7E,OAAO,GAAY,MAAM,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;;IAG3D,WAAW,GAAW,IAAI,CAAC,OAAO,EAAE,WAAW,IAAI,IAAI;;IAGvD,YAAY,GAAwB,IAAI;;AAGT,IAAA,kBAAkB;;IAGlD,SAAS,GAAW,CAAC;IACrB,MAAM,GAAW,CAAC;;AAGlB,IAAA,MAAM;AACN,IAAA,MAAM;A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A,CAAA;kBAHzB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACRK,SAAU,0BAA0B,CAAC,MAA2B,EAAA;AAClE,IAAA,OAAO,wBAAwB,CAAC;QAC5B,EAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE;AACzD,KAAA,CAAC;AACN;;MCFa,mBAAmB,CAAA;IAE5B,OAAO,OAAO,CAAC,MAA4B,EAAA;QACvC,OAAO;AACH,YAAA,QAAQ,EAAE,mBAAmB;AAC7B,YAAA,SAAS,EAAE;gBACP,0BAA0B,CAAC,MAAM;AACpC;SACJ;IACL;uGATS,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAnB,mBAAmB,EAAA,CAAA;wGAAnB,mBAAmB,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B;;;ACJD;;AAEG;;;;"}
|
|
@@ -120,10 +120,10 @@ class Permissions {
|
|
|
120
120
|
});
|
|
121
121
|
this._subscription.add(subscription);
|
|
122
122
|
}
|
|
123
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
124
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Permissions, deps: [{ token: PermissionsHandler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
124
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Permissions, providedIn: 'root' });
|
|
125
125
|
}
|
|
126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Permissions, decorators: [{
|
|
127
127
|
type: Injectable,
|
|
128
128
|
args: [{
|
|
129
129
|
providedIn: 'root'
|
|
@@ -199,10 +199,10 @@ class BbPermission {
|
|
|
199
199
|
static ngAcceptInputType_bbPermission;
|
|
200
200
|
static ngAcceptInputType_bbPermissionElse;
|
|
201
201
|
static ngAcceptInputType_bbPermissionMode;
|
|
202
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
203
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.
|
|
202
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: BbPermission, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
203
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.4", type: BbPermission, isStandalone: true, selector: "ng-template[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse", bbPermissionMode: "bbPermissionMode" }, ngImport: i0 });
|
|
204
204
|
}
|
|
205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: BbPermission, decorators: [{
|
|
206
206
|
type: Directive,
|
|
207
207
|
args: [{
|
|
208
208
|
selector: 'ng-template[bbPermission]'
|
|
@@ -267,11 +267,11 @@ class PermissionsModule {
|
|
|
267
267
|
]
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
271
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
272
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
270
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PermissionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
271
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: PermissionsModule, imports: [BbPermission], exports: [BbPermission] });
|
|
272
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PermissionsModule });
|
|
273
273
|
}
|
|
274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PermissionsModule, decorators: [{
|
|
275
275
|
type: NgModule,
|
|
276
276
|
args: [{
|
|
277
277
|
imports: [BbPermission],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bravobit-bb-foundation-permissions.mjs","sources":["../../../projects/bb-foundation/permissions/src/lib/handlers/abstract.handler.ts","../../../projects/bb-foundation/permissions/src/lib/handlers/local.handler.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.service.ts","../../../projects/bb-foundation/permissions/src/lib/directives/permission.directive.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.interface.ts","../../../projects/bb-foundation/permissions/src/lib/guards/permission.guard.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.config.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.module.ts","../../../projects/bb-foundation/permissions/src/bravobit-bb-foundation-permissions.ts"],"sourcesContent":["import {Observable} from 'rxjs';\n\nexport abstract class PermissionsHandler {\n\n abstract get(): Observable<string[]> | string[];\n\n}\n","import {LocalPermissionsData} from '../permissions.interface';\nimport {PermissionsHandler} from './abstract.handler';\nimport {Auth} from '@bravobit/bb-foundation/auth';\nimport {map} from 'rxjs/operators';\n\nexport class LocalPermissionsHandler extends PermissionsHandler {\n\n constructor(protected auth: Auth,\n protected localPermissions: LocalPermissionsData) {\n super();\n }\n\n override get() {\n return this.auth.user.pipe(\n map(user => user?.['role'] as string ?? null),\n map(role => {\n if (role === null || role === undefined) {\n return [];\n }\n\n return this.getPermissionsForRole(role);\n })\n );\n }\n\n protected getPermissionsForRole(role: string) {\n return Object.keys(this.localPermissions ?? {}).reduce((previous, current) => {\n const roles = this.localPermissions?.[current] ?? [];\n if (roles === '*' || roles?.includes(role)) {\n return [...previous, current];\n }\n\n return previous;\n }, []);\n }\n\n}\n","import {BehaviorSubject, isObservable, of, Subscription} from 'rxjs';\nimport {PermissionsHandler} from './handlers/abstract.handler';\nimport {PermissionsOptions} from './permissions.interface';\nimport {distinctUntilChanged, map} from 'rxjs/operators';\nimport {Injectable, OnDestroy} from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Permissions implements OnDestroy {\n\n // State.\n private _activePermissions$ = new BehaviorSubject<string[]>([]);\n\n // Subscriptions.\n private _subscription = new Subscription();\n\n constructor(private _handler: PermissionsHandler) {\n this.trackPermissions();\n }\n\n ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n\n all() {\n return this._activePermissions$.asObservable();\n }\n\n allSync() {\n return this._activePermissions$.getValue();\n }\n\n has(value: string | string[], options?: PermissionsOptions) {\n const requiredPermissions = this.getRequiredPermissions(value);\n if (requiredPermissions?.length <= 0) {\n return of(false);\n }\n\n return this._activePermissions$.pipe(\n map(activePermissions => this.hasPermission(requiredPermissions, activePermissions, options)),\n distinctUntilChanged()\n );\n }\n\n hasSync(value: string | string[], options?: PermissionsOptions) {\n const requiredPermissions = this.getRequiredPermissions(value);\n if (requiredPermissions?.length <= 0) {\n return false;\n }\n\n const activePermissions = this._activePermissions$.getValue();\n return this.hasPermission(requiredPermissions, activePermissions, options);\n }\n\n private hasPermission(requiredPermissions: string[], activePermissions: string[], options?: PermissionsOptions) {\n const mode = options?.mode ?? 'and';\n switch (mode) {\n case 'or':\n return this.verifyModeOr(requiredPermissions, activePermissions);\n case 'not':\n return this.verifyModeNot(requiredPermissions, activePermissions);\n case 'and':\n default:\n return this.verifyModeAnd(requiredPermissions, activePermissions);\n }\n }\n\n private verifyModeAnd(permissions: string[], activePermissions: string[]) {\n for (const permission of permissions) {\n const verified = activePermissions?.includes(permission);\n if (!verified) {\n return false;\n }\n }\n\n return true;\n }\n\n private verifyModeNot(permissions: string[], activePermissions: string[]) {\n for (const permission of permissions) {\n if (activePermissions.includes(permission)) {\n return false;\n }\n }\n\n return true;\n }\n\n private verifyModeOr(permissions: string[], activePermissions: string[]) {\n for (const permission of permissions) {\n const verified = activePermissions?.includes(permission);\n if (verified) {\n return true;\n }\n }\n\n return false;\n }\n\n private getRequiredPermissions(value: string | string[]) {\n return Array.isArray(value)\n ? value\n : [value];\n }\n\n private trackPermissions() {\n const data = this._handler.get();\n const permissions$ = isObservable(data) ? data : of(data);\n\n const subscription = permissions$.subscribe(permissions => {\n this._activePermissions$.next(permissions ?? []);\n });\n this._subscription.add(subscription);\n }\n\n}\n","import {Directive, EmbeddedViewRef, inject, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';\nimport {BehaviorSubject, combineLatest, Subscription} from 'rxjs';\nimport {distinctUntilChanged, switchMap} from 'rxjs/operators';\nimport {PermissionsMode} from '../permissions.interface';\nimport {Permissions} from '../permissions.service';\n\n@Directive({\n selector: 'ng-template[bbPermission]'\n})\nexport class BbPermission implements OnInit, OnDestroy {\n\n // Dependencies.\n private readonly _permissions: Permissions = inject(Permissions);\n private readonly _templateRef: TemplateRef<any> = inject(TemplateRef);\n private readonly _viewContainerRef: ViewContainerRef = inject(ViewContainerRef);\n\n // Templates.\n private _elseTemplateRef: TemplateRef<any> | null = null;\n\n // View refs.\n private _thenViewRef: EmbeddedViewRef<any> | null = null;\n private _elseViewRef: EmbeddedViewRef<any> | null = null;\n\n // Data.\n private _valid: boolean = false;\n private _permission$ = new BehaviorSubject<string[]>([]);\n private _mode$ = new BehaviorSubject<PermissionsMode>('and');\n\n @Input()\n set bbPermission(value: string | string[]) {\n const permissions = Array.isArray(value) ? value : [value];\n this._permission$.next(permissions);\n this.updateView();\n }\n\n @Input()\n set bbPermissionElse(templateRef: TemplateRef<any>) {\n this.assertTemplate('bbPermissionElse', templateRef);\n this._elseTemplateRef = templateRef;\n this.updateView();\n }\n\n @Input()\n set bbPermissionMode(mode: PermissionsMode) {\n this._mode$.next(mode);\n }\n\n // Subscriptions.\n private _subscription = new Subscription();\n\n ngOnInit() {\n const check$ = combineLatest([this._permission$, this._mode$]).pipe(\n switchMap(([permissions, mode]) => this._permissions.has(permissions, {mode})),\n distinctUntilChanged()\n );\n\n const subscription = check$.subscribe(valid => {\n this._valid = valid;\n this.updateView();\n });\n this._subscription.add(subscription);\n }\n\n ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n\n private updateView() {\n if (this._valid) {\n if (!this._thenViewRef) {\n this._viewContainerRef.clear();\n this._elseViewRef = null;\n if (this._templateRef) {\n this._thenViewRef = this._viewContainerRef.createEmbeddedView(this._templateRef);\n }\n }\n } else {\n if (!this._elseViewRef) {\n this._viewContainerRef.clear();\n this._thenViewRef = null;\n if (this._elseTemplateRef) {\n this._elseViewRef = this._viewContainerRef.createEmbeddedView(this._elseTemplateRef);\n }\n }\n }\n }\n\n private assertTemplate(property: string, templateRef: TemplateRef<any> | null) {\n const isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);\n if (!isTemplateRefOrNull) {\n throw new Error(`${property} must be a TemplateRef.`);\n }\n }\n\n static ngAcceptInputType_bbPermission: string | string[];\n static ngAcceptInputType_bbPermissionElse: TemplateRef<any>;\n static ngAcceptInputType_bbPermissionMode: PermissionsMode;\n\n}\n","import {ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree} from '@angular/router';\nimport {InjectionToken, Provider} from '@angular/core';\n\nexport class PermissionsConfig {\n provider?: Provider;\n localPermissions?: LocalPermissionsData;\n onPermissionDenied?: (router: Router, snapshot: ActivatedRouteSnapshot, state: RouterStateSnapshot) => UrlTree;\n}\n\nexport interface PermissionsOptions {\n mode?: PermissionsMode;\n}\n\nexport type PermissionsMode = 'and' | 'or' | 'not';\nexport type LocalPermissionsData<T extends string = any> = Record<string, T[] | '*'>;\n\nexport const PERMISSIONS_CONFIG: InjectionToken<PermissionsConfig> = new InjectionToken('permissions config');\n","import {ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot} from '@angular/router';\nimport {PermissionsOptions, PERMISSIONS_CONFIG} from '../permissions.interface';\nimport {Permissions} from '../permissions.service';\nimport {inject} from '@angular/core';\n\nexport const bbPermissionGuard = (value: string | string[], options?: PermissionsOptions): CanActivateFn => {\n return (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {\n const router = inject(Router);\n const permissions = inject(Permissions);\n const config = inject(PERMISSIONS_CONFIG, {optional: true});\n\n const valid = permissions.hasSync(value, options);\n if (valid) {\n return true;\n }\n\n const onPermissionDeniedFn = config?.onPermissionDenied ?? null;\n if (!onPermissionDeniedFn) {\n return false;\n }\n\n const urlTree = onPermissionDeniedFn(router, route, state);\n if (!urlTree) {\n return false;\n }\n\n return valid ? true : urlTree;\n };\n};\n","import {EnvironmentProviders, makeEnvironmentProviders, Provider} from '@angular/core';\nimport {PERMISSIONS_CONFIG, PermissionsConfig} from './permissions.interface';\nimport {LocalPermissionsHandler} from './handlers/local.handler';\nimport {PermissionsHandler} from './handlers/abstract.handler';\nimport {Auth} from '@bravobit/bb-foundation/auth';\n\nexport function providePermissionsConfig(config?: PermissionsConfig): EnvironmentProviders {\n const defaultProvider: Provider = {\n provide: PermissionsHandler,\n deps: [Auth],\n useFactory: (auth: Auth) => {\n return new LocalPermissionsHandler(auth, config?.localPermissions ?? {});\n }\n };\n\n const permissionHandlerProvider = config?.provider ?? defaultProvider;\n\n return makeEnvironmentProviders([\n {provide: PERMISSIONS_CONFIG, useValue: config},\n permissionHandlerProvider\n ]);\n}\n","import {BbPermission} from './directives/permission.directive';\nimport {providePermissionsConfig} from './permissions.config';\nimport {ModuleWithProviders, NgModule} from '@angular/core';\nimport {PermissionsConfig} from './permissions.interface';\n\n@NgModule({\n imports: [BbPermission],\n exports: [BbPermission]\n})\nexport class PermissionsModule {\n\n static forRoot(config?: PermissionsConfig): ModuleWithProviders<PermissionsModule> {\n return {\n ngModule: PermissionsModule,\n providers: [\n providePermissionsConfig(config)\n ]\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.PermissionsHandler"],"mappings":";;;;;;;MAEsB,kBAAkB,CAAA;AAIvC;;ACDK,MAAO,uBAAwB,SAAQ,kBAAkB,CAAA;AAErC,IAAA,IAAA;AACA,IAAA,gBAAA;IADtB,WAAA,CAAsB,IAAU,EACV,gBAAsC,EAAA;AACxD,QAAA,KAAK,EAAE;QAFW,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;;IAI7B,GAAG,GAAA;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACtB,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,MAAM,CAAW,IAAI,IAAI,CAAC,EAC7C,GAAG,CAAC,IAAI,IAAG;YACP,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;AACrC,gBAAA,OAAO,EAAE;;AAGb,YAAA,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC;SAC1C,CAAC,CACL;;AAGK,IAAA,qBAAqB,CAAC,IAAY,EAAA;AACxC,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAI;YACzE,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,IAAI,EAAE;YACpD,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,EAAE,QAAQ,CAAC,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AA,OAAO,EAAE,kBAAkB;QAC3B,IAAI,EAAE,CAAC,IAAI,CAAC;AACZ,QAAA,UAAU,EAAE,CAAC,IAAU,KAAI;YACvB,OAAO,IAAI,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,IAAI,EAAE,CAAC;;KAE/E;AAED,IAAA,MAAM,yBAAyB,GAAG,MAAM,EAAE,QAAQ,IAAI,eAAe;AAErE,IAAA,OAAO,wBAAwB,CAAC;AAC5B,QAAA,EAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAC;QAC/C;AACH,KAAA,CAAC;AACN;;MCZa,iBAAiB,CAAA;IAE1B,OAAO,OAAO,CAAC,MAA0B,EAAA;QACrC,OAAO;AACH,YAAA,QAAQ,EAAE,iBAAiB;AAC3B,YAAA,SAAS,EAAE;gBACP,wBAAwB,CAAC,MAAM;AAClC;SACJ;;uGARI,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAjB,iBAAiB,EAAA,OAAA,EAAA,CAHhB,YAAY,CAAA,EAAA,OAAA,EAAA,CACZ,YAAY,CAAA,EAAA,CAAA;wGAEb,iBAAiB,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,YAAY;AACzB,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bravobit-bb-foundation-permissions.mjs","sources":["../../../projects/bb-foundation/permissions/src/lib/handlers/abstract.handler.ts","../../../projects/bb-foundation/permissions/src/lib/handlers/local.handler.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.service.ts","../../../projects/bb-foundation/permissions/src/lib/directives/permission.directive.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.interface.ts","../../../projects/bb-foundation/permissions/src/lib/guards/permission.guard.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.config.ts","../../../projects/bb-foundation/permissions/src/lib/permissions.module.ts","../../../projects/bb-foundation/permissions/src/bravobit-bb-foundation-permissions.ts"],"sourcesContent":["import {Observable} from 'rxjs';\n\nexport abstract class PermissionsHandler {\n\n abstract get(): Observable<string[]> | string[];\n\n}\n","import {LocalPermissionsData} from '../permissions.interface';\nimport {PermissionsHandler} from './abstract.handler';\nimport {Auth} from '@bravobit/bb-foundation/auth';\nimport {map} from 'rxjs/operators';\n\nexport class LocalPermissionsHandler extends PermissionsHandler {\n\n constructor(protected auth: Auth,\n protected localPermissions: LocalPermissionsData) {\n super();\n }\n\n override get() {\n return this.auth.user.pipe(\n map(user => user?.['role'] as string ?? null),\n map(role => {\n if (role === null || role === undefined) {\n return [];\n }\n\n return this.getPermissionsForRole(role);\n })\n );\n }\n\n protected getPermissionsForRole(role: string) {\n return Object.keys(this.localPermissions ?? {}).reduce((previous, current) => {\n const roles = this.localPermissions?.[current] ?? [];\n if (roles === '*' || roles?.includes(role)) {\n return [...previous, current];\n }\n\n return previous;\n }, []);\n }\n\n}\n","import {BehaviorSubject, isObservable, of, Subscription} from 'rxjs';\nimport {PermissionsHandler} from './handlers/abstract.handler';\nimport {PermissionsOptions} from './permissions.interface';\nimport {distinctUntilChanged, map} from 'rxjs/operators';\nimport {Injectable, OnDestroy} from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Permissions implements OnDestroy {\n\n // State.\n private _activePermissions$ = new BehaviorSubject<string[]>([]);\n\n // Subscriptions.\n private _subscription = new Subscription();\n\n constructor(private _handler: PermissionsHandler) {\n this.trackPermissions();\n }\n\n ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n\n all() {\n return this._activePermissions$.asObservable();\n }\n\n allSync() {\n return this._activePermissions$.getValue();\n }\n\n has(value: string | string[], options?: PermissionsOptions) {\n const requiredPermissions = this.getRequiredPermissions(value);\n if (requiredPermissions?.length <= 0) {\n return of(false);\n }\n\n return this._activePermissions$.pipe(\n map(activePermissions => this.hasPermission(requiredPermissions, activePermissions, options)),\n distinctUntilChanged()\n );\n }\n\n hasSync(value: string | string[], options?: PermissionsOptions) {\n const requiredPermissions = this.getRequiredPermissions(value);\n if (requiredPermissions?.length <= 0) {\n return false;\n }\n\n const activePermissions = this._activePermissions$.getValue();\n return this.hasPermission(requiredPermissions, activePermissions, options);\n }\n\n private hasPermission(requiredPermissions: string[], activePermissions: string[], options?: PermissionsOptions) {\n const mode = options?.mode ?? 'and';\n switch (mode) {\n case 'or':\n return this.verifyModeOr(requiredPermissions, activePermissions);\n case 'not':\n return this.verifyModeNot(requiredPermissions, activePermissions);\n case 'and':\n default:\n return this.verifyModeAnd(requiredPermissions, activePermissions);\n }\n }\n\n private verifyModeAnd(permissions: string[], activePermissions: string[]) {\n for (const permission of permissions) {\n const verified = activePermissions?.includes(permission);\n if (!verified) {\n return false;\n }\n }\n\n return true;\n }\n\n private verifyModeNot(permissions: string[], activePermissions: string[]) {\n for (const permission of permissions) {\n if (activePermissions.includes(permission)) {\n return false;\n }\n }\n\n return true;\n }\n\n private verifyModeOr(permissions: string[], activePermissions: string[]) {\n for (const permission of permissions) {\n const verified = activePermissions?.includes(permission);\n if (verified) {\n return true;\n }\n }\n\n return false;\n }\n\n private getRequiredPermissions(value: string | string[]) {\n return Array.isArray(value)\n ? value\n : [value];\n }\n\n private trackPermissions() {\n const data = this._handler.get();\n const permissions$ = isObservable(data) ? data : of(data);\n\n const subscription = permissions$.subscribe(permissions => {\n this._activePermissions$.next(permissions ?? []);\n });\n this._subscription.add(subscription);\n }\n\n}\n","import {Directive, EmbeddedViewRef, inject, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';\nimport {BehaviorSubject, combineLatest, Subscription} from 'rxjs';\nimport {distinctUntilChanged, switchMap} from 'rxjs/operators';\nimport {PermissionsMode} from '../permissions.interface';\nimport {Permissions} from '../permissions.service';\n\n@Directive({\n selector: 'ng-template[bbPermission]'\n})\nexport class BbPermission implements OnInit, OnDestroy {\n\n // Dependencies.\n private readonly _permissions: Permissions = inject(Permissions);\n private readonly _templateRef: TemplateRef<any> = inject(TemplateRef);\n private readonly _viewContainerRef: ViewContainerRef = inject(ViewContainerRef);\n\n // Templates.\n private _elseTemplateRef: TemplateRef<any> | null = null;\n\n // View refs.\n private _thenViewRef: EmbeddedViewRef<any> | null = null;\n private _elseViewRef: EmbeddedViewRef<any> | null = null;\n\n // Data.\n private _valid: boolean = false;\n private _permission$ = new BehaviorSubject<string[]>([]);\n private _mode$ = new BehaviorSubject<PermissionsMode>('and');\n\n @Input()\n set bbPermission(value: string | string[]) {\n const permissions = Array.isArray(value) ? value : [value];\n this._permission$.next(permissions);\n this.updateView();\n }\n\n @Input()\n set bbPermissionElse(templateRef: TemplateRef<any>) {\n this.assertTemplate('bbPermissionElse', templateRef);\n this._elseTemplateRef = templateRef;\n this.updateView();\n }\n\n @Input()\n set bbPermissionMode(mode: PermissionsMode) {\n this._mode$.next(mode);\n }\n\n // Subscriptions.\n private _subscription = new Subscription();\n\n ngOnInit() {\n const check$ = combineLatest([this._permission$, this._mode$]).pipe(\n switchMap(([permissions, mode]) => this._permissions.has(permissions, {mode})),\n distinctUntilChanged()\n );\n\n const subscription = check$.subscribe(valid => {\n this._valid = valid;\n this.updateView();\n });\n this._subscription.add(subscription);\n }\n\n ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n\n private updateView() {\n if (this._valid) {\n if (!this._thenViewRef) {\n this._viewContainerRef.clear();\n this._elseViewRef = null;\n if (this._templateRef) {\n this._thenViewRef = this._viewContainerRef.createEmbeddedView(this._templateRef);\n }\n }\n } else {\n if (!this._elseViewRef) {\n this._viewContainerRef.clear();\n this._thenViewRef = null;\n if (this._elseTemplateRef) {\n this._elseViewRef = this._viewContainerRef.createEmbeddedView(this._elseTemplateRef);\n }\n }\n }\n }\n\n private assertTemplate(property: string, templateRef: TemplateRef<any> | null) {\n const isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);\n if (!isTemplateRefOrNull) {\n throw new Error(`${property} must be a TemplateRef.`);\n }\n }\n\n static ngAcceptInputType_bbPermission: string | string[];\n static ngAcceptInputType_bbPermissionElse: TemplateRef<any>;\n static ngAcceptInputType_bbPermissionMode: PermissionsMode;\n\n}\n","import {ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree} from '@angular/router';\nimport {InjectionToken, Provider} from '@angular/core';\n\nexport class PermissionsConfig {\n provider?: Provider;\n localPermissions?: LocalPermissionsData;\n onPermissionDenied?: (router: Router, snapshot: ActivatedRouteSnapshot, state: RouterStateSnapshot) => UrlTree;\n}\n\nexport interface PermissionsOptions {\n mode?: PermissionsMode;\n}\n\nexport type PermissionsMode = 'and' | 'or' | 'not';\nexport type LocalPermissionsData<T extends string = any> = Record<string, T[] | '*'>;\n\nexport const PERMISSIONS_CONFIG: InjectionToken<PermissionsConfig> = new InjectionToken('permissions config');\n","import {ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot} from '@angular/router';\nimport {PermissionsOptions, PERMISSIONS_CONFIG} from '../permissions.interface';\nimport {Permissions} from '../permissions.service';\nimport {inject} from '@angular/core';\n\nexport const bbPermissionGuard = (value: string | string[], options?: PermissionsOptions): CanActivateFn => {\n return (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {\n const router = inject(Router);\n const permissions = inject(Permissions);\n const config = inject(PERMISSIONS_CONFIG, {optional: true});\n\n const valid = permissions.hasSync(value, options);\n if (valid) {\n return true;\n }\n\n const onPermissionDeniedFn = config?.onPermissionDenied ?? null;\n if (!onPermissionDeniedFn) {\n return false;\n }\n\n const urlTree = onPermissionDeniedFn(router, route, state);\n if (!urlTree) {\n return false;\n }\n\n return valid ? true : urlTree;\n };\n};\n","import {EnvironmentProviders, makeEnvironmentProviders, Provider} from '@angular/core';\nimport {PERMISSIONS_CONFIG, PermissionsConfig} from './permissions.interface';\nimport {LocalPermissionsHandler} from './handlers/local.handler';\nimport {PermissionsHandler} from './handlers/abstract.handler';\nimport {Auth} from '@bravobit/bb-foundation/auth';\n\nexport function providePermissionsConfig(config?: PermissionsConfig): EnvironmentProviders {\n const defaultProvider: Provider = {\n provide: PermissionsHandler,\n deps: [Auth],\n useFactory: (auth: Auth) => {\n return new LocalPermissionsHandler(auth, config?.localPermissions ?? {});\n }\n };\n\n const permissionHandlerProvider = config?.provider ?? defaultProvider;\n\n return makeEnvironmentProviders([\n {provide: PERMISSIONS_CONFIG, useValue: config},\n permissionHandlerProvider\n ]);\n}\n","import {BbPermission} from './directives/permission.directive';\nimport {providePermissionsConfig} from './permissions.config';\nimport {ModuleWithProviders, NgModule} from '@angular/core';\nimport {PermissionsConfig} from './permissions.interface';\n\n@NgModule({\n imports: [BbPermission],\n exports: [BbPermission]\n})\nexport class PermissionsModule {\n\n static forRoot(config?: PermissionsConfig): ModuleWithProviders<PermissionsModule> {\n return {\n ngModule: PermissionsModule,\n providers: [\n providePermissionsConfig(config)\n ]\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.PermissionsHandler"],"mappings":";;;;;;;MAEsB,kBAAkB,CAAA;AAIvC;;ACDK,MAAO,uBAAwB,SAAQ,kBAAkB,CAAA;AAErC,IAAA,IAAA;AACA,IAAA,gBAAA;IADtB,WAAA,CAAsB,IAAU,EACV,gBAAsC,EAAA;AACxD,QAAA,KAAK,EAAE;QAFW,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;IAEtC;IAES,GAAG,GAAA;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACtB,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,MAAM,CAAW,IAAI,IAAI,CAAC,EAC7C,GAAG,CAAC,IAAI,IAAG;YACP,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE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AA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAjB,iBAAiB,EAAA,OAAA,EAAA,CAHhB,YAAY,CAAA,EAAA,OAAA,EAAA,CACZ,YAAY,CAAA,EAAA,CAAA;wGAEb,iBAAiB,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,YAAY;AACzB,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -70,10 +70,10 @@ class RecaptchaLoader {
|
|
|
70
70
|
.map(item => `${item?.key}=${item?.value}`)
|
|
71
71
|
.join('&');
|
|
72
72
|
}
|
|
73
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
74
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
73
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
74
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaLoader, providedIn: 'root' });
|
|
75
75
|
}
|
|
76
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
76
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaLoader, decorators: [{
|
|
77
77
|
type: Injectable,
|
|
78
78
|
args: [{
|
|
79
79
|
providedIn: 'root'
|
|
@@ -233,8 +233,8 @@ class RecaptchaComponent {
|
|
|
233
233
|
const newSrc = src.replace(/hl=(.*?)&/, `hl=${locale}&`);
|
|
234
234
|
this._renderer.setAttribute(frame, 'src', newSrc);
|
|
235
235
|
}
|
|
236
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
237
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.
|
|
236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
237
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.4", type: RecaptchaComponent, isStandalone: true, selector: "bb-recaptcha", inputs: { id: "id", siteKey: "siteKey", tabIndex: "tabIndex", type: "type", size: "size", theme: "theme", badge: "badge", errorMode: "errorMode", grouped: ["grouped", "grouped", booleanAttribute] }, outputs: { resolved: "resolved", error: "error" }, host: { properties: { "class.grouped": "grouped", "attr.id": "this.id" }, classAttribute: "bb-recaptcha" }, providers: [
|
|
238
238
|
{
|
|
239
239
|
provide: NG_VALUE_ACCESSOR,
|
|
240
240
|
useExisting: forwardRef(() => RecaptchaComponent),
|
|
@@ -242,7 +242,7 @@ class RecaptchaComponent {
|
|
|
242
242
|
}
|
|
243
243
|
], exportAs: ["bbRecaptcha"], ngImport: i0, template: "", styles: [".bb-recaptcha{display:block;line-height:normal}.bb-recaptcha.grouped{margin-bottom:1.5rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
244
244
|
}
|
|
245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaComponent, decorators: [{
|
|
246
246
|
type: Component,
|
|
247
247
|
args: [{ selector: 'bb-recaptcha', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'bbRecaptcha', providers: [
|
|
248
248
|
{
|
|
@@ -298,11 +298,11 @@ class RecaptchaModule {
|
|
|
298
298
|
]
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
302
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
303
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
301
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
302
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaModule, imports: [RecaptchaComponent], exports: [RecaptchaComponent] });
|
|
303
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaModule });
|
|
304
304
|
}
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
305
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RecaptchaModule, decorators: [{
|
|
306
306
|
type: NgModule,
|
|
307
307
|
args: [{
|
|
308
308
|
imports: [RecaptchaComponent],
|