@aquera/ngx-smart-table 0.0.2-alpha

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.
Files changed (169) hide show
  1. package/README.md +152 -0
  2. package/aquera-ngx-smart-table.d.ts +5 -0
  3. package/esm2020/aquera-ngx-smart-table.mjs +5 -0
  4. package/esm2020/lib/builder/components/builder-preview/builder-preview.component.mjs +63 -0
  5. package/esm2020/lib/builder/components/builder-toolbar/builder-toolbar.component.mjs +115 -0
  6. package/esm2020/lib/builder/components/column-editor/column-editor.component.mjs +206 -0
  7. package/esm2020/lib/builder/components/column-list/column-list.component.mjs +125 -0
  8. package/esm2020/lib/builder/components/definition-builder/definition-builder.component.mjs +105 -0
  9. package/esm2020/lib/builder/components/table-config-editor/table-config-editor.component.mjs +132 -0
  10. package/esm2020/lib/builder/definition-builder.module.mjs +70 -0
  11. package/esm2020/lib/builder/models/builder-state.interface.mjs +5 -0
  12. package/esm2020/lib/builder/services/definition-builder.service.mjs +251 -0
  13. package/esm2020/lib/builder/services/definition-export.service.mjs +167 -0
  14. package/esm2020/lib/builder/services/definition-import.service.mjs +193 -0
  15. package/esm2020/lib/builder/services/sample-data-generator.service.mjs +126 -0
  16. package/esm2020/lib/builder/utils/config-validator.util.mjs +165 -0
  17. package/esm2020/lib/builder/utils/typescript-generator.util.mjs +206 -0
  18. package/esm2020/lib/editors/index.mjs +9 -0
  19. package/esm2020/lib/editors/nile-autocomplete-editor.mjs +228 -0
  20. package/esm2020/lib/editors/nile-calendar-editor.mjs +214 -0
  21. package/esm2020/lib/editors/nile-date-picker-editor.mjs +227 -0
  22. package/esm2020/lib/editors/nile-input-editor.mjs +235 -0
  23. package/esm2020/lib/editors/nile-select-editor.mjs +317 -0
  24. package/esm2020/lib/factories/column-config.factory.mjs +231 -0
  25. package/esm2020/lib/models/autosave-config.interface.mjs +8 -0
  26. package/esm2020/lib/models/base-column-config.class.mjs +253 -0
  27. package/esm2020/lib/models/cell-strategies.interface.mjs +6 -0
  28. package/esm2020/lib/models/cell-types.mjs +147 -0
  29. package/esm2020/lib/models/column-action.interface.mjs +6 -0
  30. package/esm2020/lib/models/column-config.interface.mjs +43 -0
  31. package/esm2020/lib/models/column-config.utils.mjs +101 -0
  32. package/esm2020/lib/models/row-action.interface.mjs +5 -0
  33. package/esm2020/lib/models/row-validator.interface.mjs +2 -0
  34. package/esm2020/lib/models/schema-validation.interface.mjs +2 -0
  35. package/esm2020/lib/models/sheet-action.interface.mjs +5 -0
  36. package/esm2020/lib/models/sheet-config.interface.mjs +5 -0
  37. package/esm2020/lib/models/table-config.interface.mjs +106 -0
  38. package/esm2020/lib/models/table-validator.interface.mjs +2 -0
  39. package/esm2020/lib/models/workbook-action.interface.mjs +5 -0
  40. package/esm2020/lib/models/workbook-config.interface.mjs +5 -0
  41. package/esm2020/lib/renderer/components/st-add-column-button/st-add-column-button.component.mjs +24 -0
  42. package/esm2020/lib/renderer/components/st-cell/st-cell.component.mjs +391 -0
  43. package/esm2020/lib/renderer/components/st-column-editor-modal/st-column-editor-modal.component.mjs +103 -0
  44. package/esm2020/lib/renderer/components/st-column-filter/st-column-filter.component.mjs +383 -0
  45. package/esm2020/lib/renderer/components/st-column-menu/st-column-menu.component.mjs +232 -0
  46. package/esm2020/lib/renderer/components/st-column-visibility/st-column-visibility.component.mjs +97 -0
  47. package/esm2020/lib/renderer/components/st-header/st-header.component.mjs +157 -0
  48. package/esm2020/lib/renderer/components/st-pagination/st-pagination.component.mjs +87 -0
  49. package/esm2020/lib/renderer/components/st-row-actions-dropdown/st-row-actions-dropdown.component.mjs +167 -0
  50. package/esm2020/lib/renderer/components/st-sheet/st-sheet.component.mjs +165 -0
  51. package/esm2020/lib/renderer/components/st-sheet-actions/st-sheet-actions.component.mjs +112 -0
  52. package/esm2020/lib/renderer/components/st-table/st-table.component.mjs +1246 -0
  53. package/esm2020/lib/renderer/components/st-table-actions/st-table-actions.component.mjs +171 -0
  54. package/esm2020/lib/renderer/components/st-workbook/st-workbook.component.mjs +489 -0
  55. package/esm2020/lib/renderer/directives/click-outside.directive.mjs +28 -0
  56. package/esm2020/lib/renderer/directives/st-column-resize.directive.mjs +108 -0
  57. package/esm2020/lib/renderer/directives/st-keyboard-navigation.directive.mjs +73 -0
  58. package/esm2020/lib/renderer/models/cell-state.interface.mjs +66 -0
  59. package/esm2020/lib/renderer/models/cell.class.mjs +389 -0
  60. package/esm2020/lib/renderer/models/row-validation-state.interface.mjs +7 -0
  61. package/esm2020/lib/renderer/models/sheet-state.class.mjs +90 -0
  62. package/esm2020/lib/renderer/models/sheet-state.interface.mjs +5 -0
  63. package/esm2020/lib/renderer/models/table-state.class.mjs +841 -0
  64. package/esm2020/lib/renderer/models/table-state.interface.mjs +5 -0
  65. package/esm2020/lib/renderer/models/table-types.mjs +29 -0
  66. package/esm2020/lib/renderer/models/table-validation-state.interface.mjs +7 -0
  67. package/esm2020/lib/renderer/models/workbook-state.class.mjs +174 -0
  68. package/esm2020/lib/renderer/models/workbook-state.interface.mjs +5 -0
  69. package/esm2020/lib/renderer/models/z-index.enum.mjs +55 -0
  70. package/esm2020/lib/schemas/table-config.schema.mjs +472 -0
  71. package/esm2020/lib/services/autosave.service.mjs +92 -0
  72. package/esm2020/lib/services/custom-validation-rules.util.mjs +124 -0
  73. package/esm2020/lib/services/json-schema-validator.service.mjs +216 -0
  74. package/esm2020/lib/services/row-validation.service.mjs +42 -0
  75. package/esm2020/lib/services/validation-logger.service.mjs +177 -0
  76. package/esm2020/lib/services/virtual-scroll.service.mjs +52 -0
  77. package/esm2020/lib/shared/shared-table-components.module.mjs +35 -0
  78. package/esm2020/lib/smart-table.module.mjs +124 -0
  79. package/esm2020/lib/strategies/default-editors.mjs +433 -0
  80. package/esm2020/lib/strategies/default-formatters.mjs +238 -0
  81. package/esm2020/lib/strategies/default-validators.mjs +327 -0
  82. package/esm2020/public-api.mjs +146 -0
  83. package/fesm2015/aquera-ngx-smart-table.mjs +11860 -0
  84. package/fesm2015/aquera-ngx-smart-table.mjs.map +1 -0
  85. package/fesm2020/aquera-ngx-smart-table.mjs +11897 -0
  86. package/fesm2020/aquera-ngx-smart-table.mjs.map +1 -0
  87. package/lib/builder/components/builder-preview/builder-preview.component.d.ts +31 -0
  88. package/lib/builder/components/builder-toolbar/builder-toolbar.component.d.ts +53 -0
  89. package/lib/builder/components/column-editor/column-editor.component.d.ts +69 -0
  90. package/lib/builder/components/column-list/column-list.component.d.ts +65 -0
  91. package/lib/builder/components/definition-builder/definition-builder.component.d.ts +58 -0
  92. package/lib/builder/components/table-config-editor/table-config-editor.component.d.ts +32 -0
  93. package/lib/builder/definition-builder.module.d.ts +15 -0
  94. package/lib/builder/models/builder-state.interface.d.ts +93 -0
  95. package/lib/builder/services/definition-builder.service.d.ts +80 -0
  96. package/lib/builder/services/definition-export.service.d.ts +59 -0
  97. package/lib/builder/services/definition-import.service.d.ts +31 -0
  98. package/lib/builder/services/sample-data-generator.service.d.ts +41 -0
  99. package/lib/builder/utils/config-validator.util.d.ts +32 -0
  100. package/lib/builder/utils/typescript-generator.util.d.ts +29 -0
  101. package/lib/editors/index.d.ts +8 -0
  102. package/lib/editors/nile-autocomplete-editor.d.ts +102 -0
  103. package/lib/editors/nile-calendar-editor.d.ts +89 -0
  104. package/lib/editors/nile-date-picker-editor.d.ts +95 -0
  105. package/lib/editors/nile-input-editor.d.ts +67 -0
  106. package/lib/editors/nile-select-editor.d.ts +109 -0
  107. package/lib/factories/column-config.factory.d.ts +73 -0
  108. package/lib/models/autosave-config.interface.d.ts +23 -0
  109. package/lib/models/base-column-config.class.d.ts +115 -0
  110. package/lib/models/cell-strategies.interface.d.ts +181 -0
  111. package/lib/models/cell-types.d.ts +337 -0
  112. package/lib/models/column-action.interface.d.ts +86 -0
  113. package/lib/models/column-config.interface.d.ts +272 -0
  114. package/lib/models/column-config.utils.d.ts +37 -0
  115. package/lib/models/row-action.interface.d.ts +86 -0
  116. package/lib/models/row-validator.interface.d.ts +37 -0
  117. package/lib/models/schema-validation.interface.d.ts +42 -0
  118. package/lib/models/sheet-action.interface.d.ts +59 -0
  119. package/lib/models/sheet-config.interface.d.ts +41 -0
  120. package/lib/models/table-config.interface.d.ts +245 -0
  121. package/lib/models/table-validator.interface.d.ts +40 -0
  122. package/lib/models/workbook-action.interface.d.ts +90 -0
  123. package/lib/models/workbook-config.interface.d.ts +107 -0
  124. package/lib/renderer/components/st-add-column-button/st-add-column-button.component.d.ts +9 -0
  125. package/lib/renderer/components/st-cell/st-cell.component.d.ts +69 -0
  126. package/lib/renderer/components/st-column-editor-modal/st-column-editor-modal.component.d.ts +39 -0
  127. package/lib/renderer/components/st-column-filter/st-column-filter.component.d.ts +139 -0
  128. package/lib/renderer/components/st-column-menu/st-column-menu.component.d.ts +81 -0
  129. package/lib/renderer/components/st-column-visibility/st-column-visibility.component.d.ts +44 -0
  130. package/lib/renderer/components/st-header/st-header.component.d.ts +93 -0
  131. package/lib/renderer/components/st-pagination/st-pagination.component.d.ts +42 -0
  132. package/lib/renderer/components/st-row-actions-dropdown/st-row-actions-dropdown.component.d.ts +67 -0
  133. package/lib/renderer/components/st-sheet/st-sheet.component.d.ts +98 -0
  134. package/lib/renderer/components/st-sheet-actions/st-sheet-actions.component.d.ts +58 -0
  135. package/lib/renderer/components/st-table/st-table.component.d.ts +349 -0
  136. package/lib/renderer/components/st-table-actions/st-table-actions.component.d.ts +77 -0
  137. package/lib/renderer/components/st-workbook/st-workbook.component.d.ts +235 -0
  138. package/lib/renderer/directives/click-outside.directive.d.ts +10 -0
  139. package/lib/renderer/directives/st-column-resize.directive.d.ts +44 -0
  140. package/lib/renderer/directives/st-keyboard-navigation.directive.d.ts +15 -0
  141. package/lib/renderer/models/cell-state.interface.d.ts +118 -0
  142. package/lib/renderer/models/cell.class.d.ts +174 -0
  143. package/lib/renderer/models/row-validation-state.interface.d.ts +27 -0
  144. package/lib/renderer/models/sheet-state.class.d.ts +67 -0
  145. package/lib/renderer/models/sheet-state.interface.d.ts +55 -0
  146. package/lib/renderer/models/table-state.class.d.ts +313 -0
  147. package/lib/renderer/models/table-state.interface.d.ts +18 -0
  148. package/lib/renderer/models/table-types.d.ts +228 -0
  149. package/lib/renderer/models/table-validation-state.interface.d.ts +34 -0
  150. package/lib/renderer/models/workbook-state.class.d.ts +117 -0
  151. package/lib/renderer/models/workbook-state.interface.d.ts +71 -0
  152. package/lib/renderer/models/z-index.enum.d.ts +44 -0
  153. package/lib/schemas/table-config.schema.d.ts +455 -0
  154. package/lib/services/autosave.service.d.ts +73 -0
  155. package/lib/services/custom-validation-rules.util.d.ts +12 -0
  156. package/lib/services/json-schema-validator.service.d.ts +49 -0
  157. package/lib/services/row-validation.service.d.ts +17 -0
  158. package/lib/services/validation-logger.service.d.ts +87 -0
  159. package/lib/services/virtual-scroll.service.d.ts +44 -0
  160. package/lib/shared/shared-table-components.module.d.ts +9 -0
  161. package/lib/smart-table.module.d.ts +26 -0
  162. package/lib/strategies/default-editors.d.ts +109 -0
  163. package/lib/strategies/default-formatters.d.ts +116 -0
  164. package/lib/strategies/default-validators.d.ts +113 -0
  165. package/package.json +42 -0
  166. package/public-api.d.ts +70 -0
  167. package/src/lib/builder/README.md +30 -0
  168. package/src/lib/editors/README.md +303 -0
  169. package/src/lib/renderer/components/st-column-filter/README.md +286 -0
