@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.
- package/README.md +152 -0
- package/aquera-ngx-smart-table.d.ts +5 -0
- package/esm2020/aquera-ngx-smart-table.mjs +5 -0
- package/esm2020/lib/builder/components/builder-preview/builder-preview.component.mjs +63 -0
- package/esm2020/lib/builder/components/builder-toolbar/builder-toolbar.component.mjs +115 -0
- package/esm2020/lib/builder/components/column-editor/column-editor.component.mjs +206 -0
- package/esm2020/lib/builder/components/column-list/column-list.component.mjs +125 -0
- package/esm2020/lib/builder/components/definition-builder/definition-builder.component.mjs +105 -0
- package/esm2020/lib/builder/components/table-config-editor/table-config-editor.component.mjs +132 -0
- package/esm2020/lib/builder/definition-builder.module.mjs +70 -0
- package/esm2020/lib/builder/models/builder-state.interface.mjs +5 -0
- package/esm2020/lib/builder/services/definition-builder.service.mjs +251 -0
- package/esm2020/lib/builder/services/definition-export.service.mjs +167 -0
- package/esm2020/lib/builder/services/definition-import.service.mjs +193 -0
- package/esm2020/lib/builder/services/sample-data-generator.service.mjs +126 -0
- package/esm2020/lib/builder/utils/config-validator.util.mjs +165 -0
- package/esm2020/lib/builder/utils/typescript-generator.util.mjs +206 -0
- package/esm2020/lib/editors/index.mjs +9 -0
- package/esm2020/lib/editors/nile-autocomplete-editor.mjs +228 -0
- package/esm2020/lib/editors/nile-calendar-editor.mjs +214 -0
- package/esm2020/lib/editors/nile-date-picker-editor.mjs +227 -0
- package/esm2020/lib/editors/nile-input-editor.mjs +235 -0
- package/esm2020/lib/editors/nile-select-editor.mjs +317 -0
- package/esm2020/lib/factories/column-config.factory.mjs +231 -0
- package/esm2020/lib/models/autosave-config.interface.mjs +8 -0
- package/esm2020/lib/models/base-column-config.class.mjs +253 -0
- package/esm2020/lib/models/cell-strategies.interface.mjs +6 -0
- package/esm2020/lib/models/cell-types.mjs +147 -0
- package/esm2020/lib/models/column-action.interface.mjs +6 -0
- package/esm2020/lib/models/column-config.interface.mjs +43 -0
- package/esm2020/lib/models/column-config.utils.mjs +101 -0
- package/esm2020/lib/models/row-action.interface.mjs +5 -0
- package/esm2020/lib/models/row-validator.interface.mjs +2 -0
- package/esm2020/lib/models/schema-validation.interface.mjs +2 -0
- package/esm2020/lib/models/sheet-action.interface.mjs +5 -0
- package/esm2020/lib/models/sheet-config.interface.mjs +5 -0
- package/esm2020/lib/models/table-config.interface.mjs +106 -0
- package/esm2020/lib/models/table-validator.interface.mjs +2 -0
- package/esm2020/lib/models/workbook-action.interface.mjs +5 -0
- package/esm2020/lib/models/workbook-config.interface.mjs +5 -0
- package/esm2020/lib/renderer/components/st-add-column-button/st-add-column-button.component.mjs +24 -0
- package/esm2020/lib/renderer/components/st-cell/st-cell.component.mjs +391 -0
- package/esm2020/lib/renderer/components/st-column-editor-modal/st-column-editor-modal.component.mjs +103 -0
- package/esm2020/lib/renderer/components/st-column-filter/st-column-filter.component.mjs +383 -0
- package/esm2020/lib/renderer/components/st-column-menu/st-column-menu.component.mjs +232 -0
- package/esm2020/lib/renderer/components/st-column-visibility/st-column-visibility.component.mjs +97 -0
- package/esm2020/lib/renderer/components/st-header/st-header.component.mjs +157 -0
- package/esm2020/lib/renderer/components/st-pagination/st-pagination.component.mjs +87 -0
- package/esm2020/lib/renderer/components/st-row-actions-dropdown/st-row-actions-dropdown.component.mjs +167 -0
- package/esm2020/lib/renderer/components/st-sheet/st-sheet.component.mjs +165 -0
- package/esm2020/lib/renderer/components/st-sheet-actions/st-sheet-actions.component.mjs +112 -0
- package/esm2020/lib/renderer/components/st-table/st-table.component.mjs +1246 -0
- package/esm2020/lib/renderer/components/st-table-actions/st-table-actions.component.mjs +171 -0
- package/esm2020/lib/renderer/components/st-workbook/st-workbook.component.mjs +489 -0
- package/esm2020/lib/renderer/directives/click-outside.directive.mjs +28 -0
- package/esm2020/lib/renderer/directives/st-column-resize.directive.mjs +108 -0
- package/esm2020/lib/renderer/directives/st-keyboard-navigation.directive.mjs +73 -0
- package/esm2020/lib/renderer/models/cell-state.interface.mjs +66 -0
- package/esm2020/lib/renderer/models/cell.class.mjs +389 -0
- package/esm2020/lib/renderer/models/row-validation-state.interface.mjs +7 -0
- package/esm2020/lib/renderer/models/sheet-state.class.mjs +90 -0
- package/esm2020/lib/renderer/models/sheet-state.interface.mjs +5 -0
- package/esm2020/lib/renderer/models/table-state.class.mjs +841 -0
- package/esm2020/lib/renderer/models/table-state.interface.mjs +5 -0
- package/esm2020/lib/renderer/models/table-types.mjs +29 -0
- package/esm2020/lib/renderer/models/table-validation-state.interface.mjs +7 -0
- package/esm2020/lib/renderer/models/workbook-state.class.mjs +174 -0
- package/esm2020/lib/renderer/models/workbook-state.interface.mjs +5 -0
- package/esm2020/lib/renderer/models/z-index.enum.mjs +55 -0
- package/esm2020/lib/schemas/table-config.schema.mjs +472 -0
- package/esm2020/lib/services/autosave.service.mjs +92 -0
- package/esm2020/lib/services/custom-validation-rules.util.mjs +124 -0
- package/esm2020/lib/services/json-schema-validator.service.mjs +216 -0
- package/esm2020/lib/services/row-validation.service.mjs +42 -0
- package/esm2020/lib/services/validation-logger.service.mjs +177 -0
- package/esm2020/lib/services/virtual-scroll.service.mjs +52 -0
- package/esm2020/lib/shared/shared-table-components.module.mjs +35 -0
- package/esm2020/lib/smart-table.module.mjs +124 -0
- package/esm2020/lib/strategies/default-editors.mjs +433 -0
- package/esm2020/lib/strategies/default-formatters.mjs +238 -0
- package/esm2020/lib/strategies/default-validators.mjs +327 -0
- package/esm2020/public-api.mjs +146 -0
- package/fesm2015/aquera-ngx-smart-table.mjs +11860 -0
- package/fesm2015/aquera-ngx-smart-table.mjs.map +1 -0
- package/fesm2020/aquera-ngx-smart-table.mjs +11897 -0
- package/fesm2020/aquera-ngx-smart-table.mjs.map +1 -0
- package/lib/builder/components/builder-preview/builder-preview.component.d.ts +31 -0
- package/lib/builder/components/builder-toolbar/builder-toolbar.component.d.ts +53 -0
- package/lib/builder/components/column-editor/column-editor.component.d.ts +69 -0
- package/lib/builder/components/column-list/column-list.component.d.ts +65 -0
- package/lib/builder/components/definition-builder/definition-builder.component.d.ts +58 -0
- package/lib/builder/components/table-config-editor/table-config-editor.component.d.ts +32 -0
- package/lib/builder/definition-builder.module.d.ts +15 -0
- package/lib/builder/models/builder-state.interface.d.ts +93 -0
- package/lib/builder/services/definition-builder.service.d.ts +80 -0
- package/lib/builder/services/definition-export.service.d.ts +59 -0
- package/lib/builder/services/definition-import.service.d.ts +31 -0
- package/lib/builder/services/sample-data-generator.service.d.ts +41 -0
- package/lib/builder/utils/config-validator.util.d.ts +32 -0
- package/lib/builder/utils/typescript-generator.util.d.ts +29 -0
- package/lib/editors/index.d.ts +8 -0
- package/lib/editors/nile-autocomplete-editor.d.ts +102 -0
- package/lib/editors/nile-calendar-editor.d.ts +89 -0
- package/lib/editors/nile-date-picker-editor.d.ts +95 -0
- package/lib/editors/nile-input-editor.d.ts +67 -0
- package/lib/editors/nile-select-editor.d.ts +109 -0
- package/lib/factories/column-config.factory.d.ts +73 -0
- package/lib/models/autosave-config.interface.d.ts +23 -0
- package/lib/models/base-column-config.class.d.ts +115 -0
- package/lib/models/cell-strategies.interface.d.ts +181 -0
- package/lib/models/cell-types.d.ts +337 -0
- package/lib/models/column-action.interface.d.ts +86 -0
- package/lib/models/column-config.interface.d.ts +272 -0
- package/lib/models/column-config.utils.d.ts +37 -0
- package/lib/models/row-action.interface.d.ts +86 -0
- package/lib/models/row-validator.interface.d.ts +37 -0
- package/lib/models/schema-validation.interface.d.ts +42 -0
- package/lib/models/sheet-action.interface.d.ts +59 -0
- package/lib/models/sheet-config.interface.d.ts +41 -0
- package/lib/models/table-config.interface.d.ts +245 -0
- package/lib/models/table-validator.interface.d.ts +40 -0
- package/lib/models/workbook-action.interface.d.ts +90 -0
- package/lib/models/workbook-config.interface.d.ts +107 -0
- package/lib/renderer/components/st-add-column-button/st-add-column-button.component.d.ts +9 -0
- package/lib/renderer/components/st-cell/st-cell.component.d.ts +69 -0
- package/lib/renderer/components/st-column-editor-modal/st-column-editor-modal.component.d.ts +39 -0
- package/lib/renderer/components/st-column-filter/st-column-filter.component.d.ts +139 -0
- package/lib/renderer/components/st-column-menu/st-column-menu.component.d.ts +81 -0
- package/lib/renderer/components/st-column-visibility/st-column-visibility.component.d.ts +44 -0
- package/lib/renderer/components/st-header/st-header.component.d.ts +93 -0
- package/lib/renderer/components/st-pagination/st-pagination.component.d.ts +42 -0
- package/lib/renderer/components/st-row-actions-dropdown/st-row-actions-dropdown.component.d.ts +67 -0
- package/lib/renderer/components/st-sheet/st-sheet.component.d.ts +98 -0
- package/lib/renderer/components/st-sheet-actions/st-sheet-actions.component.d.ts +58 -0
- package/lib/renderer/components/st-table/st-table.component.d.ts +349 -0
- package/lib/renderer/components/st-table-actions/st-table-actions.component.d.ts +77 -0
- package/lib/renderer/components/st-workbook/st-workbook.component.d.ts +235 -0
- package/lib/renderer/directives/click-outside.directive.d.ts +10 -0
- package/lib/renderer/directives/st-column-resize.directive.d.ts +44 -0
- package/lib/renderer/directives/st-keyboard-navigation.directive.d.ts +15 -0
- package/lib/renderer/models/cell-state.interface.d.ts +118 -0
- package/lib/renderer/models/cell.class.d.ts +174 -0
- package/lib/renderer/models/row-validation-state.interface.d.ts +27 -0
- package/lib/renderer/models/sheet-state.class.d.ts +67 -0
- package/lib/renderer/models/sheet-state.interface.d.ts +55 -0
- package/lib/renderer/models/table-state.class.d.ts +313 -0
- package/lib/renderer/models/table-state.interface.d.ts +18 -0
- package/lib/renderer/models/table-types.d.ts +228 -0
- package/lib/renderer/models/table-validation-state.interface.d.ts +34 -0
- package/lib/renderer/models/workbook-state.class.d.ts +117 -0
- package/lib/renderer/models/workbook-state.interface.d.ts +71 -0
- package/lib/renderer/models/z-index.enum.d.ts +44 -0
- package/lib/schemas/table-config.schema.d.ts +455 -0
- package/lib/services/autosave.service.d.ts +73 -0
- package/lib/services/custom-validation-rules.util.d.ts +12 -0
- package/lib/services/json-schema-validator.service.d.ts +49 -0
- package/lib/services/row-validation.service.d.ts +17 -0
- package/lib/services/validation-logger.service.d.ts +87 -0
- package/lib/services/virtual-scroll.service.d.ts +44 -0
- package/lib/shared/shared-table-components.module.d.ts +9 -0
- package/lib/smart-table.module.d.ts +26 -0
- package/lib/strategies/default-editors.d.ts +109 -0
- package/lib/strategies/default-formatters.d.ts +116 -0
- package/lib/strategies/default-validators.d.ts +113 -0
- package/package.json +42 -0
- package/public-api.d.ts +70 -0
- package/src/lib/builder/README.md +30 -0
- package/src/lib/editors/README.md +303 -0
- package/src/lib/renderer/components/st-column-filter/README.md +286 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column Resize Directive
|
|
3
|
+
* Handles column resizing when applied to th/td elements
|
|
4
|
+
*/
|
|
5
|
+
import { ElementRef, EventEmitter, OnDestroy } from '@angular/core';
|
|
6
|
+
import { ColumnConfig } from '../../models/column-config.interface';
|
|
7
|
+
import { ColumnResizeEvent } from '../models/table-types';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export declare class StColumnResizeDirective implements OnDestroy {
|
|
10
|
+
private el;
|
|
11
|
+
/**
|
|
12
|
+
* Column configuration
|
|
13
|
+
*/
|
|
14
|
+
column: ColumnConfig<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Emits when column is resized
|
|
17
|
+
*/
|
|
18
|
+
columnResized: EventEmitter<ColumnResizeEvent>;
|
|
19
|
+
/**
|
|
20
|
+
* Resize state
|
|
21
|
+
*/
|
|
22
|
+
private isResizing;
|
|
23
|
+
private startX;
|
|
24
|
+
private startWidth;
|
|
25
|
+
constructor(el: ElementRef<HTMLElement>);
|
|
26
|
+
/**
|
|
27
|
+
* Start resize on mousedown
|
|
28
|
+
*/
|
|
29
|
+
onResizeStart(event: MouseEvent): void;
|
|
30
|
+
/**
|
|
31
|
+
* Track mouse movement during resize
|
|
32
|
+
*/
|
|
33
|
+
private onResizeMove;
|
|
34
|
+
/**
|
|
35
|
+
* End resize on mouseup
|
|
36
|
+
*/
|
|
37
|
+
private onResizeEnd;
|
|
38
|
+
/**
|
|
39
|
+
* Cleanup on destroy
|
|
40
|
+
*/
|
|
41
|
+
ngOnDestroy(): void;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StColumnResizeDirective, never>;
|
|
43
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<StColumnResizeDirective, "[stColumnResize]", never, { "column": "column"; }, { "columnResized": "columnResized"; }, never>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TableState } from '../models/table-state.class';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Directive to handle keyboard navigation in table cells
|
|
5
|
+
*/
|
|
6
|
+
export declare class StKeyboardNavigationDirective {
|
|
7
|
+
tableState: TableState;
|
|
8
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
9
|
+
/**
|
|
10
|
+
* Convert navigation key to direction using enums
|
|
11
|
+
*/
|
|
12
|
+
private getDirection;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StKeyboardNavigationDirective, never>;
|
|
14
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<StKeyboardNavigationDirective, "[stKeyboardNavigation]", never, { "tableState": "tableState"; }, {}, never>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell state interface - represents unique state per cell instance
|
|
3
|
+
* This is the "Context" in the Flyweight pattern
|
|
4
|
+
*/
|
|
5
|
+
import { CellLifecycleState } from '../../models/cell-types';
|
|
6
|
+
/**
|
|
7
|
+
* Cell state containing all unique state per cell instance
|
|
8
|
+
* This is stored individually per cell, while ColumnConfig is shared (Flyweight)
|
|
9
|
+
*/
|
|
10
|
+
export interface CellState<T = any> {
|
|
11
|
+
/**
|
|
12
|
+
* Current cell value
|
|
13
|
+
*/
|
|
14
|
+
value: T;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the cell is currently in edit mode
|
|
17
|
+
*/
|
|
18
|
+
isEditing: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the cell value has been modified
|
|
21
|
+
*/
|
|
22
|
+
isDirty: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Previous value before current edit (for undo/cancel)
|
|
25
|
+
*/
|
|
26
|
+
previousValue?: T;
|
|
27
|
+
/**
|
|
28
|
+
* Original value when cell was initialized (for reset)
|
|
29
|
+
*/
|
|
30
|
+
originalValue?: T;
|
|
31
|
+
/**
|
|
32
|
+
* Validation error message if validation failed
|
|
33
|
+
*/
|
|
34
|
+
error?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Multiple validation errors (field-specific)
|
|
37
|
+
*/
|
|
38
|
+
errors?: Record<string, string>;
|
|
39
|
+
/**
|
|
40
|
+
* Warning messages (non-blocking)
|
|
41
|
+
*/
|
|
42
|
+
warnings?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Current lifecycle state of the cell
|
|
45
|
+
*/
|
|
46
|
+
lifecycleState: CellLifecycleState;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the cell is currently loading (async operations)
|
|
49
|
+
*/
|
|
50
|
+
isLoading?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the cell is disabled
|
|
53
|
+
*/
|
|
54
|
+
isDisabled?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the cell is readonly
|
|
57
|
+
*/
|
|
58
|
+
isReadonly?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the cell is selected
|
|
61
|
+
*/
|
|
62
|
+
isSelected?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the cell is focused
|
|
65
|
+
*/
|
|
66
|
+
isFocused?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the cell is hovered
|
|
69
|
+
*/
|
|
70
|
+
isHovered?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Custom metadata for cell-specific data
|
|
73
|
+
*/
|
|
74
|
+
metadata?: Record<string, any>;
|
|
75
|
+
/**
|
|
76
|
+
* Timestamp of last modification
|
|
77
|
+
*/
|
|
78
|
+
lastModified?: Date;
|
|
79
|
+
/**
|
|
80
|
+
* Timestamp of last validation
|
|
81
|
+
*/
|
|
82
|
+
lastValidated?: Date;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Factory function to create initial cell state with defaults
|
|
86
|
+
*/
|
|
87
|
+
export declare function createCellState<T>(value: T, overrides?: Partial<CellState<T>>): CellState<T>;
|
|
88
|
+
/**
|
|
89
|
+
* Cell state memento for save/restore operations (Memento pattern)
|
|
90
|
+
* Contains minimal state needed for undo/redo
|
|
91
|
+
*/
|
|
92
|
+
export interface CellStateMemento<T = any> {
|
|
93
|
+
value: T;
|
|
94
|
+
isDirty: boolean;
|
|
95
|
+
error?: string;
|
|
96
|
+
metadata?: Record<string, any>;
|
|
97
|
+
timestamp: Date;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create a memento snapshot of cell state
|
|
101
|
+
*/
|
|
102
|
+
export declare function createMemento<T>(state: CellState<T>): CellStateMemento<T>;
|
|
103
|
+
/**
|
|
104
|
+
* Restore cell state from memento
|
|
105
|
+
*/
|
|
106
|
+
export declare function restoreFromMemento<T>(currentState: CellState<T>, memento: CellStateMemento<T>): CellState<T>;
|
|
107
|
+
/**
|
|
108
|
+
* Helper to check if cell is in valid state
|
|
109
|
+
*/
|
|
110
|
+
export declare function isCellValid<T>(state: CellState<T>): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Helper to check if cell can be edited
|
|
113
|
+
*/
|
|
114
|
+
export declare function canEdit<T>(state: CellState<T>): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Helper to check if cell is in display mode
|
|
117
|
+
*/
|
|
118
|
+
export declare function isDisplayMode<T>(state: CellState<T>): boolean;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell class - represents individual cell instances
|
|
3
|
+
* Combines ColumnConfig (Flyweight) with CellState (unique per instance)
|
|
4
|
+
*/
|
|
5
|
+
import { ColumnConfig } from '../../models/column-config.interface';
|
|
6
|
+
import { CellState } from './cell-state.interface';
|
|
7
|
+
import { ValidationResult } from '../../models/cell-types';
|
|
8
|
+
/**
|
|
9
|
+
* Cell class implementing the Flyweight pattern
|
|
10
|
+
* - References shared ColumnConfig (Flyweight)
|
|
11
|
+
* - Owns unique CellState (Flyweight Context)
|
|
12
|
+
*/
|
|
13
|
+
export declare class Cell<T = any> {
|
|
14
|
+
/**
|
|
15
|
+
* Shared column configuration (Flyweight - reference only, not owned)
|
|
16
|
+
*/
|
|
17
|
+
private readonly columnConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Unique cell state (owned by this instance)
|
|
20
|
+
*/
|
|
21
|
+
private state;
|
|
22
|
+
/**
|
|
23
|
+
* Row data context (reference to parent row data)
|
|
24
|
+
*/
|
|
25
|
+
private rowData?;
|
|
26
|
+
/**
|
|
27
|
+
* Row index in table
|
|
28
|
+
*/
|
|
29
|
+
private rowIndex?;
|
|
30
|
+
/**
|
|
31
|
+
* History of state mementos for undo/redo
|
|
32
|
+
*/
|
|
33
|
+
private history;
|
|
34
|
+
/**
|
|
35
|
+
* Current position in history
|
|
36
|
+
*/
|
|
37
|
+
private historyIndex;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum history size
|
|
40
|
+
*/
|
|
41
|
+
private readonly maxHistorySize;
|
|
42
|
+
constructor(columnConfig: ColumnConfig<T>, initialValue: T, rowData?: any, rowIndex?: number);
|
|
43
|
+
/**
|
|
44
|
+
* Get current cell value
|
|
45
|
+
*/
|
|
46
|
+
getValue(): T;
|
|
47
|
+
/**
|
|
48
|
+
* Set cell value
|
|
49
|
+
* @param value New value
|
|
50
|
+
* @param skipValidation Skip validation (useful for programmatic sets)
|
|
51
|
+
*/
|
|
52
|
+
setValue(value: T, skipValidation?: boolean): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Render cell value as formatted string (delegates to formatter strategy)
|
|
55
|
+
*/
|
|
56
|
+
render(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Validate cell value (delegates to validator strategy)
|
|
59
|
+
*/
|
|
60
|
+
validate(): ValidationResult;
|
|
61
|
+
/**
|
|
62
|
+
* Start edit mode
|
|
63
|
+
*/
|
|
64
|
+
startEdit(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Save edited value
|
|
67
|
+
* @param newValue The new value from editor
|
|
68
|
+
*/
|
|
69
|
+
saveEdit(newValue: T): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Cancel edit and revert to previous value
|
|
72
|
+
*/
|
|
73
|
+
cancelEdit(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Reset cell to original value
|
|
76
|
+
*/
|
|
77
|
+
reset(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Check if cell can be edited
|
|
80
|
+
*/
|
|
81
|
+
canEdit(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Check if cell is valid
|
|
84
|
+
*/
|
|
85
|
+
isValid(): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Check if cell is dirty (modified)
|
|
88
|
+
*/
|
|
89
|
+
isDirty(): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Check if cell is in edit mode
|
|
92
|
+
*/
|
|
93
|
+
isEditing(): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Set focus state on this cell
|
|
96
|
+
*/
|
|
97
|
+
focus(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Remove focus from this cell
|
|
100
|
+
*/
|
|
101
|
+
blur(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Check if this cell is focused
|
|
104
|
+
*/
|
|
105
|
+
isFocused(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Get current cell state (Memento pattern)
|
|
108
|
+
*/
|
|
109
|
+
getState(): CellState<T>;
|
|
110
|
+
/**
|
|
111
|
+
* Restore cell state from snapshot (Memento pattern)
|
|
112
|
+
*/
|
|
113
|
+
restoreState(state: CellState<T>): void;
|
|
114
|
+
/**
|
|
115
|
+
* Get column configuration (readonly access)
|
|
116
|
+
*/
|
|
117
|
+
getColumnConfig(): Readonly<ColumnConfig<T>>;
|
|
118
|
+
/**
|
|
119
|
+
* Get row data context
|
|
120
|
+
*/
|
|
121
|
+
getRowData(): any;
|
|
122
|
+
/**
|
|
123
|
+
* Get row index
|
|
124
|
+
*/
|
|
125
|
+
getRowIndex(): number | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Set loading state
|
|
128
|
+
*/
|
|
129
|
+
setLoading(isLoading: boolean): void;
|
|
130
|
+
/**
|
|
131
|
+
* Set disabled state
|
|
132
|
+
*/
|
|
133
|
+
setDisabled(isDisabled: boolean): void;
|
|
134
|
+
/**
|
|
135
|
+
* Set readonly state
|
|
136
|
+
*/
|
|
137
|
+
setReadonly(isReadonly: boolean): void;
|
|
138
|
+
/**
|
|
139
|
+
* Save current state to history
|
|
140
|
+
*/
|
|
141
|
+
private saveToHistory;
|
|
142
|
+
/**
|
|
143
|
+
* Undo last change
|
|
144
|
+
*/
|
|
145
|
+
undo(): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Redo last undone change
|
|
148
|
+
*/
|
|
149
|
+
redo(): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Check if undo is available
|
|
152
|
+
*/
|
|
153
|
+
canUndo(): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Check if redo is available
|
|
156
|
+
*/
|
|
157
|
+
canRedo(): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Create cell event for hooks
|
|
160
|
+
*/
|
|
161
|
+
private createEvent;
|
|
162
|
+
/**
|
|
163
|
+
* Get cell metadata
|
|
164
|
+
*/
|
|
165
|
+
getMetadata(key: string): any;
|
|
166
|
+
/**
|
|
167
|
+
* Set cell metadata
|
|
168
|
+
*/
|
|
169
|
+
setMetadata(key: string, value: any): void;
|
|
170
|
+
/**
|
|
171
|
+
* Clear all metadata
|
|
172
|
+
*/
|
|
173
|
+
clearMetadata(): void;
|
|
174
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row validation state interface
|
|
3
|
+
* Represents an INVALID row with accumulated cell errors
|
|
4
|
+
* Note: Valid rows are not stored - absence of a row state means the row is valid
|
|
5
|
+
*/
|
|
6
|
+
export interface RowValidationState {
|
|
7
|
+
/**
|
|
8
|
+
* Index of the row in the table
|
|
9
|
+
*/
|
|
10
|
+
rowIndex: number;
|
|
11
|
+
/**
|
|
12
|
+
* Always false for stored states (only invalid rows are stored)
|
|
13
|
+
*/
|
|
14
|
+
isValid: false;
|
|
15
|
+
/**
|
|
16
|
+
* Number of invalid cells in the row
|
|
17
|
+
*/
|
|
18
|
+
invalidCellCount: number;
|
|
19
|
+
/**
|
|
20
|
+
* Map of column keys to validation error messages
|
|
21
|
+
*/
|
|
22
|
+
cellErrors: Map<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Timestamp of the last validation
|
|
25
|
+
*/
|
|
26
|
+
lastValidated: Date;
|
|
27
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SheetState - Reactive state management for sheet operations
|
|
3
|
+
* Wraps TableState and adds sheet-level state tracking
|
|
4
|
+
*/
|
|
5
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
6
|
+
import { TableState } from './table-state.class';
|
|
7
|
+
import { SheetStateConfig, SheetMetadata, SheetStateSnapshot } from './sheet-state.interface';
|
|
8
|
+
import { ColumnConfig } from '../../models/column-config.interface';
|
|
9
|
+
import { TableStateConfig } from './table-state.interface';
|
|
10
|
+
/**
|
|
11
|
+
* SheetState class - Manages sheet-level state and delegates table operations
|
|
12
|
+
*/
|
|
13
|
+
export declare class SheetState {
|
|
14
|
+
/**
|
|
15
|
+
* Sheet identity
|
|
16
|
+
*/
|
|
17
|
+
readonly id: string;
|
|
18
|
+
/**
|
|
19
|
+
* Observable sheet name
|
|
20
|
+
*/
|
|
21
|
+
readonly name$: BehaviorSubject<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Table state instance (delegates table operations)
|
|
24
|
+
*/
|
|
25
|
+
readonly tableState: TableState;
|
|
26
|
+
/**
|
|
27
|
+
* Sheet metadata
|
|
28
|
+
*/
|
|
29
|
+
private _metadata$;
|
|
30
|
+
readonly metadata$: Observable<SheetMetadata>;
|
|
31
|
+
/**
|
|
32
|
+
* Constructor
|
|
33
|
+
* @param config Sheet state configuration
|
|
34
|
+
* @param columns Reference to columns array for table state
|
|
35
|
+
* @param tableStateConfig Optional table state configuration
|
|
36
|
+
*/
|
|
37
|
+
constructor(config: SheetStateConfig, columns: ColumnConfig<any>[], tableStateConfig?: TableStateConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Update sheet name
|
|
40
|
+
* @param name New sheet name
|
|
41
|
+
*/
|
|
42
|
+
updateName(name: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Get current sheet name
|
|
45
|
+
*/
|
|
46
|
+
getName(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Get complete state snapshot
|
|
49
|
+
*/
|
|
50
|
+
getSnapshot(): SheetStateSnapshot;
|
|
51
|
+
/**
|
|
52
|
+
* Reset sheet state
|
|
53
|
+
*/
|
|
54
|
+
reset(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Update last accessed timestamp
|
|
57
|
+
*/
|
|
58
|
+
updateLastAccessed(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Update last modified timestamp
|
|
61
|
+
*/
|
|
62
|
+
private updateLastModified;
|
|
63
|
+
/**
|
|
64
|
+
* Get current metadata
|
|
65
|
+
*/
|
|
66
|
+
getMetadata(): SheetMetadata;
|
|
67
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sheet state interfaces for state management
|
|
3
|
+
*/
|
|
4
|
+
import { TableStateSnapshot } from './table-types';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for initializing SheetState
|
|
7
|
+
*/
|
|
8
|
+
export interface SheetStateConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Sheet ID
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Initial sheet name
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Sheet metadata tracking
|
|
20
|
+
*/
|
|
21
|
+
export interface SheetMetadata {
|
|
22
|
+
/**
|
|
23
|
+
* When the sheet was created
|
|
24
|
+
*/
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
/**
|
|
27
|
+
* When the sheet was last modified
|
|
28
|
+
*/
|
|
29
|
+
lastModified: Date;
|
|
30
|
+
/**
|
|
31
|
+
* When the sheet was last accessed
|
|
32
|
+
*/
|
|
33
|
+
lastAccessed: Date;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Complete snapshot of sheet state
|
|
37
|
+
*/
|
|
38
|
+
export interface SheetStateSnapshot {
|
|
39
|
+
/**
|
|
40
|
+
* Sheet ID
|
|
41
|
+
*/
|
|
42
|
+
id: string;
|
|
43
|
+
/**
|
|
44
|
+
* Sheet name
|
|
45
|
+
*/
|
|
46
|
+
name: string;
|
|
47
|
+
/**
|
|
48
|
+
* Table state snapshot
|
|
49
|
+
*/
|
|
50
|
+
tableStateSnapshot: TableStateSnapshot;
|
|
51
|
+
/**
|
|
52
|
+
* Sheet metadata
|
|
53
|
+
*/
|
|
54
|
+
metadata: SheetMetadata;
|
|
55
|
+
}
|