move sort and humanize pipe
This commit is contained in:
parent
c87bcb4db3
commit
2cb86ab702
@ -6,8 +6,8 @@ import { Observable } from 'rxjs';
|
||||
import { Toaster } from '@services/toaster.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { TypeValueWrapper } from '@models/file/type-value.wrapper';
|
||||
import { humanize } from '../../../../utils/functions';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { humanize } from '@iqser/common-ui';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-add-edit-dictionary-dialog',
|
||||
|
||||
@ -2,9 +2,9 @@ import { Component, Inject } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { humanize } from '../../../../utils/functions';
|
||||
import { PermissionsService } from '../../../../services/permissions.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { humanize } from '@iqser/common-ui';
|
||||
|
||||
export interface RemoveAnnotationsDialogInput {
|
||||
annotationsToRemove: AnnotationWrapper[];
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { humanize } from '@utils/functions';
|
||||
|
||||
@Pipe({
|
||||
name: 'humanize'
|
||||
})
|
||||
export class HumanizePipe implements PipeTransform {
|
||||
transform(item: string, lowercase: boolean = false): any {
|
||||
return humanize(item, lowercase);
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { SortingOrder, SortingService } from '@iqser/common-ui';
|
||||
|
||||
@Pipe({ name: 'sortBy' })
|
||||
export class SortByPipe implements PipeTransform {
|
||||
constructor(private readonly _sortingService: SortingService) {}
|
||||
|
||||
transform<T>(value: T[], order: SortingOrder, column: string): T[] {
|
||||
return this._sortingService.sort(value, order, column);
|
||||
}
|
||||
}
|
||||
@ -14,14 +14,13 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { AnnotationIconComponent } from './components/annotation-icon/annotation-icon.component';
|
||||
import { SimpleDoughnutChartComponent } from './components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||
import { StatusBarComponent } from './components/status-bar/status-bar.component';
|
||||
import { HumanizePipe } from './pipes/humanize.pipe';
|
||||
import { SyncWidthDirective } from './directives/sync-width.directive';
|
||||
import { HasScrollbarDirective } from './directives/has-scrollbar.directive';
|
||||
import { DictionaryAnnotationIconComponent } from './components/dictionary-annotation-icon/dictionary-annotation-icon.component';
|
||||
import { HiddenActionComponent } from './components/hidden-action/hidden-action.component';
|
||||
import { ConfirmationDialogComponent } from './dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||
import { EmptyStateComponent } from './components/empty-state/empty-state.component';
|
||||
import { SortByPipe } from './pipes/sort-by.pipe';
|
||||
import { CommonUiModule } from '@iqser/common-ui';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { SelectComponent } from './components/select/select.component';
|
||||
@ -36,7 +35,6 @@ import { InputWithActionComponent } from '@shared/components/input-with-action/i
|
||||
import { PageHeaderComponent } from './components/page-header/page-header.component';
|
||||
import { DatePipe } from '@shared/pipes/date.pipe';
|
||||
import { TableHeaderComponent } from './components/table-header/table-header.component';
|
||||
import { CommonUiModule } from '@iqser/common-ui';
|
||||
|
||||
const buttons = [FileDownloadBtnComponent, UserButtonComponent];
|
||||
|
||||
@ -54,7 +52,6 @@ const components = [
|
||||
PopupFilterComponent,
|
||||
ConfirmationDialogComponent,
|
||||
EmptyStateComponent,
|
||||
SortByPipe,
|
||||
SelectComponent,
|
||||
SideNavComponent,
|
||||
DictionaryManagerComponent,
|
||||
@ -65,7 +62,7 @@ const components = [
|
||||
...buttons
|
||||
];
|
||||
|
||||
const utils = [HumanizePipe, DatePipe, SyncWidthDirective, HasScrollbarDirective, NavigateLastDossiersScreenDirective];
|
||||
const utils = [DatePipe, SyncWidthDirective, HasScrollbarDirective, NavigateLastDossiersScreenDirective];
|
||||
|
||||
const modules = [MatConfigModule, TranslateModule, ScrollingModule, IconsModule, FormsModule, ReactiveFormsModule, CommonUiModule];
|
||||
|
||||
|
||||
@ -15,13 +15,14 @@ import { Event, NavigationEnd, ResolveStart, Router } from '@angular/router';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { forkJoin, Observable, of } from 'rxjs';
|
||||
import { catchError, tap } from 'rxjs/operators';
|
||||
import { FALLBACK_COLOR, hexToRgb, humanize } from '@utils/functions';
|
||||
import { FALLBACK_COLOR, hexToRgb } from '@utils/functions';
|
||||
import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import { DossierWrapper } from './model/dossier.wrapper';
|
||||
import { TypeValueWrapper } from '@models/file/type-value.wrapper';
|
||||
import { DossierTemplateModelWrapper } from '@models/file/dossier-template-model.wrapper';
|
||||
import { DossiersService } from '../modules/dossier/services/dossiers.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { humanize } from '@iqser/common-ui';
|
||||
|
||||
export interface AppState {
|
||||
dossiers: DossierWrapper[];
|
||||
|
||||
@ -7,25 +7,6 @@ export function groupBy(xs: any[], key: string) {
|
||||
}, {});
|
||||
}
|
||||
|
||||
export function computerize(str: string) {
|
||||
if (!str) {
|
||||
return undefined;
|
||||
}
|
||||
const frags = str.toLowerCase().split(/[ \-_]+/);
|
||||
return frags.join('_');
|
||||
}
|
||||
|
||||
export function humanize(str: string, lowercase: boolean = true) {
|
||||
if (!str) {
|
||||
return undefined;
|
||||
}
|
||||
const frags = (lowercase ? str.toLowerCase() : str).split(/[ \-_]+/);
|
||||
for (let i = 0; i < frags.length; i++) {
|
||||
frags[i] = frags[i].charAt(0).toUpperCase() + frags[i].slice(1);
|
||||
}
|
||||
return frags.join(' ');
|
||||
}
|
||||
|
||||
export function hexToRgb(hex) {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result
|
||||
@ -37,14 +18,6 @@ export function hexToRgb(hex) {
|
||||
: null;
|
||||
}
|
||||
|
||||
export function keypress(key: string) {
|
||||
document.dispatchEvent(new KeyboardEvent('keypress', { key: key }));
|
||||
}
|
||||
|
||||
export function reference(x: any) {
|
||||
return x;
|
||||
}
|
||||
|
||||
export function getFirstRelevantTextPart(text, direction: 'FORWARD' | 'BACKWARD') {
|
||||
let spaceCount = 0;
|
||||
let accumulator = '';
|
||||
@ -58,11 +31,7 @@ export function getFirstRelevantTextPart(text, direction: 'FORWARD' | 'BACKWARD'
|
||||
|
||||
accumulator += char;
|
||||
|
||||
if (spaceCount >= 2) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return spaceCount >= 2;
|
||||
};
|
||||
|
||||
if (direction === 'FORWARD') {
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "pretty-quick --staged && ng lint --project=red-ui-http && ng lint --project=red-ui --fix"
|
||||
"pre-commit": "pretty-quick --staged && ng lint --project=red-ui-http && ng lint --project=red-ui --fix && ng lint --project=common-ui --fix"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user