@dakataa/crud-react 1.0.10 → 2.0.0
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/CHANGELOG.md +83 -0
- package/README.md +439 -169
- package/dist/Crud.d.ts +15 -0
- package/dist/component/BaseButtonContent.d.ts +10 -0
- package/dist/component/Button.d.ts +9 -0
- package/dist/component/Dropdown.d.ts +17 -0
- package/dist/component/Empty.d.ts +5 -0
- package/dist/component/Link.d.ts +6 -0
- package/dist/component/LottieAnimation.d.ts +8 -0
- package/dist/component/Modal.d.ts +22 -0
- package/dist/component/Money.d.ts +7 -0
- package/dist/component/Preloader.d.ts +20 -0
- package/dist/component/Translation.d.ts +14 -0
- package/dist/component/crud/ActionLink.d.ts +10 -0
- package/dist/component/crud/CrudLoader.d.ts +29 -0
- package/dist/component/crud/DynamicView.d.ts +19 -0
- package/dist/component/crud/FiltersView.d.ts +6 -0
- package/dist/component/crud/GridView.d.ts +27 -0
- package/dist/component/crud/IsListItemActionGranted.d.ts +10 -0
- package/dist/component/crud/ItemAction.d.ts +9 -0
- package/dist/component/crud/ItemActions.d.ts +7 -0
- package/dist/component/crud/ItemLabel.d.ts +6 -0
- package/dist/component/crud/ItemValue.d.ts +6 -0
- package/dist/component/crud/List.d.ts +19 -0
- package/dist/component/crud/ListItem.d.ts +4 -0
- package/dist/component/crud/ListView.d.ts +8 -0
- package/dist/component/crud/Modify.d.ts +9 -0
- package/dist/component/crud/Navigation.d.ts +19 -0
- package/dist/component/crud/Paginator.d.ts +2 -0
- package/dist/component/crud/ViewLoader.d.ts +14 -0
- package/dist/component/crud/batch/BatchActionSelector.d.ts +2 -0
- package/dist/component/crud/batch/BatchActionsContext.d.ts +17 -0
- package/dist/component/crud/batch/BatchItemSelector.d.ts +4 -0
- package/dist/component/crud/form/Form.d.ts +31 -0
- package/dist/component/crud/form/FormError.d.ts +6 -0
- package/dist/component/crud/form/FormField.d.ts +11 -0
- package/dist/component/crud/form/FormGroup.d.ts +76 -0
- package/dist/component/crud/form/FormGroupViewLoader.d.ts +2 -0
- package/dist/component/crud/form/FormLabel.d.ts +4 -0
- package/dist/component/crud/form/FormRequestError.d.ts +14 -0
- package/dist/component/crud/form/FormRest.d.ts +2 -0
- package/dist/component/crud/form/FormRestError.d.ts +4 -0
- package/dist/component/error/ErrorBoundary.d.ts +13 -0
- package/dist/component/error/Exception.d.ts +9 -0
- package/dist/component/error/HttpException.d.ts +16 -0
- package/dist/component/form/Choice.d.ts +24 -0
- package/dist/component/form/Collection.d.ts +27 -0
- package/dist/component/form/Form.d.ts +62 -0
- package/dist/component/form/FormAlert.d.ts +3 -0
- package/dist/component/form/FormFieldError.d.ts +6 -0
- package/dist/component/form/FormGroup.d.ts +8 -0
- package/dist/component/form/FormHelp.d.ts +5 -0
- package/dist/component/form/FormLabel.d.ts +7 -0
- package/dist/component/form/FormSetting.d.ts +11 -0
- package/dist/component/form/FormStore.d.ts +93 -0
- package/dist/component/form/Input.d.ts +13 -0
- package/dist/component/form/Textarea.d.ts +15 -0
- package/dist/component/form/constraint/Contraint.d.ts +6 -0
- package/dist/component/form/constraint/NotBlank.d.ts +11 -0
- package/dist/component/form/formChoices.d.ts +8 -0
- package/dist/component/form/formSession.d.ts +3 -0
- package/dist/component/form/formView.d.ts +35 -0
- package/dist/component/router/Route.d.ts +11 -0
- package/dist/component/templating/Template.d.ts +17 -0
- package/dist/component/templating/TemplateBlock.d.ts +8 -0
- package/dist/component/templating/TemplateExtend.d.ts +9 -0
- package/dist/component/templating/TemplateParentBlock.d.ts +5 -0
- package/dist/context/ActionContext.d.ts +46 -0
- package/dist/context/AlertContext.d.ts +52 -0
- package/dist/context/ConfigContext.d.ts +34 -0
- package/dist/context/CrudProvider.d.ts +7 -0
- package/dist/context/GetData.d.ts +43 -0
- package/dist/context/ListContext.d.ts +69 -0
- package/dist/context/ListItemContext.d.ts +8 -0
- package/dist/context/LoaderContext.d.ts +5 -0
- package/dist/context/ModalContext.d.ts +18 -0
- package/dist/context/NamespaceContext.d.ts +5 -0
- package/dist/crud-react.css +2 -1
- package/dist/crud-react.js +4014 -2955
- package/dist/denied-Emsz18Y8.js +688 -0
- package/dist/helper/ObjectUtils.d.ts +3 -0
- package/dist/helper/PathUtils.d.ts +12 -0
- package/dist/helper/StringUtils.d.ts +3 -0
- package/dist/info-C897Uj_w.js +626 -0
- package/dist/layout/default/Base.d.ts +5 -0
- package/dist/layout/default/Error.d.ts +11 -0
- package/dist/layout/default/Main.d.ts +4 -0
- package/dist/main.d.ts +91 -79
- package/dist/setupTests.d.ts +0 -0
- package/dist/success-YbPKEx5j.js +559 -0
- package/dist/type/ActionRequestType.d.ts +17 -0
- package/dist/type/ActionType.d.ts +15 -0
- package/dist/type/ColumnType.d.ts +24 -0
- package/dist/type/ExceptionType.d.ts +6 -0
- package/dist/type/FormType.d.ts +6 -0
- package/dist/type/FormViewType.d.ts +96 -0
- package/dist/type/ListMetaType.d.ts +8 -0
- package/dist/type/ListType.d.ts +32 -0
- package/dist/type/ModifyType.d.ts +15 -0
- package/dist/type/RedirectType.d.ts +7 -0
- package/dist/type/RouteType.d.ts +7 -0
- package/dist/type/ViewType.d.ts +15 -0
- package/dist/warning-DJITKJj5.js +630 -0
- package/package.json +86 -81
- package/dist/denied-CgoMpaA7.js +0 -27
- package/dist/info-D-NzIEYs.js +0 -144
- package/dist/success-Bu_BJcf1.js +0 -27
- package/dist/warning-B1nr7TsB.js +0 -27
package/dist/Crud.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import { default as Requester, Config as RequesterConfig } from '@dakataa/requester';
|
|
3
|
+
import { Config, Templates } from './context/ConfigContext.tsx';
|
|
4
|
+
export declare const CRUD_NAMESPACE = "dakataa_crud";
|
|
5
|
+
declare const CrudConfiguration: ({ connection, templates }: {
|
|
6
|
+
connection: RequesterConfig;
|
|
7
|
+
templates?: Templates;
|
|
8
|
+
}) => void;
|
|
9
|
+
declare const CrudRequester: () => Requester;
|
|
10
|
+
declare const Crud: ({ children, config, errorFallback }: {
|
|
11
|
+
errorFallback?: ReactElement;
|
|
12
|
+
config?: Config;
|
|
13
|
+
} & PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export { CrudConfiguration, CrudRequester };
|
|
15
|
+
export default Crud;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
export type ButtonContentProps = {
|
|
3
|
+
icon?: ReactElement;
|
|
4
|
+
preloader?: ReactElement;
|
|
5
|
+
rightIcon?: ReactElement;
|
|
6
|
+
permission?: string | string[];
|
|
7
|
+
preload?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const BaseButtonContent: ({ icon, preloader, rightIcon, children, preload }: ButtonContentProps & PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default BaseButtonContent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React, PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
import { ButtonContentProps } from './BaseButtonContent.tsx';
|
|
3
|
+
export type ButtonPropsType = {
|
|
4
|
+
loader?: string;
|
|
5
|
+
autoDisableOnInvalid?: boolean;
|
|
6
|
+
ref?: RefObject<HTMLButtonElement>;
|
|
7
|
+
} & ButtonContentProps & PropsWithChildren & React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
8
|
+
declare const _default: ({ children, type, form, preload, autoDisableOnInvalid, ref, ...props }: ButtonPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
declare const DropdownButton: ({ children, disabled, className }: PropsWithChildren<{
|
|
3
|
+
className?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const DropdownContent: ({ children, position, ...props }: {
|
|
7
|
+
children: any;
|
|
8
|
+
position?: "end" | "start";
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const Dropdown: ({ className, children, autoClose, strategy, icon }: PropsWithChildren<{
|
|
11
|
+
className?: string;
|
|
12
|
+
icon?: any;
|
|
13
|
+
autoClose?: "outside" | "inside" | boolean;
|
|
14
|
+
strategy?: "absolute" | "fixed";
|
|
15
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export { DropdownContent, DropdownButton };
|
|
17
|
+
export default Dropdown;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonContentProps } from './BaseButtonContent.tsx';
|
|
3
|
+
declare const _default: ({ to, children, onClick, ...props }: {
|
|
4
|
+
to?: string;
|
|
5
|
+
} & React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> & ButtonContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnimationConfigWithData, AnimationConfigWithPath, AnimationConfig } from 'lottie-web';
|
|
2
|
+
declare const LottieAnimation: ({ animationData, path, options, width, height, className, ...props }: Omit<AnimationConfigWithPath, "container"> & Omit<AnimationConfigWithData, "container"> & {
|
|
3
|
+
width?: number | `${number}%`;
|
|
4
|
+
height?: number | `${number}%`;
|
|
5
|
+
className?: string;
|
|
6
|
+
options?: Omit<AnimationConfig, "container">;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default LottieAnimation;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
export type ModalType = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
backdrop?: boolean;
|
|
7
|
+
animation?: Animation | string;
|
|
8
|
+
keyboard?: boolean;
|
|
9
|
+
size?: 'sm' | 'lg' | 'xl' | 'auto';
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export type ModalRefType = {
|
|
13
|
+
toggle: () => void;
|
|
14
|
+
open: () => void;
|
|
15
|
+
close: () => Promise<void>;
|
|
16
|
+
isOpen: () => boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare enum Animation {
|
|
19
|
+
fade = "fade"
|
|
20
|
+
}
|
|
21
|
+
declare const Modal: React.FC<ModalType & React.RefAttributes<unknown>>;
|
|
22
|
+
export default Modal;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type PreloaderProviderContextType = {
|
|
3
|
+
isLoading: (loader: string) => boolean;
|
|
4
|
+
startLoading: (loader: string) => void;
|
|
5
|
+
stopLoading: (loader: string) => void;
|
|
6
|
+
loaders: LoadersState;
|
|
7
|
+
};
|
|
8
|
+
type LoadersState = {
|
|
9
|
+
[key: string]: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const UsePreloaderProvider: () => PreloaderProviderContextType | undefined;
|
|
12
|
+
export declare const PreloaderIndicator: ({ loader, children }: {
|
|
13
|
+
loader?: string;
|
|
14
|
+
} & PropsWithChildren) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
15
|
+
export declare const UsePreloader: () => string | undefined;
|
|
16
|
+
export declare const Preloader: ({ loader, children }: {
|
|
17
|
+
loader?: string;
|
|
18
|
+
} & PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const PreloaderProvider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default PreloaderProvider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React, PropsWithChildren } from 'react';
|
|
2
|
+
export type TranslationOptions = {
|
|
3
|
+
domain?: string;
|
|
4
|
+
properties?: {
|
|
5
|
+
[key: string]: string | number | null;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export type TranslationFunction = (key: string, options?: TranslationOptions) => string;
|
|
9
|
+
export declare function UseTranslate(): TranslationFunction;
|
|
10
|
+
export type TranslationProps = TranslationOptions & PropsWithChildren & {
|
|
11
|
+
translationKey?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const Translation: ({ children, translationKey, domain, properties }: TranslationProps & PropsWithChildren) => React.ReactNode;
|
|
14
|
+
export default Translation;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React, ReactNode, SyntheticEvent } from 'react';
|
|
2
|
+
import { ActionRequestType } from '../../type/ActionRequestType.tsx';
|
|
3
|
+
import { ButtonContentProps } from '../BaseButtonContent.tsx';
|
|
4
|
+
declare const ActionLink: ({ children, action, className, onClick, ...props }: {
|
|
5
|
+
action: ActionRequestType;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
onClick?: (e: SyntheticEvent) => void;
|
|
9
|
+
} & React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> & ButtonContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default ActionLink;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React, PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import { ActionRequestType } from '../../type/ActionRequestType.tsx';
|
|
3
|
+
type CurrentActionRequestContextType = {
|
|
4
|
+
actionRequest: ActionRequestType;
|
|
5
|
+
setActionRequest: (actionRequest: ActionRequestType) => void;
|
|
6
|
+
refresh: () => void;
|
|
7
|
+
};
|
|
8
|
+
type CurrentActionRequestCollectionContextType = {
|
|
9
|
+
set: (key: string, context: CurrentActionRequestContextType) => void;
|
|
10
|
+
get: (key: string) => CurrentActionRequestContextType | null;
|
|
11
|
+
unset: (key: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function CurrentActionCollectionProvider({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function UseCurrentActionCollection(): CurrentActionRequestCollectionContextType;
|
|
15
|
+
export declare function UseCurrentActionRequest(): CurrentActionRequestContextType;
|
|
16
|
+
export type CurrentActionRequestProviderRef = {
|
|
17
|
+
refresh: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare function CurrentActionRequestProvider({ actionRequest, name, ref, ...props }: {
|
|
20
|
+
actionRequest: ActionRequestType;
|
|
21
|
+
name?: string;
|
|
22
|
+
ref?: React.Ref<CurrentActionRequestProviderRef>;
|
|
23
|
+
} & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const CrudLoader: ({ path, preloader }: {
|
|
25
|
+
path?: string;
|
|
26
|
+
errorFallback?: ReactElement;
|
|
27
|
+
preloader?: ReactElement;
|
|
28
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
|
+
export default CrudLoader;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React, ReactElement, ReactNode } from 'react';
|
|
2
|
+
type DynamicViewContextType = {
|
|
3
|
+
parent?: ReactElement | ReactNode;
|
|
4
|
+
template: string | string[];
|
|
5
|
+
data?: any;
|
|
6
|
+
view?: string | string[];
|
|
7
|
+
namespace?: string;
|
|
8
|
+
isImported: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function UseDynamicView(): DynamicViewContextType | undefined;
|
|
11
|
+
declare const DynamicView: React.MemoExoticComponent<({ view, prefix, namespace, children, props, data }: {
|
|
12
|
+
view: string | string[];
|
|
13
|
+
namespace?: string;
|
|
14
|
+
prefix?: string;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
data?: any;
|
|
17
|
+
props?: any;
|
|
18
|
+
}) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined>;
|
|
19
|
+
export default DynamicView;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ColumnType } from '../../type/ColumnType';
|
|
2
|
+
import { HTMLAttributes, ReactElement, TableHTMLAttributes } from 'react';
|
|
3
|
+
type GridViewHeaderColumnAttributes = {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
export type GridViewType = {
|
|
7
|
+
options?: {
|
|
8
|
+
columns: {
|
|
9
|
+
[key: string]: ((data?: any) => Partial<ColumnType>) | Partial<ColumnType>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
headerOptions?: {
|
|
13
|
+
columns: {
|
|
14
|
+
[key: string]: {
|
|
15
|
+
view: ReactElement | ((column: ColumnType) => ReactElement);
|
|
16
|
+
attr?: GridViewHeaderColumnAttributes | ((column: ColumnType) => GridViewHeaderColumnAttributes);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
tableOptions?: TableHTMLAttributes<HTMLTableElement>;
|
|
21
|
+
routeParams?: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
namespace?: string;
|
|
25
|
+
};
|
|
26
|
+
declare const GridView: ({ routeParams, namespace, options, tableOptions, ...HTMLAttributes }: GridViewType & HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export default GridView;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type IsGrantedProps = {
|
|
3
|
+
permission?: string | null;
|
|
4
|
+
id?: number | string;
|
|
5
|
+
};
|
|
6
|
+
declare const useListItemActionGranted: () => {
|
|
7
|
+
isListItemGranted: ({ permission, id }: IsGrantedProps) => boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const IsListItemActionGranted: ({ permission, children, id: itemId }: IsGrantedProps & PropsWithChildren) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
10
|
+
export { IsListItemActionGranted as default, useListItemActionGranted };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ActionRequestType } from '../../type/ActionRequestType.tsx';
|
|
3
|
+
declare const ItemAction: ({ action, icon, className, ...props }: {
|
|
4
|
+
action: ActionRequestType;
|
|
5
|
+
className?: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default ItemAction;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentType, FC, ReactElement, SyntheticEvent, default as React } from 'react';
|
|
2
|
+
import { ActionRequestType } from '../../type/ActionRequestType.tsx';
|
|
3
|
+
type ListPropsType = {
|
|
4
|
+
embedded?: boolean;
|
|
5
|
+
title?: string | ReactElement | false;
|
|
6
|
+
className?: string;
|
|
7
|
+
onAction?: (action: ActionRequestType, event?: SyntheticEvent) => boolean | null | void;
|
|
8
|
+
};
|
|
9
|
+
declare const List: FC<ListPropsType & {
|
|
10
|
+
children?: React.ReactNode | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
declare function WithListProvider<P extends object>(Component: ComponentType<P>, options?: ListPropsType): FC<P>;
|
|
13
|
+
declare const ListInner: FC<{
|
|
14
|
+
title?: string | ReactElement | false;
|
|
15
|
+
className?: string;
|
|
16
|
+
} & {
|
|
17
|
+
children?: React.ReactNode | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export { List as default, ListInner, WithListProvider };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { GridViewType } from './GridView.tsx';
|
|
3
|
+
type ListViewType = GridViewType & {
|
|
4
|
+
itemView?: ReactElement;
|
|
5
|
+
emptyView?: ReactElement | null;
|
|
6
|
+
};
|
|
7
|
+
declare const ListView: ({ itemView, emptyView, namespace }: ListViewType) => false | import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[] | null;
|
|
8
|
+
export default ListView;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React, ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { ModifyType } from '../../type/ModifyType.tsx';
|
|
3
|
+
declare const Modify: React.FC<{
|
|
4
|
+
template?: ComponentType;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
onSuccess?: (event: CustomEvent, data: ModifyType) => void;
|
|
7
|
+
modal?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export default Modify;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RouteType } from '../../type/RouteType.tsx';
|
|
3
|
+
export type NavigationItem = {
|
|
4
|
+
title: string;
|
|
5
|
+
route?: RouteType;
|
|
6
|
+
icon?: any;
|
|
7
|
+
items?: NavigationItem[];
|
|
8
|
+
target?: '_blank' | '_self';
|
|
9
|
+
};
|
|
10
|
+
export type NavigationItemContextType = {
|
|
11
|
+
toggle: (value?: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
declare const Navigation: React.ForwardRefExoticComponent<{
|
|
14
|
+
items: NavigationItem[];
|
|
15
|
+
className?: string;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
props?: any;
|
|
18
|
+
} & React.RefAttributes<NavigationItemContextType>>;
|
|
19
|
+
export default Navigation;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const DefaultViewComponent: ({ view, props }: {
|
|
2
|
+
view: string;
|
|
3
|
+
props?: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const ViewLoader: ({ view, namespace, props }: {
|
|
8
|
+
view: string;
|
|
9
|
+
namespace?: string;
|
|
10
|
+
props?: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}) => any;
|
|
14
|
+
export { ViewLoader, DefaultViewComponent };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export type BatchContextType = {
|
|
3
|
+
actions: {
|
|
4
|
+
[action: string]: string;
|
|
5
|
+
} | undefined;
|
|
6
|
+
toggle: (row: number, add: boolean) => void;
|
|
7
|
+
toggleAll: (selectAll: boolean) => void;
|
|
8
|
+
isSelected: (row: number) => boolean;
|
|
9
|
+
isSelectedAll: boolean;
|
|
10
|
+
executeAction: (method: string) => void;
|
|
11
|
+
selected?: any[];
|
|
12
|
+
clear: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function UseBatchActions(): BatchContextType | undefined;
|
|
15
|
+
export declare function BatchActionsProvider({ onClick, ...props }: {
|
|
16
|
+
onClick?: (method: string, ids: any, data: FormData) => Promise<void>;
|
|
17
|
+
} & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FormProps, FormRef, FormValue } from '../../form/Form.tsx';
|
|
2
|
+
import { PropsWithChildren, ReactNode, default as React } from 'react';
|
|
3
|
+
import { FormViewType } from '../../../type/FormViewType.tsx';
|
|
4
|
+
import { ExceptionType } from '../../../type/ExceptionType.tsx';
|
|
5
|
+
import { FormSubmission, FormSyncMode } from '../../form/FormStore.ts';
|
|
6
|
+
export type ModifyFormRefType = {
|
|
7
|
+
getFormRef: () => FormRef | null;
|
|
8
|
+
};
|
|
9
|
+
export type FormViewContextType = {
|
|
10
|
+
form: FormViewType;
|
|
11
|
+
setValue: (name: string | null, value: FormValue) => void;
|
|
12
|
+
setValues: (data: Record<string, FormValue>) => void;
|
|
13
|
+
allowDuplicates?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const FormViewProvider: ({ view, allowDuplicates, children, syncMode, submission }: PropsWithChildren & {
|
|
16
|
+
view: FormViewType;
|
|
17
|
+
allowDuplicates?: boolean;
|
|
18
|
+
syncMode?: FormSyncMode;
|
|
19
|
+
submission?: FormSubmission;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function UseFormView(): FormViewContextType;
|
|
22
|
+
export declare function UseParentFormView(): FormViewContextType | undefined;
|
|
23
|
+
declare const Form: React.FC<{
|
|
24
|
+
onSuccess?: (data: any) => Promise<void>;
|
|
25
|
+
onError?: (data: ExceptionType) => boolean | void;
|
|
26
|
+
onLoad?: () => void;
|
|
27
|
+
onStateChange?: FormProps["onStateChange"];
|
|
28
|
+
embedded?: boolean;
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
} & React.RefAttributes<unknown>>;
|
|
31
|
+
export default Form;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormFieldErrorProps } from '../../form/FormFieldError.tsx';
|
|
2
|
+
export type FormErrorProps = Omit<FormFieldErrorProps, "name"> & {
|
|
3
|
+
name?: string | (string | null)[];
|
|
4
|
+
};
|
|
5
|
+
declare const FormError: ({ name, ...attributes }: FormErrorProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default FormError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FormViewType } from '../../../type/FormViewType.tsx';
|
|
3
|
+
declare const FormField: ({ name, options, optional, ref }: {
|
|
4
|
+
name?: string;
|
|
5
|
+
options?: Partial<FormViewType>;
|
|
6
|
+
size?: "lg" | "sm";
|
|
7
|
+
/** Return null when the requested view is missing. Defaults to false. */
|
|
8
|
+
optional?: boolean;
|
|
9
|
+
ref?: React.RefObject<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null>;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export default FormField;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { FormViewType } from '../../../type/FormViewType.tsx';
|
|
3
|
+
type FormGroupContextType = {
|
|
4
|
+
view: FormViewType;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Returns metadata for the form group currently being rendered.
|
|
8
|
+
*
|
|
9
|
+
* @internal This hook supports the schema renderer and is not part of the
|
|
10
|
+
* package's public entry point.
|
|
11
|
+
*/
|
|
12
|
+
export declare function UseFormGroup(): FormGroupContextType | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Provides the current group to the nested schema renderer.
|
|
15
|
+
*
|
|
16
|
+
* @internal Consumers should render {@link FormGroup} instead of creating this
|
|
17
|
+
* context directly.
|
|
18
|
+
*/
|
|
19
|
+
export declare function FormGroupProvider({ view, children }: FormGroupContextType & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/** Props accepted by {@link FormGroup}. */
|
|
21
|
+
export type FormGroupProps = {
|
|
22
|
+
/**
|
|
23
|
+
* Name of a direct child of the current form view.
|
|
24
|
+
*
|
|
25
|
+
* When omitted, the component renders the current view itself. Nested paths
|
|
26
|
+
* such as `address.street` are not resolved; nest `FormViewProvider`
|
|
27
|
+
* instances or render from the appropriate parent view instead.
|
|
28
|
+
*/
|
|
29
|
+
name?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Shallow overrides applied to the selected schema node before rendering.
|
|
32
|
+
*
|
|
33
|
+
* The node's `type` cannot be overridden. Object-valued properties such as
|
|
34
|
+
* `attr` and `children` replace the corresponding property rather than being
|
|
35
|
+
* deep-merged.
|
|
36
|
+
*/
|
|
37
|
+
options?: Omit<FormViewType, "type">;
|
|
38
|
+
/**
|
|
39
|
+
* Return `null` when the requested view is missing instead of throwing.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue false
|
|
42
|
+
*/
|
|
43
|
+
optional?: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Renders a form schema node from the nearest {@link FormViewProvider}.
|
|
47
|
+
*
|
|
48
|
+
* `FormGroup` selects either the current view or one of its direct children,
|
|
49
|
+
* applies optional shallow overrides, and delegates rendering to the dynamic
|
|
50
|
+
* form view loader. The loader handles containers recursively and renders leaf
|
|
51
|
+
* nodes with the library's standard label, field, error, and help markup.
|
|
52
|
+
*
|
|
53
|
+
* The component must be rendered below `FormViewProvider` (normally provided by
|
|
54
|
+
* `CrudForm`). If no matching view exists, it throws unless `optional` is set.
|
|
55
|
+
*
|
|
56
|
+
* @throws {Error} When no matching form view exists and `optional` is `false`.
|
|
57
|
+
* @throws {Error} When rendered outside a `FormViewProvider`.
|
|
58
|
+
*
|
|
59
|
+
* @example Render a direct child from the current form schema.
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <FormGroup name="title" />
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Customize the selected view for this render.
|
|
65
|
+
* ```tsx
|
|
66
|
+
* <FormGroup
|
|
67
|
+
* name="price"
|
|
68
|
+
* options={{
|
|
69
|
+
* label: 'Unit price',
|
|
70
|
+
* attr: {className: 'form-control text-end'},
|
|
71
|
+
* }}
|
|
72
|
+
* />
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare const FormGroup: ({ name, options, optional }: FormGroupProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
76
|
+
export default FormGroup;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { FormSubmission } from '../../form/FormStore.ts';
|
|
3
|
+
import { ExceptionType } from '../../../type/ExceptionType.tsx';
|
|
4
|
+
export type PendingFormSubmission = {
|
|
5
|
+
session: string;
|
|
6
|
+
snapshot: FormSubmission;
|
|
7
|
+
};
|
|
8
|
+
/** Handles failures of this form's pending submission, retaining the draft. */
|
|
9
|
+
export default function FormRequestError({ session, pending, loader, onError }: {
|
|
10
|
+
session: string;
|
|
11
|
+
pending: RefObject<PendingFormSubmission | null>;
|
|
12
|
+
loader: string;
|
|
13
|
+
onError?: (error: ExceptionType) => boolean | void;
|
|
14
|
+
}): null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { default as Exception } from './Exception.tsx';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
type ErrorFallback = React.ReactElement | ((error: Exception | null) => void);
|
|
5
|
+
type ErrorBoundaryProps = {
|
|
6
|
+
fallback?: ErrorFallback;
|
|
7
|
+
resetKeys?: readonly unknown[];
|
|
8
|
+
children?: any;
|
|
9
|
+
};
|
|
10
|
+
export declare function UseErrorBoundary(): boolean;
|
|
11
|
+
export declare function ErrorBoundaryContextProvider({ ...props }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const ErrorBoundary: ({ children, fallback, ...props }: ErrorBoundaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExceptionTraceType } from './HttpException.tsx';
|
|
2
|
+
declare class Exception {
|
|
3
|
+
detail: string;
|
|
4
|
+
code: number;
|
|
5
|
+
trace?: ExceptionTraceType[];
|
|
6
|
+
name?: string;
|
|
7
|
+
constructor(code: number | undefined, detail: string, trace?: ExceptionTraceType[], name?: string);
|
|
8
|
+
}
|
|
9
|
+
export default Exception;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as Exception } from './Exception.tsx';
|
|
2
|
+
export type ExceptionTraceType = {
|
|
3
|
+
type: string;
|
|
4
|
+
file: string;
|
|
5
|
+
class: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
function: string;
|
|
8
|
+
line: number;
|
|
9
|
+
namespace: string;
|
|
10
|
+
short_class: string;
|
|
11
|
+
};
|
|
12
|
+
declare class HttpException extends Exception {
|
|
13
|
+
status: number;
|
|
14
|
+
constructor(status: number, detail?: string, trace?: ExceptionTraceType[], name?: string);
|
|
15
|
+
}
|
|
16
|
+
export default HttpException;
|