@@ -0,0 +1,313 @@
1
+ /**
2
+ * TableState - Reactive state management for table operations
3
+ * Event-driven architecture: tracks state, emits events, consumer handles async data operations
4
+ */
5
+ import { Observable } from 'rxjs';
6
+ import { ColumnConfig } from '../../models/column-config.interface';
7
+ import { PaginationState, SortDirection, FilterOperator, TableStateChangeEvent, TableStateSnapshot, CellFocusPosition } from './table-types';
8
+ import { TableStateConfig } from './table-state.interface';
9
+ import { NavigationDirection } from '../../models/cell-types';
10
+ import { TableValidationState } from './table-validation-state.interface';
11
+ /**
12
+ * TableState class - Column-driven, event-emitting state management
13
+ * NO data manipulation - only state tracking and event emission
14
+ */
15
+ export declare class TableState {
16
+ private _columns;
17
+ private _pagination$;
18
+ private _stateChange$;
19
+ private _initialConfig;
20
+ private _rowNumberWidth;
21
+ private _settingsColumnWidth;
22
+ private _focusedCellPosition$;
23
+ readonly focusedCellPosition$: Observable<CellFocusPosition | null>;
24
+ private _editingCellPosition$;
25
+ readonly editingCellPosition$: Observable<CellFocusPosition | null>;
26
+ private _tableValidationState$;
27
+ readonly tableValidationState$: Observable<TableValidationState>;
28
+ private _rowCount;
29
+ private _columnCount;
30
+ /**
31
+ * Observable of complete state snapshot
32
+ */
33
+ readonly state$: Observable<TableStateSnapshot>;
34
+ /**
35
+ * Observable of state change events
36
+ */
37
+ readonly stateChange$: Observable<TableStateChangeEvent>;
38
+ /**
39
+ * Observable of pagination state changes
40
+ */
41
+ readonly paginationChange$: Observable<PaginationState>;
42
+ /**
43
+ * Constructor
44
+ * @param columns Reference to columns array
45
+ * @param config Initial configuration
46
+ */
47
+ constructor(columns: ColumnConfig<any>[], config?: TableStateConfig);
48
+ /**
49
+ * Get current state snapshot
50
+ */
51
+ getState(): TableStateSnapshot;
52
+ /**
53
+ * Get current pagination state
54
+ */
55
+ getPagination(): PaginationState;
56
+ /**
57
+ * Get columns with sorting enabled
58
+ */
59
+ getSortedColumns(): ColumnConfig<any>[];
60
+ /**
61
+ * Get columns with filtering enabled
62
+ */
63
+ getFilteredColumns(): ColumnConfig<any>[];
64
+ /**
65
+ * Get current columns reference
66
+ */
67
+ getColumns(): ColumnConfig<any>[];
68
+ /**
69
+ * Set current page
70
+ * @param page Page number (0-indexed)
71
+ */
72
+ setPage(page: number): void;
73
+ /**
74
+ * Set page size
75
+ * @param size Number of items per page
76
+ */
77
+ setPageSize(size: number): void;
78
+ /**
79
+ * Set total items (called after API response)
80
+ * @param total Total number of items
81
+ */
82
+ setTotalItems(total: number): void;
83
+ /**
84
+ * Go to next page
85
+ */
86
+ nextPage(): void;
87
+ /**
88
+ * Go to previous page
89
+ */
90
+ previousPage(): void;
91
+ /**
92
+ * Go to first page
93
+ */
94
+ firstPage(): void;
95
+ /**
96
+ * Go to last page
97
+ */
98
+ lastPage(): void;
99
+ /**
100
+ * Check if there is a next page
101
+ */
102
+ hasNextPage(): boolean;
103
+ /**
104
+ * Check if there is a previous page
105
+ */
106
+ hasPreviousPage(): boolean;
107
+ /**
108
+ * Set sort on a column (clears other sorts)
109
+ * @param columnKey Column key
110
+ * @param direction Sort direction
111
+ */
112
+ setSortOnColumn(columnKey: string, direction: SortDirection): void;
113
+ /**
114
+ * Add sort to a column (for multi-column sorting)
115
+ * @param columnKey Column key
116
+ * @param direction Sort direction
117
+ */
118
+ addSortToColumn(columnKey: string, direction: SortDirection): void;
119
+ /**
120
+ * Toggle sort on a column (cycles through none -> asc -> desc -> none)
121
+ * @param columnKey Column key
122
+ */
123
+ toggleSortOnColumn(columnKey: string): void;
124
+ /**
125
+ * Clear all sorting
126
+ */
127
+ clearAllSorting(): void;
128
+ /**
129
+ * Get sort configuration for a column
130
+ * @param columnKey Column key
131
+ * @returns Sort configuration or null
132
+ */
133
+ getSortForColumn(columnKey: string): {
134
+ direction: SortDirection;
135
+ enabled: boolean;
136
+ } | null;
137
+ /**
138
+ * Set filter on a column
139
+ * @param columnKey Column key
140
+ * @param operator Filter operator
141
+ * @param value Filter value
142
+ */
143
+ setFilterOnColumn(columnKey: string, operator: FilterOperator, value: any): void;
144
+ /**
145
+ * Clear filter on a column
146
+ * @param columnKey Column key
147
+ */
148
+ clearFilterOnColumn(columnKey: string): void;
149
+ /**
150
+ * Clear all filters
151
+ */
152
+ clearAllFilters(): void;
153
+ /**
154
+ * Set filter enabled state
155
+ * @param columnKey Column key
156
+ * @param enabled Whether filter is enabled
157
+ */
158
+ setFilterEnabled(columnKey: string, enabled: boolean): void;
159
+ /**
160
+ * Get filter configuration for a column
161
+ * @param columnKey Column key
162
+ * @returns Filter configuration or null
163
+ */
164
+ getFilterForColumn(columnKey: string): {
165
+ operator: FilterOperator;
166
+ value: any;
167
+ enabled: boolean;
168
+ } | null;
169
+ /**
170
+ * Get sticky columns grouped by position
171
+ * @returns Object with left and right sticky column keys
172
+ */
173
+ getStickyColumns(): {
174
+ left: string[];
175
+ right: string[];
176
+ };
177
+ /**
178
+ * Set sticky position for a column
179
+ * @param columnKey Column key
180
+ * @param position Sticky position ('left', 'right', or false)
181
+ */
182
+ setStickyColumn(columnKey: string, position: 'left' | 'right' | false): void;
183
+ /**
184
+ * Calculate sticky offsets for all sticky columns
185
+ * This calculates cumulative widths for positioning
186
+ * @param rowNumberWidth Optional width of row number column to account for in left offset
187
+ * @param settingsColumnWidth Optional width of settings column to account for in right offset
188
+ */
189
+ calculateStickyOffsets(rowNumberWidth?: number, settingsColumnWidth?: number): void;
190
+ /**
191
+ * Update columns reference
192
+ * @param columns New columns array
193
+ */
194
+ updateColumns(columns: ColumnConfig<any>[]): void;
195
+ /**
196
+ * Toggle visibility of a column
197
+ * @param columnKey Column key
198
+ */
199
+ toggleColumnVisibility(columnKey: string): void;
200
+ /**
201
+ * Set visibility of a column
202
+ * @param columnKey Column key
203
+ * @param visible Whether column should be visible
204
+ */
205
+ setColumnVisibility(columnKey: string, visible: boolean): void;
206
+ /**
207
+ * Get all visible columns
208
+ * @returns Array of visible column configs
209
+ */
210
+ getVisibleColumns(): ColumnConfig<any>[];
211
+ /**
212
+ * Get visibility state for all columns
213
+ * @returns Array of column visibility info
214
+ */
215
+ getAllColumnsVisibility(): {
216
+ key: string;
217
+ header: string;
218
+ visible: boolean;
219
+ hideable: boolean;
220
+ }[];
221
+ /**
222
+ * Set table dimensions for navigation boundaries
223
+ */
224
+ setDimensions(rowCount: number, columnCount: number): void;
225
+ /**
226
+ * Focus a cell by position
227
+ */
228
+ focusCell(rowIndex: number, columnIndex: number): void;
229
+ /**
230
+ * Get currently focused position
231
+ */
232
+ getFocusedPosition(): CellFocusPosition | null;
233
+ /**
234
+ * Notify that a cell entered edit mode
235
+ */
236
+ setEditingCell(rowIndex: number, columnIndex: number): void;
237
+ /**
238
+ * Notify that edit mode ended
239
+ */
240
+ clearEditingCell(): void;
241
+ /**
242
+ * Check if any cell is currently editing
243
+ */
244
+ isAnyCellEditing(): boolean;
245
+ /**
246
+ * Get currently editing position
247
+ */
248
+ getEditingPosition(): CellFocusPosition | null;
249
+ /**
250
+ * Move focus in a direction using NavigationDirection enum
251
+ */
252
+ moveFocus(direction: NavigationDirection): boolean;
253
+ /**
254
+ * Clear focus
255
+ */
256
+ clearFocus(): void;
257
+ /**
258
+ * Check if navigation is active
259
+ */
260
+ isNavigationActive(): boolean;
261
+ /**
262
+ * Update cell validation and accumulate into row/table validation state
263
+ * Only stores invalid states - valid rows are automatically removed
264
+ */
265
+ updateCellValidation(rowIndex: number, columnKey: string, isValid: boolean, error?: string): void;
266
+ /**
267
+ * Get current table validation state
268
+ */
269
+ getTableValidationState(): TableValidationState;
270
+ /**
271
+ * Set total rows for validation state tracking
272
+ */
273
+ setValidationRowCount(totalRows: number): void;
274
+ /**
275
+ * Reset to initial configuration
276
+ */
277
+ reset(): void;
278
+ /**
279
+ * Reset pagination only
280
+ */
281
+ resetPagination(): void;
282
+ /**
283
+ * Reset all column sorts
284
+ */
285
+ resetAllSorting(): void;
286
+ /**
287
+ * Reset all column filters
288
+ */
289
+ resetAllFilters(): void;
290
+ /**
291
+ * Find a column by key
292
+ * @param columnKey Column key
293
+ * @returns Column config or undefined
294
+ */
295
+ private findColumn;
296
+ /**
297
+ * Calculate total pages
298
+ * @param totalItems Total number of items
299
+ * @param pageSize Page size
300
+ * @returns Total number of pages
301
+ */
302
+ private calculateTotalPages;
303
+ /**
304
+ * Emit state change event
305
+ * @param type Type of change
306
+ */
307
+ private emitStateChange;
308
+ /**
309
+ * Build state snapshot from current state
310
+ * @returns State snapshot
311
+ */
312
+ private buildStateSnapshot;
313
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Table state interfaces for configuration and initialization
3
+ */
4
+ /**
5
+ * Configuration options for initializing TableState
6
+ */
7
+ export interface TableStateConfig {
8
+ /**
9
+ * Initial page number (0-indexed)
10
+ * @default 0
11
+ */
12
+ initialPage?: number;
13
+ /**
14
+ * Number of items per page
15
+ * @default 25
16
+ */
17
+ pageSize?: number;
18
+ }
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Table types and enumerations for state management
3
+ */
4
+ import type { ColumnConfig } from '../../models/column-config.interface';
5
+ /**
6
+ * Sort direction for columns
7
+ */
8
+ export declare enum SortDirection {
9
+ NONE = "none",
10
+ ASC = "asc",
11
+ DESC = "desc"
12
+ }
13
+ /**
14
+ * Filter operators for column filtering
15
+ */
16
+ export declare enum FilterOperator {
17
+ EQUALS = "equals",
18
+ CONTAINS = "contains",
19
+ STARTS_WITH = "startsWith",
20
+ ENDS_WITH = "endsWith",
21
+ GT = "gt",
22
+ LT = "lt",
23
+ GTE = "gte",
24
+ LTE = "lte",
25
+ BETWEEN = "between",
26
+ IN = "in"
27
+ }
28
+ /**
29
+ * Pagination state for table
30
+ */
31
+ export interface PaginationState {
32
+ currentPage: number;
33
+ pageSize: number;
34
+ totalItems: number;
35
+ totalPages: number;
36
+ }
37
+ /**
38
+ * Sort state for a column
39
+ * Contains full information about an active sort operation
40
+ */
41
+ export interface ColumnSortState {
42
+ columnKey: string;
43
+ direction: SortDirection;
44
+ priority?: number;
45
+ }
46
+ /**
47
+ * Filter state for a column
48
+ * Contains full information about an active filter operation
49
+ */
50
+ export interface ColumnFilterState {
51
+ columnKey: string;
52
+ operator: FilterOperator;
53
+ value: any;
54
+ enabled: boolean;
55
+ }
56
+ /**
57
+ * Cell focus position for keyboard navigation
58
+ */
59
+ export interface CellFocusPosition {
60
+ rowIndex: number;
61
+ columnIndex: number;
62
+ }
63
+ /**
64
+ * Table state change event
65
+ */
66
+ export interface TableStateChangeEvent {
67
+ type: 'pagination' | 'sorting' | 'filtering' | 'column-config' | 'column-visibility' | 'cell-focus' | 'cell-edit-start' | 'cell-edit-end';
68
+ state: TableStateSnapshot;
69
+ focusPosition?: CellFocusPosition;
70
+ editingPosition?: CellFocusPosition;
71
+ }
72
+ /**
73
+ * Snapshot of current table state
74
+ * Contains complete state information for sorting, filtering, and pagination
75
+ */
76
+ export interface TableStateSnapshot {
77
+ pagination: PaginationState;
78
+ sortedColumns: ColumnSortState[];
79
+ filteredColumns: ColumnFilterState[];
80
+ }
81
+ /**
82
+ * Column resize event
83
+ * Emitted when a column is resized by the user
84
+ */
85
+ export interface ColumnResizeEvent {
86
+ /**
87
+ * Key of the resized column
88
+ */
89
+ columnKey: string;
90
+ /**
91
+ * Previous width before resize
92
+ */
93
+ oldWidth: number;
94
+ /**
95
+ * New width after resize
96
+ */
97
+ newWidth: number;
98
+ /**
99
+ * The column configuration
100
+ */
101
+ column: ColumnConfig;
102
+ }
103
+ /**
104
+ * Column sort toggle event
105
+ * Emitted when a column's sort direction is changed
106
+ */
107
+ export interface ColumnSortEvent {
108
+ /**
109
+ * Key of the sorted column
110
+ */
111
+ columnKey: string;
112
+ /**
113
+ * New sort direction
114
+ */
115
+ direction: SortDirection;
116
+ /**
117
+ * Previous sort direction
118
+ */
119
+ previousDirection: SortDirection;
120
+ /**
121
+ * The column configuration
122
+ */
123
+ column: ColumnConfig;
124
+ /**
125
+ * Current table state snapshot
126
+ */
127
+ tableState: TableStateSnapshot;
128
+ }
129
+ /**
130
+ * Column filter change event
131
+ * Emitted when a column filter is modified
132
+ */
133
+ export interface ColumnFilterEvent {
134
+ /**
135
+ * Key of the filtered column
136
+ */
137
+ columnKey: string;
138
+ /**
139
+ * Filter operator
140
+ */
141
+ operator: FilterOperator;
142
+ /**
143
+ * Filter value
144
+ */
145
+ value: any;
146
+ /**
147
+ * Previous filter value
148
+ */
149
+ previousValue?: any;
150
+ /**
151
+ * Whether filter is enabled
152
+ */
153
+ enabled: boolean;
154
+ /**
155
+ * The column configuration
156
+ */
157
+ column: ColumnConfig;
158
+ /**
159
+ * Current table state snapshot
160
+ */
161
+ tableState: TableStateSnapshot;
162
+ }
163
+ /**
164
+ * Column moved event
165
+ * Emitted when a column is reordered
166
+ */
167
+ export interface ColumnMoveEvent {
168
+ /**
169
+ * Key of the moved column
170
+ */
171
+ columnKey: string;
172
+ /**
173
+ * Direction of movement
174
+ */
175
+ direction: 'left' | 'right';
176
+ /**
177
+ * Original column index
178
+ */
179
+ oldIndex: number;
180
+ /**
181
+ * New column index after move
182
+ */
183
+ newIndex: number;
184
+ /**
185
+ * The column configuration
186
+ */
187
+ column: ColumnConfig;
188
+ }
189
+ /**
190
+ * Column added event
191
+ * Emitted when a new column is added to the table
192
+ */
193
+ export interface ColumnAddEvent {
194
+ /**
195
+ * The newly added column configuration
196
+ */
197
+ column: ColumnConfig;
198
+ /**
199
+ * Index where column was added
200
+ */
201
+ index: number;
202
+ /**
203
+ * Total number of columns after addition
204
+ */
205
+ totalColumns: number;
206
+ }
207
+ /**
208
+ * Data change event
209
+ * Emitted when table data is updated (via sync or async input)
210
+ */
211
+ export interface DataChangeEvent {
212
+ /**
213
+ * Previous data array reference
214
+ */
215
+ previousData: any[];
216
+ /**
217
+ * Current data array reference
218
+ */
219
+ currentData: any[];
220
+ /**
221
+ * Timestamp when change occurred
222
+ */
223
+ timestamp: number;
224
+ /**
225
+ * Source of the data change
226
+ */
227
+ source: 'sync' | 'async';
228
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Table validation state interface
3
+ * Aggregates validation results from all rows in the table
4
+ * Note: Only invalid rows are stored in rowStates - absence means row is valid
5
+ */
6
+ import { RowValidationState } from './row-validation-state.interface';
7
+ export interface TableValidationState {
8
+ /**
9
+ * Whether all rows in the table are valid
10
+ * True when rowStates is empty (no invalid rows)
11
+ */
12
+ isValid: boolean;
13
+ /**
14
+ * Total number of rows in the table
15
+ */
16
+ totalRows: number;
17
+ /**
18
+ * Number of valid rows (calculated as totalRows - invalidRows)
19
+ */
20
+ validRows: number;
21
+ /**
22
+ * Number of invalid rows (size of rowStates map)
23
+ */
24
+ invalidRows: number;
25
+ /**
26
+ * Map of row indices to their validation states
27
+ * Only contains INVALID rows - if a row is not in this map, it's valid
28
+ */
29
+ rowStates: Map<number, RowValidationState>;
30
+ /**
31
+ * Timestamp of the last validation state update
32
+ */
33
+ lastUpdated: Date;
34
+ }
@@ -0,0 +1,117 @@
1
+ /**
2
+ * WorkbookState - Reactive state management for workbook operations
3
+ * Manages multiple sheet states and workbook-level state
4
+ */
5
+ import { BehaviorSubject, Observable } from 'rxjs';
6
+ import { TableState } from './table-state.class';
7
+ import { WorkbookStateConfig, WorkbookMetadata, WorkbookStateSnapshot } from './workbook-state.interface';
8
+ import { ColumnConfig } from '../../models/column-config.interface';
9
+ import { TableStateConfig } from './table-state.interface';
10
+ /**
11
+ * WorkbookState class - Manages workbook-level state and sheet TableStates
12
+ */
13
+ export declare class WorkbookState {
14
+ /**
15
+ * Workbook identity
16
+ */
17
+ readonly id: string;
18
+ /**
19
+ * Observable workbook name
20
+ */
21
+ readonly name$: BehaviorSubject<string>;
22
+ /**
23
+ * Map of TableState instances (one per sheet)
24
+ * Key: sheetId, Value: TableState
25
+ */
26
+ private _sheetTableStates;
27
+ /**
28
+ * Active sheet tracking
29
+ */
30
+ private _activeSheetIndex$;
31
+ readonly activeSheetIndex$: Observable<number>;
32
+ /**
33
+ * Fullscreen state
34
+ */
35
+ private _isFullscreen$;
36
+ readonly isFullscreen$: Observable<boolean>;
37
+ /**
38
+ * Workbook metadata
39
+ */
40
+ private _metadata$;
41
+ readonly metadata$: Observable<WorkbookMetadata>;
42
+ /**
43
+ * Constructor
44
+ * @param config Workbook state configuration
45
+ */
46
+ constructor(config: WorkbookStateConfig);
47
+ /**
48
+ * Get or create TableState for a sheet
49
+ * @param sheetId Sheet ID
50
+ * @param columns Column configurations for the sheet
51
+ * @param tableStateConfig Optional table state configuration
52
+ * @returns TableState instance for the sheet
53
+ */
54
+ getSheetTableState(sheetId: string, columns: ColumnConfig<any>[], tableStateConfig?: TableStateConfig): TableState;
55
+ /**
56
+ * Set TableState for a sheet (useful for lazy initialization)
57
+ * @param sheetId Sheet ID
58
+ * @param tableState TableState instance to set
59
+ */
60
+ setSheetTableState(sheetId: string, tableState: TableState): void;
61
+ /**
62
+ * Remove TableState for a sheet
63
+ * @param sheetId Sheet ID to remove
64
+ */
65
+ removeSheetTableState(sheetId: string): void;
66
+ /**
67
+ * Set active sheet index
68
+ * @param index Sheet index (0-based)
69
+ */
70
+ setActiveSheetIndex(index: number): void;
71
+ /**
72
+ * Get current active sheet index
73
+ */
74
+ getActiveSheetIndex(): number;
75
+ /**
76
+ * Toggle fullscreen mode
77
+ */
78
+ toggleFullscreen(): void;
79
+ /**
80
+ * Set fullscreen mode
81
+ * @param fullscreen Fullscreen state
82
+ */
83
+ setFullscreen(fullscreen: boolean): void;
84
+ /**
85
+ * Get current fullscreen state
86
+ */
87
+ isFullscreen(): boolean;
88
+ /**
89
+ * Update workbook name
90
+ * @param name New workbook name
91
+ */
92
+ updateName(name: string): void;
93
+ /**
94
+ * Get current workbook name
95
+ */
96
+ getName(): string;
97
+ /**
98
+ * Get complete state snapshot
99
+ */
100
+ getSnapshot(): WorkbookStateSnapshot;
101
+ /**
102
+ * Update last accessed timestamp
103
+ */
104
+ private updateLastAccessed;
105
+ /**
106
+ * Update last modified timestamp
107
+ */
108
+ private updateLastModified;
109
+ /**
110
+ * Update sheet count in metadata
111
+ */
112
+ private updateSheetCount;
113
+ /**
114
+ * Get current metadata
115
+ */
116
+ getMetadata(): WorkbookMetadata;
117
+ }