@servicemind.tis/tis-smart-table-viewer 2.2.0 → 2.3.1
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/servicemind.tis-tis-smart-table-viewer.mjs +1200 -251
- package/fesm2022/servicemind.tis-tis-smart-table-viewer.mjs.map +1 -1
- package/lib/components/tis-smart-table-viewer/tis-smart-table-viewer.component.d.ts +25 -2
- package/lib/datasources/api.datasource.d.ts +2 -1
- package/lib/helpers/collection.helper.d.ts +92 -0
- package/lib/helpers/date-time.helper.d.ts +39 -0
- package/lib/helpers/filter-display.helper.d.ts +51 -0
- package/lib/helpers/query-params.helper.d.ts +47 -0
- package/lib/helpers/timeout-manager.helper.d.ts +72 -0
- package/lib/helpers/url.helper.d.ts +78 -0
- package/lib/helpers/validation.helper.d.ts +73 -0
- package/lib/tis-smart-table-viewer.module.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitter, SimpleChanges } from '@angular/core';
|
|
1
|
+
import { EventEmitter, SimpleChanges, OnDestroy } from '@angular/core';
|
|
2
2
|
import { FormGroup, FormControl } from '@angular/forms';
|
|
3
3
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
4
4
|
import { Subscription, Observable } from 'rxjs';
|
|
@@ -17,7 +17,7 @@ import { Location } from '@angular/common';
|
|
|
17
17
|
import type { DataNotFoundConfig } from '../../interfaces/data-not-found-config.type';
|
|
18
18
|
import type { ColumnCustomizationUrlConfig } from '../../interfaces/url-config.type';
|
|
19
19
|
import * as i0 from "@angular/core";
|
|
20
|
-
export declare class TisSmartTableViewerComponent {
|
|
20
|
+
export declare class TisSmartTableViewerComponent implements OnDestroy {
|
|
21
21
|
private dialog;
|
|
22
22
|
private apiService;
|
|
23
23
|
private route;
|
|
@@ -85,6 +85,15 @@ export declare class TisSmartTableViewerComponent {
|
|
|
85
85
|
search: string;
|
|
86
86
|
searchCtrl: FormControl<any>;
|
|
87
87
|
private _onDestroy;
|
|
88
|
+
private _selectionSubscription;
|
|
89
|
+
private _handsetSubscription;
|
|
90
|
+
private _queryParamsSubscription;
|
|
91
|
+
private _columnMappingCache;
|
|
92
|
+
private _displayedColumnsCache;
|
|
93
|
+
private _lastColumnsCodeMappingHash;
|
|
94
|
+
private _currentRequestSubject;
|
|
95
|
+
private timeoutManager;
|
|
96
|
+
private computedRowBackgrounds;
|
|
88
97
|
dataSource: ApiDataSource;
|
|
89
98
|
private _sort;
|
|
90
99
|
private _sortSubscription;
|
|
@@ -111,6 +120,7 @@ export declare class TisSmartTableViewerComponent {
|
|
|
111
120
|
isExpandedRow: boolean;
|
|
112
121
|
expandedTemplate: any;
|
|
113
122
|
isAllExpanded: boolean;
|
|
123
|
+
private expandedRowIds;
|
|
114
124
|
isHandset$: Observable<boolean>;
|
|
115
125
|
isMobile: boolean;
|
|
116
126
|
constructor(dialog: MatDialog, apiService: ApiService, route: ActivatedRoute, router: Router, location: Location, breakpointObserver: BreakpointObserver);
|
|
@@ -119,6 +129,19 @@ export declare class TisSmartTableViewerComponent {
|
|
|
119
129
|
ngOnDestroy(): void;
|
|
120
130
|
setDefaultColumns(): void;
|
|
121
131
|
handleDisplayedColumns(): void;
|
|
132
|
+
private updateColumnMappingCache;
|
|
133
|
+
trackByBreadcrumb(index: number, breadcrumb: {
|
|
134
|
+
url: string;
|
|
135
|
+
name: string;
|
|
136
|
+
}): string;
|
|
137
|
+
trackByFilterValue(index: number, filterValue: SelectedFilterDisplayValueType): string;
|
|
138
|
+
trackByAutoColumn(index: number, column: SmartTableWrapperColumnsConfig): string;
|
|
139
|
+
trackByTemplateColumn(index: number, column: SmartTableWrapperColumnsConfig): string;
|
|
140
|
+
trackByTableRow(index: number, row: any): any;
|
|
141
|
+
private getRowIdentifier;
|
|
142
|
+
isRowExpanded(row: any): boolean;
|
|
143
|
+
private clearRowBackgroundCache;
|
|
144
|
+
private computeAllRowBackgrounds;
|
|
122
145
|
handleSortingChanges(ch: any): void;
|
|
123
146
|
private getHomeUrl;
|
|
124
147
|
getNestedValue(obj: any, path: string): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CollectionViewer, DataSource } from '@angular/cdk/collections';
|
|
2
|
-
import { BehaviorSubject, Observable } from 'rxjs';
|
|
2
|
+
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
|
3
3
|
import { ApiService } from '../services/api.service';
|
|
4
4
|
export declare class ApiDataSource implements DataSource<any> {
|
|
5
5
|
private apiService;
|
|
@@ -14,4 +14,5 @@ export declare class ApiDataSource implements DataSource<any> {
|
|
|
14
14
|
connect(collectionViewer: CollectionViewer): Observable<any[]>;
|
|
15
15
|
disconnect(collectionViewer: CollectionViewer): void;
|
|
16
16
|
load(url: string, pageIndex: number, pageSize: number, search: string, filter?: object, sortFilter?: object): void;
|
|
17
|
+
loadWithCancellation(url: string, pageIndex: number, pageSize: number, search: string, filter?: object, sortFilter?: object, cancelSubject?: Subject<void>): void;
|
|
17
18
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized collection management utility helper for common array and object operations.
|
|
3
|
+
* Provides reusable functions for managing collections, selections, and data structures.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CollectionHelper {
|
|
6
|
+
/**
|
|
7
|
+
* Safely clears an array if it exists
|
|
8
|
+
* @param array - Array to clear
|
|
9
|
+
*/
|
|
10
|
+
static clearArray(array: any[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Safely clears a Set if it exists
|
|
13
|
+
* @param set - Set to clear
|
|
14
|
+
*/
|
|
15
|
+
static clearSet(set: Set<any>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Safely clears a Map if it exists
|
|
18
|
+
* @param map - Map to clear
|
|
19
|
+
*/
|
|
20
|
+
static clearMap(map: Map<any, any>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Gets a consistent identifier for a row based on available keys
|
|
23
|
+
* @param row - Row object
|
|
24
|
+
* @param primaryKey - Primary key property name (default: 'id')
|
|
25
|
+
* @param fallbackKey - Fallback key property name
|
|
26
|
+
* @returns Row identifier or JSON string as last resort
|
|
27
|
+
*/
|
|
28
|
+
static getRowIdentifier(row: any, primaryKey?: string, fallbackKey?: string): string | number;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a hash from an array of objects for cache validation
|
|
31
|
+
* @param items - Array of items to hash
|
|
32
|
+
* @param keyExtractor - Function to extract key from each item
|
|
33
|
+
* @returns Hash string
|
|
34
|
+
*/
|
|
35
|
+
static createArrayHash<T>(items: T[], keyExtractor: (item: T) => string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Safely filters an array with predicate function
|
|
38
|
+
* @param array - Array to filter
|
|
39
|
+
* @param predicate - Filter predicate function
|
|
40
|
+
* @returns Filtered array or empty array if input is invalid
|
|
41
|
+
*/
|
|
42
|
+
static safeFilter<T>(array: T[], predicate: (item: T) => boolean): T[];
|
|
43
|
+
/**
|
|
44
|
+
* Safely maps an array with transform function
|
|
45
|
+
* @param array - Array to map
|
|
46
|
+
* @param transform - Transform function
|
|
47
|
+
* @returns Mapped array or empty array if input is invalid
|
|
48
|
+
*/
|
|
49
|
+
static safeMap<T, U>(array: T[], transform: (item: T) => U): U[];
|
|
50
|
+
/**
|
|
51
|
+
* Safely finds an item in array
|
|
52
|
+
* @param array - Array to search
|
|
53
|
+
* @param predicate - Find predicate function
|
|
54
|
+
* @returns Found item or undefined
|
|
55
|
+
*/
|
|
56
|
+
static safeFind<T>(array: T[], predicate: (item: T) => boolean): T | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a Map from an array for O(1) lookups
|
|
59
|
+
* @param array - Array to convert
|
|
60
|
+
* @param keyExtractor - Function to extract key from each item
|
|
61
|
+
* @returns Map with keys and items
|
|
62
|
+
*/
|
|
63
|
+
static createLookupMap<T>(array: T[], keyExtractor: (item: T) => string): Map<string, T>;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if two arrays have the same items (order doesn't matter)
|
|
66
|
+
* @param array1 - First array
|
|
67
|
+
* @param array2 - Second array
|
|
68
|
+
* @param keyExtractor - Function to extract comparison key
|
|
69
|
+
* @returns True if arrays contain same items
|
|
70
|
+
*/
|
|
71
|
+
static arraysEqual<T>(array1: T[], array2: T[], keyExtractor?: (item: T) => any): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Safely removes items from a Set based on a predicate
|
|
74
|
+
* @param set - Set to modify
|
|
75
|
+
* @param predicate - Function to determine if item should be removed
|
|
76
|
+
*/
|
|
77
|
+
static removeFromSet<T>(set: Set<T>, predicate: (item: T) => boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* Safely clones an array to prevent mutation issues
|
|
80
|
+
* @param array - Array to clone
|
|
81
|
+
* @returns Cloned array or empty array if input is invalid
|
|
82
|
+
*/
|
|
83
|
+
static cloneArray<T>(array: T[]): T[];
|
|
84
|
+
/**
|
|
85
|
+
* Performs safe property access with default value
|
|
86
|
+
* @param obj - Object to access
|
|
87
|
+
* @param path - Property path (e.g., 'user.profile.name')
|
|
88
|
+
* @param defaultValue - Default value if property doesn't exist
|
|
89
|
+
* @returns Property value or default
|
|
90
|
+
*/
|
|
91
|
+
static getNestedProperty(obj: any, path: string, defaultValue?: any): any;
|
|
92
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
/**
|
|
3
|
+
* Centralized date/time utility helper for consistent date handling across the library.
|
|
4
|
+
* Provides common date formatting and conversion functions to avoid code duplication.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DateTimeHelper {
|
|
7
|
+
/**
|
|
8
|
+
* Formats a date value for display based on form control type
|
|
9
|
+
* @param value - The date value (Date, DateTime, string, number)
|
|
10
|
+
* @param formControlType - The type of form control ('date', 'date-time', etc.)
|
|
11
|
+
* @returns Formatted date string
|
|
12
|
+
*/
|
|
13
|
+
static formatForDisplay(value: any, formControlType: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Converts various date formats to DateTime object
|
|
16
|
+
* @param value - Date value in various formats
|
|
17
|
+
* @returns DateTime object or null if invalid
|
|
18
|
+
*/
|
|
19
|
+
static toDateTime(value: any): DateTime | null;
|
|
20
|
+
/**
|
|
21
|
+
* Converts date/DateTime objects to milliseconds for API calls
|
|
22
|
+
* @param value - Date value
|
|
23
|
+
* @returns Milliseconds or original value if not a date
|
|
24
|
+
*/
|
|
25
|
+
static toMilliseconds(value: any): any;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a query parameter key represents a date field
|
|
28
|
+
* @param key - Query parameter key
|
|
29
|
+
* @param value - Query parameter value
|
|
30
|
+
* @returns True if it's a date field
|
|
31
|
+
*/
|
|
32
|
+
static isDateQueryParam(key: string, value: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Parses date from query parameters
|
|
35
|
+
* @param value - Query parameter value (milliseconds as string)
|
|
36
|
+
* @returns DateTime object
|
|
37
|
+
*/
|
|
38
|
+
static parseFromQueryParam(value: string): DateTime;
|
|
39
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SelectedFilterDisplayValueType, SelectedFiltersGroupedValuesType, SelectedFilterDisplayValuesType } from '../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Centralized filter display utility helper for managing filter value formatting and grouping.
|
|
4
|
+
* Handles the complex logic of grouping and displaying filter values in a consistent manner.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FilterDisplayHelper {
|
|
7
|
+
/**
|
|
8
|
+
* Formats filter values based on form control type for display
|
|
9
|
+
* @param items - Array of filter display values
|
|
10
|
+
* @returns Processed array with formatted display values
|
|
11
|
+
*/
|
|
12
|
+
static formatFilterValuesForDisplay(items: SelectedFilterDisplayValueType[]): SelectedFilterDisplayValueType[];
|
|
13
|
+
/**
|
|
14
|
+
* Groups filter values by form control attributes
|
|
15
|
+
* @param data - Array of filter display values
|
|
16
|
+
* @returns Grouped filter values
|
|
17
|
+
*/
|
|
18
|
+
static groupByFormControlAttributes(data: SelectedFilterDisplayValueType[]): SelectedFiltersGroupedValuesType[];
|
|
19
|
+
/**
|
|
20
|
+
* Determines if a form control should only have single values
|
|
21
|
+
* @param formControlType - Type of form control
|
|
22
|
+
* @param explicitSingleValue - Explicit single value flag
|
|
23
|
+
* @returns True if single value control
|
|
24
|
+
*/
|
|
25
|
+
static isSingleValueFormControl(formControlType: string, explicitSingleValue?: boolean): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Updates selected filter values by replacing values for a specific form control
|
|
28
|
+
* @param currentValues - Current selected filter values
|
|
29
|
+
* @param newValues - New values to add/update
|
|
30
|
+
* @param formControlName - Name of the form control being updated
|
|
31
|
+
* @returns Updated filter values and grouped values
|
|
32
|
+
*/
|
|
33
|
+
static updateSelectedFilterValues(currentValues: SelectedFilterDisplayValuesType, newValues: SelectedFilterDisplayValueType | SelectedFilterDisplayValuesType, formControlName?: string): {
|
|
34
|
+
selectedFilterValues: SelectedFilterDisplayValuesType;
|
|
35
|
+
selectedFilterGroupedValues: SelectedFiltersGroupedValuesType[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Filters selected values to only show those present in query parameters
|
|
39
|
+
* @param selectedValues - All selected filter values
|
|
40
|
+
* @param queryParams - Current query parameters
|
|
41
|
+
* @returns Filtered values for display
|
|
42
|
+
*/
|
|
43
|
+
static getValuesForDisplay(selectedValues: SelectedFilterDisplayValuesType, queryParams: any): SelectedFilterDisplayValuesType;
|
|
44
|
+
/**
|
|
45
|
+
* Removes a specific filter value from the collection
|
|
46
|
+
* @param selectedValues - Current selected filter values
|
|
47
|
+
* @param filterToRemove - Filter value to remove
|
|
48
|
+
* @returns Updated filter values
|
|
49
|
+
*/
|
|
50
|
+
static removeFilterValue(selectedValues: SelectedFilterDisplayValuesType, filterToRemove: SelectedFilterDisplayValueType): SelectedFilterDisplayValuesType;
|
|
51
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized query parameter utility helper for consistent URL parameter handling.
|
|
3
|
+
* Provides common functions for parsing, validating, and transforming query parameters.
|
|
4
|
+
*/
|
|
5
|
+
export declare class QueryParamsHelper {
|
|
6
|
+
/**
|
|
7
|
+
* Parses query parameters from URL and handles type conversions
|
|
8
|
+
* @param url - Full URL string
|
|
9
|
+
* @returns Parsed query parameters object
|
|
10
|
+
*/
|
|
11
|
+
static parseQueryParams(url: string): Record<string, string | string[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a query parameter value is valid (not empty, null, or undefined)
|
|
14
|
+
* @param value - Query parameter value
|
|
15
|
+
* @returns True if valid
|
|
16
|
+
*/
|
|
17
|
+
static isValidParam(value: any): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Processes a query parameter value and handles arrays
|
|
20
|
+
* @param value - Raw query parameter value
|
|
21
|
+
* @returns Processed value (string or array)
|
|
22
|
+
*/
|
|
23
|
+
static processParamValue(value: string): string | string[];
|
|
24
|
+
/**
|
|
25
|
+
* Processes query parameters for filter form with type conversions
|
|
26
|
+
* @param queryParams - Raw query parameters
|
|
27
|
+
* @param columnsCodeMapping - Column mapping for transformations
|
|
28
|
+
* @returns Processed filter and sort objects
|
|
29
|
+
*/
|
|
30
|
+
static processForFilters(queryParams: any, columnsCodeMapping: any[]): {
|
|
31
|
+
filterParams: any;
|
|
32
|
+
sortParams: any;
|
|
33
|
+
pageIndex: number;
|
|
34
|
+
pageSize: number;
|
|
35
|
+
search: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Builds query string from filter data with proper encoding
|
|
39
|
+
* @param filterData - Filter form data
|
|
40
|
+
* @param sortParams - Sort parameters
|
|
41
|
+
* @param pageIndex - Current page index
|
|
42
|
+
* @param pageSize - Current page size
|
|
43
|
+
* @param search - Search term
|
|
44
|
+
* @returns URLSearchParams object
|
|
45
|
+
*/
|
|
46
|
+
static buildQueryString(filterData: any, sortParams: any, pageIndex: number, pageSize: number, search: string): URLSearchParams;
|
|
47
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimeoutManager - A utility class for managing timeouts to prevent memory leaks
|
|
3
|
+
*
|
|
4
|
+
* This class provides a centralized way to create, track, and clean up setTimeout calls.
|
|
5
|
+
* It automatically handles cleanup when component is destroyed to prevent memory leaks.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* export class MyComponent implements OnDestroy {
|
|
10
|
+
* private timeoutManager = new TimeoutManager();
|
|
11
|
+
*
|
|
12
|
+
* someMethod() {
|
|
13
|
+
* this.timeoutManager.createTimeout(() => {
|
|
14
|
+
* console.log('Delayed execution');
|
|
15
|
+
* }, 1000);
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* ngOnDestroy() {
|
|
19
|
+
* this.timeoutManager.clearAll(); // Clean up all pending timeouts
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class TimeoutManager {
|
|
25
|
+
private activeTimeouts;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a tracked timeout that will be automatically cleaned up
|
|
28
|
+
* @param callback - Function to execute after delay
|
|
29
|
+
* @param delay - Delay in milliseconds
|
|
30
|
+
* @returns The timeout ID (same as setTimeout return value)
|
|
31
|
+
*/
|
|
32
|
+
createTimeout(callback: () => void, delay: number): ReturnType<typeof setTimeout>;
|
|
33
|
+
/**
|
|
34
|
+
* Manually clear a specific timeout
|
|
35
|
+
* @param timeoutId - The timeout ID returned from createTimeout
|
|
36
|
+
*/
|
|
37
|
+
clearTimeout(timeoutId: ReturnType<typeof setTimeout>): void;
|
|
38
|
+
/**
|
|
39
|
+
* Clear all pending timeouts
|
|
40
|
+
* This should be called in ngOnDestroy to prevent memory leaks
|
|
41
|
+
*/
|
|
42
|
+
clearAll(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Get the number of active (pending) timeouts
|
|
45
|
+
* Useful for debugging and testing
|
|
46
|
+
*/
|
|
47
|
+
get activeCount(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Check if a specific timeout is still active
|
|
50
|
+
* @param timeoutId - The timeout ID to check
|
|
51
|
+
*/
|
|
52
|
+
isActive(timeoutId: ReturnType<typeof setTimeout>): boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Static helper functions for one-off timeout usage
|
|
56
|
+
* Use the TimeoutManager class for more comprehensive timeout management
|
|
57
|
+
*/
|
|
58
|
+
export declare class TimeoutHelper {
|
|
59
|
+
/**
|
|
60
|
+
* Create a single tracked timeout with external cleanup responsibility
|
|
61
|
+
* @param callback - Function to execute after delay
|
|
62
|
+
* @param delay - Delay in milliseconds
|
|
63
|
+
* @param trackingSet - Set to track the timeout for cleanup
|
|
64
|
+
* @returns The timeout ID
|
|
65
|
+
*/
|
|
66
|
+
static createTrackedTimeout(callback: () => void, delay: number, trackingSet: Set<ReturnType<typeof setTimeout>>): ReturnType<typeof setTimeout>;
|
|
67
|
+
/**
|
|
68
|
+
* Clear all timeouts in a tracking set
|
|
69
|
+
* @param trackingSet - Set containing timeout IDs to clear
|
|
70
|
+
*/
|
|
71
|
+
static clearAllTimeouts(trackingSet: Set<ReturnType<typeof setTimeout>>): void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
3
|
+
/**
|
|
4
|
+
* Centralized URL and navigation utility helper.
|
|
5
|
+
* Provides common functions for URL manipulation and navigation.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UrlHelper {
|
|
8
|
+
/**
|
|
9
|
+
* Extracts the home URL from current window location
|
|
10
|
+
* @returns Home URL path
|
|
11
|
+
*/
|
|
12
|
+
static getHomeUrl(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Safely navigates to a URL if it's valid
|
|
15
|
+
* @param router - Angular Router instance
|
|
16
|
+
* @param url - URL to navigate to
|
|
17
|
+
* @returns Promise<boolean> - Navigation result
|
|
18
|
+
*/
|
|
19
|
+
static safeNavigate(router: Router, url: string): Promise<boolean> | null;
|
|
20
|
+
/**
|
|
21
|
+
* Updates the browser URL without navigation using Location service
|
|
22
|
+
* @param location - Angular Location service
|
|
23
|
+
* @param baseUrl - Base URL path
|
|
24
|
+
* @param queryString - Query string parameters
|
|
25
|
+
*/
|
|
26
|
+
static updateUrl(location: Location, baseUrl: string, queryString: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Builds a complete URL with query parameters
|
|
29
|
+
* @param baseUrl - Base URL path
|
|
30
|
+
* @param queryParams - URLSearchParams object
|
|
31
|
+
* @returns Complete URL string
|
|
32
|
+
*/
|
|
33
|
+
static buildUrl(baseUrl: string, queryParams: URLSearchParams): string;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the base URL without query parameters
|
|
36
|
+
* @param router - Angular Router instance
|
|
37
|
+
* @returns Base URL string
|
|
38
|
+
*/
|
|
39
|
+
static getBaseUrl(router: Router): string;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if current URL differs from generated URL
|
|
42
|
+
* @param generatedUrl - Generated URL to compare
|
|
43
|
+
* @returns True if URLs are different
|
|
44
|
+
*/
|
|
45
|
+
static hasUrlChanged(generatedUrl: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Extracts query parameters from a URL string
|
|
48
|
+
* @param url - Full URL string
|
|
49
|
+
* @returns URLSearchParams object
|
|
50
|
+
*/
|
|
51
|
+
static extractQueryParams(url: string): URLSearchParams | null;
|
|
52
|
+
/**
|
|
53
|
+
* Handles button click actions (URL navigation or callback execution)
|
|
54
|
+
* @param router - Angular Router instance
|
|
55
|
+
* @param config - Button configuration object
|
|
56
|
+
* @param primaryUrlKey - Primary URL property name (default: 'btnUrl')
|
|
57
|
+
* @param primaryClickKey - Primary click handler property name (default: 'btnClick')
|
|
58
|
+
*/
|
|
59
|
+
static handleButtonClick(router: Router, config: any, primaryUrlKey?: string, primaryClickKey?: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Handles secondary button click actions
|
|
62
|
+
* @param router - Angular Router instance
|
|
63
|
+
* @param config - Button configuration object
|
|
64
|
+
*/
|
|
65
|
+
static handleSecondaryButtonClick(router: Router, config: any): void;
|
|
66
|
+
/**
|
|
67
|
+
* Validates if a URL string is properly formatted
|
|
68
|
+
* @param url - URL to validate
|
|
69
|
+
* @returns True if URL is valid
|
|
70
|
+
*/
|
|
71
|
+
static isValidUrl(url: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Safely encodes URL parameters
|
|
74
|
+
* @param value - Value to encode
|
|
75
|
+
* @returns Encoded string
|
|
76
|
+
*/
|
|
77
|
+
static encodeParam(value: any): string;
|
|
78
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized validation utility helper for common validation tasks.
|
|
3
|
+
* Provides reusable validation functions to avoid code duplication.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ValidationHelper {
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a value is not null, undefined, or empty string
|
|
8
|
+
* @param value - Value to check
|
|
9
|
+
* @returns True if value has content
|
|
10
|
+
*/
|
|
11
|
+
static hasValue(value: any): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if any values in an object are non-empty
|
|
14
|
+
* @param obj - Object to check
|
|
15
|
+
* @returns True if any value is non-empty
|
|
16
|
+
*/
|
|
17
|
+
static hasNonEmptyValue(obj: any): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a form has any non-empty values
|
|
20
|
+
* @param formData - Form data object
|
|
21
|
+
* @returns True if form has any data
|
|
22
|
+
*/
|
|
23
|
+
static hasFormData(formData: any): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Validates if an array has items
|
|
26
|
+
* @param array - Array to check
|
|
27
|
+
* @returns True if array exists and has items
|
|
28
|
+
*/
|
|
29
|
+
static hasItems(array: any[]): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a URL is valid
|
|
32
|
+
* @param url - URL string to validate
|
|
33
|
+
* @returns True if URL is valid
|
|
34
|
+
*/
|
|
35
|
+
static isValidUrl(url: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Validates if a string is a valid number
|
|
38
|
+
* @param value - Value to check
|
|
39
|
+
* @returns True if value is a valid number
|
|
40
|
+
*/
|
|
41
|
+
static isValidNumber(value: any): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if an object has a specific property with a valid value
|
|
44
|
+
* @param obj - Object to check
|
|
45
|
+
* @param property - Property name
|
|
46
|
+
* @returns True if property exists and has a value
|
|
47
|
+
*/
|
|
48
|
+
static hasProperty(obj: any, property: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Validates if a selection model row has the required key
|
|
51
|
+
* @param row - Row object
|
|
52
|
+
* @param keyName - Key property name
|
|
53
|
+
* @returns True if row has the key property with a value
|
|
54
|
+
*/
|
|
55
|
+
static hasRowKey(row: any, keyName: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if a filter value should be processed (not null, empty, or invalid)
|
|
58
|
+
* @param value - Filter value
|
|
59
|
+
* @returns True if filter value is valid for processing
|
|
60
|
+
*/
|
|
61
|
+
static isValidFilterValue(value: any): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Validates pagination parameters
|
|
64
|
+
* @param pageIndex - Page index
|
|
65
|
+
* @param pageSize - Page size
|
|
66
|
+
* @returns Object with validation results
|
|
67
|
+
*/
|
|
68
|
+
static validatePagination(pageIndex: any, pageSize: any): {
|
|
69
|
+
isValid: boolean;
|
|
70
|
+
pageIndex: number;
|
|
71
|
+
pageSize: number;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -32,6 +32,6 @@ import * as i30 from "@angular/material/sort";
|
|
|
32
32
|
import * as i31 from "@angular/cdk/drag-drop";
|
|
33
33
|
export declare class TisSmartTableViewerModule {
|
|
34
34
|
static ɵfac: i0.ɵɵFactoryDeclaration<TisSmartTableViewerModule, never>;
|
|
35
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<TisSmartTableViewerModule, [typeof i1.ScrollingDirective, typeof i2.TisDatePipe, typeof i3.TisDateTimePipe, typeof i4.TisDateTimeWithSecondsPipe, typeof i5.Quantity, typeof i6.Money, typeof i7.TisSmartTableViewerComponent, typeof i8.TisColumnsBtnComponent, typeof i9.CreateColumnsTemplateComponent, typeof
|
|
35
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TisSmartTableViewerModule, [typeof i1.ScrollingDirective, typeof i2.TisDatePipe, typeof i3.TisDateTimePipe, typeof i4.TisDateTimeWithSecondsPipe, typeof i5.Quantity, typeof i6.Money, typeof i7.TisSmartTableViewerComponent, typeof i8.TisColumnsBtnComponent, typeof i9.CreateColumnsTemplateComponent, typeof i10.TisSmartTableErrorDialogComponent, typeof i11.TisSmartTableConfirmationDialogComponent], [typeof i12.CommonModule, typeof i13.FormsModule, typeof i13.ReactiveFormsModule, typeof i14.RouterLink, typeof i14.RouterOutlet, typeof i15.MatTooltipModule, typeof i16.MatIconModule, typeof i17.MatFormFieldModule, typeof i18.MatSelectModule, typeof i19.MatInputModule, typeof i20.MatSnackBarModule, typeof i21.MatProgressSpinnerModule, typeof i22.MatButtonModule, typeof i23.MatPaginatorModule, typeof i24.LayoutModule, typeof i25.MatDialogModule, typeof i26.MatTableModule, typeof i27.MatCheckboxModule, typeof i28.MatMenuModule, typeof i29.MatDividerModule, typeof i30.MatSortModule, typeof i31.DragDropModule], [typeof i7.TisSmartTableViewerComponent]>;
|
|
36
36
|
static ɵinj: i0.ɵɵInjectorDeclaration<TisSmartTableViewerModule>;
|
|
37
37
|
}
|