@gnwebsoft/ui 3.0.8 → 3.0.9
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-3OPVOWQK.js +140 -0
- package/dist/chunk-AEOF2TUF.cjs +2273 -0
- package/dist/chunk-ALHC7RLK.js +575 -0
- package/dist/chunk-BRRLB22L.js +72 -0
- package/dist/chunk-CHZU4PZB.js +2273 -0
- package/dist/chunk-EBRUE2WR.cjs +1 -1
- package/dist/chunk-HEHPKM4B.cjs +140 -0
- package/dist/chunk-K2EJ4YKO.cjs +72 -0
- package/dist/chunk-MVPLBJRK.cjs +1 -1
- package/dist/chunk-XY4U6A77.cjs +575 -0
- package/dist/components/index.cjs +1 -1
- package/dist/{enhanced-z-I7EHVS.d.cts → enhanced-CDTkKUlj.d.ts} +5 -5
- package/dist/{enhanced-z-I7EHVS.d.ts → enhanced-ZQoS03Cd.d.cts} +5 -5
- package/dist/events-BcHVCLBz.d.cts +77 -0
- package/dist/events-BcHVCLBz.d.ts +77 -0
- package/dist/hooks/index.cjs +3 -3
- package/dist/hooks/index.d.cts +3 -2
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +67 -6
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +65 -4
- package/dist/types/index.cjs +31 -2
- package/dist/types/index.d.cts +588 -1
- package/dist/types/index.d.ts +588 -1
- package/dist/types/index.js +30 -1
- package/dist/utils/index.cjs +37 -3
- package/dist/utils/index.d.cts +329 -13
- package/dist/utils/index.d.ts +329 -13
- package/dist/utils/index.js +35 -1
- package/dist/wrappers/index.cjs +4 -4
- package/dist/wrappers/index.d.cts +11 -9
- package/dist/wrappers/index.d.ts +11 -9
- package/dist/wrappers/index.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-4H3AFH7A.js +0 -505
- package/dist/chunk-DE62KYFK.js +0 -122
- package/dist/chunk-DEPJRTVT.js +0 -1
- package/dist/chunk-FD57PCAC.cjs +0 -1
- package/dist/chunk-JCXHX2PZ.js +0 -2265
- package/dist/chunk-MW2UCDTI.cjs +0 -2265
- package/dist/chunk-R2YK4LTT.cjs +0 -122
- package/dist/chunk-ZC7FGYL2.cjs +0 -505
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PostModel, ApiResponse, ListResponse, ValidationErrors } from '../types/index.cjs';
|
|
1
|
+
import { PostModel, ApiResponse, ListResponse, JsonObject, RequestOptions, ValidationErrors } from '../types/index.cjs';
|
|
2
2
|
import { PickerValidDate } from '@mui/x-date-pickers';
|
|
3
3
|
import { useLocalizationContext } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -6,26 +6,28 @@ import { FieldValues, UseFormSetError, Control, DeepPartialSkipArrayKey, Path, P
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import '@mui/x-data-grid';
|
|
8
8
|
import '../AsyncSelectPayload-B9-6l33R.cjs';
|
|
9
|
+
import '../events-BcHVCLBz.cjs';
|
|
10
|
+
import 'react';
|
|
9
11
|
|
|
10
12
|
declare class api {
|
|
11
13
|
static filter<T, TFilter>(url: string, postModel: PostModel<TFilter>): Promise<ApiResponse<ListResponse<T>>>;
|
|
12
|
-
static post<T>(url: string, body?:
|
|
14
|
+
static post<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
|
|
13
15
|
static get<T>(url: string): Promise<ApiResponse<T>>;
|
|
14
16
|
static delete<T>(url: string): Promise<ApiResponse<T>>;
|
|
15
|
-
static put<T>(url: string, body?:
|
|
16
|
-
static fetch(url: string, options?:
|
|
17
|
-
static tempFetch<T>(url: string, options?:
|
|
17
|
+
static put<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
|
|
18
|
+
static fetch(url: string, options?: RequestInit): Promise<Response>;
|
|
19
|
+
static tempFetch<T>(url: string, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
18
20
|
static upload<T>(url: string, formData: FormData): Promise<ApiResponse<T>>;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
declare class api2 {
|
|
22
24
|
static filter<T, TFilter>(url: string, postModel: PostModel<TFilter>): Promise<ApiResponse<ListResponse<T>>>;
|
|
23
|
-
static post<T>(url: string, body?:
|
|
25
|
+
static post<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
|
|
24
26
|
static get<T>(url: string): Promise<ApiResponse<T>>;
|
|
25
27
|
static delete<T>(url: string): Promise<ApiResponse<T>>;
|
|
26
|
-
static put<T>(url: string, body?:
|
|
27
|
-
static fetch(url: string, options?:
|
|
28
|
-
static tempFetch<T>(url: string, options?:
|
|
28
|
+
static put<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
|
|
29
|
+
static fetch(url: string, options?: RequestInit): Promise<Response>;
|
|
30
|
+
static tempFetch<T>(url: string, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
29
31
|
static upload<T>(url: string, formData: FormData): Promise<ApiResponse<T>>;
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -90,9 +92,7 @@ declare class api2 {
|
|
|
90
92
|
*
|
|
91
93
|
* @public
|
|
92
94
|
*/
|
|
93
|
-
declare const flattenObjectKeys: (obj:
|
|
94
|
-
[x: string]: any;
|
|
95
|
-
};
|
|
95
|
+
declare const flattenObjectKeys: (obj: unknown, prefix?: string) => Record<string, unknown>;
|
|
96
96
|
|
|
97
97
|
declare function getTimezone<TDate extends PickerValidDate>(adapter: ReturnType<typeof useLocalizationContext>, value: TDate): string | null;
|
|
98
98
|
|
|
@@ -364,4 +364,320 @@ declare const typedWatch: {
|
|
|
364
364
|
readonly selector: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>, TOutput>(control: react_hook_form.Control<TFieldValues>, name: TName, selector: (value: react_hook_form.PathValue<TFieldValues, TName>) => TOutput, deps?: React.DependencyList) => TOutput;
|
|
365
365
|
};
|
|
366
366
|
|
|
367
|
-
|
|
367
|
+
/**
|
|
368
|
+
* Type guard utilities for runtime type checking
|
|
369
|
+
*
|
|
370
|
+
* @packageDocumentation
|
|
371
|
+
*/
|
|
372
|
+
/**
|
|
373
|
+
* Type guard to check if a value is a non-null object (excluding arrays)
|
|
374
|
+
*
|
|
375
|
+
* @param value - The value to check
|
|
376
|
+
* @returns True if the value is a plain object
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* if (isRecord(value)) {
|
|
381
|
+
* // value is Record<string, unknown>
|
|
382
|
+
* const keys = Object.keys(value);
|
|
383
|
+
* }
|
|
384
|
+
* ```
|
|
385
|
+
*
|
|
386
|
+
* @public
|
|
387
|
+
*/
|
|
388
|
+
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
389
|
+
/**
|
|
390
|
+
* Type guard to check if an object has a specific property
|
|
391
|
+
*
|
|
392
|
+
* @param obj - The object to check
|
|
393
|
+
* @param key - The property key to look for
|
|
394
|
+
* @returns True if the object has the property
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* if (hasProperty(obj, 'name')) {
|
|
399
|
+
* // obj is Record<'name', unknown>
|
|
400
|
+
* console.log(obj.name);
|
|
401
|
+
* }
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* @public
|
|
405
|
+
*/
|
|
406
|
+
declare function hasProperty<K extends PropertyKey>(obj: unknown, key: K): obj is Record<K, unknown>;
|
|
407
|
+
/**
|
|
408
|
+
* Type guard to check if a value is a non-empty string
|
|
409
|
+
*
|
|
410
|
+
* @param value - The value to check
|
|
411
|
+
* @returns True if the value is a non-empty string
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```typescript
|
|
415
|
+
* if (isNonEmptyString(value)) {
|
|
416
|
+
* // value is string with length > 0
|
|
417
|
+
* console.log(value.toUpperCase());
|
|
418
|
+
* }
|
|
419
|
+
* ```
|
|
420
|
+
*
|
|
421
|
+
* @public
|
|
422
|
+
*/
|
|
423
|
+
declare function isNonEmptyString(value: unknown): value is string;
|
|
424
|
+
/**
|
|
425
|
+
* Type guard to check if a value is a valid array
|
|
426
|
+
*
|
|
427
|
+
* @param value - The value to check
|
|
428
|
+
* @returns True if the value is an array
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```typescript
|
|
432
|
+
* if (isArray(value)) {
|
|
433
|
+
* // value is unknown[]
|
|
434
|
+
* value.forEach(item => console.log(item));
|
|
435
|
+
* }
|
|
436
|
+
* ```
|
|
437
|
+
*
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
declare function isArray<T = unknown>(value: unknown): value is T[];
|
|
441
|
+
/**
|
|
442
|
+
* Type guard to check if a value is a non-empty array
|
|
443
|
+
*
|
|
444
|
+
* @param value - The value to check
|
|
445
|
+
* @returns True if the value is a non-empty array
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* ```typescript
|
|
449
|
+
* if (isNonEmptyArray(items)) {
|
|
450
|
+
* // items is [T, ...T[]] - guaranteed to have at least one element
|
|
451
|
+
* const first = items[0]; // Safe access
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
declare function isNonEmptyArray<T>(value: unknown): value is [T, ...T[]];
|
|
458
|
+
/**
|
|
459
|
+
* Type guard to check if a value is a function
|
|
460
|
+
*
|
|
461
|
+
* @param value - The value to check
|
|
462
|
+
* @returns True if the value is a function
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```typescript
|
|
466
|
+
* if (isFunction(callback)) {
|
|
467
|
+
* // callback is (...args: unknown[]) => unknown
|
|
468
|
+
* callback();
|
|
469
|
+
* }
|
|
470
|
+
* ```
|
|
471
|
+
*
|
|
472
|
+
* @public
|
|
473
|
+
*/
|
|
474
|
+
declare function isFunction(value: unknown): value is (...args: readonly unknown[]) => unknown;
|
|
475
|
+
/**
|
|
476
|
+
* Type guard to check if a value is a string
|
|
477
|
+
*
|
|
478
|
+
* @param value - The value to check
|
|
479
|
+
* @returns True if the value is a string (including empty string)
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```typescript
|
|
483
|
+
* if (isString(value)) {
|
|
484
|
+
* // value is string
|
|
485
|
+
* console.log(value.length);
|
|
486
|
+
* }
|
|
487
|
+
* ```
|
|
488
|
+
*
|
|
489
|
+
* @public
|
|
490
|
+
*/
|
|
491
|
+
declare function isString(value: unknown): value is string;
|
|
492
|
+
/**
|
|
493
|
+
* Type guard to check if a value is a number (excluding NaN)
|
|
494
|
+
*
|
|
495
|
+
* @param value - The value to check
|
|
496
|
+
* @returns True if the value is a valid number
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```typescript
|
|
500
|
+
* if (isNumber(value)) {
|
|
501
|
+
* // value is number (not NaN)
|
|
502
|
+
* const doubled = value * 2;
|
|
503
|
+
* }
|
|
504
|
+
* ```
|
|
505
|
+
*
|
|
506
|
+
* @public
|
|
507
|
+
*/
|
|
508
|
+
declare function isNumber(value: unknown): value is number;
|
|
509
|
+
/**
|
|
510
|
+
* Type guard to check if a value is a boolean
|
|
511
|
+
*
|
|
512
|
+
* @param value - The value to check
|
|
513
|
+
* @returns True if the value is a boolean
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```typescript
|
|
517
|
+
* if (isBoolean(value)) {
|
|
518
|
+
* // value is boolean
|
|
519
|
+
* console.log(!value);
|
|
520
|
+
* }
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @public
|
|
524
|
+
*/
|
|
525
|
+
declare function isBoolean(value: unknown): value is boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Type guard to check if a value is null
|
|
528
|
+
*
|
|
529
|
+
* @param value - The value to check
|
|
530
|
+
* @returns True if the value is null
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```typescript
|
|
534
|
+
* if (isNull(value)) {
|
|
535
|
+
* // value is null
|
|
536
|
+
* return defaultValue;
|
|
537
|
+
* }
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* @public
|
|
541
|
+
*/
|
|
542
|
+
declare function isNull(value: unknown): value is null;
|
|
543
|
+
/**
|
|
544
|
+
* Type guard to check if a value is undefined
|
|
545
|
+
*
|
|
546
|
+
* @param value - The value to check
|
|
547
|
+
* @returns True if the value is undefined
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```typescript
|
|
551
|
+
* if (isUndefined(value)) {
|
|
552
|
+
* // value is undefined
|
|
553
|
+
* return defaultValue;
|
|
554
|
+
* }
|
|
555
|
+
* ```
|
|
556
|
+
*
|
|
557
|
+
* @public
|
|
558
|
+
*/
|
|
559
|
+
declare function isUndefined(value: unknown): value is undefined;
|
|
560
|
+
/**
|
|
561
|
+
* Type guard to check if a value is null or undefined
|
|
562
|
+
*
|
|
563
|
+
* @param value - The value to check
|
|
564
|
+
* @returns True if the value is nullish
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```typescript
|
|
568
|
+
* if (isNullish(value)) {
|
|
569
|
+
* // value is null | undefined
|
|
570
|
+
* return defaultValue;
|
|
571
|
+
* }
|
|
572
|
+
*
|
|
573
|
+
* if (!isNullish(value)) {
|
|
574
|
+
* // value is NonNullable<typeof value>
|
|
575
|
+
* console.log(value);
|
|
576
|
+
* }
|
|
577
|
+
* ```
|
|
578
|
+
*
|
|
579
|
+
* @public
|
|
580
|
+
*/
|
|
581
|
+
declare function isNullish(value: unknown): value is null | undefined;
|
|
582
|
+
/**
|
|
583
|
+
* Type guard to check if a value is defined (not null or undefined)
|
|
584
|
+
*
|
|
585
|
+
* @param value - The value to check
|
|
586
|
+
* @returns True if the value is not null or undefined
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```typescript
|
|
590
|
+
* const filtered = items.filter(isDefined);
|
|
591
|
+
* // filtered has type: NonNullable<T>[]
|
|
592
|
+
* ```
|
|
593
|
+
*
|
|
594
|
+
* @public
|
|
595
|
+
*/
|
|
596
|
+
declare function isDefined<T>(value: T): value is NonNullable<T>;
|
|
597
|
+
/**
|
|
598
|
+
* Type guard to check if a value is a Date object
|
|
599
|
+
*
|
|
600
|
+
* @param value - The value to check
|
|
601
|
+
* @returns True if the value is a Date
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* ```typescript
|
|
605
|
+
* if (isDate(value)) {
|
|
606
|
+
* // value is Date
|
|
607
|
+
* console.log(value.toISOString());
|
|
608
|
+
* }
|
|
609
|
+
* ```
|
|
610
|
+
*
|
|
611
|
+
* @public
|
|
612
|
+
*/
|
|
613
|
+
declare function isDate(value: unknown): value is Date;
|
|
614
|
+
/**
|
|
615
|
+
* Type guard to check if a value is a Promise
|
|
616
|
+
*
|
|
617
|
+
* @param value - The value to check
|
|
618
|
+
* @returns True if the value is a Promise
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```typescript
|
|
622
|
+
* if (isPromise(value)) {
|
|
623
|
+
* // value is Promise<unknown>
|
|
624
|
+
* const result = await value;
|
|
625
|
+
* }
|
|
626
|
+
* ```
|
|
627
|
+
*
|
|
628
|
+
* @public
|
|
629
|
+
*/
|
|
630
|
+
declare function isPromise(value: unknown): value is Promise<unknown>;
|
|
631
|
+
/**
|
|
632
|
+
* Type guard to check if an error is an Error instance
|
|
633
|
+
*
|
|
634
|
+
* @param error - The error to check
|
|
635
|
+
* @returns True if the error is an Error instance
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```typescript
|
|
639
|
+
* try {
|
|
640
|
+
* // ...
|
|
641
|
+
* } catch (error) {
|
|
642
|
+
* if (isError(error)) {
|
|
643
|
+
* // error is Error
|
|
644
|
+
* console.error(error.message);
|
|
645
|
+
* }
|
|
646
|
+
* }
|
|
647
|
+
* ```
|
|
648
|
+
*
|
|
649
|
+
* @public
|
|
650
|
+
*/
|
|
651
|
+
declare function isError(error: unknown): error is Error;
|
|
652
|
+
/**
|
|
653
|
+
* Type guard to check if a value matches a specific type using a validator function
|
|
654
|
+
*
|
|
655
|
+
* @param value - The value to check
|
|
656
|
+
* @param validator - Function that returns true if value matches the type
|
|
657
|
+
* @returns True if the value matches the type
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```typescript
|
|
661
|
+
* interface User {
|
|
662
|
+
* id: string;
|
|
663
|
+
* name: string;
|
|
664
|
+
* }
|
|
665
|
+
*
|
|
666
|
+
* const isUser = (value: unknown): value is User =>
|
|
667
|
+
* isRecord(value) &&
|
|
668
|
+
* hasProperty(value, 'id') &&
|
|
669
|
+
* hasProperty(value, 'name') &&
|
|
670
|
+
* isString(value.id) &&
|
|
671
|
+
* isString(value.name);
|
|
672
|
+
*
|
|
673
|
+
* if (isUser(data)) {
|
|
674
|
+
* // data is User
|
|
675
|
+
* console.log(data.name);
|
|
676
|
+
* }
|
|
677
|
+
* ```
|
|
678
|
+
*
|
|
679
|
+
* @public
|
|
680
|
+
*/
|
|
681
|
+
declare function matches<T>(value: unknown, validator: (value: unknown) => value is T): value is T;
|
|
682
|
+
|
|
683
|
+
export { type PathArray, api, api2, flattenObjectKeys, getTimezone, handleServerErrors, hasProperty, isArray, isBoolean, isDate, isDefined, isError, isFunction, isNonEmptyArray, isNonEmptyString, isNull, isNullish, isNumber, isPromise, isRecord, isString, isUndefined, matches, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools, typedWatch, useWatchBatch, useWatchBoolean, useWatchConditional, useWatchDebounced, useWatchDefault, useWatchField, useWatchFields, useWatchForm, useWatchSelector, useWatchTransform };
|