@sumaris-net/ngx-components 18.22.4 → 18.22.5
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/doc/changelog.md +5 -0
- package/esm2022/src/app/shared/functions.mjs +100 -9
- package/fesm2022/sumaris-net.ngx-components.mjs +100 -9
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/functions.d.ts +77 -3
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -68,9 +68,83 @@ export declare function suggestFromStringArray(values: string[], searchText: any
|
|
|
68
68
|
}): string[];
|
|
69
69
|
export declare function joinPropertiesPath<T = any>(obj: T, properties: string[], separator?: string): string | undefined;
|
|
70
70
|
export declare function joinProperties<T = any, K extends keyof T = any>(obj: T, keys: K[], separator?: string): string | undefined;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Generic comparison between two values.
|
|
73
|
+
*
|
|
74
|
+
* Compares two values using the JavaScript greater-than operator.
|
|
75
|
+
* Works for numbers, strings, dates, and any types that provide
|
|
76
|
+
* a meaningful `>` comparison. Use for ascending order.
|
|
77
|
+
*
|
|
78
|
+
* @typeParam T - Type of the compared values.
|
|
79
|
+
* @param a - Left value to compare.
|
|
80
|
+
* @param b - Right value to compare.
|
|
81
|
+
* @returns 0 if equal, -1 if a < b, 1 if a > b.
|
|
82
|
+
*/
|
|
83
|
+
export declare function compareValues<T>(a: T, b: T): number;
|
|
84
|
+
/**
|
|
85
|
+
* Reverse comparison between two values (descending order).
|
|
86
|
+
*
|
|
87
|
+
* Same semantics as {@link compareValues} but inverted, to sort
|
|
88
|
+
* in descending order.
|
|
89
|
+
*
|
|
90
|
+
* @typeParam T - Type of the compared values.
|
|
91
|
+
* @param a - Left value to compare.
|
|
92
|
+
* @param b - Right value to compare.
|
|
93
|
+
* @returns 0 if equal, 1 if a < b, -1 if a > b.
|
|
94
|
+
*/
|
|
95
|
+
export declare function compareValuesDesc<T>(a: T, b: T): number;
|
|
96
|
+
/**
|
|
97
|
+
* Build a comparator function based on a nested property path.
|
|
98
|
+
*
|
|
99
|
+
* Uses {@link getPropertyByPath} to extract values and compares them
|
|
100
|
+
* in ascending or descending order.
|
|
101
|
+
*
|
|
102
|
+
* @typeParam T - Type of compared objects.
|
|
103
|
+
* @param path - Property path or array path (e.g. "a.b[0].c").
|
|
104
|
+
* @param direction - Sort direction, 'asc' by default.
|
|
105
|
+
* @returns A comparator compatible with `Array.prototype.sort`.
|
|
106
|
+
*/
|
|
107
|
+
export declare function propertyPathComparator<T = any>(path: string | string[], direction?: 'asc' | 'desc'): (a: T, b: T) => number;
|
|
108
|
+
/**
|
|
109
|
+
* Build a comparator based on a direct property of the compared objects.
|
|
110
|
+
*
|
|
111
|
+
* Falls back to `defaultValue` when the property is `undefined` on an item.
|
|
112
|
+
*
|
|
113
|
+
* @typeParam T - Type of compared objects.
|
|
114
|
+
* @typeParam K - Key of the property in `T`.
|
|
115
|
+
* @param property - Property name to compare.
|
|
116
|
+
* @param direction - Sort direction, 'asc' by default.
|
|
117
|
+
* @param defaultValue - Value used when the property is undefined.
|
|
118
|
+
* @returns A comparator compatible with `Array.prototype.sort`.
|
|
119
|
+
*/
|
|
120
|
+
export declare function propertyComparator<T = any, K extends keyof T = any>(property: K, direction?: 'asc' | 'desc', defaultValue?: any): (a: T, b: T) => number;
|
|
121
|
+
/**
|
|
122
|
+
* Build a comparator using multiple property paths as tie-breakers.
|
|
123
|
+
*
|
|
124
|
+
* Each key in `keys` is resolved via {@link getPropertyByPath}. The first
|
|
125
|
+
* non-zero comparison result is returned. If provided, `defaultValues[i]`
|
|
126
|
+
* is used when a value at `keys[i]` is undefined.
|
|
127
|
+
*
|
|
128
|
+
* @typeParam T - Type of compared objects.
|
|
129
|
+
* @param keys - Ordered list of property paths to compare.
|
|
130
|
+
* @param direction - Sort direction applied to each key, 'asc' by default.
|
|
131
|
+
* @param defaultValues - Optional default values, aligned with `keys`.
|
|
132
|
+
* @throws Error when `keys` is empty or when `defaultValues` length is invalid.
|
|
133
|
+
* @returns A comparator compatible with `Array.prototype.sort`.
|
|
134
|
+
*/
|
|
135
|
+
export declare function propertiesPathComparator<T = any>(keys: string[], direction?: 'asc' | 'desc', defaultValues?: any[]): (a: T, b: T) => number;
|
|
136
|
+
/**
|
|
137
|
+
* Compose a comparator from multiple comparators (multi-level sort).
|
|
138
|
+
*
|
|
139
|
+
* Each comparator is applied sequentially. The first non-zero result is
|
|
140
|
+
* returned, allowing you to define primary, secondary, tertiary criteria, etc.
|
|
141
|
+
* If all comparators return 0, the items are considered equivalent.
|
|
142
|
+
*
|
|
143
|
+
* @typeParam T - Type of the compared items.
|
|
144
|
+
* @param comparators - List of comparator functions to apply in order.
|
|
145
|
+
* @returns A comparator compatible with `Array.prototype.sort`.
|
|
146
|
+
*/
|
|
147
|
+
export declare function composeComparators<T>(...comparators: Array<(a: T, b: T) => number>): (a: T, b: T) => number;
|
|
74
148
|
export declare function sort<T>(array: T[], attribute?: string, opts?: Intl.CollatorOptions): T[];
|
|
75
149
|
export declare function isInt(value: string): boolean;
|
|
76
150
|
export declare function isNumber(value: string): boolean;
|
package/src/assets/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ngx-sumaris-components",
|
|
3
3
|
"short_name": "ngx-sumaris-components",
|
|
4
4
|
"manifest_version": 1,
|
|
5
|
-
"version": "18.22.
|
|
5
|
+
"version": "18.22.5",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|