i-tech-shared-components 1.4.40 → 1.4.42
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.
- package/fesm2022/i-tech-shared-components.mjs +361 -3
- package/fesm2022/i-tech-shared-components.mjs.map +1 -1
- package/lib/components/ag-grid/date-range-selection/date-range-selection.component.d.ts +34 -0
- package/lib/components/ag-grid/select-with-search/select-with-search.component.d.ts +44 -0
- package/lib/interfaces/date-range-filtration.interface.d.ts +7 -0
- package/lib/interfaces/selection-filtration-configuration.interface.d.ts +59 -0
- package/lib/interfaces/selection-filtration.tokens.d.ts +6 -0
- package/lib/services/filtration-helper.service.d.ts +18 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { UntypedFormGroup } from '@angular/forms';
|
|
2
|
+
import { IFilterAngularComp } from 'ag-grid-angular';
|
|
3
|
+
import { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community';
|
|
4
|
+
import { DateRangeDatepickerComponent } from '../../date-range-datepicker/date-range-datepicker.component';
|
|
5
|
+
import { ParseDateService } from "../../../services/parse-date.service";
|
|
6
|
+
import { AgGridDateRangeConfig } from "../../../interfaces/date-range-filtration.interface";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class DateRangeSelectionComponent implements IFilterAngularComp {
|
|
9
|
+
private dateService;
|
|
10
|
+
rangePicker: DateRangeDatepickerComponent;
|
|
11
|
+
params: IFilterParams;
|
|
12
|
+
config: AgGridDateRangeConfig;
|
|
13
|
+
form: UntypedFormGroup;
|
|
14
|
+
defaultValueForDates: any[];
|
|
15
|
+
constructor(dateService: ParseDateService);
|
|
16
|
+
agInit(params: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* Selection event from the Datepicker component
|
|
19
|
+
*/
|
|
20
|
+
onDateChange(event: Array<string>): void;
|
|
21
|
+
/**
|
|
22
|
+
* AG Grid calls this to get the state of the filter
|
|
23
|
+
*/
|
|
24
|
+
getModel(): any;
|
|
25
|
+
/**
|
|
26
|
+
* AG Grid calls this to restore the filter state
|
|
27
|
+
*/
|
|
28
|
+
setModel(model: any): void;
|
|
29
|
+
isFilterActive(): boolean;
|
|
30
|
+
doesFilterPass(params: IDoesFilterPassParams): boolean;
|
|
31
|
+
afterGuiDetached(): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateRangeSelectionComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DateRangeSelectionComponent, "i-tech-date-range-selection", never, {}, {}, never, never, true, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from "@angular/core";
|
|
2
|
+
import { UniversalSelectorConfig } from "../../../interfaces/selection-filtration-configuration.interface";
|
|
3
|
+
import { IDoesFilterPassParams, IFilterParams } from "ag-grid-community";
|
|
4
|
+
import { FiltrationHelperService } from "../../../services/filtration-helper.service";
|
|
5
|
+
import { IFilterAngularComp } from "ag-grid-angular";
|
|
6
|
+
import { UntypedFormGroup } from "@angular/forms";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class SelectWithSearchComponent implements OnInit, OnDestroy, IFilterAngularComp {
|
|
9
|
+
private dataService;
|
|
10
|
+
config: UniversalSelectorConfig;
|
|
11
|
+
params: IFilterParams;
|
|
12
|
+
items: any[];
|
|
13
|
+
selectedIds: Set<any>;
|
|
14
|
+
allSelected: boolean;
|
|
15
|
+
partiallySelected: boolean;
|
|
16
|
+
currentPage: number;
|
|
17
|
+
isLastPage: boolean;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
searchForm: UntypedFormGroup;
|
|
20
|
+
private search$;
|
|
21
|
+
private pageLoad$;
|
|
22
|
+
private destroy$;
|
|
23
|
+
constructor(dataService: FiltrationHelperService);
|
|
24
|
+
agInit(params: IFilterParams): void;
|
|
25
|
+
doesFilterPass(params: IDoesFilterPassParams): boolean;
|
|
26
|
+
isFilterActive(): boolean;
|
|
27
|
+
getModel(): any;
|
|
28
|
+
setModel(model: any): void;
|
|
29
|
+
ngOnInit(): void;
|
|
30
|
+
private initCombinedStream;
|
|
31
|
+
private updateCheckboxState;
|
|
32
|
+
toggleAll(checked: boolean): void;
|
|
33
|
+
onSearchChange(value: string): void;
|
|
34
|
+
handleScroll(e: any): void;
|
|
35
|
+
resetFilter(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Handles selection logic for the custom list.
|
|
38
|
+
* Supports SINGLE (radio-like) and MULTI (checkbox) modes.
|
|
39
|
+
*/
|
|
40
|
+
onItemClick(item: any): void;
|
|
41
|
+
ngOnDestroy(): void;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SelectWithSearchComponent, never>;
|
|
43
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SelectWithSearchComponent, "i-tech-select-with-search", never, {}, {}, never, never, true, never>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface PaginationResponse<T = any> {
|
|
2
|
+
content: T[];
|
|
3
|
+
totalPages: number;
|
|
4
|
+
totalElements: number;
|
|
5
|
+
size: number;
|
|
6
|
+
number: number;
|
|
7
|
+
first: boolean;
|
|
8
|
+
last: boolean;
|
|
9
|
+
empty: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UniversalSelectorConfig {
|
|
12
|
+
/** Source of the data: Can be a remote Request, a Fixed array, or a Map/Object */
|
|
13
|
+
source: {
|
|
14
|
+
type: 'REQUEST';
|
|
15
|
+
url: string;
|
|
16
|
+
method: 'GET' | 'POST';
|
|
17
|
+
payload?: any;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'FIXED';
|
|
20
|
+
data: any[];
|
|
21
|
+
} | {
|
|
22
|
+
type: 'MAP';
|
|
23
|
+
data: Record<string, any>;
|
|
24
|
+
};
|
|
25
|
+
/** SINGLE allows one selection; MULTI allows multiple via checkboxes */
|
|
26
|
+
mode: 'SINGLE' | 'MULTI';
|
|
27
|
+
/** If true, shows the '(Select All)' checkbox at the top of the list */
|
|
28
|
+
selectAll: boolean;
|
|
29
|
+
/** The key the backend expects for the ID array (e.g., 'statuses', 'driverIds') */
|
|
30
|
+
backEndKey: string;
|
|
31
|
+
/** * Default is true.
|
|
32
|
+
* true -> returns { [backEndKey]: string[] }
|
|
33
|
+
* false -> returns { [backEndKey]: string[], selectAll: boolean }
|
|
34
|
+
*/
|
|
35
|
+
returnFlatArray?: boolean;
|
|
36
|
+
/** Configuration for rendering and extracting data from objects */
|
|
37
|
+
renderAndKeys: {
|
|
38
|
+
/** Keys to extract from the object to create the 'value' ID. Empty = whole object. */
|
|
39
|
+
valueByKeys?: string[];
|
|
40
|
+
/** Keys used to build the primary label displayed in the list. */
|
|
41
|
+
labelKeys: string[];
|
|
42
|
+
/** Optional keys for a secondary line of text in the list option. */
|
|
43
|
+
subValueKey?: string[];
|
|
44
|
+
/** String used to join multiple label keys (default is usually a space). */
|
|
45
|
+
separator?: string;
|
|
46
|
+
/** For complex parameter mapping. */
|
|
47
|
+
valueByParam?: string[][];
|
|
48
|
+
/** If true, labels will be passed through the TranslatePipe. */
|
|
49
|
+
needTranslate?: boolean;
|
|
50
|
+
/** Optional prefix for icons if rendered. */
|
|
51
|
+
iconPrefix?: string;
|
|
52
|
+
};
|
|
53
|
+
/** Optional search bar configuration */
|
|
54
|
+
search?: {
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
};
|
|
57
|
+
/** If true, a clear button can be implemented to reset selection */
|
|
58
|
+
clearable?: boolean;
|
|
59
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { PaginationResponse, UniversalSelectorConfig } from '../interfaces/selection-filtration-configuration.interface';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class FiltrationHelperService {
|
|
6
|
+
private http;
|
|
7
|
+
private dataEndpoint;
|
|
8
|
+
constructor(http: HttpClient, dataEndpoint: string);
|
|
9
|
+
getData(config: UniversalSelectorConfig, page?: number, size?: number, search?: string): Observable<PaginationResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Universal path extractor for strings or hierarchical arrays ['user', 'role', 'id']
|
|
12
|
+
*/
|
|
13
|
+
getValueByPath(item: any, path: string | Array<string | number>): any;
|
|
14
|
+
private filterLocal;
|
|
15
|
+
private wrapInFakePagination;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FiltrationHelperService, [null, { optional: true; }]>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FiltrationHelperService>;
|
|
18
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './lib/components/date-time-picker/date-time-picker.component';
|
|
|
23
23
|
export * from './lib/components/new-sidebar/new-sidebar.component';
|
|
24
24
|
export * from './lib/interfaces/license.interface';
|
|
25
25
|
export * from './lib/interfaces/driver.interface';
|
|
26
|
+
export * from './lib/interfaces/selection-filtration.tokens';
|
|
26
27
|
export * from './lib/interfaces/license-type.interface';
|
|
27
28
|
export * from './lib/services/ag-grid-functions.service';
|
|
28
29
|
export * from './lib/components/ag-grid/ag-grid-button-cell/ag-grid-button-cell.component';
|
|
@@ -31,3 +32,5 @@ export * from './lib/components/ag-grid/tooltip-cell-renderer.component';
|
|
|
31
32
|
export * from './lib/helper-functions/phone-number-formatter.function';
|
|
32
33
|
export * from './lib/components/phone-number-input/phone-number-input.component';
|
|
33
34
|
export * from './lib/components/phone-number-input/phone-number.validator';
|
|
35
|
+
export * from './lib/components/ag-grid/date-range-selection/date-range-selection.component';
|
|
36
|
+
export * from './lib/components/ag-grid/select-with-search/select-with-search.component';
|