@ahoo-wang/fetcher-viewer 3.8.9 → 3.9.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.
@@ -56,7 +56,7 @@ import { TableRecordType } from '../types';
56
56
  * }
57
57
  * ],
58
58
  * availableFilters: [],
59
- * dataSourceUrl: '/api/users',
59
+ * dataUrl: '/api/users',
60
60
  * countUrl: '/api/users/count',
61
61
  * checkable: true
62
62
  * };
@@ -1,10 +1,166 @@
1
1
  import { FilterStateReducerReturn } from './useFilterStateReducer';
2
2
  import { ReactNode } from 'react';
3
+ /**
4
+ * Filter State Context Type
5
+ *
6
+ * Represents the complete filter state management interface provided by the context.
7
+ * This includes active filters, panel visibility, query conditions, and update functions.
8
+ */
3
9
  export type FilterStateContext = FilterStateReducerReturn;
10
+ /**
11
+ * React Context for Filter State Management
12
+ *
13
+ * Provides a centralized way to manage filter state across the viewer component tree.
14
+ * Components can access and modify filter state without prop drilling.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { useFilterStateContext } from './FilterStateContext';
19
+ *
20
+ * function FilterButton() {
21
+ * const { showFilterPanel, updateShowFilterPanel } = useFilterStateContext();
22
+ *
23
+ * return (
24
+ * <button onClick={() => updateShowFilterPanel(!showFilterPanel)}>
25
+ * {showFilterPanel ? 'Hide' : 'Show'} Filters
26
+ * </button>
27
+ * );
28
+ * }
29
+ * ```
30
+ */
4
31
  export declare const FilterStateContext: import('react').Context<FilterStateReducerReturn | undefined>;
32
+ /**
33
+ * Props for the FilterStateContextProvider component.
34
+ *
35
+ * Extends the FilterStateContext interface with React children for component composition.
36
+ */
5
37
  export interface FilterStateContextOptions extends FilterStateContext {
38
+ /** Child components that will have access to the filter state context */
6
39
  children: ReactNode;
7
40
  }
41
+ /**
42
+ * Filter State Context Provider Component
43
+ *
44
+ * Provides filter state management to all descendant components in the React tree.
45
+ * This component should wrap the parts of your application that need access to filter state.
46
+ *
47
+ * @param props - Provider configuration and child components
48
+ * @param props.children - Components that will have access to filter state
49
+ * @param props.activeFilters - Current active filter configurations
50
+ * @param props.showFilterPanel - Whether the filter panel is visible
51
+ * @param props.queryCondition - Current query condition for data filtering
52
+ * @param props.updateActiveFilters - Function to update active filters
53
+ * @param props.updateShowFilterPanel - Function to toggle filter panel visibility
54
+ * @param props.updateQueryCondition - Function to update query conditions
55
+ *
56
+ * @example
57
+ * ```tsx
58
+ * import { FilterStateContextProvider } from './FilterStateContext';
59
+ * import { useFilterState } from './useFilterStateReducer';
60
+ *
61
+ * function App() {
62
+ * // Initialize filter state management
63
+ * const filterState = useFilterState({
64
+ * initialFilters: [],
65
+ * initialCondition: {}
66
+ * });
67
+ *
68
+ * return (
69
+ * <FilterStateContextProvider
70
+ * activeFilters={filterState.activeFilters}
71
+ * showFilterPanel={filterState.showFilterPanel}
72
+ * queryCondition={filterState.queryCondition}
73
+ * updateActiveFilters={filterState.updateActiveFilters}
74
+ * updateShowFilterPanel={filterState.updateShowFilterPanel}
75
+ * updateQueryCondition={filterState.updateQueryCondition}
76
+ * >
77
+ * <FilterableDataTable />
78
+ * <FilterPanel />
79
+ * </FilterStateContextProvider>
80
+ * );
81
+ * }
82
+ * ```
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * // Integration with Viewer component
87
+ * function DataViewer({ definition, dataSource }) {
88
+ * const filterState = useFilterState({
89
+ * initialFilters: definition.filters || [],
90
+ * initialCondition: definition.condition || {}
91
+ * });
92
+ *
93
+ * return (
94
+ * <FilterStateContextProvider {...filterState}>
95
+ * <Viewer
96
+ * definition={definition}
97
+ * dataSource={dataSource}
98
+ * />
99
+ * </FilterStateContextProvider>
100
+ * );
101
+ * }
102
+ * ```
103
+ */
8
104
  export declare function FilterStateContextProvider({ children, ...options }: FilterStateContextOptions): import("react/jsx-runtime").JSX.Element;
