(linting) Migrated over to the ESLint

This commit is contained in:
sercan 2021-05-14 17:17:06 +03:00
parent 0c5f5b9165
commit d159ae1458
182 changed files with 3543 additions and 2400 deletions

95
.eslintrc.json Normal file
View File

@ -0,0 +1,95 @@
{
"root": true,
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "",
"style": "camelCase"
}
],
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/no-inferrable-types": "off",
"arrow-parens": [
"error",
"as-needed",
{
"requireForBlockBody": true
}
],
"brace-style": [
"off",
"off"
],
"import/order": "off",
"max-len": [
"error",
{
"ignorePattern": "^import |^export | implements",
"code": 180
}
],
"no-underscore-dangle": "off",
"object-shorthand": "off",
"quote-props": [
"error",
"consistent"
],
"quotes": [
"error",
"single"
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}

View File

@ -126,15 +126,11 @@
} }
}, },
"lint": { "lint": {
"builder": "@angular-devkit/build-angular:tslint", "builder": "@angular-eslint/builder:lint",
"options": { "options": {
"tsConfig": [ "lintFilePatterns": [
"tsconfig.app.json", "src/**/*.ts",
"tsconfig.spec.json", "src/**/*.html"
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
] ]
} }
}, },
@ -153,5 +149,8 @@
} }
} }
}, },
"defaultProject": "fuse" "defaultProject": "fuse",
"cli": {
"defaultCollection": "@angular-eslint/schematics"
}
} }

1698
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -49,6 +49,11 @@
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "12.0.0", "@angular-devkit/build-angular": "12.0.0",
"@angular-eslint/builder": "12.0.0",
"@angular-eslint/eslint-plugin": "12.0.0",
"@angular-eslint/eslint-plugin-template": "12.0.0",
"@angular-eslint/schematics": "12.0.0",
"@angular-eslint/template-parser": "12.0.0",
"@angular/cli": "12.0.0", "@angular/cli": "12.0.0",
"@angular/compiler-cli": "12.0.0", "@angular/compiler-cli": "12.0.0",
"@angular/language-service": "12.0.0", "@angular/language-service": "12.0.0",
@ -62,9 +67,14 @@
"@types/lodash": "4.14.168", "@types/lodash": "4.14.168",
"@types/lodash-es": "4.17.4", "@types/lodash-es": "4.17.4",
"@types/node": "12.20.13", "@types/node": "12.20.13",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"autoprefixer": "10.2.5", "autoprefixer": "10.2.5",
"chroma-js": "2.1.1", "chroma-js": "2.1.1",
"codelyzer": "6.0.1", "eslint": "7.26.0",
"eslint-plugin-import": "2.23.0",
"eslint-plugin-jsdoc": "34.2.2",
"eslint-plugin-prefer-arrow": "1.2.3",
"jasmine-core": "3.7.1", "jasmine-core": "3.7.1",
"jasmine-spec-reporter": "5.0.2", "jasmine-spec-reporter": "5.0.2",
"karma": "6.3.2", "karma": "6.3.2",
@ -77,7 +87,6 @@
"protractor": "7.0.0", "protractor": "7.0.0",
"tailwindcss": "2.1.2", "tailwindcss": "2.1.2",
"ts-node": "8.3.0", "ts-node": "8.3.0",
"tslint": "6.1.3",
"typescript": "4.2.4" "typescript": "4.2.4"
} }
} }

View File

@ -1,14 +1,14 @@
export class FuseAnimationCurves export class FuseAnimationCurves
{ {
static STANDARD_CURVE = 'cubic-bezier(0.4, 0.0, 0.2, 1)'; static standard = 'cubic-bezier(0.4, 0.0, 0.2, 1)';
static DECELERATION_CURVE = 'cubic-bezier(0.0, 0.0, 0.2, 1)'; static deceleration = 'cubic-bezier(0.0, 0.0, 0.2, 1)';
static ACCELERATION_CURVE = 'cubic-bezier(0.4, 0.0, 1, 1)'; static acceleration = 'cubic-bezier(0.4, 0.0, 1, 1)';
static SHARP_CURVE = 'cubic-bezier(0.4, 0.0, 0.6, 1)'; static sharp = 'cubic-bezier(0.4, 0.0, 0.6, 1)';
} }
export class FuseAnimationDurations export class FuseAnimationDurations
{ {
static COMPLEX = '375ms'; static complex = '375ms';
static ENTERING = '225ms'; static entering = '225ms';
static EXITING = '195ms'; static exiting = '195ms';
} }

View File

@ -24,7 +24,7 @@ const expandCollapse = trigger('expandCollapse',
animate('{{timings}}'), animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )

View File

