chrv-components 1.10.21 → 1.10.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export declare const inOutAnimation: (duration?: number) => import("@angular/animations").AnimationTriggerMetadata;
@@ -1,6 +1,6 @@
1
1
  import { MatDialogRef, MatDialogConfig } from '@angular/material/dialog';
2
- import { IAction } from '../chr-table-wip/chr-table.component';
3
2
  import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
3
+ import { IAction } from '../chr-table/chr-table.component';
4
4
  import * as i0 from "@angular/core";
5
5
  export interface IDefaultDialogConfig extends MatDialogConfig<any> {
6
6
  config?: MatDialogConfig<any>;
@@ -121,6 +121,11 @@ export declare class ChrBaseInputComponent implements OnInit, ControlValueAccess
121
121
  * To use in any component inheriting the BaseInput Class, please call super.ngOnDestroy() at any point within the overriden ngOnDestroy() method.
122
122
  */
123
123
  ngOnDestroy(): void;
124
+ /**
125
+ * A method that returns the input's value. If it's linked to a formcontrol returns the formcontrol's value otherwise the local value
126
+ * @returns value any
127
+ */
128
+ getValue: () => any;
124
129
  /**
125
130
  * A method that can be used instead of onChange(value). It will pass the new value to an observable that will in turn add a debounce time then call the onchange function.
126
131
  *
@@ -154,6 +159,7 @@ export declare class ChrBaseInputComponent implements OnInit, ControlValueAccess
154
159
  private configureValidityReplication;
155
160
  private configureFormControl;
156
161
  private buildFormControl;
162
+ protected doCallback: () => void;
157
163
  static ɵfac: i0.ɵɵFactoryDeclaration<ChrBaseInputComponent, [{ optional: true; }]>;
158
164
  static ɵcmp: i0.ɵɵComponentDeclaration<ChrBaseInputComponent, "chr-base-input", never, { "label": { "alias": "label"; "required": false; }; "type": { "alias": "type"; "required": false; }; "id": { "alias": "id"; "required": false; }; "name": { "alias": "name"; "required": false; }; "span": { "alias": "span"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconCallback": { "alias": "iconCallback"; "required": false; }; "iconCallbackDisabled": { "alias": "iconCallbackDisabled"; "required": false; }; "iconTooltip": { "alias": "iconTooltip"; "required": false; }; "tooltip": { "alias": "tooltip"; "required": false; }; "debounceTime": { "alias": "debounceTime"; "required": false; }; "validations": { "alias": "validations"; "required": false; }; "standalone": { "alias": "standalone"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "siblings": { "alias": "siblings"; "required": false; }; }, { "valueChanges": "valueChanges"; }, never, never, true, never>;
159
165
  }
@@ -1,7 +1,7 @@
1
1
  import { OnInit, OnDestroy } from '@angular/core';
2
2
  import { ControlValueAccessor, NgControl } from '@angular/forms';
3
3
  import { MatAutocomplete } from '@angular/material/autocomplete';
4
- import { Observable } from 'rxjs';
4
+ import { Observable, Subject } from 'rxjs';
5
5
  import { ChrBaseInputComponent } from '../chr-form/chr-base-input/chr-base-input.component';
6
6
  import * as i0 from "@angular/core";
7
7
  export interface IInputSearchFilter {
@@ -18,6 +18,19 @@ export declare class ChrSearchSelectComponent extends ChrBaseInputComponent impl
18
18
  data: any[] | null;
19
19
  display?: (entry: any) => string;
20
20
  filters?: IInputSearchFilter[];
21
+ /**
22
+ * Callback that will be called BEFORE the value is added with the selected value passed as parameter.
23
+ * If this callback returns null, the entry will NOT be added.
24
+ * This lets you update the value before it's added.
25
+ */
26
+ addCallback?: ((entry: any, subject: Subject<any>) => any | null | void) | null;
27
+ private addSubject;
28
+ /**
29
+ * Indicate if the input accepts raw text or if the requires the selection to be made from the search list.
30
+ * This defaults to false.
31
+ * If there are neither data nor display function, this defaults to true.
32
+ */
33
+ acceptText: boolean | null;
21
34
  protected filterIndex: number;
22
35
  protected overrideShowResults: boolean;
23
36
  constructor(ngControl: NgControl);
@@ -48,10 +61,11 @@ export declare class ChrSearchSelectComponent extends ChrBaseInputComponent impl
48
61
  protected void: () => void;
49
62
  protected enableShowPanel: (input: any) => void;
50
63
  protected disableShowPanel: () => void;
64
+ protected addFromText: (event: any) => void;
51
65
  private _filterModel;
52
66
  private _doFilterModelInt;
53
67
  private _doFilterModelString;
54
68
  private _filterValues;
55
69
  static ɵfac: i0.ɵɵFactoryDeclaration<ChrSearchSelectComponent, [{ optional: true; }]>;
56
- static ɵcmp: i0.ɵɵComponentDeclaration<ChrSearchSelectComponent, "app-chr-search-select, [app-chr-search-select]", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "data": { "alias": "data"; "required": false; }; "display": { "alias": "display"; "required": false; }; "filters": { "alias": "filters"; "required": false; }; }, {}, never, ["*"], true, never>;
70
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChrSearchSelectComponent, "app-chr-search-select, [app-chr-search-select]", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "data": { "alias": "data"; "required": false; }; "display": { "alias": "display"; "required": false; }; "filters": { "alias": "filters"; "required": false; }; "addCallback": { "alias": "addCallback"; "required": false; }; "acceptText": { "alias": "acceptText"; "required": false; }; }, {}, never, ["*"], true, never>;
57
71
  }
