Skip to content

Commit

Permalink
chore(ngx-core): use ngx- selectors
Browse files Browse the repository at this point in the history
chore(ngx-message-box): use ngx- selectors
chore(ngx-message-box-dialog): use ngx- selectors
chore(ngx-layout): use ngx- selectors
chore(ngx-list-loader): use ngx- selectors
chore(ngx-numeric-stepper): use ngx- selectors
chore(ngx-overlay): use ngx- selectors
chore(ngx-search-container): use ngx- selectors
chore(ngx-sidenav): use ngx- selectors
chore(ngx-snackbar): use ngx- selectors
chore(ngx-splitter): use ngx- selectors
chore(ngx-status): use ngx- selectors
chore(ngx-time-picker): use ngx- selectors
chore(ngx-tooltip): use ngx- selectors
chore(ngx-user-card): use ngx- selectors
chore(ngx-user-tooltip): use ngx- selectors
  • Loading branch information
vapkse committed Jul 23, 2024
1 parent 3536f09 commit 8b34653
Show file tree
Hide file tree
Showing 79 changed files with 336 additions and 336 deletions.
6 changes: 3 additions & 3 deletions projects/core/src/cache.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { catchError, Observable, throwError } from 'rxjs';

export interface CacheEntry<T> {
export interface NgxCacheEntry<T> {
timeStamp: number;
data$: T;
}

export class Cache<T, K = string> extends Map<K, CacheEntry<T>> {
export class NgxCache<T, K = string> extends Map<K, NgxCacheEntry<T>> {
public constructor(public duty = 86400000) {
super();
}
Expand Down Expand Up @@ -44,7 +44,7 @@ export class Cache<T, K = string> extends Map<K, CacheEntry<T>> {
}
}

export class ObservableCache<T, K = string> extends Cache<Observable<T>, K> {
export class NgxObservableCache<T, K = string> extends NgxCache<Observable<T>, K> {
// eslint-disable-next-line rxjs/finnish
public override getCache(key: K, defaultValueFn?: (timeStamp: number) => Observable<T>): Observable<T> {
const data$ = super.getCache(key, defaultValueFn);
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/custom-array.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ declare global {
}

@NgModule()
export class CustomArrayModule {
export class NgxCustomArrayModule {
public constructor() {
(Array.prototype as void[]).filterMap = function <T, U>(this: T[], predicate: (value: T, index: number, _array: T[]) => U | undefined): TruthyTypesOf<U>[] {
return this.map(predicate).filter(v => v !== undefined);
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/directives/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Directive, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';

@Directive()
export class Destroy implements OnDestroy {
export class NgxDestroy implements OnDestroy {
protected destroyed$ = new Subject<void>();

public ngOnDestroy(): void {
Expand Down
8 changes: 4 additions & 4 deletions projects/core/src/directives/input-autosize.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { Directive, ElementRef, inject, NgZone, OnInit } from '@angular/core';
import { MatInput } from '@angular/material/input';
import { debounceTime, fromEvent, mergeWith, of, startWith, takeUntil } from 'rxjs';

import { Destroy } from './destroy';
import { NgxDestroy } from './destroy';

@Directive({
selector: '[inputAutosize][matInput], [inputAutosize] [matInput]',
exportAs: 'inputAutosize',
selector: '[ngx-input-autosize][matInput], [ngx-input-autosize] [matInput]',
exportAs: 'ngx-input-autosize',
standalone: true
})
export class InputAutosizeDirective extends Destroy implements OnInit {
export class NgxInputAutosizeDirective extends NgxDestroy implements OnInit {
private elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef);
private ngZone = inject(NgZone);
private matInput = inject(MatInput);
Expand Down
6 changes: 3 additions & 3 deletions projects/core/src/directives/single-click.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { Directive, EventEmitter, HostListener, Input, OnInit, Output } from '@a
import { ReplaySubject } from 'rxjs';
import { takeUntil, throttleTime } from 'rxjs/operators';

import { Destroy } from './destroy';
import { NgxDestroy } from './destroy';

@Directive({
selector: '[singleClick]',
selector: '[ngx-single-click]',
standalone: true
})
export class SingleClickDirective extends Destroy implements OnInit {
export class NgxSingleClickDirective extends NgxDestroy implements OnInit {
@Input()
public throttleTime = 2000;

Expand Down
4 changes: 2 additions & 2 deletions projects/core/src/services/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Type } from '@angular/core';
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
import { Observable, ReplaySubject, switchMap, take, throttleTime } from 'rxjs';

import { AbstractLazyModule, LazyLoaderService } from './lazy-loader.service';
import { AbstractLazyModule, NgxLazyLoaderService } from './lazy-loader.service';

export abstract class DialogService<ReturnType, DataType> {
protected openDialogSub$ = new ReplaySubject<MatDialogConfig<DataType>>(1);
protected dialogResponse$: Observable<ReturnType | undefined>;
protected dialogRef!: MatDialogRef<unknown, ReturnType>;

public constructor(
private lazyLoaderService: LazyLoaderService,
private lazyLoaderService: NgxLazyLoaderService,
private dialog: MatDialog,
matDialogConfig?: MatDialogConfig<DataType>
) {
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/services/lazy-loader.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export abstract class AbstractLazyModule<Component> {
@Injectable({
providedIn: 'root'
})
export class LazyLoaderService {
export class NgxLazyLoaderService {
public constructor(
private injector: Injector
) {}
Expand Down
12 changes: 6 additions & 6 deletions projects/core/src/services/media.service.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Inject, Injectable, InjectionToken, NgZone, OnDestroy, Optional } from '@angular/core';
import { BehaviorSubject, distinctUntilChanged, map, Observable, shareReplay } from 'rxjs';

export interface MediaQueryDefinition {
export interface NgxMediaQueryDefinition {
alias: string;
mediaQuery: string;
overlapping?: boolean;
}

export const mediaQueryDefinitions = new InjectionToken<MediaQueryDefinition[]>('MEDIA_QUERY_DEFINITIONS');
export const mediaQueryDefinitions = new InjectionToken<NgxMediaQueryDefinition[]>('MEDIA_QUERY_DEFINITIONS');

export const defaultMediaQueryDefinitions = [
{
Expand Down Expand Up @@ -70,7 +70,7 @@ export const defaultMediaQueryDefinitions = [
alias: 'xl',
mediaQuery: '(min-width: 1920px) and (max-width: 5000px)'
}
] as MediaQueryDefinition[];
] as NgxMediaQueryDefinition[];

export const simplifiedMediaQueryDefinitions = [
{
Expand All @@ -86,20 +86,20 @@ export const simplifiedMediaQueryDefinitions = [
alias: 'lg',
mediaQuery: '(min-width: 1280px)'
}
] as MediaQueryDefinition[];
] as NgxMediaQueryDefinition[];

@Injectable({
providedIn: 'root'
})
export class MediaService implements OnDestroy {
export class NgxMediaService implements OnDestroy {
public readonly isHandset$: Observable<boolean>;
public readonly isMobile$: Observable<boolean>;
public mediaChanged$ = new BehaviorSubject('lg');
public mql = {} as Record<string, MediaQueryList>;

public constructor(
private zone: NgZone,
@Optional() @Inject(mediaQueryDefinitions) mediaDefinitions?: MediaQueryDefinition[]
@Optional() @Inject(mediaQueryDefinitions) mediaDefinitions?: NgxMediaQueryDefinition[]
) {
if (!mediaDefinitions) {
mediaDefinitions = simplifiedMediaQueryDefinitions;
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/styles/mixins/_menu-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

.ngx-menu,
[ngx-menu] {
.menu-content {
.ngx-menu-content {
background-color: #fff;
border-color: rgba(0, 0, 0, 0.3);

Expand Down
6 changes: 3 additions & 3 deletions projects/core/src/styles/mixins/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
display: flex;
flex-direction: column;

.menu-content {
.ngx-menu-content {
overflow-x: hidden;
overflow-y: auto;
display: block;
Expand All @@ -17,8 +17,8 @@
0 1px 5px 0 rgba(0, 0, 0, 0.12);
height: 100%;

.menu-header,
.menu-footer {
.ngx-menu-header,
.ngx-menu-footer {
flex: 0 0 auto;
padding: 0.5rem;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<button *ngIf="!hideClear" data-cy="dtp-clear" [disabled]="forInput.disabled" mat-icon-button class="date-picker-button" matTooltip="effacer" type="button" (click)="setValue($event, false)">
<button *ngIf="!hideClear" data-cy="dtp-clear" [disabled]="forInput.disabled" mat-icon-button class="ngx-date-picker-button" matTooltip="effacer" type="button" (click)="setValue($event, false)">
<mat-icon>close</mat-icon>
</button>
<button *ngIf="!hideToday" data-cy="dtp-today" [disabled]="forInput.disabled" mat-icon-button class="date-picker-button" matTooltip="aujourd'hui" type="button" (click)="setValue($event, true)">
<button *ngIf="!hideToday" data-cy="dtp-today" [disabled]="forInput.disabled" mat-icon-button class="ngx-date-picker-button" matTooltip="aujourd'hui" type="button" (click)="setValue($event, true)">
<mat-icon>today</mat-icon>
</button>
<button data-cy="dtp-open" [disabled]="forInput.disabled" mat-icon-button class="date-picker-button" matTooltip="ouvrir le calendrier" type="button" (click)="openCalendar()">
<button data-cy="dtp-open" [disabled]="forInput.disabled" mat-icon-button class="ngx-date-picker-button" matTooltip="ouvrir le calendrier" type="button" (click)="openCalendar()">
<mat-icon>date_range</mat-icon>
</button>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
datepicker-buttons {
ngx-datepicker-buttons {
font-size: 80%;

.date-picker-button {
.ngx-date-picker-button {
max-width: 20px;
max-height: 20px;

Expand All @@ -21,7 +21,7 @@ datepicker-buttons {
.mat-form-field.mat-form-field-appearance-legacy {
font-size: inherit;

datepicker-buttons {
ngx-datepicker-buttons {
.mat-icon-button {
font-size: 130%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, In
import { AbstractControl } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { DateAdapter } from '@angular/material/core';
import { MatDatepicker, MatDateRangeInput, MatDateRangePicker } from '@angular/material/datepicker';
import { MatDateRangeInput, MatDateRangePicker, MatDatepicker } from '@angular/material/datepicker';
import { MatFormFieldControl } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { Destroy } from '@hug/ngx-core';
import { NgxDestroy } from '@hug/ngx-core';
import { set } from 'date-fns';
import { filter, ReplaySubject, switchMap, takeUntil, tap } from 'rxjs';
import { ReplaySubject, filter, switchMap, takeUntil, tap } from 'rxjs';

@Component({
selector: 'datepicker-buttons',
selector: 'ngx-datepicker-buttons',
templateUrl: './datepicker-buttons.component.html',
styleUrls: ['./datepicker-buttons.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
Expand All @@ -26,7 +26,7 @@ import { filter, ReplaySubject, switchMap, takeUntil, tap } from 'rxjs';
MatTooltipModule
]
})
export class DatepickerButtonsComponent extends Destroy implements OnInit {
export class NgxDatepickerButtonsComponent extends NgxDestroy implements OnInit {
@Output() public readonly dateChange = new EventEmitter<Date>();

@Input() public forInput!: MatFormFieldControl<unknown>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormControl, ValidationErrors, Validator } from '@angular/forms';
import { isValid } from 'date-fns';

@Injectable()
export class DatepickerMaskValidatorService implements Validator {
export class NgxDatepickerMaskValidatorService implements Validator {
private invalid = false;

public validate({ value }: FormControl<Date>): ValidationErrors | null {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
import { Directive, ElementRef, forwardRef, Inject, Input, OnInit, Optional, Renderer2 } from '@angular/core';
import { AbstractControl, NG_VALIDATORS, NgControl } from '@angular/forms';
import { DateAdapter, MAT_DATE_FORMATS, MatDateFormats } from '@angular/material/core';
import { Destroy, filterMap, KeyCodes, subscribeWith } from '@hug/ngx-core';
import { filterMap, KeyCodes, NgxDestroy, subscribeWith } from '@hug/ngx-core';
import { addDays, addHours, addMinutes, addMonths, addSeconds, addYears, isValid, parse, set } from 'date-fns';
import { isNil } from 'lodash-es';
import { delay, EMPTY, filter, fromEvent, mergeWith, of, startWith, switchMap, takeUntil, tap, timeInterval } from 'rxjs';

import { DatepickerMaskValidatorService } from './datepicker-mask-validator.service';
import { NgxDatepickerMaskValidatorService } from './datepicker-mask-validator.service';


@Directive({
selector: '[matDatepicker][dateFormat],[matDatepicker][dateTimeFormat],[matStartDate][dateFormat],[matEndDate][dateFormat],[matStartDate][dateTimeFormat],[matEndDate][dateTimeFormat]',
providers: [
DatepickerMaskValidatorService,
NgxDatepickerMaskValidatorService,
{
provide: NG_VALIDATORS,
useExisting: forwardRef(() => DatepickerMaskValidatorService),
useExisting: forwardRef(() => NgxDatepickerMaskValidatorService),
multi: true
}
]
})
export class DatepickerMaskDirective extends Destroy implements OnInit {
export class NgxDatepickerMaskDirective extends NgxDestroy implements OnInit {
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('dateTimeFormat')
public set dateTimeFormat(value: string) {
Expand Down Expand Up @@ -57,7 +57,7 @@ export class DatepickerMaskDirective extends Destroy implements OnInit {
private elementRef: ElementRef<HTMLInputElement>,
private ngControl: NgControl,
private renderer: Renderer2,
private validator: DatepickerMaskValidatorService,
private validator: NgxDatepickerMaskValidatorService,
private dateAdapter: DateAdapter<unknown>
) {
super();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-template>
<time-picker #timepicker class="datepicker-with-time" [(time)]="time"></time-picker>
<div class="datepicker-with-time action-buttons">
<ngx-time-picker #timepicker class="ngx-datepicker-with-time" [(time)]="time"></ngx-time-picker>
<div class="ngx-datepicker-with-time action-buttons">
<button mat-raised-button color="primary" matDatepickerApply (click)="onDateTimeClosed()">OK</button>
</div>
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
deja-time-picker.datepicker-with-time {
ngx-time-picker.ngx-datepicker-with-time {
.time-range {
display: flex;
align-items: center;

.time-picker-separator {
.ngx-time-picker-separator {
text-align: center;
margin: 0 0.5rem;
}
}
}

.datepicker-with-time.action-buttons {
.ngx-datepicker-with-time.action-buttons {
padding: 1.5rem 0 1rem 0;
display: flex;
justify-content: center;
Expand All @@ -30,11 +30,11 @@ deja-time-picker.datepicker-with-time {
}

.mat-calendar,
deja-time-picker.datepicker-with-time {
ngx-time-picker.ngx-datepicker-with-time {
flex: 0 0 auto;
}

.datepicker-with-time.action-buttons {
.ngx-datepicker-with-time.action-buttons {
flex: 1 0 100%;
padding: 0 0 1rem 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { TemplatePortal } from '@angular/cdk/portal';
import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Inject, OnDestroy, Optional, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { DateAdapter } from '@angular/material/core';
import { MatDatepicker, MatDatepickerInput, MatDateSelectionModel } from '@angular/material/datepicker';
import { Destroy } from '@hug/ngx-core';
import { MatDateSelectionModel, MatDatepicker, MatDatepickerInput } from '@angular/material/datepicker';
import { NgxDestroy } from '@hug/ngx-core';
import { DateOrDuration, TimePickerComponent } from '@hug/ngx-time-picker';
import { cloneDeep } from 'lodash-es';
import { delay, filter, map, takeUntil, tap } from 'rxjs';
Expand All @@ -12,7 +12,7 @@ import { DATE_TIME_ADAPTER, DateTimeAdapter } from '../date-adapter/date-time-ad


@Component({
selector: 'datepicker-with-time',
selector: 'ngx-datepicker-with-time',
templateUrl: './datepicker-with-time.component.html',
styleUrls: ['./datepicker-with-time.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
Expand All @@ -23,7 +23,7 @@ import { DATE_TIME_ADAPTER, DateTimeAdapter } from '../date-adapter/date-time-ad
TimePickerComponent
]
})
export class DatepickerWithTimeComponent extends Destroy implements AfterViewInit, OnDestroy {
export class NgxDatepickerWithTimeComponent extends NgxDestroy implements AfterViewInit, OnDestroy {
@ViewChild(TemplateRef)
private template?: TemplateRef<unknown>;

Expand Down
Loading

0 comments on commit 8b34653

Please sign in to comment.