Skip to content

Commit

Permalink
misc updates/fix from downstream
Browse files Browse the repository at this point in the history
  • Loading branch information
jrassa committed May 31, 2024
1 parent 5a6b1cd commit ed666dd
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/app/common/dialog/dialog.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class DialogReturn<T> {

export function isDialogActionOK<T>() {
return (source$: Observable<DialogReturn<T>>) =>
source$.pipe(filter((result) => result.action === DialogAction.OK));
source$.pipe(filter((result) => result?.action === DialogAction.OK));
}

export function mapToDialogReturnData<T>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';

import { LoadingOverlayComponent } from './loading-overlay.component';

Expand All @@ -19,8 +18,6 @@ describe('LoadingOverlayComponent', () => {
it('should display loading overlay and loading spinner', () => {
fixture.componentRef.setInput('isLoading', true);
fixture.detectChanges();
// expect(rootHTMLElement.innerHTML).toEqual('');
// expect(fixture.debugElement.query(By.css('.overlay'))).toBeDefined();
expect(rootHTMLElement.getElementsByClassName('overlay').length).toEqual(1);
expect(rootHTMLElement.getElementsByClassName('overlay-spinner').length).toEqual(1);
expect(rootHTMLElement.getElementsByClassName('alert').length).toEqual(0);
Expand Down
11 changes: 9 additions & 2 deletions src/app/common/pipes/utc-date-pipe/utc-date-utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@ export class UtcDateUtils {
value: string | number | Date | DateTime | null | undefined,
format?: string
): string {
if (null != value) {
if (value) {
let luxonDate;
if (value instanceof DateTime) {
luxonDate = value;
} else if (value instanceof Date) {
luxonDate = DateTime.fromJSDate(value).toUTC();
} else if (typeof value === 'number') {
luxonDate = DateTime.fromMillis(value).toUTC();
} else if (typeof value === 'string') {
} else {
luxonDate = DateTime.fromISO(value).toUTC();

if (!luxonDate.isValid) {
luxonDate = DateTime.fromFormat(value, 'D').toUTC();
}
if (!luxonDate.isValid) {
luxonDate = DateTime.fromFormat(value, 'M-d-yyyy').toUTC();
}
if (!luxonDate.isValid) {
// converts a string of milliseconds into a number
value = +value;
Expand Down
2 changes: 1 addition & 1 deletion src/app/common/table/asy-table-data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class AsyTableDataSource<T> extends DataSource<T> {
switchMap(([search, filter]) =>
pagingOptions$.pipe(map((pagingOptions) => [pagingOptions, search, filter]))
),
tap(([pagingOptions]) => {
tap(() => {
this.loading$.next(true);
this.pagingResults$.next(NULL_PAGING_RESULTS);
}),
Expand Down
11 changes: 1 addition & 10 deletions src/app/common/table/column-chooser/column-chooser.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ import {
moveItemInArray
} from '@angular/cdk/drag-drop';
import { TitleCasePipe } from '@angular/common';
import {
Component,
EventEmitter,
Input,
OnInit,
Output,
booleanAttribute,
input,
output
} from '@angular/core';
import { Component, Input, OnInit, booleanAttribute, input, output } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { LocalStorageService } from '../../storage/local-storage.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@if (isExpandable(index, item)) {
<div style="cursor: pointer" (click)="toggle(index, item)">
<span
class="fa-solid fa-2x fa-angle-down"
class="fa-solid fa-lg fa-angle-down"
[class.fa-flip-vertical]="isExpanded(index, item)"
></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[checked]="_isAllSelected$ | async"
(change)="_toggleAll()"
/>
<label class="form-check-label" for="table-select-all"></label>
</div>
}
</th>
Expand All @@ -23,10 +22,6 @@
[disabled]="!isSelectable(_isMultiTemplateDataRows ? dataIndex : index, result)"
(change)="toggle(_isMultiTemplateDataRows ? dataIndex : index, result)"
/>
<label
class="form-check-label"
for="table-selected-{{ _isMultiTemplateDataRows ? dataIndex : index }}"
></label>
</div>
</td>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</ng-template>
</th>
<td class="text-nowrap" cdk-cell *cdkCellDef="let obj">
{{ obj[name] }}
{{ obj[name] ?? defaultValue }}
</td>
</ng-container>
6 changes: 4 additions & 2 deletions src/app/common/table/columns/text/text-column.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CdkTableModule } from '@angular/cdk/table';
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { Component, input } from '@angular/core';

import { AsySortHeaderComponent } from '../../sort/asy-sort-header/asy-sort-header.component';
import { AsyAbstractValueColumnComponent } from '../asy-abstract-value-column.component';
Expand All @@ -12,4 +12,6 @@ import { AsyAbstractValueColumnComponent } from '../asy-abstract-value-column.co
templateUrl: './text-column.component.html',
styleUrls: ['./text-column.component.scss']
})
export class TextColumnComponent<T> extends AsyAbstractValueColumnComponent<T> {}
export class TextColumnComponent<T> extends AsyAbstractValueColumnComponent<T> {
readonly defaultValue = input('');
}
2 changes: 1 addition & 1 deletion src/app/common/table/filter/asy-filter.directive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, Input, input } from '@angular/core';
import { Directive, input } from '@angular/core';

import isEmpty from 'lodash/isEmpty';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(overlayOutsideClick)="isOpen.set(false)"
>
<div class="dropdown-menu d-flex flex-column" cdkTrapFocus cdkTrapFocusAutoCapture>
@if (showSearch()) {
@if (showSearch() || _options.length > showSearchMinOptions()) {
<div class="search mt-2">
<asy-search-input
placeholder="Search..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
booleanAttribute,
inject,
input,
numberAttribute,
signal
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
Expand Down Expand Up @@ -60,8 +61,11 @@ export class AsyHeaderListFilterComponent extends AsyAbstractHeaderFilterCompone
readonly #titleCasePipe = inject(TitleCasePipe);
readonly #destroyRef = inject(DestroyRef);

readonly showSearch = input(false, { transform: booleanAttribute });
readonly showMatch = input(false, { transform: booleanAttribute });
readonly showSearch = input(false, { transform: booleanAttribute });
readonly showSearchMinOptions = input(Number.MAX_SAFE_INTEGER, {
transform: numberAttribute
});

readonly optionsLoading = signal(false);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { A11yModule } from '@angular/cdk/a11y';
import { CdkConnectedOverlay, CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
import { NgClass } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
Inject,
Optional,
effect,
signal
} from '@angular/core';
import { ChangeDetectionStrategy, Component, Inject, Optional, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { NgSelectModule } from '@ng-select/ng-select';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div class="text-nowrap">
<button class="px-0">
<ng-content></ng-content>

@if (sortable) {
<span class="fa-stack">
<span
Expand All @@ -15,5 +14,4 @@
</span>
}
</button>
<ng-content select="asy-header-filter"></ng-content>
</div>

0 comments on commit ed666dd

Please sign in to comment.