@aquera/ngx-smart-table 0.0.17-patch-0.1 → 0.0.17-patch-0.3

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.
@@ -6,3 +6,4 @@ export { NileSelectEditor, NileSelectEditorOptions, SelectOption } from './nile-
6
6
  export { NileAutoCompleteEditor, NileAutoCompleteEditorOptions, AutoCompleteOption } from './nile-autocomplete-editor';
7
7
  export { NileCalendarEditor, NileCalendarEditorOptions, AllowedDatesRange } from './nile-calendar-editor';
8
8
  export { NileDatePickerEditor, NileDatePickerEditorOptions, DateRange } from './nile-date-picker-editor';
9
+ export { NileCodeEditor, NileCodeEditorOptions, CodeEditorCompletion, AutoCompleteStyle } from './nile-code-editor';
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Custom editor using NileCodeEditor from @aquera/nile-elements
3
+ * This provides code editing capabilities with syntax highlighting for table cells
4
+ */
5
+ import { CellEditor, CellEditorContext } from '../models/cell-strategies.interface';
6
+ /**
7
+ * Autocompletion item configuration
8
+ */
9
+ export interface CodeEditorCompletion {
10
+ /** The completion label shown in dropdown */
11
+ label: string;
12
+ /** The value to insert */
13
+ value?: string;
14
+ /** Optional description */
15
+ detail?: string;
16
+ }
17
+ /**
18
+ * Autocomplete style configuration
19
+ */
20
+ export interface AutoCompleteStyle {
21
+ /** Width of the autocomplete dropdown */
22
+ width?: string;
23
+ /** Enable multiline content in autocomplete */
24
+ multiline?: boolean;
25
+ }
26
+ /**
27
+ * Options interface for NileCodeEditor
28
+ */
29
+ export interface NileCodeEditorOptions {
30
+ /** Language mode for syntax highlighting */
31
+ language?: 'javascript' | 'sql' | 'json' | 'html';
32
+ /** Disable syntax highlighting */
33
+ disableSyntaxHighlighting?: boolean;
34
+ /** Placeholder text when empty */
35
+ placeholder?: string;
36
+ /** Show line numbers (single-line mode) */
37
+ lineNumbers?: boolean;
38
+ /** Show line numbers in multiline mode */
39
+ lineNumbersMultiline?: boolean;
40
+ /** Allow multi-line editing */
41
+ multiline?: boolean;
42
+ /** Render without border */
43
+ noborder?: boolean;
44
+ /** Use default font instead of inherit */
45
+ defaultFont?: boolean;
46
+ /** Auto focus on edit */
47
+ autoFocus?: boolean;
48
+ /** Read-only mode */
49
+ readonly?: boolean;
50
+ /** Disabled state */
51
+ disabled?: boolean;
52
+ /** Enable Tab-to-complete */
53
+ tabCompletion?: boolean;
54
+ /** Enable search keymap */
55
+ enableSearch?: boolean;
56
+ /** Show code folding gutters */
57
+ enableFoldGutters?: boolean;
58
+ /** Internal scroll container */
59
+ hasScroller?: boolean;
60
+ /** Show expand control (native nile-code-editor expand) */
61
+ expandable?: boolean;
62
+ /** Icon for expand control */
63
+ expandIcon?: string;
64
+ /** Show expand button to open full editor dialog (default: true) */
65
+ showExpandButton?: boolean;
66
+ /** Dialog title (default: 'Edit Code') */
67
+ dialogTitle?: string;
68
+ /** Dialog width (default: '600px') */
69
+ dialogWidth?: string;
70
+ /** Dialog max height (default: '80vh') */
71
+ dialogMaxHeight?: string;
72
+ /** Dialog editor min height (default: '300px') */
73
+ dialogEditorHeight?: string;
74
+ /** Minimum number of visible lines in the dialog editor (default: 20) */
75
+ dialogMinLines?: number;
76
+ /** Inline completion dataset */
77
+ customAutoCompletions?: Record<string, CodeEditorCompletion[]> | CodeEditorCompletion[];
78
+ /** Paths to fetch completion datasets from */
79
+ customCompletionsPaths?: string[];
80
+ /** Enable variables in suggestions */
81
+ allowVariableInCustomSuggestion?: boolean;
82
+ /** Show autocomplete above cursor */
83
+ aboveCursor?: boolean;
84
+ /** Style config for autocomplete dropdown */
85
+ autoCompleteStyle?: AutoCompleteStyle;
86
+ /** Debounce change events */
87
+ debounce?: boolean;
88
+ /** Debounce delay in ms */
89
+ debounceTimeout?: number;
90
+ /** Error state */
91
+ error?: boolean;
92
+ /** Error message to display */
93
+ errorMessage?: string;
94
+ /** Custom theme CSS object */
95
+ customThemeCSS?: Record<string, Record<string, string>>;
96
+ /** Validate before saving (default: true) */
97
+ validateOnSave?: boolean;
98
+ }
99
+ /**
100
+ * Custom editor that uses NileCodeEditor component
101
+ * Provides code editing with syntax highlighting for table cells
102
+ * @template T The value type (typically string)
103
+ */
104
+ export declare class NileCodeEditor<T = string> implements CellEditor<T> {
105
+ private readonly options?;
106
+ private editor?;
107
+ private wrapper?;
108
+ private expandButton?;
109
+ private dialog?;
110
+ private dialogEditor?;
111
+ private eventListeners;
112
+ private context?;
113
+ private dialogOpen;
114
+ private expandButtonClicked;
115
+ private documentClickHandler?;
116
+ private trackedValue;
117
+ constructor(options?: NileCodeEditorOptions | undefined);
118
+ edit(context: CellEditorContext<T>): void;
119
+ /**
120
+ * Focus the editor and place cursor
121
+ */
122
+ private focusEditor;
123
+ /**
124
+ * Read the live value directly from CodeMirror's internal state,
125
+ * bypassing debounced nile-change events and the possibly-stale .value property.
126
+ */
127
+ private getLiveEditorValue;
128
+ /**
129
+ * Open the full editor dialog
130
+ */
131
+ private openDialog;
132
+ /**
133
+ * Close the dialog and optionally save/exit edit mode
134
+ */
135
+ private closeDialog;
136
+ /**
137
+ * Apply all configuration options to the NileCodeEditor element
138
+ */
139
+ private applyOptions;
140
+ /**
141
+ * Set up all event listeners with proper cleanup tracking
142
+ */
143
+ private setupEventListeners;
144
+ /**
145
+ * Save value with optional validation
146
+ */
147
+ private saveValue;
148
+ destroy(): void;
149
+ focus(): void;
150
+ getCurrentValue(): T;
151
+ /**
152
+ * Set value programmatically
153
+ */
154
+ setValue(value: T): void;
155
+ /**
156
+ * Get the CodeMirror instance (if needed for advanced usage)
157
+ */
158
+ getEditorInstance(): any;
159
+ }
@@ -1,10 +1,11 @@
1
- import { EventEmitter, OnInit, OnDestroy, ElementRef, AfterViewInit, TemplateRef } from '@angular/core';
1
+ import { EventEmitter, OnInit, OnDestroy, ElementRef, AfterViewInit, TemplateRef, ChangeDetectorRef } from '@angular/core';
2
2
  import { Cell } from '../../models/cell.class';
