@pubflow/react 0.1.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/LICENSE +661 -0
- package/README.md +539 -0
- package/dist/index.d.ts +1908 -0
- package/dist/index.esm.js +9922 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +9954 -0
- package/dist/index.js.map +1 -0
- package/dist/types/components/AdvancedFilter.d.ts +113 -0
- package/dist/types/components/BridgeForm/index.d.ts +6 -0
- package/dist/types/components/BridgeForm/styles.d.ts +62 -0
- package/dist/types/components/BridgeForm/types.d.ts +128 -0
- package/dist/types/components/BridgeForm/utils.d.ts +60 -0
- package/dist/types/components/BridgeList.d.ts +157 -0
- package/dist/types/components/BridgeTable.d.ts +110 -0
- package/dist/types/components/BridgeView.d.ts +39 -0
- package/dist/types/components/OfflineIndicator.d.ts +58 -0
- package/dist/types/components/auth/AccountCreationForm.d.ts +60 -0
- package/dist/types/components/auth/LoginForm.d.ts +76 -0
- package/dist/types/components/auth/PasswordResetForm.d.ts +60 -0
- package/dist/types/components/auth/index.d.ts +8 -0
- package/dist/types/components/theme/ThemeProvider.d.ts +255 -0
- package/dist/types/components/theme/index.d.ts +6 -0
- package/dist/types/context/PubflowProvider.d.ts +100 -0
- package/dist/types/hooks/useAuth.d.ts +32 -0
- package/dist/types/hooks/useBridgeApi.d.ts +14 -0
- package/dist/types/hooks/useBridgeApiRaw.d.ts +91 -0
- package/dist/types/hooks/useBridgeCrud.d.ts +193 -0
- package/dist/types/hooks/useBridgeMutation.d.ts +69 -0
- package/dist/types/hooks/useBridgeQuery.d.ts +44 -0
- package/dist/types/hooks/useSearchQueryBuilder.d.ts +152 -0
- package/dist/types/hooks/useServerAuth.d.ts +45 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/storage/BrowserStorageAdapter.d.ts +112 -0
- package/dist/types/test/setup.d.ts +4 -0
- package/dist/types/utils/auth-utils.d.ts +37 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/persistent-cache.d.ts +57 -0
- package/package.json +70 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advanced Filter Component for React
|
|
3
|
+
*
|
|
4
|
+
* Provides advanced filtering capabilities for BridgeList
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { FilterOperator, FilterDefinition } from '@pubflow/core';
|
|
8
|
+
/**
|
|
9
|
+
* Filter field definition
|
|
10
|
+
*/
|
|
11
|
+
export interface FilterField {
|
|
12
|
+
/**
|
|
13
|
+
* Field name
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Display label
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* Field type
|
|
22
|
+
*/
|
|
23
|
+
type: 'text' | 'number' | 'date' | 'boolean' | 'select';
|
|
24
|
+
/**
|
|
25
|
+
* Options for select type
|
|
26
|
+
*/
|
|
27
|
+
options?: {
|
|
28
|
+
label: string;
|
|
29
|
+
value: any;
|
|
30
|
+
}[];
|
|
31
|
+
/**
|
|
32
|
+
* Allowed operators
|
|
33
|
+
*/
|
|
34
|
+
operators?: FilterOperator[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Advanced filter texts
|
|
38
|
+
*/
|
|
39
|
+
export interface AdvancedFilterTexts {
|
|
40
|
+
title?: string;
|
|
41
|
+
addFilter?: string;
|
|
42
|
+
resetFilters?: string;
|
|
43
|
+
apply?: string;
|
|
44
|
+
cancel?: string;
|
|
45
|
+
field?: string;
|
|
46
|
+
operator?: string;
|
|
47
|
+
value?: string;
|
|
48
|
+
filterButton?: string;
|
|
49
|
+
activeFilters?: string;
|
|
50
|
+
noActiveFilters?: string;
|
|
51
|
+
selectField?: string;
|
|
52
|
+
selectOperator?: string;
|
|
53
|
+
enterValue?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Advanced filter colors
|
|
57
|
+
*/
|
|
58
|
+
export interface AdvancedFilterColors {
|
|
59
|
+
primary?: string;
|
|
60
|
+
secondary?: string;
|
|
61
|
+
background?: string;
|
|
62
|
+
surface?: string;
|
|
63
|
+
text?: string;
|
|
64
|
+
textSecondary?: string;
|
|
65
|
+
border?: string;
|
|
66
|
+
error?: string;
|
|
67
|
+
success?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Advanced filter props
|
|
71
|
+
*/
|
|
72
|
+
export interface AdvancedFilterProps {
|
|
73
|
+
/**
|
|
74
|
+
* Available filter fields
|
|
75
|
+
*/
|
|
76
|
+
fields: FilterField[];
|
|
77
|
+
/**
|
|
78
|
+
* Current filters
|
|
79
|
+
*/
|
|
80
|
+
filters: FilterDefinition[];
|
|
81
|
+
/**
|
|
82
|
+
* Add filter callback
|
|
83
|
+
*/
|
|
84
|
+
onAddFilter: (filter: FilterDefinition) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Remove filter callback
|
|
87
|
+
*/
|
|
88
|
+
onRemoveFilter: (index: number) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Reset filters callback
|
|
91
|
+
*/
|
|
92
|
+
onResetFilters: () => void;
|
|
93
|
+
/**
|
|
94
|
+
* Container style
|
|
95
|
+
*/
|
|
96
|
+
style?: React.CSSProperties;
|
|
97
|
+
/**
|
|
98
|
+
* Custom texts
|
|
99
|
+
*/
|
|
100
|
+
texts?: AdvancedFilterTexts;
|
|
101
|
+
/**
|
|
102
|
+
* Custom colors
|
|
103
|
+
*/
|
|
104
|
+
colors?: AdvancedFilterColors;
|
|
105
|
+
/**
|
|
106
|
+
* Custom CSS class
|
|
107
|
+
*/
|
|
108
|
+
className?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Advanced Filter component
|
|
112
|
+
*/
|
|
113
|
+
export declare function AdvancedFilter({ fields, filters, onAddFilter, onRemoveFilter, onResetFilters, style, texts, colors, className }: AdvancedFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BridgeFormProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* BridgeForm component
|
|
4
|
+
*/
|
|
5
|
+
export declare function BridgeForm<T extends Record<string, any>>({ schema, mode, entityConfig, instanceId, initialData, id, fields, layout, onSuccess, onError, onCancel, labels, theme, mainColor, className, style, customStyles }: BridgeFormProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export * from './types';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for BridgeForm component
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base styles for the form and its elements
|
|
6
|
+
*/
|
|
7
|
+
export declare const baseStyles: {
|
|
8
|
+
form: string;
|
|
9
|
+
formLight: string;
|
|
10
|
+
formDark: string;
|
|
11
|
+
fieldsContainer: string;
|
|
12
|
+
field: string;
|
|
13
|
+
label: string;
|
|
14
|
+
labelLight: string;
|
|
15
|
+
labelDark: string;
|
|
16
|
+
description: string;
|
|
17
|
+
descriptionLight: string;
|
|
18
|
+
descriptionDark: string;
|
|
19
|
+
input: string;
|
|
20
|
+
inputLight: string;
|
|
21
|
+
inputDark: string;
|
|
22
|
+
textarea: string;
|
|
23
|
+
textareaLight: string;
|
|
24
|
+
textareaDark: string;
|
|
25
|
+
select: string;
|
|
26
|
+
selectLight: string;
|
|
27
|
+
selectDark: string;
|
|
28
|
+
checkboxContainer: string;
|
|
29
|
+
checkbox: string;
|
|
30
|
+
checkboxLight: string;
|
|
31
|
+
checkboxDark: string;
|
|
32
|
+
checkboxLabel: string;
|
|
33
|
+
checkboxLabelLight: string;
|
|
34
|
+
checkboxLabelDark: string;
|
|
35
|
+
radioContainer: string;
|
|
36
|
+
radioOption: string;
|
|
37
|
+
radio: string;
|
|
38
|
+
radioLight: string;
|
|
39
|
+
radioDark: string;
|
|
40
|
+
radioLabel: string;
|
|
41
|
+
radioLabelLight: string;
|
|
42
|
+
radioLabelDark: string;
|
|
43
|
+
error: string;
|
|
44
|
+
errorLight: string;
|
|
45
|
+
errorDark: string;
|
|
46
|
+
buttonsContainer: string;
|
|
47
|
+
button: string;
|
|
48
|
+
primaryButton: string;
|
|
49
|
+
primaryButtonDark: string;
|
|
50
|
+
secondaryButton: string;
|
|
51
|
+
secondaryButtonDark: string;
|
|
52
|
+
loading: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Combines base styles with theme-specific styles
|
|
56
|
+
* @param base Base style
|
|
57
|
+
* @param light Light theme style
|
|
58
|
+
* @param dark Dark theme style
|
|
59
|
+
* @param isDarkMode Whether dark mode is active
|
|
60
|
+
* @returns Combined style string
|
|
61
|
+
*/
|
|
62
|
+
export declare function getThemedStyle(base: string, light: string, dark: string, isDarkMode: boolean): string;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for BridgeForm component
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { EntityConfig } from '@pubflow/core';
|
|
7
|
+
/**
|
|
8
|
+
* Field configuration for BridgeForm
|
|
9
|
+
*/
|
|
10
|
+
export interface FieldConfig {
|
|
11
|
+
/** Field name (must exist in the schema) */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Custom label (defaults to formatted field name) */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Placeholder text */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** Help text description */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Field type */
|
|
20
|
+
type?: 'text' | 'number' | 'email' | 'password' | 'select' | 'checkbox' | 'radio' | 'date' | 'textarea' | 'file' | 'color' | 'range' | 'hidden';
|
|
21
|
+
/** Options for select/radio fields */
|
|
22
|
+
options?: Array<{
|
|
23
|
+
value: any;
|
|
24
|
+
label: string;
|
|
25
|
+
}>;
|
|
26
|
+
/** Field width (%, px, etc.) */
|
|
27
|
+
width?: string;
|
|
28
|
+
/** Whether the field should be hidden */
|
|
29
|
+
hidden?: boolean;
|
|
30
|
+
/** Whether the field should be disabled */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Default value */
|
|
33
|
+
defaultValue?: any;
|
|
34
|
+
/** Whether the field should have autofocus */
|
|
35
|
+
autoFocus?: boolean;
|
|
36
|
+
/** Custom CSS class */
|
|
37
|
+
className?: string;
|
|
38
|
+
/** Inline styles */
|
|
39
|
+
style?: CSSProperties;
|
|
40
|
+
/** Custom render function */
|
|
41
|
+
render?: (props: FieldRenderProps) => ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Props for custom field rendering
|
|
45
|
+
*/
|
|
46
|
+
export interface FieldRenderProps {
|
|
47
|
+
/** Field configuration */
|
|
48
|
+
field: FieldConfig;
|
|
49
|
+
/** Current field value */
|
|
50
|
+
value: any;
|
|
51
|
+
/** Function to change value */
|
|
52
|
+
onChange: (value: any) => void;
|
|
53
|
+
/** Function for blur event */
|
|
54
|
+
onBlur: () => void;
|
|
55
|
+
/** Validation error if any */
|
|
56
|
+
error?: string;
|
|
57
|
+
/** Whether the field is required */
|
|
58
|
+
required: boolean;
|
|
59
|
+
/** Whether the field is disabled */
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
/** Whether dark mode is active */
|
|
62
|
+
isDarkMode: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* BridgeForm component props
|
|
66
|
+
*/
|
|
67
|
+
export interface BridgeFormProps<T extends Record<string, any>> {
|
|
68
|
+
/** Zod schema for validation */
|
|
69
|
+
schema: z.ZodType<T>;
|
|
70
|
+
/** Form mode */
|
|
71
|
+
mode: 'create' | 'update' | 'partial';
|
|
72
|
+
/** Entity configuration for BridgeApi */
|
|
73
|
+
entityConfig: EntityConfig;
|
|
74
|
+
/** Pubflow instance ID */
|
|
75
|
+
instanceId?: string;
|
|
76
|
+
/** Initial data (for update/partial mode) */
|
|
77
|
+
initialData?: Partial<T>;
|
|
78
|
+
/** Record ID (for update/partial mode) */
|
|
79
|
+
id?: string;
|
|
80
|
+
/** Fields to display (all schema fields by default) */
|
|
81
|
+
fields?: FieldConfig[];
|
|
82
|
+
/** Layout configuration */
|
|
83
|
+
layout?: {
|
|
84
|
+
/** Number of columns or responsive configuration */
|
|
85
|
+
columns?: number | {
|
|
86
|
+
sm?: number;
|
|
87
|
+
md?: number;
|
|
88
|
+
lg?: number;
|
|
89
|
+
};
|
|
90
|
+
/** Gap between fields */
|
|
91
|
+
gap?: string;
|
|
92
|
+
};
|
|
93
|
+
/** Success callback */
|
|
94
|
+
onSuccess?: (data: T) => void;
|
|
95
|
+
/** Error callback */
|
|
96
|
+
onError?: (error: Error) => void;
|
|
97
|
+
/** Cancel callback */
|
|
98
|
+
onCancel?: () => void;
|
|
99
|
+
/** Custom labels */
|
|
100
|
+
labels?: {
|
|
101
|
+
/** Submit button text */
|
|
102
|
+
submit?: string;
|
|
103
|
+
/** Cancel button text */
|
|
104
|
+
cancel?: string;
|
|
105
|
+
/** Required field indicator text */
|
|
106
|
+
required?: string;
|
|
107
|
+
};
|
|
108
|
+
/** Theme */
|
|
109
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
110
|
+
/** Main color for the form (buttons, focus rings, etc.) */
|
|
111
|
+
mainColor?: string;
|
|
112
|
+
/** Custom CSS class */
|
|
113
|
+
className?: string;
|
|
114
|
+
/** Inline styles */
|
|
115
|
+
style?: CSSProperties;
|
|
116
|
+
/** Custom styles for form elements */
|
|
117
|
+
customStyles?: {
|
|
118
|
+
form?: string;
|
|
119
|
+
field?: string;
|
|
120
|
+
label?: string;
|
|
121
|
+
input?: string;
|
|
122
|
+
select?: string;
|
|
123
|
+
checkbox?: string;
|
|
124
|
+
radio?: string;
|
|
125
|
+
button?: string;
|
|
126
|
+
error?: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for BridgeForm
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { FieldConfig } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Formats a string to title case with spaces
|
|
8
|
+
* @param str String to format
|
|
9
|
+
* @returns Formatted string
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatFieldName(str: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Determines the field type based on Zod schema and field config
|
|
14
|
+
* @param schema Zod schema for the field
|
|
15
|
+
* @param configType Type specified in field config
|
|
16
|
+
* @returns Determined field type
|
|
17
|
+
*/
|
|
18
|
+
export declare function determineFieldType(schema: z.ZodTypeAny, configType?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if a field is required based on Zod schema
|
|
21
|
+
* @param schema Zod schema for the field
|
|
22
|
+
* @returns Whether the field is required
|
|
23
|
+
*/
|
|
24
|
+
export declare function isFieldRequired(schema: z.ZodTypeAny): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Gets options for select/radio fields from Zod enum schema
|
|
27
|
+
* @param schema Zod schema for the field
|
|
28
|
+
* @returns Options array or undefined
|
|
29
|
+
*/
|
|
30
|
+
export declare function getOptionsFromSchema(schema: z.ZodTypeAny): Array<{
|
|
31
|
+
value: any;
|
|
32
|
+
label: string;
|
|
33
|
+
}> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Gets responsive grid classes based on layout configuration
|
|
36
|
+
* @param layout Layout configuration
|
|
37
|
+
* @returns CSS class string
|
|
38
|
+
*/
|
|
39
|
+
export declare function getGridClasses(layout?: {
|
|
40
|
+
columns?: number | {
|
|
41
|
+
sm?: number;
|
|
42
|
+
md?: number;
|
|
43
|
+
lg?: number;
|
|
44
|
+
};
|
|
45
|
+
gap?: string;
|
|
46
|
+
}): string;
|
|
47
|
+
/**
|
|
48
|
+
* Extracts field configs from Zod schema
|
|
49
|
+
* @param schema Zod schema
|
|
50
|
+
* @returns Array of field configs
|
|
51
|
+
*/
|
|
52
|
+
export declare function getFieldsFromSchema<T extends Record<string, any>>(schema: z.ZodType<T>): FieldConfig[];
|
|
53
|
+
/**
|
|
54
|
+
* Adjusts a color by a percentage
|
|
55
|
+
* @param color Hex color code
|
|
56
|
+
* @param percent Percentage to adjust (-100 to 100)
|
|
57
|
+
* @param alpha Whether to adjust opacity instead of brightness
|
|
58
|
+
* @returns Adjusted color
|
|
59
|
+
*/
|
|
60
|
+
export declare function adjustColor(color: string, percent: number, alpha?: boolean): string;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge List Component for React
|
|
3
|
+
*
|
|
4
|
+
* Provides a list component with sorting, filtering, and pagination
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { EntityData, EntityConfig, FilterDefinition } from '@pubflow/core';
|
|
8
|
+
import { FilterField } from './AdvancedFilter';
|
|
9
|
+
/**
|
|
10
|
+
* Bridge List render item props
|
|
11
|
+
*/
|
|
12
|
+
export interface BridgeListRenderItemProps<T> {
|
|
13
|
+
item: T;
|
|
14
|
+
index: number;
|
|
15
|
+
isSelected: boolean;
|
|
16
|
+
onSelect: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bridge List texts
|
|
20
|
+
*/
|
|
21
|
+
export interface BridgeListTexts {
|
|
22
|
+
searchPlaceholder?: string;
|
|
23
|
+
offlineText?: string;
|
|
24
|
+
noResults?: string;
|
|
25
|
+
loading?: string;
|
|
26
|
+
error?: string;
|
|
27
|
+
loadMore?: string;
|
|
28
|
+
showingResults?: string;
|
|
29
|
+
of?: string;
|
|
30
|
+
results?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Bridge List colors
|
|
34
|
+
*/
|
|
35
|
+
export interface BridgeListColors {
|
|
36
|
+
primary?: string;
|
|
37
|
+
secondary?: string;
|
|
38
|
+
background?: string;
|
|
39
|
+
surface?: string;
|
|
40
|
+
text?: string;
|
|
41
|
+
textSecondary?: string;
|
|
42
|
+
border?: string;
|
|
43
|
+
error?: string;
|
|
44
|
+
success?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Bridge List layout configuration
|
|
48
|
+
*/
|
|
49
|
+
export interface BridgeListLayout {
|
|
50
|
+
advancedFilterWidth?: number;
|
|
51
|
+
contentWidth?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Bridge List props
|
|
55
|
+
*/
|
|
56
|
+
export interface BridgeListProps<T extends EntityData> {
|
|
57
|
+
/**
|
|
58
|
+
* Function to render each item
|
|
59
|
+
*/
|
|
60
|
+
renderItem: (props: BridgeListRenderItemProps<T>) => React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Entity configuration
|
|
63
|
+
*/
|
|
64
|
+
entityConfig: EntityConfig;
|
|
65
|
+
/**
|
|
66
|
+
* Show pagination
|
|
67
|
+
*/
|
|
68
|
+
showPagination?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Show search
|
|
71
|
+
*/
|
|
72
|
+
showSearch?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Show filters
|
|
75
|
+
*/
|
|
76
|
+
showFilters?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Show advanced filters
|
|
79
|
+
*/
|
|
80
|
+
showAdvancedFilters?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Advanced filter fields
|
|
83
|
+
*/
|
|
84
|
+
advancedFilterFields?: FilterField[];
|
|
85
|
+
/**
|
|
86
|
+
* Layout configuration
|
|
87
|
+
*/
|
|
88
|
+
layout?: BridgeListLayout;
|
|
89
|
+
/**
|
|
90
|
+
* Key extractor function
|
|
91
|
+
*/
|
|
92
|
+
keyExtractor?: (item: T) => string;
|
|
93
|
+
/**
|
|
94
|
+
* Item press handler
|
|
95
|
+
*/
|
|
96
|
+
onItemPress?: (item: T) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Container style
|
|
99
|
+
*/
|
|
100
|
+
style?: React.CSSProperties;
|
|
101
|
+
/**
|
|
102
|
+
* Loading component
|
|
103
|
+
*/
|
|
104
|
+
loadingComponent?: React.ReactNode;
|
|
105
|
+
/**
|
|
106
|
+
* Empty component
|
|
107
|
+
*/
|
|
108
|
+
emptyComponent?: React.ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Error component
|
|
111
|
+
*/
|
|
112
|
+
errorComponent?: React.ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Pagination component
|
|
115
|
+
*/
|
|
116
|
+
paginationComponent?: React.ReactNode;
|
|
117
|
+
/**
|
|
118
|
+
* Search component
|
|
119
|
+
*/
|
|
120
|
+
searchComponent?: React.ReactNode;
|
|
121
|
+
/**
|
|
122
|
+
* Filter component
|
|
123
|
+
*/
|
|
124
|
+
filterComponent?: React.ReactNode;
|
|
125
|
+
/**
|
|
126
|
+
* Advanced filter component
|
|
127
|
+
*/
|
|
128
|
+
advancedFilterComponent?: React.ReactNode;
|
|
129
|
+
/**
|
|
130
|
+
* Custom texts
|
|
131
|
+
*/
|
|
132
|
+
texts?: BridgeListTexts;
|
|
133
|
+
/**
|
|
134
|
+
* Custom colors
|
|
135
|
+
*/
|
|
136
|
+
colors?: BridgeListColors;
|
|
137
|
+
/**
|
|
138
|
+
* Show offline indicator
|
|
139
|
+
*/
|
|
140
|
+
showOfflineIndicator?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Pubflow instance ID
|
|
143
|
+
*/
|
|
144
|
+
instanceId?: string;
|
|
145
|
+
/**
|
|
146
|
+
* Custom CSS class
|
|
147
|
+
*/
|
|
148
|
+
className?: string;
|
|
149
|
+
limit?: number;
|
|
150
|
+
orderBy?: string;
|
|
151
|
+
orderDir?: 'asc' | 'desc';
|
|
152
|
+
initialFilters?: FilterDefinition[];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Component for displaying data in a list with sorting, filtering, and pagination
|
|
156
|
+
*/
|
|
157
|
+
export declare function BridgeList<T extends EntityData>({ renderItem, showPagination, showSearch, showFilters, showAdvancedFilters, advancedFilterFields, layout, keyExtractor, onItemPress, style, loadingComponent, emptyComponent, errorComponent, paginationComponent, searchComponent, filterComponent, advancedFilterComponent, texts, colors, showOfflineIndicator, className, ...crudOptions }: BridgeListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge Table Component for React
|
|
3
|
+
*
|
|
4
|
+
* Provides a component for displaying data in a table with sorting, filtering, and pagination
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { EntityData } from '@pubflow/core';
|
|
8
|
+
import { UseBridgeCrudOptions } from '../hooks/useBridgeCrud';
|
|
9
|
+
/**
|
|
10
|
+
* Column definition
|
|
11
|
+
*/
|
|
12
|
+
export interface ColumnDef<T> {
|
|
13
|
+
/**
|
|
14
|
+
* Column key
|
|
15
|
+
*/
|
|
16
|
+
key: string;
|
|
17
|
+
/**
|
|
18
|
+
* Column header
|
|
19
|
+
*/
|
|
20
|
+
header: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Cell renderer
|
|
23
|
+
*/
|
|
24
|
+
cell?: (item: T, index: number) => React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the column is sortable
|
|
27
|
+
*/
|
|
28
|
+
sortable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the column is filterable
|
|
31
|
+
*/
|
|
32
|
+
filterable?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Column width
|
|
35
|
+
*/
|
|
36
|
+
width?: string | number;
|
|
37
|
+
/**
|
|
38
|
+
* Column alignment
|
|
39
|
+
*/
|
|
40
|
+
align?: 'left' | 'center' | 'right';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Bridge Table props
|
|
44
|
+
*/
|
|
45
|
+
export interface BridgeTableProps<T extends EntityData> extends UseBridgeCrudOptions<T> {
|
|
46
|
+
/**
|
|
47
|
+
* Column definitions
|
|
48
|
+
*/
|
|
49
|
+
columns: ColumnDef<T>[];
|
|
50
|
+
/**
|
|
51
|
+
* Whether to show pagination
|
|
52
|
+
*/
|
|
53
|
+
showPagination?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to show search
|
|
56
|
+
*/
|
|
57
|
+
showSearch?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to show filters
|
|
60
|
+
*/
|
|
61
|
+
showFilters?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Row key function
|
|
64
|
+
*/
|
|
65
|
+
rowKey?: (item: T) => string;
|
|
66
|
+
/**
|
|
67
|
+
* Row click handler
|
|
68
|
+
*/
|
|
69
|
+
onRowClick?: (item: T) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Table class name
|
|
72
|
+
*/
|
|
73
|
+
className?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Loading component
|
|
76
|
+
*/
|
|
77
|
+
loadingComponent?: React.ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* Empty component
|
|
80
|
+
*/
|
|
81
|
+
emptyComponent?: React.ReactNode;
|
|
82
|
+
/**
|
|
83
|
+
* Error component
|
|
84
|
+
*/
|
|
85
|
+
errorComponent?: React.ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Pagination component
|
|
88
|
+
*/
|
|
89
|
+
paginationComponent?: React.ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* Search component
|
|
92
|
+
*/
|
|
93
|
+
searchComponent?: React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Filter component
|
|
96
|
+
*/
|
|
97
|
+
filterComponent?: React.ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Search placeholder
|
|
100
|
+
*/
|
|
101
|
+
searchPlaceholder?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Actions renderer
|
|
104
|
+
*/
|
|
105
|
+
actions?: (item: T) => React.ReactNode;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Component for displaying data in a table with sorting, filtering, and pagination
|
|
109
|
+
*/
|
|
110
|
+
export declare function BridgeTable<T extends EntityData>({ columns, showPagination, showSearch, showFilters, rowKey, onRowClick, className, loadingComponent, emptyComponent, errorComponent, paginationComponent, searchComponent, filterComponent, searchPlaceholder, actions, ...crudOptions }: BridgeTableProps<T>): string | number | true | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge View Component for React
|
|
3
|
+
*
|
|
4
|
+
* Provides a component for conditional rendering based on authentication and user type
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* Bridge View props
|
|
9
|
+
*/
|
|
10
|
+
export interface BridgeViewProps {
|
|
11
|
+
/**
|
|
12
|
+
* Content to render if conditions are met
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* User types allowed to view the content
|
|
17
|
+
*/
|
|
18
|
+
allowedTypes?: string | string[];
|
|
19
|
+
/**
|
|
20
|
+
* Content to render if conditions are not met
|
|
21
|
+
*/
|
|
22
|
+
fallback?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Loading component
|
|
25
|
+
*/
|
|
26
|
+
loadingComponent?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Callback when user is not authorized
|
|
29
|
+
*/
|
|
30
|
+
onUnauthorized?: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Pubflow instance ID
|
|
33
|
+
*/
|
|
34
|
+
instanceId?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Component for conditional rendering based on authentication and user type
|
|
38
|
+
*/
|
|
39
|
+
export declare function BridgeView({ children, allowedTypes, fallback, loadingComponent, onUnauthorized, instanceId }: BridgeViewProps): import("react/jsx-runtime").JSX.Element;
|