@ -25,7 +25,7 @@ const fadeIn = trigger('fadeIn',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -58,7 +58,7 @@ const fadeInTop = trigger('fadeInTop',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -91,7 +91,7 @@ const fadeInBottom = trigger('fadeInBottom',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -124,7 +124,7 @@ const fadeInLeft = trigger('fadeInLeft',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -157,7 +157,7 @@ const fadeInRight = trigger('fadeInRight',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -188,7 +188,7 @@ const fadeOut = trigger('fadeOut',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )
@ -221,7 +221,7 @@ const fadeOutTop = trigger('fadeOutTop',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )
@ -254,7 +254,7 @@ const fadeOutBottom = trigger('fadeOutBottom',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )
@ -287,7 +287,7 @@ const fadeOutLeft = trigger('fadeOutLeft',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )
@ -320,7 +320,7 @@ const fadeOutRight = trigger('fadeOutRight',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )

View File

@ -4,7 +4,7 @@ import { shake } from './shake';
import { slideInBottom, slideInLeft, slideInRight, slideInTop, slideOutBottom, slideOutLeft, slideOutRight, slideOutTop } from './slide'; import { slideInBottom, slideInLeft, slideInRight, slideInTop, slideOutBottom, slideOutLeft, slideOutRight, slideOutTop } from './slide';
import { zoomIn, zoomOut } from './zoom'; import { zoomIn, zoomOut } from './zoom';
export const FuseAnimations = [ export const fuseAnimations = [
expandCollapse, expandCollapse,
fadeIn, fadeInTop, fadeInBottom, fadeInLeft, fadeInRight, fadeIn, fadeInTop, fadeInBottom, fadeInLeft, fadeInRight,
fadeOut, fadeOutTop, fadeOutBottom, fadeOutLeft, fadeOutRight, fadeOut, fadeOutTop, fadeOutBottom, fadeOutLeft, fadeOutRight,

View File

@ -25,7 +25,7 @@ const slideInTop = trigger('slideInTop',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -56,7 +56,7 @@ const slideInBottom = trigger('slideInBottom',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -87,7 +87,7 @@ const slideInLeft = trigger('slideInLeft',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -118,7 +118,7 @@ const slideInRight = trigger('slideInRight',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -149,7 +149,7 @@ const slideOutTop = trigger('slideOutTop',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )
@ -180,7 +180,7 @@ const slideOutBottom = trigger('slideOutBottom',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )
@ -211,7 +211,7 @@ const slideOutLeft = trigger('slideOutLeft',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )
@ -242,7 +242,7 @@ const slideOutRight = trigger('slideOutRight',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )

View File

@ -28,7 +28,7 @@ const zoomIn = trigger('zoomIn',
transition('void => *', animate('{{timings}}'), transition('void => *', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}` timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
} }
} }
) )
@ -62,7 +62,7 @@ const zoomOut = trigger('zoomOut',
transition('* => void', animate('{{timings}}'), transition('* => void', animate('{{timings}}'),
{ {
params: { params: {
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}` timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
} }
} }
) )

View File

@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Ho
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators'; import { filter, takeUntil } from 'rxjs/operators';
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion'; import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseAlertAppearance, FuseAlertType } from '@fuse/components/alert/alert.types'; import { FuseAlertAppearance, FuseAlertType } from '@fuse/components/alert/alert.types';
import { FuseAlertService } from '@fuse/components/alert/alert.service'; import { FuseAlertService } from '@fuse/components/alert/alert.service';
import { FuseUtilsService } from '@fuse/services/utils/utils.service'; import { FuseUtilsService } from '@fuse/services/utils/utils.service';
@ -13,14 +13,16 @@ import { FuseUtilsService } from '@fuse/services/utils/utils.service';
styleUrls : ['./alert.component.scss'], styleUrls : ['./alert.component.scss'],
encapsulation : ViewEncapsulation.None, encapsulation : ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
animations : FuseAnimations, animations : fuseAnimations,
exportAs : 'fuseAlert' exportAs : 'fuseAlert'
}) })
export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_dismissible: BooleanInput; static ngAcceptInputType_dismissible: BooleanInput;
static ngAcceptInputType_dismissed: BooleanInput; static ngAcceptInputType_dismissed: BooleanInput;
static ngAcceptInputType_showIcon: BooleanInput; static ngAcceptInputType_showIcon: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() appearance: FuseAlertAppearance = 'soft'; @Input() appearance: FuseAlertAppearance = 'soft';
@Input() dismissed: boolean = false; @Input() dismissed: boolean = false;
@ -115,7 +117,7 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
// Subscribe to the dismiss calls // Subscribe to the dismiss calls
this._fuseAlertService.onDismiss this._fuseAlertService.onDismiss
.pipe( .pipe(
filter((name) => this.name === name), filter(name => this.name === name),
takeUntil(this._unsubscribeAll) takeUntil(this._unsubscribeAll)
) )
.subscribe(() => { .subscribe(() => {
@ -127,7 +129,7 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
// Subscribe to the show calls // Subscribe to the show calls
this._fuseAlertService.onShow this._fuseAlertService.onShow
.pipe( .pipe(
filter((name) => this.name === name), filter(name => this.name === name),
takeUntil(this._unsubscribeAll) takeUntil(this._unsubscribeAll)
) )
.subscribe(() => { .subscribe(() => {

View File

@ -1,6 +1,6 @@
import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion'; import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseCardFace } from '@fuse/components/card/card.types'; import { FuseCardFace } from '@fuse/components/card/card.types';
@Component({ @Component({
@ -8,13 +8,15 @@ import { FuseCardFace } from '@fuse/components/card/card.types';
templateUrl : './card.component.html', templateUrl : './card.component.html',
styleUrls : ['./card.component.scss'], styleUrls : ['./card.component.scss'],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
animations : FuseAnimations, animations : fuseAnimations,
exportAs : 'fuseCard' exportAs : 'fuseCard'
}) })
export class FuseCardComponent implements OnChanges export class FuseCardComponent implements OnChanges
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_expanded: BooleanInput; static ngAcceptInputType_expanded: BooleanInput;
static ngAcceptInputType_flippable: BooleanInput; static ngAcceptInputType_flippable: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() expanded: boolean = false; @Input() expanded: boolean = false;
@Input() face: FuseCardFace = 'front'; @Input() face: FuseCardFace = 'front';

View File

@ -23,14 +23,14 @@ import { Moment } from 'moment';
}) })
export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnDestroy export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnDestroy
{ {
@Output() readonly rangeChanged: EventEmitter<{ start: string, end: string }> = new EventEmitter<{ start: string; end: string }>(); @Output() readonly rangeChanged: EventEmitter<{ start: string; end: string }> = new EventEmitter<{ start: string; end: string }>();
@ViewChild('matMonthView1') private _matMonthView1: MatMonthView<any>; @ViewChild('matMonthView1') private _matMonthView1: MatMonthView<any>;
@ViewChild('matMonthView2') private _matMonthView2: MatMonthView<any>; @ViewChild('matMonthView2') private _matMonthView2: MatMonthView<any>;
@ViewChild('pickerPanelOrigin', {read: ElementRef}) private _pickerPanelOrigin: ElementRef; @ViewChild('pickerPanelOrigin', {read: ElementRef}) private _pickerPanelOrigin: ElementRef;
@ViewChild('pickerPanel') private _pickerPanel: TemplateRef<any>; @ViewChild('pickerPanel') private _pickerPanel: TemplateRef<any>;
@HostBinding('class.fuse-date-range') private _defaultClassNames = true; @HostBinding('class.fuse-date-range') private _defaultClassNames = true;
activeDates: { month1: Moment | null, month2: Moment | null } = { activeDates: { month1: Moment | null; month2: Moment | null } = {
month1: null, month1: null,
month2: null month2: null
}; };
@ -41,7 +41,7 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
private _onChange: (value: any) => void; private _onChange: (value: any) => void;
private _onTouched: (value: any) => void; private _onTouched: (value: any) => void;
private _programmaticChange!: boolean; private _programmaticChange!: boolean;
private _range: { start: Moment | null, end: Moment | null } = { private _range: { start: Moment | null; end: Moment | null } = {
start: null, start: null,
end : null end : null
}; };
@ -330,7 +330,7 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
* *
* @param range * @param range
*/ */
writeValue(range: { start: string, end: string }): void writeValue(range: { start: string; end: string }): void
{ {
// Set this change as a programmatic one // Set this change as a programmatic one
this._programmaticChange = true; this._programmaticChange = true;
@ -481,11 +481,8 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
*/ */
dateFilter(): any dateFilter(): any
{ {
return (date: Moment): boolean => {
// If we are selecting the end date, disable all the dates that comes before the start date // If we are selecting the end date, disable all the dates that comes before the start date
return !(this.setWhichDate === 'end' && date.isBefore(this._range.start, 'day')); return (date: Moment): boolean => !(this.setWhichDate === 'end' && date.isBefore(this._range.start, 'day'));
};
} }
/** /**
@ -667,7 +664,7 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
private _parseTime(value: string): Moment private _parseTime(value: string): Moment
{ {
// Parse the time using the time regexp // Parse the time using the time regexp
const timeArr = value.split(this._timeRegExp).filter((part) => part !== ''); const timeArr = value.split(this._timeRegExp).filter(part => part !== '');
// Get the meridiem // Get the meridiem
const meridiem = timeArr[2] || null; const meridiem = timeArr[2] || null;

View File

@ -14,9 +14,11 @@ import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
}) })
export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_fixed: BooleanInput; static ngAcceptInputType_fixed: BooleanInput;
static ngAcceptInputType_opened: BooleanInput; static ngAcceptInputType_opened: BooleanInput;
static ngAcceptInputType_transparentOverlay: BooleanInput; static ngAcceptInputType_transparentOverlay: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() fixed: boolean = false; @Input() fixed: boolean = false;
@Input() mode: FuseDrawerMode = 'side'; @Input() mode: FuseDrawerMode = 'side';
@ -76,6 +78,40 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
}; };
} }
// -----------------------------------------------------------------------------------------------------
// @ Decorated methods
// -----------------------------------------------------------------------------------------------------
/**
* On mouseenter
*
* @private
*/
@HostListener('mouseenter')
private _onMouseenter(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = true;
}
/**
* On mouseleave
*
* @private
*/
@HostListener('mouseleave')
private _onMouseleave(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = false;
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks // @ Lifecycle hooks
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -347,36 +383,6 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
}); });
} }
/**
* On mouseenter
*
* @private
*/
@HostListener('mouseenter')
private _onMouseenter(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = true;
}
/**
* On mouseleave
*
* @private
*/
@HostListener('mouseleave')
private _onMouseleave(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = false;
}
/** /**
* Open/close the drawer * Open/close the drawer
* *

View File

@ -60,7 +60,7 @@ export class FuseHighlightService
} }
// Iterate through the lines // Iterate through the lines
lines.filter((line) => line.length) lines.filter(line => line.length)
.forEach((line, index) => { .forEach((line, index) => {
// Always get the indentation of the first line so we can // Always get the indentation of the first line so we can
@ -77,6 +77,6 @@ export class FuseHighlightService
// Iterate through the lines one more time, remove the extra // Iterate through the lines one more time, remove the extra
// indentation, join them together and return it // indentation, join them together and return it
return lines.map((line) => line.substring(indentation)).join('\n'); return lines.map(line => line.substring(indentation)).join('\n');
} }
} }

View File

@ -1,5 +1,5 @@
import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, TemplateRef, ViewEncapsulation } from '@angular/core'; import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, TemplateRef, ViewEncapsulation } from '@angular/core';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
@Component({ @Component({
@ -7,7 +7,7 @@ import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
templateUrl : './masonry.component.html', templateUrl : './masonry.component.html',
styleUrls : ['./masonry.component.scss'], styleUrls : ['./masonry.component.scss'],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
animations : FuseAnimations, animations : fuseAnimations,
exportAs : 'fuseMasonry' exportAs : 'fuseMasonry'
}) })
export class FuseMasonryComponent implements OnChanges, AfterViewInit export class FuseMasonryComponent implements OnChanges, AfterViewInit

View File

@ -15,7 +15,9 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
}) })
export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDestroy export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_child: BooleanInput; static ngAcceptInputType_child: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() child: boolean = false; @Input() child: boolean = false;
@Input() item: FuseNavigationItem; @Input() item: FuseNavigationItem;

View File

@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { ReplaySubject, Subject } from 'rxjs'; import { ReplaySubject, Subject } from 'rxjs';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types'; import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service'; import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
import { FuseUtilsService } from '@fuse/services/utils/utils.service'; import { FuseUtilsService } from '@fuse/services/utils/utils.service';
@ -9,7 +9,7 @@ import { FuseUtilsService } from '@fuse/services/utils/utils.service';
selector : 'fuse-horizontal-navigation', selector : 'fuse-horizontal-navigation',
templateUrl : './horizontal.component.html', templateUrl : './horizontal.component.html',
styleUrls : ['./horizontal.component.scss'], styleUrls : ['./horizontal.component.scss'],
animations : FuseAnimations, animations : fuseAnimations,
encapsulation : ViewEncapsulation.None, encapsulation : ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
exportAs : 'fuseHorizontalNavigation' exportAs : 'fuseHorizontalNavigation'

View File

@ -67,7 +67,6 @@ export class FuseNavigationService
* Get navigation from storage by key * Get navigation from storage by key
* *
* @param key * @param key
* @returns {any}
*/ */
getNavigation(key: string): FuseNavigationItem[] getNavigation(key: string): FuseNavigationItem[]
{ {
@ -97,7 +96,6 @@ export class FuseNavigationService
* *
* @param navigation * @param navigation
* @param flatNavigation * @param flatNavigation
* @returns {FuseNavigationItem[]}
*/ */
getFlatNavigation(navigation: FuseNavigationItem[], flatNavigation: FuseNavigationItem[] = []): FuseNavigationItem[] getFlatNavigation(navigation: FuseNavigationItem[], flatNavigation: FuseNavigationItem[] = []): FuseNavigationItem[]
{ {

View File

@ -15,8 +15,10 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
}) })
export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnInit, OnDestroy export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_autoCollapse: BooleanInput; static ngAcceptInputType_autoCollapse: BooleanInput;
static ngAcceptInputType_skipChildren: BooleanInput; static ngAcceptInputType_skipChildren: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() activeItemId: string; @Input() activeItemId: string;
@Input() autoCollapse: boolean; @Input() autoCollapse: boolean;
@ -101,6 +103,21 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
this._unsubscribeAll.complete(); this._unsubscribeAll.complete();
} }
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Track by function for ngFor loops
*
* @param index
* @param item
*/
trackByFn(index: number, item: any): any
{
return item.id || index;
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Private methods // @ Private methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -168,19 +185,4 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
// Mark for check // Mark for check
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
} }
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Track by function for ngFor loops
*
* @param index
* @param item
*/
trackByFn(index: number, item: any): any
{
return item.id || index;
}
} }

View File

@ -3,7 +3,7 @@ import { NavigationEnd, Router } from '@angular/router';
import { BooleanInput } from '@angular/cdk/coercion'; import { BooleanInput } from '@angular/cdk/coercion';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators'; import { filter, takeUntil } from 'rxjs/operators';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component'; import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service'; import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types'; import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
@ -12,12 +12,14 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
selector : 'fuse-vertical-navigation-collapsable-item', selector : 'fuse-vertical-navigation-collapsable-item',
templateUrl : './collapsable.component.html', templateUrl : './collapsable.component.html',
styles : [], styles : [],
animations : FuseAnimations, animations : fuseAnimations,
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, OnDestroy export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_autoCollapse: BooleanInput; static ngAcceptInputType_autoCollapse: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() autoCollapse: boolean; @Input() autoCollapse: boolean;
@Input() item: FuseNavigationItem; @Input() item: FuseNavigationItem;
@ -179,84 +181,6 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
this._unsubscribeAll.complete(); this._unsubscribeAll.complete();
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Check if the given item has the given url
* in one of its children
*
* @param item
* @param currentUrl
* @private
*/
private _hasActiveChild(item: FuseNavigationItem, currentUrl: string): boolean
{
const children = item.children;
if ( !children )
{
return false;
}
for ( const child of children )
{
if ( child.children )
{
if ( this._hasActiveChild(child, currentUrl) )
{
return true;
}
}
// Check if the child has a link and is active
if ( child.link && this._router.isActive(child.link, child.exactMatch || false) )
{
return true;
}
}
return false;
}
/**
* Check if this is a children
* of the given item
*
* @param parent
* @param item
* @return {boolean}
* @private
*/
private _isChildrenOf(parent: FuseNavigationItem, item: FuseNavigationItem): boolean
{
const children = parent.children;
if ( !children )
{
return false;
}
if ( children.indexOf(item) > -1 )
{
return true;
}
for ( const child of children )
{
if ( child.children )
{
if ( this._isChildrenOf(child, item) )
{
return true;
}
}
}
return false;
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Public methods // @ Public methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -343,4 +267,81 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
{ {
return item.id || index; return item.id || index;
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Check if the given item has the given url
* in one of its children
*
* @param item
* @param currentUrl
* @private
*/
private _hasActiveChild(item: FuseNavigationItem, currentUrl: string): boolean
{
const children = item.children;
if ( !children )
{
return false;
}
for ( const child of children )
{
if ( child.children )
{
if ( this._hasActiveChild(child, currentUrl) )
{
return true;
}
}
// Check if the child has a link and is active
if ( child.link && this._router.isActive(child.link, child.exactMatch || false) )
{
return true;
}
}
return false;
}
/**
* Check if this is a children
* of the given item
*
* @param parent
* @param item
* @private
*/
private _isChildrenOf(parent: FuseNavigationItem, item: FuseNavigationItem): boolean
{
const children = parent.children;
if ( !children )
{
return false;
}
if ( children.indexOf(item) > -1 )
{
return true;
}
for ( const child of children )
{
if ( child.children )
{
if ( this._isChildrenOf(child, item) )
{
return true;
}
}
}
return false;
}
} }

View File

@ -14,7 +14,9 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
}) })
export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestroy export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_autoCollapse: BooleanInput; static ngAcceptInputType_autoCollapse: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() autoCollapse: boolean; @Input() autoCollapse: boolean;
@Input() item: FuseNavigationItem; @Input() item: FuseNavigationItem;

View File

