@archbase/template 3.0.0 → 3.0.3

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.
@@ -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,122 @@
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
+ /** Largura da coluna de ações. Default: 60 */
71
+ actionsColumnWidth?: number;
72
+ /** Padding da célula do cabeçalho da tabela */
73
+ tableHeadCellPadding?: string;
74
+ /** Função para renderizar o painel de detalhes */
75
+ renderDetailPanel?: (props: {
76
+ row: T;
77
+ }) => ReactNode;
78
+ /** Função para renderizar a barra de ferramentas superior */
79
+ renderTopToolbar?: ReactNode;
80
+ /** Alinhamento da toolbar */
81
+ toolbarAlignment?: 'left' | 'right';
82
+ /** Conteúdo da esquerda da toolbar */
83
+ toolbarLeftContent?: ReactNode;
84
+ /** Função chamada quando as linhas selecionadas mudam */
85
+ onSelectedRowsChanged?: (rows: T[]) => void;
86
+ /** Função chamada quando ocorre duplo clique em uma célula */
87
+ onCellDoubleClick?: (event: CellClickEvent) => void;
88
+ /** Função chamada quando o modelo de filtro da grid muda */
89
+ onFilterModelChange?: (filterModel: any) => void;
90
+ /** Labels para paginação */
91
+ paginationLabels?: {
92
+ totalRecords?: string;
93
+ pageSize?: string;
94
+ currentPage?: string;
95
+ of?: string;
96
+ };
97
+ customRenderRowActions?: (row: T) => ReactNode;
98
+ /** Exibir borda inferior da toolbar. Default: true */
99
+ withToolbarBorder?: boolean;
100
+ /** Exibir borda superior da paginação. Default: true */
101
+ withPaginationBorder?: boolean;
102
+ /** Padding da toolbar. Default: '8px 12px' */
103
+ toolbarPadding?: string | number;
104
+ /** Padding da paginação. Default: '8px 12px' */
105
+ paginationPadding?: string | number;
106
+ /** Altura das linhas da grid. Default: 52 */
107
+ rowHeight?: number;
108
+ }
109
+ export interface ArchbaseGridTemplateRef {
110
+ refreshData: () => void;
111
+ getSelectedRows: () => any[];
112
+ clearSelection: () => void;
113
+ exportData: () => void;
114
+ printData: () => void;
115
+ getDataGridRef: () => React.RefObject<ArchbaseDataGridRef>;
116
+ getFilterModel: () => any;
117
+ }
118
+ declare function ArchbaseGridTemplateImpl<T extends object, ID>(props: ArchbaseGridTemplateProps<T, ID>, ref: React.ForwardedRef<ArchbaseGridTemplateRef>): import("react/jsx-runtime").JSX.Element;
119
+ export declare const ArchbaseGridTemplate: <T extends object, ID>(props: ArchbaseGridTemplateProps<T, ID> & {
120
+ ref?: React.ForwardedRef<ArchbaseGridTemplateRef>;
121
+ }) => ReturnType<typeof ArchbaseGridTemplateImpl>;
122
+ 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,2 @@
1
+ export * from './ArchbaseSmartActionButton';
2
+ export * from './ArchbaseConditionalSecurityWrapper';
@@ -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;