@gnwebsoft/ui 4.0.0 → 4.0.2
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/dist/chunk-BXF3QEBN.js +2181 -0
- package/dist/chunk-DS524L7W.cjs +467 -0
- package/dist/chunk-FYU2OIMD.js +15 -0
- package/dist/chunk-GHW77WIM.cjs +72 -0
- package/dist/chunk-GLN5JSFF.cjs +2181 -0
- package/dist/chunk-GVWCGJ3F.js +140 -0
- package/dist/chunk-LUW7V5GI.cjs +15 -0
- package/dist/chunk-M526GQZS.js +2490 -0
- package/dist/chunk-MULSVYFT.js +72 -0
- package/dist/chunk-MVPLBJRK.cjs +1 -1
- package/dist/chunk-PUQIPRL2.js +467 -0
- package/dist/chunk-QLQ6OH25.cjs +2490 -0
- package/dist/chunk-Y3QTSDLJ.cjs +140 -0
- package/dist/core/index.cjs +121 -0
- package/dist/core/index.js +121 -0
- package/dist/hooks/index.cjs +3 -3
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +85 -7
- package/dist/index.js +147 -69
- package/dist/types/index.cjs +3 -3
- package/dist/types/index.js +1 -1
- package/dist/utils/index.cjs +4 -24
- package/dist/utils/index.js +6 -26
- package/dist/wrappers/index.cjs +7 -4
- package/dist/wrappers/index.js +21 -18
- package/package.json +22 -17
- package/dist/AsyncSelectPayload-B9-6l33R.d.cts +0 -10
- package/dist/AsyncSelectPayload-B9-6l33R.d.ts +0 -10
- package/dist/chunk-3OPVOWQK.js +0 -140
- package/dist/chunk-AEOF2TUF.cjs +0 -2273
- package/dist/chunk-ALHC7RLK.js +0 -575
- package/dist/chunk-BRRLB22L.js +0 -72
- package/dist/chunk-CHZU4PZB.js +0 -2273
- package/dist/chunk-EBRUE2WR.cjs +0 -493
- package/dist/chunk-HEHPKM4B.cjs +0 -140
- package/dist/chunk-K2EJ4YKO.cjs +0 -72
- package/dist/chunk-U6SDYCWF.js +0 -493
- package/dist/chunk-XY4U6A77.cjs +0 -575
- package/dist/components/index.cjs +0 -25
- package/dist/components/index.d.cts +0 -752
- package/dist/components/index.d.ts +0 -752
- package/dist/components/index.js +0 -25
- package/dist/enhanced-CDTkKUlj.d.ts +0 -134
- package/dist/enhanced-ZQoS03Cd.d.cts +0 -134
- package/dist/events-BcHVCLBz.d.cts +0 -77
- package/dist/events-BcHVCLBz.d.ts +0 -77
- package/dist/hooks/index.d.cts +0 -96
- package/dist/hooks/index.d.ts +0 -96
- package/dist/index.d.cts +0 -16
- package/dist/index.d.ts +0 -16
- package/dist/types/index.d.cts +0 -820
- package/dist/types/index.d.ts +0 -820
- package/dist/utils/index.d.cts +0 -683
- package/dist/utils/index.d.ts +0 -683
- package/dist/wrappers/index.d.cts +0 -1753
- package/dist/wrappers/index.d.ts +0 -1753
package/dist/types/index.d.ts
DELETED
|
@@ -1,820 +0,0 @@
|
|
|
1
|
-
import { GridSortModel } from '@mui/x-data-grid';
|
|
2
|
-
export { a as AsyncSelectMultiPayload, A as AsyncSelectPayload } from '../AsyncSelectPayload-B9-6l33R.js';
|
|
3
|
-
export { E as EventOrValue, F as FormChangeEvent, c as GenericEventHandler, G as GenericSyntheticEvent, H as HtmlSelectElement, a as InputChangeEvent, I as InputElement, S as SelectChangeEvent, b as TransformInputHandler, T as TransformOutputHandler, g as createEventValueExtractor, f as extractEventValue, e as isFormChangeEvent, i as isInputChangeEvent, d as isSelectChangeEvent } from '../events-BcHVCLBz.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Type definition for server validation errors structure.
|
|
8
|
-
*
|
|
9
|
-
* This type represents the format of validation errors returned from server APIs.
|
|
10
|
-
* It supports multiple error formats for each field, allowing flexibility in how
|
|
11
|
-
* validation errors are communicated and processed.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* String error messages:
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const errors: ValidationErrors = {
|
|
17
|
-
* email: 'Email is required',
|
|
18
|
-
* username: 'Username must be unique'
|
|
19
|
-
* };
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* Array of error messages:
|
|
24
|
-
* ```tsx
|
|
25
|
-
* const errors: ValidationErrors = {
|
|
26
|
-
* password: [
|
|
27
|
-
* 'Password must be at least 8 characters',
|
|
28
|
-
* 'Password must contain at least one number',
|
|
29
|
-
* 'Password must contain at least one special character'
|
|
30
|
-
* ]
|
|
31
|
-
* };
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* Boolean flags for validation state:
|
|
36
|
-
* ```tsx
|
|
37
|
-
* const errors: ValidationErrors = {
|
|
38
|
-
* termsAccepted: false, // Field is invalid
|
|
39
|
-
* emailVerified: true // Field has an error
|
|
40
|
-
* };
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* Structured error objects:
|
|
45
|
-
* ```tsx
|
|
46
|
-
* const errors: ValidationErrors = {
|
|
47
|
-
* dateOfBirth: {
|
|
48
|
-
* key: 'DATE_INVALID',
|
|
49
|
-
* message: 'Date of birth must be in the past'
|
|
50
|
-
* }
|
|
51
|
-
* };
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
interface ValidationErrors {
|
|
57
|
-
[field: string]: string | string[] | boolean | {
|
|
58
|
-
key: string;
|
|
59
|
-
message: string;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Standardized API response structure for server communications.
|
|
65
|
-
*
|
|
66
|
-
* This type defines the common structure for API responses throughout the application,
|
|
67
|
-
* providing a consistent interface for handling server responses, errors, and data.
|
|
68
|
-
* It follows a standard error response format with optional success data.
|
|
69
|
-
*
|
|
70
|
-
* @template TModel - The type of data contained in the apiData field
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* Success response with data:
|
|
74
|
-
* ```tsx
|
|
75
|
-
* const userResponse: ApiResponse<User> = {
|
|
76
|
-
* status: 200,
|
|
77
|
-
* apiData: {
|
|
78
|
-
* id: 1,
|
|
79
|
-
* name: 'John Doe',
|
|
80
|
-
* email: 'john@example.com'
|
|
81
|
-
* }
|
|
82
|
-
* };
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* Error response with validation errors:
|
|
87
|
-
* ```tsx
|
|
88
|
-
* const errorResponse: ApiResponse<null> = {
|
|
89
|
-
* type: 'validation_error',
|
|
90
|
-
* title: 'Validation failed',
|
|
91
|
-
* status: 400,
|
|
92
|
-
* traceId: 'abc123',
|
|
93
|
-
* errors: {
|
|
94
|
-
* email: 'Email is required',
|
|
95
|
-
* password: ['Too short', 'Must contain numbers']
|
|
96
|
-
* },
|
|
97
|
-
* modelErrors: true
|
|
98
|
-
* };
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* @public
|
|
102
|
-
*/
|
|
103
|
-
interface ApiResponse<TModel> {
|
|
104
|
-
/**
|
|
105
|
-
* The type or category of the response/error
|
|
106
|
-
* @example "validation_error" | "server_error" | "success"
|
|
107
|
-
*/
|
|
108
|
-
type?: string;
|
|
109
|
-
/**
|
|
110
|
-
* Human-readable title or summary of the response
|
|
111
|
-
* @example "Validation Failed" | "User Created Successfully"
|
|
112
|
-
*/
|
|
113
|
-
title?: string;
|
|
114
|
-
/**
|
|
115
|
-
* HTTP status code of the response
|
|
116
|
-
* @example 200 | 400 | 500
|
|
117
|
-
*/
|
|
118
|
-
status?: number;
|
|
119
|
-
/**
|
|
120
|
-
* Unique identifier for tracing/debugging the request
|
|
121
|
-
* @example "abc123-def456-ghi789"
|
|
122
|
-
*/
|
|
123
|
-
traceId?: string;
|
|
124
|
-
/**
|
|
125
|
-
* Field-specific validation errors
|
|
126
|
-
*/
|
|
127
|
-
errors?: ValidationErrors;
|
|
128
|
-
/**
|
|
129
|
-
* Flag indicating if there are model validation errors
|
|
130
|
-
*/
|
|
131
|
-
modelErrors?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* The actual response data/payload
|
|
134
|
-
*/
|
|
135
|
-
apiData?: TModel;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Standard option item structure for select components.
|
|
140
|
-
*
|
|
141
|
-
* This type defines the expected structure for option items used in
|
|
142
|
-
* select components throughout the application. It provides a consistent
|
|
143
|
-
* interface with string labels and values.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* Basic usage:
|
|
147
|
-
* ```tsx
|
|
148
|
-
* const categories: OptionItem[] = [
|
|
149
|
-
* { Label: 'Technology', Value: 'tech' },
|
|
150
|
-
* { Label: 'Finance', Value: 'finance' },
|
|
151
|
-
* { Label: 'Healthcare', Value: 'health' }
|
|
152
|
-
* ];
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* @public
|
|
156
|
-
*/
|
|
157
|
-
interface OptionItem {
|
|
158
|
-
/** Display text shown to the user */
|
|
159
|
-
Label: string;
|
|
160
|
-
/** Internal value used for form submission and identification */
|
|
161
|
-
Value: string;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Payload structure for async multi-select operations.
|
|
165
|
-
*
|
|
166
|
-
* This type defines the data structure used when performing asynchronous
|
|
167
|
-
* multi-select operations, typically for server-side filtering and loading
|
|
168
|
-
* of options with pre-selected values.
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* Search with initial values:
|
|
172
|
-
* ```tsx
|
|
173
|
-
* const payload: AsyncMultiSelectPayload = {
|
|
174
|
-
* query: 'john',
|
|
175
|
-
* initialValues: ['user1', 'user2', 'user3']
|
|
176
|
-
* };
|
|
177
|
-
* ```
|
|
178
|
-
*
|
|
179
|
-
* @public
|
|
180
|
-
*/
|
|
181
|
-
interface AsyncMultiSelectPayload {
|
|
182
|
-
/** Search query string for filtering options */
|
|
183
|
-
query: string | null;
|
|
184
|
-
/** Pre-selected values to be included in the selection */
|
|
185
|
-
initialValues?: string[] | number[] | null;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Extended option item structure supporting both string and number values.
|
|
189
|
-
*
|
|
190
|
-
* This type extends the basic OptionItem to support numeric values,
|
|
191
|
-
* providing flexibility for different data types while maintaining
|
|
192
|
-
* the same label-value structure.
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* Mixed value types:
|
|
196
|
-
* ```tsx
|
|
197
|
-
* const options: OptionItem2[] = [
|
|
198
|
-
* { Label: 'First Option', Value: 1 },
|
|
199
|
-
* { Label: 'Second Option', Value: 'second' },
|
|
200
|
-
* { Label: 'Third Option', Value: 3 }
|
|
201
|
-
* ];
|
|
202
|
-
* ```
|
|
203
|
-
*
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
interface OptionItem2 {
|
|
207
|
-
/** Display text shown to the user */
|
|
208
|
-
Label: string;
|
|
209
|
-
/** Internal value that can be either a number or string */
|
|
210
|
-
Value: number | string;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
interface OperationResponse {
|
|
214
|
-
id?: number;
|
|
215
|
-
rowsAffected: number;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Type-safe API request and response utilities
|
|
220
|
-
* @module types/api
|
|
221
|
-
*/
|
|
222
|
-
/**
|
|
223
|
-
* HTTP methods supported by the API
|
|
224
|
-
*/
|
|
225
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
226
|
-
/**
|
|
227
|
-
* Valid JSON primitive types that can be sent in request bodies
|
|
228
|
-
*/
|
|
229
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
230
|
-
/**
|
|
231
|
-
* Valid JSON values (primitives, objects, arrays)
|
|
232
|
-
*/
|
|
233
|
-
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
234
|
-
/**
|
|
235
|
-
* JSON object with string keys and JSON values
|
|
236
|
-
*/
|
|
237
|
-
interface JsonObject {
|
|
238
|
-
[key: string]: JsonValue;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* JSON array containing JSON values
|
|
242
|
-
*/
|
|
243
|
-
type JsonArray = JsonValue[];
|
|
244
|
-
/**
|
|
245
|
-
* Type-safe request body - must be JSON-serializable
|
|
246
|
-
*/
|
|
247
|
-
type RequestBody = JsonObject | JsonArray | FormData;
|
|
248
|
-
/**
|
|
249
|
-
* Standard HTTP headers with known header names
|
|
250
|
-
*/
|
|
251
|
-
type HttpHeaders = Record<string, string>;
|
|
252
|
-
/**
|
|
253
|
-
* Options for making HTTP requests (based on fetch API)
|
|
254
|
-
*/
|
|
255
|
-
interface RequestOptions {
|
|
256
|
-
/**
|
|
257
|
-
* HTTP method for the request
|
|
258
|
-
*/
|
|
259
|
-
method: HttpMethod;
|
|
260
|
-
/**
|
|
261
|
-
* Request headers
|
|
262
|
-
*/
|
|
263
|
-
headers?: HttpHeaders;
|
|
264
|
-
/**
|
|
265
|
-
* Request body (string for JSON, FormData for file uploads)
|
|
266
|
-
*/
|
|
267
|
-
body?: string | FormData;
|
|
268
|
-
/**
|
|
269
|
-
* Request credentials mode
|
|
270
|
-
*/
|
|
271
|
-
credentials?: RequestCredentials;
|
|
272
|
-
/**
|
|
273
|
-
* Request mode (cors, no-cors, same-origin)
|
|
274
|
-
*/
|
|
275
|
-
mode?: RequestMode;
|
|
276
|
-
/**
|
|
277
|
-
* Cache mode for the request
|
|
278
|
-
*/
|
|
279
|
-
cache?: RequestCache;
|
|
280
|
-
/**
|
|
281
|
-
* Redirect mode for the request
|
|
282
|
-
*/
|
|
283
|
-
redirect?: RequestRedirect;
|
|
284
|
-
/**
|
|
285
|
-
* Referrer policy for the request
|
|
286
|
-
*/
|
|
287
|
-
referrerPolicy?: ReferrerPolicy;
|
|
288
|
-
/**
|
|
289
|
-
* AbortSignal for request cancellation
|
|
290
|
-
*/
|
|
291
|
-
signal?: AbortSignal;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Configuration options for API calls
|
|
295
|
-
*/
|
|
296
|
-
interface ApiCallOptions {
|
|
297
|
-
/**
|
|
298
|
-
* Custom headers to include in the request
|
|
299
|
-
*/
|
|
300
|
-
headers?: HttpHeaders;
|
|
301
|
-
/**
|
|
302
|
-
* Whether to include authentication token
|
|
303
|
-
* @defaultValue true
|
|
304
|
-
*/
|
|
305
|
-
includeAuth?: boolean;
|
|
306
|
-
/**
|
|
307
|
-
* AbortSignal for request cancellation
|
|
308
|
-
*/
|
|
309
|
-
signal?: AbortSignal;
|
|
310
|
-
/**
|
|
311
|
-
* Custom base URL (overrides default)
|
|
312
|
-
*/
|
|
313
|
-
baseUrl?: string;
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Options for fetch operations with any additional parameters
|
|
317
|
-
*/
|
|
318
|
-
interface FetchOptions extends Omit<RequestInit, 'body' | 'headers'> {
|
|
319
|
-
/**
|
|
320
|
-
* Request headers
|
|
321
|
-
*/
|
|
322
|
-
headers?: HttpHeaders;
|
|
323
|
-
/**
|
|
324
|
-
* Request body
|
|
325
|
-
*/
|
|
326
|
-
body?: RequestBody;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Type guard to check if a value is a valid JSON object
|
|
330
|
-
*/
|
|
331
|
-
declare function isJsonObject(value: unknown): value is JsonObject;
|
|
332
|
-
/**
|
|
333
|
-
* Type guard to check if a value is a valid JSON array
|
|
334
|
-
*/
|
|
335
|
-
declare function isJsonArray(value: unknown): value is JsonArray;
|
|
336
|
-
/**
|
|
337
|
-
* Type guard to check if a value is FormData
|
|
338
|
-
*/
|
|
339
|
-
declare function isFormData(value: unknown): value is FormData;
|
|
340
|
-
/**
|
|
341
|
-
* Type guard to check if a value is a valid request body
|
|
342
|
-
*/
|
|
343
|
-
declare function isRequestBody(value: unknown): value is RequestBody;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Utility types and type helpers for enhanced type safety
|
|
347
|
-
*
|
|
348
|
-
* @packageDocumentation
|
|
349
|
-
*/
|
|
350
|
-
/**
|
|
351
|
-
* Makes all properties of T required and non-nullable
|
|
352
|
-
*
|
|
353
|
-
* @example
|
|
354
|
-
* ```typescript
|
|
355
|
-
* interface User {
|
|
356
|
-
* id?: string;
|
|
357
|
-
* name?: string | null;
|
|
358
|
-
* }
|
|
359
|
-
*
|
|
360
|
-
* type RequiredUser = DeepRequired<User>;
|
|
361
|
-
* // { id: string; name: string }
|
|
362
|
-
* ```
|
|
363
|
-
*
|
|
364
|
-
* @public
|
|
365
|
-
*/
|
|
366
|
-
type DeepRequired<T> = {
|
|
367
|
-
[P in keyof T]-?: NonNullable<T[P]>;
|
|
368
|
-
};
|
|
369
|
-
/**
|
|
370
|
-
* Makes all properties of T optional
|
|
371
|
-
*
|
|
372
|
-
* @example
|
|
373
|
-
* ```typescript
|
|
374
|
-
* interface User {
|
|
375
|
-
* id: string;
|
|
376
|
-
* name: string;
|
|
377
|
-
* }
|
|
378
|
-
*
|
|
379
|
-
* type PartialUser = DeepPartial<User>;
|
|
380
|
-
* // { id?: string; name?: string }
|
|
381
|
-
* ```
|
|
382
|
-
*
|
|
383
|
-
* @public
|
|
384
|
-
*/
|
|
385
|
-
type DeepPartial<T> = {
|
|
386
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
387
|
-
};
|
|
388
|
-
/**
|
|
389
|
-
* Makes all properties of T readonly deeply
|
|
390
|
-
*
|
|
391
|
-
* @example
|
|
392
|
-
* ```typescript
|
|
393
|
-
* interface User {
|
|
394
|
-
* id: string;
|
|
395
|
-
* profile: {
|
|
396
|
-
* name: string;
|
|
397
|
-
* };
|
|
398
|
-
* }
|
|
399
|
-
*
|
|
400
|
-
* type ReadonlyUser = DeepReadonly<User>;
|
|
401
|
-
* // { readonly id: string; readonly profile: { readonly name: string } }
|
|
402
|
-
* ```
|
|
403
|
-
*
|
|
404
|
-
* @public
|
|
405
|
-
*/
|
|
406
|
-
type DeepReadonly<T> = {
|
|
407
|
-
readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
|
|
408
|
-
};
|
|
409
|
-
/**
|
|
410
|
-
* Extracts keys from T that are not undefined
|
|
411
|
-
*
|
|
412
|
-
* @example
|
|
413
|
-
* ```typescript
|
|
414
|
-
* interface User {
|
|
415
|
-
* id: string;
|
|
416
|
-
* name?: string;
|
|
417
|
-
* email: string | undefined;
|
|
418
|
-
* }
|
|
419
|
-
*
|
|
420
|
-
* type RequiredKeys = RequiredKeys<User>;
|
|
421
|
-
* // 'id'
|
|
422
|
-
* ```
|
|
423
|
-
*
|
|
424
|
-
* @public
|
|
425
|
-
*/
|
|
426
|
-
type RequiredKeys<T> = {
|
|
427
|
-
[K in keyof T]-?: undefined extends T[K] ? never : K;
|
|
428
|
-
}[keyof T];
|
|
429
|
-
/**
|
|
430
|
-
* Extracts keys from T that can be undefined
|
|
431
|
-
*
|
|
432
|
-
* @example
|
|
433
|
-
* ```typescript
|
|
434
|
-
* interface User {
|
|
435
|
-
* id: string;
|
|
436
|
-
* name?: string;
|
|
437
|
-
* email: string | undefined;
|
|
438
|
-
* }
|
|
439
|
-
*
|
|
440
|
-
* type OptKeys = OptionalKeys<User>;
|
|
441
|
-
* // 'name' | 'email'
|
|
442
|
-
* ```
|
|
443
|
-
*
|
|
444
|
-
* @public
|
|
445
|
-
*/
|
|
446
|
-
type OptionalKeys<T> = {
|
|
447
|
-
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
448
|
-
}[keyof T];
|
|
449
|
-
/**
|
|
450
|
-
* Makes specified keys K of type T required
|
|
451
|
-
*
|
|
452
|
-
* @example
|
|
453
|
-
* ```typescript
|
|
454
|
-
* interface User {
|
|
455
|
-
* id?: string;
|
|
456
|
-
* name?: string;
|
|
457
|
-
* email?: string;
|
|
458
|
-
* }
|
|
459
|
-
*
|
|
460
|
-
* type UserWithId = RequireKeys<User, 'id' | 'email'>;
|
|
461
|
-
* // { id: string; name?: string; email: string }
|
|
462
|
-
* ```
|
|
463
|
-
*
|
|
464
|
-
* @public
|
|
465
|
-
*/
|
|
466
|
-
type RequireKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
467
|
-
/**
|
|
468
|
-
* Makes specified keys K of type T optional
|
|
469
|
-
*
|
|
470
|
-
* @example
|
|
471
|
-
* ```typescript
|
|
472
|
-
* interface User {
|
|
473
|
-
* id: string;
|
|
474
|
-
* name: string;
|
|
475
|
-
* email: string;
|
|
476
|
-
* }
|
|
477
|
-
*
|
|
478
|
-
* type UserUpdate = PartialKeys<User, 'name' | 'email'>;
|
|
479
|
-
* // { id: string; name?: string; email?: string }
|
|
480
|
-
* ```
|
|
481
|
-
*
|
|
482
|
-
* @public
|
|
483
|
-
*/
|
|
484
|
-
type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
485
|
-
/**
|
|
486
|
-
* Excludes keys K from type T
|
|
487
|
-
*
|
|
488
|
-
* @example
|
|
489
|
-
* ```typescript
|
|
490
|
-
* interface User {
|
|
491
|
-
* id: string;
|
|
492
|
-
* password: string;
|
|
493
|
-
* email: string;
|
|
494
|
-
* }
|
|
495
|
-
*
|
|
496
|
-
* type PublicUser = ExcludeKeys<User, 'password'>;
|
|
497
|
-
* // { id: string; email: string }
|
|
498
|
-
* ```
|
|
499
|
-
*
|
|
500
|
-
* @public
|
|
501
|
-
*/
|
|
502
|
-
type ExcludeKeys<T, K extends keyof T> = Omit<T, K>;
|
|
503
|
-
/**
|
|
504
|
-
* Picks only keys K from type T
|
|
505
|
-
*
|
|
506
|
-
* @example
|
|
507
|
-
* ```typescript
|
|
508
|
-
* interface User {
|
|
509
|
-
* id: string;
|
|
510
|
-
* name: string;
|
|
511
|
-
* email: string;
|
|
512
|
-
* }
|
|
513
|
-
*
|
|
514
|
-
* type UserCredentials = PickKeys<User, 'email'>;
|
|
515
|
-
* // { email: string }
|
|
516
|
-
* ```
|
|
517
|
-
*
|
|
518
|
-
* @public
|
|
519
|
-
*/
|
|
520
|
-
type PickKeys<T, K extends keyof T> = Pick<T, K>;
|
|
521
|
-
/**
|
|
522
|
-
* Extracts the value type from an array type
|
|
523
|
-
*
|
|
524
|
-
* @example
|
|
525
|
-
* ```typescript
|
|
526
|
-
* type StringArray = string[];
|
|
527
|
-
* type Item = ArrayElement<StringArray>;
|
|
528
|
-
* // string
|
|
529
|
-
* ```
|
|
530
|
-
*
|
|
531
|
-
* @public
|
|
532
|
-
*/
|
|
533
|
-
type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
|
|
534
|
-
/**
|
|
535
|
-
* Extracts the return type of an async function
|
|
536
|
-
*
|
|
537
|
-
* @example
|
|
538
|
-
* ```typescript
|
|
539
|
-
* async function getUser(): Promise<User> {
|
|
540
|
-
* return { id: '1', name: 'John' };
|
|
541
|
-
* }
|
|
542
|
-
*
|
|
543
|
-
* type User = AsyncReturnType<typeof getUser>;
|
|
544
|
-
* // User
|
|
545
|
-
* ```
|
|
546
|
-
*
|
|
547
|
-
* @public
|
|
548
|
-
*/
|
|
549
|
-
type AsyncReturnType<T extends (...args: readonly unknown[]) => Promise<unknown>> = T extends (...args: readonly unknown[]) => Promise<infer R> ? R : never;
|
|
550
|
-
/**
|
|
551
|
-
* Makes a type nullable (adds null)
|
|
552
|
-
*
|
|
553
|
-
* @example
|
|
554
|
-
* ```typescript
|
|
555
|
-
* type Username = string;
|
|
556
|
-
* type NullableUsername = Nullable<Username>;
|
|
557
|
-
* // string | null
|
|
558
|
-
* ```
|
|
559
|
-
*
|
|
560
|
-
* @public
|
|
561
|
-
*/
|
|
562
|
-
type Nullable<T> = T | null;
|
|
563
|
-
/**
|
|
564
|
-
* Makes a type optional (adds undefined)
|
|
565
|
-
*
|
|
566
|
-
* @example
|
|
567
|
-
* ```typescript
|
|
568
|
-
* type Username = string;
|
|
569
|
-
* type OptionalUsername = Maybe<Username>;
|
|
570
|
-
* // string | undefined
|
|
571
|
-
* ```
|
|
572
|
-
*
|
|
573
|
-
* @public
|
|
574
|
-
*/
|
|
575
|
-
type Maybe<T> = T | undefined;
|
|
576
|
-
/**
|
|
577
|
-
* Makes a type nullish (adds null and undefined)
|
|
578
|
-
*
|
|
579
|
-
* @example
|
|
580
|
-
* ```typescript
|
|
581
|
-
* type Username = string;
|
|
582
|
-
* type NullishUsername = Nullish<Username>;
|
|
583
|
-
* // string | null | undefined
|
|
584
|
-
* ```
|
|
585
|
-
*
|
|
586
|
-
* @public
|
|
587
|
-
*/
|
|
588
|
-
type Nullish<T> = T | null | undefined;
|
|
589
|
-
/**
|
|
590
|
-
* Creates a union of all possible paths through an object type
|
|
591
|
-
*
|
|
592
|
-
* @example
|
|
593
|
-
* ```typescript
|
|
594
|
-
* interface User {
|
|
595
|
-
* profile: {
|
|
596
|
-
* name: string;
|
|
597
|
-
* address: {
|
|
598
|
-
* city: string;
|
|
599
|
-
* };
|
|
600
|
-
* };
|
|
601
|
-
* }
|
|
602
|
-
*
|
|
603
|
-
* type Paths = ObjectPaths<User>;
|
|
604
|
-
* // 'profile' | 'profile.name' | 'profile.address' | 'profile.address.city'
|
|
605
|
-
* ```
|
|
606
|
-
*
|
|
607
|
-
* @public
|
|
608
|
-
*/
|
|
609
|
-
type ObjectPaths<T> = {
|
|
610
|
-
[K in keyof T & string]: T[K] extends object ? K | `${K}.${ObjectPaths<T[K]>}` : K;
|
|
611
|
-
}[keyof T & string];
|
|
612
|
-
/**
|
|
613
|
-
* Merges two types, with properties from B overriding those in A
|
|
614
|
-
*
|
|
615
|
-
* @example
|
|
616
|
-
* ```typescript
|
|
617
|
-
* interface A {
|
|
618
|
-
* id: number;
|
|
619
|
-
* name: string;
|
|
620
|
-
* }
|
|
621
|
-
*
|
|
622
|
-
* interface B {
|
|
623
|
-
* id: string;
|
|
624
|
-
* email: string;
|
|
625
|
-
* }
|
|
626
|
-
*
|
|
627
|
-
* type Merged = Merge<A, B>;
|
|
628
|
-
* // { id: string; name: string; email: string }
|
|
629
|
-
* ```
|
|
630
|
-
*
|
|
631
|
-
* @public
|
|
632
|
-
*/
|
|
633
|
-
type Merge<A, B> = Omit<A, keyof B> & B;
|
|
634
|
-
/**
|
|
635
|
-
* Ensures a type is serializable (no functions, symbols, undefined)
|
|
636
|
-
*
|
|
637
|
-
* @example
|
|
638
|
-
* ```typescript
|
|
639
|
-
* interface Data {
|
|
640
|
-
* id: string;
|
|
641
|
-
* callback: () => void;
|
|
642
|
-
* value: number;
|
|
643
|
-
* }
|
|
644
|
-
*
|
|
645
|
-
* type SerializableData = Serializable<Data>;
|
|
646
|
-
* // { id: string; value: number }
|
|
647
|
-
* ```
|
|
648
|
-
*
|
|
649
|
-
* @public
|
|
650
|
-
*/
|
|
651
|
-
type Serializable<T> = {
|
|
652
|
-
[K in keyof T as T[K] extends (...args: readonly unknown[]) => unknown ? never : T[K] extends symbol ? never : T[K] extends undefined ? never : K]: T[K] extends object ? Serializable<T[K]> : T[K];
|
|
653
|
-
};
|
|
654
|
-
/**
|
|
655
|
-
* Converts a union type to an intersection type
|
|
656
|
-
*
|
|
657
|
-
* @example
|
|
658
|
-
* ```typescript
|
|
659
|
-
* type Union = { a: string } | { b: number };
|
|
660
|
-
* type Intersection = UnionToIntersection<Union>;
|
|
661
|
-
* // { a: string } & { b: number }
|
|
662
|
-
* ```
|
|
663
|
-
*
|
|
664
|
-
* @public
|
|
665
|
-
*/
|
|
666
|
-
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
667
|
-
/**
|
|
668
|
-
* Gets all keys of T whose values extend V
|
|
669
|
-
*
|
|
670
|
-
* @example
|
|
671
|
-
* ```typescript
|
|
672
|
-
* interface User {
|
|
673
|
-
* id: string;
|
|
674
|
-
* age: number;
|
|
675
|
-
* name: string;
|
|
676
|
-
* active: boolean;
|
|
677
|
-
* }
|
|
678
|
-
*
|
|
679
|
-
* type StringKeys = KeysOfType<User, string>;
|
|
680
|
-
* // 'id' | 'name'
|
|
681
|
-
* ```
|
|
682
|
-
*
|
|
683
|
-
* @public
|
|
684
|
-
*/
|
|
685
|
-
type KeysOfType<T, V> = {
|
|
686
|
-
[K in keyof T]: T[K] extends V ? K : never;
|
|
687
|
-
}[keyof T];
|
|
688
|
-
/**
|
|
689
|
-
* Ensures a value is exactly the type T (no wider types allowed)
|
|
690
|
-
*
|
|
691
|
-
* @example
|
|
692
|
-
* ```typescript
|
|
693
|
-
* const config: Exact<{ debug: boolean }> = {
|
|
694
|
-
* debug: true,
|
|
695
|
-
* // extra: 'value' // ❌ Error: extra property not allowed
|
|
696
|
-
* };
|
|
697
|
-
* ```
|
|
698
|
-
*
|
|
699
|
-
* @public
|
|
700
|
-
*/
|
|
701
|
-
type Exact<T, Shape = T> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
|
|
702
|
-
/**
|
|
703
|
-
* Creates a branded type for nominal typing
|
|
704
|
-
* This prevents mixing values of the same primitive type
|
|
705
|
-
*
|
|
706
|
-
* @example
|
|
707
|
-
* ```typescript
|
|
708
|
-
* type UserId = Brand<string, 'UserId'>;
|
|
709
|
-
* type ProductId = Brand<string, 'ProductId'>;
|
|
710
|
-
*
|
|
711
|
-
* const userId: UserId = '123' as UserId;
|
|
712
|
-
* const productId: ProductId = '456' as ProductId;
|
|
713
|
-
*
|
|
714
|
-
* // ❌ Type error: UserId is not assignable to ProductId
|
|
715
|
-
* const test: ProductId = userId;
|
|
716
|
-
* ```
|
|
717
|
-
*
|
|
718
|
-
* @public
|
|
719
|
-
*/
|
|
720
|
-
type Brand<T, TBrand extends string> = T & {
|
|
721
|
-
readonly __brand: TBrand;
|
|
722
|
-
};
|
|
723
|
-
/**
|
|
724
|
-
* Helper to create a branded value
|
|
725
|
-
*
|
|
726
|
-
* @param value - The value to brand
|
|
727
|
-
* @returns The value as a branded type
|
|
728
|
-
*
|
|
729
|
-
* @example
|
|
730
|
-
* ```typescript
|
|
731
|
-
* type UserId = Brand<string, 'UserId'>;
|
|
732
|
-
* const id = brand<string, 'UserId'>('user-123');
|
|
733
|
-
* // id has type UserId
|
|
734
|
-
* ```
|
|
735
|
-
*
|
|
736
|
-
* @public
|
|
737
|
-
*/
|
|
738
|
-
declare function brand<T, TBrand extends string>(value: T): Brand<T, TBrand>;
|
|
739
|
-
/**
|
|
740
|
-
* Removes branding from a branded type
|
|
741
|
-
*
|
|
742
|
-
* @example
|
|
743
|
-
* ```typescript
|
|
744
|
-
* type UserId = Brand<string, 'UserId'>;
|
|
745
|
-
* type PlainId = Unbrand<UserId>;
|
|
746
|
-
* // string
|
|
747
|
-
* ```
|
|
748
|
-
*
|
|
749
|
-
* @public
|
|
750
|
-
*/
|
|
751
|
-
type Unbrand<T> = T extends infer U & {
|
|
752
|
-
readonly __brand: string;
|
|
753
|
-
} ? U : T;
|
|
754
|
-
/**
|
|
755
|
-
* Type-safe Object.keys that preserves key types
|
|
756
|
-
*
|
|
757
|
-
* @param obj - The object to get keys from
|
|
758
|
-
* @returns Array of keys with proper type
|
|
759
|
-
*
|
|
760
|
-
* @example
|
|
761
|
-
* ```typescript
|
|
762
|
-
* const user = { id: '1', name: 'John' } as const;
|
|
763
|
-
* const keys = typedKeys(user);
|
|
764
|
-
* // keys has type: ('id' | 'name')[]
|
|
765
|
-
* ```
|
|
766
|
-
*
|
|
767
|
-
* @public
|
|
768
|
-
*/
|
|
769
|
-
declare function typedKeys<T extends Record<string, unknown>>(obj: T): Array<keyof T>;
|
|
770
|
-
/**
|
|
771
|
-
* Type-safe Object.entries that preserves key and value types
|
|
772
|
-
*
|
|
773
|
-
* @param obj - The object to get entries from
|
|
774
|
-
* @returns Array of [key, value] tuples with proper types
|
|
775
|
-
*
|
|
776
|
-
* @example
|
|
777
|
-
* ```typescript
|
|
778
|
-
* const user = { id: '1', age: 30 } as const;
|
|
779
|
-
* const entries = typedEntries(user);
|
|
780
|
-
* // entries has type: ['id', '1'] | ['age', 30]
|
|
781
|
-
* ```
|
|
782
|
-
*
|
|
783
|
-
* @public
|
|
784
|
-
*/
|
|
785
|
-
declare function typedEntries<T extends Record<string, unknown>>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
786
|
-
/**
|
|
787
|
-
* Type-safe Object.values that preserves value types
|
|
788
|
-
*
|
|
789
|
-
* @param obj - The object to get values from
|
|
790
|
-
* @returns Array of values with proper type
|
|
791
|
-
*
|
|
792
|
-
* @example
|
|
793
|
-
* ```typescript
|
|
794
|
-
* const user = { id: '1', age: 30 };
|
|
795
|
-
* const values = typedValues(user);
|
|
796
|
-
* // values has type: (string | number)[]
|
|
797
|
-
* ```
|
|
798
|
-
*
|
|
799
|
-
* @public
|
|
800
|
-
*/
|
|
801
|
-
declare function typedValues<T extends Record<string, unknown>>(obj: T): Array<T[keyof T]>;
|
|
802
|
-
|
|
803
|
-
interface PostModel<TFilterModel> {
|
|
804
|
-
filterModel?: TFilterModel;
|
|
805
|
-
pageOffset: number;
|
|
806
|
-
pageSize: number;
|
|
807
|
-
sortField: string | null;
|
|
808
|
-
sortOrder: "asc" | "desc" | null | undefined;
|
|
809
|
-
sortModel?: GridSortModel;
|
|
810
|
-
}
|
|
811
|
-
interface ListResponse<TGridModel> {
|
|
812
|
-
Data: TGridModel[];
|
|
813
|
-
Total: number;
|
|
814
|
-
}
|
|
815
|
-
interface ValueLabel {
|
|
816
|
-
Value: number | string;
|
|
817
|
-
Label: string;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
export { type ApiCallOptions, type ApiResponse, type ArrayElement, type AsyncMultiSelectPayload, type AsyncReturnType, type Brand, type DeepPartial, type DeepReadonly, type DeepRequired, type Exact, type ExcludeKeys, type FetchOptions, type HttpHeaders, type HttpMethod, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type KeysOfType, type ListResponse, type Maybe, type Merge, type Nullable, type Nullish, type ObjectPaths, type OperationResponse, type OptionItem, type OptionItem2, type OptionalKeys, type PartialKeys, type PickKeys, type PostModel, type RequestBody, type RequestOptions, type RequireKeys, type RequiredKeys, type Serializable, type Unbrand, type UnionToIntersection, type ValidationErrors, type ValueLabel, brand, isFormData, isJsonArray, isJsonObject, isRequestBody, typedEntries, typedKeys, typedValues };
|