@@ -0,0 +1,155 @@
1
+ import { ChangeDetectorRef, EventEmitter } from '@angular/core';
2
+ import { IAction } from '../chr-table/chr-table.component';
3
+ import { DataService } from '../services/data.service';
4
+ import { Color } from '../models/colors';
5
+ import { IControlValidation } from '../models/chr-validators/base-validator';
6
+ import * as i0 from "@angular/core";
7
+ export type TColumn = {
8
+ /**
9
+ * Nom de la colonne
10
+ */
11
+ display: string;
12
+ /**
13
+ * Taille en pourcent
14
+ */
15
+ width?: number;
16
+ /**
17
+ * Sélecteur qui représente la propriété ciblée. Ex: 'obj.id'.
18
+ */
19
+ properties?: string;
20
+ /**
21
+ * Méthode callback qui sera appelée avec la valeur de la propriété cible.
22
+ * Elle est utilisée pour apporter un traitement personnalisé à la valeur.
23
+ * @param value valeur de la propriété cible
24
+ * @returns
25
+ */
26
+ callback?: (value: any | null | undefined) => string;
27
+ /**
28
+ * Type de la colonne: lien, chips, input, date, default
29
+ */
30
+ type?: TColumnType;
31
+ /**
32
+ * Format de la date pour les colonnes de type date
33
+ */
34
+ format?: string;
35
+ /**
36
+ * Url de base pour les colonnes de type lien
37
+ */
38
+ url?: string;
39
+ /**
40
+ * Type d'input pour les colonnes de type input
41
+ */
42
+ inputType?: 'text' | 'number' | 'password' | 'date' | 'datetime' | 'file' | 'color' | 'toggle';
43
+ /**
44
+ * Règles de validations pour les colonnes de type input
45
+ */
46
+ validations?: IControlValidation[];
47
+ /**
48
+ * Chips disponibles pour les colonnes de type chips
49
+ */
50
+ chips?: {
51
+ [key: string]: IChip;
52
+ };
53
+ /**
54
+ * Méthode callback qui sera avec la valeur de la propriété cible.
55
+ * Elle est utilisée comme clef pour sélectionner quel chips afficher
56
+ * @param entry
57
+ * @returns
58
+ */
59
+ chipsCallback?: (entry: any) => string;
60
+ };
61
+ export interface IChip {
62
+ /**
63
+ * Le text qui sera affiché dans le chips
64
+ */
65
+ display: string;
66
+ /**
67
+ * La couleur du background du chips
68
+ */
69
+ color: Color;
70
+ }
71
+ export type TColumnType = 'link' | 'chips' | 'input' | 'date' | 'default';
72
+ export declare class ChrTableNewComponent {
73
+ private dataService;
74
+ private changeDetector;
75
+ private _data;
76
+ /**
77
+ * Data to display.
78
+ * @see If it's piped with | Async, please note that the input column may not work as expected
79
+ */
80
+ get data(): any[] | null;
81
+ set data(value: any[] | null);
82
+ /**
83
+ * Whether or not the table will show a column with a checkbox to select entries. Default is false
84
+ */
85
+ selectable: boolean;
86
+ /**
87
+ * The selected entries
88
+ */
89
+ selection: any[];
90
+ /**
91
+ * The selected entries change event. This will be triggered on each selection and contain the full array of selected entries
92
+ */
93
+ selectionChange: EventEmitter<any[]>;
94
+ /**
95
+ * The table's action column definition
96
+ */
97
+ actions?: IAction[];
98
+ /**
99
+ * The tabl'es action column's width in percentage
100
+ */
101
+ actionsWidth?: number;
102
+ /**
103
+ * Wheter or not the current sort is ascendant. Default is true
104
+ */
105
+ isAsc: boolean;
106
+ isAscChange: EventEmitter<boolean>;
107
+ /**
108
+ * The property by which the data will be sorted
109
+ */
110
+ sortBy?: string;
111
+ sortByChange: EventEmitter<string>;
112
+ /**
113
+ * The page size for the table. Default is 20
114
+ */
115
+ pageSize: number;
116
+ pageSizeChange: EventEmitter<number>;
117
+ /**
118
+ * The current page of the table. Default is 1
119
+ */
120
+ currentPage: number;
121
+ currentPageChange: EventEmitter<number>;
122
+ /**
123
+ * The ID of the table. It's used to persist page size and currentpage when the user change pages
124
+ */
125
+ id?: string;
126
+ /**
127
+ * The color to use for the table's header
128
+ */
129
+ color?: Color;
130
+ /**
131
+ * The table's columns definitions
132
+ */
133
+ columns: TColumn[];
134
+ constructor(dataService: DataService, changeDetector: ChangeDetectorRef);
135
+ ngOnInit(): void;
136
+ protected emitIsAsc(isAsc: any): void;
137
+ protected emitSortBy(sortBy: any): void;
138
+ protected emitPageSize(pageSize: any): void;
139
+ protected emitCurrentPage(currentPage: any): void;
140
+ protected getNestedProperty(obj: any, path?: string): any;
141
+ protected select: (entry: any, event: MouseEvent) => void;
142
+ getSelection: () => any[];
143
+ setSelection: (data: any[]) => void;
144
+ protected contains: (entry: any) => boolean;
145
+ updateModel: (entry: any, properties: string, value: {
146
+ key: any;
147
+ }) => void;
148
+ protected getTextColor: (color?: Color) => string;
149
+ protected getBackgroundColor: (color?: Color) => string;
150
+ protected getContrastTextColor: (color?: Color) => string;
151
+ protected getBorderColor: (color?: Color) => string;
152
+ protected sort: (properties?: string) => void;
153
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChrTableNewComponent, never>;
154
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChrTableNewComponent, "chr-table", never, { "data": { "alias": "data"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "selection": { "alias": "selection"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "actionsWidth": { "alias": "actionsWidth"; "required": false; }; "isAsc": { "alias": "isAsc"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "currentPage": { "alias": "currentPage"; "required": false; }; "id": { "alias": "id"; "required": false; }; "color": { "alias": "color"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; }, { "selectionChange": "selectionChange"; "isAscChange": "isAscChange"; "sortByChange": "sortByChange"; "pageSizeChange": "pageSizeChange"; "currentPageChange": "currentPageChange"; }, never, never, true, never>;
155
+ }
@@ -50,11 +50,10 @@ export declare class ChrTagSelectComponent extends ChrBaseInputComponent impleme
50
50
  protected getModelDisplay: (model: any) => any;
51
51
  protected addFromText: (event: any) => void;
52
52
  protected add: (event: any) => void;
53
- protected edit: (entry: any) => void | import("rxjs").Subscription;
53
+ protected edit: (entry: any) => void;
54
54
  protected remove(value: any): void;
55
55
  protected registerFilters: () => void;
56
56
  protected increment: (input: any) => void;
57
- protected getValue: () => any[] | null;
58
57
  protected void: () => void;
59
58
  protected enableShowPanel: (input: any) => void;
60
59
  protected disableShowPanel: () => void;
@@ -0,0 +1,9 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class TabToInputHandlerDirective {
4
+ private el;
5
+ constructor(el: ElementRef);
6
+ handleTab(event: KeyboardEvent): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<TabToInputHandlerDirective, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TabToInputHandlerDirective, "[tab-input-only]", never, {}, {}, never, never, true, never>;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class TabToEnterHandlerDirective {
4
+ private el;
5
+ constructor(el: ElementRef);
6
+ handleTab(event: KeyboardEvent): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<TabToEnterHandlerDirective, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TabToEnterHandlerDirective, "[tab-enter]", never, {}, {}, never, never, true, never>;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrv-components",
3
- "version": "1.10.21",
3
+ "version": "1.10.23",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=17.3.0",
6
6
  "@angular/core": ">=17.3.0",
@@ -8,7 +8,7 @@
8
8
  "@angular/material": ">=17.3.0",
9
9
  "tailwindcss": ">=3.2.4",
10
10
  "ngx-pagination": ">=6.0.3",
11
- "chrv-pipes": ">=1.1.6",
11
+ "chrv-pipes": ">=1.3.3",
12
12
  "@microsoft/signalr": ">=8.0.7"
13
13
  },
14
14
  "dependencies": {
package/public-api.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from './lib/chr-form/chr-textarea-input/chr-textarea-input.component';
11
11
  export * from './lib/chr-form/chr-toggle-input/chr-toggle-input.component';
12
12
  export * from './lib/chr-search-select/chr-search-select.component';
13
13
  export * from './lib/chr-tag-select/chr-tag-select.component';
14
+ export * from './lib/chr-table-new/chr-table-new.component';
14
15
  export * from './lib/chr-searchbar/chr-searchbar.component';
15
16
  export * from './lib/chr-paginator/chr-paginator.component';
16
17
  export * from './lib/chr-table/chr-table.component';
@@ -23,6 +24,10 @@ export * from './lib/models/chr-validators/type-validator';
23
24
  export * from './lib/chr-spinner/chr-spinner.component';
24
25
  export * from './lib/chr-toast/chr-toast.component';
25
26
  export * from './lib/chr-default-modal/chr-default-modal.component';
27
+ export * from './lib/directives/tab-input-only-handler.directive';
28
+ export * from './lib/directives/tab-to-enter-handler.directive';
29
+ export * from './lib/animations/in-out.animation';
30
+ export * from './lib/animations/rotation.animation';
26
31
  export * from './lib/services/dialog.service';
27
32
  export * from './lib/services/data.service';
28
33
  export * from './lib/services/live-update.service';
Binary file
@@ -1,93 +0,0 @@
1
- import { AfterViewInit, EventEmitter, ChangeDetectorRef, OnInit } from '@angular/core';
2
- import { DatePipe } from '@angular/common';
3
- import { DataService } from '../services/data.service';
4
- import { Color } from '../models/colors';
5
- import * as i0 from "@angular/core";
6
- export type Alignment = 'left' | 'center' | 'right';
7
- export declare const Aligments: {
8
- [key: string]: string;
9
- };
10
- export interface IChips {
11
- display: string;
12
- name: string;
13
- callback: (entry: any) => string | boolean;
14
- textColor?: Color;
15
- backgroundColor?: Color;
16
- }
17
- export interface IColumn {
18
- display: string;
19
- alignment?: 'left' | 'center' | 'right';
20
- chips?: IChips[];
21
- properties?: string[];
22
- callback?: Function;
23
- date?: string;
24
- isLink?: boolean;
25
- linkStaticUrl?: string;
26
- }
27
- export interface IComputedRow {
28
- columns: IComputedColumn[];
29
- }
30
- export interface IComputedColumn {
31
- label?: string;
32
- value?: any;
33
- callback?: Function;
34
- alignment?: 'left' | 'center' | 'right';
35
- after?: string;
36
- }
37
- export interface IAction {
38
- display?: string;
39
- icon?: string;
40
- callback: Function;
41
- disabled?: boolean;
42
- disabledCallback?: Function;
43
- color: Color;
44
- }
45
- export declare class ChrTableComponent implements OnInit, AfterViewInit {
46
- private _date;
47
- private dataService;
48
- private changeDetector;
49
- computedRows?: IComputedRow[];
50
- columns?: IColumn[];
51
- data: any[] | null;
52
- actions?: IAction[];
53
- isAsc: boolean;
54
- isAscChange: EventEmitter<boolean>;
55
- sortBy?: string[];
56
- sortByChange: EventEmitter<string[]>;
57
- pageSize: number;
58
- pageSizeChange: EventEmitter<number>;
59
- currentPage: number;
60
- currentPageChange: EventEmitter<number>;
61
- selectable: boolean;
62
- selection: any[];
63
- selectionChange: EventEmitter<any[]>;
64
- id?: string;
65
- color?: Color;
66
- textColor?: Color;
67
- private _page;
68
- currentProperty: any | null;
69
- currentText: string | null;
70
- constructor(_date: DatePipe, dataService: DataService, changeDetector: ChangeDetectorRef);
71
- ngOnInit(): void;
72
- ngAfterViewInit(): void;
73
- protected emitIsAsc(isAsc: any): void;
74
- protected emitSortBy(sortBy: any): void;
75
- protected emitPageSize(pageSize: any): void;
76
- protected emitCurrentPage(currentPage: any): void;
77
- protected getProperty: (entry: any, properties?: any[]) => any;
78
- protected explore: (entry: any, column: IColumn) => any;
79
- protected _explore: (entry: any, properties?: any[], value?: any | null) => any;
80
- protected getText: (property: any, column: IColumn) => any;
81
- protected select: (entry: any, event: MouseEvent) => void;
82
- getSelection: () => any[];
83
- setSelection: (data: any[]) => void;
84
- protected contains: (entry: any) => boolean;
85
- protected getIsAsc: () => boolean;
86
- protected getSortBy: () => string[] | undefined;
87
- protected getTextColor: (color?: Color) => string;
88
- protected getBackgroundColor: (color?: Color) => string;
89
- protected getBorderColor: (color?: Color) => string;
90
- protected getAlignment: (alignment?: Alignment) => string;
91
- static ɵfac: i0.ɵɵFactoryDeclaration<ChrTableComponent, never>;
92
- static ɵcmp: i0.ɵɵComponentDeclaration<ChrTableComponent, "app-chr-table, [app-chr-table]", never, { "computedRows": { "alias": "computedRows"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "data": { "alias": "data"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "isAsc": { "alias": "isAsc"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "currentPage": { "alias": "currentPage"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "selection": { "alias": "selection"; "required": false; }; "id": { "alias": "id"; "required": false; }; "color": { "alias": "color"; "required": false; }; "textColor": { "alias": "textColor"; "required": false; }; }, { "isAscChange": "isAscChange"; "sortByChange": "sortByChange"; "pageSizeChange": "pageSizeChange"; "currentPageChange": "currentPageChange"; "selectionChange": "selectionChange"; }, never, ["*"], true, never>;
93
- }