@abp/ng.theme.shared 7.0.2 → 7.1.0-rc.2

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.
@@ -8,7 +8,7 @@ import { ResolveEnd } from '@angular/router';
8
8
  import * as i2 from '@abp/ng.core';
9
9
  import { getRoutePath, SubscriptionService, PROJECTION_STRATEGY, uuid, AbstractNgModelComponent, LocalizationService, getLocaleDirection, HttpErrorReporterService, RouterEvents, AuthService, RoutesService, InternalStore, DomInsertionService, CONTENT_STRATEGY, CoreModule, noop, ConfigStateService } from '@abp/ng.core';
10
10
  import { startWith, map, debounceTime, filter, takeUntil, distinctUntilChanged, take, catchError, switchMap } from 'rxjs/operators';
11
- import { fromEvent, Subscription, combineLatest, timer, ReplaySubject, Subject, BehaviorSubject, throwError, Observable, of } from 'rxjs';
11
+ import { fromEvent, Subscription, combineLatest, timer, ReplaySubject, Subject, of, from, Observable, EMPTY, BehaviorSubject, throwError } from 'rxjs';
12
12
  import * as i3 from '@ng-bootstrap/ng-bootstrap';
13
13
  import { NgbInputDatepickerConfig, NgbTypeaheadConfig, NgbDateParserFormatter, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
14
14
  import * as i2$1 from '@angular/forms';
@@ -873,9 +873,12 @@ class ToastContainerComponent {
873
873
  constructor() {
874
874
  this.toasts = [];
875
875
  this.right = '30px';
876
+ this.defaultRight = '30px';
877
+ this.defaultMobileRight = '0';
876
878
  this.bottom = '30px';
877
879
  }
878
880
  ngOnInit() {
881
+ this.setDefaultRight();
879
882
  this.toasts$.subscribe(toasts => {
880
883
  this.toasts = this.toastKey
881
884
  ? toasts.filter(t => {
@@ -884,6 +887,15 @@ class ToastContainerComponent {
884
887
  : toasts;
885
888
  });
886
889
  }
890
+ onWindowResize() {
891
+ this.setDefaultRight();
892
+ }
893
+ setDefaultRight() {
894
+ const screenWidth = window.innerWidth;
895
+ if (screenWidth < 768 && this.right == this.defaultRight) {
896
+ this.right = this.defaultMobileRight;
897
+ }
898
+ }
887
899
  trackByFunc(index, toast) {
888
900
  if (!toast)
889
901
  return null;
@@ -891,10 +903,10 @@ class ToastContainerComponent {
891
903
  }
892
904
  }
893
905
  ToastContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ToastContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
894
- ToastContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: ToastContainerComponent, selector: "abp-toast-container", inputs: { top: "top", right: "right", bottom: "bottom", left: "left", toastKey: "toastKey" }, ngImport: i0, template: "<div\r\n class=\"abp-toast-container\"\r\n [style.top]=\"top || 'auto'\"\r\n [style.right]=\"right || 'auto'\"\r\n [style.bottom]=\"bottom || 'auto'\"\r\n [style.left]=\"left || 'auto'\"\r\n [style.display]=\"toasts.length ? 'flex' : 'none'\"\r\n [@toastInOut]=\"toasts.length\"\r\n>\r\n <abp-toast\r\n [toast]=\"toast\"\r\n *ngFor=\"let toast of toasts; trackBy: trackByFunc\"\r\n (remove)=\"remove($event)\"\r\n ></abp-toast>\r\n</div>\r\n", styles: [".abp-toast-container{position:fixed;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;min-width:350px;min-height:80px;z-index:1900}.abp-toast-container.new-on-top{flex-direction:column-reverse}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ToastComponent, selector: "abp-toast", inputs: ["toast"], outputs: ["remove"] }], animations: [toastInOut] });
906
+ ToastContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: ToastContainerComponent, selector: "abp-toast-container", inputs: { top: "top", right: "right", bottom: "bottom", left: "left", toastKey: "toastKey" }, host: { listeners: { "window:resize": "onWindowResize($event)" } }, ngImport: i0, template: "<div\r\n class=\"abp-toast-container\"\r\n [style.top]=\"top || 'auto'\"\r\n [style.right]=\"right || 'auto'\"\r\n [style.bottom]=\"bottom || 'auto'\"\r\n [style.left]=\"left || 'auto'\"\r\n [style.display]=\"toasts.length ? 'flex' : 'none'\"\r\n [@toastInOut]=\"toasts.length\"\r\n>\r\n <abp-toast\r\n [toast]=\"toast\"\r\n *ngFor=\"let toast of toasts; trackBy: trackByFunc\"\r\n (remove)=\"remove($event)\"\r\n ></abp-toast>\r\n</div>\r\n", styles: [".abp-toast-container{position:fixed;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;min-width:350px;min-height:80px;z-index:1900}.abp-toast-container.new-on-top{flex-direction:column-reverse}@media only screen and (max-width: 768px){.abp-toast-container{min-width:100%}}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ToastComponent, selector: "abp-toast", inputs: ["toast"], outputs: ["remove"] }], animations: [toastInOut] });
895
907
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ToastContainerComponent, decorators: [{
896
908
  type: Component,
897
- args: [{ selector: 'abp-toast-container', animations: [toastInOut], template: "<div\r\n class=\"abp-toast-container\"\r\n [style.top]=\"top || 'auto'\"\r\n [style.right]=\"right || 'auto'\"\r\n [style.bottom]=\"bottom || 'auto'\"\r\n [style.left]=\"left || 'auto'\"\r\n [style.display]=\"toasts.length ? 'flex' : 'none'\"\r\n [@toastInOut]=\"toasts.length\"\r\n>\r\n <abp-toast\r\n [toast]=\"toast\"\r\n *ngFor=\"let toast of toasts; trackBy: trackByFunc\"\r\n (remove)=\"remove($event)\"\r\n ></abp-toast>\r\n</div>\r\n", styles: [".abp-toast-container{position:fixed;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;min-width:350px;min-height:80px;z-index:1900}.abp-toast-container.new-on-top{flex-direction:column-reverse}\n"] }]
909
+ args: [{ selector: 'abp-toast-container', animations: [toastInOut], template: "<div\r\n class=\"abp-toast-container\"\r\n [style.top]=\"top || 'auto'\"\r\n [style.right]=\"right || 'auto'\"\r\n [style.bottom]=\"bottom || 'auto'\"\r\n [style.left]=\"left || 'auto'\"\r\n [style.display]=\"toasts.length ? 'flex' : 'none'\"\r\n [@toastInOut]=\"toasts.length\"\r\n>\r\n <abp-toast\r\n [toast]=\"toast\"\r\n *ngFor=\"let toast of toasts; trackBy: trackByFunc\"\r\n (remove)=\"remove($event)\"\r\n ></abp-toast>\r\n</div>\r\n", styles: [".abp-toast-container{position:fixed;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;min-width:350px;min-height:80px;z-index:1900}.abp-toast-container.new-on-top{flex-direction:column-reverse}@media only screen and (max-width: 768px){.abp-toast-container{min-width:100%}}\n"] }]
898
910
  }], propDecorators: { top: [{
899
911
  type: Input
900
912
  }], right: [{
@@ -905,6 +917,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
905
917
  type: Input
906
918
  }], toastKey: [{
907
919
  type: Input
920
+ }], onWindowResize: [{
921
+ type: HostListener,
922
+ args: ['window:resize', ['$event']]
908
923
  }] } });
909
924
 
910
925
  class PasswordComponent extends AbstractNgModelComponent {
@@ -1264,6 +1279,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
1264
1279
  type: Input
1265
1280
  }] } });
1266
1281
 
1282
+ class AbpVisibleDirective {
1283
+ constructor(viewContainerRef, templateRef) {
1284
+ this.viewContainerRef = viewContainerRef;
1285
+ this.templateRef = templateRef;
1286
+ this.condition$ = of(false);
1287
+ }
1288
+ set abpVisible(value) {
1289
+ this.condition$ = checkType(value);
1290
+ this.subscribeToCondition();
1291
+ }
1292
+ ngOnInit() {
1293
+ this.updateVisibility();
1294
+ }
1295
+ ngOnDestroy() {
1296
+ this.conditionSubscription?.unsubscribe();
1297
+ }
1298
+ subscribeToCondition() {
1299
+ this.conditionSubscription = this.condition$.subscribe(value => {
1300
+ this.isVisible = value;
1301
+ this.updateVisibility();
1302
+ });
1303
+ }
1304
+ updateVisibility() {
1305
+ this.viewContainerRef.clear();
1306
+ // it should be false not falsy
1307
+ if (this.isVisible === false) {
1308
+ return;
1309
+ }
1310
+ this.viewContainerRef.createEmbeddedView(this.templateRef);
1311
+ }
1312
+ }
1313
+ AbpVisibleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AbpVisibleDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1314
+ AbpVisibleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: AbpVisibleDirective, selector: "[abpVisible]", inputs: { abpVisible: "abpVisible" }, ngImport: i0 });
1315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AbpVisibleDirective, decorators: [{
1316
+ type: Directive,
1317
+ args: [{
1318
+ selector: '[abpVisible]',
1319
+ }]
1320
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }]; }, propDecorators: { abpVisible: [{
1321
+ type: Input,
1322
+ args: ['abpVisible']
1323
+ }] } });
1324
+ function checkType(value) {
1325
+ if (value instanceof Promise) {
1326
+ return from(value);
1327
+ }
1328
+ else if (value instanceof Observable) {
1329
+ return value;
1330
+ }
1331
+ else if (typeof value === 'boolean') {
1332
+ return of(value);
1333
+ }
1334
+ else if (value === undefined || value === null) {
1335
+ return of(true);
1336
+ }
1337
+ else {
1338
+ return EMPTY;
1339
+ }
1340
+ }
1341
+
1267
1342
  class DocumentDirHandlerService {
1268
1343
  constructor(injector) {
1269
1344
  this.injector = injector;
@@ -1582,7 +1657,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
1582
1657
 
1583
1658
  class NavItem {
1584
1659
  constructor(props) {
1585
- props = { ...props, visible: props.visible || (() => true) };
1586
1660
  Object.assign(this, props);
1587
1661
  }
1588
1662
  }
@@ -2080,6 +2154,7 @@ const declarationsWithExports = [
2080
2154
  NgxDatatableListDirective,
2081
2155
  LoadingDirective,
2082
2156
  ModalCloseDirective,
2157
+ AbpVisibleDirective,
2083
2158
  ];
2084
2159
  class BaseThemeSharedModule {
2085
2160
  }
@@ -2097,7 +2172,8 @@ BaseThemeSharedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
2097
2172
  NgxDatatableDefaultDirective,
2098
2173
  NgxDatatableListDirective,
2099
2174
  LoadingDirective,
2100
- ModalCloseDirective, HttpErrorWrapperComponent], imports: [CoreModule,
2175
+ ModalCloseDirective,
2176
+ AbpVisibleDirective, HttpErrorWrapperComponent], imports: [CoreModule,
2101
2177
  NgxDatatableModule,
2102
2178
  NgxValidateCoreModule,
2103
2179
  NgbPaginationModule,
@@ -2114,7 +2190,8 @@ BaseThemeSharedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
2114
2190
  NgxDatatableDefaultDirective,
2115
2191
  NgxDatatableListDirective,
2116
2192
  LoadingDirective,
2117
- ModalCloseDirective] });
2193
+ ModalCloseDirective,
2194
+ AbpVisibleDirective] });
2118
2195
  BaseThemeSharedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BaseThemeSharedModule, providers: [DatePipe], imports: [CoreModule,
2119
2196
  NgxDatatableModule,
2120
2197
  NgxValidateCoreModule,
@@ -2272,5 +2349,5 @@ function validatePassword(shouldContain) {
2272
2349
  * Generated bundle index. Do not edit.
2273
2350
  */
2274
2351
 
2275
- export { BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, Confirmation, ConfirmationComponent, ConfirmationService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, EllipsisDirective, EllipsisModule, ErrorHandler, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, SUPPRESS_UNSAVED_CHANGES_WARNING, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut, validatePassword };
2352
+ export { AbpVisibleDirective, BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, Confirmation, ConfirmationComponent, ConfirmationService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, EllipsisDirective, EllipsisModule, ErrorHandler, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, SUPPRESS_UNSAVED_CHANGES_WARNING, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut, validatePassword };
2276
2353
  //# sourceMappingURL=abp-ng.theme.shared.mjs.map