qucoon-components 0.0.6 → 0.0.7
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/index.cjs.js +252 -241
- package/dist/index.es.js +90580 -80332
- package/dist/style.css +1 -1
- package/dist/types/components/custom/bulkUploadLayout.d.ts +26 -0
- package/dist/types/components/custom/index.d.ts +2 -0
- package/dist/types/components/ui/datepicker/BaseDatePicker.d.ts +6 -4
- package/dist/types/components/ui/datepicker/BaseDateRangePicker.d.ts +8 -8
- package/dist/types/components/ui/modal/BaseModal.d.ts +2 -1
- package/dist/types/components/ui/modal/GlobalModal.d.ts +1 -1
- package/dist/types/components/ui/modal/index.d.ts +1 -0
- package/dist/types/components/ui/modal/v2/BaseModal.d.ts +26 -0
- package/dist/types/components/ui/modal/v2/ModalRenderer.d.ts +6 -0
- package/dist/types/components/ui/modal/v2/index.d.ts +7 -0
- package/dist/types/utilities/context/modalContext.d.ts +11 -9
- package/dist/types/utilities/enhancedTimeUtil.d.ts +105 -0
- package/dist/types/utilities/factory/modalFactory.d.ts +55 -7
- package/dist/types/utilities/helpers/bulkUploadFileGenerator.d.ts +22 -0
- package/dist/types/utilities/helpers/bulkUploadFileParser.d.ts +50 -0
- package/dist/types/utilities/helpers/index.d.ts +2 -0
- package/dist/types/utilities/hooks/index.d.ts +2 -0
- package/dist/types/utilities/hooks/useBulkUpload.d.ts +39 -0
- package/dist/types/utilities/hooks/useModal.d.ts +11 -11
- package/dist/types/utilities/hooks/useModalRegistration.d.ts +2 -7
- package/dist/types/utilities/hooks/useModalRegistrations.d.ts +1 -2
- package/dist/types/utilities/hooks/useNotification.d.ts +7 -7
- package/dist/types/utilities/index.d.ts +1 -0
- package/dist/types/utilities/modalUtil.d.ts +14 -10
- package/dist/types/utilities/timeUtil.d.ts +2 -0
- package/dist/types/utilities/types/modalTypes.d.ts +32 -15
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BulkUploadConfig, BulkUploadError } from '../../utilities/helpers/bulkUploadFileParser';
|
|
2
|
+
export interface BulkUploadLayoutProps<T> {
|
|
3
|
+
config: BulkUploadConfig<T>;
|
|
4
|
+
onSuccess: (data: T[], additionalData?: Record<string, any>) => Promise<void>;
|
|
5
|
+
onError?: (errors: BulkUploadError[]) => void;
|
|
6
|
+
title?: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
additionalFields?: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
label: string;
|
|
11
|
+
type?: 'text' | 'number' | 'email' | 'tel';
|
|
12
|
+
required?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
validator?: (value: string) => string | null;
|
|
15
|
+
}>;
|
|
16
|
+
showPreview?: boolean;
|
|
17
|
+
maxPreviewRows?: number;
|
|
18
|
+
allowAutoSubmit?: boolean;
|
|
19
|
+
submitButtonText?: string;
|
|
20
|
+
cancelButtonText?: string;
|
|
21
|
+
onCancel?: () => void;
|
|
22
|
+
className?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare const BulkUploadLayout: <T>({ config, onSuccess, onError, title, subtitle, additionalFields, showPreview, maxPreviewRows, allowAutoSubmit, submitButtonText, cancelButtonText, onCancel, className, disabled, }: BulkUploadLayoutProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export default BulkUploadLayout;
|
|
@@ -21,5 +21,7 @@ export { default as TextDecorator } from './TextDecorator';
|
|
|
21
21
|
export * from './TextDecorator';
|
|
22
22
|
export { default as TodoList } from './TodoList';
|
|
23
23
|
export * from './TodoList';
|
|
24
|
+
export { default as bulkUploadLayout } from './bulkUploadLayout';
|
|
25
|
+
export * from './bulkUploadLayout';
|
|
24
26
|
export { default as reduxProvider } from './reduxProvider';
|
|
25
27
|
export * from './reduxProvider';
|
|
@@ -2,9 +2,10 @@ import { default as React, CSSProperties } from 'react';
|
|
|
2
2
|
import { BaseCalendarProps } from '../calendar/BaseCalendar';
|
|
3
3
|
import { FormikProps, FormikValues } from 'formik';
|
|
4
4
|
import { EnhancedLabelProps } from '../label/EnhancedLabel';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { DateFormatConfig, DateFormatPresets, DateFormatType } from '../../../utilities/enhancedTimeUtil';
|
|
6
|
+
export type BaseDatePickerProps<T extends FormikValues = any> = {
|
|
7
|
+
selected?: unknown;
|
|
8
|
+
onSelect?: (date: unknown) => void;
|
|
8
9
|
placeholder?: string;
|
|
9
10
|
className?: string;
|
|
10
11
|
label?: string;
|
|
@@ -18,7 +19,8 @@ export type BaseDatePickerProps<T extends FormikValues> = {
|
|
|
18
19
|
isLoading?: boolean;
|
|
19
20
|
};
|
|
20
21
|
formik?: FormikProps<T>;
|
|
22
|
+
dateFormat?: DateFormatConfig<any, any> | keyof typeof DateFormatPresets | DateFormatType;
|
|
21
23
|
useTimestamp?: boolean;
|
|
22
24
|
} & Omit<BaseCalendarProps, "selected" | "onSelect" | "mode">;
|
|
23
|
-
declare const BaseDatePicker: <T extends FormikValues>({ selected, onSelect, placeholder, className, showPresetRanges, label, labelStyle, labelProps, helperText, helperTextProps, formik, name, error, useTimestamp, ...baseCalendarProps }: BaseDatePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare const BaseDatePicker: <T extends FormikValues = any>({ selected, onSelect, placeholder, className, showPresetRanges, label, labelStyle, labelProps, helperText, helperTextProps, formik, name, error, dateFormat, useTimestamp, ...baseCalendarProps }: BaseDatePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
24
26
|
export default BaseDatePicker;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { default as React, CSSProperties } from 'react';
|
|
2
|
-
import { BaseCalendarProps } from '../calendar/BaseCalendar';
|
|
3
|
-
import { DateRange } from 'react-day-picker';
|
|
4
1
|
import { FormikProps, FormikValues } from 'formik';
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { BaseCalendarProps, EnhancedLabelProps } from '../..';
|
|
4
|
+
import { DateFormatConfig, DateFormatPresets, DateFormatType } from '../../../utilities/enhancedTimeUtil';
|
|
5
|
+
export type BaseDateRangePickerProps<T extends FormikValues = any> = {
|
|
7
6
|
type?: "single" | "double";
|
|
8
|
-
selected?:
|
|
9
|
-
onSelect?: (date:
|
|
7
|
+
selected?: unknown;
|
|
8
|
+
onSelect?: (date: unknown) => void;
|
|
10
9
|
placeholder?: string;
|
|
11
10
|
className?: string;
|
|
12
11
|
label?: string;
|
|
@@ -20,9 +19,10 @@ export type BaseDateRangePickerProps<T extends FormikValues> = {
|
|
|
20
19
|
isLoading?: boolean;
|
|
21
20
|
};
|
|
22
21
|
formik?: FormikProps<T>;
|
|
22
|
+
dateFormat?: DateFormatConfig<any, any> | keyof typeof DateFormatPresets | DateFormatType;
|
|
23
23
|
startDateField?: string;
|
|
24
24
|
endDateField?: string;
|
|
25
25
|
useTimestamps?: boolean;
|
|
26
26
|
} & Omit<BaseCalendarProps, "selected" | "onSelect" | "mode">;
|
|
27
|
-
declare const BaseDateRangePicker: <T extends FormikValues>({ type, selected, onSelect, placeholder, className, showPresetRanges, label, labelStyle, labelProps, helperText, helperTextProps, formik, name, error, startDateField, endDateField, useTimestamps, ...baseCalendarProps }: BaseDateRangePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
declare const BaseDateRangePicker: <T extends FormikValues = any>({ type, selected, onSelect, placeholder, className, showPresetRanges, label, labelStyle, labelProps, helperText, helperTextProps, formik, name, error, startDateField, endDateField, dateFormat, useTimestamps, ...baseCalendarProps }: BaseDateRangePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export default BaseDateRangePicker;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { ModalPosition } from '../../../utilities/types/modalTypes';
|
|
3
|
-
|
|
3
|
+
interface BaseModalProps {
|
|
4
4
|
ref: React.RefObject<HTMLDivElement>;
|
|
5
5
|
id: string;
|
|
6
6
|
zIndex?: number;
|
|
@@ -17,3 +17,4 @@ export interface BaseModalProps {
|
|
|
17
17
|
containerClassName?: string;
|
|
18
18
|
}
|
|
19
19
|
export default function BaseModal({ ref, id, zIndex, backdrop, closeOnBackdropClick, enableBackDrop, position, offset, animation, children, onClose, onFocus, containerClassName, }: BaseModalProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const GlobalModal: () =>
|
|
1
|
+
declare const GlobalModal: () => null;
|
|
2
2
|
export default GlobalModal;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ModalPosition } from '../../../../utilities/types/modalTypes';
|
|
3
|
+
export interface BaseModalProps {
|
|
4
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
5
|
+
id: string;
|
|
6
|
+
zIndex?: number;
|
|
7
|
+
backdrop?: 'blur' | 'solid' | 'transparent';
|
|
8
|
+
closeOnBackdropClick?: boolean;
|
|
9
|
+
enableBackDrop?: boolean;
|
|
10
|
+
closeOnEscape?: boolean;
|
|
11
|
+
position?: ModalPosition;
|
|
12
|
+
offset?: number;
|
|
13
|
+
animation?: 'fade' | 'slide' | 'scale' | 'none';
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
onFocus?: () => void;
|
|
17
|
+
containerClassName?: string;
|
|
18
|
+
containerStyle?: React.CSSProperties;
|
|
19
|
+
backdropClassName?: string;
|
|
20
|
+
backdropStyle?: React.CSSProperties;
|
|
21
|
+
theme?: 'default' | 'minimal' | 'glass' | 'elevated';
|
|
22
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'auto';
|
|
23
|
+
cssProps?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
export declare function BaseModal({ ref, id, zIndex, backdrop, closeOnBackdropClick, enableBackDrop, position, offset, animation, theme, size, children, onClose, onFocus, containerClassName, containerStyle, backdropClassName, backdropStyle, cssProps, }: BaseModalProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export default BaseModal;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ModalBaseConfig
|
|
3
|
-
export interface ModalInstance
|
|
2
|
+
import { ModalBaseConfig } from '../types/modalTypes';
|
|
3
|
+
export interface ModalInstance {
|
|
4
4
|
id: string;
|
|
5
|
-
type:
|
|
6
|
-
data:
|
|
7
|
-
resolve: (result:
|
|
5
|
+
type: string;
|
|
6
|
+
data: any;
|
|
7
|
+
resolve: (result: any) => void;
|
|
8
8
|
reject: (reason?: any) => void;
|
|
9
9
|
options?: ModalBaseConfig;
|
|
10
10
|
}
|
|
11
|
-
export interface ModalOpenResult
|
|
11
|
+
export interface ModalOpenResult {
|
|
12
12
|
id: string;
|
|
13
|
-
promise: Promise<
|
|
14
|
-
resolve: (result:
|
|
13
|
+
promise: Promise<any>;
|
|
14
|
+
resolve: (result: any) => void;
|
|
15
15
|
reject: (reason?: any) => void;
|
|
16
16
|
}
|
|
17
17
|
export interface ModalContextValue {
|
|
18
18
|
modals: ModalInstance[];
|
|
19
|
-
openModal:
|
|
19
|
+
openModal: (type: string, // Changed from keyof ModalRegistry
|
|
20
|
+
data: any, // Changed from ModalRegistry[T]["data"]
|
|
21
|
+
options?: ModalBaseConfig) => ModalOpenResult;
|
|
20
22
|
closeModal: (id: string) => void;
|
|
21
23
|
getModalById: (id: string) => ModalInstance | undefined;
|
|
22
24
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { TimeUtil } from './timeUtil';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
3
|
+
export type DateFormatType = 'iso' | 'timestamp-ms' | 'timestamp-s' | 'date-object' | 'date-only' | 'datetime-local' | 'formatted' | 'luxon-iso' | 'custom';
|
|
4
|
+
export type SupportedLocale = 'en-US' | 'en-GB' | 'en-CA' | 'en-AU' | 'fr-FR' | 'fr-CA' | 'de-DE' | 'de-AT' | 'de-CH' | 'es-ES' | 'es-MX' | 'es-AR' | 'it-IT' | 'pt-BR' | 'pt-PT' | 'ja-JP' | 'ko-KR' | 'zh-CN' | 'zh-TW' | 'ru-RU' | 'ar-SA' | 'hi-IN' | string;
|
|
5
|
+
export type SupportedTimeZone = 'UTC' | 'GMT' | 'America/New_York' | 'America/Chicago' | 'America/Denver' | 'America/Los_Angeles' | 'America/Toronto' | 'America/Mexico_City' | 'America/Sao_Paulo' | 'Europe/London' | 'Europe/Paris' | 'Europe/Berlin' | 'Europe/Rome' | 'Asia/Tokyo' | 'Asia/Seoul' | 'Asia/Shanghai' | 'Asia/Hong_Kong' | 'Australia/Sydney' | 'Australia/Melbourne' | 'Pacific/Auckland' | string;
|
|
6
|
+
export interface DateFormatOptions {
|
|
7
|
+
locale?: SupportedLocale;
|
|
8
|
+
timeZone?: SupportedTimeZone;
|
|
9
|
+
customFormat?: string;
|
|
10
|
+
includeTime?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type DateFormatTypeMap = {
|
|
13
|
+
'iso': string;
|
|
14
|
+
'timestamp-ms': number;
|
|
15
|
+
'timestamp-s': number;
|
|
16
|
+
'date-object': Date;
|
|
17
|
+
'date-only': string;
|
|
18
|
+
'datetime-local': string;
|
|
19
|
+
'formatted': string;
|
|
20
|
+
'luxon-iso': string;
|
|
21
|
+
'custom': string;
|
|
22
|
+
};
|
|
23
|
+
export interface DateFormatConfig<TInput extends DateFormatType = 'date-object', TOutput extends DateFormatType = 'date-object'> {
|
|
24
|
+
input: TInput;
|
|
25
|
+
output: TOutput;
|
|
26
|
+
display?: DateFormatType;
|
|
27
|
+
options?: DateFormatOptions;
|
|
28
|
+
}
|
|
29
|
+
export declare const DateFormatPresets: {
|
|
30
|
+
readonly timestamp: {
|
|
31
|
+
readonly input: "timestamp-ms";
|
|
32
|
+
readonly output: "timestamp-ms";
|
|
33
|
+
};
|
|
34
|
+
readonly apiStandard: {
|
|
35
|
+
readonly input: "iso";
|
|
36
|
+
readonly output: "iso";
|
|
37
|
+
};
|
|
38
|
+
readonly timeUtilCompatible: {
|
|
39
|
+
readonly input: "luxon-iso";
|
|
40
|
+
readonly output: "luxon-iso";
|
|
41
|
+
};
|
|
42
|
+
readonly htmlDate: {
|
|
43
|
+
readonly input: "date-only";
|
|
44
|
+
readonly output: "date-only";
|
|
45
|
+
};
|
|
46
|
+
readonly international: (locale?: SupportedLocale, timeZone?: SupportedTimeZone) => {
|
|
47
|
+
input: "iso";
|
|
48
|
+
output: "iso";
|
|
49
|
+
options: {
|
|
50
|
+
locale: string;
|
|
51
|
+
timeZone: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type DateRangeFormatTypeMap = {
|
|
56
|
+
'iso': {
|
|
57
|
+
from?: string;
|
|
58
|
+
to?: string;
|
|
59
|
+
};
|
|
60
|
+
'timestamp-ms': {
|
|
61
|
+
from?: number;
|
|
62
|
+
to?: number;
|
|
63
|
+
};
|
|
64
|
+
'timestamp-s': {
|
|
65
|
+
from?: number;
|
|
66
|
+
to?: number;
|
|
67
|
+
};
|
|
68
|
+
'date-object': DateRange;
|
|
69
|
+
'date-only': {
|
|
70
|
+
from?: string;
|
|
71
|
+
to?: string;
|
|
72
|
+
};
|
|
73
|
+
'datetime-local': {
|
|
74
|
+
from?: string;
|
|
75
|
+
to?: string;
|
|
76
|
+
};
|
|
77
|
+
'formatted': {
|
|
78
|
+
from?: string;
|
|
79
|
+
to?: string;
|
|
80
|
+
};
|
|
81
|
+
'luxon-iso': {
|
|
82
|
+
from?: string;
|
|
83
|
+
to?: string;
|
|
84
|
+
};
|
|
85
|
+
'custom': {
|
|
86
|
+
from?: string;
|
|
87
|
+
to?: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export declare class EnhancedTimeUtil extends TimeUtil {
|
|
91
|
+
static parseInput(value: unknown, inputFormat: DateFormatType): Date | undefined;
|
|
92
|
+
static formatOutput(date: Date | undefined, outputFormat: DateFormatType, options?: DateFormatOptions): unknown;
|
|
93
|
+
static formatForDisplay(date: Date | undefined, displayFormat?: DateFormatType, options?: DateFormatOptions): string;
|
|
94
|
+
static parseRangeInput(value: unknown, inputFormat: DateFormatType): DateRange | undefined;
|
|
95
|
+
static formatRangeOutput(range: DateRange | undefined, outputFormat: DateFormatType, options?: DateFormatOptions): unknown;
|
|
96
|
+
static createFormatter<TInput extends DateFormatType = 'date-object', TOutput extends DateFormatType = 'date-object'>(config: DateFormatConfig<TInput, TOutput>): {
|
|
97
|
+
parseInput: (value: unknown) => Date | undefined;
|
|
98
|
+
formatOutput: (date: Date | undefined) => unknown;
|
|
99
|
+
formatForDisplay: (date: Date | undefined) => string;
|
|
100
|
+
parseRangeInput: (value: unknown) => DateRange | undefined;
|
|
101
|
+
formatRangeOutput: (range: DateRange | undefined) => unknown;
|
|
102
|
+
config: DateFormatConfig<TInput, TOutput>;
|
|
103
|
+
};
|
|
104
|
+
private static formatForLocale;
|
|
105
|
+
}
|
|
@@ -1,7 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ModalBaseConfig } from '../types/modalTypes';
|
|
3
|
+
interface ModalRegistration<TData = any, TResult = any> {
|
|
4
|
+
key: string;
|
|
5
|
+
component: React.ComponentType<TData>;
|
|
6
|
+
defaultConfig: ModalBaseConfig;
|
|
7
|
+
containerClassName?: string;
|
|
8
|
+
containerStyle?: React.CSSProperties;
|
|
9
|
+
theme?: 'default' | 'minimal' | 'glass' | 'elevated';
|
|
10
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
cssProps?: Record<string, string>;
|
|
12
|
+
__dataType?: TData;
|
|
13
|
+
__resultType?: TResult;
|
|
14
|
+
}
|
|
15
|
+
declare class EnhancedModalFactory {
|
|
16
|
+
private registry;
|
|
17
|
+
private typeRegistry;
|
|
18
|
+
register<TData, TResult = void>(config: {
|
|
19
|
+
key: string;
|
|
20
|
+
component: React.ComponentType<TData>;
|
|
21
|
+
defaultConfig?: ModalBaseConfig;
|
|
22
|
+
containerClassName?: string;
|
|
23
|
+
containerStyle?: React.CSSProperties;
|
|
24
|
+
theme?: 'default' | 'minimal' | 'glass' | 'elevated';
|
|
25
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
26
|
+
cssProps?: Record<string, string>;
|
|
27
|
+
}): void;
|
|
28
|
+
get(key: string): ModalRegistration | undefined;
|
|
29
|
+
getComponent(key: string): React.ComponentType<any> | null;
|
|
30
|
+
getDefaultConfig(key: string): ModalBaseConfig;
|
|
31
|
+
getModalConfig(key: string): Omit<ModalRegistration, 'component' | '__dataType' | '__resultType'>;
|
|
32
|
+
getAllRegistered(): string[];
|
|
33
|
+
getTypeInfo(key: string): {
|
|
34
|
+
dataType: any;
|
|
35
|
+
resultType: any;
|
|
36
|
+
} | undefined;
|
|
37
|
+
validateRegistrations(): void;
|
|
38
|
+
clear(): void;
|
|
39
|
+
unregister(key: string): boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare const modalFactory: EnhancedModalFactory;
|
|
42
|
+
export declare function registerModal<TData, TResult = void>(config: {
|
|
43
|
+
key: string;
|
|
44
|
+
component: React.ComponentType<TData>;
|
|
45
|
+
defaultConfig?: ModalBaseConfig;
|
|
46
|
+
containerClassName?: string;
|
|
47
|
+
containerStyle?: React.CSSProperties;
|
|
48
|
+
theme?: 'default' | 'minimal' | 'glass' | 'elevated';
|
|
49
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
50
|
+
cssProps?: Record<string, string>;
|
|
51
|
+
}): void;
|
|
52
|
+
export declare function getModalConfig(key: string): ModalBaseConfig;
|
|
53
|
+
export declare function getModalComponent(key: string): React.ComponentType<any> | null;
|
|
54
|
+
export { modalFactory as default };
|
|
55
|
+
export declare const getModalDefaultConfig: typeof getModalConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BulkUploadConfig } from './bulkUploadFileParser';
|
|
2
|
+
export declare class BulkUploadTemplateGenerator {
|
|
3
|
+
static generateExcelTemplate<T>(config: BulkUploadConfig<T>): Blob;
|
|
4
|
+
static generateCSVTemplate<T>(config: BulkUploadConfig<T>): Blob;
|
|
5
|
+
}
|
|
6
|
+
export declare const ValidationUtils: {
|
|
7
|
+
email: (value: string) => string | null;
|
|
8
|
+
required: (value: string) => string | null;
|
|
9
|
+
numeric: (value: string) => string | null;
|
|
10
|
+
minLength: (min: number) => (value: string) => string | null;
|
|
11
|
+
maxLength: (max: number) => (value: string) => string | null;
|
|
12
|
+
pattern: (regex: RegExp, message: string) => (value: string) => string | null;
|
|
13
|
+
};
|
|
14
|
+
export declare const TransformUtils: {
|
|
15
|
+
toNumber: (value: string) => number;
|
|
16
|
+
toDate: (value: string) => Date;
|
|
17
|
+
toUpperCase: (value: string) => string;
|
|
18
|
+
toLowerCase: (value: string) => string;
|
|
19
|
+
trimSpaces: (value: string) => string;
|
|
20
|
+
removeSpecialChars: (value: string) => string;
|
|
21
|
+
formatCurrency: (value: string) => number;
|
|
22
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface BulkUploadColumn<T = any> {
|
|
2
|
+
key: keyof T;
|
|
3
|
+
label?: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
validator?: (value: string, row: Record<string, string>, index: number) => string | null;
|
|
6
|
+
transformer?: (value: string) => T[keyof T];
|
|
7
|
+
aliases?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface BulkUploadConfig<T = any> {
|
|
10
|
+
columns: BulkUploadColumn<T>[];
|
|
11
|
+
maxFileSize?: number;
|
|
12
|
+
maxRows?: number;
|
|
13
|
+
allowedFileTypes?: string[];
|
|
14
|
+
templateFileName?: string;
|
|
15
|
+
strictColumnMapping?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ParsedBulkData<T = any> {
|
|
18
|
+
data: T[];
|
|
19
|
+
errors: BulkUploadError[];
|
|
20
|
+
warnings: BulkUploadWarning[];
|
|
21
|
+
summary: {
|
|
22
|
+
totalRows: number;
|
|
23
|
+
validRows: number;
|
|
24
|
+
errorRows: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface BulkUploadError {
|
|
28
|
+
row: number;
|
|
29
|
+
column?: string;
|
|
30
|
+
message: string;
|
|
31
|
+
type: 'validation' | 'parsing' | 'structure';
|
|
32
|
+
}
|
|
33
|
+
export interface BulkUploadWarning {
|
|
34
|
+
row: number;
|
|
35
|
+
column?: string;
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
export declare class BulkUploadFileParser {
|
|
39
|
+
private static readonly CHUNK_SIZE;
|
|
40
|
+
static parseFile<T>(file: File, config: BulkUploadConfig<T>): Promise<ParsedBulkData<T>>;
|
|
41
|
+
private static validateFile;
|
|
42
|
+
private static parseCSV;
|
|
43
|
+
private static processCSVText;
|
|
44
|
+
private static parseCSVRow;
|
|
45
|
+
private static parseExcel;
|
|
46
|
+
private static processExcelData;
|
|
47
|
+
private static createColumnMapping;
|
|
48
|
+
private static normalizeHeader;
|
|
49
|
+
private static processDataRow;
|
|
50
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated barrel for src/utilities/hooks
|
|
3
3
|
*/
|
|
4
|
+
export { default as useBulkUpload } from './useBulkUpload';
|
|
5
|
+
export * from './useBulkUpload';
|
|
4
6
|
export { default as useFetchOnStageChange } from './useFetchOnStageChange';
|
|
5
7
|
export * from './useFetchOnStageChange';
|
|
6
8
|
export { default as useFirstRender } from './useFirstRender';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BulkUploadConfig, BulkUploadError, BulkUploadWarning, ParsedBulkData } from '../helpers/bulkUploadFileParser';
|
|
2
|
+
export interface UseBulkUploadOptions<T> {
|
|
3
|
+
config: BulkUploadConfig<T>;
|
|
4
|
+
onSuccess?: (data: T[], additionalData?: Record<string, any>) => Promise<void>;
|
|
5
|
+
onError?: (errors: BulkUploadError[]) => void;
|
|
6
|
+
onProgress?: (progress: {
|
|
7
|
+
loaded: number;
|
|
8
|
+
total: number;
|
|
9
|
+
}) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface BulkUploadState<T> {
|
|
12
|
+
file: File | null;
|
|
13
|
+
parsedData: ParsedBulkData<T> | null;
|
|
14
|
+
isProcessing: boolean;
|
|
15
|
+
isUploading: boolean;
|
|
16
|
+
progress: number;
|
|
17
|
+
errors: BulkUploadError[];
|
|
18
|
+
warnings: BulkUploadWarning[];
|
|
19
|
+
}
|
|
20
|
+
export declare const useBulkUpload: <T>({ config, onSuccess, onError, }: UseBulkUploadOptions<T>) => {
|
|
21
|
+
setFile: (file: File | null) => void;
|
|
22
|
+
parseFile: () => Promise<ParsedBulkData<T> | undefined>;
|
|
23
|
+
submitData: (additionalData?: Record<string, any>) => Promise<void>;
|
|
24
|
+
downloadTemplate: (format?: "excel" | "csv") => void;
|
|
25
|
+
reset: () => void;
|
|
26
|
+
abort: () => void;
|
|
27
|
+
hasValidData: boolean | 0 | undefined;
|
|
28
|
+
hasErrors: boolean;
|
|
29
|
+
hasWarnings: boolean;
|
|
30
|
+
canSubmit: boolean | 0 | undefined;
|
|
31
|
+
file: File | null;
|
|
32
|
+
parsedData: ParsedBulkData<T> | null;
|
|
33
|
+
isProcessing: boolean;
|
|
34
|
+
isUploading: boolean;
|
|
35
|
+
progress: number;
|
|
36
|
+
errors: BulkUploadError[];
|
|
37
|
+
warnings: BulkUploadWarning[];
|
|
38
|
+
};
|
|
39
|
+
export default useBulkUpload;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ModalBaseConfig
|
|
2
|
-
export declare const useModal: <T extends
|
|
3
|
-
open: (data:
|
|
4
|
-
close: (result?:
|
|
5
|
-
submit: (result?:
|
|
1
|
+
import { ModalBaseConfig } from '../types/modalTypes';
|
|
2
|
+
export declare const useModal: <T extends string>(modalKey: T) => {
|
|
3
|
+
open: (data: any, options?: ModalBaseConfig) => Promise<any>;
|
|
4
|
+
close: (result?: any) => void;
|
|
5
|
+
submit: (result?: any) => void;
|
|
6
6
|
cancel: (reason?: any) => void;
|
|
7
|
-
closeAll: (result?:
|
|
7
|
+
closeAll: (result?: any) => void;
|
|
8
8
|
isOpen: boolean;
|
|
9
|
-
instances: import('..').ModalInstance
|
|
10
|
-
latestInstance: import('..').ModalInstance
|
|
11
|
-
focusedInstance: import('..').ModalInstance
|
|
12
|
-
activeInstance: import('..').ModalInstance
|
|
9
|
+
instances: import('..').ModalInstance[];
|
|
10
|
+
latestInstance: import('..').ModalInstance;
|
|
11
|
+
focusedInstance: import('..').ModalInstance | undefined;
|
|
12
|
+
activeInstance: import('..').ModalInstance;
|
|
13
13
|
count: number;
|
|
14
14
|
focus: () => void;
|
|
15
|
-
data:
|
|
15
|
+
data: any;
|
|
16
16
|
id: string;
|
|
17
17
|
};
|
|
18
18
|
export default useModal;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
key: TKey;
|
|
4
|
-
component: React.ComponentType<ModalRegistry[TKey]['data']>;
|
|
5
|
-
defaultConfig?: ModalBaseConfig;
|
|
6
|
-
}
|
|
7
|
-
export default function useModalRegistration<TKey extends keyof ModalRegistry>(config: ModalRegistrationConfig<TKey>): void;
|
|
1
|
+
import { ModalRegistrationConfig } from '..';
|
|
2
|
+
export default function useModalRegistration<TKey>(config: ModalRegistrationConfig<TKey>): void;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { ModalRegistrationConfig } from '
|
|
2
|
-
import { ModalRegistry } from '..';
|
|
1
|
+
import { ModalRegistrationConfig, ModalRegistry } from '..';
|
|
3
2
|
export default function useModalRegistrations(configs: ModalRegistrationConfig<keyof ModalRegistry>[]): void;
|
|
@@ -9,13 +9,13 @@ export interface NotificationOptions {
|
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare const useNotification: (defaultPosition?: NotificationPosition) => {
|
|
12
|
-
show: (message: string, options?: NotificationOptions) => Promise<
|
|
13
|
-
success: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<
|
|
14
|
-
error: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<
|
|
15
|
-
warning: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<
|
|
16
|
-
info: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<
|
|
17
|
-
close: (result?:
|
|
18
|
-
closeAll: (result?:
|
|
12
|
+
show: (message: string, options?: NotificationOptions) => Promise<any>;
|
|
13
|
+
success: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<any>;
|
|
14
|
+
error: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<any>;
|
|
15
|
+
warning: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<any>;
|
|
16
|
+
info: (message: string, options?: Omit<NotificationOptions, "variant">) => Promise<any>;
|
|
17
|
+
close: (result?: any) => void;
|
|
18
|
+
closeAll: (result?: any) => void;
|
|
19
19
|
isOpen: boolean;
|
|
20
20
|
count: number;
|
|
21
21
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModalContextValue, ModalInstance } from './context/modalContext';
|
|
2
|
-
import { ModalBaseConfig
|
|
2
|
+
import { ModalBaseConfig } from './types/modalTypes';
|
|
3
3
|
export declare class ModalUtil {
|
|
4
4
|
private static instance;
|
|
5
5
|
private contextValue;
|
|
@@ -7,6 +7,9 @@ export declare class ModalUtil {
|
|
|
7
7
|
private pendingModals;
|
|
8
8
|
private autoCloseTimers;
|
|
9
9
|
private componentCleanupCallbacks;
|
|
10
|
+
private cleanupInterval;
|
|
11
|
+
private cleaningUp;
|
|
12
|
+
constructor();
|
|
10
13
|
static getInstance(): ModalUtil;
|
|
11
14
|
setContext(contextValue: ModalContextValue): void;
|
|
12
15
|
setFocusedModal(id: string): void;
|
|
@@ -16,18 +19,19 @@ export declare class ModalUtil {
|
|
|
16
19
|
isModalFocused(id: string): boolean;
|
|
17
20
|
registerComponentCleanup(componentId: string, cleanup: () => void): void;
|
|
18
21
|
unregisterComponentCleanup(componentId: string): void;
|
|
22
|
+
open<TData, TResult>(modalKey: string, data: TData, options?: ModalBaseConfig): Promise<TResult>;
|
|
23
|
+
close(id: string, result?: any): void;
|
|
24
|
+
closeAllOfType(type: string, result?: any): void;
|
|
25
|
+
closeAll(): void;
|
|
19
26
|
closeFocused(result?: any): void;
|
|
20
27
|
submitFocused(result?: any): void;
|
|
21
28
|
cancelFocused(reason?: any): void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
closeAllOfType<T extends keyof ModalRegistry>(type: T, result?: ModalRegistry[T]["result"]): void;
|
|
25
|
-
closeAll(): void;
|
|
26
|
-
destroy(): void;
|
|
27
|
-
getModalsByType<T extends keyof ModalRegistry>(type: T): ModalInstance[];
|
|
28
|
-
isTypeOpen<T extends keyof ModalRegistry>(type: T): boolean;
|
|
29
|
+
getModalsByType(type: string): ModalInstance[];
|
|
30
|
+
isTypeOpen(type: string): boolean;
|
|
29
31
|
getModalConfig(): Required<ModalBaseConfig>;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
destroy(): void;
|
|
33
|
+
__resetForTesting(): void;
|
|
34
|
+
private performMaintenanceCleanup;
|
|
35
|
+
private safeCleanupModal;
|
|
32
36
|
}
|
|
33
37
|
export declare const modalUtil: ModalUtil;
|
|
@@ -35,4 +35,6 @@ export declare class TimeUtil {
|
|
|
35
35
|
fullFormattedDateTime: string;
|
|
36
36
|
isDateTimeValid: boolean;
|
|
37
37
|
};
|
|
38
|
+
static formatDate: (date: Date, format: string | ((date: Date) => string)) => string;
|
|
39
|
+
static parseDate: (value: unknown, inputFormat?: string) => Date | undefined;
|
|
38
40
|
}
|