@thecodeblogs/blog 0.15.4 → 0.15.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.
@@ -62,6 +62,8 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
62
62
  import { trigger, state, style, transition, animate } from '@angular/animations';
63
63
  import * as i8$1 from '@angular/material/list';
64
64
  import { MatListModule } from '@angular/material/list';
65
+ import * as i9$1 from '@angular/material/progress-spinner';
66
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
65
67
  import * as i3$1 from '@angular/material/sidenav';
66
68
  import { MatSidenavModule } from '@angular/material/sidenav';
67
69
  import Autolinker from 'autolinker';
@@ -1384,6 +1386,9 @@ class SideNavigationComponent {
1384
1386
  this.identityService = identityService;
1385
1387
  this.renderer = renderer;
1386
1388
  this.state = 'out';
1389
+ this.response = null;
1390
+ this.debounceTimeout = 200;
1391
+ this.loading = true;
1387
1392
  this.entries = [];
1388
1393
  this.entriesByMonthAndYear = [];
1389
1394
  this.searchTerm = "";
@@ -1391,7 +1396,7 @@ class SideNavigationComponent {
1391
1396
  this.searchControl = new FormControl('');
1392
1397
  }
1393
1398
  ngOnInit() {
1394
- this.doSearch.pipe(debounceTime(500)).subscribe((result) => {
1399
+ this.doSearch.pipe(debounceTime(this.debounceTimeout)).subscribe((result) => {
1395
1400
  this.searchEntries(result);
1396
1401
  });
1397
1402
  this.identityService.getMe().subscribe((identity) => {
@@ -1401,23 +1406,27 @@ class SideNavigationComponent {
1401
1406
  });
1402
1407
  this.getEntries();
1403
1408
  }
1404
- getEntriesWithUrl(url) {
1409
+ getMore() {
1410
+ this.getEntriesWithUrl(this.response.next, false);
1411
+ }
1412
+ getEntriesWithUrl(url, wipe = true) {
1413
+ this.loading = true;
1405
1414
  this.entryService.getListByUrl(url).subscribe((response) => {
1415
+ this.response = response;
1406
1416
  this.entries = this.entries.concat(map$1(response.results, (result) => {
1407
1417
  return { id: result.id, entry: new Entry(result) };
1408
1418
  }));
1409
- if (response.next) {
1410
- this.getEntriesWithUrl(response.next);
1411
- }
1412
- else {
1413
- this.organizeEntries();
1414
- }
1419
+ this.organizeEntries(wipe);
1415
1420
  });
1416
1421
  }
1417
- organizeEntries() {
1418
- this.state = 'out';
1422
+ organizeEntries(wipe = true) {
1423
+ if (wipe) {
1424
+ this.state = 'out';
1425
+ }
1419
1426
  let organizeEntriesFn = () => {
1420
- this.entriesByMonthAndYear = [];
1427
+ if (wipe) {
1428
+ this.entriesByMonthAndYear = [];
1429
+ }
1421
1430
  let newEntries = JSON.parse(JSON.stringify(this.entriesByMonthAndYear));
1422
1431
  for (const entryWrapper of this.entries) {
1423
1432
  const entry = entryWrapper.entry;
@@ -1445,37 +1454,37 @@ class SideNavigationComponent {
1445
1454
  newEntries.reverse();
1446
1455
  let setEntriesFn = () => {
1447
1456
  this.entriesByMonthAndYear = newEntries;
1448
- this.state = 'in';
1457
+ this.loading = false;
1458
+ if (wipe) {
1459
+ this.state = 'in';
1460
+ }
1449
1461
  };
1450
1462
  setTimeout(setEntriesFn.bind(this), 400);
1451
1463
  };
1452
1464
  setTimeout(organizeEntriesFn.bind(this), 400);
1453
1465
  }
1454
1466
  getEntries() {
1467
+ this.loading = true;
1455
1468
  this.entryService.get().subscribe((response) => {
1469
+ this.response = response;
1456
1470
  this.entries = map$1(response.results, (result) => {
1457
1471
  return { id: result.id, entry: new Entry(result) };
1458
1472
  });
1459
- if (response.next) {
1460
- this.getEntriesWithUrl(response.next);
1461
- }
1462
- else {
1463
- this.organizeEntries();
1464
- }
1473
+ this.organizeEntries();
1465
1474
  });
1466
1475
  }
1467
1476
  searchEntries(searchTerm) {
1477
+ let turnOnLoading = () => {
1478
+ this.loading = true;
1479
+ };
1480
+ setTimeout(turnOnLoading.bind(this), this.debounceTimeout + 100);
1468
1481
  if (searchTerm !== "") {
1469
1482
  this.entryService.search(searchTerm).subscribe((response) => {
1483
+ this.response = response;
1470
1484
  this.entries = map$1(response.results, (result) => {
1471
1485
  return { id: result.id, entry: new Entry(result) };
1472
1486
  });
1473
- if (response.next) {
1474
- this.getEntriesWithUrl(response.next);
1475
- }
1476
- else {
1477
- this.organizeEntries();
1478
- }
1487
+ this.organizeEntries();
1479
1488
  });
1480
1489
  }
1481
1490
  else {
@@ -1552,7 +1561,7 @@ class SideNavigationComponent {
1552
1561
  }
1553
1562
  }
1554
1563
  SideNavigationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SideNavigationComponent, deps: [{ token: EntryService }, { token: i1$4.Router }, { token: IdentityService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1555
- SideNavigationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: SideNavigationComponent, selector: "app-side-navigation", viewQueries: [{ propertyName: "divNav", first: true, predicate: ["navcontainer"], descendants: true }], ngImport: i0, template: "<div class=\"sidenav no-scrollbar\">\n <div style=\"margin-top: 20px;\">\n <mat-form-field style=\"width: 100%\">\n <mat-label>Search</mat-label>\n <input matInput [formControl]=\"searchControl\" (ngModelChange)=\"onSearchChange($event)\">\n </mat-form-field>\n </div>\n\n <div #navcontainer class=\"navcontainer\"\n [@sideNavAnimation]=\"state\"\n >\n <mat-nav-list\n *ngFor=\"let container of entriesByMonthAndYear\"\n >\n <h3>{{getMonthAndYearFromKey(container.month_year)}}</h3>\n <a mat-list-item *ngFor=\"let entry of container.entries\" href=\"javascript:void(0)\" (click)=\"routeTo(entry)\">{{entry.title}}</a>\n </mat-nav-list>\n\n </div>\n\n <ng-container *ngIf=\"identity?.id === 1\">\n <h2>Misc</h2>\n\n <mat-nav-list>\n <a mat-list-item href=\"javascript:void(0);\" (click)=\"routeTo(null)\">Create</a>\n </mat-nav-list>\n </ng-container>\n <h3 *ngIf=\"identity\">Logged in as {{identity?.email}}</h3>\n</div>\n\n", styles: [".sidenav{max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.sidenav{max-height:100vh}}h2,h3{margin-left:10px;justify-content:right}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "component", type: i8$1.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i8$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }], animations: [
1564
+ SideNavigationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: SideNavigationComponent, selector: "app-side-navigation", viewQueries: [{ propertyName: "divNav", first: true, predicate: ["navcontainer"], descendants: true }], ngImport: i0, template: "<div class=\"sidenav no-scrollbar\">\n <div style=\"margin-top: 20px;\">\n <mat-form-field style=\"width: 100%\">\n <mat-label>Search</mat-label>\n <input matInput [formControl]=\"searchControl\" (ngModelChange)=\"onSearchChange($event)\">\n </mat-form-field>\n </div>\n\n <div\n class=\"progress\"\n [hidden]=\"!loading\"\n >\n <mat-progress-spinner\n style=\"margin-left: 16px;\"\n [diameter]=20\n mode=\"indeterminate\"\n >\n </mat-progress-spinner>\n </div>\n\n <div #navcontainer class=\"navcontainer\"\n [@sideNavAnimation]=\"state\"\n >\n <mat-nav-list\n *ngFor=\"let container of entriesByMonthAndYear\"\n >\n <h3>{{getMonthAndYearFromKey(container.month_year)}}</h3>\n <a mat-list-item *ngFor=\"let entry of container.entries\" href=\"javascript:void(0)\" (click)=\"routeTo(entry)\">{{entry.title}}</a>\n </mat-nav-list>\n\n <a\n class=\"sidelink\"\n *ngIf=\"this?.response?.next && !loading\"\n (click)=\"getMore()\"\n href=\"javascript:void(0);\">More...</a>\n </div>\n <ng-container *ngIf=\"identity?.id === 1\">\n <h2>Misc</h2>\n\n <mat-nav-list>\n <a mat-list-item href=\"javascript:void(0);\" (click)=\"routeTo(null)\">Create</a>\n </mat-nav-list>\n </ng-container>\n <h3 *ngIf=\"identity\">Logged in as {{identity?.email}}</h3>\n</div>\n\n", styles: [".progress{position:absolute;top:100px;left:0}.sidelink{padding-left:16px}.sidenav{position:relative;max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.sidenav{max-height:100vh}}h2,h3{margin-left:10px;justify-content:right}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "component", type: i8$1.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i8$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "component", type: i9$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], animations: [
1556
1565
  trigger('sideNavAnimation', [
1557
1566
  state('in', style({ transform: 'translateX(0%)' })),
1558
1567
  state('out', style({ transform: 'translateX(110%)' })),
@@ -1577,7 +1586,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
1577
1586
  animate('100ms ease-in', style({ transform: 'translateX(0%)' }))
1578
1587
  ])
1579
1588
  ]),
1580
- ], template: "<div class=\"sidenav no-scrollbar\">\n <div style=\"margin-top: 20px;\">\n <mat-form-field style=\"width: 100%\">\n <mat-label>Search</mat-label>\n <input matInput [formControl]=\"searchControl\" (ngModelChange)=\"onSearchChange($event)\">\n </mat-form-field>\n </div>\n\n <div #navcontainer class=\"navcontainer\"\n [@sideNavAnimation]=\"state\"\n >\n <mat-nav-list\n *ngFor=\"let container of entriesByMonthAndYear\"\n >\n <h3>{{getMonthAndYearFromKey(container.month_year)}}</h3>\n <a mat-list-item *ngFor=\"let entry of container.entries\" href=\"javascript:void(0)\" (click)=\"routeTo(entry)\">{{entry.title}}</a>\n </mat-nav-list>\n\n </div>\n\n <ng-container *ngIf=\"identity?.id === 1\">\n <h2>Misc</h2>\n\n <mat-nav-list>\n <a mat-list-item href=\"javascript:void(0);\" (click)=\"routeTo(null)\">Create</a>\n </mat-nav-list>\n </ng-container>\n <h3 *ngIf=\"identity\">Logged in as {{identity?.email}}</h3>\n</div>\n\n", styles: [".sidenav{max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.sidenav{max-height:100vh}}h2,h3{margin-left:10px;justify-content:right}\n"] }]
1589
+ ], template: "<div class=\"sidenav no-scrollbar\">\n <div style=\"margin-top: 20px;\">\n <mat-form-field style=\"width: 100%\">\n <mat-label>Search</mat-label>\n <input matInput [formControl]=\"searchControl\" (ngModelChange)=\"onSearchChange($event)\">\n </mat-form-field>\n </div>\n\n <div\n class=\"progress\"\n [hidden]=\"!loading\"\n >\n <mat-progress-spinner\n style=\"margin-left: 16px;\"\n [diameter]=20\n mode=\"indeterminate\"\n >\n </mat-progress-spinner>\n </div>\n\n <div #navcontainer class=\"navcontainer\"\n [@sideNavAnimation]=\"state\"\n >\n <mat-nav-list\n *ngFor=\"let container of entriesByMonthAndYear\"\n >\n <h3>{{getMonthAndYearFromKey(container.month_year)}}</h3>\n <a mat-list-item *ngFor=\"let entry of container.entries\" href=\"javascript:void(0)\" (click)=\"routeTo(entry)\">{{entry.title}}</a>\n </mat-nav-list>\n\n <a\n class=\"sidelink\"\n *ngIf=\"this?.response?.next && !loading\"\n (click)=\"getMore()\"\n href=\"javascript:void(0);\">More...</a>\n </div>\n <ng-container *ngIf=\"identity?.id === 1\">\n <h2>Misc</h2>\n\n <mat-nav-list>\n <a mat-list-item href=\"javascript:void(0);\" (click)=\"routeTo(null)\">Create</a>\n </mat-nav-list>\n </ng-container>\n <h3 *ngIf=\"identity\">Logged in as {{identity?.email}}</h3>\n</div>\n\n", styles: [".progress{position:absolute;top:100px;left:0}.sidelink{padding-left:16px}.sidenav{position:relative;max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.sidenav{max-height:100vh}}h2,h3{margin-left:10px;justify-content:right}\n"] }]
1581
1590
  }], ctorParameters: function () { return [{ type: EntryService }, { type: i1$4.Router }, { type: IdentityService }, { type: i0.Renderer2 }]; }, propDecorators: { divNav: [{
1582
1591
  type: ViewChild,
1583
1592
  args: ['navcontainer', { static: false }]
@@ -1792,6 +1801,7 @@ CoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15
1792
1801
  MatDatepickerModule,
1793
1802
  MatNativeDateModule,
1794
1803
  MatTableModule,
1804
+ MatProgressSpinnerModule,
1795
1805
  FontAwesomeModule,
1796
1806
  FileUploadModule,
1797
1807
  NgxMaterialTimepickerModule], exports: [EntryRendererComponent,
@@ -1836,6 +1846,7 @@ CoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15
1836
1846
  MatDatepickerModule,
1837
1847
  MatNativeDateModule,
1838
1848
  MatTableModule,
1849
+ MatProgressSpinnerModule,
1839
1850
  FontAwesomeModule,
1840
1851
  FileUploadModule,
1841
1852
  NgxMaterialTimepickerModule] });
@@ -1880,6 +1891,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
1880
1891
  MatDatepickerModule,
1881
1892
  MatNativeDateModule,
1882
1893
  MatTableModule,
1894
+ MatProgressSpinnerModule,
1883
1895
  FontAwesomeModule,
1884
1896
  FileUploadModule,
1885
1897
  NgxMaterialTimepickerModule,