@bravobit/bb-foundation 0.22.1 → 0.22.4
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/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +3 -2
- package/controls/lib/checkbox/checkbox.module.d.ts +2 -1
- package/controls/lib/form-control/form-control/form-control.component.d.ts +5 -5
- package/controls/lib/form-control/form-control.module.d.ts +2 -1
- package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +4 -2
- package/dialog/lib/dialog.interfaces.d.ts +7 -0
- package/dialog/lib/dialog.service.d.ts +5 -9
- package/elements/lib/date-picker/date-picker.component.d.ts +4 -2
- package/elements/lib/elements.module.d.ts +25 -28
- package/elements/lib/pipes/relative-time.pipe.d.ts +4 -4
- package/elements/public_api.d.ts +0 -4
- package/esm2020/auth/lib/auth.interceptor.mjs +3 -3
- package/esm2020/auth/lib/auth.module.mjs +4 -4
- package/esm2020/auth/lib/auth.service.mjs +3 -3
- package/esm2020/auth/lib/directives/authenticated.directive.mjs +3 -3
- package/esm2020/auth/lib/directives/permission.directive.mjs +3 -3
- package/esm2020/auth/lib/guards/anonymous.guard.mjs +3 -3
- package/esm2020/auth/lib/guards/authenticated.guard.mjs +3 -3
- package/esm2020/auth/lib/guards/permission.guard.mjs +3 -3
- package/esm2020/auth/lib/permissions/permissions.service.mjs +3 -3
- package/esm2020/collections/lib/collections.module.mjs +4 -4
- package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +3 -3
- package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +5 -5
- package/esm2020/collections/lib/components/collections.directive.mjs +12 -12
- package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +3 -3
- package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +7 -6
- package/esm2020/controls/lib/checkbox/checkbox.module.mjs +7 -6
- package/esm2020/controls/lib/control-error/control-error/control-error.component.mjs +3 -3
- package/esm2020/controls/lib/control-error/control-error-submit.directive.mjs +3 -3
- package/esm2020/controls/lib/control-error/control-error.module.mjs +4 -4
- package/esm2020/controls/lib/controls.module.mjs +4 -4
- package/esm2020/controls/lib/form-control/form-control/form-control.component.mjs +6 -5
- package/esm2020/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +3 -3
- package/esm2020/controls/lib/form-control/form-control-input.directive.mjs +3 -3
- package/esm2020/controls/lib/form-control/form-control.module.mjs +8 -7
- package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard.module.mjs +4 -4
- package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +15 -12
- package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +5 -5
- package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +6 -6
- package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog.insertion.mjs +3 -3
- package/esm2020/dialog/lib/dialog.interfaces.mjs +1 -1
- package/esm2020/dialog/lib/dialog.module.mjs +4 -4
- package/esm2020/dialog/lib/dialog.service.mjs +15 -27
- package/esm2020/elements/lib/avatar/avatar.component.mjs +7 -7
- package/esm2020/elements/lib/button/button.component.mjs +6 -6
- package/esm2020/elements/lib/checkbox/checkbox.component.mjs +3 -3
- package/esm2020/elements/lib/date-picker/date-picker.component.mjs +20 -15
- package/esm2020/elements/lib/directives/addon.directive.mjs +6 -6
- package/esm2020/elements/lib/directives/form-submit.directive.mjs +3 -3
- package/esm2020/elements/lib/directives/form-submitter.directive.mjs +3 -3
- package/esm2020/elements/lib/directives/input.directive.mjs +6 -6
- package/esm2020/elements/lib/dropdown/dropdown.component.mjs +6 -6
- package/esm2020/elements/lib/elements.module.mjs +21 -25
- package/esm2020/elements/lib/file-picker/file-picker.component.mjs +4 -4
- package/esm2020/elements/lib/form-control/form-control.component.mjs +4 -4
- package/esm2020/elements/lib/form-error/form-error.component.mjs +3 -3
- package/esm2020/elements/lib/form-group/form-group.component.mjs +3 -3
- package/esm2020/elements/lib/icon/icon.component.mjs +3 -3
- package/esm2020/elements/lib/image-picker/image-picker.component.mjs +3 -3
- package/esm2020/elements/lib/pipes/file-image.pipe.mjs +3 -3
- package/esm2020/elements/lib/pipes/file-size.pipe.mjs +3 -3
- package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +15 -13
- package/esm2020/elements/lib/spinner/spinner.component.mjs +3 -3
- package/esm2020/elements/lib/tag/tag.component.mjs +3 -3
- package/esm2020/elements/public_api.mjs +1 -5
- package/esm2020/http/lib/classes/http.config.mjs +2 -3
- package/esm2020/http/lib/http.module.mjs +4 -4
- package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +6 -6
- package/esm2020/http/lib/interceptors/error.interceptor.mjs +3 -3
- package/esm2020/lib/core/services/clipboard.service.mjs +3 -3
- package/esm2020/lib/core/services/exif.service.mjs +3 -3
- package/esm2020/lib/core/services/file-loader.service.mjs +3 -3
- package/esm2020/lib/core/services/image-converter.service.mjs +3 -3
- package/esm2020/lib/core/services/languages.service.mjs +3 -3
- package/esm2020/lib/core/services/network.service.mjs +3 -3
- package/esm2020/lib/core/services/patch.service.mjs +3 -3
- package/esm2020/localize/lib/localize.dictionary.mjs +2 -4
- package/esm2020/localize/lib/localize.module.mjs +9 -11
- package/esm2020/localize/lib/localize.pipe.mjs +3 -3
- package/esm2020/localize/lib/localize.service.mjs +3 -3
- package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +6 -6
- package/esm2020/localize/lib/views/localize-template.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/currency-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/date-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/input-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/masking.module.mjs +4 -4
- package/esm2020/masking/lib/masking.service.mjs +3 -3
- package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +3 -3
- package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +3 -3
- package/esm2020/notifications/lib/notifications.module.mjs +4 -4
- package/esm2020/notifications/lib/notifications.service.mjs +22 -26
- package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +3 -3
- package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +3 -3
- package/esm2020/recaptcha/lib/recaptcha.module.mjs +4 -4
- package/esm2020/storage/lib/storage.service.mjs +7 -7
- package/esm2020/table/lib/components/table/table.component.mjs +9 -9
- package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +3 -3
- package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +3 -3
- package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +3 -3
- package/esm2020/table/lib/table.module.mjs +4 -4
- package/esm2020/theming/lib/theming.directive.mjs +3 -3
- package/esm2020/theming/lib/theming.module.mjs +4 -4
- package/esm2020/utils/bravobit-bb-foundation-utils.mjs +5 -0
- package/esm2020/utils/lib/directives/autosize.directive.mjs +72 -0
- package/esm2020/utils/lib/directives/focus-trap.directive.mjs +77 -0
- package/esm2020/utils/lib/directives/focus.directive.mjs +37 -0
- package/esm2020/utils/lib/directives/template.directive.mjs +28 -0
- package/esm2020/utils/lib/utils.module.mjs +35 -0
- package/esm2020/utils/public_api.mjs +6 -0
- package/fesm2015/bravobit-bb-foundation-auth.mjs +28 -28
- package/fesm2015/bravobit-bb-foundation-collections.mjs +23 -23
- package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-controls.mjs +47 -45
- package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs +25 -25
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-dialog.mjs +56 -83
- package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-elements.mjs +126 -324
- package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-http.mjs +14 -14
- package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-localize.mjs +26 -53
- package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-masking.mjs +16 -16
- package/fesm2015/bravobit-bb-foundation-notifications.mjs +31 -52
- package/fesm2015/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +10 -10
- package/fesm2015/bravobit-bb-foundation-storage.mjs +6 -6
- package/fesm2015/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-table.mjs +22 -22
- package/fesm2015/bravobit-bb-foundation-theming.mjs +7 -7
- package/fesm2015/bravobit-bb-foundation-utils.mjs +246 -0
- package/fesm2015/bravobit-bb-foundation-utils.mjs.map +1 -0
- package/fesm2015/bravobit-bb-foundation.mjs +21 -21
- package/fesm2020/bravobit-bb-foundation-auth.mjs +28 -28
- package/fesm2020/bravobit-bb-foundation-collections.mjs +23 -23
- package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-controls.mjs +47 -45
- package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs +25 -25
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-dialog.mjs +55 -81
- package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-elements.mjs +124 -322
- package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-http.mjs +14 -14
- package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-localize.mjs +26 -53
- package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-masking.mjs +16 -16
- package/fesm2020/bravobit-bb-foundation-notifications.mjs +31 -52
- package/fesm2020/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +10 -10
- package/fesm2020/bravobit-bb-foundation-storage.mjs +6 -6
- package/fesm2020/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-table.mjs +22 -22
- package/fesm2020/bravobit-bb-foundation-theming.mjs +7 -7
- package/fesm2020/bravobit-bb-foundation-utils.mjs +244 -0
- package/fesm2020/bravobit-bb-foundation-utils.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation.mjs +21 -21
- package/localize/lib/localize.module.d.ts +3 -3
- package/notifications/lib/notifications.service.d.ts +6 -7
- package/package.json +12 -4
- package/utils/index.d.ts +5 -0
- package/{elements → utils}/lib/directives/autosize.directive.d.ts +0 -0
- package/{elements → utils}/lib/directives/focus-trap.directive.d.ts +0 -0
- package/{elements → utils}/lib/directives/focus.directive.d.ts +0 -0
- package/{elements → utils}/lib/directives/template.directive.d.ts +1 -0
- package/utils/lib/utils.module.d.ts +10 -0
- package/utils/public_api.d.ts +5 -0
- package/dialog/lib/dialog.injector.d.ts +0 -8
- package/esm2020/dialog/lib/dialog.injector.mjs +0 -18
- package/esm2020/elements/lib/directives/autosize.directive.mjs +0 -72
- package/esm2020/elements/lib/directives/focus-trap.directive.mjs +0 -77
- package/esm2020/elements/lib/directives/focus.directive.mjs +0 -37
- package/esm2020/elements/lib/directives/template.directive.mjs +0 -28
- package/esm2020/localize/lib/views/localize-template-or-string.directive.mjs +0 -28
- package/esm2020/notifications/lib/notifications.injector.mjs +0 -18
- package/localize/lib/views/localize-template-or-string.directive.d.ts +0 -10
- package/notifications/lib/notifications.injector.d.ts +0 -8
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { TemplateRef, Directive, Input, HostBinding, HostListener, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/cdk/platform';
|
|
4
|
+
|
|
5
|
+
class BbTemplate {
|
|
6
|
+
constructor(_templateRef, _viewContainerRef) {
|
|
7
|
+
this._templateRef = _templateRef;
|
|
8
|
+
this._viewContainerRef = _viewContainerRef;
|
|
9
|
+
}
|
|
10
|
+
set bbTemplate(content) {
|
|
11
|
+
// Get the template.
|
|
12
|
+
const template = content instanceof TemplateRef
|
|
13
|
+
? content
|
|
14
|
+
: this._templateRef;
|
|
15
|
+
// Clear the view container ref and create the view.
|
|
16
|
+
this._viewContainerRef.clear();
|
|
17
|
+
this._viewContainerRef.createEmbeddedView(template);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
21
|
+
BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbTemplate, decorators: [{
|
|
23
|
+
type: Directive,
|
|
24
|
+
args: [{
|
|
25
|
+
selector: '[bbTemplate]'
|
|
26
|
+
}]
|
|
27
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
|
|
28
|
+
type: Input
|
|
29
|
+
}] } });
|
|
30
|
+
|
|
31
|
+
class BbAutosize {
|
|
32
|
+
constructor(_renderer, _elementRef) {
|
|
33
|
+
this._renderer = _renderer;
|
|
34
|
+
this._elementRef = _elementRef;
|
|
35
|
+
// Min/max heights for the textarea.
|
|
36
|
+
this.minHeight = null;
|
|
37
|
+
this.maxHeight = null;
|
|
38
|
+
this.rows = 1;
|
|
39
|
+
}
|
|
40
|
+
get element() {
|
|
41
|
+
return this._elementRef?.nativeElement;
|
|
42
|
+
}
|
|
43
|
+
ngAfterViewInit() {
|
|
44
|
+
// Update the styles after the DOM has loaded.
|
|
45
|
+
this.updateStyles();
|
|
46
|
+
}
|
|
47
|
+
onWindowResize() {
|
|
48
|
+
// Update the styles when the window is resized.
|
|
49
|
+
this.updateStyles();
|
|
50
|
+
}
|
|
51
|
+
onInputReceived() {
|
|
52
|
+
// Update the styles after the textarea received input.
|
|
53
|
+
this.updateStyles();
|
|
54
|
+
}
|
|
55
|
+
updateStyles() {
|
|
56
|
+
// Validate the element exists.
|
|
57
|
+
if (!this.element) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// Calculate border height which is not included in the scroll height.
|
|
61
|
+
const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;
|
|
62
|
+
// Reset textarea height to auto that correctly calculate the new height.
|
|
63
|
+
this.setHeight('auto');
|
|
64
|
+
// Set new height.
|
|
65
|
+
this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);
|
|
66
|
+
}
|
|
67
|
+
setHeight(value) {
|
|
68
|
+
this._renderer.setStyle(this.element, 'height', value);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
72
|
+
BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: BbAutosize, selector: "textarea[bbAutosize]", inputs: { minHeight: "minHeight", maxHeight: "maxHeight", rows: "rows" }, host: { listeners: { "window:resize": "onWindowResize()", "input": "onInputReceived()" }, properties: { "style.min-height": "this.minHeight", "style.max-height": "this.maxHeight", "rows": "this.rows" } }, ngImport: i0 });
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbAutosize, decorators: [{
|
|
74
|
+
type: Directive,
|
|
75
|
+
args: [{
|
|
76
|
+
selector: 'textarea[bbAutosize]'
|
|
77
|
+
}]
|
|
78
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}, {
|
|
81
|
+
type: HostBinding,
|
|
82
|
+
args: ['style.min-height']
|
|
83
|
+
}], maxHeight: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}, {
|
|
86
|
+
type: HostBinding,
|
|
87
|
+
args: ['style.max-height']
|
|
88
|
+
}], rows: [{
|
|
89
|
+
type: Input
|
|
90
|
+
}, {
|
|
91
|
+
type: HostBinding,
|
|
92
|
+
args: ['rows']
|
|
93
|
+
}], onWindowResize: [{
|
|
94
|
+
type: HostListener,
|
|
95
|
+
args: ['window:resize']
|
|
96
|
+
}], onInputReceived: [{
|
|
97
|
+
type: HostListener,
|
|
98
|
+
args: ['input']
|
|
99
|
+
}] } });
|
|
100
|
+
|
|
101
|
+
class BbFocus {
|
|
102
|
+
constructor(_zone, _elementRef) {
|
|
103
|
+
this._zone = _zone;
|
|
104
|
+
this._elementRef = _elementRef;
|
|
105
|
+
}
|
|
106
|
+
get nativeElement() {
|
|
107
|
+
return this._elementRef.nativeElement;
|
|
108
|
+
}
|
|
109
|
+
ngAfterViewInit() {
|
|
110
|
+
// Run the method outside the Angular zone.
|
|
111
|
+
this._zone.runOutsideAngular(() => this.focus());
|
|
112
|
+
}
|
|
113
|
+
focus() {
|
|
114
|
+
// Check if set timeout exists and the user is
|
|
115
|
+
// using the site on desktop devices.
|
|
116
|
+
if (!setTimeout) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// Check if the element and the focus method exist, if so focus the element.
|
|
120
|
+
if (!this.nativeElement || !this.nativeElement.focus) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// Execute the focus method in a timeout.
|
|
124
|
+
setTimeout(() => this.nativeElement.focus(), 0);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
128
|
+
BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbFocus, decorators: [{
|
|
130
|
+
type: Directive,
|
|
131
|
+
args: [{
|
|
132
|
+
selector: '[bbFocus]'
|
|
133
|
+
}]
|
|
134
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }]; } });
|
|
135
|
+
|
|
136
|
+
class BbFocusTrap {
|
|
137
|
+
constructor(_platform, _elementRef) {
|
|
138
|
+
this._platform = _platform;
|
|
139
|
+
this._elementRef = _elementRef;
|
|
140
|
+
this._focusableElements = [
|
|
141
|
+
'a[href]',
|
|
142
|
+
'area[href]',
|
|
143
|
+
'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
|
|
144
|
+
'select:not([disabled]):not([aria-hidden])',
|
|
145
|
+
'textarea:not([disabled]):not([aria-hidden])',
|
|
146
|
+
'button:not([disabled]):not([aria-hidden])',
|
|
147
|
+
'iframe',
|
|
148
|
+
'object',
|
|
149
|
+
'embed',
|
|
150
|
+
'[contenteditable]',
|
|
151
|
+
'[tabindex]:not([tabindex^="-"])'
|
|
152
|
+
];
|
|
153
|
+
this.focus = (element) => {
|
|
154
|
+
return element && element.focus && element.focus();
|
|
155
|
+
};
|
|
156
|
+
this.isTabEvent = (event) => {
|
|
157
|
+
return event?.key === 'Tab' || event?.keyCode === 9;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
onKeydown(event) {
|
|
161
|
+
// Validate it is a tab event.
|
|
162
|
+
if (!this.isTabEvent(event)) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
// Trap the focus inside the element.
|
|
166
|
+
return this.trapFocus(event);
|
|
167
|
+
}
|
|
168
|
+
trapFocus(event) {
|
|
169
|
+
// Validate that the DOM is available.
|
|
170
|
+
if (!this._platform.isBrowser) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// Get all focusable nodes.
|
|
174
|
+
const focusableNodes = this.getFocusableNodes();
|
|
175
|
+
// Focus the first available element if the focus
|
|
176
|
+
// is not in the modal.
|
|
177
|
+
if (!this.element.contains(document.activeElement)) {
|
|
178
|
+
return this.focus(focusableNodes[0]);
|
|
179
|
+
}
|
|
180
|
+
const focusedItemIndex = focusableNodes.indexOf(document.activeElement);
|
|
181
|
+
if (event.shiftKey && focusedItemIndex === 0) {
|
|
182
|
+
this.focus(focusableNodes[focusableNodes.length - 1]);
|
|
183
|
+
return event.preventDefault();
|
|
184
|
+
}
|
|
185
|
+
if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {
|
|
186
|
+
this.focus(focusableNodes[0]);
|
|
187
|
+
return event.preventDefault();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
get element() {
|
|
191
|
+
return this._elementRef.nativeElement;
|
|
192
|
+
}
|
|
193
|
+
getFocusableNodes() {
|
|
194
|
+
const nodes = this.element.querySelectorAll(this._focusableElements);
|
|
195
|
+
return Array(...nodes);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
BbFocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
199
|
+
BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
|
|
200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbFocusTrap, decorators: [{
|
|
201
|
+
type: Directive,
|
|
202
|
+
args: [{
|
|
203
|
+
selector: '[bbFocusTrap]'
|
|
204
|
+
}]
|
|
205
|
+
}], ctorParameters: function () { return [{ type: i1.Platform }, { type: i0.ElementRef }]; }, propDecorators: { onKeydown: [{
|
|
206
|
+
type: HostListener,
|
|
207
|
+
args: ['keydown', ['$event']]
|
|
208
|
+
}] } });
|
|
209
|
+
|
|
210
|
+
class UtilsModule {
|
|
211
|
+
}
|
|
212
|
+
UtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
213
|
+
UtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: UtilsModule, declarations: [BbTemplate,
|
|
214
|
+
BbAutosize,
|
|
215
|
+
BbFocus,
|
|
216
|
+
BbFocusTrap], exports: [BbTemplate,
|
|
217
|
+
BbAutosize,
|
|
218
|
+
BbFocus,
|
|
219
|
+
BbFocusTrap] });
|
|
220
|
+
UtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UtilsModule });
|
|
221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UtilsModule, decorators: [{
|
|
222
|
+
type: NgModule,
|
|
223
|
+
args: [{
|
|
224
|
+
declarations: [
|
|
225
|
+
BbTemplate,
|
|
226
|
+
BbAutosize,
|
|
227
|
+
BbFocus,
|
|
228
|
+
BbFocusTrap
|
|
229
|
+
],
|
|
230
|
+
exports: [
|
|
231
|
+
BbTemplate,
|
|
232
|
+
BbAutosize,
|
|
233
|
+
BbFocus,
|
|
234
|
+
BbFocusTrap
|
|
235
|
+
]
|
|
236
|
+
}]
|
|
237
|
+
}] });
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Generated bundle index. Do not edit.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
export { BbAutosize, BbFocus, BbFocusTrap, BbTemplate, UtilsModule };
|
|
244
|
+
//# sourceMappingURL=bravobit-bb-foundation-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bravobit-bb-foundation-utils.mjs","sources":["../../../projects/bb-foundation/utils/src/lib/directives/template.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/autosize.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus-trap.directive.ts","../../../projects/bb-foundation/utils/src/lib/utils.module.ts","../../../projects/bb-foundation/utils/src/bravobit-bb-foundation-utils.ts"],"sourcesContent":["import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';\n\n@Directive({\n selector: '[bbTemplate]'\n})\nexport class BbTemplate {\n\n @Input() set bbTemplate(content: string | TemplateRef<any>) {\n // Get the template.\n const template = content instanceof TemplateRef\n ? content\n : this._templateRef;\n\n // Clear the view container ref and create the view.\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(template);\n }\n\n constructor(private _templateRef: TemplateRef<any>,\n private _viewContainerRef: ViewContainerRef) {\n }\n\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbTemplate: string | TemplateRef<any>;\n\n}\n","import {AfterViewInit, Directive, ElementRef, HostBinding, HostListener, Input, Renderer2} from '@angular/core';\n\n@Directive({\n selector: 'textarea[bbAutosize]'\n})\nexport class BbAutosize implements AfterViewInit {\n\n // Min/max heights for the textarea.\n @Input() @HostBinding('style.min-height') minHeight: string | null = null;\n @Input() @HostBinding('style.max-height') maxHeight: string | null = null;\n @Input() @HostBinding('rows') rows: number = 1;\n\n constructor(private _renderer: Renderer2,\n private _elementRef: ElementRef) {\n }\n\n get element() {\n return this._elementRef?.nativeElement as HTMLTextAreaElement;\n }\n\n ngAfterViewInit() {\n // Update the styles after the DOM has loaded.\n this.updateStyles();\n }\n\n @HostListener('window:resize')\n onWindowResize() {\n // Update the styles when the window is resized.\n this.updateStyles();\n }\n\n @HostListener('input')\n onInputReceived() {\n // Update the styles after the textarea received input.\n this.updateStyles();\n }\n\n private updateStyles() {\n // Validate the element exists.\n if (!this.element) {\n return;\n }\n\n // Calculate border height which is not included in the scroll height.\n const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;\n\n // Reset textarea height to auto that correctly calculate the new height.\n this.setHeight('auto');\n\n // Set new height.\n this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);\n }\n\n private setHeight(value: string) {\n this._renderer.setStyle(this.element, 'height', value);\n }\n\n}\n","import {AfterViewInit, Directive, ElementRef, NgZone} from '@angular/core';\n\n@Directive({\n selector: '[bbFocus]'\n})\nexport class BbFocus implements AfterViewInit {\n\n constructor(private _zone: NgZone,\n private _elementRef: ElementRef) {\n }\n\n private get nativeElement() {\n return this._elementRef.nativeElement;\n }\n\n ngAfterViewInit() {\n // Run the method outside the Angular zone.\n this._zone.runOutsideAngular(() => this.focus());\n }\n\n private focus() {\n // Check if set timeout exists and the user is\n // using the site on desktop devices.\n if (!setTimeout) {\n return;\n }\n\n // Check if the element and the focus method exist, if so focus the element.\n if (!this.nativeElement || !this.nativeElement.focus) {\n return;\n }\n\n // Execute the focus method in a timeout.\n setTimeout(() => this.nativeElement.focus(), 0);\n }\n\n}\n","import {Directive, ElementRef, HostListener} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocusTrap]'\n})\nexport class BbFocusTrap {\n\n private readonly _focusableElements = [\n 'a[href]',\n 'area[href]',\n 'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n 'select:not([disabled]):not([aria-hidden])',\n 'textarea:not([disabled]):not([aria-hidden])',\n 'button:not([disabled]):not([aria-hidden])',\n 'iframe',\n 'object',\n 'embed',\n '[contenteditable]',\n '[tabindex]:not([tabindex^=\"-\"])'\n ];\n\n constructor(private _platform: Platform,\n private _elementRef: ElementRef) {\n }\n\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent) {\n // Validate it is a tab event.\n if (!this.isTabEvent(event)) {\n return;\n }\n\n // Trap the focus inside the element.\n return this.trapFocus(event);\n }\n\n trapFocus(event: KeyboardEvent) {\n // Validate that the DOM is available.\n if (!this._platform.isBrowser) {\n return;\n }\n\n // Get all focusable nodes.\n const focusableNodes = this.getFocusableNodes();\n\n // Focus the first available element if the focus\n // is not in the modal.\n if (!this.element.contains(document.activeElement)) {\n return this.focus(focusableNodes[0]);\n }\n\n const focusedItemIndex = focusableNodes.indexOf(document.activeElement);\n\n if (event.shiftKey && focusedItemIndex === 0) {\n this.focus(focusableNodes[focusableNodes.length - 1]);\n return event.preventDefault();\n }\n\n if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {\n this.focus(focusableNodes[0]);\n return event.preventDefault();\n }\n }\n\n private get element() {\n return this._elementRef.nativeElement;\n }\n\n private getFocusableNodes() {\n const nodes = this.element.querySelectorAll(this._focusableElements);\n return Array(...nodes);\n }\n\n private focus = (element: HTMLElement) => {\n return element && element.focus && element.focus();\n };\n\n private isTabEvent = (event: KeyboardEvent) => {\n return event?.key === 'Tab' || event?.keyCode === 9;\n };\n\n}\n","import {BbFocusTrap} from './directives/focus-trap.directive';\nimport {BbTemplate} from './directives/template.directive';\nimport {BbAutosize} from './directives/autosize.directive';\nimport {BbFocus} from './directives/focus.directive';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n declarations: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ],\n exports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ]\n})\nexport class UtilsModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAKa,UAAU,CAAA;IAanB,WAAoB,CAAA,YAA8B,EAC9B,iBAAmC,EAAA;QADnC,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAkB;QAC9B,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAkB;KACtD;IAbD,IAAa,UAAU,CAAC,OAAkC,EAAA;;AAEtD,QAAA,MAAM,QAAQ,GAAG,OAAO,YAAY,WAAW;AAC3C,cAAE,OAAO;AACT,cAAE,IAAI,CAAC,YAAY,CAAC;;AAGxB,QAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC/B,QAAA,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;KACvD;;uGAXQ,UAAU,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,WAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAA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AAW,CAAA;;wGAAX,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAX,WAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,iBAZhB,UAAU;QACV,UAAU;QACV,OAAO;AACP,QAAA,WAAW,aAGX,UAAU;QACV,UAAU;QACV,OAAO;QACP,WAAW,CAAA,EAAA,CAAA,CAAA;yGAGN,WAAW,EAAA,CAAA,CAAA;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAdvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,YAAY,EAAE;wBACV,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACJ,iBAAA,CAAA;;;ACnBD;;AAEG;;;;"}
|
|
@@ -82,9 +82,9 @@ class FileLoader {
|
|
|
82
82
|
return this.blobToFile(blobFile, name);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
FileLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
86
|
-
FileLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
87
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
85
|
+
FileLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
86
|
+
FileLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: FileLoader, providedIn: 'root' });
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: FileLoader, decorators: [{
|
|
88
88
|
type: Injectable,
|
|
89
89
|
args: [{
|
|
90
90
|
providedIn: 'root'
|
|
@@ -241,9 +241,9 @@ class Exif {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
Exif.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
245
|
-
Exif.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
246
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
244
|
+
Exif.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Exif, deps: [{ token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
245
|
+
Exif.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Exif, providedIn: 'root' });
|
|
246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Exif, decorators: [{
|
|
247
247
|
type: Injectable,
|
|
248
248
|
args: [{
|
|
249
249
|
providedIn: 'root'
|
|
@@ -359,9 +359,9 @@ class ImageConverter {
|
|
|
359
359
|
return this.stringToImage(contents);
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
ImageConverter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
363
|
-
ImageConverter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
364
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
362
|
+
ImageConverter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
363
|
+
ImageConverter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ImageConverter, providedIn: 'root' });
|
|
364
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ImageConverter, decorators: [{
|
|
365
365
|
type: Injectable,
|
|
366
366
|
args: [{
|
|
367
367
|
providedIn: 'root'
|
|
@@ -427,9 +427,9 @@ class Languages {
|
|
|
427
427
|
.sort((a, b) => b.quality - a.quality);
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
Languages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
431
|
-
Languages.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
430
|
+
Languages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
431
|
+
Languages.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Languages, providedIn: 'root' });
|
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Languages, decorators: [{
|
|
433
433
|
type: Injectable,
|
|
434
434
|
args: [{
|
|
435
435
|
providedIn: 'root'
|
|
@@ -484,9 +484,9 @@ class Network {
|
|
|
484
484
|
this._online$ = merge(now$, online$, offline$).pipe(map(value => value), distinctUntilChanged(), shareReplay(1));
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
Network.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
488
|
-
Network.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
489
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
487
|
+
Network.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Network, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
488
|
+
Network.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Network, providedIn: 'root' });
|
|
489
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Network, decorators: [{
|
|
490
490
|
type: Injectable,
|
|
491
491
|
args: [{
|
|
492
492
|
providedIn: 'root'
|
|
@@ -540,9 +540,9 @@ class Patch {
|
|
|
540
540
|
this._subscription.add(subscription);
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
Patch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
544
|
-
Patch.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
545
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
543
|
+
Patch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Patch, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
544
|
+
Patch.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Patch, providedIn: 'root' });
|
|
545
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Patch, decorators: [{
|
|
546
546
|
type: Injectable,
|
|
547
547
|
args: [{
|
|
548
548
|
providedIn: 'root'
|
|
@@ -573,9 +573,9 @@ class Clipboard {
|
|
|
573
573
|
return new ClipboardCopy(text, this._document);
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
Clipboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
577
|
-
Clipboard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
578
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
576
|
+
Clipboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Clipboard, deps: [{ token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
577
|
+
Clipboard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Clipboard, providedIn: 'root' });
|
|
578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Clipboard, decorators: [{
|
|
579
579
|
type: Injectable,
|
|
580
580
|
args: [{
|
|
581
581
|
providedIn: 'root'
|
|
@@ -5,12 +5,12 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
import * as i1 from "./localize.pipe";
|
|
6
6
|
import * as i2 from "./views/localize-string/localize-string.component";
|
|
7
7
|
import * as i3 from "./views/localize-template.directive";
|
|
8
|
-
import * as i4 from "
|
|
9
|
-
import * as i5 from "@
|
|
8
|
+
import * as i4 from "@angular/common";
|
|
9
|
+
import * as i5 from "@bravobit/bb-foundation/utils";
|
|
10
10
|
export declare class LocalizeModule {
|
|
11
11
|
static forRoot(config: LocalizeConfig): ModuleWithProviders<LocalizeModule>;
|
|
12
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizeModule, never>;
|
|
13
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizeModule, [typeof i1.BbLocalize, typeof i2.BbLocalizeString, typeof i3.BbLocalizeTemplate, typeof i4.
|
|
13
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizeModule, [typeof i1.BbLocalize, typeof i2.BbLocalizeString, typeof i3.BbLocalizeTemplate], [typeof i4.CommonModule, typeof i5.UtilsModule], [typeof i1.BbLocalize, typeof i2.BbLocalizeString, typeof i3.BbLocalizeTemplate]>;
|
|
14
14
|
static ɵinj: i0.ɵɵInjectorDeclaration<LocalizeModule>;
|
|
15
15
|
}
|
|
16
16
|
export declare function initializeLocale(localize: Localize): () => Promise<void>;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { ApplicationRef, ComponentFactoryResolver, Injector, TemplateRef } from '@angular/core';
|
|
2
1
|
import { Notification, NotificationAction, NotificationsConfig } from './notifications.interfaces';
|
|
2
|
+
import { ApplicationRef, EnvironmentInjector, TemplateRef } from '@angular/core';
|
|
3
3
|
import { Localize } from '@bravobit/bb-foundation/localize';
|
|
4
4
|
import { Platform } from '@angular/cdk/platform';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class Notifications {
|
|
7
|
-
private _injector;
|
|
8
7
|
private _platform;
|
|
9
8
|
private _applicationRef;
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
9
|
+
private _environmentInjector;
|
|
10
|
+
private _localize?;
|
|
11
|
+
private _config?;
|
|
13
12
|
private _ref;
|
|
14
13
|
private readonly _defaultMode;
|
|
15
14
|
private readonly _defaultTimeout;
|
|
@@ -18,7 +17,7 @@ export declare class Notifications {
|
|
|
18
17
|
private readonly _defaultDismissText;
|
|
19
18
|
private readonly _defaultPosition;
|
|
20
19
|
private _notifications$;
|
|
21
|
-
constructor(
|
|
20
|
+
constructor(_platform: Platform, _applicationRef: ApplicationRef, _environmentInjector: EnvironmentInjector, _localize?: Localize, _config?: NotificationsConfig);
|
|
22
21
|
success(content: string | TemplateRef<any>, actions?: NotificationAction[], timeout?: number): Notification;
|
|
23
22
|
error(content: string | TemplateRef<any>, actions?: NotificationAction[], timeout?: number): Notification;
|
|
24
23
|
warn(content: string | TemplateRef<any>, actions?: NotificationAction[], timeout?: number): Notification;
|
|
@@ -29,6 +28,6 @@ export declare class Notifications {
|
|
|
29
28
|
private compose;
|
|
30
29
|
private createElement;
|
|
31
30
|
private getProperty;
|
|
32
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<Notifications, [null, null, null, { optional: true; }, { optional: true; }
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Notifications, [null, null, null, { optional: true; }, { optional: true; }]>;
|
|
33
32
|
static ɵprov: i0.ɵɵInjectableDeclaration<Notifications>;
|
|
34
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bravobit/bb-foundation",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.4",
|
|
4
4
|
"description": "The Angular core foundation of the Bravobit team.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Stan van Heumen",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"url": "https://bravobit.nl"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/common": "^14.
|
|
12
|
-
"@angular/core": "^14.
|
|
13
|
-
"@angular/cdk": "^14.
|
|
11
|
+
"@angular/common": "^14.2.0",
|
|
12
|
+
"@angular/core": "^14.2.0",
|
|
13
|
+
"@angular/cdk": "^14.2.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"tslib": "^2.4.0",
|
|
@@ -154,6 +154,14 @@
|
|
|
154
154
|
"es2015": "./fesm2015/bravobit-bb-foundation-theming.mjs",
|
|
155
155
|
"node": "./fesm2015/bravobit-bb-foundation-theming.mjs",
|
|
156
156
|
"default": "./fesm2020/bravobit-bb-foundation-theming.mjs"
|
|
157
|
+
},
|
|
158
|
+
"./utils": {
|
|
159
|
+
"types": "./utils/index.d.ts",
|
|
160
|
+
"esm2020": "./esm2020/utils/bravobit-bb-foundation-utils.mjs",
|
|
161
|
+
"es2020": "./fesm2020/bravobit-bb-foundation-utils.mjs",
|
|
162
|
+
"es2015": "./fesm2015/bravobit-bb-foundation-utils.mjs",
|
|
163
|
+
"node": "./fesm2015/bravobit-bb-foundation-utils.mjs",
|
|
164
|
+
"default": "./fesm2020/bravobit-bb-foundation-utils.mjs"
|
|
157
165
|
}
|
|
158
166
|
},
|
|
159
167
|
"sideEffects": false
|
package/utils/index.d.ts
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,6 +5,7 @@ export declare class BbTemplate {
|
|
|
5
5
|
private _viewContainerRef;
|
|
6
6
|
set bbTemplate(content: string | TemplateRef<any>);
|
|
7
7
|
constructor(_templateRef: TemplateRef<any>, _viewContainerRef: ViewContainerRef);
|
|
8
|
+
static ngAcceptInputType_bbTemplate: string | TemplateRef<any>;
|
|
8
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<BbTemplate, never>;
|
|
9
10
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BbTemplate, "[bbTemplate]", never, { "bbTemplate": "bbTemplate"; }, {}, never, never, false>;
|
|
10
11
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./directives/template.directive";
|
|
3
|
+
import * as i2 from "./directives/autosize.directive";
|
|
4
|
+
import * as i3 from "./directives/focus.directive";
|
|
5
|
+
import * as i4 from "./directives/focus-trap.directive";
|
|
6
|
+
export declare class UtilsModule {
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UtilsModule, never>;
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<UtilsModule, [typeof i1.BbTemplate, typeof i2.BbAutosize, typeof i3.BbFocus, typeof i4.BbFocusTrap], never, [typeof i1.BbTemplate, typeof i2.BbAutosize, typeof i3.BbFocus, typeof i4.BbFocusTrap]>;
|
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<UtilsModule>;
|
|
10
|
+
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Injector, Type } from '@angular/core';
|
|
2
|
-
export declare class BbDialogInjector implements Injector {
|
|
3
|
-
private _parentInjector;
|
|
4
|
-
private _additionalTokens;
|
|
5
|
-
constructor(_parentInjector: Injector, _additionalTokens: WeakMap<any, any>);
|
|
6
|
-
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T): T;
|
|
7
|
-
get(token: any, notFoundValue?: any): any;
|
|
8
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class BbDialogInjector {
|
|
2
|
-
constructor(_parentInjector, _additionalTokens) {
|
|
3
|
-
this._parentInjector = _parentInjector;
|
|
4
|
-
this._additionalTokens = _additionalTokens;
|
|
5
|
-
}
|
|
6
|
-
get(token, notFoundValue) {
|
|
7
|
-
// First check if the additional token
|
|
8
|
-
// contains the token.
|
|
9
|
-
const value = this._additionalTokens.get(token);
|
|
10
|
-
// If that value exists return it.
|
|
11
|
-
if (value) {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
// Else query the parent injector.
|
|
15
|
-
return this._parentInjector.get(token, notFoundValue);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLmluamVjdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvYmItZm91bmRhdGlvbi9kaWFsb2cvc3JjL2xpYi9kaWFsb2cuaW5qZWN0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsTUFBTSxPQUFPLGdCQUFnQjtJQUV6QixZQUFvQixlQUF5QixFQUN6QixpQkFBb0M7UUFEcEMsb0JBQWUsR0FBZixlQUFlLENBQVU7UUFDekIsc0JBQWlCLEdBQ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bi5cbiAgICAgICAgY29uc3QgdmFsdWUgPSB0aGlzLl9hZGRpdGlvbmFsVG9rZW5zLmdldCh0b2tlbik7XG5cbiAgICAgICAgLy8gSWYgdGhhdCB2YWx1ZSBleGlzdHMgcmV0dXJuIGl0LlxuICAgICAgICBpZiAodmFsdWUpIHtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEVsc2UgcXVlcnkgdGhlIHBhcmVudCBpbmplY3Rvci5cbiAgICAgICAgcmV0dXJuIHRoaXMuX3BhcmVudEluamVjdG9yLmdldDxhbnk+KHRva2VuLCBub3RGb3VuZFZhbHVlKTtcbiAgICB9XG5cbn1cbiJdfQ==
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Directive, HostBinding, HostListener, Input } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export class BbAutosize {
|
|
4
|
-
constructor(_renderer, _elementRef) {
|
|
5
|
-
this._renderer = _renderer;
|
|
6
|
-
this._elementRef = _elementRef;
|
|
7
|
-
// Min/max heights for the textarea.
|
|
8
|
-
this.minHeight = null;
|
|
9
|
-
this.maxHeight = null;
|
|
10
|
-
this.rows = 1;
|
|
11
|
-
}
|
|
12
|
-
get element() {
|
|
13
|
-
return this._elementRef?.nativeElement;
|
|
14
|
-
}
|
|
15
|
-
ngAfterViewInit() {
|
|
16
|
-
// Update the styles after the DOM has loaded.
|
|
17
|
-
this.updateStyles();
|
|
18
|
-
}
|
|
19
|
-
onWindowResize() {
|
|
20
|
-
// Update the styles when the window is resized.
|
|
21
|
-
this.updateStyles();
|
|
22
|
-
}
|
|
23
|
-
onInputReceived() {
|
|
24
|
-
// Update the styles after the textarea received input.
|
|
25
|
-
this.updateStyles();
|
|
26
|
-
}
|
|
27
|
-
updateStyles() {
|
|
28
|
-
// Validate the element exists.
|
|
29
|
-
if (!this.element) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
// Calculate border height which is not included in the scroll height.
|
|
33
|
-
const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;
|
|
34
|
-
// Reset textarea height to auto that correctly calculate the new height.
|
|
35
|
-
this.setHeight('auto');
|
|
36
|
-
// Set new height.
|
|
37
|
-
this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);
|
|
38
|
-
}
|
|
39
|
-
setHeight(value) {
|
|
40
|
-
this._renderer.setStyle(this.element, 'height', value);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
44
|
-
BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: BbAutosize, selector: "textarea[bbAutosize]", inputs: { minHeight: "minHeight", maxHeight: "maxHeight", rows: "rows" }, host: { listeners: { "window:resize": "onWindowResize()", "input": "onInputReceived()" }, properties: { "style.min-height": "this.minHeight", "style.max-height": "this.maxHeight", "rows": "this.rows" } }, ngImport: i0 });
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: BbAutosize, decorators: [{
|
|
46
|
-
type: Directive,
|
|
47
|
-
args: [{
|
|
48
|
-
selector: 'textarea[bbAutosize]'
|
|
49
|
-
}]
|
|
50
|
-
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
|
|
51
|
-
type: Input
|
|
52
|
-
}, {
|
|
53
|
-
type: HostBinding,
|
|
54
|
-
args: ['style.min-height']
|
|
55
|
-
}], maxHeight: [{
|
|
56
|
-
type: Input
|
|
57
|
-
}, {
|
|
58
|
-
type: HostBinding,
|
|
59
|
-
args: ['style.max-height']
|
|
60
|
-
}], rows: [{
|
|
61
|
-
type: Input
|
|
62
|
-
}, {
|
|
63
|
-
type: HostBinding,
|
|
64
|
-
args: ['rows']
|
|
65
|
-
}], onWindowResize: [{
|
|
66
|
-
type: HostListener,
|
|
67
|
-
args: ['window:resize']
|
|
68
|
-
}], onInputReceived: [{
|
|
69
|
-
type: HostListener,
|
|
70
|
-
args: ['input']
|
|
71
|
-
}] } });
|
|
72
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b3NpemUuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvYmItZm91bmRhdGlvbi9lbGVtZW50cy9zcmMvbGliL2RpcmVjdGl2ZXMvYXV0b3NpemUuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBZ0IsU0FBUyxFQUFjLFdBQVcsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFZLE1BQU0sZUFBZSxDQUFDOztBQUtoSCxNQUFNLE9BQU8sVUFBVTtJQU9uQixZQUFvQixTQUFvQixFQUNwQixXQUF1QjtRQUR2QixjQUFTLEdBQVQsU0FBUyxDQUFXO1FBQ3BCLGdCQUFXLEdBQVgsV0FBVyxDQUFZO1FBTjNDLG9DQUFvQztRQUNNLGNBQVMsR0FBa0IsSUFBSSxDQUFDO1FBQ2hDLGNBQVMsR0FBa0IsSUFBSSxDQUFDO1FBQzVDLFNBQUksR0FBVyxDQUFDLENBQUM7SUFJL0MsQ0FBQztJQUVELElBQUksT0FBTztRQUNQLE9BQU8sSUFBSSxDQUFDLFdBQVcsRUFBRSxhQUFvQyxDQUFDO0lBQ2xFLENBQUM7SUFFRCxlQUFlO1FBQ1gsOENBQThDO1FBQzlDLElBQUksQ0FBQyxZQUFZLEVBQUUsQ0FBQztJQUN4QixDQUFDO0lBR0QsY0FBYztRQUNWLGdEQUFnRDtRQUNoRCxJQUF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