@aquera/ngx-smart-table 0.0.10-alpha → 0.0.12-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.
@@ -206,6 +206,12 @@ export interface TableConfig {
206
206
  * @default false
207
207
  */
208
208
  enabled?: boolean;
209
+ /**
210
+ * Add a new empty row when navigating past the last row (arrow down at bottom)
211
+ * When enabled, pressing arrow down at the last row will emit a requestAddRow event
212
+ * @default false
213
+ */
214
+ addRowOnNavigatePastEnd?: boolean;
209
215
  };
210
216
  };
211
217
  /**
@@ -19,6 +19,7 @@ export declare class StTableComponent implements OnInit, OnChanges, OnDestroy, A
19
19
  private schemaValidator;
20
20
  private logger;
21
21
  private virtualScrollService;
22
+ private elementRef;
22
23
  readonly ZIndex: typeof TableZIndex;
23
24
  tableConfig: TableConfig;
24
25
  data?: any[];
@@ -38,6 +39,9 @@ export declare class StTableComponent implements OnInit, OnChanges, OnDestroy, A
38
39
  columnAdded: EventEmitter<ColumnAddEvent>;
39
40
  rowAction: EventEmitter<RowActionEvent>;
40
41
  validationStateChange: EventEmitter<TableValidationState>;
42
+ requestAddRow: EventEmitter<{
43
+ focusColumn?: number | undefined;
44
+ }>;
41
45
  validateConfig: boolean;
42
46
  private internalTableState?;
43
47
  private internalCellGrid?;
@@ -45,6 +49,7 @@ export declare class StTableComponent implements OnInit, OnChanges, OnDestroy, A
45
49
  private focusSubscription?;
46
50
  private validationSubscription?;
47
51
  private dataSubscription?;
52
+ private requestAddRowSubscription?;
48
53
  private internalData$;
49
54
  private previousData;
50
55
  mergedConfig: TableConfig;
@@ -77,7 +82,7 @@ export declare class StTableComponent implements OnInit, OnChanges, OnDestroy, A
77
82
  virtualScrollOffsetYNeg$: Observable<number>;
78
83
  visibleRows$: Observable<Cell<any>[][]>;
79
84
  scrollViewport?: ElementRef<HTMLElement>;
80
- constructor(schemaValidator: JsonSchemaValidatorService, logger: ValidationLoggerService, virtualScrollService: VirtualScrollService);
85
+ constructor(schemaValidator: JsonSchemaValidatorService, logger: ValidationLoggerService, virtualScrollService: VirtualScrollService, elementRef: ElementRef<HTMLElement>);
81
86
  ngOnInit(): void;
82
87
  ngAfterViewInit(): void;
83
88
  ngOnChanges(changes: SimpleChanges): void;
@@ -360,5 +365,5 @@ export declare class StTableComponent implements OnInit, OnChanges, OnDestroy, A
360
365
  onDocumentClick(event: MouseEvent): void;
361
366
  ngOnDestroy(): void;
362
367
  static ɵfac: i0.ɵɵFactoryDeclaration<StTableComponent, never>;
363
- static ɵcmp: i0.ɵɵComponentDeclaration<StTableComponent, "st-table", never, { "tableConfig": "tableConfig"; "data": "data"; "data$": "data$"; "tableState": "tableState"; "enableSorting": "enableSorting"; "enableFiltering": "enableFiltering"; "validateConfig": "validateConfig"; }, { "stateChange": "stateChange"; "dataChange": "dataChange"; "cellEdit": "cellEdit"; "cellSave": "cellSave"; "cellCancel": "cellCancel"; "cellChange": "cellChange"; "columnResized": "columnResized"; "columnMoved": "columnMoved"; "configValidationErrors": "configValidationErrors"; "columnAdded": "columnAdded"; "rowAction": "rowAction"; "validationStateChange": "validationStateChange"; }, never, never>;
368
+ static ɵcmp: i0.ɵɵComponentDeclaration<StTableComponent, "st-table", never, { "tableConfig": "tableConfig"; "data": "data"; "data$": "data$"; "tableState": "tableState"; "enableSorting": "enableSorting"; "enableFiltering": "enableFiltering"; "validateConfig": "validateConfig"; }, { "stateChange": "stateChange"; "dataChange": "dataChange"; "cellEdit": "cellEdit"; "cellSave": "cellSave"; "cellCancel": "cellCancel"; "cellChange": "cellChange"; "columnResized": "columnResized"; "columnMoved": "columnMoved"; "configValidationErrors": "configValidationErrors"; "columnAdded": "columnAdded"; "rowAction": "rowAction"; "validationStateChange": "validationStateChange"; "requestAddRow": "requestAddRow"; }, never, never>;
364
369
  }
@@ -56,6 +56,14 @@ export declare class StWorkbookComponent implements OnInit, OnChanges, OnDestroy
56
56
  * Emitted when fullscreen is toggled
57
57
  */