105
+ /**
106
+ * Hook to Access Filter State Context
107
+ *
108
+ * Provides access to the filter state context within components.
109
+ * Must be used within a FilterStateContextProvider component tree.
110
+ *
111
+ * @returns Filter state context with all filter management functions
112
+ * @throws Error if used outside of FilterStateContextProvider
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * import { useFilterStateContext } from './FilterStateContext';
117
+ *
118
+ * function FilterControls() {
119
+ * const {
120
+ * activeFilters,
121
+ * showFilterPanel,
122
+ * queryCondition,
123
+ * updateActiveFilters,
124
+ * updateShowFilterPanel,
125
+ * updateQueryCondition
126
+ * } = useFilterStateContext();
127
+ *
128
+ * const handleAddFilter = (newFilter) => {
129
+ * updateActiveFilters([...activeFilters, newFilter]);
130
+ * };
131
+ *
132
+ * const handleTogglePanel = () => {
133
+ * updateShowFilterPanel(!showFilterPanel);
134
+ * };
135
+ *
136
+ * return (
137
+ * <div>
138
+ * <button onClick={handleTogglePanel}>
139
+ * {showFilterPanel ? 'Hide' : 'Show'} Filters
140
+ * </button>
141
+ * <FilterList
142
+ * filters={activeFilters}
143
+ * onAddFilter={handleAddFilter}
144
+ * />
145
+ * </div>
146
+ * );
147
+ * }
148
+ * ```
149
+ *
150
+ * @example
151
+ * ```tsx
152
+ * // Error handling pattern
153
+ * function SafeFilterComponent() {
154
+ * try {
155
+ * const filterState = useFilterStateContext();
156
+ * return <FilterUI {...filterState} />;
157
+ * } catch (error) {
158
+ * // Handle case where context is not available
159
+ * console.warn('FilterStateContext not found, using defaults');
160
+ * return <DefaultFilterUI />;
161
+ * }
162
+ * }
163
+ * ```
164
+ */
9
165
  export declare function useFilterStateContext(): FilterStateContext;
10
166
  //# sourceMappingURL=FilterStateContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterStateContext.d.ts","sourceRoot":"","sources":["../../src/viewer/FilterStateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAE1D,eAAO,MAAM,kBAAkB,+DAE9B,CAAC;AAEF,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,GAAG,OAAO,EACX,EAAE,yBAAyB,2CAM3B;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,CAQ1D"}