@ -4,7 +4,7 @@ import { NavigationEnd, Router } from '@angular/router';
import { ScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay'; import { ScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';
import { merge, ReplaySubject, Subject, Subscription } from 'rxjs'; import { merge, ReplaySubject, Subject, Subscription } from 'rxjs';
import { delay, filter, takeUntil } from 'rxjs/operators'; import { delay, filter, takeUntil } from 'rxjs/operators';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseNavigationItem, FuseVerticalNavigationAppearance, FuseVerticalNavigationMode, FuseVerticalNavigationPosition } from '@fuse/components/navigation/navigation.types'; import { FuseNavigationItem, FuseVerticalNavigationAppearance, FuseVerticalNavigationMode, FuseVerticalNavigationPosition } from '@fuse/components/navigation/navigation.types';
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service'; import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
import { FuseScrollbarDirective } from '@fuse/directives/scrollbar/scrollbar.directive'; import { FuseScrollbarDirective } from '@fuse/directives/scrollbar/scrollbar.directive';
@ -15,16 +15,18 @@ import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
selector : 'fuse-vertical-navigation', selector : 'fuse-vertical-navigation',
templateUrl : './vertical.component.html', templateUrl : './vertical.component.html',
styleUrls : ['./vertical.component.scss'], styleUrls : ['./vertical.component.scss'],
animations : FuseAnimations, animations : fuseAnimations,
encapsulation : ViewEncapsulation.None, encapsulation : ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
exportAs : 'fuseVerticalNavigation' exportAs : 'fuseVerticalNavigation'
}) })
export class FuseVerticalNavigationComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy export class FuseVerticalNavigationComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_inner: BooleanInput; static ngAcceptInputType_inner: BooleanInput;
static ngAcceptInputType_opened: BooleanInput; static ngAcceptInputType_opened: BooleanInput;
static ngAcceptInputType_transparentOverlay: BooleanInput; static ngAcceptInputType_transparentOverlay: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() appearance: FuseVerticalNavigationAppearance = 'default'; @Input() appearance: FuseVerticalNavigationAppearance = 'default';
@Input() autoCollapse: boolean = true; @Input() autoCollapse: boolean = true;
@ -151,6 +153,40 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
}); });
} }
// -----------------------------------------------------------------------------------------------------
// @ Decorated methods
// -----------------------------------------------------------------------------------------------------
/**
* On mouseenter
*
* @private
*/
@HostListener('mouseenter')
private _onMouseenter(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = true;
}
/**
* On mouseleave
*
* @private
*/
@HostListener('mouseleave')
private _onMouseleave(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = false;
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks // @ Lifecycle hooks
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -672,36 +708,6 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
}); });
} }
/**
* On mouseenter
*
* @private
*/
@HostListener('mouseenter')
private _onMouseenter(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = true;
}
/**
* On mouseleave
*
* @private
*/
@HostListener('mouseleave')
private _onMouseleave(): void
{
// Enable the animations
this._enableAnimations();
// Set the hovered
this._hovered = false;
}
/** /**
* Open/close the navigation * Open/close the navigation
* *

View File

@ -7,7 +7,7 @@ import { Subject } from 'rxjs';
}) })
export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy
{ {
// tslint:disable-next-line:no-input-rename // eslint-disable-next-line @angular-eslint/no-input-rename
@Input('fuseAutogrowVerticalPadding') padding: number = 8; @Input('fuseAutogrowVerticalPadding') padding: number = 8;
@HostBinding('rows') private _rows: number = 1; @HostBinding('rows') private _rows: number = 1;
@ -41,6 +41,39 @@ export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy
}; };
} }
// -----------------------------------------------------------------------------------------------------
// @ Decorated methods
// -----------------------------------------------------------------------------------------------------
/**
* Resize on 'input' and 'ngModelChange' events
*
* @private
*/
@HostListener('input')
@HostListener('ngModelChange')
private _resize(): void
{
// This doesn't need to trigger Angular's change detection by itself
this._ngZone.runOutsideAngular(() => {
setTimeout(() => {
// Set the height to 'auto' so we can correctly read the scrollHeight
this._height = 'auto';
// Detect the changes so the height is applied
this._changeDetectorRef.detectChanges();
// Get the scrollHeight and subtract the vertical padding
this._height = `${this._elementRef.nativeElement.scrollHeight - this.padding}px`;
// Detect the changes one more time to apply the final height
this._changeDetectorRef.detectChanges();
});
});
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks // @ Lifecycle hooks
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -78,37 +111,4 @@ export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy
this._unsubscribeAll.next(); this._unsubscribeAll.next();
this._unsubscribeAll.complete(); this._unsubscribeAll.complete();
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Resize on 'input' and 'ngModelChange' events
*
* @private
*/
@HostListener('input')
@HostListener('ngModelChange')
private _resize(): void
{
// This doesn't need to trigger Angular's change detection by itself
this._ngZone.runOutsideAngular(() => {
setTimeout(() => {
// Set the height to 'auto' so we can correctly read the scrollHeight
this._height = 'auto';
// Detect the changes so the height is applied
this._changeDetectorRef.detectChanges();
// Get the scrollHeight and subtract the vertical padding
this._height = `${this._elementRef.nativeElement.scrollHeight - this.padding}px`;
// Detect the changes one more time to apply the final height
this._changeDetectorRef.detectChanges();
});
});
}
} }

View File

