This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const path = require('path'); | |
| const exec = require('child_process').exec; | |
| const ts = require('typescript'); | |
| const tsHost = ts.createCompilerHost( | |
| { | |
| allowJs: true, | |
| noEmit: true, | |
| isolatedModules: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { CommonModule, NgClass } from '@angular/common'; | |
| import { Component } from '@angular/core'; | |
| import { UntilDestroy } from '@ngneat/until-destroy'; | |
| import { concat, timer } from 'rxjs'; | |
| import { delay, map, repeat, startWith, takeWhile, tap } from 'rxjs/operators'; | |
| @UntilDestroy() | |
| @Component({ | |
| selector: 't-logo', | |
| standalone: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| Component, | |
| Input, | |
| OnChanges, | |
| SimpleChanges, | |
| OnDestroy, | |
| } from '@angular/core'; | |
| import { | |
| MatDialogRef, | |
| MatDialogConfig, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SimpleChanges } from '@angular/core'; | |
| export function AsyncInput(inputName?: string) { | |
| return (target, rxInputName: string) => { | |
| inputName = inputName || rxInputName.slice(0, -1); // Remove '$' ('data$' => 'data') | |
| const oldOnChanges = target.ngOnChanges; | |
| const oldOnDestroy = target.ngOnDestroy; | |
| target.ngOnChanges = function(changes: SimpleChanges) { | |
| const inputChange = changes[inputName]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Directive, Input} from '@angular/core'; | |
| import {NgControl} from '@angular/forms'; | |
| @Directive({ | |
| selector: '[disableControl]', | |
| }) | |
| export class DisableControlDirective { | |
| @Input() | |
| set disableControl(disabled: boolean) { | |
| const method = disabled ? 'disable' : 'enable'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Directive, Input} from '@angular/core'; | |
| @Directive({ | |
| selector: '[disableFormGroup]', | |
| }) | |
| export class DisableFormGroupDirective { | |
| @Input() form: any; | |
| @Input() formGroupName: string; | |
| @Input() | |
| set disableFormGroup(disabled: boolean) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Directive, Input} from '@angular/core'; | |
| import {NgControl} from '@angular/forms'; | |
| @Directive({ | |
| selector: '[setValue]', | |
| }) | |
| export class SetValueDirective { | |
| @Input() | |
| set setValue(val: any) { | |
| this.ngControl.control.setValue(val); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Directive, Input} from '@angular/core'; | |
| @Directive({ | |
| selector: '[patchFormGroupValues]', | |
| }) | |
| export class PatchFormGroupValuesDirective { | |
| @Input() formGroup: any; | |
| @Input() | |
| set patchFormGroupValues(val: any) { | |
| if (!val) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function favoriteItemsReducer(state = initialState, action: Action) { | |
| switch(action.type) { | |
| case 'REMOVE_FAVORITE_ITEM': | |
| case 'DELETE_ITEM_SUCCESS': | |
| const itemId = action.payload; | |
| return state.filter(id => id !== itemId); | |
| default: | |
| return state; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| requireUsers$ = this.userSelectors.needUsers$.pipe( | |
| filter(needUsers => needUsers), | |
| tap(() => this.store.dispatch({type: 'GET_USERS'})), | |
| switchMap(() => this.getUsers()), | |
| tap(users => this.store.dispatch({type: 'RECEIVE_USERS', users})), | |
| share(), | |
| ); | |
| users$ = using( | |
| () => this.requireUsers$.subscribe(), |
NewerOlder