1
+ {"version":3,"file":"FilterStateContext.d.ts","sourceRoot":"","sources":["../../src/viewer/FilterStateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,+DAE9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE,yEAAyE;IACzE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,GAAG,OAAO,EACX,EAAE,yBAAyB,2CAM3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAQ1D"}
@@ -1,12 +1,210 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { UseTableStateReducerReturn } from './useTableStateReducer';
3
+ /**
4
+ * Table State Context Type
5
+ *
6
+ * Represents the complete table state management interface provided by the context.
7
+ * Extends the table state reducer with data refresh functionality.
8
+ */
3
9
  export type TableStateContext = UseTableStateReducerReturn & {
10
+ /** Function to refresh/reload table data */
4
11
  refreshData: () => void;
5
12
  };
13
+ /**
14
+ * React Context for Table State Management
15
+ *
16
+ * Provides centralized management of table-related state across the viewer component tree.
17
+ * Includes column configurations, table sizing, and data refresh capabilities.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * import { useTableStateContext } from './TableStateContext';
22
+ *
23
+ * function TableControls() {
24
+ * const { columns, tableSize, refreshData } = useTableStateContext();
25
+ *
26
+ * return (
27
+ * <div>
28
+ * <button onClick={refreshData}>Refresh Data</button>
29
+ * <span>Table Size: {tableSize}</span>
30
+ * <span>Visible Columns: {columns.filter(c => c.visible).length}</span>
31
+ * </div>
32
+ * );
33
+ * }
34
+ * ```
35
+ */
6
36
  export declare const TableStateContext: import('react').Context<TableStateContext | undefined>;
37
+ /**
38
+ * Props for the TableStateContextProvider component.
39
+ *
40
+ * Extends the TableStateContext interface with React children for component composition.
41
+ */
7
42
  export interface TableStateContextOptions extends TableStateContext {
43
+ /** Child components that will have access to the table state context */
8
44
  children: ReactNode;
9
45
  }
46
+ /**
47
+ * Table State Context Provider Component
48
+ *
49
+ * Provides table state management to all descendant components in the React tree.
50
+ * This component should wrap the parts of your application that need access to table state.
51
+ *
52
+ * @param props - Provider configuration and child components
53
+ * @param props.children - Components that will have access to table state
54
+ * @param props.columns - Current column configurations with visibility and sizing
55
+ * @param props.tableSize - Current table size (small, middle, large)
56
+ * @param props.updateColumns - Function to update column configurations
57
+ * @param props.updateTableSize - Function to change table size
58
+ * @param props.refreshData - Function to refresh/reload table data
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * import { TableStateContextProvider } from './TableStateContext';
63
+ * import { useTableState } from './useTableStateReducer';
64
+ *
65
+ * function DataTable({ definition, dataSource }) {
66
+ * // Initialize table state management
67
+ * const tableState = useTableState({
68
+ * initialColumns: definition.columns,
69
+ * initialTableSize: 'middle'
70
+ * });
71
+ *
72
+ * const handleRefresh = async () => {
73
+ * // Fetch fresh data from API
74
+ * const newData = await fetchData();
75
+ * setDataSource(newData);
76
+ * };
77
+ *
78
+ * return (
79
+ * <TableStateContextProvider
80
+ * columns={tableState.columns}
81
+ * tableSize={tableState.tableSize}
82
+ * updateColumns={tableState.updateColumns}
83
+ * updateTableSize={tableState.updateTableSize}
84
+ * refreshData={handleRefresh}
85
+ * >
86
+ * <ViewTable
87
+ * viewDefinition={definition}
88
+ * dataSource={dataSource}
89
+ * />
90
+ * <TableSettings />
91
+ * <RefreshButton />
92
+ * </TableStateContextProvider>
93
+ * );
94
+ * }
95
+ * ```
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * // Integration with Viewer component
100
+ * function DataViewer({ definition, dataSource, onRefresh }) {
101
+ * const tableState = useTableState({
102
+ * initialColumns: definition.columns,
103
+ * initialTableSize: definition.tableSize || 'middle'
104
+ * });
105
+ *
106
+ * return (
107
+ * <TableStateContextProvider
108
+ * columns={tableState.columns}
109
+ * tableSize={tableState.tableSize}
110
+ * updateColumns={tableState.updateColumns}
111
+ * updateTableSize={tableState.updateTableSize}
112
+ * refreshData={onRefresh}
113
+ * >
114
+ * <Viewer
115
+ * definition={definition}
116
+ * dataSource={dataSource}
117
+ * />
118
+ * </TableStateContextProvider>
119
+ * );
120
+ * }
121
+ * ```
122
+ */
10
123
  export declare function TableStateContextProvider({ children, ...options }: TableStateContextOptions): import("react/jsx-runtime").JSX.Element;
124
+ /**
125
+ * Hook to Access Table State Context
126
+ *
127
+ * Provides access to the table state context within components.
128
+ * Must be used within a TableStateContextProvider component tree.
129
+ *
130
+ * @returns Table state context with all table management functions
131
+ * @throws Error if used outside of TableStateContextProvider
132
+ *
133
+ * @example
134
+ * ```tsx
135
+ * import { useTableStateContext } from './TableStateContext';
136
+ *
137
+ * function ColumnVisibilityToggle({ columnId }) {
138
+ * const { columns, updateColumns } = useTableStateContext();
139
+ *
140
+ * const column = columns.find(c => c.dataIndex === columnId);
141
+ * const isVisible = column?.visible ?? true;
142
+ *
143
+ * const handleToggle = () => {
144
+ * const updatedColumns = columns.map(c =>
145
+ * c.dataIndex === columnId
146
+ * ? { ...c, visible: !isVisible }
147
+ * : c
148
+ * );
149
+ * updateColumns(updatedColumns);
150
+ * };
151
+ *
152
+ * return (
153
+ * <button onClick={handleToggle}>
154
+ * {isVisible ? 'Hide' : 'Show'} Column
155
+ * </button>
156
+ * );
157
+ * }
158
+ * ```
159
+ *
160
+ * @example
161
+ * ```tsx
162
+ * // Table size controls
163
+ * function TableSizeSelector() {
164
+ * const { tableSize, updateTableSize } = useTableStateContext();
165
+ *
166
+ * return (
167
+ * <select
168
+ * value={tableSize}
169
+ * onChange={(e) => updateTableSize(e.target.value as SizeType)}
170
+ * >
171
+ * <option value="small">Small</option>
172
+ * <option value="middle">Medium</option>
173
+ * <option value="large">Large</option>
174
+ * </select>
175
+ * );
176
+ * }
177
+ * ```
178
+ *
179
+ * @example
180
+ * ```tsx
181
+ * // Data refresh functionality
182
+ * function RefreshControls() {
183
+ * const { refreshData } = useTableStateContext();
184
+ *
185
+ * return (
186
+ * <div>
187
+ * <button onClick={refreshData}>Refresh Data</button>
188
+ * <AutoRefreshToggle />
189
+ * </div>
190
+ * );
191
+ * }
192
+ * ```
193
+ *
194
+ * @example
195
+ * ```tsx
196
+ * // Error handling pattern
197
+ * function SafeTableComponent() {
198
+ * try {
199
+ * const tableState = useTableStateContext();
200
+ * return <TableUI {...tableState} />;
201
+ * } catch (error) {
202
+ * // Handle case where context is not available
203
+ * console.warn('TableStateContext not found, using defaults');
204
+ * return <DefaultTable />;
205
+ * }
206
+ * }
207
+ * ```
208
+ */
11
209
  export declare function useTableStateContext(): TableStateContext;
12
210
  //# sourceMappingURL=TableStateContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableStateContext.d.ts","sourceRoot":"","sources":["../../src/viewer/TableStateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,GAAG;IAC3D,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,wDAE7B,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,GAAG,OAAO,EACX,EAAE,wBAAwB,2CAM1B;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAQxD"}
1
+ {"version":3,"file":"TableStateContext.d.ts","sourceRoot":"","sources":["../../src/viewer/TableStateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,GAAG;IAC3D,4CAA4C;IAC5C,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iBAAiB,wDAE7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,wEAAwE;IACxE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,GAAG,OAAO,EACX,EAAE,wBAAwB,2CAM1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAQxD"}
@@ -4,16 +4,146 @@ import { View, ViewDefinition } from './';
4
4
  import { StyleCapable, TableRecordType } from '../types';
5
5
  import { RefAttributes } from 'react';
6
6
  import { TopBarPropsCapable } from '../topbar';
7
+ /**
8
+ * Ref interface for the Viewer component.
9
+ *
10
+ * Provides imperative methods to control the viewer from parent components.
11
+ */
7
12
  export interface ViewerRef {
13
+ /** Refreshes the data by re-executing the current query */
8
14
  refreshData: () => void;
9
15
  }
16
+ /**
17
+ * Props for the Viewer component.
18
+ *
19
+ * The Viewer is a comprehensive data viewing component that provides:
20
+ * - Multiple view management with persistent configurations
21
+ * - Advanced filtering with editable filter panels
22
+ * - Table display with sorting, selection, and pagination
23
+ * - State management for table and filter configurations
24
+ * - Responsive layout with collapsible panels
25
+ */
10
26
  export interface ViewerProps<RecordType> extends TopBarPropsCapable<RecordType>, StyleCapable, RefAttributes<ViewerRef> {
27
+ /** Display name for the viewer instance */
11
28
  name: string;
29
+ /** Array of available views for switching between different data perspectives */
12
30
  views: View[];
31
+ /** Optional ID of the default view to select on initialization */
13
32
  defaultViewId?: string;
33
+ /** View definition containing column configurations and data source information */
14
34
  definition: ViewDefinition;
35
+ /** Action column configuration for table row actions */
15
36
  actionColumn: ViewTableActionColumn<TableRecordType<RecordType>>;
37
+ /** Additional pagination props (excluding total which is managed internally) */
16
38
  paginationProps?: Omit<PaginationProps, 'total'>;
17
39
  }
40
+ /**
41
+ * Viewer Component
42
+ *
43
+ * A comprehensive data viewing component that provides a complete data management interface.
44
+ * It integrates views, filters, table display, and pagination into a cohesive user experience.
45
+ *
46
+ * Key features:
47
+ * - Multiple view management with persistent configurations
48
+ * - Advanced filtering with editable filter panels
49
+ * - Sortable, selectable table with customizable columns
50
+ * - Responsive layout with collapsible side panels
51
+ * - State management for all viewer configurations
52
+ * - Debounced queries for optimal performance
53
+ *
54
+ * @template RecordType - The type of data records being displayed
55
+ * @param props - Viewer configuration and data
56
+ * @param props.name - Display name for the viewer
57
+ * @param props.views - Available views for data perspective switching
58
+ * @param props.defaultViewId - Optional default view selection
59
+ * @param props.definition - Column and data source configuration
60
+ * @param props.actionColumn - Row action column configuration
61
+ * @param props.paginationProps - Additional pagination settings
62
+ * @param props.topBar - Top bar configuration and actions
63
+ * @param props.className - CSS class for styling
64
+ * @param props.style - Inline styles
65
+ * @param props.ref - Ref for imperative methods
66
+ *
67
+ * @example
68
+ * ```tsx
69
+ * import { Viewer } from './Viewer';
70
+ * import type { View, ViewDefinition } from './types';
71
+ *
72
+ * interface User {
73
+ * id: number;
74
+ * name: string;
75
+ * email: string;
76
+ * status: 'active' | 'inactive';
77
+ * }
78
+ *
79
+ * const userViews: View[] = [
80
+ * {
81
+ * id: 'all-users',
82
+ * name: 'All Users',
83
+ * viewType: 'PUBLIC',
84
+ * viewSource: 'CUSTOM',
85
+ * isDefault: true,
86
+ * filters: [],
87
+ * columns: [
88
+ * { dataIndex: 'id', fixed: false, visible: true },
89
+ * { dataIndex: 'name', fixed: false, visible: true },
90
+ * { dataIndex: 'email', fixed: false, visible: true },
91
+ * { dataIndex: 'status', fixed: false, visible: true }
92
+ * ],
93
+ * tableSize: 'middle',
94
+ * condition: {},
95
+ * pageSize: 20
96
+ * }
97
+ * ];
98
+ *
99
+ * const userDefinition: ViewDefinition = {
100
+ * name: 'User Management',
101
+ * columns: [
102
+ * {
103
+ * title: 'ID',
104
+ * dataIndex: 'id',
105
+ * type: 'number',
106
+ * primaryKey: true,
107
+ * sorter: true
108
+ * },
109
+ * {
110
+ * title: 'Name',
111
+ * dataIndex: 'name',
112
+ * type: 'text',
113
+ * sorter: true
114
+ * }
115
+ * ],
116
+ * availableFilters: [],
117
+ * dataUrl: '/api/users',
118
+ * countUrl: '/api/users/count',
119
+ * checkable: true
120
+ * };
121
+ *
122
+ * const actionColumn: ViewTableActionColumn<User> = {
123
+ * title: 'Actions',
124
+ * configurable: true,
125
+ * actions: (record) => ({
126
+ * primaryAction: {
127
+ * data: { value: 'Edit', record, index: 0 },
128
+ * attributes: { onClick: () => handleEdit(record) }
129
+ * }
130
+ * })
131
+ * };
132
+ *
133
+ * function UserManagement() {
134
+ * const viewerRef = useRef<ViewerRef>(null);
135
+ *
136
+ * return (
137
+ * <Viewer<User>
138
+ * ref={viewerRef}
139
+ * name="User Management"
140
+ * views={userViews}
141
+ * definition={userDefinition}
142
+ * actionColumn={actionColumn}
143
+ * />
144
+ * );
145
+ * }
146
+ * ```
147
+ */
18
148
  export declare function Viewer<RecordType>(props: ViewerProps<RecordType>): import("react/jsx-runtime").JSX.Element;
19
149
  //# sourceMappingURL=Viewer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Viewer.d.ts","sourceRoot":"","sources":["../../src/viewer/Viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAsB,eAAe,EAAS,MAAM,MAAM,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAa,MAAM,IAAI,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EACL,aAAa,EAKd,MAAM,OAAO,CAAC;AAYf,OAAO,EAAU,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAWvD,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,WAAW,CAAC,UAAU,CACrC,SACE,kBAAkB,CAAC,UAAU,CAAC,EAC9B,YAAY,EACZ,aAAa,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,cAAc,CAAC;IAC3B,YAAY,EAAE,qBAAqB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjE,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;CAClD;AAED,wBAAgB,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,2CAsThE"}
1
+ {"version":3,"file":"Viewer.d.ts","sourceRoot":"","sources":["../../src/viewer/Viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAsB,eAAe,EAAS,MAAM,MAAM,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAa,MAAM,IAAI,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EACL,aAAa,EAKd,MAAM,OAAO,CAAC;AAYf,OAAO,EAAU,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAWvD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW,CAAC,UAAU,CACrC,SACE,kBAAkB,CAAC,UAAU,CAAC,EAC9B,YAAY,EACZ,aAAa,CAAC,SAAS,CAAC;IAC1B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,UAAU,EAAE,cAAc,CAAC;IAC3B,wDAAwD;IACxD,YAAY,EAAE,qBAAqB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,gFAAgF;IAChF,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,2CAkUhE"}
@@ -5,5 +5,4 @@ export * from './types';
5
5
  export * from './useFilterStateReducer';
6
6
  export * from './useTableStateReducer';
7
7
  export * from './Viewer';
8
- export * from './ViewerSharedValueContext';
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/viewer/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/viewer/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC"}
@@ -1,8 +1,88 @@
1
1
  import { View } from '../index';
2
+ /**
3
+ * Props for the ViewItem component.
4
+ *
5
+ * @interface ViewItemProps
6
+ */
2
7
  export interface ViewItemProps {
8
+ /** The view configuration containing name, type, filters, and other metadata */
3
9
  view: View;
10
+ /** API endpoint URL for fetching the count of records matching this view's condition */
4
11
  countUrl: string;
12
+ /** Whether this view item is currently active/selected */
5
13
  active: boolean;
6
14
  }
15
+ /**
16
+ * ViewItem Component
17
+ *
18
+ * A compact component that displays a view item in a list or panel. It shows the view name,
19
+ * a system tag for system views, and the record count (when not active). The component
20
+ * automatically fetches and displays the count of records that match the view's condition
21
+ * using a debounced query to avoid excessive API calls.
22
+ *
23
+ * @param props - The properties for configuring the view item
24
+ * @param props.view - The view configuration with name, type, condition, and metadata
25
+ * @param props.countUrl - API endpoint for fetching record count
26
+ * @param props.active - Whether this view is currently selected/active
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * import { ViewItem } from './ViewItem';
31
+ * import type { View } from '../types';
32
+ *
33
+ * const userView: View = {
34
+ * id: 'user-list',
35
+ * name: 'All Users',
36
+ * viewType: 'PUBLIC',
37
+ * viewSource: 'CUSTOM',
38
+ * isDefault: true,
39
+ * filters: [],
40
+ * columns: [
41
+ * { dataIndex: 'id', fixed: false, visible: true },
42
+ * { dataIndex: 'name', fixed: false, visible: true },
43
+ * { dataIndex: 'email', fixed: false, visible: true }
44
+ * ],
45
+ * tableSize: 'middle',
46
+ * condition: { status: 'active' },
47
+ * pageSize: 20,
48
+ * sortId: 1
49
+ * };
50
+ *
51
+ * function ViewList() {
52
+ * return (
53
+ * <div>
54
+ * <ViewItem
55
+ * view={userView}
56
+ * countUrl="/api/users/count"
57
+ * active={false}
58
+ * />
59
+ * <ViewItem
60
+ * view={systemView}
61
+ * countUrl="/api/users/count"
62
+ * active={true}
63
+ * />
64
+ * </div>
65
+ * );
66
+ * }
67
+ * ```
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * // System view with special styling
72
+ * const systemView: View = {
73
+ * id: 'system-admin',
74
+ * name: 'Admin Users',
75
+ * viewType: 'PUBLIC',
76
+ * viewSource: 'SYSTEM', // This will show a "系统" tag
77
+ * isDefault: false,
78
+ * filters: [],
79
+ * columns: [],
80
+ * tableSize: 'middle',
81
+ * condition: { role: 'admin' },
82
+ * pageSize: 10,
83
+ * sortId: 2
84
+ * };
85
+ * ```
86
+ */
7
87
  export declare function ViewItem(props: ViewItemProps): import("react/jsx-runtime").JSX.Element;
8
88
  //# sourceMappingURL=ViewItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ViewItem.d.ts","sourceRoot":"","sources":["../../../src/viewer/panel/ViewItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAMhC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CA8B5C"}
1
+ {"version":3,"file":"ViewItem.d.ts","sourceRoot":"","sources":["../../../src/viewer/panel/ViewItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAMhC;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,IAAI,EAAE,IAAI,CAAC;IACX,wFAAwF;IACxF,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAqC5C"}