@aquera/ngx-smart-table 0.0.17-alpha → 0.0.17-patch-0.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.
- package/esm2020/lib/editors/index.mjs +2 -1
- package/esm2020/lib/editors/nile-code-editor.mjs +619 -0
- package/esm2020/lib/editors/nile-select-editor.mjs +23 -10
- package/esm2020/lib/renderer/components/st-cell/st-cell.component.mjs +19 -6
- package/esm2020/lib/renderer/components/st-table/st-table.component.mjs +15 -2
- package/esm2020/lib/renderer/models/cell.class.mjs +30 -2
- package/fesm2015/aquera-ngx-smart-table.mjs +721 -17
- package/fesm2015/aquera-ngx-smart-table.mjs.map +1 -1
- package/fesm2020/aquera-ngx-smart-table.mjs +703 -17
- package/fesm2020/aquera-ngx-smart-table.mjs.map +1 -1
- package/lib/editors/index.d.ts +1 -0
- package/lib/editors/nile-code-editor.d.ts +154 -0
- package/lib/editors/nile-select-editor.d.ts +1 -0
- package/lib/renderer/components/st-cell/st-cell.component.d.ts +4 -2
- package/lib/renderer/models/cell.class.d.ts +18 -1
- package/package.json +1 -1
package/lib/editors/index.d.ts
CHANGED
|
@@ -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,154 @@
|
|
|
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
|
+
* Open the full editor dialog
|
|
125
|
+
*/
|
|
126
|
+
private openDialog;
|
|
127
|
+
/**
|
|
128
|
+
* Close the dialog and optionally save/exit edit mode
|
|
129
|
+
*/
|
|
130
|
+
private closeDialog;
|
|
131
|
+
/**
|
|
132
|
+
* Apply all configuration options to the NileCodeEditor element
|
|
133
|
+
*/
|
|
134
|
+
private applyOptions;
|
|
135
|
+
/**
|
|
136
|
+
* Set up all event listeners with proper cleanup tracking
|
|
137
|
+
*/
|
|
138
|
+
private setupEventListeners;
|
|
139
|
+
/**
|
|
140
|
+
* Save value with optional validation
|
|
141
|
+
*/
|
|
142
|
+
private saveValue;
|
|
143
|
+
destroy(): void;
|
|
144
|
+
focus(): void;
|
|
145
|
+
getCurrentValue(): T;
|
|
146
|
+
/**
|
|
147
|
+
* Set value programmatically
|
|
148
|
+
*/
|
|
149
|
+
setValue(value: T): void;
|
|
150
|
+
/**
|
|
151
|
+
* Get the CodeMirror instance (if needed for advanced usage)
|
|
152
|
+
*/
|
|
153
|
+
getEditorInstance(): any;
|
|
154
|
+
}
|
|
@@ -78,6 +78,7 @@ export declare class NileSelectEditor<T = string> implements CellEditor<T> {
|
|
|
78
78
|
private optionsSubscription?;
|
|
79
79
|
private currentOptions;
|
|
80
80
|
private trackedValues;
|
|
81
|
+
private hasChangeOccurred;
|
|
81
82
|
constructor(options: NileSelectEditorOptions);
|
|
82
83
|
edit(context: CellEditorContext<T>): void;
|
|
83
84
|
/**
|
|
@@ -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
|
-
*
|
|
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
|
*/
|