@archbase/template 3.0.0 → 3.0.2
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.d.ts +2 -0
- package/dist/index.js +587 -584
- package/dist/template/src/ArchbaseFormModalTemplate.d.ts +21 -0
- package/dist/template/src/ArchbaseFormTemplate.d.ts +35 -0
- package/dist/template/src/ArchbaseGridTemplate.d.ts +110 -0
- package/dist/template/src/ArchbaseMasonryTemplate.d.ts +76 -0
- package/dist/template/src/ArchbaseModalTemplate.d.ts +11 -0
- package/dist/template/src/ArchbasePanelTemplate.d.ts +60 -0
- package/dist/template/src/ArchbaseSearchTemplate.d.ts +1 -0
- package/dist/template/src/ArchbaseSpaceTemplate.d.ts +70 -0
- package/dist/template/src/ArchbaseStateValues.d.ts +9 -0
- package/dist/template/src/ArchbaseTemplateCommonTypes.d.ts +28 -0
- package/dist/template/src/ArchbaseTemplateState.d.ts +9 -0
- package/dist/template/src/components/ArchbaseConditionalSecurityWrapper.d.ts +34 -0
- package/dist/template/src/components/ArchbaseSmartActionButton.d.ts +27 -0
- package/dist/template/src/components/index.d.ts +2 -0
- package/dist/template/src/hooks/index.d.ts +1 -0
- package/dist/template/src/hooks/useOptionalTemplateSecurity.d.ts +25 -0
- package/dist/template/src/index.d.ts +14 -0
- package/dist/template/src/validation/ValidationErrorsContext.d.ts +25 -0
- package/package.json +20 -18
- package/dist/archbase-template-3.0.0.tgz +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LoadingOverlayStylesNames, ModalProps } from '@mantine/core';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { ArchbaseDataSource } from '../../data/src';
|
|
4
|
+
import { ArchbaseTemplateSecurityProps } from './ArchbaseTemplateCommonTypes';
|
|
5
|
+
export interface ArchbaseFormModalTemplateProps<T extends object, ID> extends Omit<ModalProps, 'onClose' | 'onError'>, ArchbaseTemplateSecurityProps {
|
|
6
|
+
dataSource?: ArchbaseDataSource<T, ID>;
|
|
7
|
+
height: string | number | undefined;
|
|
8
|
+
userActions?: ReactNode;
|
|
9
|
+
onCustomSave?: (record?: T, callback?: Function) => void;
|
|
10
|
+
onAfterSave?: (record?: T) => void;
|
|
11
|
+
onClickOk: (record?: T, result?: any) => void;
|
|
12
|
+
onClickCancel: (record?: T) => void;
|
|
13
|
+
onBeforeOk?: (record?: T) => Promise<any> | boolean | undefined;
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
error?: string | undefined;
|
|
16
|
+
clearError?: () => void;
|
|
17
|
+
onError?: (error: string) => void;
|
|
18
|
+
autoCloseAlertError?: number;
|
|
19
|
+
loadingOverlayStyles?: Partial<Record<LoadingOverlayStylesNames, CSSProperties>>;
|
|
20
|
+
}
|
|
21
|
+
export declare function ArchbaseFormModalTemplate<T extends object, ID>({ title, withOverlay, overlayProps, children, withCloseButton, closeButtonProps, opened, fullScreen, centered, variant, closeOnEscape, size, dataSource, height, userActions, onAfterSave, onClickOk, onClickCancel, onBeforeOk, onCustomSave, isError, error, clearError, onError, autoCloseAlertError, loadingOverlayStyles, resourceName, resourceDescription, requiredPermissions, fallbackComponent, securityOptions, ...rest }: ArchbaseFormModalTemplateProps<T, ID>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AlertVariant, ButtonVariant } from '@mantine/core';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { ArchbaseDataSource } from '../../data/src';
|
|
4
|
+
import { ArchbaseTemplateSecurityProps } from './ArchbaseTemplateCommonTypes';
|
|
5
|
+
export interface ArchbaseFormTemplateProps<T, ID> extends ArchbaseTemplateSecurityProps {
|
|
6
|
+
title: string;
|
|
7
|
+
dataSource: ArchbaseDataSource<T, ID>;
|
|
8
|
+
variant?: ButtonVariant | AlertVariant | string;
|
|
9
|
+
/** Referência para o componente interno */
|
|
10
|
+
innerRef?: React.RefObject<HTMLInputElement> | undefined;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
isCanceling?: boolean;
|
|
13
|
+
isSaving?: boolean;
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
error?: string | undefined;
|
|
16
|
+
clearError?: () => void;
|
|
17
|
+
autoCloseAlertError?: number;
|
|
18
|
+
width?: number | string | undefined;
|
|
19
|
+
height?: number | string | undefined;
|
|
20
|
+
withBorder?: boolean;
|
|
21
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
22
|
+
radius?: string | number | undefined;
|
|
23
|
+
/** Alinhamento dos botões no footer: 'left' | 'center' | 'right' */
|
|
24
|
+
footerAlign?: 'left' | 'center' | 'right';
|
|
25
|
+
/** Conteúdo adicional a ser exibido no footer (à esquerda dos botões se footerAlign='right', à direita se footerAlign='left') */
|
|
26
|
+
footerContent?: React.ReactNode;
|
|
27
|
+
onSave?: (entityToSave: any) => void;
|
|
28
|
+
onCancel?: () => void;
|
|
29
|
+
onBeforeSave?: (entityToSave: T) => void;
|
|
30
|
+
onAfterSave?: (savedEntity: T) => void;
|
|
31
|
+
onBeforeCancel?: () => void;
|
|
32
|
+
onAfterCancel?: () => void;
|
|
33
|
+
onError?: (error: string) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare function ArchbaseFormTemplate<T extends object, ID>({ innerRef, title, isError, isCanceling, isSaving, error, clearError, autoCloseAlertError, width, height, withBorder, children, radius, variant, footerAlign, footerContent, dataSource, onSave, onCancel, onBeforeSave, onAfterSave, onBeforeCancel, onAfterCancel, onError, resourceName, resourceDescription, requiredPermissions, fallbackComponent, securityOptions, ...rest }: ArchbaseFormTemplateProps<T, ID>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { AlertVariant, ButtonVariant } from '@mantine/core';
|
|
2
|
+
import { default as React, ReactNode } from 'react';
|
|
3
|
+
import { ArchbaseDataGridRef, CellClickEvent } from '../../components/src';
|
|
4
|
+
import { ArchbaseStateValues } from './ArchbaseStateValues';
|
|
5
|
+
import { ArchbaseQueryFilterDelegator, FilterOptions } from '../../advanced/src';
|
|
6
|
+
import { ArchbaseDataSource } from '../../data/src';
|
|
7
|
+
import { ArchbaseTemplateSecurityProps } from './ArchbaseTemplateCommonTypes';
|
|
8
|
+
export interface UserActionsOptions {
|
|
9
|
+
visible: boolean;
|
|
10
|
+
labelAdd?: string;
|
|
11
|
+
labelEdit?: string;
|
|
12
|
+
labelRemove?: string;
|
|
13
|
+
labelView?: string;
|
|
14
|
+
allowRemove: boolean;
|
|
15
|
+
customUserActions?: ReactNode;
|
|
16
|
+
customUserActionsPosition?: 'left' | 'right';
|
|
17
|
+
onAddExecute?: () => void;
|
|
18
|
+
onEditExecute?: () => void;
|
|
19
|
+
onRemoveExecute?: () => void;
|
|
20
|
+
onViewExecute?: () => void;
|
|
21
|
+
}
|
|
22
|
+
export interface UserRowActionsOptions<T extends Object> {
|
|
23
|
+
actions?: any;
|
|
24
|
+
onAddRow?: (row: T) => void;
|
|
25
|
+
onEditRow?: (row: T) => void;
|
|
26
|
+
onRemoveRow?: (row: T) => void;
|
|
27
|
+
onViewRow?: (row: T) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface ArchbaseGridTemplateProps<T extends Object, ID> extends ArchbaseTemplateSecurityProps {
|
|
30
|
+
id?: string;
|
|
31
|
+
title: string;
|
|
32
|
+
printTitle?: string;
|
|
33
|
+
logoPrint?: string;
|
|
34
|
+
variant?: AlertVariant | ButtonVariant;
|
|
35
|
+
dataSource: ArchbaseDataSource<T, ID>;
|
|
36
|
+
dataSourceEdition?: ArchbaseDataSource<T, ID> | undefined;
|
|
37
|
+
store?: ArchbaseStateValues | undefined;
|
|
38
|
+
filterType: 'none' | 'normal' | 'advanced';
|
|
39
|
+
filterOptions?: FilterOptions;
|
|
40
|
+
filterPersistenceDelegator?: ArchbaseQueryFilterDelegator;
|
|
41
|
+
pageSize?: number;
|
|
42
|
+
pageIndex?: number;
|
|
43
|
+
columns: ReactNode;
|
|
44
|
+
filterFields?: ReactNode | undefined;
|
|
45
|
+
userActions?: UserActionsOptions;
|
|
46
|
+
userRowActions?: UserRowActionsOptions<T>;
|
|
47
|
+
innerRef?: React.RefObject<HTMLInputElement> | undefined;
|
|
48
|
+
isLoading?: boolean;
|
|
49
|
+
isLoadingFilter?: boolean;
|
|
50
|
+
isError?: boolean;
|
|
51
|
+
error?: string | undefined;
|
|
52
|
+
clearError?: () => void;
|
|
53
|
+
width?: number | string | undefined;
|
|
54
|
+
height?: number | string | undefined;
|
|
55
|
+
onSearchByFilter?: () => void;
|
|
56
|
+
getRowId?: (row: T) => any;
|
|
57
|
+
withBorder?: boolean;
|
|
58
|
+
enableTopToolbar?: boolean;
|
|
59
|
+
enableTopToolbarActions?: boolean;
|
|
60
|
+
cellPadding?: string | number;
|
|
61
|
+
bottomToolbarMinHeight?: string | number;
|
|
62
|
+
/** Habilitar seleção de linhas */
|
|
63
|
+
enableRowSelection?: boolean;
|
|
64
|
+
/** Habilitar números de linha */
|
|
65
|
+
enableRowNumbers?: boolean;
|
|
66
|
+
/** Habilitar ações nas linhas */
|
|
67
|
+
enableRowActions?: boolean;
|
|
68
|
+
/** Posição da coluna de ações */
|
|
69
|
+
positionActionsColumn: 'first' | 'last';
|
|
70
|
+
/** Padding da célula do cabeçalho da tabela */
|
|
71
|
+
tableHeadCellPadding?: string;
|
|
72
|
+
/** Função para renderizar o painel de detalhes */
|
|
73
|
+
renderDetailPanel?: (props: {
|
|
74
|
+
row: T;
|
|
75
|
+
}) => ReactNode;
|
|
76
|
+
/** Função para renderizar a barra de ferramentas superior */
|
|
77
|
+
renderTopToolbar?: ReactNode;
|
|
78
|
+
/** Alinhamento da toolbar */
|
|
79
|
+
toolbarAlignment?: 'left' | 'right';
|
|
80
|
+
/** Conteúdo da esquerda da toolbar */
|
|
81
|
+
toolbarLeftContent?: ReactNode;
|
|
82
|
+
/** Função chamada quando as linhas selecionadas mudam */
|
|
83
|
+
onSelectedRowsChanged?: (rows: T[]) => void;
|
|
84
|
+
/** Função chamada quando ocorre duplo clique em uma célula */
|
|
85
|
+
onCellDoubleClick?: (event: CellClickEvent) => void;
|
|
86
|
+
/** Função chamada quando o modelo de filtro da grid muda */
|
|
87
|
+
onFilterModelChange?: (filterModel: any) => void;
|
|
88
|
+
/** Labels para paginação */
|
|
89
|
+
paginationLabels?: {
|
|
90
|
+
totalRecords?: string;
|
|
91
|
+
pageSize?: string;
|
|
92
|
+
currentPage?: string;
|
|
93
|
+
of?: string;
|
|
94
|
+
};
|
|
95
|
+
customRenderRowActions?: (row: T) => ReactNode;
|
|
96
|
+
}
|
|
97
|
+
export interface ArchbaseGridTemplateRef {
|
|
98
|
+
refreshData: () => void;
|
|
99
|
+
getSelectedRows: () => any[];
|
|
100
|
+
clearSelection: () => void;
|
|
101
|
+
exportData: () => void;
|
|
102
|
+
printData: () => void;
|
|
103
|
+
getDataGridRef: () => React.RefObject<ArchbaseDataGridRef>;
|
|
104
|
+
getFilterModel: () => any;
|
|
105
|
+
}
|
|
106
|
+
declare function ArchbaseGridTemplateImpl<T extends object, ID>(props: ArchbaseGridTemplateProps<T, ID>, ref: React.ForwardedRef<ArchbaseGridTemplateRef>): import("react/jsx-runtime").JSX.Element;
|
|
107
|
+
export declare const ArchbaseGridTemplate: <T extends object, ID>(props: ArchbaseGridTemplateProps<T, ID> & {
|
|
108
|
+
ref?: React.ForwardedRef<ArchbaseGridTemplateRef>;
|
|
109
|
+
}) => ReturnType<typeof ArchbaseGridTemplateImpl>;
|
|
110
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { default as React, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { ArchbaseAction, ArchbaseActionButtonsOptions } from '../../components/src';
|
|
3
|
+
import { ComponentDefinition } from '../../core/src';
|
|
4
|
+
import { ArchbaseDataSource } from '../../data/src';
|
|
5
|
+
import { ArchbaseQueryFilterDelegator, FilterOptions } from '../../advanced/src';
|
|
6
|
+
import { ArchbaseSpaceTemplateOptions } from './ArchbaseSpaceTemplate';
|
|
7
|
+
import { ArchbaseDebugOptions, ArchbaseTemplateSecurityProps } from './ArchbaseTemplateCommonTypes';
|
|
8
|
+
export interface MasonryUserActionsOptions {
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
labelAdd?: string | undefined | null;
|
|
11
|
+
labelEdit?: string | undefined | null;
|
|
12
|
+
labelRemove?: string | undefined | null;
|
|
13
|
+
labelView?: string | undefined | null;
|
|
14
|
+
allowAdd?: boolean;
|
|
15
|
+
allowEdit?: boolean;
|
|
16
|
+
allowView?: boolean;
|
|
17
|
+
allowRemove?: boolean;
|
|
18
|
+
onAddExecute?: () => void;
|
|
19
|
+
onEditExecute?: () => void;
|
|
20
|
+
onRemoveExecute?: () => void;
|
|
21
|
+
onViewExecute?: () => void;
|
|
22
|
+
customUserActions?: ArchbaseAction[];
|
|
23
|
+
positionCustomUserActions?: 'before' | 'after';
|
|
24
|
+
}
|
|
25
|
+
export interface MasonryUserRowActionsOptions<T> {
|
|
26
|
+
actions?: any;
|
|
27
|
+
onAddRow?: (row: T) => void;
|
|
28
|
+
onEditRow?: (row: T) => void;
|
|
29
|
+
onRemoveRow?: (row: T) => void;
|
|
30
|
+
onViewRow?: (row: T) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface ArchbaseMasonryTemplateProps<T, ID> extends ArchbaseTemplateSecurityProps {
|
|
33
|
+
title: string;
|
|
34
|
+
dataSource: ArchbaseDataSource<T, ID>;
|
|
35
|
+
dataSourceEdition?: ArchbaseDataSource<T, ID> | undefined;
|
|
36
|
+
filterType: 'none' | 'normal' | 'advanced';
|
|
37
|
+
globalFilterFieldNames?: string[];
|
|
38
|
+
filterOptions: FilterOptions;
|
|
39
|
+
pageSize?: number;
|
|
40
|
+
filterFields: ReactNode | undefined;
|
|
41
|
+
filterPersistenceDelegator: ArchbaseQueryFilterDelegator;
|
|
42
|
+
userActions?: MasonryUserActionsOptions;
|
|
43
|
+
variant?: string;
|
|
44
|
+
/** Referência para o componente interno */
|
|
45
|
+
innerRef?: React.RefObject<HTMLInputElement> | undefined;
|
|
46
|
+
isLoading?: boolean;
|
|
47
|
+
debug?: boolean;
|
|
48
|
+
isError?: boolean;
|
|
49
|
+
error?: string | undefined;
|
|
50
|
+
clearError?: () => void;
|
|
51
|
+
width?: number | string | undefined;
|
|
52
|
+
height?: number | string | undefined;
|
|
53
|
+
withBorder?: boolean;
|
|
54
|
+
withPagination?: boolean;
|
|
55
|
+
radius?: string | number | undefined;
|
|
56
|
+
columnsCountBreakPoints?: Record<number, number>;
|
|
57
|
+
columnsCount?: number;
|
|
58
|
+
gutter?: string;
|
|
59
|
+
/** Definições do componente customizado a ser renderizado para um Item da lista */
|
|
60
|
+
component?: ComponentDefinition;
|
|
61
|
+
id?: string;
|
|
62
|
+
activeIndex?: number;
|
|
63
|
+
/** Cor de fundo do item ativo */
|
|
64
|
+
activeBackgroundColor?: string;
|
|
65
|
+
/** Cor do item ativo */
|
|
66
|
+
activeColor?: string;
|
|
67
|
+
/** Evento gerado quando o mouse está sobre um item */
|
|
68
|
+
onItemEnter?: (event: React.MouseEvent, data: any) => void;
|
|
69
|
+
/** Evento gerado quando o mouse sai de um item */
|
|
70
|
+
onItemLeave?: (event: React.MouseEvent, data: any) => void;
|
|
71
|
+
style?: CSSProperties;
|
|
72
|
+
actionsButtonsOptions?: ArchbaseActionButtonsOptions;
|
|
73
|
+
spaceOptions?: ArchbaseSpaceTemplateOptions;
|
|
74
|
+
debugOptions?: ArchbaseDebugOptions;
|
|
75
|
+
}
|
|
76
|
+
export declare function ArchbaseMasonryTemplate<T extends object, ID>({ title, dataSource, filterOptions, globalFilterFieldNames, filterFields, innerRef, debug, filterType, isError, error, clearError, width, height, withBorder, filterPersistenceDelegator, withPagination, radius, userActions, columnsCountBreakPoints, columnsCount, gutter, component, activeIndex, activeBackgroundColor, activeColor, onItemEnter, onItemLeave, style, actionsButtonsOptions, spaceOptions, variant, id, debugOptions, resourceName, resourceDescription, requiredPermissions, fallbackComponent, securityOptions, }: ArchbaseMasonryTemplateProps<T, ID>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ModalProps } from '@mantine/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ArchbaseTemplateSecurityProps } from './ArchbaseTemplateCommonTypes';
|
|
4
|
+
export interface ArchbaseModalTemplateProps extends ModalProps, ArchbaseTemplateSecurityProps {
|
|
5
|
+
height: string | number | undefined;
|
|
6
|
+
userActions?: ReactNode;
|
|
7
|
+
onlyOkButton?: boolean;
|
|
8
|
+
onClickOk?: () => void;
|
|
9
|
+
onClickCancel?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function ArchbaseModalTemplate({ title, withOverlay, overlayProps, children, withCloseButton, closeButtonProps, opened, fullScreen, centered, variant, closeOnEscape, size, height, onlyOkButton, onClose, onClickOk, onClickCancel, userActions, resourceName, resourceDescription, requiredPermissions, fallbackComponent, securityOptions, }: ArchbaseModalTemplateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ArchbaseAction, ArchbaseActionButtonsOptions } from '../../components/src';
|
|
2
|
+
import { default as React, CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { ArchbaseDataSource } from '../../data/src';
|
|
4
|
+
import { ArchbaseQueryFilterDelegator, FilterOptions } from '../../advanced/src';
|
|
5
|
+
import { ArchbaseSpaceTemplateOptions } from './ArchbaseSpaceTemplate';
|
|
6
|
+
import { ArchbaseDebugOptions, ArchbaseTemplateSecurityProps } from './ArchbaseTemplateCommonTypes';
|
|
7
|
+
export interface PanelUserActionsOptions {
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
labelAdd?: string;
|
|
10
|
+
labelEdit?: string;
|
|
11
|
+
labelRemove?: string;
|
|
12
|
+
labelView?: string;
|
|
13
|
+
allowAdd?: boolean;
|
|
14
|
+
allowEdit?: boolean;
|
|
15
|
+
allowView?: boolean;
|
|
16
|
+
allowRemove?: boolean;
|
|
17
|
+
onAddExecute?: () => void;
|
|
18
|
+
onEditExecute?: () => void;
|
|
19
|
+
onRemoveExecute?: () => void;
|
|
20
|
+
onView?: () => void;
|
|
21
|
+
customUserActions?: ArchbaseAction[];
|
|
22
|
+
positionCustomUserActions?: 'before' | 'after';
|
|
23
|
+
}
|
|
24
|
+
export interface PanelUserRowActionsOptions<T> {
|
|
25
|
+
actions?: any;
|
|
26
|
+
onAddRow?: (row: T) => void;
|
|
27
|
+
onEditRow?: (row: T) => void;
|
|
28
|
+
onRemoveRow?: (row: T) => void;
|
|
29
|
+
onViewRow?: (row: T) => void;
|
|
30
|
+
variant?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ArchbasePanelTemplateProps<T, ID> extends ArchbaseTemplateSecurityProps {
|
|
33
|
+
title: string;
|
|
34
|
+
dataSource: ArchbaseDataSource<T, ID>;
|
|
35
|
+
dataSourceEdition?: ArchbaseDataSource<T, ID> | undefined;
|
|
36
|
+
variant?: string;
|
|
37
|
+
filterOptions: FilterOptions;
|
|
38
|
+
pageSize?: number;
|
|
39
|
+
filterFields: ReactNode | undefined;
|
|
40
|
+
filterPersistenceDelegator: ArchbaseQueryFilterDelegator;
|
|
41
|
+
userActions?: PanelUserActionsOptions;
|
|
42
|
+
/** Referência para o componente interno */
|
|
43
|
+
innerRef?: React.RefObject<HTMLInputElement> | undefined;
|
|
44
|
+
isLoading?: boolean;
|
|
45
|
+
isError?: boolean;
|
|
46
|
+
error?: string | undefined;
|
|
47
|
+
clearError?: () => void;
|
|
48
|
+
width?: number | string | undefined;
|
|
49
|
+
height?: number | string | undefined;
|
|
50
|
+
withBorder?: boolean;
|
|
51
|
+
withPagination?: boolean;
|
|
52
|
+
children?: React.ReactNode;
|
|
53
|
+
radius?: number | string | undefined;
|
|
54
|
+
debug?: boolean;
|
|
55
|
+
actionsButtonsOptions?: ArchbaseActionButtonsOptions;
|
|
56
|
+
spaceOptions?: ArchbaseSpaceTemplateOptions;
|
|
57
|
+
style?: CSSProperties;
|
|
58
|
+
debugOptions?: ArchbaseDebugOptions;
|
|
59
|
+
}
|
|
60
|
+
export declare function ArchbasePanelTemplate<T extends object, ID>({ title, dataSource, filterOptions, filterFields, innerRef, isError, error, clearError, width, height, withBorder, filterPersistenceDelegator, withPagination, children, radius, userActions, debug, variant, actionsButtonsOptions, spaceOptions, style, debugOptions, resourceName, resourceDescription, requiredPermissions, fallbackComponent, securityOptions, }: ArchbasePanelTemplateProps<T, ID>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ArchbaseSearchTemplate(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { AlertVariant, StyleProp, GridColProps } from '@mantine/core';
|
|
2
|
+
import { default as React, CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { ArchbaseDebugOptions, ArchbaseTemplateSecurityProps } from './ArchbaseTemplateCommonTypes';
|
|
4
|
+
type ColSpan = GridColProps['span'];
|
|
5
|
+
interface ArchbaseBreakpointsColSpans {
|
|
6
|
+
/** Col span em (min-width: theme.breakpoints.xs) */
|
|
7
|
+
xs?: ColSpan;
|
|
8
|
+
/** Col span em (min-width: theme.breakpoints.sm) */
|
|
9
|
+
sm?: ColSpan;
|
|
10
|
+
/** Col span em (min-width: theme.breakpoints.md) */
|
|
11
|
+
md?: ColSpan;
|
|
12
|
+
/** Col span em (min-width: theme.breakpoints.lg) */
|
|
13
|
+
lg?: ColSpan;
|
|
14
|
+
/** Col span em (min-width: theme.breakpoints.xl) */
|
|
15
|
+
xl?: ColSpan;
|
|
16
|
+
}
|
|
17
|
+
export interface ArchbaseSpaceTemplateOptions {
|
|
18
|
+
/** Indicar qual lado do header irá crescer para preencher o espaço sobrando (Válido somente quando headerGridColumns não é atribuído ao options) */
|
|
19
|
+
headerFlexGrow?: 'left' | 'even' | 'right';
|
|
20
|
+
/** Justificar o conteúdo interno da parte direita do header.*/
|
|
21
|
+
headerFlexRightJustifyContent?: StyleProp<React.CSSProperties['justifyContent']>;
|
|
22
|
+
/** Justificar o conteúdo interno da parte esquerda do header.*/
|
|
23
|
+
headerFlexLeftJustifyContent?: StyleProp<React.CSSProperties['justifyContent']>;
|
|
24
|
+
/** Indicar os ColSpan das grids para cada parte do header (left, middle, right) de acordo com os breakpoints */
|
|
25
|
+
headerGridColumns?: {
|
|
26
|
+
right?: ArchbaseBreakpointsColSpans;
|
|
27
|
+
middle?: ArchbaseBreakpointsColSpans;
|
|
28
|
+
left?: ArchbaseBreakpointsColSpans;
|
|
29
|
+
};
|
|
30
|
+
/** Indicar qual lado do footer irá crescer para preencher o espaço sobrando (Válido somente quando footerGridColumns não é atribuído ao options) */
|
|
31
|
+
footerFlexGrow?: 'left' | 'even' | 'right';
|
|
32
|
+
/** Justificar o conteúdo interno da parte direita do footer.*/
|
|
33
|
+
footerFlexRightJustifyContent?: StyleProp<React.CSSProperties['justifyContent']>;
|
|
34
|
+
/** Justificar o conteúdo interno da parte esquerda do footer.*/
|
|
35
|
+
footerFlexLeftJustifyContent?: StyleProp<React.CSSProperties['justifyContent']>;
|
|
36
|
+
/** Indicar os ColSpan das grids para cada parte do footer (left, middle, right) de acordo com os breakpoints */
|
|
37
|
+
footerGridColumns?: {
|
|
38
|
+
right?: ArchbaseBreakpointsColSpans;
|
|
39
|
+
middle?: ArchbaseBreakpointsColSpans;
|
|
40
|
+
left?: ArchbaseBreakpointsColSpans;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface ArchbaseSpaceTemplateProps<T, ID> extends ArchbaseTemplateSecurityProps {
|
|
44
|
+
title: string;
|
|
45
|
+
variant?: AlertVariant | string;
|
|
46
|
+
headerLeft?: ReactNode;
|
|
47
|
+
headerMiddle?: ReactNode;
|
|
48
|
+
headerRight?: ReactNode;
|
|
49
|
+
footerLeft?: ReactNode;
|
|
50
|
+
footerMiddle?: ReactNode;
|
|
51
|
+
footerRight?: ReactNode;
|
|
52
|
+
/** Referência para o componente interno */
|
|
53
|
+
innerRef?: React.RefObject<HTMLInputElement> | undefined;
|
|
54
|
+
width?: number | string | undefined;
|
|
55
|
+
height?: number | string | undefined;
|
|
56
|
+
withBorder?: boolean;
|
|
57
|
+
children?: React.ReactNode;
|
|
58
|
+
radius?: string | number | undefined;
|
|
59
|
+
debug?: boolean;
|
|
60
|
+
defaultDebug?: boolean;
|
|
61
|
+
isError?: boolean;
|
|
62
|
+
error?: string | undefined;
|
|
63
|
+
clearError?: () => void;
|
|
64
|
+
/** Opções de personalização */
|
|
65
|
+
options?: ArchbaseSpaceTemplateOptions;
|
|
66
|
+
style?: CSSProperties;
|
|
67
|
+
debugOptions?: ArchbaseDebugOptions;
|
|
68
|
+
}
|
|
69
|
+
export declare function ArchbaseSpaceTemplate<T extends object, ID>({ title, innerRef, isError, error, clearError, width, height, withBorder, children, radius, debug, defaultDebug, headerLeft, headerMiddle, headerRight, footerLeft, footerMiddle, footerRight, variant, options, style, debugOptions, resourceName, resourceDescription, requiredPermissions, fallbackComponent, securityOptions, }: ArchbaseSpaceTemplateProps<T, ID>): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ArchbaseStateValues = {
|
|
2
|
+
values: Map<string, any>;
|
|
3
|
+
setValue: (key: string, value: any) => void;
|
|
4
|
+
getValue: (key: any) => any;
|
|
5
|
+
existsValue: (key: string) => boolean;
|
|
6
|
+
clearValue: (key: string) => void;
|
|
7
|
+
clearAllValues: () => void;
|
|
8
|
+
reset: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ArchbaseObjectToInspect } from '../../components/src';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface ArchbaseDebugOptions {
|
|
4
|
+
debugLayoutHotKey?: string;
|
|
5
|
+
debugObjectInspectorHotKey?: string;
|
|
6
|
+
objectsToInspect?: ArchbaseObjectToInspect[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Props opcionais para integração de segurança em templates
|
|
10
|
+
* Completamente opcionais - se não fornecidas, template funciona normalmente
|
|
11
|
+
*/
|
|
12
|
+
export interface ArchbaseTemplateSecurityProps {
|
|
13
|
+
/** Nome do recurso - SE definido, ativa segurança */
|
|
14
|
+
resourceName?: string;
|
|
15
|
+
/** Descrição do recurso - opcional */
|
|
16
|
+
resourceDescription?: string;
|
|
17
|
+
/** Permissões obrigatórias - só válido SE resourceName definido */
|
|
18
|
+
requiredPermissions?: string[];
|
|
19
|
+
/** Fallback para acesso negado - só usado SE segurança ativa */
|
|
20
|
+
fallbackComponent?: ReactNode;
|
|
21
|
+
/** Configurações avançadas - só funciona SE segurança ativa */
|
|
22
|
+
securityOptions?: {
|
|
23
|
+
autoRegisterActions?: boolean;
|
|
24
|
+
strictMode?: boolean;
|
|
25
|
+
onSecurityReady?: (manager: any) => void;
|
|
26
|
+
onAccessDenied?: () => void;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ArchbaseRemoteDataSource } from '../../data/src';
|
|
2
|
+
export type ArchbaseTemplateState<T, ID> = {
|
|
3
|
+
dataSource?: ArchbaseRemoteDataSource<T, ID>;
|
|
4
|
+
dataSourceEdition?: ArchbaseRemoteDataSource<T, ID>;
|
|
5
|
+
setDataSource: (ds: ArchbaseRemoteDataSource<T, ID>) => void;
|
|
6
|
+
setDataSourceEdition: (ds: ArchbaseRemoteDataSource<T, ID>) => void;
|
|
7
|
+
clearDataSource: () => void;
|
|
8
|
+
clearDataSourceEdition: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Wrapper ultra-leve que aplica segurança condicionalmente
|
|
4
|
+
* Se não tem resourceName ou contexto de segurança, apenas renderiza children
|
|
5
|
+
* Se tem ambos, envolve com ArchbaseViewSecurityProvider
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANTE: Este componente é otimizado para evitar re-renders desnecessários
|
|
8
|
+
*/
|
|
9
|
+
interface ConditionalSecurityWrapperProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** Se não fornecido, não envolve com segurança */
|
|
12
|
+
resourceName?: string;
|
|
13
|
+
/** Descrição opcional do recurso */
|
|
14
|
+
resourceDescription?: string;
|
|
15
|
+
/** Permissões obrigatórias para acessar */
|
|
16
|
+
requiredPermissions?: string[];
|
|
17
|
+
/** Componente de fallback se acesso negado */
|
|
18
|
+
fallbackComponent?: ReactNode;
|
|
19
|
+
/** Callback quando segurança está pronta */
|
|
20
|
+
onSecurityReady?: (manager: any) => void;
|
|
21
|
+
/** Callback quando acesso negado */
|
|
22
|
+
onAccessDenied?: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const ArchbaseConditionalSecurityWrapper: React.FC<ConditionalSecurityWrapperProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Hook para verificar se deve aplicar wrapper de segurança
|
|
27
|
+
* IMPORTANTE: Retorna valor estável para evitar re-renders infinitos
|
|
28
|
+
*/
|
|
29
|
+
export declare const useConditionalSecurity: (resourceName?: string) => {
|
|
30
|
+
shouldWrap: boolean;
|
|
31
|
+
isSecurityAvailable: boolean;
|
|
32
|
+
hasResourceName: boolean;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '@mantine/core';
|
|
3
|
+
/**
|
|
4
|
+
* Botão inteligente que detecta contexto de segurança
|
|
5
|
+
* Se não tem contexto ou ação não especificada, renderiza botão normal
|
|
6
|
+
* Se tem contexto e ação, verifica permissão antes de renderizar
|
|
7
|
+
*/
|
|
8
|
+
interface ArchbaseSmartActionButtonProps extends Omit<ButtonProps, 'onClick'> {
|
|
9
|
+
/** Nome da ação para verificar permissão - se não fornecido, sempre renderiza */
|
|
10
|
+
actionName?: string;
|
|
11
|
+
/** Descrição da ação para auto-registro */
|
|
12
|
+
actionDescription?: string;
|
|
13
|
+
/** Conteúdo do botão */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** Componente alternativo se não tem permissão */
|
|
16
|
+
fallback?: ReactNode;
|
|
17
|
+
/** Se deve auto-registrar a ação */
|
|
18
|
+
autoRegister?: boolean;
|
|
19
|
+
/** Função onClick */
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const ArchbaseSmartActionButton: React.FC<ArchbaseSmartActionButtonProps>;
|
|
23
|
+
/**
|
|
24
|
+
* Versão mais avançada que usa diretamente o sistema de segurança quando disponível
|
|
25
|
+
*/
|
|
26
|
+
export declare const ArchbaseAdvancedSmartButton: React.FC<ArchbaseSmartActionButtonProps>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useOptionalTemplateSecurity';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook que funciona com ou sem contexto de segurança
|
|
3
|
+
* Se não há contexto de segurança, sempre retorna true (permite tudo)
|
|
4
|
+
* Se há contexto de segurança, usa as verificações reais
|
|
5
|
+
*
|
|
6
|
+
* IMPORTANTE: Retorna objeto estável para evitar re-renders infinitos
|
|
7
|
+
*/
|
|
8
|
+
export declare const useOptionalTemplateSecurity: (config?: {
|
|
9
|
+
resourceName?: string;
|
|
10
|
+
resourceDescription?: string;
|
|
11
|
+
autoRegisterActions?: boolean;
|
|
12
|
+
}) => {
|
|
13
|
+
readonly isAvailable: false;
|
|
14
|
+
readonly hasPermission: () => boolean;
|
|
15
|
+
readonly registerAction: () => void;
|
|
16
|
+
readonly canCreate: true;
|
|
17
|
+
readonly canEdit: true;
|
|
18
|
+
readonly canDelete: true;
|
|
19
|
+
readonly canView: true;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Hook mais direto para verificar se contexto de segurança está disponível
|
|
23
|
+
* IMPORTANTE: Retorna valor estável para evitar re-renders
|
|
24
|
+
*/
|
|
25
|
+
export declare const useTemplateSecurityAvailable: () => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './ArchbaseFormTemplate';
|
|
2
|
+
export * from './ArchbaseFormModalTemplate';
|
|
3
|
+
export * from './ArchbaseModalTemplate';
|
|
4
|
+
export * from './ArchbaseGridTemplate';
|
|
5
|
+
export * from './ArchbaseMasonryTemplate';
|
|
6
|
+
export * from './ArchbasePanelTemplate';
|
|
7
|
+
export * from './ArchbaseSpaceTemplate';
|
|
8
|
+
export * from './ArchbaseSearchTemplate';
|
|
9
|
+
export * from './ArchbaseTemplateCommonTypes';
|
|
10
|
+
export * from './ArchbaseTemplateState';
|
|
11
|
+
export * from './ArchbaseStateValues';
|
|
12
|
+
export * from './components';
|
|
13
|
+
export * from './hooks';
|
|
14
|
+
export * from './validation/ValidationErrorsContext';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ValidationErrorsContextType {
|
|
3
|
+
errors: Record<string, string>;
|
|
4
|
+
setError: (field: string, error: string) => void;
|
|
5
|
+
clearError: (field: string) => void;
|
|
6
|
+
clearAll: () => void;
|
|
7
|
+
getError: (field: string) => string | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Provider para gerenciar erros de validação de formulários
|
|
11
|
+
* Armazena erros em um estado global que sobrevive a unmounts de componentes
|
|
12
|
+
*/
|
|
13
|
+
export declare function ValidationErrorsProvider({ children }: {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Hook para acessar o contexto de erros de validação
|
|
18
|
+
* Retorna undefined se o contexto não estiver disponível (para compatibilidade)
|
|
19
|
+
*/
|
|
20
|
+
export declare function useValidationErrors(): ValidationErrorsContextType | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Hook que sempre retorna um contexto de erros (cria um vazio se não existir)
|
|
23
|
+
* Use quando você PRECISA do contexto
|
|
24
|
+
*/
|
|
25
|
+
export declare function useRequiredValidationErrors(): ValidationErrorsContextType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archbase/template",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Template components for Archbase React v3 - High-level templates and layouts",
|
|
5
5
|
"author": "Edson Martins <edsonmartins2005@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,48 +13,50 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
15
|
"require": "./dist/index.js"
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"./dist/index.css": "./dist/index.css"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"dist",
|
|
20
21
|
"README.md"
|
|
21
22
|
],
|
|
22
23
|
"peerDependencies": {
|
|
23
|
-
"react": "^18.3.0 || ^19.0.0",
|
|
24
|
-
"react-dom": "^18.3.0 || ^19.0.0",
|
|
25
24
|
"@mantine/core": "8.3.12",
|
|
26
25
|
"@mantine/dates": "8.3.12",
|
|
27
26
|
"@mantine/hooks": "8.3.12",
|
|
28
27
|
"@mantine/modals": "8.3.12",
|
|
29
|
-
"@tabler/icons-react": "^3.26.0"
|
|
28
|
+
"@tabler/icons-react": "^3.26.0",
|
|
29
|
+
"react": "^18.3.0 || ^19.2.0",
|
|
30
|
+
"react-dom": "^18.3.0 || ^19.2.0"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
33
|
+
"@archbase/advanced": "3.0.2",
|
|
34
|
+
"@archbase/components": "3.0.2",
|
|
35
|
+
"@archbase/core": "3.0.2",
|
|
36
|
+
"@archbase/data": "3.0.2",
|
|
37
|
+
"@archbase/layout": "3.0.2",
|
|
38
|
+
"@archbase/security": "3.0.2",
|
|
39
|
+
"@archbase/security-ui": "3.0.2",
|
|
40
|
+
"@rehooks/component-size": "^1.0.3",
|
|
32
41
|
"dayjs": "^1.11.13",
|
|
33
42
|
"i18next": "^25.3.1",
|
|
34
|
-
"react-i18next": "^15.1.2",
|
|
35
43
|
"lodash": "^4.17.21",
|
|
36
|
-
"
|
|
37
|
-
"@archbase/core": "3.0.0",
|
|
38
|
-
"@archbase/data": "3.0.0",
|
|
39
|
-
"@archbase/layout": "3.0.0",
|
|
40
|
-
"@archbase/advanced": "3.0.0",
|
|
41
|
-
"@archbase/components": "3.0.0",
|
|
42
|
-
"@archbase/security": "3.0.0",
|
|
43
|
-
"@archbase/security-ui": "3.0.0"
|
|
44
|
+
"react-i18next": "^15.1.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@types/react": "^19.0.
|
|
47
|
+
"@types/react": "^19.0.6",
|
|
47
48
|
"@types/react-dom": "^19.0.2",
|
|
48
49
|
"@vitejs/plugin-react": "^4.3.4",
|
|
49
|
-
"react": "^19.
|
|
50
|
-
"react-dom": "^19.
|
|
50
|
+
"react": "^19.2.3",
|
|
51
|
+
"react-dom": "^19.2.3",
|
|
51
52
|
"typescript": "~5.7.2",
|
|
52
53
|
"vite": "^6.0.3",
|
|
54
|
+
"vite-plugin-dts": "^4.5.4",
|
|
53
55
|
"vitest": "^2.1.8"
|
|
54
56
|
},
|
|
55
57
|
"scripts": {
|
|
56
58
|
"dev": "NODE_OPTIONS=\"--max-old-space-size=16384\" vite build --watch",
|
|
57
|
-
"build": "NODE_OPTIONS=\"--max-old-space-size=16384\" vite build
|
|
59
|
+
"build": "NODE_OPTIONS=\"--max-old-space-size=16384\" vite build",
|
|
58
60
|
"test": "vitest run",
|
|
59
61
|
"test:watch": "vitest",
|
|
60
62
|
"test:coverage": "vitest run --coverage",
|