@expresscsv/react 0.1.25 → 0.1.26
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 +4 -4
- package/dist/index.d.cts +163 -58
- package/dist/index.d.mts +163 -58
- package/dist/index.d.ts +163 -58
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,39 @@ declare type BooleanControlType = 'toggle' | 'checkbox' | 'dropdown';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare type ColorModePref = 'light' | 'dark' | 'system';
|
|
11
11
|
|
|
12
|
+
export declare interface ColumnMatch<TTargetField extends string = string> {
|
|
13
|
+
sourceColumnIndex: number;
|
|
14
|
+
targetField: TTargetField;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare type ColumnMatchingFn<TTargetField extends string = string> = (data: ColumnMatchingParams) => Promise<ColumnMatchingResult<TTargetField>>;
|
|
18
|
+
|
|
19
|
+
export declare type ColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ManagedColumnMatchingOptions | CustomColumnMatchingOptions<TSchema>;
|
|
20
|
+
|
|
21
|
+
export declare interface ColumnMatchingParams {
|
|
22
|
+
sessionId: string;
|
|
23
|
+
sourceColumns: ColumnMatchingSourceColumn[];
|
|
24
|
+
targetFields: ColumnMatchingTargetField[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare interface ColumnMatchingResult<TTargetField extends string = string> {
|
|
28
|
+
matches: Array<ColumnMatch<TTargetField>>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare interface ColumnMatchingSourceColumn {
|
|
32
|
+
sourceColumnIndex: number;
|
|
33
|
+
name: string;
|
|
34
|
+
sampleValues: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export declare interface ColumnMatchingTargetField {
|
|
38
|
+
name: string;
|
|
39
|
+
label?: string;
|
|
40
|
+
type: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
aliases: string[];
|
|
43
|
+
}
|
|
44
|
+
|
|
12
45
|
declare const Countries: readonly [{
|
|
13
46
|
readonly name: "Afghanistan";
|
|
14
47
|
readonly alpha2: "AF";
|
|
@@ -1878,11 +1911,21 @@ declare const CurrencyCodes: readonly [{
|
|
|
1878
1911
|
readonly numeric: "932";
|
|
1879
1912
|
}];
|
|
1880
1913
|
|
|
1881
|
-
|
|
1914
|
+
declare type CustomColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
1882
1915
|
type: 'custom';
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1916
|
+
match: ColumnMatchingFn<SchemaFieldName<TSchema>>;
|
|
1917
|
+
};
|
|
1918
|
+
|
|
1919
|
+
declare type CustomPromptedEditsOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
1920
|
+
type: 'custom';
|
|
1921
|
+
edit: PromptedEditsFn<SchemaFieldName<TSchema>>;
|
|
1922
|
+
};
|
|
1923
|
+
|
|
1924
|
+
export declare type CustomSessionRecoveryOptions = {
|
|
1925
|
+
type: 'custom';
|
|
1926
|
+
get: (key: SessionRecoveryKey) => Promise<RecoveredSession | null>;
|
|
1927
|
+
set: (key: SessionRecoveryKey, value: RecoveredSession) => Promise<void>;
|
|
1928
|
+
remove: (key: SessionRecoveryKey) => Promise<void>;
|
|
1886
1929
|
};
|
|
1887
1930
|
|
|
1888
1931
|
declare interface DatetimeOptions {
|
|
@@ -1893,11 +1936,6 @@ export declare type DeepPartial<T> = {
|
|
|
1893
1936
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
1894
1937
|
};
|
|
1895
1938
|
|
|
1896
|
-
export declare interface DeliveryOptions<T> {
|
|
1897
|
-
/** Callback for processing delivered chunks */
|
|
1898
|
-
onData: (chunk: RecordsChunk<T>, next: () => void) => void | Promise<void>;
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
1939
|
/**
|
|
1902
1940
|
* Font source configuration for custom fonts
|
|
1903
1941
|
*/
|
|
@@ -2825,6 +2863,8 @@ declare interface ExpressCSVLocale {
|
|
|
2825
2863
|
showAll: string;
|
|
2826
2864
|
moveUp: string;
|
|
2827
2865
|
moveDown: string;
|
|
2866
|
+
/** When the selected row has zero columns (cannot continue) */
|
|
2867
|
+
rowNotSelectable: string;
|
|
2828
2868
|
};
|
|
2829
2869
|
matchColumns: {
|
|
2830
2870
|
loading: string;
|
|
@@ -2859,6 +2899,8 @@ declare interface ExpressCSVLocale {
|
|
|
2859
2899
|
previewTooltip: string;
|
|
2860
2900
|
/** Available: {rowCount}, {columnName} */
|
|
2861
2901
|
previewShowing: TemplateString<'rowCount' | 'columnName'>;
|
|
2902
|
+
/** Available: {columnNumber} — 1-based index when the sheet header cell is empty */
|
|
2903
|
+
unnamedSourceColumn: TemplateString<'columnNumber'>;
|
|
2862
2904
|
};
|
|
2863
2905
|
matchOptions: {
|
|
2864
2906
|
loading: string;
|
|
@@ -2951,27 +2993,27 @@ declare interface ExpressCSVLocale {
|
|
|
2951
2993
|
filteredColumns: string;
|
|
2952
2994
|
unfilteredColumns: string;
|
|
2953
2995
|
columnsLabel: string;
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2996
|
+
promptedEditsTooltip: string;
|
|
2997
|
+
promptedEditsTitle: string;
|
|
2998
|
+
promptedEditsClose: string;
|
|
2999
|
+
promptedEditsCloseDiscardTooltip: string;
|
|
3000
|
+
promptedEditsCloseTooltip: string;
|
|
3001
|
+
promptedEditsError: string;
|
|
3002
|
+
promptedEditsPlaceholder: string;
|
|
3003
|
+
promptedEditsGenerating: string;
|
|
3004
|
+
promptedEditsApplying: string;
|
|
3005
|
+
promptedEditsDiscard: string;
|
|
3006
|
+
promptedEditsApply: string;
|
|
3007
|
+
promptedEditsUnappliedTitle: string;
|
|
3008
|
+
promptedEditsUnappliedDescription: string;
|
|
3009
|
+
promptedEditsKeepEditing: string;
|
|
3010
|
+
promptedEditsDiscardClose: string;
|
|
3011
|
+
promptedEditsAbortTitle: string;
|
|
3012
|
+
promptedEditsAbortDescription: string;
|
|
3013
|
+
promptedEditsAbortClose: string;
|
|
3014
|
+
promptedEditsSubmit: string;
|
|
2973
3015
|
};
|
|
2974
|
-
|
|
3016
|
+
emptyColumn: {
|
|
2975
3017
|
/** Available: {number} */
|
|
2976
3018
|
defaultName: TemplateString<'number'>;
|
|
2977
3019
|
remove: string;
|
|
@@ -3510,10 +3552,22 @@ export declare type Infer<T extends ExType<unknown, ExBaseDef, unknown>> = T ext
|
|
|
3510
3552
|
|
|
3511
3553
|
declare type IPAddressVersion = 'v4' | 'v6' | 'all';
|
|
3512
3554
|
|
|
3513
|
-
export declare type
|
|
3555
|
+
export declare type LocalSessionRecoveryOptions = {
|
|
3514
3556
|
type: 'local';
|
|
3515
3557
|
};
|
|
3516
3558
|
|
|
3559
|
+
declare type ManagedColumnMatchingOptions = {
|
|
3560
|
+
type: 'managed';
|
|
3561
|
+
exact?: boolean;
|
|
3562
|
+
caseInsensitive?: boolean;
|
|
3563
|
+
normalized?: boolean;
|
|
3564
|
+
inference?: boolean;
|
|
3565
|
+
};
|
|
3566
|
+
|
|
3567
|
+
declare type ManagedPromptedEditsOptions = {
|
|
3568
|
+
type: 'managed';
|
|
3569
|
+
};
|
|
3570
|
+
|
|
3517
3571
|
declare interface MultiselectOptions {
|
|
3518
3572
|
enforceCaseSensitiveMatch?: boolean;
|
|
3519
3573
|
message?: string;
|
|
@@ -3523,7 +3577,9 @@ declare interface MultiselectOptions {
|
|
|
3523
3577
|
* Options for the open() method
|
|
3524
3578
|
* Requires an onData callback for delivery
|
|
3525
3579
|
*/
|
|
3526
|
-
export declare type OpenOptions<T> =
|
|
3580
|
+
export declare type OpenOptions<T> = {
|
|
3581
|
+
/** Callback for processing delivered chunks */
|
|
3582
|
+
onData: (chunk: RecordsChunk<T>, next: () => void) => void | Promise<void>;
|
|
3527
3583
|
/** Number of records per chunk (default: 1000) */
|
|
3528
3584
|
chunkSize?: number;
|
|
3529
3585
|
/** Called when all chunks have been processed */
|
|
@@ -3643,6 +3699,51 @@ declare abstract class PrimitiveExType<Output, Def extends PrimitiveExBaseDef, I
|
|
|
3643
3699
|
protected _replaceOrAddCheck(check: ValidatorCheck, existingIndex: number): void;
|
|
3644
3700
|
}
|
|
3645
3701
|
|
|
3702
|
+
export declare type PromptedEditsChange<TField extends string = string> = {
|
|
3703
|
+
type: 'add';
|
|
3704
|
+
values: Partial<Record<TField, unknown>>;
|
|
3705
|
+
} | {
|
|
3706
|
+
type: 'update';
|
|
3707
|
+
rowId: string;
|
|
3708
|
+
values: Partial<Record<TField, unknown>>;
|
|
3709
|
+
} | {
|
|
3710
|
+
type: 'remove';
|
|
3711
|
+
rowId: string;
|
|
3712
|
+
};
|
|
3713
|
+
|
|
3714
|
+
export declare interface PromptedEditsField<TField extends string = string> {
|
|
3715
|
+
key: TField;
|
|
3716
|
+
name: string;
|
|
3717
|
+
type: string;
|
|
3718
|
+
sampleValues: unknown[];
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
export declare type PromptedEditsFn<TField extends string = string> = (data: PromptedEditsParams<TField>) => Promise<PromptedEditsResult<TField>>;
|
|
3722
|
+
|
|
3723
|
+
export declare type PromptedEditsOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ManagedPromptedEditsOptions | CustomPromptedEditsOptions<TSchema>;
|
|
3724
|
+
|
|
3725
|
+
export declare interface PromptedEditsParams<TField extends string = string> {
|
|
3726
|
+
sessionId: string;
|
|
3727
|
+
prompt: string;
|
|
3728
|
+
fields: Array<PromptedEditsField<TField>>;
|
|
3729
|
+
rows: Array<PromptedEditsRow<TField>>;
|
|
3730
|
+
totalRows: number;
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
export declare type PromptedEditsResult<TField extends string = string> = {
|
|
3734
|
+
type: 'success';
|
|
3735
|
+
changes: Array<PromptedEditsChange<TField>>;
|
|
3736
|
+
} | {
|
|
3737
|
+
type: 'no-op';
|
|
3738
|
+
message: string;
|
|
3739
|
+
};
|
|
3740
|
+
|
|
3741
|
+
export declare interface PromptedEditsRow<TField extends string = string> {
|
|
3742
|
+
rowId: string;
|
|
3743
|
+
rowIndex: number;
|
|
3744
|
+
values: Partial<Record<TField, unknown>>;
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3646
3747
|
declare type Protocol = 'http' | 'https' | 'ftp' | 'sftp' | 'file' | 'mailto' | 'tel';
|
|
3647
3748
|
|
|
3648
3749
|
/**
|
|
@@ -3663,6 +3764,10 @@ export declare interface RecordsChunk<T> {
|
|
|
3663
3764
|
chunkIdempotencyKey: string;
|
|
3664
3765
|
}
|
|
3665
3766
|
|
|
3767
|
+
export declare type RecoveredSession = PersistedImportSessionData;
|
|
3768
|
+
|
|
3769
|
+
export declare type RecoveredSessionData = PersistedImportSessionPayload;
|
|
3770
|
+
|
|
3666
3771
|
declare type RefineBatchResultItem = {
|
|
3667
3772
|
valid: boolean;
|
|
3668
3773
|
message?: string;
|
|
@@ -3692,6 +3797,29 @@ declare type RefineResultItem = {
|
|
|
3692
3797
|
};
|
|
3693
3798
|
};
|
|
3694
3799
|
|
|
3800
|
+
declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, unknown>> = Extract<keyof Infer<TSchema>, string>;
|
|
3801
|
+
|
|
3802
|
+
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3803
|
+
schema: TSchema;
|
|
3804
|
+
getSessionToken: () => Promise<string>;
|
|
3805
|
+
importIdentifier: string;
|
|
3806
|
+
title?: string;
|
|
3807
|
+
debug?: boolean;
|
|
3808
|
+
preload?: boolean;
|
|
3809
|
+
theme?: ECSVTheme;
|
|
3810
|
+
colorMode?: ColorModePref;
|
|
3811
|
+
customCSS?: string;
|
|
3812
|
+
fonts?: Record<string, ECSVFontSource>;
|
|
3813
|
+
stepDisplay?: 'progressBar' | 'segmented' | 'numbered';
|
|
3814
|
+
previewSchemaBeforeUpload?: boolean;
|
|
3815
|
+
columnMatching?: ColumnMatchingOptions<TSchema>;
|
|
3816
|
+
promptedEdits?: PromptedEditsOptions<TSchema>;
|
|
3817
|
+
templateDownload?: TemplateDownloadOptions<TSchema>;
|
|
3818
|
+
sessionRecovery?: SessionRecoveryOptions;
|
|
3819
|
+
locale?: DeepPartial<ExpressCSVLocaleInput>;
|
|
3820
|
+
disableStatusStep?: boolean;
|
|
3821
|
+
}
|
|
3822
|
+
|
|
3695
3823
|
declare interface SelectOption<TValue extends string | number = string | number> {
|
|
3696
3824
|
label: string;
|
|
3697
3825
|
value: TValue;
|
|
@@ -3704,13 +3832,9 @@ declare interface SelectOptions {
|
|
|
3704
3832
|
message?: string;
|
|
3705
3833
|
}
|
|
3706
3834
|
|
|
3707
|
-
export declare type
|
|
3708
|
-
|
|
3709
|
-
export declare type StorageOptions = LocalStorageOptions | CustomStorageOptions;
|
|
3710
|
-
|
|
3711
|
-
export declare type StoredSession = PersistedImportSessionData;
|
|
3835
|
+
export declare type SessionRecoveryKey = PersistedImportSessionKey;
|
|
3712
3836
|
|
|
3713
|
-
export declare type
|
|
3837
|
+
export declare type SessionRecoveryOptions = LocalSessionRecoveryOptions | CustomSessionRecoveryOptions;
|
|
3714
3838
|
|
|
3715
3839
|
declare type StripBrand<T> = {
|
|
3716
3840
|
[K in keyof T]: T[K] extends TemplateString<string> ? string : T[K] extends object ? StripBrand<T[K]> : T[K];
|
|
@@ -3800,33 +3924,14 @@ declare interface URLOptions {
|
|
|
3800
3924
|
message?: string;
|
|
3801
3925
|
}
|
|
3802
3926
|
|
|
3803
|
-
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, getSessionToken, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload,
|
|
3927
|
+
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, getSessionToken, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, columnMatching, promptedEdits, templateDownload, sessionRecovery, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
|
|
3804
3928
|
open: (options: OpenOptions<Infer<TSchema>>) => void;
|
|
3805
3929
|
importerState: ImporterState;
|
|
3806
3930
|
isInitialising: boolean;
|
|
3807
3931
|
isOpen: boolean;
|
|
3808
3932
|
};
|
|
3809
3933
|
|
|
3810
|
-
export declare
|
|
3811
|
-
schema: TSchema;
|
|
3812
|
-
title?: string;
|
|
3813
|
-
importIdentifier: string;
|
|
3814
|
-
getSessionToken: () => Promise<string>;
|
|
3815
|
-
debug?: boolean;
|
|
3816
|
-
preload?: boolean;
|
|
3817
|
-
theme?: ECSVTheme;
|
|
3818
|
-
colorMode?: ColorModePref;
|
|
3819
|
-
customCSS?: string;
|
|
3820
|
-
fonts?: Record<string, ECSVFontSource>;
|
|
3821
|
-
stepDisplay?: 'progressBar' | 'segmented' | 'numbered';
|
|
3822
|
-
previewSchemaBeforeUpload?: boolean;
|
|
3823
|
-
aiColumnMatching?: boolean;
|
|
3824
|
-
aiTransform?: boolean;
|
|
3825
|
-
templateDownload?: TemplateDownloadOptions<TSchema>;
|
|
3826
|
-
storage?: StorageOptions;
|
|
3827
|
-
locale?: DeepPartial<ExpressCSVLocaleInput>;
|
|
3828
|
-
disableStatusStep?: boolean;
|
|
3829
|
-
}
|
|
3934
|
+
export declare type UseExpressCSVOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> = SDKOptions<TSchema>;
|
|
3830
3935
|
|
|
3831
3936
|
declare type UUIDVersion = 'v1' | 'v4' | 'v5' | 'all';
|
|
3832
3937
|
|