@bootkit/ng0 0.0.0-alpha.4 → 0.0.0-alpha.41
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/README.md +2 -2
- package/common/index.d.ts +263 -7
- package/components/accordion/index.d.ts +13 -3
- package/components/backdrop/index.d.ts +12 -0
- package/components/dropdown/index.d.ts +156 -0
- package/components/form-field/index.d.ts +24 -41
- package/components/list/index.d.ts +260 -0
- package/components/modal/index.d.ts +21 -3
- package/components/nav/index.d.ts +23 -19
- package/components/offcanvas/index.d.ts +13 -5
- package/components/pagination/index.d.ts +34 -8
- package/components/select/index.d.ts +160 -0
- package/components/sidenav/index.d.ts +125 -0
- package/components/table/index.d.ts +191 -59
- package/components/tooltip/index.d.ts +20 -11
- package/components/vertical-menu/index.d.ts +57 -0
- package/data/index.d.ts +103 -38
- package/date/index.d.ts +34 -0
- package/fesm2022/bootkit-ng0-common.mjs +289 -12
- package/fesm2022/bootkit-ng0-common.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-accordion.mjs +34 -27
- package/fesm2022/bootkit-ng0-components-accordion.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-backdrop.mjs +46 -0
- package/fesm2022/bootkit-ng0-components-backdrop.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-button.mjs +12 -12
- package/fesm2022/bootkit-ng0-components-button.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-card.mjs +13 -13
- package/fesm2022/bootkit-ng0-components-card.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-code.mjs +10 -10
- package/fesm2022/bootkit-ng0-components-code.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-collapse.mjs +16 -16
- package/fesm2022/bootkit-ng0-components-collapse.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-confirmation.mjs +14 -14
- package/fesm2022/bootkit-ng0-components-confirmation.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-dropdown.mjs +308 -0
- package/fesm2022/bootkit-ng0-components-dropdown.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-form-field.mjs +62 -84
- package/fesm2022/bootkit-ng0-components-form-field.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-list.mjs +564 -0
- package/fesm2022/bootkit-ng0-components-list.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-modal.mjs +41 -24
- package/fesm2022/bootkit-ng0-components-modal.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-nav.mjs +59 -60
- package/fesm2022/bootkit-ng0-components-nav.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs +20 -13
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-overlay.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-pagination.mjs +59 -24
- package/fesm2022/bootkit-ng0-components-pagination.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-popover.mjs +12 -12
- package/fesm2022/bootkit-ng0-components-popover.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-select.mjs +448 -0
- package/fesm2022/bootkit-ng0-components-select.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-sidenav.mjs +290 -0
- package/fesm2022/bootkit-ng0-components-sidenav.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-stepper.mjs +15 -15
- package/fesm2022/bootkit-ng0-components-stepper.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-table.mjs +303 -159
- package/fesm2022/bootkit-ng0-components-table.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-toast.mjs +7 -7
- package/fesm2022/bootkit-ng0-components-toast.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-tooltip.mjs +41 -22
- package/fesm2022/bootkit-ng0-components-tooltip.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs +148 -0
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-data.mjs +152 -39
- package/fesm2022/bootkit-ng0-data.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-date.mjs +50 -0
- package/fesm2022/bootkit-ng0-date.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-file.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-form.mjs +336 -264
- package/fesm2022/bootkit-ng0-form.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-http.mjs +40 -5
- package/fesm2022/bootkit-ng0-http.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-layouts-layout1.mjs +317 -0
- package/fesm2022/bootkit-ng0-layouts-layout1.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-localization-locales.mjs +101 -0
- package/fesm2022/bootkit-ng0-localization-locales.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-localization.mjs +431 -105
- package/fesm2022/bootkit-ng0-localization.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-platform-browser.mjs +179 -0
- package/fesm2022/bootkit-ng0-platform-browser.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-routing.mjs +80 -0
- package/fesm2022/bootkit-ng0-routing.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-script.mjs +3 -3
- package/fesm2022/bootkit-ng0-script.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-security.mjs +16 -16
- package/fesm2022/bootkit-ng0-security.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-utils.mjs +75 -0
- package/fesm2022/bootkit-ng0-utils.mjs.map +1 -0
- package/fesm2022/bootkit-ng0.mjs +2 -2
- package/fesm2022/bootkit-ng0.mjs.map +1 -1
- package/form/index.d.ts +94 -62
- package/http/index.d.ts +35 -4
- package/index.d.ts +2 -2
- package/layouts/layout1/index.d.ts +201 -0
- package/localization/index.d.ts +231 -42
- package/localization/locales/index.d.ts +7 -0
- package/package.json +63 -15
- package/platform/browser/index.d.ts +88 -0
- package/routing/index.d.ts +124 -0
- package/utils/index.d.ts +42 -0
package/data/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { FilterPredicate } from '@bootkit/ng0/common';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
1
3
|
import * as rxjs from 'rxjs';
|
|
2
4
|
import { Observable } from 'rxjs';
|
|
5
|
+
import * as _bootkit_ng0_data from '@bootkit/ng0/data';
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* DataRequest class represents a request for data with pagination, filtering, sorting, and field selection.
|
|
@@ -14,8 +17,7 @@ declare class DataRequest {
|
|
|
14
17
|
select?: string[];
|
|
15
18
|
computeTotal?: boolean;
|
|
16
19
|
constructor(options?: {
|
|
17
|
-
|
|
18
|
-
pageSize?: number;
|
|
20
|
+
page?: DataRequestPage;
|
|
19
21
|
filters?: DataRequestFilter[];
|
|
20
22
|
sort?: DataRequestSort;
|
|
21
23
|
select?: string[];
|
|
@@ -23,13 +25,22 @@ declare class DataRequest {
|
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
|
-
* Represents a
|
|
27
|
-
* @property index The index of the page (0-based).
|
|
28
|
-
* @property size The size of the page (number of items per page).
|
|
28
|
+
* Represents a data request page.
|
|
29
29
|
*/
|
|
30
30
|
interface DataRequestPage {
|
|
31
|
+
/**
|
|
32
|
+
* Index of the page.
|
|
33
|
+
* If zeroBased is true, the index starts from 0.
|
|
34
|
+
*/
|
|
31
35
|
index: number;
|
|
36
|
+
/**
|
|
37
|
+
* Size of the page, i.e., number of items in each page.
|
|
38
|
+
*/
|
|
32
39
|
size: number;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates if the index is zero-based.
|
|
42
|
+
*/
|
|
43
|
+
zeroBased: boolean;
|
|
33
44
|
}
|
|
34
45
|
/**
|
|
35
46
|
* Represents a sorting option in a DataRequest.
|
|
@@ -42,14 +53,32 @@ interface DataRequestSort {
|
|
|
42
53
|
}
|
|
43
54
|
/**
|
|
44
55
|
* Represents a filter in a DataRequest.
|
|
45
|
-
* @property field The field to filter by.
|
|
46
|
-
* @property value The value to filter by.
|
|
47
|
-
* @property operator The operator to use for filtering.
|
|
48
56
|
*/
|
|
49
57
|
interface DataRequestFilter {
|
|
50
|
-
|
|
58
|
+
/**
|
|
59
|
+
* The field to filter by.
|
|
60
|
+
* It can be a string representing the property name of the data items.
|
|
61
|
+
*/
|
|
62
|
+
field?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The value to filter by.
|
|
65
|
+
* It can be a string, number, or any other type depending on the field.
|
|
66
|
+
*/
|
|
51
67
|
value?: string;
|
|
52
|
-
|
|
68
|
+
/**
|
|
69
|
+
* The operator to use for filtering.
|
|
70
|
+
* It can be one of the standard filter operators like Contains, StartsWith, EndsWith, Equals, etc.
|
|
71
|
+
*/
|
|
72
|
+
operator?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Indicates if the filter is case-sensitive. only for text columns.
|
|
75
|
+
* Default is false.
|
|
76
|
+
*/
|
|
77
|
+
caseSensitive?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* A custom filter function to apply for filtering.
|
|
80
|
+
*/
|
|
81
|
+
filterBy?: FilterPredicate;
|
|
53
82
|
}
|
|
54
83
|
|
|
55
84
|
declare class DataResult<T = any> {
|
|
@@ -58,52 +87,88 @@ declare class DataResult<T = any> {
|
|
|
58
87
|
constructor(data: T[], total?: number | undefined);
|
|
59
88
|
}
|
|
60
89
|
|
|
90
|
+
/**
|
|
91
|
+
* DataLoader is a function that takes a DataRequest and returns an Observable of DataResult.
|
|
92
|
+
* It is used by RemoteDataSource to load data asynchronously.
|
|
93
|
+
*/
|
|
94
|
+
type DataLoader<T = any> = (request: DataRequest) => Observable<DataResult<T>>;
|
|
95
|
+
/**
|
|
96
|
+
* Abstract base class for data sources.
|
|
97
|
+
* This class provides a common interface for loading data from various sources.
|
|
98
|
+
*/
|
|
61
99
|
declare abstract class DataSource<T = any> {
|
|
62
|
-
|
|
100
|
+
abstract readonly type: 'local' | 'remote';
|
|
101
|
+
protected _isLoading: _angular_core.WritableSignal<boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* Indicates whether the data source is currently loading data.
|
|
104
|
+
*/
|
|
105
|
+
isLoading: _angular_core.Signal<boolean>;
|
|
63
106
|
constructor();
|
|
64
|
-
|
|
65
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Loads data from the data source.
|
|
109
|
+
* @param request The data request object containing pagination, sorting, and filtering information.
|
|
110
|
+
*/
|
|
66
111
|
abstract load(request: DataRequest): Observable<DataResult>;
|
|
67
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* DataSourceLike is a type that can be used to represent any data source
|
|
115
|
+
* that can be used with the table, autocomplete, dropdown and any component that requires data.
|
|
116
|
+
* It can be an array of data, a function that returns an observable of data,
|
|
117
|
+
* or an instance of DataSource.
|
|
118
|
+
*/
|
|
119
|
+
type DataSourceLike<T = any> = Array<any> | DataLoader<T> | DataSource<T> | Record<string, string | number> | // enum: extract enum or object values
|
|
120
|
+
undefined | null;
|
|
68
121
|
|
|
69
122
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
123
|
+
* Converts a DataSourceLike to a DataSource instance.
|
|
124
|
+
* @param source The data source to convert.
|
|
125
|
+
* @returns A DataSource instance.
|
|
72
126
|
*/
|
|
73
|
-
|
|
127
|
+
declare function dataSourceAttribute<T>(source: DataSourceLike): DataSource<T>;
|
|
128
|
+
|
|
74
129
|
/**
|
|
75
|
-
*
|
|
130
|
+
* RemoteDataSource is a DataSource that loads data asynchronously using a DataLoader function.
|
|
76
131
|
* It is used to fetch data from a remote source, such as an API.
|
|
77
132
|
*/
|
|
78
|
-
declare class
|
|
133
|
+
declare class RemoteDataSource extends DataSource {
|
|
79
134
|
private readonly loader;
|
|
135
|
+
readonly type = "remote";
|
|
80
136
|
constructor(loader: DataLoader);
|
|
81
|
-
load(request: DataRequest): Observable<DataResult<any>>;
|
|
137
|
+
load(request: DataRequest): Observable<_bootkit_ng0_data.DataResult<any>>;
|
|
82
138
|
}
|
|
83
139
|
|
|
84
|
-
|
|
140
|
+
/**
|
|
141
|
+
* An implementation of DataSource that uses an array as the data source.
|
|
142
|
+
* This is useful for static data or when you want to manage the data manually.
|
|
143
|
+
*/
|
|
144
|
+
declare class LocalDataSource extends DataSource {
|
|
85
145
|
private items;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}>;
|
|
92
|
-
readonly removed: rxjs.Observable<{
|
|
93
|
-
item: any;
|
|
94
|
-
index: number;
|
|
95
|
-
}>;
|
|
96
|
-
readonly updated: rxjs.Observable<{
|
|
97
|
-
item: any;
|
|
98
|
-
index: number;
|
|
99
|
-
}>;
|
|
146
|
+
readonly type = "local";
|
|
147
|
+
/**
|
|
148
|
+
* Creates a new LocalDataSource.
|
|
149
|
+
* @param items The array of items to be used as the data source.
|
|
150
|
+
*/
|
|
100
151
|
constructor(items: any[]);
|
|
152
|
+
/**
|
|
153
|
+
* Creates a LocalDataSource from enum values.
|
|
154
|
+
* @param enumClass The enum class to extract values from.
|
|
155
|
+
* @returns A LocalDataSource containing the enum values.
|
|
156
|
+
*/
|
|
157
|
+
static fromEnum(enumClass: Record<string, string | number>): LocalDataSource;
|
|
158
|
+
/**
|
|
159
|
+
* Loads data from the local array based on the provided DataRequest.
|
|
160
|
+
* @param request The DataRequest containing filtering, sorting, and pagination information.
|
|
161
|
+
* @returns An observable of DataResult containing the requested data.
|
|
162
|
+
*/
|
|
101
163
|
load(request: DataRequest): rxjs.Observable<DataResult<any>>;
|
|
102
|
-
remove(item: any): void;
|
|
103
|
-
insert(...items: any[]): void;
|
|
104
164
|
}
|
|
105
165
|
|
|
106
166
|
declare function toDataResult<T = any>(dr: DataRequest): (source: Observable<any>) => Observable<DataResult<T>>;
|
|
107
167
|
|
|
108
|
-
|
|
109
|
-
|
|
168
|
+
/**
|
|
169
|
+
* LogicalOperator is a list of predefined logical operators that can be used in data requests to filter data.
|
|
170
|
+
*/
|
|
171
|
+
type LogicalOperator = 'contains' | 'endsWith' | 'startsWith' | 'like' | 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
172
|
+
|
|
173
|
+
export { DataRequest, DataResult, DataSource, LocalDataSource, RemoteDataSource, dataSourceAttribute, toDataResult };
|
|
174
|
+
export type { DataLoader, DataRequestFilter, DataRequestPage, DataRequestSort, DataSourceLike, LogicalOperator };
|
package/date/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a time span in months, days, hours, minutes, seconds, and milliseconds.
|
|
3
|
+
* Provides methods to create a TimeSpan from a total number of milliseconds.
|
|
4
|
+
* @example
|
|
5
|
+
* const span = TimeSpan.fromMilliseconds(123456789);
|
|
6
|
+
* console.log(span); // TimeSpan { months: 0, days: 1, hours: 10, minutes: 17, seconds: 36, milliseconds: 789 }
|
|
7
|
+
*/
|
|
8
|
+
declare class TimeSpan {
|
|
9
|
+
readonly months: number;
|
|
10
|
+
readonly days: number;
|
|
11
|
+
readonly hours: number;
|
|
12
|
+
readonly minutes: number;
|
|
13
|
+
readonly seconds: number;
|
|
14
|
+
readonly milliseconds: number;
|
|
15
|
+
/** Milliseconds per second */
|
|
16
|
+
static readonly msPerSecond = 1000;
|
|
17
|
+
/** Milliseconds per minute */
|
|
18
|
+
static readonly msPerMinute: number;
|
|
19
|
+
/** Milliseconds per hour */
|
|
20
|
+
static readonly msPerHour: number;
|
|
21
|
+
/** Milliseconds per day */
|
|
22
|
+
static readonly msPerDay: number;
|
|
23
|
+
/** Milliseconds per month */
|
|
24
|
+
static readonly msPerMonth: number;
|
|
25
|
+
constructor(months?: number, days?: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number);
|
|
26
|
+
/**
|
|
27
|
+
* Creates a TimeSpan from a total number of milliseconds.
|
|
28
|
+
* @param ms The total number of milliseconds.
|
|
29
|
+
* @returns A TimeSpan representing the equivalent time span.
|
|
30
|
+
*/
|
|
31
|
+
static fromMilliseconds(ms: number): TimeSpan;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { TimeSpan };
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, TemplateRef, ViewContainerRef, input, effect, Directive } from '@angular/core';
|
|
3
|
+
import { Observable, from, of } from 'rxjs';
|
|
2
4
|
|
|
3
5
|
const RTL = new InjectionToken('RTL Direction');
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (let i = start; i <= end; i++) {
|
|
11
|
-
result.push(i);
|
|
12
|
-
}
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
7
|
+
/**
|
|
8
|
+
* Flips the placement direction.
|
|
9
|
+
* @param placement The placement direction to flip.
|
|
10
|
+
* @returns The flipped placement direction.
|
|
11
|
+
*/
|
|
15
12
|
function flipPlacement(placement) {
|
|
16
13
|
switch (placement) {
|
|
17
14
|
case 'bottom':
|
|
@@ -25,15 +22,295 @@ function flipPlacement(placement) {
|
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Formats a string by replacing placeholders with the provided arguments.
|
|
27
|
+
* @param str The string to format, containing placeholders in the form of {0}, {1}, etc.
|
|
28
|
+
* @param args The values to replace the placeholders with.
|
|
29
|
+
* @returns The formatted string.
|
|
30
|
+
*/
|
|
28
31
|
function formatString(str, ...args) {
|
|
29
32
|
return str.replace(/\{(\d+)\}/g, function (match, index) {
|
|
30
33
|
return args[index];
|
|
31
34
|
});
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Converts a value to an Observable.
|
|
39
|
+
* If the value is already an Observable, it returns it directly.
|
|
40
|
+
* If the value is a Promise, it converts it to an Observable.
|
|
41
|
+
* If the value is neither, it wraps it in an Observable using `of`.
|
|
42
|
+
* @param value The value to convert.
|
|
43
|
+
* @returns An Observable that emits the value.
|
|
44
|
+
*/
|
|
45
|
+
function toObservable(value) {
|
|
46
|
+
if (value instanceof Observable) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
else if (value instanceof Promise) {
|
|
50
|
+
return from(value);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return of(value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Creates an array of numbers within a specified range.
|
|
59
|
+
* @param start The starting number of the range (inclusive).
|
|
60
|
+
* @param end The ending number of the range (inclusive).
|
|
61
|
+
* @returns An array of numbers within the specified range.
|
|
62
|
+
*/
|
|
63
|
+
function numberArray(start, end) {
|
|
64
|
+
return Array.from({ length: end - start + 1 }, (_, i) => i + start);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Deletes multiple entries from an array based on the provided indices.
|
|
68
|
+
* @param array
|
|
69
|
+
* @param indices
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
function deleteEntries(array, indices) {
|
|
73
|
+
// Sort indices in descending order
|
|
74
|
+
// This prevents index shifting issues when removing multiple items
|
|
75
|
+
indices.sort((a, b) => b - a);
|
|
76
|
+
indices.forEach(index => {
|
|
77
|
+
if (index >= 0 && index < array.length) {
|
|
78
|
+
array.splice(index, 1);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error(`Index out of bounds: ${index}`);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function getEnumValues(enumClass) {
|
|
87
|
+
return Object.keys(enumClass)
|
|
88
|
+
.filter(k => isNaN(Number(k))) // remove reverse-mapping keys
|
|
89
|
+
.map(k => enumClass[k]);
|
|
90
|
+
}
|
|
91
|
+
;
|
|
92
|
+
|
|
93
|
+
let _idCounter = 0;
|
|
94
|
+
/**
|
|
95
|
+
* Creates a sequential ID generator function with an optional prefix.
|
|
96
|
+
* This function generates unique IDs by incrementing a counter each time it is called.
|
|
97
|
+
* @param prefix Optional prefix for the generated IDs.
|
|
98
|
+
* @returns A function that generates sequential IDs with the given prefix.
|
|
99
|
+
*/
|
|
100
|
+
function sequentialIdGenerator(prefix) {
|
|
101
|
+
return (item) => `${prefix || ''}${_idCounter++}`;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Converts an IdGeneratorLike to an IdGenerator function.
|
|
105
|
+
* @param v The ID generator to convert.
|
|
106
|
+
* @returns An IdGenerator function.
|
|
107
|
+
*/
|
|
108
|
+
function IdGeneratorAttribute(v) {
|
|
109
|
+
if (typeof v === 'function')
|
|
110
|
+
return v;
|
|
111
|
+
else if (typeof v === 'string') {
|
|
112
|
+
return (item) => item ? item[v] : undefined;
|
|
113
|
+
}
|
|
114
|
+
throw Error('invalid id generator');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Converts a CssClassLike to a CssClassGetter function.
|
|
119
|
+
* @param v The CssClassLike to convert.
|
|
120
|
+
* @returns A function that returns the desired CSS class.
|
|
121
|
+
*/
|
|
122
|
+
function CssClassAttribute(v) {
|
|
123
|
+
if (v === undefined || v === null) {
|
|
124
|
+
return (item) => undefined;
|
|
125
|
+
}
|
|
126
|
+
else if (typeof v === 'function')
|
|
127
|
+
return v;
|
|
128
|
+
else if (typeof v === 'string' || Array.isArray(v) || typeof v === 'object') {
|
|
129
|
+
return (item) => v;
|
|
130
|
+
}
|
|
131
|
+
throw Error('invalid css class getter');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Default equality comparer function.
|
|
136
|
+
* @param a First value to compare.
|
|
137
|
+
* @param b Second value to compare.
|
|
138
|
+
* @returns true if a === b else returns false
|
|
139
|
+
*/
|
|
140
|
+
function defaultEqualityComparer(a, b) {
|
|
141
|
+
return a === b;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Converts an EqualityComparerLike to an EqualityComparer function.
|
|
145
|
+
* @param e The EqualityComparerLike to convert.
|
|
146
|
+
* @returns The converted EqualityComparer.
|
|
147
|
+
*/
|
|
148
|
+
function equalityComparerAttribute(e) {
|
|
149
|
+
if (typeof e === 'function')
|
|
150
|
+
return e;
|
|
151
|
+
if (typeof e === 'string') {
|
|
152
|
+
return (a, b) => {
|
|
153
|
+
let a2 = a != null && Object.hasOwn(a, e) ? a[e] : a;
|
|
154
|
+
let b2 = b != null && Object.hasOwn(b, e) ? b[e] : b;
|
|
155
|
+
return a2 === b2;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
throw Error('invalid equality comparer');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Default value writer function.
|
|
163
|
+
* @param a The input value
|
|
164
|
+
* @returns the input value (it does not transform it)
|
|
165
|
+
*/
|
|
166
|
+
function defaultValueWriter(a) {
|
|
167
|
+
return a;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Converts a ValueWriterLike to a ValueWriterFunction.
|
|
171
|
+
* @param v The value writer to convert.
|
|
172
|
+
* @returns A ValueWriter function.
|
|
173
|
+
*/
|
|
174
|
+
function valueWriterAttribute(v) {
|
|
175
|
+
if (typeof v === 'function')
|
|
176
|
+
return v;
|
|
177
|
+
if (typeof v === 'string') {
|
|
178
|
+
return (item) => item ? item[v] : undefined;
|
|
179
|
+
}
|
|
180
|
+
throw Error('invalid value writer');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A simple comparer function.
|
|
185
|
+
* @param a The first value to compare.
|
|
186
|
+
* @param b The second value to compare.
|
|
187
|
+
* @returns -1 if a < b, 1 if a > b, 0 if a === b
|
|
188
|
+
*/
|
|
189
|
+
function defaultComparer(a, b) {
|
|
190
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Converts a ComparerLike to a Comparer.
|
|
194
|
+
* @param v The comparer to convert.
|
|
195
|
+
* @returns A function that compares two values.
|
|
196
|
+
*/
|
|
197
|
+
function comparerAttribute(v) {
|
|
198
|
+
if (typeof v === 'function')
|
|
199
|
+
return v;
|
|
200
|
+
if (typeof v === 'string') {
|
|
201
|
+
return (a, b) => a?.[v] === b?.[v] ? 0 : a?.[v] < b?.[v] ? -1 : 1;
|
|
202
|
+
}
|
|
203
|
+
throw Error('invalid value comparer');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* No-op filter predicate that always returns true.
|
|
208
|
+
* @param item The item to test against the filter.
|
|
209
|
+
* @returns true
|
|
210
|
+
*/
|
|
211
|
+
const noopFilter = (item, ...params) => true;
|
|
212
|
+
/**
|
|
213
|
+
* A simple filter predicate that checks if the item's string representation includes the match string.
|
|
214
|
+
* @param item The item to test against the filter.
|
|
215
|
+
* @param match The string to match.
|
|
216
|
+
* @returns True if the item matches the filter, false otherwise.
|
|
217
|
+
*/
|
|
218
|
+
const defaultFilter = (item, match) => {
|
|
219
|
+
if (match == undefined || match == '') {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
if (item == undefined) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
return item.toString().toLowerCase().includes(match.toLowerCase());
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Converts a FilterPredicateLike to a FilterPredicate function.
|
|
229
|
+
* If the input is a string, it creates a predicate that checks the property with that name.
|
|
230
|
+
* @param v The FilterPredicateLike to convert.
|
|
231
|
+
* @returns The corresponding FilterPredicate function.
|
|
232
|
+
*/
|
|
233
|
+
function filterPredicateAttribute(v) {
|
|
234
|
+
if (typeof v === 'function')
|
|
235
|
+
return v;
|
|
236
|
+
else if (typeof v === 'string') {
|
|
237
|
+
return (item, match) => item != null && Object.hasOwn(item, v) ? defaultFilter(item[v], match) : false;
|
|
238
|
+
}
|
|
239
|
+
throw Error('invalid filter predicate');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* A trackBy function that tracks items by their index.
|
|
244
|
+
*/
|
|
245
|
+
const trackByIndex = (index, item) => index;
|
|
246
|
+
/**
|
|
247
|
+
* A trackBy function that tracks items by the item itself.
|
|
248
|
+
*/
|
|
249
|
+
const trackByItem = (index, item) => item;
|
|
250
|
+
/**
|
|
251
|
+
* Converts a TrackByLike to a TrackByFunction.
|
|
252
|
+
* @param v The item tracker to convert.
|
|
253
|
+
* @returns A TrackByFunction.
|
|
254
|
+
*/
|
|
255
|
+
function TrackByAttribute(v) {
|
|
256
|
+
if (typeof v === 'function')
|
|
257
|
+
return v;
|
|
258
|
+
else if (typeof v === 'string') {
|
|
259
|
+
if (v.startsWith('@item')) {
|
|
260
|
+
return trackByItem;
|
|
261
|
+
}
|
|
262
|
+
else if (v.startsWith('@index')) {
|
|
263
|
+
return trackByIndex;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
return (index, item) => item ? item[v] : undefined;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
throw Error('invalid TrackBy value');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* IfDirective is a structural directive that conditionally includes or excludes a template
|
|
274
|
+
* based on the boolean value of the `show` input property.
|
|
275
|
+
*
|
|
276
|
+
*/
|
|
277
|
+
class IfDirective {
|
|
278
|
+
_templateRef = inject((TemplateRef));
|
|
279
|
+
_vcr = inject(ViewContainerRef);
|
|
280
|
+
_viewRef;
|
|
281
|
+
show = input(true, ...(ngDevMode ? [{ debugName: "show", alias: 'ng0If' }] : [{ alias: 'ng0If' }]));
|
|
282
|
+
constructor() {
|
|
283
|
+
effect(() => {
|
|
284
|
+
if (this.show()) {
|
|
285
|
+
if (!this._viewRef) {
|
|
286
|
+
this._viewRef = this._vcr.createEmbeddedView(this._templateRef);
|
|
287
|
+
}
|
|
288
|
+
if (this._vcr.length === 0) {
|
|
289
|
+
this._vcr.insert(this._viewRef);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
if (this._vcr.length > 0) {
|
|
294
|
+
this._vcr.detach(0);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: IfDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
300
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.11", type: IfDirective, isStandalone: true, selector: "[ng0If]", inputs: { show: { classPropertyName: "show", publicName: "ng0If", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["ng0If"], ngImport: i0 });
|
|
301
|
+
}
|
|
302
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: IfDirective, decorators: [{
|
|
303
|
+
type: Directive,
|
|
304
|
+
args: [{
|
|
305
|
+
selector: '[ng0If]',
|
|
306
|
+
exportAs: 'ng0If',
|
|
307
|
+
standalone: true,
|
|
308
|
+
}]
|
|
309
|
+
}], ctorParameters: () => [], propDecorators: { show: [{ type: i0.Input, args: [{ isSignal: true, alias: "ng0If", required: false }] }] } });
|
|
310
|
+
|
|
34
311
|
/**
|
|
35
312
|
* Generated bundle index. Do not edit.
|
|
36
313
|
*/
|
|
37
314
|
|
|
38
|
-
export { RTL,
|
|
315
|
+
export { CssClassAttribute, IdGeneratorAttribute, IfDirective, RTL, TrackByAttribute, comparerAttribute, defaultComparer, defaultEqualityComparer, defaultFilter, defaultValueWriter, deleteEntries, equalityComparerAttribute, filterPredicateAttribute, flipPlacement, formatString, getEnumValues, noopFilter, numberArray, sequentialIdGenerator, toObservable, trackByIndex, trackByItem, valueWriterAttribute };
|
|
39
316
|
//# sourceMappingURL=bootkit-ng0-common.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootkit-ng0-common.mjs","sources":["../../../projects/ng0/common/types.ts","../../../projects/ng0/common/utils.ts","../../../projects/ng0/common/format-string.ts","../../../projects/ng0/common/bootkit-ng0-common.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\n\r\nexport type Placement = 'start' | 'end' | 'top' | 'bottom';\r\nexport type Alignment = 'start' | 'center' | 'end';\r\nexport const RTL = new InjectionToken<boolean>('RTL Direction');","import { Placement } from \"./types\";\r\n\r\nexport function numberRange(start: number, end: number) {\r\n return Array.from({ length: end - start + 1 }, (_, i) => i + start)\r\n}\r\n\r\nexport function fillArray(start: number, end: number): number[] {\r\n const result: number[] = [];\r\n for (let i = start; i <= end; i++) {\r\n result.push(i);\r\n }\r\n return result;\r\n}\r\n\r\nexport function flipPlacement(placement: Placement) {\r\n switch (placement) {\r\n case 'bottom':\r\n return 'top'\r\n case 'top':\r\n return 'bottom'\r\n case 'start':\r\n return 'end'\r\n case 'end':\r\n return 'start'\r\n }\r\n}\r\n","export function formatString(str: string, ...args: any[]) {\r\n return str.replace(/\\{(\\d+)\\}/g, function (match, index) {\r\n return args[index];\r\n });\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAIa,GAAG,GAAG,IAAI,cAAc,CAAU,eAAe;;ACF9C,SAAA,WAAW,CAAC,KAAa,EAAE,GAAW,EAAA;IAClD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AACvE;AAEgB,SAAA,SAAS,CAAC,KAAa,EAAE,GAAW,EAAA;IAChD,MAAM,MAAM,GAAa,EAAE;AAC3B,IAAA,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE;AAC/B,QAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;;AAElB,IAAA,OAAO,MAAM;AACjB;AAEM,SAAU,aAAa,CAAC,SAAoB,EAAA;IAC9C,QAAQ,SAAS;AACb,QAAA,KAAK,QAAQ;AACT,YAAA,OAAO,KAAK;AAChB,QAAA,KAAK,KAAK;AACN,YAAA,OAAO,QAAQ;AACnB,QAAA,KAAK,OAAO;AACR,YAAA,OAAO,KAAK;AAChB,QAAA,KAAK,KAAK;AACN,YAAA,OAAO,OAAO;;AAE1B;;SCzBgB,YAAY,CAAC,GAAW,EAAE,GAAG,IAAW,EAAA;IACpD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,KAAK,EAAE,KAAK,EAAA;AACnD,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC;AACtB,KAAC,CAAC;AACN;;ACJA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bootkit-ng0-common.mjs","sources":["../../../projects/ng0/common/types.ts","../../../projects/ng0/common/layout.ts","../../../projects/ng0/common/string-utils.ts","../../../projects/ng0/common/rxjs-utils.ts","../../../projects/ng0/common/array-utils.ts","../../../projects/ng0/common/enum.ts","../../../projects/ng0/common/id-generator.ts","../../../projects/ng0/common/css-class.ts","../../../projects/ng0/common/equality-comparer.ts","../../../projects/ng0/common/value-writer.ts","../../../projects/ng0/common/comparer.ts","../../../projects/ng0/common/filter.ts","../../../projects/ng0/common/track-by.ts","../../../projects/ng0/common/if.directive.ts","../../../projects/ng0/common/bootkit-ng0-common.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\n\nexport const RTL = new InjectionToken<boolean>('RTL Direction');\n\n","export type Placement = 'start' | 'end' | 'top' | 'bottom';\nexport type Alignment = 'start' | 'center' | 'end';\n\n/**\n * Flips the placement direction.\n * @param placement The placement direction to flip.\n * @returns The flipped placement direction.\n */\nexport function flipPlacement(placement: Placement) {\n switch (placement) {\n case 'bottom':\n return 'top'\n case 'top':\n return 'bottom'\n case 'start':\n return 'end'\n case 'end':\n return 'start'\n }\n}\n\n\n","/**\n * Formats a string by replacing placeholders with the provided arguments.\n * @param str The string to format, containing placeholders in the form of {0}, {1}, etc.\n * @param args The values to replace the placeholders with.\n * @returns The formatted string.\n */\nexport function formatString(str: string, ...args: any[]) {\n return str.replace(/\\{(\\d+)\\}/g, function (match, index) {\n return args[index];\n });\n}\n","import { from, Observable, of } from 'rxjs';\n\n/**\n * Converts a value to an Observable.\n * If the value is already an Observable, it returns it directly.\n * If the value is a Promise, it converts it to an Observable.\n * If the value is neither, it wraps it in an Observable using `of`.\n * @param value The value to convert.\n * @returns An Observable that emits the value.\n */\nexport function toObservable<T>(value: T | Observable<T> | Promise<T>): Observable<T> {\n if (value instanceof Observable) {\n return value;\n } else if (value instanceof Promise) {\n return from(value);\n } else {\n return of(value);\n }\n}\n","/**\n * Creates an array of numbers within a specified range.\n * @param start The starting number of the range (inclusive).\n * @param end The ending number of the range (inclusive).\n * @returns An array of numbers within the specified range.\n */\nexport function numberArray(start: number, end: number) {\n return Array.from({ length: end - start + 1 }, (_, i) => i + start)\n}\n\n/**\n * Deletes multiple entries from an array based on the provided indices.\n * @param array \n * @param indices \n * @private\n */\nexport function deleteEntries(array: any[], indices: number[]) {\n // Sort indices in descending order\n // This prevents index shifting issues when removing multiple items\n indices.sort((a, b) => b - a); \n indices.forEach(index => {\n if (index >= 0 && index < array.length) {\n array.splice(index, 1);\n } else {\n throw new Error(`Index out of bounds: ${index}`);\n }\n });\n}\n","\nexport function getEnumValues(enumClass: Record<string, string | number>): Array<string | number> {\n return Object.keys(enumClass)\n .filter(k => isNaN(Number(k))) // remove reverse-mapping keys\n .map(k => enumClass[k]);\n};\n","let _idCounter = 0;\n\n/**\n * Type definition for an ID generator function.\n * @param item The item for which the ID is to be generated.\n * @returns A string representing the generated ID.\n */\nexport type IdGenerator = (item: any) => string;\n\n/**\n * Type definition for an ID generator which can be a function or a string representing the property name to extract the ID from.\n */\nexport type IdGeneratorLike = IdGenerator | string;\n\n/**\n * Creates a sequential ID generator function with an optional prefix.\n * This function generates unique IDs by incrementing a counter each time it is called.\n * @param prefix Optional prefix for the generated IDs.\n * @returns A function that generates sequential IDs with the given prefix.\n */\nexport function sequentialIdGenerator(prefix?: string): IdGenerator {\n return (item: any) => `${prefix || ''}${_idCounter++}`;\n}\n\n/**\n * Converts an IdGeneratorLike to an IdGenerator function.\n * @param v The ID generator to convert.\n * @returns An IdGenerator function.\n */\nexport function IdGeneratorAttribute(v: IdGeneratorLike): IdGenerator {\n if (typeof v === 'function')\n return v;\n else if (typeof v === 'string') {\n return (item: any) => item ? item[v] : undefined;\n }\n\n throw Error('invalid id generator');\n}\n","/**\n * CSS class type which can be a string, array of strings, set of strings, or an object with class names as keys.\n */\nexport type CssClass = string | string[] | Set<string> | { [klass: string]: any } | null | undefined;\n\n/**\n * A function that takes an item and returns a CssClass.\n * @param item The item to get the CSS class for.\n * @returns The CSS class for the item.\n */\nexport type CssClassGetter = (obj: any) => CssClass;\n\n/**\n * A type that represents a CSS class or a function that returns a CSS class.\n */\nexport type CssClassLike = CssClass | CssClassGetter;\n\n\n/**\n * Converts a CssClassLike to a CssClassGetter function.\n * @param v The CssClassLike to convert.\n * @returns A function that returns the desired CSS class.\n */\nexport function CssClassAttribute(v: CssClassLike): CssClassGetter {\n if (v === undefined || v === null) {\n return (item: any) => undefined;\n } else if (typeof v === 'function')\n return v as CssClassGetter;\n else if (typeof v === 'string' || Array.isArray(v) || typeof v === 'object') {\n return (item: any) => v;\n }\n\n throw Error('invalid css class getter');\n}\n","/**\n * Equality comparer function type.\n * @param a First value to compare.\n * @param b Second value to compare.\n * @returns true if a is considered equal to b else returns false\n */\nexport type EqualityComparer = (a: any, b: any) => boolean;\n\n/**\n * Equality comparer like type.\n * can be a function or a string representing the property name to compare.\n */\nexport type EqualityComparerLike = EqualityComparer | string;\n\n/**\n * Default equality comparer function.\n * @param a First value to compare.\n * @param b Second value to compare.\n * @returns true if a === b else returns false\n */\nexport function defaultEqualityComparer(a: any, b: any): boolean {\n return a === b;\n}\n\n/**\n * Converts an EqualityComparerLike to an EqualityComparer function.\n * @param e The EqualityComparerLike to convert.\n * @returns The converted EqualityComparer.\n */\nexport function equalityComparerAttribute(e: EqualityComparerLike): EqualityComparer {\n if (typeof e === 'function')\n return e;\n if (typeof e === 'string') {\n return (a: any, b: any) => {\n let a2 = a != null && Object.hasOwn(a, e) ? a[e] : a;\n let b2 = b != null && Object.hasOwn(b, e) ? b[e] : b;\n return a2 === b2;\n }\n }\n\n throw Error('invalid equality comparer');\n}\n","/**\n * Value writer function type.\n * @param a The input value\n * @returns The written value\n */\nexport type ValueWriter = (a: any) => any;\n\n/**\n * Value writer can be a function or a string representing the property name to extract the value from.\n */\nexport type ValueWriterLike = ValueWriter | string;\n\n\n/**\n * Default value writer function.\n * @param a The input value\n * @returns the input value (it does not transform it)\n */\nexport function defaultValueWriter(a: any): any {\n return a;\n}\n\n/**\n * Converts a ValueWriterLike to a ValueWriterFunction.\n * @param v The value writer to convert.\n * @returns A ValueWriter function.\n */\nexport function valueWriterAttribute(v: ValueWriterLike): ValueWriter {\n if (typeof v === 'function')\n return v;\n if (typeof v === 'string') {\n return (item: any) => item ? item[v] : undefined;\n }\n\n throw Error('invalid value writer');\n}\n","/**\n * A comparison function type that defines an ordering relation between two values.\n * @param a The first value to compare.\n * @param b The second value to compare.\n * @returns\n * - A negative number if `a` should come before `b`\n * - A positive number if `a` should come after `b`\n * - Zero if `a` and `b` are considered equal\n */\nexport type Comparer = (a: any, b: any) => number;\n\n/**\n * Value comparer can be a function or a string representing the property name to compare.\n */\nexport type ComparerLike = Comparer | string;\n\n/**\n * A simple comparer function.\n * @param a The first value to compare.\n * @param b The second value to compare.\n * @returns -1 if a < b, 1 if a > b, 0 if a === b\n */\nexport function defaultComparer(a: any, b: any): number {\n return a === b ? 0 : a < b ? -1 : 1;\n}\n\n/**\n * Converts a ComparerLike to a Comparer.\n * @param v The comparer to convert.\n * @returns A function that compares two values.\n */\nexport function comparerAttribute(v: ComparerLike): Comparer {\n if (typeof v === 'function')\n return v;\n if (typeof v === 'string') {\n return (a: any, b: any) => a?.[v] === b?.[v] ? 0 : a?.[v] < b?.[v] ? -1 : 1;\n }\n\n throw Error('invalid value comparer');\n}\n\n","/**\n * Filter predicate function type.\n * @param item The item to test against the filter.\n * @param params Additional parameters to pass to the filter.\n * @returns True if the item matches the filter, false otherwise.\n */\nexport type FilterPredicate = (item: any, ...params: any[]) => boolean;\n\n/**\n * Filter predicate can be a function or a string representing the property name to filter.\n */\nexport type FilterPredicateLike = FilterPredicate | string;\n\n/**\n * No-op filter predicate that always returns true.\n * @param item The item to test against the filter.\n * @returns true\n */\nexport const noopFilter: FilterPredicate = (item: any, ...params: any[]) => true;\n\n\n/**\n * A simple filter predicate that checks if the item's string representation includes the match string.\n * @param item The item to test against the filter.\n * @param match The string to match.\n * @returns True if the item matches the filter, false otherwise.\n */\nexport const defaultFilter: FilterPredicate = (item: any, match: string) => {\n if (match == undefined || match == '') {\n return true;\n }\n\n if (item == undefined) {\n return false;\n }\n\n return (item as Object).toString().toLowerCase().includes(match.toLowerCase());\n}\n\n\n/**\n * Converts a FilterPredicateLike to a FilterPredicate function.\n * If the input is a string, it creates a predicate that checks the property with that name.\n * @param v The FilterPredicateLike to convert.\n * @returns The corresponding FilterPredicate function.\n */\nexport function filterPredicateAttribute(v: FilterPredicateLike): FilterPredicate {\n if (typeof v === 'function')\n return v;\n else if (typeof v === 'string') {\n return (item: any, match: string) => \n item != null && Object.hasOwn(item, v) ? defaultFilter(item[v], match) : false;\n }\n\n throw Error('invalid filter predicate');\n}\n","import { TrackByFunction } from \"@angular/core\";\n\n/**\n * An item tracker that can be either a TrackByFunction or a string property name.\n */\nexport type TrackByLike = TrackByFunction<any> | string;\n\n/**\n * A trackBy function that tracks items by their index.\n */\nexport const trackByIndex: TrackByFunction<any> = (index: number, item: any) => index;\n\n/**\n * A trackBy function that tracks items by the item itself.\n */\nexport const trackByItem: TrackByFunction<any> = (index: number, item: any) => item;\n\n/**\n * Converts a TrackByLike to a TrackByFunction.\n * @param v The item tracker to convert.\n * @returns A TrackByFunction.\n */\nexport function TrackByAttribute(v: TrackByLike): TrackByFunction<any> {\n if (typeof v === 'function')\n return v;\n else if (typeof v === 'string') {\n if(v.startsWith('@item')) {\n return trackByItem;\n } else if(v.startsWith('@index')) {\n return trackByIndex;\n } else {\n return (index: number, item: any) => item ? item[v] : undefined;\n }\n }\n\n throw Error('invalid TrackBy value');\n}\n","import { input, inject, Directive, TemplateRef, effect, ViewContainerRef, EmbeddedViewRef } from '@angular/core';\n\n/**\n * IfDirective is a structural directive that conditionally includes or excludes a template\n * based on the boolean value of the `show` input property.\n * \n */\n@Directive({\n selector: '[ng0If]',\n exportAs: 'ng0If',\n standalone: true,\n})\nexport class IfDirective {\n private readonly _templateRef = inject(TemplateRef<any>);\n private _vcr = inject(ViewContainerRef);\n private _viewRef?: EmbeddedViewRef<any>;\n public readonly show = input(true, { alias: 'ng0If' });\n\n constructor() {\n effect(() => {\n if (this.show()) {\n if (!this._viewRef) {\n this._viewRef = this._vcr.createEmbeddedView(this._templateRef);\n }\n\n if (this._vcr.length === 0) {\n this._vcr.insert(this._viewRef);\n }\n } else {\n if (this._vcr.length > 0) {\n this._vcr.detach(0);\n }\n }\n })\n }\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAEa,GAAG,GAAG,IAAI,cAAc,CAAU,eAAe;;ACC9D;;;;AAIG;AACG,SAAU,aAAa,CAAC,SAAoB,EAAA;IAC9C,QAAQ,SAAS;AACb,QAAA,KAAK,QAAQ;AACT,YAAA,OAAO,KAAK;AAChB,QAAA,KAAK,KAAK;AACN,YAAA,OAAO,QAAQ;AACnB,QAAA,KAAK,OAAO;AACR,YAAA,OAAO,KAAK;AAChB,QAAA,KAAK,KAAK;AACN,YAAA,OAAO,OAAO;;AAE1B;;ACnBA;;;;;AAKG;SACa,YAAY,CAAC,GAAW,EAAE,GAAG,IAAW,EAAA;IACpD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,KAA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