@bsol-oss/react-datatable5 13.0.1-beta.3 → 13.0.1-beta.30
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 +5 -326
- package/dist/index.d.ts +173 -367
- package/dist/index.js +2449 -2934
- package/dist/index.mjs +2456 -2934
- package/dist/types/components/DataTable/context/DataTableContext.d.ts +3 -0
- package/dist/types/components/DataTable/controls/ColumnFilterMenu.d.ts +20 -0
- package/dist/types/components/DataTable/controls/MobileTableControls.d.ts +1 -1
- package/dist/types/components/DataTable/controls/TableControls.d.ts +1 -3
- package/dist/types/components/DataTable/controls/TableFilterTags.d.ts +10 -1
- package/dist/types/components/DataTable/display/DataDisplay.d.ts +1 -1
- package/dist/types/components/DataTable/display/TableCardContainer.d.ts +5 -5
- package/dist/types/components/DataTable/hooks/useResponsiveColumnVisibility.d.ts +1 -1
- package/dist/types/components/DataTable/useDataTableServer.d.ts +1 -1
- package/dist/types/components/DataTable/utils/selectors.d.ts +1 -1
- package/dist/types/components/DatePicker/Calendar.d.ts +2 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +27 -0
- package/dist/types/components/DatePicker/DateTimePicker.d.ts +20 -4
- package/dist/types/components/DatePicker/UniversalPicker.d.ts +2 -3
- package/dist/types/components/DatePicker/index.d.ts +1 -2
- package/dist/types/components/Form/SchemaFormContext.d.ts +6 -35
- package/dist/types/components/Form/components/core/FormRoot.d.ts +31 -27
- package/dist/types/components/Form/components/fields/FilePicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +0 -25
- package/dist/types/components/Form/components/fields/useIdPickerData.d.ts +7 -4
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +75 -34
- package/dist/types/components/Form/components/viewers/EnumViewer.d.ts +1 -1
- package/dist/types/components/Form/components/viewers/FileViewer.d.ts +7 -5
- package/dist/types/components/Form/useForm.d.ts +8 -16
- package/dist/types/components/Form/utils/ajvResolver.d.ts +4 -0
- package/dist/types/components/Form/utils/getNestedError.d.ts +12 -0
- package/dist/types/components/Form/utils/getTableData.d.ts +1 -2
- package/dist/types/components/Form/utils/useFormLabel.d.ts +12 -0
- package/dist/types/components/TextArea/TextArea.d.ts +4 -19
- package/dist/types/components/TimePicker/TimePicker.d.ts +9 -8
- package/dist/types/index.d.ts +10 -3
- package/package.json +10 -4
- package/dist/types/components/DataTable/utils/getColumns.d.ts +0 -14
- package/dist/types/components/DatePicker/DatePickerInput.d.ts +0 -18
- package/dist/types/components/DatePicker/IsoTimePicker.d.ts +0 -24
- package/dist/types/components/DatePicker/PickerDemo.d.ts +0 -1
- package/dist/types/components/Form/components/fields/TagPicker.d.ts +0 -25
- package/dist/types/components/Form/components/viewers/TagViewer.d.ts +0 -30
- package/dist/types/components/Form/utils/buildErrorMessages.d.ts +0 -223
- package/dist/types/components/Form/utils/getFieldError.d.ts +0 -6
- package/dist/types/components/Form/utils/idListSanityCheck.d.ts +0 -1
- package/dist/types/components/Form/utils/useFormI18n.d.ts +0 -57
- package/dist/types/components/ui/number-input.d.ts +0 -8
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,13 @@ import { Row, Table as Table$1, RowData, OnChangeFn, Updater, SortingState, Colu
|
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { ReactNode, Dispatch, SetStateAction } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { TableHeaderProps as TableHeaderProps$1, TableRowProps, GridProps, TableRootProps,
|
|
6
|
+
import { TableHeaderProps as TableHeaderProps$1, TableRowProps, GridProps, TableRootProps, FlexProps, CardBodyProps, TextProps, ImageProps, BoxProps } from '@chakra-ui/react';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
9
9
|
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
10
10
|
import { JSONSchema7 } from 'json-schema';
|
|
11
|
-
import { ForeignKeyProps as ForeignKeyProps$1 } from '@/components/Form/components/fields/StringInputField';
|
|
12
|
-
import { AxiosRequestConfig } from 'axios';
|
|
13
11
|
import * as react_hook_form from 'react-hook-form';
|
|
14
|
-
import {
|
|
12
|
+
import { UseFormReturn, FieldValues, SubmitHandler } from 'react-hook-form';
|
|
15
13
|
|
|
16
14
|
interface TableHeaderTexts {
|
|
17
15
|
pinColumn?: string;
|
|
@@ -130,8 +128,6 @@ interface TableControlsProps {
|
|
|
130
128
|
children?: ReactNode;
|
|
131
129
|
showGlobalFilter?: boolean;
|
|
132
130
|
showFilter?: boolean;
|
|
133
|
-
showFilterName?: boolean;
|
|
134
|
-
showFilterTags?: boolean;
|
|
135
131
|
showReload?: boolean;
|
|
136
132
|
showPagination?: boolean;
|
|
137
133
|
showPageSizeControl?: boolean;
|
|
@@ -149,11 +145,20 @@ interface TableControlsProps {
|
|
|
149
145
|
hasError?: boolean;
|
|
150
146
|
gridProps?: GridProps;
|
|
151
147
|
}
|
|
152
|
-
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter,
|
|
148
|
+
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: TableControlsProps) => react_jsx_runtime.JSX.Element;
|
|
153
149
|
|
|
154
150
|
declare const TableFilter: () => react_jsx_runtime.JSX.Element;
|
|
155
151
|
|
|
156
|
-
|
|
152
|
+
interface TableFilterTagsProps {
|
|
153
|
+
filterTagsOptions?: {
|
|
154
|
+
column: string;
|
|
155
|
+
options: {
|
|
156
|
+
label: string;
|
|
157
|
+
value: string;
|
|
158
|
+
}[];
|
|
159
|
+
}[];
|
|
160
|
+
}
|
|
161
|
+
declare const TableFilterTags: ({ filterTagsOptions, }?: TableFilterTagsProps) => react_jsx_runtime.JSX.Element | null;
|
|
157
162
|
|
|
158
163
|
interface TableProps extends TableRootProps {
|
|
159
164
|
showLoading?: boolean;
|
|
@@ -185,12 +190,12 @@ interface TableRowSelectorProps<TData> {
|
|
|
185
190
|
}
|
|
186
191
|
declare const TableBody: ({ showSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
187
192
|
|
|
188
|
-
interface TableCardContainerProps extends
|
|
193
|
+
interface TableCardContainerProps extends Omit<GridProps, 'direction'> {
|
|
189
194
|
children: ReactNode;
|
|
190
|
-
variant?:
|
|
195
|
+
variant?: 'carousel' | '';
|
|
191
196
|
gap?: string;
|
|
192
197
|
gridTemplateColumns?: string;
|
|
193
|
-
direction?: FlexProps[
|
|
198
|
+
direction?: FlexProps['direction'];
|
|
194
199
|
}
|
|
195
200
|
declare const TableCardContainer: ({ children, variant, gap, gridTemplateColumns, direction, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
196
201
|
|
|
@@ -313,7 +318,7 @@ interface UseDataTableReturn {
|
|
|
313
318
|
}
|
|
314
319
|
declare const useDataTable: ({ default: { sorting: defaultSorting, pagination: defaultPagination, rowSelection: defaultRowSelection, columnFilters: defaultColumnFilters, columnOrder: defaultColumnOrder, columnVisibility: defaultColumnVisibility, globalFilter: defaultGlobalFilter, density: defaultDensity, }, }?: UseDataTableProps) => UseDataTableReturn;
|
|
315
320
|
|
|
316
|
-
interface UseDataTableServerProps<TData> extends
|
|
321
|
+
interface UseDataTableServerProps<TData> extends UseDataTableProps {
|
|
317
322
|
/**
|
|
318
323
|
* Delay to send the request if the `refreshData` called multiple times
|
|
319
324
|
*
|
|
@@ -468,6 +473,9 @@ interface DataTableLabel {
|
|
|
468
473
|
globalFilterPlaceholder: string;
|
|
469
474
|
trueLabel: string;
|
|
470
475
|
falseLabel: string;
|
|
476
|
+
noFiltersMatchText: string;
|
|
477
|
+
filterByLabel: string;
|
|
478
|
+
filterLabelsPlaceholder: string;
|
|
471
479
|
}
|
|
472
480
|
interface DataTableContextProps<TData = unknown> extends Omit<DataTableProps, 'translate'> {
|
|
473
481
|
table: Table$1<TData>;
|
|
@@ -479,292 +487,19 @@ interface DataTableContextProps<TData = unknown> extends Omit<DataTableProps, 't
|
|
|
479
487
|
|
|
480
488
|
declare const useDataTableContext: <TData>() => DataTableContextProps<TData>;
|
|
481
489
|
|
|
482
|
-
interface GetColumnsConfigs<K extends RowData> {
|
|
483
|
-
schema: JSONSchema7;
|
|
484
|
-
include?: K[];
|
|
485
|
-
ignore?: K[];
|
|
486
|
-
width?: number[];
|
|
487
|
-
meta?: {
|
|
488
|
-
[key in K as string]?: object;
|
|
489
|
-
};
|
|
490
|
-
defaultWidth?: number;
|
|
491
|
-
}
|
|
492
|
-
declare const widthSanityCheck: <K extends unknown>(widthList: number[], ignoreList: K[], properties: { [key in K as string]?: object | undefined; }) => void;
|
|
493
|
-
declare const getColumns: <TData extends unknown>({ schema, include, ignore, width, meta, defaultWidth, }: GetColumnsConfigs<TData>) => ColumnDef<TData>[];
|
|
494
|
-
|
|
495
|
-
interface Translate {
|
|
496
|
-
t: (key: string, options?: any) => string;
|
|
497
|
-
i18n?: any;
|
|
498
|
-
ready?: boolean;
|
|
499
|
-
}
|
|
500
|
-
interface UseFormProps {
|
|
501
|
-
preLoadedValues?: FieldValues | undefined;
|
|
502
|
-
keyPrefix?: string;
|
|
503
|
-
namespace?: string;
|
|
504
|
-
schema?: JSONSchema7;
|
|
505
|
-
}
|
|
506
|
-
declare const useForm: ({ preLoadedValues, keyPrefix: _keyPrefix, namespace: _namespace, schema, }: UseFormProps) => {
|
|
507
|
-
form: react_hook_form.UseFormReturn<FieldValues, any, undefined>;
|
|
508
|
-
idMap: Record<string, object>;
|
|
509
|
-
setIdMap: React$1.Dispatch<React$1.SetStateAction<Record<string, object>>>;
|
|
510
|
-
translate: Translate;
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
interface CustomQueryFnResponse {
|
|
514
|
-
/**
|
|
515
|
-
* The data of the query
|
|
516
|
-
*/
|
|
517
|
-
data: any;
|
|
518
|
-
/**
|
|
519
|
-
* The id map of the data
|
|
520
|
-
*/
|
|
521
|
-
idMap: Record<string, any>;
|
|
522
|
-
}
|
|
523
|
-
interface CustomQueryFnParams {
|
|
524
|
-
searching: string;
|
|
525
|
-
limit: number;
|
|
526
|
-
offset: number;
|
|
527
|
-
where?: Array<{
|
|
528
|
-
id: string;
|
|
529
|
-
value: string | string[];
|
|
530
|
-
}>;
|
|
531
|
-
}
|
|
532
|
-
type CustomQueryFn = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse>;
|
|
533
|
-
interface ForeignKeyProps {
|
|
534
|
-
column: string;
|
|
535
|
-
table: string;
|
|
536
|
-
customQueryFn?: CustomQueryFn;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Type definitions for error message configuration
|
|
541
|
-
*/
|
|
542
|
-
/**
|
|
543
|
-
* Common validation error types that can be customized
|
|
544
|
-
*/
|
|
545
490
|
type ValidationErrorType = 'minLength' | 'maxLength' | 'pattern' | 'minimum' | 'maximum' | 'multipleOf' | 'format' | 'type' | 'enum' | 'required' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minProperties' | 'maxProperties' | 'anyOf' | 'oneOf' | 'allOf' | 'const' | 'additionalProperties' | 'dependencies';
|
|
546
|
-
/**
|
|
547
|
-
* Configuration for field-specific validation errors
|
|
548
|
-
*/
|
|
549
|
-
type FieldErrorConfig = Partial<Record<ValidationErrorType, string>>;
|
|
550
|
-
/**
|
|
551
|
-
* Configuration for building error messages
|
|
552
|
-
*/
|
|
553
|
-
interface ErrorMessageConfig {
|
|
554
|
-
/**
|
|
555
|
-
* Required field error messages
|
|
556
|
-
* Maps field names to their required error messages
|
|
557
|
-
* Supports both plain strings and i18n translation keys
|
|
558
|
-
*
|
|
559
|
-
* @example
|
|
560
|
-
* ```typescript
|
|
561
|
-
* required: {
|
|
562
|
-
* username: "Username is required", // plain string
|
|
563
|
-
* email: "user.email.field_required" // i18n key
|
|
564
|
-
* }
|
|
565
|
-
* ```
|
|
566
|
-
*/
|
|
567
|
-
required?: Record<string, string>;
|
|
568
|
-
/**
|
|
569
|
-
* Field-specific validation error messages
|
|
570
|
-
* Maps field names to their validation error configurations
|
|
571
|
-
*
|
|
572
|
-
* @example
|
|
573
|
-
* ```typescript
|
|
574
|
-
* properties: {
|
|
575
|
-
* username: {
|
|
576
|
-
* minLength: "Username must be at least 3 characters",
|
|
577
|
-
* pattern: "Username can only contain letters and numbers"
|
|
578
|
-
* },
|
|
579
|
-
* age: {
|
|
580
|
-
* minimum: "Age must be at least 18",
|
|
581
|
-
* maximum: "Age cannot exceed 120"
|
|
582
|
-
* }
|
|
583
|
-
* }
|
|
584
|
-
* ```
|
|
585
|
-
*/
|
|
586
|
-
properties?: Record<string, FieldErrorConfig>;
|
|
587
|
-
/**
|
|
588
|
-
* Global fallback error messages for validation types
|
|
589
|
-
* These are used when no field-specific message is provided
|
|
590
|
-
*
|
|
591
|
-
* @example
|
|
592
|
-
* ```typescript
|
|
593
|
-
* {
|
|
594
|
-
* minLength: "This field is too short",
|
|
595
|
-
* minimum: "Value is too small"
|
|
596
|
-
* }
|
|
597
|
-
* ```
|
|
598
|
-
*/
|
|
599
|
-
[key: string]: any;
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Result of buildErrorMessages that follows ajv-errors format
|
|
603
|
-
*/
|
|
604
|
-
interface ErrorMessageResult {
|
|
605
|
-
required?: Record<string, string>;
|
|
606
|
-
properties?: Record<string, FieldErrorConfig>;
|
|
607
|
-
[key: string]: any;
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Schema-level error message builder
|
|
611
|
-
*
|
|
612
|
-
* Builds a complete errorMessage object compatible with ajv-errors plugin.
|
|
613
|
-
* Supports both i18n translation keys and plain string messages.
|
|
614
|
-
*
|
|
615
|
-
* @param config - Error message configuration
|
|
616
|
-
* @returns Complete errorMessage object for JSON Schema
|
|
617
|
-
*
|
|
618
|
-
* @example
|
|
619
|
-
* ```typescript
|
|
620
|
-
* // Simple required field errors
|
|
621
|
-
* const errorMessage = buildErrorMessages({
|
|
622
|
-
* required: {
|
|
623
|
-
* username: "Username is required",
|
|
624
|
-
* email: "user.email.field_required" // i18n key
|
|
625
|
-
* }
|
|
626
|
-
* });
|
|
627
|
-
*
|
|
628
|
-
* // With validation rules
|
|
629
|
-
* const errorMessage = buildErrorMessages({
|
|
630
|
-
* required: {
|
|
631
|
-
* password: "Password is required"
|
|
632
|
-
* },
|
|
633
|
-
* properties: {
|
|
634
|
-
* password: {
|
|
635
|
-
* minLength: "Password must be at least 8 characters",
|
|
636
|
-
* pattern: "Password must contain letters and numbers"
|
|
637
|
-
* },
|
|
638
|
-
* age: {
|
|
639
|
-
* minimum: "Must be 18 or older",
|
|
640
|
-
* maximum: "Must be under 120"
|
|
641
|
-
* }
|
|
642
|
-
* }
|
|
643
|
-
* });
|
|
644
|
-
*
|
|
645
|
-
* // With global fallbacks
|
|
646
|
-
* const errorMessage = buildErrorMessages({
|
|
647
|
-
* required: {
|
|
648
|
-
* email: "Email is required"
|
|
649
|
-
* },
|
|
650
|
-
* minLength: "This field is too short", // applies to all fields
|
|
651
|
-
* minimum: "Value is too small"
|
|
652
|
-
* });
|
|
653
|
-
* ```
|
|
654
|
-
*/
|
|
655
|
-
declare const buildErrorMessages: (config: ErrorMessageConfig) => ErrorMessageResult;
|
|
656
|
-
/**
|
|
657
|
-
* Converts buildErrorMessages result to ajv-errors compatible format
|
|
658
|
-
*/
|
|
659
|
-
declare const convertToAjvErrorsFormat: (errorMessages: ErrorMessageResult) => Record<string, any>;
|
|
660
|
-
/**
|
|
661
|
-
* Helper function to build required field errors
|
|
662
|
-
*
|
|
663
|
-
* Simplifies creating required field error messages, especially useful
|
|
664
|
-
* for generating i18n translation keys following a pattern.
|
|
665
|
-
*
|
|
666
|
-
* @param fields - Array of required field names
|
|
667
|
-
* @param messageOrGenerator - Either a string template or function to generate messages
|
|
668
|
-
* @returns Required field error configuration
|
|
669
|
-
*
|
|
670
|
-
* @example
|
|
671
|
-
* ```typescript
|
|
672
|
-
* // Plain string messages
|
|
673
|
-
* const required = buildRequiredErrors(
|
|
674
|
-
* ["username", "email", "password"],
|
|
675
|
-
* (field) => `${field} is required`
|
|
676
|
-
* );
|
|
677
|
-
* // Result: { username: "username is required", email: "email is required", ... }
|
|
678
|
-
*
|
|
679
|
-
* // i18n translation keys
|
|
680
|
-
* const required = buildRequiredErrors(
|
|
681
|
-
* ["username", "email"],
|
|
682
|
-
* (field) => `user.${field}.field_required`
|
|
683
|
-
* );
|
|
684
|
-
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
685
|
-
*
|
|
686
|
-
* // Same message for all fields
|
|
687
|
-
* const required = buildRequiredErrors(
|
|
688
|
-
* ["username", "email"],
|
|
689
|
-
* "This field is required"
|
|
690
|
-
* );
|
|
691
|
-
* // Result: { username: "This field is required", email: "This field is required" }
|
|
692
|
-
*
|
|
693
|
-
* // With keyPrefix for i18n
|
|
694
|
-
* const required = buildRequiredErrors(
|
|
695
|
-
* ["username", "email"],
|
|
696
|
-
* (field) => `${field}.field_required`,
|
|
697
|
-
* "user"
|
|
698
|
-
* );
|
|
699
|
-
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
700
|
-
* ```
|
|
701
|
-
*/
|
|
702
|
-
declare const buildRequiredErrors: (fields: string[], messageOrGenerator: string | ((field: string) => string), keyPrefix?: string) => Record<string, string>;
|
|
703
|
-
/**
|
|
704
|
-
* Helper function to build field-specific validation errors
|
|
705
|
-
*
|
|
706
|
-
* Creates property-specific error messages for multiple fields at once.
|
|
707
|
-
*
|
|
708
|
-
* @param config - Maps field names to their validation error configurations
|
|
709
|
-
* @returns Properties error configuration
|
|
710
|
-
*
|
|
711
|
-
* @example
|
|
712
|
-
* ```typescript
|
|
713
|
-
* const properties = buildFieldErrors({
|
|
714
|
-
* username: {
|
|
715
|
-
* minLength: "Username must be at least 3 characters",
|
|
716
|
-
* pattern: "Username can only contain letters and numbers"
|
|
717
|
-
* },
|
|
718
|
-
* age: {
|
|
719
|
-
* minimum: "Must be 18 or older",
|
|
720
|
-
* maximum: "Must be under 120"
|
|
721
|
-
* },
|
|
722
|
-
* email: {
|
|
723
|
-
* format: "Please enter a valid email address"
|
|
724
|
-
* }
|
|
725
|
-
* });
|
|
726
|
-
* ```
|
|
727
|
-
*/
|
|
728
|
-
declare const buildFieldErrors: (config: Record<string, FieldErrorConfig>) => Record<string, FieldErrorConfig>;
|
|
729
|
-
/**
|
|
730
|
-
* Helper function to create a complete error message configuration in one call
|
|
731
|
-
*
|
|
732
|
-
* Convenient wrapper that combines required and validation errors.
|
|
733
|
-
*
|
|
734
|
-
* @param required - Required field error messages
|
|
735
|
-
* @param properties - Field-specific validation error messages
|
|
736
|
-
* @param globalFallbacks - Global fallback error messages
|
|
737
|
-
* @returns Complete error message configuration
|
|
738
|
-
*
|
|
739
|
-
* @example
|
|
740
|
-
* ```typescript
|
|
741
|
-
* const errorMessage = createErrorMessage(
|
|
742
|
-
* {
|
|
743
|
-
* username: "Username is required",
|
|
744
|
-
* email: "Email is required"
|
|
745
|
-
* },
|
|
746
|
-
* {
|
|
747
|
-
* username: {
|
|
748
|
-
* minLength: "Username must be at least 3 characters"
|
|
749
|
-
* },
|
|
750
|
-
* email: {
|
|
751
|
-
* format: "Please enter a valid email"
|
|
752
|
-
* }
|
|
753
|
-
* },
|
|
754
|
-
* {
|
|
755
|
-
* minLength: "This field is too short",
|
|
756
|
-
* format: "Invalid format"
|
|
757
|
-
* }
|
|
758
|
-
* );
|
|
759
|
-
* ```
|
|
760
|
-
*/
|
|
761
|
-
declare const createErrorMessage: (required?: Record<string, string>, properties?: Record<string, FieldErrorConfig>, globalFallbacks?: Partial<Record<ValidationErrorType, string>>) => ErrorMessageResult;
|
|
762
|
-
|
|
763
491
|
interface DateTimePickerLabels {
|
|
764
492
|
monthNamesShort?: string[];
|
|
765
493
|
weekdayNamesShort?: string[];
|
|
766
494
|
backButtonLabel?: string;
|
|
767
495
|
forwardButtonLabel?: string;
|
|
496
|
+
selectDateLabel?: string;
|
|
497
|
+
quickActionLabels?: {
|
|
498
|
+
yesterday?: string;
|
|
499
|
+
today?: string;
|
|
500
|
+
tomorrow?: string;
|
|
501
|
+
plus7Days?: string;
|
|
502
|
+
};
|
|
768
503
|
}
|
|
769
504
|
interface IdPickerLabels {
|
|
770
505
|
undefined?: string;
|
|
@@ -816,25 +551,27 @@ interface FormButtonLabels {
|
|
|
816
551
|
interface TimePickerLabels {
|
|
817
552
|
placeholder?: string;
|
|
818
553
|
emptyMessage?: string;
|
|
554
|
+
selectTimeLabel?: string;
|
|
819
555
|
}
|
|
820
|
-
interface LoadInitialValuesParams {
|
|
556
|
+
interface LoadInitialValuesParams<TRecord = unknown> {
|
|
821
557
|
ids: string[];
|
|
822
|
-
|
|
823
|
-
setIdMap: React__default.Dispatch<React__default.SetStateAction<Record<string,
|
|
558
|
+
customQueryFn: CustomQueryFn<TRecord>;
|
|
559
|
+
setIdMap: React__default.Dispatch<React__default.SetStateAction<Record<string, TRecord>>>;
|
|
824
560
|
}
|
|
825
|
-
interface LoadInitialValuesResult {
|
|
561
|
+
interface LoadInitialValuesResult<TRecord = unknown> {
|
|
826
562
|
data: {
|
|
827
|
-
data:
|
|
563
|
+
data: TRecord[];
|
|
828
564
|
count: number;
|
|
829
565
|
};
|
|
830
|
-
idMap: Record<string,
|
|
566
|
+
idMap: Record<string, TRecord>;
|
|
831
567
|
}
|
|
832
|
-
interface CustomJSONSchema7 extends JSONSchema7 {
|
|
568
|
+
interface CustomJSONSchema7 extends Omit<JSONSchema7, 'items' | 'additionalItems' | 'properties' | 'additionalProperties' | 'definitions' | 'patternProperties' | 'dependencies' | 'allOf' | 'anyOf' | 'oneOf' | 'not' | 'if' | 'then' | 'else' | 'contains'> {
|
|
833
569
|
gridColumn?: string;
|
|
834
570
|
gridRow?: string;
|
|
835
|
-
|
|
836
|
-
variant?:
|
|
571
|
+
customQueryFn?: CustomQueryFn;
|
|
572
|
+
variant?: 'custom-input' | 'id-picker' | 'text-area' | 'media-library-browser' | 'file-picker' | 'date-range' | 'enum-picker' | 'radio';
|
|
837
573
|
renderDisplay?: (item: unknown) => ReactNode;
|
|
574
|
+
itemToValue?: (item: unknown) => string;
|
|
838
575
|
loadInitialValues?: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
839
576
|
inputRender?: (props: {
|
|
840
577
|
column: string;
|
|
@@ -855,33 +592,43 @@ interface CustomJSONSchema7 extends JSONSchema7 {
|
|
|
855
592
|
showLabel?: boolean;
|
|
856
593
|
formatOptions?: Intl.NumberFormatOptions;
|
|
857
594
|
numberStorageType?: 'string' | 'number';
|
|
858
|
-
|
|
595
|
+
errorMessage?: Record<Partial<ValidationErrorType> | string, string | Record<string, string>>;
|
|
859
596
|
filePicker?: FilePickerProps;
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
597
|
+
dateTimePicker?: {
|
|
598
|
+
showQuickActions?: boolean;
|
|
599
|
+
quickActionLabels?: {
|
|
600
|
+
yesterday?: string;
|
|
601
|
+
today?: string;
|
|
602
|
+
tomorrow?: string;
|
|
603
|
+
plus7Days?: string;
|
|
604
|
+
};
|
|
605
|
+
showTimezoneSelector?: boolean;
|
|
606
|
+
};
|
|
607
|
+
items?: CustomJSONSchema7 | CustomJSONSchema7[];
|
|
608
|
+
additionalItems?: CustomJSONSchema7;
|
|
609
|
+
properties?: {
|
|
610
|
+
[key: string]: CustomJSONSchema7;
|
|
611
|
+
};
|
|
612
|
+
additionalProperties?: boolean | CustomJSONSchema7;
|
|
613
|
+
definitions?: {
|
|
614
|
+
[key: string]: CustomJSONSchema7;
|
|
877
615
|
};
|
|
616
|
+
patternProperties?: {
|
|
617
|
+
[key: string]: CustomJSONSchema7;
|
|
618
|
+
};
|
|
619
|
+
dependencies?: {
|
|
620
|
+
[key: string]: CustomJSONSchema7 | string[];
|
|
621
|
+
};
|
|
622
|
+
allOf?: CustomJSONSchema7[];
|
|
623
|
+
anyOf?: CustomJSONSchema7[];
|
|
624
|
+
oneOf?: CustomJSONSchema7[];
|
|
625
|
+
not?: CustomJSONSchema7;
|
|
626
|
+
if?: CustomJSONSchema7;
|
|
627
|
+
then?: CustomJSONSchema7;
|
|
628
|
+
else?: CustomJSONSchema7;
|
|
629
|
+
contains?: CustomJSONSchema7;
|
|
878
630
|
}
|
|
879
631
|
declare const defaultRenderDisplay: (item: unknown) => ReactNode;
|
|
880
|
-
interface TagPickerProps {
|
|
881
|
-
column: string;
|
|
882
|
-
schema: CustomJSONSchema7;
|
|
883
|
-
prefix: string;
|
|
884
|
-
}
|
|
885
632
|
interface FilePickerMediaFile {
|
|
886
633
|
id: string;
|
|
887
634
|
name: string;
|
|
@@ -897,31 +644,67 @@ interface FilePickerProps {
|
|
|
897
644
|
enableUpload?: boolean;
|
|
898
645
|
onUploadFile?: (file: File) => Promise<string>;
|
|
899
646
|
}
|
|
647
|
+
interface CustomQueryFnResponse<TRecord = unknown> {
|
|
648
|
+
/**
|
|
649
|
+
* The data of the query
|
|
650
|
+
*/
|
|
651
|
+
data: {
|
|
652
|
+
data: TRecord[];
|
|
653
|
+
count: number;
|
|
654
|
+
};
|
|
655
|
+
/**
|
|
656
|
+
* The id map of the data
|
|
657
|
+
*/
|
|
658
|
+
idMap: Record<string, TRecord>;
|
|
659
|
+
}
|
|
660
|
+
interface CustomQueryFnParams {
|
|
661
|
+
searching: string;
|
|
662
|
+
limit: number;
|
|
663
|
+
offset: number;
|
|
664
|
+
where?: Array<{
|
|
665
|
+
id: string;
|
|
666
|
+
value: string | string[];
|
|
667
|
+
}>;
|
|
668
|
+
}
|
|
669
|
+
type CustomQueryFn<TRecord = unknown> = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse<TRecord>>;
|
|
900
670
|
|
|
901
671
|
interface FormRootProps<TData extends FieldValues> {
|
|
672
|
+
/**
|
|
673
|
+
* JSON Schema with support for errorMessages in properties.
|
|
674
|
+
* Each property can define errorMessages object with keys like:
|
|
675
|
+
* - required: Error message when field is required but missing
|
|
676
|
+
* - minLength, maxLength: Error messages for string length validation
|
|
677
|
+
* - minimum, maximum: Error messages for number range validation
|
|
678
|
+
* - format: Error message for format validation (email, date, etc.)
|
|
679
|
+
* - pattern: Error message for pattern validation
|
|
680
|
+
* - type: Error message for type validation
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* {
|
|
684
|
+
* type: 'object',
|
|
685
|
+
* properties: {
|
|
686
|
+
* username: {
|
|
687
|
+
* type: 'string',
|
|
688
|
+
* minLength: 3,
|
|
689
|
+
* errorMessages: {
|
|
690
|
+
* required: 'Username is required',
|
|
691
|
+
* minLength: 'Username must be at least 3 characters'
|
|
692
|
+
* }
|
|
693
|
+
* }
|
|
694
|
+
* }
|
|
695
|
+
* }
|
|
696
|
+
*/
|
|
902
697
|
schema: CustomJSONSchema7;
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
form: UseFormReturn;
|
|
907
|
-
/** Translate object for fallback text (components prefer label objects) */
|
|
908
|
-
translate: Translate;
|
|
698
|
+
idMap: Record<string, unknown>;
|
|
699
|
+
setIdMap: Dispatch<SetStateAction<Record<string, unknown>>>;
|
|
700
|
+
form: UseFormReturn<TData, any, TData>;
|
|
909
701
|
children: ReactNode;
|
|
910
|
-
order?: string[];
|
|
911
|
-
ignore?: string[];
|
|
912
|
-
include?: string[];
|
|
913
702
|
onSubmit?: SubmitHandler<TData>;
|
|
914
|
-
rowNumber?: number | string;
|
|
915
|
-
requestOptions?: AxiosRequestConfig;
|
|
916
|
-
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
917
|
-
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
918
|
-
customSuccessRenderer?: (resetHandler: () => void | Promise<void>) => ReactNode;
|
|
919
703
|
displayConfig?: {
|
|
920
704
|
showSubmitButton?: boolean;
|
|
921
705
|
showResetButton?: boolean;
|
|
922
706
|
showTitle?: boolean;
|
|
923
707
|
};
|
|
924
|
-
requireConfirmation?: boolean;
|
|
925
708
|
dateTimePickerLabels?: DateTimePickerLabels;
|
|
926
709
|
idPickerLabels?: IdPickerLabels;
|
|
927
710
|
enumPickerLabels?: EnumPickerLabels;
|
|
@@ -932,18 +715,12 @@ interface FormRootProps<TData extends FieldValues> {
|
|
|
932
715
|
}
|
|
933
716
|
interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
934
717
|
variant: string;
|
|
935
|
-
in_table: string;
|
|
936
|
-
column_ref: string;
|
|
937
718
|
gridColumn: string;
|
|
938
719
|
gridRow: string;
|
|
939
|
-
|
|
720
|
+
customQueryFn: any;
|
|
940
721
|
children: ReactNode;
|
|
941
722
|
}
|
|
942
|
-
declare const
|
|
943
|
-
table?: string | undefined;
|
|
944
|
-
column?: string | undefined;
|
|
945
|
-
} | undefined) => void;
|
|
946
|
-
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, customSuccessRenderer, displayConfig, requireConfirmation, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
723
|
+
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, onSubmit, displayConfig, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
947
724
|
|
|
948
725
|
interface DefaultFormProps<TData extends FieldValues> {
|
|
949
726
|
formConfig: Omit<FormRootProps<TData>, "children">;
|
|
@@ -976,6 +753,16 @@ type MediaLibraryBrowserPropsMultiple = MediaLibraryBrowserPropsBase & {
|
|
|
976
753
|
type MediaLibraryBrowserProps = MediaLibraryBrowserPropsSingle | MediaLibraryBrowserPropsMultiple;
|
|
977
754
|
declare const MediaLibraryBrowser: ({ onFetchFiles, filterImageOnly, labels, enabled, multiple, onFileSelect, selectedFile: controlledSelectedFile, onSelectedFileChange, }: MediaLibraryBrowserProps) => react_jsx_runtime.JSX.Element | null;
|
|
978
755
|
|
|
756
|
+
interface UseFormProps<T> {
|
|
757
|
+
preLoadedValues?: T | undefined;
|
|
758
|
+
schema: CustomJSONSchema7;
|
|
759
|
+
}
|
|
760
|
+
declare function useForm<T extends FieldValues = any>({ preLoadedValues, schema, }: UseFormProps<T>): {
|
|
761
|
+
form: react_hook_form.UseFormReturn<T, any, T>;
|
|
762
|
+
idMap: Record<string, unknown>;
|
|
763
|
+
setIdMap: React$1.Dispatch<React$1.SetStateAction<Record<string, unknown>>>;
|
|
764
|
+
};
|
|
765
|
+
|
|
979
766
|
interface CalendarDate {
|
|
980
767
|
date: Date;
|
|
981
768
|
selected: boolean;
|
|
@@ -1041,6 +828,9 @@ interface DatePickerProps {
|
|
|
1041
828
|
weekdayNamesShort: string[];
|
|
1042
829
|
backButtonLabel?: string;
|
|
1043
830
|
forwardButtonLabel?: string;
|
|
831
|
+
todayLabel?: string;
|
|
832
|
+
yesterdayLabel?: string;
|
|
833
|
+
tomorrowLabel?: string;
|
|
1044
834
|
};
|
|
1045
835
|
render?: (calendarData: CalendarRenderProps) => React__default.ReactNode;
|
|
1046
836
|
}
|
|
@@ -1049,7 +839,31 @@ interface DatePickerLabels {
|
|
|
1049
839
|
weekdayNamesShort: string[];
|
|
1050
840
|
backButtonLabel?: string;
|
|
1051
841
|
forwardButtonLabel?: string;
|
|
842
|
+
todayLabel?: string;
|
|
843
|
+
yesterdayLabel?: string;
|
|
844
|
+
tomorrowLabel?: string;
|
|
845
|
+
}
|
|
846
|
+
declare const DatePickerContext: React__default.Context<{
|
|
847
|
+
labels: DatePickerLabels;
|
|
848
|
+
}>;
|
|
849
|
+
interface DatePickerInputProps {
|
|
850
|
+
value?: string | Date;
|
|
851
|
+
onChange?: (date?: string) => void;
|
|
852
|
+
placeholder?: string;
|
|
853
|
+
dateFormat?: string;
|
|
854
|
+
displayFormat?: string;
|
|
855
|
+
labels?: DatePickerLabels;
|
|
856
|
+
timezone?: string;
|
|
857
|
+
minDate?: Date;
|
|
858
|
+
maxDate?: Date;
|
|
859
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
860
|
+
showOutsideDays?: boolean;
|
|
861
|
+
monthsToDisplay?: number;
|
|
862
|
+
insideDialog?: boolean;
|
|
863
|
+
readOnly?: boolean;
|
|
864
|
+
showHelperButtons?: boolean;
|
|
1052
865
|
}
|
|
866
|
+
declare function DatePickerInput({ value, onChange, placeholder, dateFormat, displayFormat, labels, timezone, minDate, maxDate, firstDayOfWeek, showOutsideDays, monthsToDisplay, insideDialog, readOnly, showHelperButtons, }: DatePickerInputProps): react_jsx_runtime.JSX.Element;
|
|
1053
867
|
|
|
1054
868
|
interface GetMultiDatesProps {
|
|
1055
869
|
selected: boolean;
|
|
@@ -1137,24 +951,6 @@ interface RangeDatePickerProps {
|
|
|
1137
951
|
render?: (calendarData: CalendarRenderProps) => React__default.ReactNode;
|
|
1138
952
|
}
|
|
1139
953
|
|
|
1140
|
-
interface DatePickerInputProps {
|
|
1141
|
-
value?: string | Date;
|
|
1142
|
-
onChange?: (date?: string) => void;
|
|
1143
|
-
placeholder?: string;
|
|
1144
|
-
dateFormat?: string;
|
|
1145
|
-
displayFormat?: string;
|
|
1146
|
-
labels?: DatePickerLabels;
|
|
1147
|
-
timezone?: string;
|
|
1148
|
-
minDate?: Date;
|
|
1149
|
-
maxDate?: Date;
|
|
1150
|
-
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1151
|
-
showOutsideDays?: boolean;
|
|
1152
|
-
monthsToDisplay?: number;
|
|
1153
|
-
insideDialog?: boolean;
|
|
1154
|
-
readOnly?: boolean;
|
|
1155
|
-
}
|
|
1156
|
-
declare function DatePickerInput({ value, onChange, placeholder, dateFormat, displayFormat, labels, timezone, minDate, maxDate, firstDayOfWeek, showOutsideDays, monthsToDisplay, insideDialog, readOnly, }: DatePickerInputProps): react_jsx_runtime.JSX.Element;
|
|
1157
|
-
|
|
1158
954
|
interface RecordDisplayProps {
|
|
1159
955
|
object: object | null;
|
|
1160
956
|
boxProps?: BoxProps;
|
|
@@ -1207,7 +1003,7 @@ declare const DefaultTableServer: ({ isLoading: isLoadingOverride, ...props }: D
|
|
|
1207
1003
|
interface DataDisplayProps {
|
|
1208
1004
|
variant?: 'horizontal' | 'stats' | '';
|
|
1209
1005
|
}
|
|
1210
|
-
declare const DataDisplay: ({
|
|
1006
|
+
declare const DataDisplay: ({}: DataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
1211
1007
|
|
|
1212
1008
|
interface CalendarEvent<TData = unknown> {
|
|
1213
1009
|
data: TData;
|
|
@@ -1415,7 +1211,17 @@ declare module '@tanstack/react-table' {
|
|
|
1415
1211
|
* Only applies when canResize={false}.
|
|
1416
1212
|
*/
|
|
1417
1213
|
responsivePriority?: number;
|
|
1214
|
+
/**
|
|
1215
|
+
* Grid column span for data display layout.
|
|
1216
|
+
* Used in DataDisplay component.
|
|
1217
|
+
*/
|
|
1218
|
+
gridColumn?: string | string[];
|
|
1219
|
+
/**
|
|
1220
|
+
* Grid row span for data display layout.
|
|
1221
|
+
* Used in DataDisplay component.
|
|
1222
|
+
*/
|
|
1223
|
+
gridRow?: string | object;
|
|
1418
1224
|
}
|
|
1419
1225
|
}
|
|
1420
1226
|
|
|
1421
|
-
export { CalendarDisplay, type CalendarDisplayProps, type CalendarEvent, type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, DatePickerInput, type DatePickerInputProps, type DatePickerLabels, type DatePickerProps, type DateTimePickerLabels, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DefaultTableServer, type DefaultTableServerProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, type EnumPickerLabels, ErrorAlert, type ErrorAlertProps, type
|
|
1227
|
+
export { CalendarDisplay, type CalendarDisplayProps, type CalendarEvent, type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7, type CustomJSONSchema7Definition, type CustomQueryFn, type CustomQueryFnParams, type CustomQueryFnResponse, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, DatePickerContext, DatePickerInput, type DatePickerInputProps, type DatePickerLabels, type DatePickerProps, type DateTimePickerLabels, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DefaultTableServer, type DefaultTableServerProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, type EnumPickerLabels, ErrorAlert, type ErrorAlertProps, type FilePickerLabels, type FilePickerMediaFile, type FilePickerProps, FilterDialog, FormBody, type FormButtonLabels, FormRoot, type FormRootProps, FormTitle, type GetDateColorProps, type GetMultiDatesProps, type GetRangeDatesProps, type GetStyleProps, type GetVariantProps, GlobalFilter, type IdPickerLabels, type LoadInitialValuesParams, type LoadInitialValuesResult, MediaLibraryBrowser, type MediaLibraryBrowserProps, PageSizeControl, type PageSizeControlProps, Pagination, type QueryParams, type RangeCalendarProps, type RangeDatePickerLabels, type RangeDatePickerProps, RecordDisplay, type RecordDisplayProps, ReloadButton, type ReloadButtonProps, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, type Result, RowCountText, SelectAllRowsToggle, type SelectAllRowsToggleProps, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableDataDisplay, type TableDataDisplayProps, TableFilter, TableFilterTags, type TableFilterTagsProps, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, type TableHeaderTexts, TableLoadingComponent, type TableLoadingComponentProps, type TableProps, type TableRendererProps, type TableRowSelectorProps, TableSelector, TableSorter, TableViewer, TextCell, type TextCellProps, type TimePickerLabels, type UseDataTableProps, type UseDataTableReturn, type UseDataTableServerProps, type UseDataTableServerReturn, type UseFormProps, type ValidationErrorType, ViewDialog, defaultRenderDisplay, getMultiDates, getRangeDates, useDataTable, useDataTableContext, useDataTableServer, useForm };
|