3
3
  import { CellEditEvent, CellSaveEvent, CellChangeEvent, CellCancelEvent, EditMode, NavigationDirection } from '../../../models/cell-types';
4
4
  import { TableState } from '../../models/table-state.class';
5
5
  import { TableConfig } from '../../../models/table-config.interface';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class StCellComponent implements OnInit, OnDestroy, AfterViewInit {
8
+ private cdr;
8
9
  cell: Cell<any>;
9
10
  editMode: EditMode;
10
11
  tableState?: TableState;
@@ -19,9 +20,10 @@ export declare class StCellComponent implements OnInit, OnDestroy, AfterViewInit
19
20
  direction: NavigationDirection;
20
21
  }>;
21
22
  editorContainer?: ElementRef;
23
+ cellLoading: boolean;
22
24
  private editorCleanup?;
23
25
  private editingPositionSubscription?;
24
- constructor();
26
+ constructor(cdr: ChangeDetectorRef);
25
27
  ngOnInit(): void;
26
28
  ngAfterViewInit(): void;
27
29
  ngOnDestroy(): void;
@@ -123,10 +123,27 @@ export declare class Cell<T = any> {
123
123
  * Get row index
124
124
  */
125
125
  getRowIndex(): number | undefined;
126
+ private stateChangeCallback?;
126
127
  /**
127
- * Set loading state
128
+ * When the data source refreshes, the table recreates Cell objects.
129
+ * This field lets the old (stale) Cell forward calls to its replacement
130
+ * so that async operations (e.g. setLoading from an API callback)
131
+ * still reach the live component.
132
+ */
133
+ private replacementCell?;
134
+ /**
135
+ * Link this cell to its replacement so future state mutations forward.
136
+ */
137
+ setReplacement(replacement: Cell<any>): void;
138
+ onStateChange(callback: () => void): void;
139
+ /**
140
+ * Set loading state. Forwards to replacement cell if this cell was replaced.
128
141
  */
129
142
  setLoading(isLoading: boolean): void;
143
+ /**
144
+ * Set cell value (public API, forwards to replacement if replaced).
145
+ */
146
+ setValueExternal(value: T): boolean;
130
147
  /**
131
148
  * Set disabled state
132
149
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/ngx-smart-table",
3
- "version": "0.0.17-patch-0.1",
3
+ "version": "0.0.17-patch-0.3",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": ">=13.0.0 <16.0.0",