@ -17,7 +17,9 @@ import { ScrollbarGeometry, ScrollbarPosition } from '@fuse/directives/scrollbar
}) })
export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_fuseScrollbar: BooleanInput; static ngAcceptInputType_fuseScrollbar: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() fuseScrollbar: boolean = true; @Input() fuseScrollbar: boolean = true;
@Input() fuseScrollbarOptions: PerfectScrollbar.Options; @Input() fuseScrollbarOptions: PerfectScrollbar.Options;
@ -246,8 +248,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
/** /**
* Scroll to X * Scroll to X
* *
* @param {number} x * @param x
* @param {number} speed * @param speed
*/ */
scrollToX(x: number, speed?: number): void scrollToX(x: number, speed?: number): void
{ {
@ -257,8 +259,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
/** /**
* Scroll to Y * Scroll to Y
* *
* @param {number} y * @param y
* @param {number} speed * @param speed
*/ */
scrollToY(y: number, speed?: number): void scrollToY(y: number, speed?: number): void
{ {
@ -268,8 +270,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
/** /**
* Scroll to top * Scroll to top
* *
* @param {number} offset * @param offset
* @param {number} speed * @param speed
*/ */
scrollToTop(offset: number = 0, speed?: number): void scrollToTop(offset: number = 0, speed?: number): void
{ {
@ -279,8 +281,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
/** /**
* Scroll to bottom * Scroll to bottom
* *
* @param {number} offset * @param offset
* @param {number} speed * @param speed
*/ */
scrollToBottom(offset: number = 0, speed?: number): void scrollToBottom(offset: number = 0, speed?: number): void
{ {
@ -291,8 +293,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
/** /**
* Scroll to left * Scroll to left
* *
* @param {number} offset * @param offset
* @param {number} speed * @param speed
*/ */
scrollToLeft(offset: number = 0, speed?: number): void scrollToLeft(offset: number = 0, speed?: number): void
{ {
@ -302,8 +304,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
/** /**
* Scroll to right * Scroll to right
* *
* @param {number} offset * @param offset
* @param {number} speed * @param speed
*/ */
scrollToRight(offset: number = 0, speed?: number): void scrollToRight(offset: number = 0, speed?: number): void
{ {
@ -314,10 +316,10 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
/** /**
* Scroll to element * Scroll to element
* *
* @param {string} qs * @param qs
* @param {number} offset * @param offset
* @param {boolean} ignoreVisible If true, scrollToElement won't happen if element is already inside the current viewport * @param ignoreVisible If true, scrollToElement won't happen if element is already inside the current viewport
* @param {number} speed * @param speed
*/ */
scrollToElement(qs: string, offset: number = 0, ignoreVisible: boolean = false, speed?: number): void scrollToElement(qs: string, offset: number = 0, ignoreVisible: boolean = false, speed?: number): void
{ {

View File

@ -9,11 +9,11 @@ import { FuseMockApiMethods } from '@fuse/lib/mock-api/mock-api.types';
export class FuseMockApiService export class FuseMockApiService
{ {
private _handlers: { [key: string]: Map<string, FuseMockApiHandler> } = { private _handlers: { [key: string]: Map<string, FuseMockApiHandler> } = {
DELETE: new Map<string, FuseMockApiHandler>(), 'delete': new Map<string, FuseMockApiHandler>(),
GET : new Map<string, FuseMockApiHandler>(), 'get' : new Map<string, FuseMockApiHandler>(),
PATCH : new Map<string, FuseMockApiHandler>(), 'patch' : new Map<string, FuseMockApiHandler>(),
POST : new Map<string, FuseMockApiHandler>(), 'post' : new Map<string, FuseMockApiHandler>(),
PUT : new Map<string, FuseMockApiHandler>() 'put' : new Map<string, FuseMockApiHandler>()
}; };
/** /**
@ -34,10 +34,10 @@ export class FuseMockApiService
* @param method * @param method
* @param url * @param url
*/ */
findHandler(method: string, url: string): { handler: FuseMockApiHandler | undefined, urlParams: { [key: string]: string } } findHandler(method: string, url: string): { handler: FuseMockApiHandler | undefined; urlParams: { [key: string]: string } }
{ {
// Prepare the return object // Prepare the return object
const matchingHandler: { handler: FuseMockApiHandler | undefined, urlParams: { [key: string]: string } } = { const matchingHandler: { handler: FuseMockApiHandler | undefined; urlParams: { [key: string]: string } } = {
handler : undefined, handler : undefined,
urlParams: {} urlParams: {}
}; };
@ -46,7 +46,7 @@ export class FuseMockApiService
const urlParts = url.split('/'); const urlParts = url.split('/');
// Get all related request handlers // Get all related request handlers
const handlers = this._handlers[method.toUpperCase()]; const handlers = this._handlers[method.toLowerCase()];
// Iterate through the handlers // Iterate through the handlers
handlers.forEach((handler, handlerUrl) => { handlers.forEach((handler, handlerUrl) => {
@ -93,7 +93,7 @@ export class FuseMockApiService
*/ */
onDelete(url: string, delay?: number): FuseMockApiHandler onDelete(url: string, delay?: number): FuseMockApiHandler
{ {
return this._registerHandler('DELETE', url, delay); return this._registerHandler('delete', url, delay);
} }
/** /**
@ -104,7 +104,7 @@ export class FuseMockApiService
*/ */
onGet(url: string, delay?: number): FuseMockApiHandler onGet(url: string, delay?: number): FuseMockApiHandler
{ {
return this._registerHandler('GET', url, delay); return this._registerHandler('get', url, delay);
} }
/** /**
@ -115,7 +115,7 @@ export class FuseMockApiService
*/ */
onPatch(url: string, delay?: number): FuseMockApiHandler onPatch(url: string, delay?: number): FuseMockApiHandler
{ {
return this._registerHandler('PATCH', url, delay); return this._registerHandler('patch', url, delay);
} }
/** /**
@ -126,7 +126,7 @@ export class FuseMockApiService
*/ */
onPost(url: string, delay?: number): FuseMockApiHandler onPost(url: string, delay?: number): FuseMockApiHandler
{ {
return this._registerHandler('POST', url, delay); return this._registerHandler('post', url, delay);
} }
/** /**
@ -137,7 +137,7 @@ export class FuseMockApiService
*/ */
onPut(url: string, delay?: number): FuseMockApiHandler onPut(url: string, delay?: number): FuseMockApiHandler
{ {
return this._registerHandler('PUT', url, delay); return this._registerHandler('put', url, delay);
} }
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------

View File

@ -6,8 +6,8 @@ export type FuseMockApiReplyCallback =
| undefined; | undefined;
export type FuseMockApiMethods = export type FuseMockApiMethods =
| 'GET' | 'get'
| 'POST' | 'post'
| 'PUT' | 'put'
| 'PATCH' | 'patch'
| 'DELETE'; | 'delete';

View File

@ -16,7 +16,7 @@ export class FuseMockApiUtils
*/ */
static guid(): string static guid(): string
{ {
/* tslint:disable */ /* eslint-disable */
let d = new Date().getTime(); let d = new Date().getTime();
@ -32,6 +32,6 @@ export class FuseMockApiUtils
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
}); });
/* tslint:enable */ /* eslint-enable */
} }
} }

View File

@ -28,9 +28,7 @@ export class FuseFindByKeyPipe implements PipeTransform
// If the given value is an array of strings... // If the given value is an array of strings...
if ( Array.isArray(value) ) if ( Array.isArray(value) )
{ {
return value.map((item) => { return value.map(item => source.find(sourceItem => sourceItem[key] === item));
return source.find((sourceItem) => sourceItem[key] === item);
});
} }
// If the value is a string... // If the value is a string...

View File

@ -7,7 +7,7 @@ import { FuseTailwindService } from '@fuse/services/tailwind/tailwind.service';
@Injectable() @Injectable()
export class FuseMediaWatcherService export class FuseMediaWatcherService
{ {
private _onMediaChange: ReplaySubject<{ matchingAliases: string[], matchingQueries: any }> = new ReplaySubject<{ matchingAliases: string[], matchingQueries: any }>(1); private _onMediaChange: ReplaySubject<{ matchingAliases: string[]; matchingQueries: any }> = new ReplaySubject<{ matchingAliases: string[]; matchingQueries: any }>(1);
/** /**
* Constructor * Constructor
@ -18,7 +18,7 @@ export class FuseMediaWatcherService
) )
{ {
this._fuseTailwindConfigService.tailwindConfig$.pipe( this._fuseTailwindConfigService.tailwindConfig$.pipe(
switchMap((config) => this._breakpointObserver.observe(Object.values(config.breakpoints)).pipe( switchMap(config => this._breakpointObserver.observe(Object.values(config.breakpoints)).pipe(
map((state) => { map((state) => {
// Prepare the observable values and set their defaults // Prepare the observable values and set their defaults
@ -57,7 +57,7 @@ export class FuseMediaWatcherService
/** /**
* Getter for _onMediaChange * Getter for _onMediaChange
*/ */
get onMediaChange$(): Observable<{ matchingAliases: string[], matchingQueries: any }> get onMediaChange$(): Observable<{ matchingAliases: string[]; matchingQueries: any }>
{ {
return this._onMediaChange.asObservable(); return this._onMediaChange.asObservable();
} }

View File

@ -1,4 +1,3 @@
import { Version } from '@fuse/version/version'; import { Version } from '@fuse/version/version';
const __FUSE_VERSION__ = '12.3.0'; export const FUSE_VERSION = new Version('12.3.0').full;
export const FUSE_VERSION = new Version(__FUSE_VERSION__).full;

View File

@ -5,7 +5,7 @@ import { LayoutComponent } from 'app/layout/layout.component';
import { InitialDataResolver } from 'app/app.resolvers'; import { InitialDataResolver } from 'app/app.resolvers';
// @formatter:off // @formatter:off
// tslint:disable:max-line-length /* eslint-disable max-len */
export const appRoutes: Route[] = [ export const appRoutes: Route[] = [
// Redirect empty path to '/dashboards/project' // Redirect empty path to '/dashboards/project'

View File

@ -8,10 +8,10 @@ export interface InitialData
{ {
messages: Message[]; messages: Message[];
navigation: { navigation: {
compact: FuseNavigationItem[], compact: FuseNavigationItem[];
default: FuseNavigationItem[], default: FuseNavigationItem[];
futuristic: FuseNavigationItem[], futuristic: FuseNavigationItem[];
horizontal: FuseNavigationItem[] horizontal: FuseNavigationItem[];
}; };
notifications: Notification[]; notifications: Notification[];
shortcuts: Shortcut[]; shortcuts: Shortcut[];

View File

@ -29,12 +29,12 @@ export class AuthService
*/ */
set accessToken(token: string) set accessToken(token: string)
{ {
localStorage.setItem('access_token', token); localStorage.setItem('accessToken', token);
} }
get accessToken(): string get accessToken(): string
{ {
return localStorage.getItem('access_token') ?? ''; return localStorage.getItem('accessToken') ?? '';
} }
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -66,7 +66,7 @@ export class AuthService
* *
* @param credentials * @param credentials
*/ */
signIn(credentials: { email: string, password: string }): Observable<any> signIn(credentials: { email: string; password: string }): Observable<any>
{ {
// Throw error, if the user is already logged in // Throw error, if the user is already logged in
if ( this._authenticated ) if ( this._authenticated )
@ -78,7 +78,7 @@ export class AuthService
switchMap((response: any) => { switchMap((response: any) => {
// Store the access token in the local storage // Store the access token in the local storage
this.accessToken = response.access_token; this.accessToken = response.accessToken;
// Set the authenticated flag to true // Set the authenticated flag to true
this._authenticated = true; this._authenticated = true;
@ -99,17 +99,17 @@ export class AuthService
{ {
// Renew token // Renew token
return this._httpClient.post('api/auth/refresh-access-token', { return this._httpClient.post('api/auth/refresh-access-token', {
access_token: this.accessToken accessToken: this.accessToken
}).pipe( }).pipe(
catchError(() => { catchError(() =>
// Return false // Return false
return of(false); of(false)
}), ),
switchMap((response: any) => { switchMap((response: any) => {
// Store the access token in the local storage // Store the access token in the local storage
this.accessToken = response.access_token; this.accessToken = response.accessToken;
// Set the authenticated flag to true // Set the authenticated flag to true
this._authenticated = true; this._authenticated = true;
@ -129,7 +129,7 @@ export class AuthService
signOut(): Observable<any> signOut(): Observable<any>
{ {
// Remove the access token from the local storage // Remove the access token from the local storage
localStorage.removeItem('access_token'); localStorage.removeItem('accessToken');
// Set the authenticated flag to false // Set the authenticated flag to false
this._authenticated = false; this._authenticated = false;
@ -143,7 +143,7 @@ export class AuthService
* *
* @param user * @param user
*/ */
signUp(user: { name: string, email: string, password: string, company: string }): Observable<any> signUp(user: { name: string; email: string; password: string; company: string }): Observable<any>
{ {
return this._httpClient.post('api/auth/sign-up', user); return this._httpClient.post('api/auth/sign-up', user);
} }
@ -153,7 +153,7 @@ export class AuthService
* *
* @param credentials * @param credentials
*/ */
unlockSession(credentials: { email: string, password: string }): Observable<any> unlockSession(credentials: { email: string; password: string }): Observable<any>
{ {
return this._httpClient.post('api/auth/unlock-session', credentials); return this._httpClient.post('api/auth/unlock-session', credentials);
} }

View File

@ -14,6 +14,38 @@ export class AuthUtils
{ {
} }
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Is token expired?
*
* @param token
* @param offsetSeconds
*/
static isTokenExpired(token: string, offsetSeconds?: number): boolean
{
// Return if there is no token
if ( !token || token === '' )
{
return true;
}
// Get the expiration date
const date = this._getTokenExpirationDate(token);
offsetSeconds = offsetSeconds || 0;
if ( date === null )
{
return true;
}
// Check if the token is expired
return !(date.valueOf() > new Date().valueOf() + offsetSeconds * 1000);
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Private methods // @ Private methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -39,7 +71,7 @@ export class AuthUtils
); );
} }
/* tslint:disable */ /* eslint-disable */
for ( for (
// initialize result and counters // initialize result and counters
let bc = 0, bs: any, buffer: any, idx = 0; let bc = 0, bs: any, buffer: any, idx = 0;
@ -60,7 +92,7 @@ export class AuthUtils
// try to find character in table (0-63, not found => -1) // try to find character in table (0-63, not found => -1)
buffer = chars.indexOf(buffer); buffer = chars.indexOf(buffer);
} }
/* tslint:enable */ /* eslint-enable */
return output; return output;
} }
@ -75,9 +107,7 @@ export class AuthUtils
{ {
return decodeURIComponent( return decodeURIComponent(
Array.prototype.map Array.prototype.map
.call(this._b64decode(str), (c: any) => { .call(this._b64decode(str), (c: any) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join('') .join('')
); );
} }
@ -171,36 +201,4 @@ export class AuthUtils
return date; return date;
} }
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Is token expired?
*
* @param token
* @param offsetSeconds
*/
static isTokenExpired(token: string, offsetSeconds?: number): boolean
{
// Return if there is no token
if ( !token || token === '' )
{
return true;
}
// Get the expiration date
const date = this._getTokenExpirationDate(token);
offsetSeconds = offsetSeconds || 0;
if ( date === null )
{
return true;
}
// Check if the token is expired
return !(date.valueOf() > new Date().valueOf() + offsetSeconds * 1000);
}
} }

View File

@ -19,39 +19,6 @@ export class AuthGuard implements CanActivate, CanActivateChild, CanLoad
{ {
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Check the authenticated status
*
* @param redirectURL
* @private
*/
private _check(redirectURL: string): Observable<boolean>
{
// Check the authentication status
return this._authService.check()
.pipe(
switchMap((authenticated) => {
// If the user is not authenticated...
if ( !authenticated )
{
// Redirect to the sign-in page
this._router.navigate(['sign-in'], {queryParams: {redirectURL}});
// Prevent the access
return of(false);
}
// Allow the access
return of(true);
})
);
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Public methods // @ Public methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -90,4 +57,37 @@ export class AuthGuard implements CanActivate, CanActivateChild, CanLoad
{ {
return this._check('/'); return this._check('/');
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Check the authenticated status
*
* @param redirectURL
* @private
*/
private _check(redirectURL: string): Observable<boolean>
{
// Check the authentication status
return this._authService.check()
.pipe(
switchMap((authenticated) => {
// If the user is not authenticated...
if ( !authenticated )
{
// Redirect to the sign-in page
this._router.navigate(['sign-in'], {queryParams: {redirectURL}});
// Prevent the access
return of(false);
}
// Allow the access
return of(true);
})
);
}
} }

View File

@ -19,38 +19,6 @@ export class NoAuthGuard implements CanActivate, CanActivateChild, CanLoad
{ {
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Check the authenticated status
*
* @private
*/
private _check(): Observable<boolean>
{
// Check the authentication status
return this._authService.check()
.pipe(
switchMap((authenticated) => {
// If the user is authenticated...
if ( authenticated )
{
// Redirect to the root
this._router.navigate(['']);
// Prevent the access
return of(false);
}
// Allow the access
return of(true);
})
);
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Public methods // @ Public methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -87,4 +55,36 @@ export class NoAuthGuard implements CanActivate, CanActivateChild, CanLoad
{ {
return this._check(); return this._check();
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Check the authenticated status
*
* @private
*/
private _check(): Observable<boolean>
{
// Check the authentication status
return this._authService.check()
.pipe(
switchMap((authenticated) => {
// If the user is authenticated...
if ( authenticated )
{
// Redirect to the root
this._router.navigate(['']);
// Prevent the access
return of(false);
}
// Allow the access
return of(true);
})
);
}
} }

View File

@ -3,14 +3,14 @@ import { FormControl } from '@angular/forms';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { debounceTime, filter, map, takeUntil } from 'rxjs/operators'; import { debounceTime, filter, map, takeUntil } from 'rxjs/operators';
import { FuseAnimations } from '@fuse/animations/public-api'; import { fuseAnimations } from '@fuse/animations/public-api';
@Component({ @Component({
selector : 'search', selector : 'search',
templateUrl : './search.component.html', templateUrl : './search.component.html',
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
exportAs : 'fuseSearch', exportAs : 'fuseSearch',
animations : FuseAnimations animations : fuseAnimations
}) })
export class SearchComponent implements OnChanges, OnInit, OnDestroy export class SearchComponent implements OnChanges, OnInit, OnDestroy
{ {
@ -115,12 +115,9 @@ export class SearchComponent implements OnChanges, OnInit, OnDestroy
// Continue // Continue
return value; return value;
}), }),
filter((value) => {
// Filter out undefined/null/false statements and also // Filter out undefined/null/false statements and also
// filter out the values that are smaller than minLength // filter out the values that are smaller than minLength
return value && value.length >= this.minLength; filter(value => value && value.length >= this.minLength)
})
) )
.subscribe((value) => { .subscribe((value) => {
this._httpClient.post('api/common/search', {query: value}) this._httpClient.post('api/common/search', {query: value})

View File

@ -28,9 +28,7 @@ import { SearchComponent } from 'app/layout/common/search/search.component';
providers : [ providers : [
{ {
provide : MAT_AUTOCOMPLETE_SCROLL_STRATEGY, provide : MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
useFactory: (overlay: Overlay) => { useFactory: (overlay: Overlay) => () => overlay.scrollStrategies.block(),
return () => overlay.scrollStrategies.block();
},
deps : [Overlay] deps : [Overlay]
} }
] ]

View File

@ -15,7 +15,9 @@ import { UserService } from 'app/core/user/user.service';
}) })
export class UserMenuComponent implements OnInit, OnDestroy export class UserMenuComponent implements OnInit, OnDestroy
{ {
/* eslint-disable @typescript-eslint/naming-convention */
static ngAcceptInputType_showAvatar: BooleanInput; static ngAcceptInputType_showAvatar: BooleanInput;
/* eslint-enable @typescript-eslint/naming-convention */
@Input() showAvatar: boolean = true; @Input() showAvatar: boolean = true;
user: User; user: User;

View File

@ -74,7 +74,7 @@ export class AcademyMockApi
const steps = cloneDeep(this._demoCourseSteps); const steps = cloneDeep(this._demoCourseSteps);
// Find the course and attach steps to it // Find the course and attach steps to it
const course = courses.find((item) => item.id === id); const course = courses.find(item => item.id === id);
if ( course ) if ( course )
{ {
course.steps = steps; course.steps = steps;

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
export const categories = [ export const categories = [
{ {
id : '9a67dff7-3c38-4052-a335-0cef93438ff6', id : '9a67dff7-3c38-4052-a335-0cef93438ff6',

View File

@ -110,11 +110,11 @@ export class CalendarMockApi
const id = request.params.get('id'); const id = request.params.get('id');
// Find the calendar and delete it // Find the calendar and delete it
const index = this._calendars.findIndex((calendar) => calendar.id === id); const index = this._calendars.findIndex(calendar => calendar.id === id);
this._calendars.splice(index, 1); this._calendars.splice(index, 1);
// Find the events that belong to the calendar and remove them as well // Find the events that belong to the calendar and remove them as well
this._events = this._events.filter((event) => event.calendarId !== id); this._events = this._events.filter(event => event.calendarId !== id);
// Return the response // Return the response
return [200, true]; return [200, true];
@ -287,7 +287,7 @@ export class CalendarMockApi
const id = request.params.get('id'); const id = request.params.get('id');
// Find the event and delete it // Find the event and delete it
const index = this._events.findIndex((item) => item.id === id); const index = this._events.findIndex(item => item.id === id);
this._events.splice(index, 1); this._events.splice(index, 1);
// Return the response // Return the response
@ -307,7 +307,7 @@ export class CalendarMockApi
const mode = request.body.mode; const mode = request.body.mode;
// Find the original recurring event from db // Find the original recurring event from db
const recurringEvent = this._events.find((item) => item.id === event.recurringEventId); const recurringEvent = this._events.find(item => item.id === event.recurringEventId);
// Single // Single
if ( mode === 'single' ) if ( mode === 'single' )
@ -406,7 +406,7 @@ export class CalendarMockApi
if ( mode === 'all' ) if ( mode === 'all' )
{ {
// Find the event index // Find the event index
const eventIndex = this._events.findIndex((item) => item.id === event.recurringEventId); const eventIndex = this._events.findIndex(item => item.id === event.recurringEventId);
// Update the recurring event // Update the recurring event
this._events[eventIndex] = assign({}, this._events[eventIndex], omit(event, ['id', 'recurringEventId', 'range'])); this._events[eventIndex] = assign({}, this._events[eventIndex], omit(event, ['id', 'recurringEventId', 'range']));
@ -428,7 +428,7 @@ export class CalendarMockApi
const mode = request.params.get('mode'); const mode = request.params.get('mode');
// Find the recurring event // Find the recurring event
const recurringEvent = this._events.find((item) => item.id === event.recurringEventId); const recurringEvent = this._events.find(item => item.id === event.recurringEventId);
// Single // Single
if ( mode === 'single' ) if ( mode === 'single' )
@ -495,7 +495,7 @@ export class CalendarMockApi
if ( mode === 'all' ) if ( mode === 'all' )
{ {
// Find the event and delete it // Find the event and delete it
const index = this._events.findIndex((item) => item.id === event.recurringEventId); const index = this._events.findIndex(item => item.id === event.recurringEventId);
this._events.splice(index, 1); this._events.splice(index, 1);
} }

View File

@ -1,6 +1,6 @@
/* eslint-disable */
import * as moment from 'moment'; import * as moment from 'moment';
/* tslint:disable:max-line-length */
export const calendars = [ export const calendars = [
{ {
id : '1a470c8e-40ed-4c2d-b590-a4f1f6ead6cc', id : '1a470c8e-40ed-4c2d-b590-a4f1f6ead6cc',

View File

@ -22,12 +22,12 @@ export class ChatMockApi
this.registerHandlers(); this.registerHandlers();
// Modify the chats array to attach certain data to it // Modify the chats array to attach certain data to it
this._chats = this._chats.map((chat) => ({ this._chats = this._chats.map(chat => ({
...chat, ...chat,
// Get the actual contact object from the id and attach it to the chat // Get the actual contact object from the id and attach it to the chat
contact: this._contacts.find((contact) => contact.id === chat.contactId), contact: this._contacts.find(contact => contact.id === chat.contactId),
// Since we use same set of messages on all chats, we assign them here. // Since we use same set of messages on all chats, we assign them here.
messages: this._messages.map((message) => ({ messages: this._messages.map(message => ({
...message, ...message,
chatId : chat.id, chatId : chat.id,
contactId: message.contactId === 'me' ? this._profile.id : chat.contactId, contactId: message.contactId === 'me' ? this._profile.id : chat.contactId,
@ -73,7 +73,7 @@ export class ChatMockApi
const chats = cloneDeep(this._chats); const chats = cloneDeep(this._chats);
// Find the chat we need // Find the chat we need
const chat = chats.find((item) => item.id === id); const chat = chats.find(item => item.id === id);
// Return the response // Return the response
return [200, chat]; return [200, chat];
@ -124,7 +124,7 @@ export class ChatMockApi
contacts.sort((a, b) => a.name.localeCompare(b.name)); contacts.sort((a, b) => a.name.localeCompare(b.name));
// Omit details and attachments from contacts // Omit details and attachments from contacts
contacts = contacts.map((contact) => omit(contact, ['details', 'attachments'])); contacts = contacts.map(contact => omit(contact, ['details', 'attachments']));
// Return the response // Return the response
return [200, contacts]; return [200, contacts];
@ -144,7 +144,7 @@ export class ChatMockApi
const contacts = cloneDeep(this._contacts); const contacts = cloneDeep(this._contacts);
// Find the contact // Find the contact
const contact = contacts.find((item) => item.id === id); const contact = contacts.find(item => item.id === id);
// Return the response // Return the response
return [200, contact]; return [200, contact];

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,7 @@ export class ContactsMockApi
if ( query ) if ( query )
{ {
// Filter the contacts // Filter the contacts
contacts = contacts.filter((contact) => contact.name && contact.name.toLowerCase().includes(query.toLowerCase())); contacts = contacts.filter(contact => contact.name && contact.name.toLowerCase().includes(query.toLowerCase()));
} }
// Sort the contacts by the name field by default // Sort the contacts by the name field by default
@ -90,9 +90,7 @@ export class ContactsMockApi
const contacts = cloneDeep(this._contacts); const contacts = cloneDeep(this._contacts);
// Find the contact // Find the contact
const contact = contacts.find((item) => { const contact = contacts.find(item => item.id === id);
return item.id === id;
});
// Return the response // Return the response
return [200, contact]; return [200, contact];
@ -288,10 +286,10 @@ export class ContactsMockApi
* *
* @param file * @param file
*/ */
const readAsDataURL = (file: File): Promise<any> => { const readAsDataURL = (file: File): Promise<any> =>
// Return a new promise // Return a new promise
return new Promise((resolve, reject) => { new Promise((resolve, reject) => {
// Create a new reader // Create a new reader
const reader = new FileReader(); const reader = new FileReader();
@ -308,8 +306,8 @@ export class ContactsMockApi
// Read the file as the // Read the file as the
reader.readAsDataURL(file); reader.readAsDataURL(file);
}); })
}; ;
this._fuseMockApiService this._fuseMockApiService
.onPost('api/apps/contacts/avatar') .onPost('api/apps/contacts/avatar')

File diff suppressed because it is too large Load Diff

View File

@ -81,9 +81,7 @@ export class ECommerceInventoryMockApi
if ( search ) if ( search )
{ {
// Filter the products // Filter the products
products = products.filter((contact) => { products = products.filter(contact => contact.name && contact.name.toLowerCase().includes(search.toLowerCase()));
return contact.name && contact.name.toLowerCase().includes(search.toLowerCase());
});
} }
// Paginate - Start // Paginate - Start
@ -148,9 +146,7 @@ export class ECommerceInventoryMockApi
const products = cloneDeep(this._products); const products = cloneDeep(this._products);
// Find the product // Find the product
const product = products.find((item) => { const product = products.find(item => item.id === id);
return item.id === id;
});
// Return the response // Return the response
return [200, product]; return [200, product];

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
export const categories = [ export const categories = [
{ {
id : 'b899ec30-b85a-40ab-bb1f-18a596d5c6de', id : 'b899ec30-b85a-40ab-bb1f-18a596d5c6de',

View File

@ -39,8 +39,8 @@ export class FileManagerMockApi
const items = cloneDeep(this._items); const items = cloneDeep(this._items);
// Separate the items by folders and files // Separate the items by folders and files
const folders = items.filter((item) => item.type === 'folder'); const folders = items.filter(item => item.type === 'folder');
const files = items.filter((item) => item.type !== 'folder'); const files = items.filter(item => item.type !== 'folder');
// Sort the folders and files alphabetically by filename // Sort the folders and files alphabetically by filename
folders.sort((a, b) => a.name.localeCompare(b.name)); folders.sort((a, b) => a.name.localeCompare(b.name));

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
export const items = [ export const items = [
{ {
id : 'cd6897cb-acfd-4016-8b53-3f66a5b5fc68', id : 'cd6897cb-acfd-4016-8b53-3f66a5b5fc68',
@ -175,5 +175,5 @@ export const items = [
type : 'XLS', type : 'XLS',
contents : null, contents : null,
description: null description: null
}, }
]; ];

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
export const faqCategories = [ export const faqCategories = [
{ {
id : '28924eab-97cc-465a-ba21-f232bb95843f', id : '28924eab-97cc-465a-ba21-f232bb95843f',

View File

@ -69,7 +69,7 @@ export class MailboxMockApi
this._folders.forEach((folder) => { this._folders.forEach((folder) => {
// Get the mails of this folder // Get the mails of this folder
const mails = this._mails.filter((mail) => mail.folder === folder.id); const mails = this._mails.filter(mail => mail.folder === folder.id);
// If we are counting the 'sent' or the 'trash' folder... // If we are counting the 'sent' or the 'trash' folder...
if ( folder.slug === 'sent' || folder.slug === 'trash' ) if ( folder.slug === 'sent' || folder.slug === 'trash' )
@ -148,9 +148,7 @@ export class MailboxMockApi
do do
{ {
sameSlug = this._labels.filter((item) => { sameSlug = this._labels.filter(item => item.slug === label.slug);
return item.slug === label.slug;
});
if ( sameSlug.length > 0 ) if ( sameSlug.length > 0 )
{ {
@ -215,13 +213,11 @@ export class MailboxMockApi
const id = request.params.get('id'); const id = request.params.get('id');
// Find the label and delete it // Find the label and delete it
const index = this._labels.findIndex((item) => item.id === id); const index = this._labels.findIndex(item => item.id === id);
this._labels.splice(index, 1); this._labels.splice(index, 1);
// Get all the mails that have the label // Get all the mails that have the label
const mailsWithLabel = this._mails.filter((mail) => { const mailsWithLabel = this._mails.filter(mail => mail.labels.indexOf(id) > -1);
return mail.labels.indexOf(id) > -1;
});
// Iterate through them and remove the label // Iterate through them and remove the label
mailsWithLabel.forEach((mail) => { mailsWithLabel.forEach((mail) => {
@ -267,9 +263,7 @@ export class MailboxMockApi
}); });
// Sort by date - descending // Sort by date - descending
mails.sort((a, b) => { mails.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
return new Date(b.date).getTime() - new Date(a.date).getTime();
});
// Figure out the cc and bcc counts // Figure out the cc and bcc counts
mails.forEach((mail) => { mails.forEach((mail) => {
@ -343,7 +337,7 @@ export class MailboxMockApi
const mails = cloneDeep(this._mails); const mails = cloneDeep(this._mails);
// Find the mail // Find the mail
const mail = mails.find((item) => item.id === id); const mail = mails.find(item => item.id === id);
return [ return [
200, 200,

View File

@ -1,6 +1,6 @@
/* eslint-disable */
import * as moment from 'moment'; import * as moment from 'moment';
/* tslint:disable:max-line-length */
export const folders = [ export const folders = [
{ {
id : '7c004a19-4506-48ef-93ab-f16381302e3b', id : '7c004a19-4506-48ef-93ab-f16381302e3b',

View File

@ -35,13 +35,10 @@ export class NotesMockApi
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
this._fuseMockApiService this._fuseMockApiService
.onGet('api/apps/notes/labels') .onGet('api/apps/notes/labels')
.reply(() => { .reply(() => [
return [
200, 200,
cloneDeep(this._labels) cloneDeep(this._labels)
]; ]);
});
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Labels - POST // @ Labels - POST
@ -105,12 +102,12 @@ export class NotesMockApi
const id = request.params.get('id'); const id = request.params.get('id');
// Delete the label // Delete the label
this._labels = this._labels.filter((label) => label.id !== id); this._labels = this._labels.filter(label => label.id !== id);
// Go through notes and delete the label // Go through notes and delete the label
this._notes = this._notes.map((note) => ({ this._notes = this._notes.map(note => ({
...note, ...note,
labels: note.labels.filter((item) => item !== id) labels: note.labels.filter(item => item !== id)
})); }));
return [ return [
@ -175,10 +172,10 @@ export class NotesMockApi
let notes = cloneDeep(this._notes); let notes = cloneDeep(this._notes);
// Attach the labels to the notes // Attach the labels to the notes
notes = notes.map((note) => ( notes = notes.map(note => (
{ {
...note, ...note,
labels: note.labels.map((labelId) => labels.find((label) => label.id === labelId)) labels: note.labels.map(labelId => labels.find(label => label.id === labelId))
} }
)); ));

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
import moment from 'moment'; import moment from 'moment';
export const labels = [ export const labels = [

View File

@ -35,13 +35,10 @@ export class TasksMockApi
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
this._fuseMockApiService this._fuseMockApiService
.onGet('api/apps/tasks/tags') .onGet('api/apps/tasks/tags')
.reply(() => { .reply(() => [
return [
200, 200,
cloneDeep(this._tags) cloneDeep(this._tags)
]; ]);
});
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Tags - POST // @ Tags - POST
@ -109,7 +106,7 @@ export class TasksMockApi
const id = request.params.get('id'); const id = request.params.get('id');
// Find the tag and delete it // Find the tag and delete it
const index = this._tags.findIndex((item) => item.id === id); const index = this._tags.findIndex(item => item.id === id);
this._tags.splice(index, 1); this._tags.splice(index, 1);
// Get the tasks that have the tag // Get the tasks that have the tag
@ -165,9 +162,8 @@ export class TasksMockApi
let tasks = cloneDeep(this._tasks); let tasks = cloneDeep(this._tasks);
// Filter the tasks // Filter the tasks
tasks = tasks.filter((task) => { tasks = tasks.filter(task => task.title && task.title.toLowerCase().includes(query.toLowerCase()) || task.notes && task.notes.toLowerCase()
return task.title && task.title.toLowerCase().includes(query.toLowerCase()) || task.notes && task.notes.toLowerCase().includes(query.toLowerCase()); .includes(query.toLowerCase()));
});
// Mark the found chars // Mark the found chars
tasks.forEach((task) => { tasks.forEach((task) => {
@ -231,7 +227,7 @@ export class TasksMockApi
const tasks = cloneDeep(this._tasks); const tasks = cloneDeep(this._tasks);
// Find the task // Find the task
const task = tasks.find((item) => item.id === id); const task = tasks.find(item => item.id === id);
return [ return [
200, 200,
@ -317,7 +313,7 @@ export class TasksMockApi
const id = request.params.get('id'); const id = request.params.get('id');
// Find the task and delete it // Find the task and delete it
const index = this._tasks.findIndex((item) => item.id === id); const index = this._tasks.findIndex(item => item.id === id);
this._tasks.splice(index, 1); this._tasks.splice(index, 1);
return [ return [

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
export const tags = [ export const tags = [
{ {
id : 'a0bf42ca-c3a5-47be-8341-b9c0bb8ef270', id : 'a0bf42ca-c3a5-47be-8341-b9c0bb8ef270',

View File

@ -40,28 +40,24 @@ export class AuthMockApi
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
this._fuseMockApiService this._fuseMockApiService
.onPost('api/auth/forgot-password', 1000) .onPost('api/auth/forgot-password', 1000)
.reply(() => { .reply(() =>
[
// Simply return true
return [
200, 200,
true true
]; ]
}); );
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Reset password - POST // @ Reset password - POST
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
this._fuseMockApiService this._fuseMockApiService
.onPost('api/auth/reset-password', 1000) .onPost('api/auth/reset-password', 1000)
.reply(() => { .reply(() =>
[
// Simply return true
return [
200, 200,
true true
]; ]
}); );
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Sign in - POST // @ Sign in - POST
@ -77,8 +73,8 @@ export class AuthMockApi
200, 200,
{ {
user : cloneDeep(this._user), user : cloneDeep(this._user),
access_token: this._generateJWTToken(), accessToken: this._generateJWTToken(),
token_type : 'bearer' tokenType : 'bearer'
} }
]; ];
} }
@ -98,7 +94,7 @@ export class AuthMockApi
.reply(({request}) => { .reply(({request}) => {
// Get the access token // Get the access token
const accessToken = request.body.access_token; const accessToken = request.body.accessToken;
// Verify the token // Verify the token
if ( this._verifyJWTToken(accessToken) ) if ( this._verifyJWTToken(accessToken) )
@ -107,8 +103,8 @@ export class AuthMockApi
200, 200,
{ {
user : cloneDeep(this._user), user : cloneDeep(this._user),
access_token: this._generateJWTToken(), accessToken: this._generateJWTToken(),
token_type : 'bearer' tokenType : 'bearer'
} }
]; ];
} }
@ -127,14 +123,14 @@ export class AuthMockApi
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
this._fuseMockApiService this._fuseMockApiService
.onPost('api/auth/sign-up', 1500) .onPost('api/auth/sign-up', 1500)
.reply(() => { .reply(() =>
// Simply return true // Simply return true
return [ [
200, 200,
true true
]; ]
}); );
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Unlock session - POST // @ Unlock session - POST
@ -150,8 +146,8 @@ export class AuthMockApi
200, 200,
{ {
user : cloneDeep(this._user), user : cloneDeep(this._user),
access_token: this._generateJWTToken(), accessToken: this._generateJWTToken(),
token_type : 'bearer' tokenType : 'bearer'
} }
]; ];
} }

View File

@ -1,7 +1,7 @@
/* eslint-disable */
import * as moment from 'moment'; import * as moment from 'moment';
import { Message } from 'app/layout/common/messages/messages.types'; import { Message } from 'app/layout/common/messages/messages.types';
/* tslint:disable:max-line-length */
export const messages: Message[] = [ export const messages: Message[] = [
{ {
id : '832276cc-c5e9-4fcc-8e23-d38e2e267bc9', id : '832276cc-c5e9-4fcc-8e23-d38e2e267bc9',

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
import { FuseNavigationItem } from '@fuse/components/navigation'; import { FuseNavigationItem } from '@fuse/components/navigation';
export const defaultNavigation: FuseNavigationItem[] = [ export const defaultNavigation: FuseNavigationItem[] = [

View File

@ -1,7 +1,7 @@
/* eslint-disable */
import * as moment from 'moment'; import * as moment from 'moment';
import { Notification } from 'app/layout/common/notifications/notifications.types'; import { Notification } from 'app/layout/common/notifications/notifications.types';
/* tslint:disable:max-line-length */
export const notifications: Notification[] = [ export const notifications: Notification[] = [
{ {
id : '493190c9-5b61-4912-afe5-78c21f1044d7', id : '493190c9-5b61-4912-afe5-78c21f1044d7',

View File

@ -55,14 +55,10 @@ export class SearchMockApi
} }
// Filter the navigation // Filter the navigation
const navigationResults = cloneDeep(flatNavigation).filter((item) => { const navigationResults = cloneDeep(flatNavigation).filter(item => (item.title?.toLowerCase().includes(query) || (item.subtitle && item.subtitle.includes(query))));
return (item.title?.toLowerCase().includes(query) || (item.subtitle && item.subtitle.includes(query)));
});
// Filter the contacts // Filter the contacts
const contactsResults = cloneDeep(this._contacts).filter((user) => { const contactsResults = cloneDeep(this._contacts).filter(user => user.name.toLowerCase().includes(query));
return user.name.toLowerCase().includes(query);
});
// Create the results array // Create the results array
const results = []; const results = [];

View File

@ -1,6 +1,6 @@
/* eslint-disable */
import { Shortcut } from 'app/layout/common/shortcuts/shortcuts.types'; import { Shortcut } from 'app/layout/common/shortcuts/shortcuts.types';
/* tslint:disable:max-line-length */
export const shortcuts: Shortcut[] = [ export const shortcuts: Shortcut[] = [
{ {
id : 'a1ae91d3-e2cb-459b-9be9-a184694f548b', id : 'a1ae91d3-e2cb-459b-9be9-a184694f548b',

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
export const user: any = { export const user: any = {
id : 'cfaad35d-07a3-4447-a6c3-d8c3d54fd5df', id : 'cfaad35d-07a3-4447-a6c3-d8c3d54fd5df',
name : 'Brian Hughes', name : 'Brian Hughes',

View File

@ -1,6 +1,6 @@
/* eslint-disable */
import * as moment from 'moment'; import * as moment from 'moment';
/* tslint:disable:max-line-length */
export const analytics = { export const analytics = {
visitors : { visitors : {
series: { series: {

View File

@ -1,6 +1,6 @@
/* eslint-disable */
import * as moment from 'moment'; import * as moment from 'moment';
/* tslint:disable:max-line-length */
export const project = { export const project = {
githubIssues : { githubIssues : {
overview: { overview: {

View File

@ -1,4 +1,4 @@
/* tslint:disable:max-line-length */ /* eslint-disable */
// Updated at: 20210425 - 1792 icons // Updated at: 20210425 - 1792 icons
export const material = [ export const material = [

View File

@ -48,7 +48,8 @@
<div class="py-2 px-8"> <div class="py-2 px-8">
<ol> <ol>
<ng-container *ngFor="let step of course.steps; let last = last; trackBy: trackByFn"> <ng-container *ngFor="let step of course.steps; let last = last; trackBy: trackByFn">
<li class="relative group py-6" <li
class="relative group py-6"
[class.current-step]="step.order === currentStep"> [class.current-step]="step.order === currentStep">
<ng-container *ngIf="!last"> <ng-container *ngIf="!last">
<div <div

View File

@ -81,23 +81,21 @@ export class AcademyListComponent implements OnInit, OnDestroy
// Filter by category // Filter by category
if ( categorySlug !== 'all' ) if ( categorySlug !== 'all' )
{ {
this.filteredCourses = this.filteredCourses.filter((course) => course.category === categorySlug); this.filteredCourses = this.filteredCourses.filter(course => course.category === categorySlug);
} }
// Filter by search query // Filter by search query
if ( query !== '' ) if ( query !== '' )
{ {
this.filteredCourses = this.filteredCourses.filter((course) => { this.filteredCourses = this.filteredCourses.filter(course => course.title.toLowerCase().includes(query.toLowerCase())
return course.title.toLowerCase().includes(query.toLowerCase())
|| course.description.toLowerCase().includes(query.toLowerCase()) || course.description.toLowerCase().includes(query.toLowerCase())
|| course.category.toLowerCase().includes(query.toLowerCase()); || course.category.toLowerCase().includes(query.toLowerCase()));
});
} }
// Filter by completed // Filter by completed
if ( hideCompleted ) if ( hideCompleted )
{ {
this.filteredCourses = this.filteredCourses.filter((course) => course.progress.completed === 0); this.filteredCourses = this.filteredCourses.filter(course => course.progress.completed === 0);
} }
}); });
} }

View File

@ -243,10 +243,8 @@ export class CalendarComponent implements OnInit, AfterViewInit, OnDestroy
day : 'numeric', day : 'numeric',
omitCommas: true omitCommas: true
}, },
columnHeaderHtml : (date) => { columnHeaderHtml : date => `<span class="fc-weekday">${moment(date).format('ddd')}</span>
return `<span class="fc-weekday">${moment(date).format('ddd')}</span> <span class="fc-date">${moment(date).format('D')}</span>`,
<span class="fc-date">${moment(date).format('D')}</span>`;
},
slotDuration : '01:00:00', slotDuration : '01:00:00',
slotLabelFormat : this.eventTimeFormat slotLabelFormat : this.eventTimeFormat
}, },
@ -386,7 +384,7 @@ export class CalendarComponent implements OnInit, AfterViewInit, OnDestroy
return; return;
} }
return this.calendars.find((calendar) => calendar.id === id); return this.calendars.find(calendar => calendar.id === id);
} }
/** /**
@ -552,7 +550,7 @@ export class CalendarComponent implements OnInit, AfterViewInit, OnDestroy
onEventRender(calendarEvent): void onEventRender(calendarEvent): void
{ {
// Get event's calendar // Get event's calendar
const calendar = this.calendars.find((item) => item.id === calendarEvent.event.extendedProps.calendarId); const calendar = this.calendars.find(item => item.id === calendarEvent.event.extendedProps.calendarId);
// Return if the calendar doesn't exist... // Return if the calendar doesn't exist...
if ( !calendar ) if ( !calendar )
@ -779,6 +777,7 @@ export class CalendarComponent implements OnInit, AfterViewInit, OnDestroy
/** /**
* Create the event panel overlay * Create the event panel overlay
*
* @private * @private
*/ */
private _createEventPanelOverlay(positionStrategy): void private _createEventPanelOverlay(positionStrategy): void

View File

@ -13,7 +13,7 @@ export class CalendarService
// Private // Private
private _calendars: BehaviorSubject<Calendar[] | null> = new BehaviorSubject(null); private _calendars: BehaviorSubject<Calendar[] | null> = new BehaviorSubject(null);
private _events: BehaviorSubject<CalendarEvent[] | null> = new BehaviorSubject(null); private _events: BehaviorSubject<CalendarEvent[] | null> = new BehaviorSubject(null);
private _loadedEventsRange: { start: Moment | null, end: Moment | null } = { private _loadedEventsRange: { start: Moment | null; end: Moment | null } = {
start: null, start: null,
end : null end : null
}; };
@ -163,7 +163,7 @@ export class CalendarService
this._calendars.next(calendars); this._calendars.next(calendars);
// Remove the events belong to deleted calendar // Remove the events belong to deleted calendar
const events = this._events.value.filter((event) => event.calendarId !== id); const events = this._events.value.filter(event => event.calendarId !== id);
// Update the events // Update the events
this._events.next(events); this._events.next(events);

View File

@ -212,7 +212,7 @@ export class CalendarRecurrenceComponent implements OnInit, OnDestroy
5: 'th' 5: 'th'
}; };
this.nthWeekdayText = nthWeekday.slice(0, 1) + ordinalNumberSuffixes[nthWeekday.slice(0, 1)] + ' ' + this.nthWeekdayText = nthWeekday.slice(0, 1) + ordinalNumberSuffixes[nthWeekday.slice(0, 1)] + ' ' +
this.weekdays.find((item) => item.value === nthWeekday.slice(-2)).label; this.weekdays.find(item => item.value === nthWeekday.slice(-2)).label;
// Set the defaults on recurrence form values // Set the defaults on recurrence form values
this.recurrenceFormValues = { this.recurrenceFormValues = {

View File

@ -15,8 +15,8 @@ import { calendarColors } from 'app/modules/admin/apps/calendar/sidebar/calendar
}) })
export class CalendarSidebarComponent implements OnInit, OnDestroy export class CalendarSidebarComponent implements OnInit, OnDestroy
{ {
@ViewChild('editPanel') private _editPanel: TemplateRef<any>;
@Output() readonly calendarUpdated: EventEmitter<any> = new EventEmitter<any>(); @Output() readonly calendarUpdated: EventEmitter<any> = new EventEmitter<any>();
@ViewChild('editPanel') private _editPanel: TemplateRef<any>;
calendar: Calendar | null; calendar: Calendar | null;
calendarColors: any = calendarColors; calendarColors: any = calendarColors;
@ -194,6 +194,7 @@ export class CalendarSidebarComponent implements OnInit, OnDestroy
/** /**
* Create the edit panel overlay * Create the edit panel overlay
*
* @private * @private
*/ */
private _createEditPanelOverlay(): void private _createEditPanelOverlay(): void

View File

@ -36,7 +36,7 @@ import { ProfileComponent } from 'app/modules/admin/apps/chat/profile/profile.co
MatMenuModule, MatMenuModule,
MatSidenavModule, MatSidenavModule,
FuseAutogrowModule, FuseAutogrowModule,
SharedModule, SharedModule
] ]
}) })
export class ChatModule export class ChatModule

View File

@ -20,7 +20,7 @@ export interface Contact
}[]; }[];
phoneNumbers?: { phoneNumbers?: {
country?: string; country?: string;
number?: string; phoneNumber?: string;
label?: string; label?: string;
}[]; }[];
title?: string; title?: string;
@ -29,9 +29,9 @@ export interface Contact
address?: string; address?: string;
}; };
attachments?: { attachments?: {
media?: any[] media?: any[];
docs?: any[] docs?: any[];
links?: any[] links?: any[];
}; };
} }

View File

@ -98,7 +98,7 @@ export class ChatsComponent implements OnInit, OnDestroy
return; return;
} }
this.filteredChats = this.chats.filter((chat) => chat.contact.name.toLowerCase().includes(query.toLowerCase())); this.filteredChats = this.chats.filter(chat => chat.contact.name.toLowerCase().includes(query.toLowerCase()));
} }
/** /**

View File

@ -52,7 +52,7 @@
<ng-container *ngIf="chat.contact.details.phoneNumbers.length"> <ng-container *ngIf="chat.contact.details.phoneNumbers.length">
<div> <div>
<div class="font-medium text-secondary">Phone number</div> <div class="font-medium text-secondary">Phone number</div>
<div class="">{{chat.contact.details.phoneNumbers[0].number}}</div> <div class="">{{chat.contact.details.phoneNumbers[0].phoneNumber}}</div>
</div> </div>
</ng-container> </ng-container>
<ng-container *ngIf="chat.contact.details.title"> <ng-container *ngIf="chat.contact.details.title">

View File

@ -31,6 +31,39 @@ export class ConversationComponent implements OnInit, OnDestroy
{ {
} }
// -----------------------------------------------------------------------------------------------------
// @ Decorated methods
// -----------------------------------------------------------------------------------------------------
/**
* Resize on 'input' and 'ngModelChange' events
*
* @private
*/
@HostListener('input')
@HostListener('ngModelChange')
private _resizeMessageInput(): void
{
// This doesn't need to trigger Angular's change detection by itself
this._ngZone.runOutsideAngular(() => {
setTimeout(() => {
// Set the height to 'auto' so we can correctly read the scrollHeight
this.messageInput.nativeElement.style.height = 'auto';
// Detect the changes so the height is applied
this._changeDetectorRef.detectChanges();
// Get the scrollHeight and subtract the vertical padding
this.messageInput.nativeElement.style.height = `${this.messageInput.nativeElement.scrollHeight}px`;
// Detect the changes one more time to apply the final height
this._changeDetectorRef.detectChanges();
});
});
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks // @ Lifecycle hooks
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -132,37 +165,4 @@ export class ConversationComponent implements OnInit, OnDestroy
{ {
return item.id || index; return item.id || index;
} }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Resize on 'input' and 'ngModelChange' events
*
* @private
*/
@HostListener('input')
@HostListener('ngModelChange')
private _resizeMessageInput(): void
{
// This doesn't need to trigger Angular's change detection by itself
this._ngZone.runOutsideAngular(() => {
setTimeout(() => {
// Set the height to 'auto' so we can correctly read the scrollHeight
this.messageInput.nativeElement.style.height = 'auto';
// Detect the changes so the height is applied
this._changeDetectorRef.detectChanges();
// Get the scrollHeight and subtract the vertical padding
this.messageInput.nativeElement.style.height = `${this.messageInput.nativeElement.scrollHeight}px`;
// Detect the changes one more time to apply the final height
this._changeDetectorRef.detectChanges();
});
});
}
} }

View File

@ -41,9 +41,7 @@ export class CanDeactivateContactsDetails implements CanDeactivate<ContactsDetai
else else
{ {
// Close the drawer first, and then navigate // Close the drawer first, and then navigate
return component.closeDrawer().then(() => { return component.closeDrawer().then(() => true);
return true;
});
} }
} }
} }

View File

@ -127,7 +127,7 @@ export class ContactsService
{ {
return this.contacts$.pipe( return this.contacts$.pipe(
take(1), take(1),
switchMap((contacts) => this._httpClient.post<Contact>('api/apps/contacts/contact', {}).pipe( switchMap(contacts => this._httpClient.post<Contact>('api/apps/contacts/contact', {}).pipe(
map((newContact) => { map((newContact) => {
// Update the contacts with the new contact // Update the contacts with the new contact
@ -354,6 +354,7 @@ export class ContactsService
avatar avatar
}, { }, {
headers: { headers: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'Content-Type': avatar.type 'Content-Type': avatar.type
} }
}).pipe( }).pipe(

View File

@ -5,13 +5,13 @@ export interface Contact
background?: string | null; background?: string | null;
name: string; name: string;
emails?: { emails?: {
email: string, email: string;
label: string label: string;
}[]; }[];
phoneNumbers?: { phoneNumbers?: {
country: string; country: string;
number: string; phoneNumber: string;
label: string label: string;
}[]; }[];
title?: string; title?: string;
company?: string; company?: string;

View File

@ -126,7 +126,7 @@
[style.backgroundSize]="'24px 3876px'" [style.backgroundSize]="'24px 3876px'"
[style.backgroundPosition]="getCountryByIso(phoneNumber.country).flagImagePos"></div> [style.backgroundPosition]="getCountryByIso(phoneNumber.country).flagImagePos"></div>
<div class="sm:ml-3 font-mono">{{getCountryByIso(phoneNumber.country).code}}</div> <div class="sm:ml-3 font-mono">{{getCountryByIso(phoneNumber.country).code}}</div>
<div class="ml-2.5 font-mono">{{phoneNumber.number}}</div> <div class="ml-2.5 font-mono">{{phoneNumber.phoneNumber}}</div>
<div <div
class="text-md truncate text-secondary" class="text-md truncate text-secondary"
*ngIf="phoneNumber.label"> *ngIf="phoneNumber.label">
@ -481,7 +481,7 @@
<mat-label *ngIf="first">Phone</mat-label> <mat-label *ngIf="first">Phone</mat-label>
<input <input
matInput matInput
[formControl]="phoneNumber.get('number')" [formControl]="phoneNumber.get('phoneNumber')"
[placeholder]="'Phone'"> [placeholder]="'Phone'">
<mat-select <mat-select
class="mr-1.5" class="mr-1.5"

View File

@ -150,7 +150,7 @@ export class ContactsDetailsComponent implements OnInit, OnDestroy
phoneNumbersFormGroups.push( phoneNumbersFormGroups.push(
this._formBuilder.group({ this._formBuilder.group({
country : [phoneNumber.country], country : [phoneNumber.country],
number : [phoneNumber.number], phoneNumber: [phoneNumber.phoneNumber],
label : [phoneNumber.label] label : [phoneNumber.label]
}) })
); );
@ -162,7 +162,7 @@ export class ContactsDetailsComponent implements OnInit, OnDestroy
phoneNumbersFormGroups.push( phoneNumbersFormGroups.push(
this._formBuilder.group({ this._formBuilder.group({
country : ['us'], country : ['us'],
number : [''], phoneNumber: [''],
label : [''] label : ['']
}) })
); );
@ -259,13 +259,9 @@ export class ContactsDetailsComponent implements OnInit, OnDestroy
const contact = this.contactForm.getRawValue(); const contact = this.contactForm.getRawValue();
// Go through the contact object and clear empty values // Go through the contact object and clear empty values
contact.emails = contact.emails.filter((email) => { contact.emails = contact.emails.filter(email => email.email);
return email.email;
});
contact.phoneNumbers = contact.phoneNumbers.filter((phoneNumber) => { contact.phoneNumbers = contact.phoneNumbers.filter(phoneNumber => phoneNumber.phoneNumber);
return phoneNumber.number;
});
// Update the contact on the server // Update the contact on the server
this._contactsService.updateContact(contact.id, contact).subscribe(() => { this._contactsService.updateContact(contact.id, contact).subscribe(() => {
@ -480,7 +476,7 @@ export class ContactsDetailsComponent implements OnInit, OnDestroy
// If there is a tag... // If there is a tag...
const tag = this.filteredTags[0]; const tag = this.filteredTags[0];
const isTagApplied = this.contact.tags.find((id) => id === tag.id); const isTagApplied = this.contact.tags.find(id => id === tag.id);
// If the found tag is already applied to the contact... // If the found tag is already applied to the contact...
if ( isTagApplied ) if ( isTagApplied )
@ -653,7 +649,7 @@ export class ContactsDetailsComponent implements OnInit, OnDestroy
// Create an empty phone number form group // Create an empty phone number form group
const phoneNumberFormGroup = this._formBuilder.group({ const phoneNumberFormGroup = this._formBuilder.group({
country : ['us'], country : ['us'],
number : [''], phoneNumber: [''],
label : [''] label : ['']
}); });
@ -688,7 +684,7 @@ export class ContactsDetailsComponent implements OnInit, OnDestroy
*/ */
getCountryByIso(iso: string): Country getCountryByIso(iso: string): Country
{ {
return this.countries.find((country) => country.iso === iso); return this.countries.find(country => country.iso === iso);
} }
/** /**

View File

@ -93,11 +93,11 @@ export class ContactsListComponent implements OnInit, OnDestroy
this.searchInputControl.valueChanges this.searchInputControl.valueChanges
.pipe( .pipe(
takeUntil(this._unsubscribeAll), takeUntil(this._unsubscribeAll),
switchMap((query) => { switchMap(query =>
// Search // Search
return this._contactsService.searchContacts(query); this._contactsService.searchContacts(query)
}) )
) )
.subscribe(); .subscribe();
@ -136,10 +136,10 @@ export class ContactsListComponent implements OnInit, OnDestroy
fromEvent(this._document, 'keydown') fromEvent(this._document, 'keydown')
.pipe( .pipe(
takeUntil(this._unsubscribeAll), takeUntil(this._unsubscribeAll),
filter<KeyboardEvent>((event) => { filter<KeyboardEvent>(event =>
return (event.ctrlKey === true || event.metaKey) // Ctrl or Cmd (event.ctrlKey === true || event.metaKey) // Ctrl or Cmd
&& (event.key === '/'); // '/' && (event.key === '/') // '/'
}) )
) )
.subscribe(() => { .subscribe(() => {
this.createContact(); this.createContact();

View File

@ -131,7 +131,7 @@ export class InventoryProductsResolver implements Resolve<any>
* @param route * @param route
* @param state * @param state
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<{ pagination: InventoryPagination, products: InventoryProduct[] }> resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<{ pagination: InventoryPagination; products: InventoryProduct[] }>
{ {
return this._inventoryService.getProducts(); return this._inventoryService.getProducts();
} }

View File

@ -124,9 +124,9 @@ export class InventoryService
* @param search * @param search
*/ */
getProducts(page: number = 0, size: number = 10, sort: string = 'name', order: 'asc' | 'desc' | '' = 'asc', search: string = ''): getProducts(page: number = 0, size: number = 10, sort: string = 'name', order: 'asc' | 'desc' | '' = 'asc', search: string = ''):
Observable<{ pagination: InventoryPagination, products: InventoryProduct[] }> Observable<{ pagination: InventoryPagination; products: InventoryProduct[] }>
{ {
return this._httpClient.get<{ pagination: InventoryPagination, products: InventoryProduct[] }>('api/apps/ecommerce/inventory/products', { return this._httpClient.get<{ pagination: InventoryPagination; products: InventoryProduct[] }>('api/apps/ecommerce/inventory/products', {
params: { params: {
page: '' + page, page: '' + page,
size: '' + size, size: '' + size,
@ -179,7 +179,7 @@ export class InventoryService
{ {
return this.products$.pipe( return this.products$.pipe(
take(1), take(1),
switchMap((products) => this._httpClient.post<InventoryProduct>('api/apps/ecommerce/inventory/product', {}).pipe( switchMap(products => this._httpClient.post<InventoryProduct>('api/apps/ecommerce/inventory/product', {}).pipe(
map((newProduct) => { map((newProduct) => {
// Update the products with the new product // Update the products with the new product

View File

@ -5,7 +5,7 @@ import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { merge, Observable, Subject } from 'rxjs'; import { merge, Observable, Subject } from 'rxjs';
import { debounceTime, map, switchMap, takeUntil } from 'rxjs/operators'; import { debounceTime, map, switchMap, takeUntil } from 'rxjs/operators';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { InventoryBrand, InventoryCategory, InventoryPagination, InventoryProduct, InventoryTag, InventoryVendor } from 'app/modules/admin/apps/ecommerce/inventory/inventory.types'; import { InventoryBrand, InventoryCategory, InventoryPagination, InventoryProduct, InventoryTag, InventoryVendor } from 'app/modules/admin/apps/ecommerce/inventory/inventory.types';
import { InventoryService } from 'app/modules/admin/apps/ecommerce/inventory/inventory.service'; import { InventoryService } from 'app/modules/admin/apps/ecommerce/inventory/inventory.service';
@ -14,7 +14,7 @@ import { InventoryService } from 'app/modules/admin/apps/ecommerce/inventory/inv
templateUrl : './inventory.component.html', templateUrl : './inventory.component.html',
encapsulation : ViewEncapsulation.None, encapsulation : ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
animations : FuseAnimations animations : fuseAnimations
}) })
export class InventoryListComponent implements OnInit, AfterViewInit, OnDestroy export class InventoryListComponent implements OnInit, AfterViewInit, OnDestroy
{ {
@ -333,7 +333,7 @@ export class InventoryListComponent implements OnInit, AfterViewInit, OnDestroy
// If there is a tag... // If there is a tag...
const tag = this.filteredTags[0]; const tag = this.filteredTags[0];
const isTagApplied = this.selectedProduct.tags.find((id) => id === tag.id); const isTagApplied = this.selectedProduct.tags.find(id => id === tag.id);
// If the found tag is already applied to the contact... // If the found tag is already applied to the contact...
if ( isTagApplied ) if ( isTagApplied )

View File

@ -41,9 +41,7 @@ export class CanDeactivateFileManagerDetails implements CanDeactivate<FileManage
else else
{ {
// Close the drawer first, and then navigate // Close the drawer first, and then navigate
return component.closeDrawer().then(() => { return component.closeDrawer().then(() => true);
return true;
});
} }
} }
} }

View File

@ -1,13 +1,13 @@
import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { FormBuilder, FormGroup, NgForm, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, NgForm, Validators } from '@angular/forms';
import { FuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service'; import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
@Component({ @Component({
selector : 'help-center-support', selector : 'help-center-support',
templateUrl : './support.component.html', templateUrl : './support.component.html',
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
animations : FuseAnimations animations : fuseAnimations
}) })
export class HelpCenterSupportComponent implements OnInit export class HelpCenterSupportComponent implements OnInit
{ {

View File

@ -10,7 +10,7 @@ import { MatDialogRef } from '@angular/material/dialog';
export class MailboxComposeComponent implements OnInit export class MailboxComposeComponent implements OnInit
{ {
composeForm: FormGroup; composeForm: FormGroup;
copyFields: { cc: boolean, bcc: boolean } = { copyFields: { cc: boolean; bcc: boolean } = {
cc : false, cc : false,
bcc: false bcc: false
}; };

View File

@ -114,9 +114,7 @@ export class MailboxDetailsComponent implements OnInit, OnDestroy
moveToFolder(folderSlug: string): void moveToFolder(folderSlug: string): void
{ {
// Find the folder details // Find the folder details
const folder = this.folders.find((item) => { const folder = this.folders.find(item => item.slug === folderSlug);
return item.slug === folderSlug;
});
// Return if the current folder of the mail // Return if the current folder of the mail
// is already equals to the given folder // is already equals to the given folder

View File

@ -11,8 +11,8 @@ import { MailboxSettingsComponent } from 'app/modules/admin/apps/mailbox/setting
* *
* @param url * @param url
*/ */
export function mailboxRouteMatcher(url: UrlSegment[]): UrlMatchResult export const mailboxRouteMatcher: (url: UrlSegment[]) => UrlMatchResult = (url: UrlSegment[]) => {
{
// Prepare consumed url and positional parameters // Prepare consumed url and positional parameters
let consumed = url; let consumed = url;
const posParams = {}; const posParams = {};
@ -52,10 +52,10 @@ export function mailboxRouteMatcher(url: UrlSegment[]): UrlMatchResult
consumed, consumed,
posParams posParams
}; };
} };
export const mailboxRunGuardsAndResolvers: (from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => boolean = (from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => {
export function mailboxRunGuardsAndResolvers(from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot): boolean
{
// If we are navigating from mail to mails, meaning there is an id in // If we are navigating from mail to mails, meaning there is an id in
// from's deepest first child and there isn't one in the to's, we will // from's deepest first child and there isn't one in the to's, we will
// trigger the resolver // trigger the resolver
@ -99,7 +99,7 @@ export function mailboxRunGuardsAndResolvers(from: ActivatedRouteSnapshot, to: A
// Trigger the resolver on other cases // Trigger the resolver on other cases
return true; return true;
} };
export const mailboxRoutes: Route[] = [ export const mailboxRoutes: Route[] = [
{ {

View File

@ -117,7 +117,7 @@ export class MailboxSettingsComponent implements OnInit
const labelsFormArray = this.labelsForm.get('labels') as FormArray; const labelsFormArray = this.labelsForm.get('labels') as FormArray;
// Remove the label from the labels form array // Remove the label from the labels form array
labelsFormArray.removeAt(labelsFormArray.value.findIndex((label) => label.id === id)); labelsFormArray.removeAt(labelsFormArray.value.findIndex(label => label.id === id));
// Delete label on the server // Delete label on the server
this._mailboxService.deleteLabel(id).subscribe(); this._mailboxService.deleteLabel(id).subscribe();

View File

@ -106,7 +106,7 @@ export class MailboxSidebarComponent implements OnInit, OnDestroy
const dialogRef = this._matDialog.open(MailboxComposeComponent); const dialogRef = this._matDialog.open(MailboxComposeComponent);
dialogRef.afterClosed() dialogRef.afterClosed()
.subscribe(result => { .subscribe((result) => {
console.log('Compose dialog was closed!'); console.log('Compose dialog was closed!');
}); });
} }
@ -276,7 +276,7 @@ export class MailboxSidebarComponent implements OnInit, OnDestroy
private _updateNavigationBadge(folders: MailFolder[]): void private _updateNavigationBadge(folders: MailFolder[]): void
{ {
// Get the inbox folder // Get the inbox folder
const inboxFolder = this.folders.find((folder) => folder.slug === 'inbox'); const inboxFolder = this.folders.find(folder => folder.slug === 'inbox');
// Get the component -> navigation mock-api -> item // Get the component -> navigation mock-api -> item
const mainNavigationComponent = this._fuseNavigationService.getComponent('mainNavigation'); const mainNavigationComponent = this._fuseNavigationService.getComponent('mainNavigation');

View File

@ -77,7 +77,7 @@ export class NotesDetailsComponent implements OnInit, OnDestroy
.pipe( .pipe(
takeUntil(this._unsubscribeAll), takeUntil(this._unsubscribeAll),
debounceTime(500), debounceTime(500),
switchMap((note) => this._notesService.updateNote(note))) switchMap(note => this._notesService.updateNote(note)))
.subscribe(() => { .subscribe(() => {
// Mark for check // Mark for check
@ -198,7 +198,7 @@ export class NotesDetailsComponent implements OnInit, OnDestroy
removeTaskFromNote(note: Note, task: Task): void removeTaskFromNote(note: Note, task: Task): void
{ {
// Remove the task // Remove the task
note.tasks = note.tasks.filter((item) => item.id !== task.id); note.tasks = note.tasks.filter(item => item.id !== task.id);
// Update the note // Update the note
this.noteChanged.next(note); this.noteChanged.next(note);
@ -228,7 +228,7 @@ export class NotesDetailsComponent implements OnInit, OnDestroy
*/ */
isNoteHasLabel(note: Note, label: Label): boolean isNoteHasLabel(note: Note, label: Label): boolean
{ {
return !!note.labels.find((item) => item.id === label.id); return !!note.labels.find(item => item.id === label.id);
} }
/** /**
@ -242,7 +242,7 @@ export class NotesDetailsComponent implements OnInit, OnDestroy
// If the note already has the label // If the note already has the label
if ( this.isNoteHasLabel(note, label) ) if ( this.isNoteHasLabel(note, label) )
{ {
note.labels = note.labels.filter((item) => item.id !== label.id); note.labels = note.labels.filter(item => item.id !== label.id);
} }
// Otherwise // Otherwise
else else

View File

@ -44,8 +44,8 @@ export class NotesLabelsComponent implements OnInit, OnDestroy
.pipe( .pipe(
takeUntil(this._unsubscribeAll), takeUntil(this._unsubscribeAll),
debounceTime(500), debounceTime(500),
filter((label) => label.title.trim() !== ''), filter(label => label.title.trim() !== ''),
switchMap((label) => this._notesService.updateLabel(label))) switchMap(label => this._notesService.updateLabel(label)))
.subscribe(() => { .subscribe(() => {
// Mark for check // Mark for check

View File

@ -85,7 +85,7 @@ export class NotesListComponent implements OnInit, OnDestroy
if ( searchQuery ) if ( searchQuery )
{ {
searchQuery = searchQuery.trim().toLowerCase(); searchQuery = searchQuery.trim().toLowerCase();
filteredNotes = filteredNotes.filter((note) => note.title.toLowerCase().includes(searchQuery) || note.content.toLowerCase().includes(searchQuery)); filteredNotes = filteredNotes.filter(note => note.title.toLowerCase().includes(searchQuery) || note.content.toLowerCase().includes(searchQuery));
} }
// Show all // Show all
@ -96,13 +96,13 @@ export class NotesListComponent implements OnInit, OnDestroy
// Show archive // Show archive
const isArchive = filter === 'archived'; const isArchive = filter === 'archived';
filteredNotes = filteredNotes.filter((note) => note.archived === isArchive); filteredNotes = filteredNotes.filter(note => note.archived === isArchive);
// Filter by label // Filter by label
if ( filter.startsWith('label:') ) if ( filter.startsWith('label:') )
{ {
const labelId = filter.split(':')[1]; const labelId = filter.split(':')[1];
filteredNotes = filteredNotes.filter((note) => !!note.labels.find((item) => item.id === labelId)); filteredNotes = filteredNotes.filter(note => !!note.labels.find(item => item.id === labelId));
} }
return filteredNotes; return filteredNotes;

View File

@ -186,7 +186,7 @@ export class NotesService
createNote(note: Note): Observable<Note> createNote(note: Note): Observable<Note>
{ {
return this._httpClient.post<Note>('api/apps/notes', {note}).pipe( return this._httpClient.post<Note>('api/apps/notes', {note}).pipe(
switchMap((response) => this.getNotes().pipe( switchMap(response => this.getNotes().pipe(
switchMap(() => this.getNoteById(response.id).pipe( switchMap(() => this.getNoteById(response.id).pipe(
map(() => response) map(() => response)
)) ))
@ -206,7 +206,7 @@ export class NotesService
// Before sending the note to the server, handle the labels // Before sending the note to the server, handle the labels
if ( updatedNote.labels.length ) if ( updatedNote.labels.length )
{ {
updatedNote.labels = updatedNote.labels.map((label) => label.id); updatedNote.labels = updatedNote.labels.map(label => label.id);
} }
return this._httpClient.patch<Note>('api/apps/notes', {updatedNote}).pipe( return this._httpClient.patch<Note>('api/apps/notes', {updatedNote}).pipe(

Some files were not shown because too many files have changed in this diff Show More