adb-shared 2.0.20 → 2.0.23
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/esm2020/lib/components/adb-confirm-modal/adb-confirm-modal.mjs +22 -0
- package/esm2020/lib/components/adb-confirm-modal/adb-modal.module.mjs +23 -0
- package/esm2020/lib/components/adb-confirm-modal/adb-modal.service.mjs +41 -0
- package/esm2020/lib/components/adb-dropdown/adb-dropdown.directive.mjs +20 -6
- package/esm2020/public-api.mjs +4 -1
- package/fesm2015/adb-shared.mjs +90 -6
- package/fesm2015/adb-shared.mjs.map +1 -1
- package/fesm2020/adb-shared.mjs +89 -6
- package/fesm2020/adb-shared.mjs.map +1 -1
- package/lib/components/adb-confirm-modal/adb-confirm-modal.d.ts +17 -0
- package/lib/components/adb-confirm-modal/adb-modal.module.d.ts +10 -0
- package/lib/components/adb-confirm-modal/adb-modal.service.d.ts +18 -0
- package/lib/components/adb-dropdown/adb-dropdown.directive.d.ts +5 -2
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
package/fesm2020/adb-shared.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as i0 from '@angular/core';
|
|
|
4
4
|
import { Injectable, Inject, EventEmitter, Component, Output, Input, Directive, HostListener, NgModule, HostBinding, Pipe, forwardRef } from '@angular/core';
|
|
5
5
|
import * as i1$1 from '@ngx-translate/core';
|
|
6
6
|
import { TranslateModule } from '@ngx-translate/core';
|
|
7
|
-
import { Subscription } from 'rxjs';
|
|
7
|
+
import { Subscription, Subject } from 'rxjs';
|
|
8
8
|
import * as i1 from '@angular/common/http';
|
|
9
9
|
import { HttpClientModule } from '@angular/common/http';
|
|
10
10
|
import * as i1$2 from '@angular/router';
|
|
@@ -803,6 +803,8 @@ class AdbDropdownDirective {
|
|
|
803
803
|
constructor(elementRef, adbDropdownService) {
|
|
804
804
|
this.elementRef = elementRef;
|
|
805
805
|
this.adbDropdownService = adbDropdownService;
|
|
806
|
+
this.adbDropdown = new EventEmitter();
|
|
807
|
+
this.insideClick = false;
|
|
806
808
|
this.dataToggle = "dropdown";
|
|
807
809
|
this.haspPopup = true;
|
|
808
810
|
this.expanded = false;
|
|
@@ -824,13 +826,15 @@ class AdbDropdownDirective {
|
|
|
824
826
|
menu.classList.remove('show');
|
|
825
827
|
}
|
|
826
828
|
else {
|
|
829
|
+
this.adbDropdown.emit();
|
|
827
830
|
menu.classList.add('show');
|
|
828
831
|
}
|
|
829
832
|
}
|
|
830
833
|
}
|
|
831
834
|
onCheckOutSideClick(target) {
|
|
832
835
|
if (this.adbDropdownService.currentMenuId === this.id) {
|
|
833
|
-
const
|
|
836
|
+
const parent = this.insideClick ? this.elementRef.nativeElement.parentNode : this.elementRef.nativeElement;
|
|
837
|
+
const clickedInside = parent.contains(target);
|
|
834
838
|
if (!clickedInside) {
|
|
835
839
|
const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
|
|
836
840
|
parent?.classList.remove('show');
|
|
@@ -841,18 +845,28 @@ class AdbDropdownDirective {
|
|
|
841
845
|
parent?.classList.remove('show');
|
|
842
846
|
}
|
|
843
847
|
}
|
|
848
|
+
close() {
|
|
849
|
+
const node = this.elementRef.nativeElement.parentNode;
|
|
850
|
+
const menu = node.querySelector('.dropdown-menu');
|
|
851
|
+
menu.classList.remove('show');
|
|
852
|
+
}
|
|
844
853
|
getId() {
|
|
845
854
|
return '' + Math.floor(Math.random() * Date.now());
|
|
846
855
|
}
|
|
847
856
|
}
|
|
848
857
|
/** @nocollapse */ AdbDropdownDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDropdownDirective, deps: [{ token: i0.ElementRef }, { token: AdbDropdownService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
849
|
-
/** @nocollapse */ AdbDropdownDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: AdbDropdownDirective, selector: "[adbDropdown]", host: { listeners: { "click": "onClick()", "document:click": "onCheckOutSideClick($event.target)" }, properties: { "id": "this.id", "attr.data-toggle": "this.dataToggle", "attr.aria-haspopup": "this.haspPopup", "attr.aria-expanded": "this.expanded" } }, ngImport: i0 });
|
|
858
|
+
/** @nocollapse */ AdbDropdownDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: AdbDropdownDirective, selector: "[adbDropdown]", inputs: { insideClick: "insideClick" }, outputs: { adbDropdown: "adbDropdown" }, host: { listeners: { "click": "onClick()", "document:click": "onCheckOutSideClick($event.target)" }, properties: { "id": "this.id", "attr.data-toggle": "this.dataToggle", "attr.aria-haspopup": "this.haspPopup", "attr.aria-expanded": "this.expanded" } }, exportAs: ["adbDropdown"], ngImport: i0 });
|
|
850
859
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDropdownDirective, decorators: [{
|
|
851
860
|
type: Directive,
|
|
852
861
|
args: [{
|
|
853
|
-
selector: '[adbDropdown]'
|
|
862
|
+
selector: '[adbDropdown]',
|
|
863
|
+
exportAs: 'adbDropdown'
|
|
854
864
|
}]
|
|
855
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: AdbDropdownService }]; }, propDecorators: {
|
|
865
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: AdbDropdownService }]; }, propDecorators: { adbDropdown: [{
|
|
866
|
+
type: Output
|
|
867
|
+
}], insideClick: [{
|
|
868
|
+
type: Input
|
|
869
|
+
}], id: [{
|
|
856
870
|
type: HostBinding,
|
|
857
871
|
args: ['id']
|
|
858
872
|
}], dataToggle: [{
|
|
@@ -887,6 +901,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
887
901
|
}]
|
|
888
902
|
}] });
|
|
889
903
|
|
|
904
|
+
class AdbModalService {
|
|
905
|
+
constructor(componentFactoryResolver, rendererFactory, appRef, injector) {
|
|
906
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
907
|
+
this.appRef = appRef;
|
|
908
|
+
this.injector = injector;
|
|
909
|
+
this.closeSubject = new Subject();
|
|
910
|
+
this.close$ = this.closeSubject.asObservable();
|
|
911
|
+
this.renderer = rendererFactory.createRenderer(null, null);
|
|
912
|
+
}
|
|
913
|
+
hide(confirm) {
|
|
914
|
+
this.closeSubject.next(confirm);
|
|
915
|
+
document.body.removeChild(this.domElem);
|
|
916
|
+
document.body.removeChild(this.backdrop);
|
|
917
|
+
this.renderer.removeClass(document.body, 'modal-open');
|
|
918
|
+
}
|
|
919
|
+
showConfirm(model) {
|
|
920
|
+
this.renderer.addClass(document.body, 'modal-open');
|
|
921
|
+
this.backdrop = this.renderer.createElement('div');
|
|
922
|
+
this.backdrop.classList.add('modal-backdrop', 'fade', 'show');
|
|
923
|
+
this.renderer.appendChild(document.body, this.backdrop);
|
|
924
|
+
let componentRef = this.componentFactoryResolver.resolveComponentFactory(AdbConfirmModal).create(this.injector);
|
|
925
|
+
model.header = model.header ?? 'NOT_SET';
|
|
926
|
+
model.text = model.text ?? 'NOT_SET';
|
|
927
|
+
model.confirm = model.confirm ?? 'OK';
|
|
928
|
+
model.decline = model.decline ?? 'CANCEL';
|
|
929
|
+
componentRef.instance.model = model;
|
|
930
|
+
this.appRef.attachView(componentRef.hostView);
|
|
931
|
+
this.domElem = componentRef.hostView.rootNodes[0];
|
|
932
|
+
document.body.appendChild(this.domElem);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
/** @nocollapse */ AdbModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbModalService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.RendererFactory2 }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
936
|
+
/** @nocollapse */ AdbModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbModalService });
|
|
937
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbModalService, decorators: [{
|
|
938
|
+
type: Injectable
|
|
939
|
+
}], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }, { type: i0.Injector }]; } });
|
|
940
|
+
|
|
941
|
+
class AdbConfirmModal {
|
|
942
|
+
constructor(modalRef) {
|
|
943
|
+
this.modalRef = modalRef;
|
|
944
|
+
}
|
|
945
|
+
onClose(confirm) {
|
|
946
|
+
this.modalRef.hide(confirm);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
/** @nocollapse */ AdbConfirmModal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbConfirmModal, deps: [{ token: AdbModalService }], target: i0.ɵɵFactoryTarget.Component });
|
|
950
|
+
/** @nocollapse */ AdbConfirmModal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: AdbConfirmModal, selector: "ng-component", inputs: { model: "model" }, ngImport: i0, template: "<div class=\"modal fade show\" *ngIf=\"model\">\r\n <div class=\"modal-dialog modal-dialog-centered\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"h-subsection mb-0 modal-title\" translate>{{model.header}}</h1>\r\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"onClose(false)\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n {{model.text|translate}}\r\n <div *ngIf=\"model.value\">\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"text-right\">\r\n <button type=\"button\" class=\"btn btn-primary me-2\"\r\n (click)=\"onClose(true)\">{{model.confirm|translate}}</button>\r\n <button type=\"button\" class=\"btn btn-secondary\"\r\n (click)=\"onClose(false)\">{{model.decline|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }], pipes: { "translate": i1$1.TranslatePipe } });
|
|
951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbConfirmModal, decorators: [{
|
|
952
|
+
type: Component,
|
|
953
|
+
args: [{ template: "<div class=\"modal fade show\" *ngIf=\"model\">\r\n <div class=\"modal-dialog modal-dialog-centered\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"h-subsection mb-0 modal-title\" translate>{{model.header}}</h1>\r\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"onClose(false)\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n {{model.text|translate}}\r\n <div *ngIf=\"model.value\">\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"text-right\">\r\n <button type=\"button\" class=\"btn btn-primary me-2\"\r\n (click)=\"onClose(true)\">{{model.confirm|translate}}</button>\r\n <button type=\"button\" class=\"btn btn-secondary\"\r\n (click)=\"onClose(false)\">{{model.decline|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>" }]
|
|
954
|
+
}], ctorParameters: function () { return [{ type: AdbModalService }]; }, propDecorators: { model: [{
|
|
955
|
+
type: Input
|
|
956
|
+
}] } });
|
|
957
|
+
|
|
958
|
+
class AdbModalModule {
|
|
959
|
+
}
|
|
960
|
+
/** @nocollapse */ AdbModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
961
|
+
/** @nocollapse */ AdbModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbModalModule, declarations: [AdbConfirmModal], imports: [CommonModule, i1$1.TranslateModule, AdbDirectivesModule], exports: [AdbConfirmModal] });
|
|
962
|
+
/** @nocollapse */ AdbModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbModalModule, providers: [AdbModalService], imports: [[CommonModule, TranslateModule.forChild(), AdbDirectivesModule]] });
|
|
963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbModalModule, decorators: [{
|
|
964
|
+
type: NgModule,
|
|
965
|
+
args: [{
|
|
966
|
+
imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
|
|
967
|
+
declarations: [AdbConfirmModal],
|
|
968
|
+
exports: [AdbConfirmModal],
|
|
969
|
+
providers: [AdbModalService]
|
|
970
|
+
}]
|
|
971
|
+
}] });
|
|
972
|
+
|
|
890
973
|
/*
|
|
891
974
|
* Public API Surface of artdata-shared
|
|
892
975
|
*/
|
|
@@ -895,5 +978,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
895
978
|
* Generated bundle index. Do not edit.
|
|
896
979
|
*/
|
|
897
980
|
|
|
898
|
-
export { ADBHeaderComponent, ADBHeaderModule, AdbDatePickerComponent, AdbDatePickerDirective, AdbDatePickerModule, AdbDirectivesModule, AdbDropdownDirective, AdbDropdownModule, AdbPagersModule, AdbPipesModule, ClickOutsideDirective, FileUploadDirective, FocusDirective, HighlightPipe, InfiniteScrollComponent, LocaleDatePipe, NumberSpacingPipe, PagerComponent };
|
|
981
|
+
export { ADBHeaderComponent, ADBHeaderModule, AdbConfirmModal, AdbDatePickerComponent, AdbDatePickerDirective, AdbDatePickerModule, AdbDirectivesModule, AdbDropdownDirective, AdbDropdownModule, AdbModalModule, AdbModalService, AdbPagersModule, AdbPipesModule, ClickOutsideDirective, FileUploadDirective, FocusDirective, HighlightPipe, InfiniteScrollComponent, LocaleDatePipe, NumberSpacingPipe, PagerComponent };
|
|
899
982
|
//# sourceMappingURL=adb-shared.mjs.map
|