58
58
  fullscreenToggle: EventEmitter<boolean>;
59
+ /**
60
+ * Emitted when user navigates past last row (arrow down at bottom)
61
+ * Only emitted if addRowOnNavigatePastEnd is enabled in tableConfig
62
+ */
63
+ requestAddRow: EventEmitter<{
64
+ sheetId: string;
65
+ focusColumn?: number | undefined;
66
+ }>;
59
67
  /**
60
68
  * Array of sheets
61
69
  */
@@ -216,6 +224,12 @@ export declare class StWorkbookComponent implements OnInit, OnChanges, OnDestroy
216
224
  * Handle table state change - pass through to parent
217
225
  */
218
226
  onTableStateChange(event: TableStateChangeEvent): void;
227
+ /**
228
+ * Handle request to add a new row - emitted when navigating past last row
229
+ */
230
+ onRequestAddRow(event: {
231
+ focusColumn?: number;
232
+ }): void;
219
233
  /**
220
234
  * Component cleanup
221
235
  */
@@ -237,5 +251,5 @@ export declare class StWorkbookComponent implements OnInit, OnChanges, OnDestroy
237
251
  */
238
252
  private setupBeforeUnloadWarning;
239
253
  static ɵfac: i0.ɵɵFactoryDeclaration<StWorkbookComponent, never>;
240
- static ɵcmp: i0.ɵɵComponentDeclaration<StWorkbookComponent, "st-workbook", never, { "config": "config"; "sheetsData": "sheetsData"; "state": "state"; }, { "sheetChanged": "sheetChanged"; "addSheet": "addSheet"; "sheetTabAction": "sheetTabAction"; "workbookAction": "workbookAction"; "cellChange": "cellChange"; "cellSave": "cellSave"; "tableStateChange": "tableStateChange"; "fullscreenToggle": "fullscreenToggle"; }, never, never>;
254
+ static ɵcmp: i0.ɵɵComponentDeclaration<StWorkbookComponent, "st-workbook", never, { "config": "config"; "sheetsData": "sheetsData"; "state": "state"; }, { "sheetChanged": "sheetChanged"; "addSheet": "addSheet"; "sheetTabAction": "sheetTabAction"; "workbookAction": "workbookAction"; "cellChange": "cellChange"; "cellSave": "cellSave"; "tableStateChange": "tableStateChange"; "fullscreenToggle": "fullscreenToggle"; "requestAddRow": "requestAddRow"; }, never, never>;
241
255
  }
@@ -5,11 +5,15 @@ import * as i0 from "@angular/core";
5
5
  */
6
6
  export declare class StKeyboardNavigationDirective {
7
7
  tableState: TableState;
8
+ /**
9
+ * When enabled, pressing arrow down at the last row will emit requestAddRow event
10
+ */
11
+ addRowOnNavigatePastEnd: boolean;
8
12
  onKeyDown(event: KeyboardEvent): void;
9
13
  /**
10
14
  * Convert navigation key to direction using enums
11
15
  */
12
16
  private getDirection;
13
17
  static ɵfac: i0.ɵɵFactoryDeclaration<StKeyboardNavigationDirective, never>;
14
- static ɵdir: i0.ɵɵDirectiveDeclaration<StKeyboardNavigationDirective, "[stKeyboardNavigation]", never, { "tableState": "tableState"; }, {}, never>;
18
+ static ɵdir: i0.ɵɵDirectiveDeclaration<StKeyboardNavigationDirective, "[stKeyboardNavigation]", never, { "tableState": "tableState"; "addRowOnNavigatePastEnd": "addRowOnNavigatePastEnd"; }, {}, never>;
15
19
  }
@@ -25,6 +25,11 @@ export declare class TableState {
25
25
  readonly editingCellPosition$: Observable<CellFocusPosition | null>;
26
26
  private _tableValidationState$;
27
27
  readonly tableValidationState$: Observable<TableValidationState>;
28
+ private _requestAddRow$;
29
+ readonly requestAddRow$: Observable<{
30
+ focusColumn: number;
31
+ }>;
32
+ private _pendingFocusAfterRowAdd;
28
33
  private _rowCount;
29
34
  private _columnCount;
30
35
  /**
@@ -248,8 +253,10 @@ export declare class TableState {
248
253
  getEditingPosition(): CellFocusPosition | null;
249
254
  /**
250
255
  * Move focus in a direction using NavigationDirection enum
256
+ * @param direction The navigation direction
257
+ * @param addRowOnNavigatePastEnd If true, emits requestAddRow when navigating past last row
251
258
  */
252
- moveFocus(direction: NavigationDirection): boolean;
259
+ moveFocus(direction: NavigationDirection, addRowOnNavigatePastEnd?: boolean): boolean;
253
260
  /**
254
261
  * Clear focus
255
262
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/ngx-smart-table",
3
- "version": "0.0.10-alpha",
3
+ "version": "0.0.12-alpha",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": ">=13.0.0 <16.0.0",