ezfw-core 1.0.0

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 (154) hide show
  1. package/components/EzBaseComponent.ts +648 -0
  2. package/components/EzComponent.ts +89 -0
  3. package/components/EzInput.module.scss +183 -0
  4. package/components/EzInput.ts +104 -0
  5. package/components/EzLabel.ts +22 -0
  6. package/components/EzOutlet.ts +181 -0
  7. package/components/HtmlWrapper.ts +305 -0
  8. package/components/avatar/EzAvatar.module.scss +200 -0
  9. package/components/avatar/EzAvatar.ts +130 -0
  10. package/components/badge/EzBadge.module.scss +202 -0
  11. package/components/badge/EzBadge.ts +77 -0
  12. package/components/button/EzButton.module.scss +402 -0
  13. package/components/button/EzButton.ts +175 -0
  14. package/components/button/EzButtonGroup.ts +48 -0
  15. package/components/card/EzCard.module.scss +71 -0
  16. package/components/card/EzCard.ts +120 -0
  17. package/components/chart/EzBarChart.ts +47 -0
  18. package/components/chart/EzChart.module.scss +14 -0
  19. package/components/chart/EzChart.ts +279 -0
  20. package/components/chart/EzDoughnutChart.ts +47 -0
  21. package/components/chart/EzLineChart.ts +53 -0
  22. package/components/checkbox/EzCheckbox.module.scss +145 -0
  23. package/components/checkbox/EzCheckbox.ts +115 -0
  24. package/components/dataview/EzDataView.module.scss +115 -0
  25. package/components/dataview/EzDataView.ts +355 -0
  26. package/components/dataview/modes/EzDataViewCards.ts +322 -0
  27. package/components/dataview/modes/EzDataViewGrid.ts +76 -0
  28. package/components/datepicker/EzDatePicker.module.scss +348 -0
  29. package/components/datepicker/EzDatePicker.ts +519 -0
  30. package/components/dialog/EzDialog.module.scss +180 -0
  31. package/components/dropdown/EzDropdown.module.scss +107 -0
  32. package/components/dropdown/EzDropdown.ts +235 -0
  33. package/components/feed/EzActivityFeed.module.scss +90 -0
  34. package/components/feed/EzActivityFeed.ts +78 -0
  35. package/components/form/EzForm.ts +364 -0
  36. package/components/form/EzValidators.test.js +421 -0
  37. package/components/form/EzValidators.ts +202 -0
  38. package/components/grid/EzGrid.scss +88 -0
  39. package/components/grid/EzGrid.ts +1085 -0
  40. package/components/grid/EzGridContainer.ts +104 -0
  41. package/components/grid/body/EzGridBody.scss +283 -0
  42. package/components/grid/body/EzGridBody.ts +549 -0
  43. package/components/grid/body/EzGridCell.ts +211 -0
  44. package/components/grid/body/EzGridRow.ts +196 -0
  45. package/components/grid/filter/EzGridFilters.scss +78 -0
  46. package/components/grid/filter/EzGridFilters.ts +285 -0
  47. package/components/grid/footer/EzGridFooter.scss +136 -0
  48. package/components/grid/footer/EzGridFooter.ts +448 -0
  49. package/components/grid/header/EzGridHeader.scss +199 -0
  50. package/components/grid/header/EzGridHeader.ts +430 -0
  51. package/components/grid/query/EzGridQuery.ts +81 -0
  52. package/components/grid/state/EzGridColumns.ts +155 -0
  53. package/components/grid/state/EzGridController.ts +470 -0
  54. package/components/grid/state/EzGridLifecycle.ts +136 -0
  55. package/components/grid/state/EzGridNormalizers.test.js +273 -0
  56. package/components/grid/state/EzGridNormalizers.ts +162 -0
  57. package/components/grid/state/EzGridParts.ts +233 -0
  58. package/components/grid/state/EzGridPersistence.ts +140 -0
  59. package/components/grid/state/EzGridRemote.test.js +573 -0
  60. package/components/grid/state/EzGridRemote.ts +335 -0
  61. package/components/grid/state/EzGridSelection.ts +231 -0
  62. package/components/grid/state/EzGridSort.ts +286 -0
  63. package/components/grid/title/EzGridActionBar.ts +98 -0
  64. package/components/grid/title/EzGridTitle.ts +114 -0
  65. package/components/grid/title/EzGridTitleBar.scss +65 -0
  66. package/components/grid/title/EzGridTitleBar.ts +87 -0
  67. package/components/grid/types.ts +607 -0
  68. package/components/panel/EzPanel.module.scss +133 -0
  69. package/components/panel/EzPanel.ts +147 -0
  70. package/components/radio/EzRadio.module.scss +190 -0
  71. package/components/radio/EzRadio.ts +149 -0
  72. package/components/select/EzSelect.module.scss +153 -0
  73. package/components/select/EzSelect.ts +238 -0
  74. package/components/skeleton/EzSkeleton.module.scss +95 -0
  75. package/components/skeleton/EzSkeleton.ts +70 -0
  76. package/components/store/EzStore.ts +344 -0
  77. package/components/switch/EzSwitch.module.scss +164 -0
  78. package/components/switch/EzSwitch.ts +117 -0
  79. package/components/tabs/EzTabPanel.module.scss +181 -0
  80. package/components/tabs/EzTabPanel.ts +402 -0
  81. package/components/textarea/EzTextarea.module.scss +131 -0
  82. package/components/textarea/EzTextarea.ts +161 -0
  83. package/components/timepicker/EzTimePicker.module.scss +282 -0
  84. package/components/timepicker/EzTimePicker.ts +540 -0
  85. package/components/toast/EzToast.module.scss +291 -0
  86. package/components/tooltip/EzTooltip.module.scss +124 -0
  87. package/components/tooltip/EzTooltip.ts +153 -0
  88. package/core/EzComponentTypes.ts +693 -0
  89. package/core/EzError.ts +63 -0
  90. package/core/EzModel.ts +268 -0
  91. package/core/EzTypes.ts +328 -0
  92. package/core/eventBus.ts +284 -0
  93. package/core/ez.ts +617 -0
  94. package/core/loader.ts +725 -0
  95. package/core/renderer.ts +1010 -0
  96. package/core/router.ts +490 -0
  97. package/core/services.ts +124 -0
  98. package/core/state.ts +142 -0
  99. package/core/utils.ts +81 -0
  100. package/package.json +51 -0
  101. package/services/RouteUI.js +17 -0
  102. package/services/crypto.js +64 -0
  103. package/services/dialog.js +222 -0
  104. package/services/fetchApi.js +63 -0
  105. package/services/firebase.js +30 -0
  106. package/services/toast.js +214 -0
  107. package/template/doc/EzDocs.js +15 -0
  108. package/template/doc/EzDocs.module.scss +627 -0
  109. package/template/doc/EzDocsController.js +164 -0
  110. package/template/doc/data/activityfeed/EzActivityFeedDoc.js +42 -0
  111. package/template/doc/data/avatar/EzAvatarDoc.js +71 -0
  112. package/template/doc/data/badge/EzBadgeDoc.js +92 -0
  113. package/template/doc/data/button/EzButtonDoc.js +77 -0
  114. package/template/doc/data/buttongroup/EzButtonGroupDoc.js +102 -0
  115. package/template/doc/data/card/EzCardDoc.js +39 -0
  116. package/template/doc/data/chart/EzChartDoc.js +60 -0
  117. package/template/doc/data/checkbox/EzCheckboxDoc.js +67 -0
  118. package/template/doc/data/component/EzComponentDoc.js +34 -0
  119. package/template/doc/data/cssmodules/CSSModulesDoc.js +70 -0
  120. package/template/doc/data/datepicker/EzDatePickerDoc.js +126 -0
  121. package/template/doc/data/dialog/EzDialogDoc.js +217 -0
  122. package/template/doc/data/dropdown/EzDropdownDoc.js +178 -0
  123. package/template/doc/data/form/EzFormDoc.js +90 -0
  124. package/template/doc/data/grid/EzGridDoc.js +99 -0
  125. package/template/doc/data/input/EzInputDoc.js +92 -0
  126. package/template/doc/data/label/EzLabelDoc.js +40 -0
  127. package/template/doc/data/model/EzModelDoc.js +53 -0
  128. package/template/doc/data/outlet/EzOutletDoc.js +63 -0
  129. package/template/doc/data/panel/EzPanelDoc.js +214 -0
  130. package/template/doc/data/radio/EzRadioDoc.js +174 -0
  131. package/template/doc/data/router/EzRouterDoc.js +75 -0
  132. package/template/doc/data/select/EzSelectDoc.js +37 -0
  133. package/template/doc/data/skeleton/EzSkeletonDoc.js +149 -0
  134. package/template/doc/data/switch/EzSwitchDoc.js +82 -0
  135. package/template/doc/data/tabpanel/EzTabPanelDoc.js +44 -0
  136. package/template/doc/data/textarea/EzTextareaDoc.js +131 -0
  137. package/template/doc/data/timepicker/EzTimePickerDoc.js +107 -0
  138. package/template/doc/data/tooltip/EzTooltipDoc.js +193 -0
  139. package/template/doc/data/validators/EzValidatorsDoc.js +37 -0
  140. package/template/doc/sidebar/EzDocsSidebar.js +32 -0
  141. package/template/doc/sidebar/category/EzDocsCategory.js +33 -0
  142. package/template/doc/sidebar/item/EzDocsComponentItem.js +24 -0
  143. package/template/doc/viewer/EzDocsViewer.js +18 -0
  144. package/template/doc/viewer/codepanel/EzDocsCodePanel.js +51 -0
  145. package/template/doc/viewer/content/EzDocsContent.js +315 -0
  146. package/template/doc/viewer/header/EzDocsViewerHeader.js +46 -0
  147. package/template/doc/viewer/showcase/EzDocsShowcase.js +59 -0
  148. package/template/doc/viewer/showcase/EzDocsShowcaseSection.js +25 -0
  149. package/template/doc/viewer/showcase/EzDocsVariantItem.js +29 -0
  150. package/template/doc/welcome/EzDocsWelcome.js +48 -0
  151. package/themes/ez-theme.scss +179 -0
  152. package/themes/nature-fresh.scss +169 -0
  153. package/types/global.d.ts +21 -0
  154. package/utils/cssModules.js +81 -0
@@ -0,0 +1,607 @@
1
+ // ==========================================================
2
+ // EzGrid Type Definitions
3
+ // ==========================================================
4
+ // Central type definitions for the EzGrid component system.
5
+ // All grid-related types should be defined or re-exported here.
6
+ // ==========================================================
7
+
8
+ // ==========================================================
9
+ // Basic Types
10
+ // ==========================================================
11
+
12
+ export type SortDirection = 'ASC' | 'DESC';
13
+ export type SelectionMode = 'single' | 'multi';
14
+ export type DataMode = 'local' | 'remote';
15
+ export type HeaderAlign = 'left' | 'center' | 'right';
16
+ export type FilterMode = 'onInput' | 'onEnter';
17
+
18
+ // ==========================================================
19
+ // Row & Data Types
20
+ // ==========================================================
21
+
22
+ /** Generic row data - can be any object */
23
+ export type RowData = Record<string, unknown>;
24
+
25
+ /** Function to extract row key from row data */
26
+ export type RowKeyFn = (row: RowData) => string | number;
27
+
28
+ /** Context passed to row click callbacks */
29
+ export interface RowClickContext {
30
+ rowKey: string | number | null;
31
+ index?: number;
32
+ grid?: EzGridRef;
33
+ }
34
+
35
+ /** Context passed to row context menu callbacks */
36
+ export interface RowContextMenuContext {
37
+ rowKey: string | number | null;
38
+ grid?: EzGridRef;
39
+ }
40
+
41
+ /** Callback for row click events */
42
+ export type RowCallback = (row: RowData, ctx: RowClickContext) => void;
43
+
44
+ /** Callback for row context menu */
45
+ export type RowContextMenuCallback = (row: RowData, ctx: RowContextMenuContext) => void;
46
+
47
+ // ==========================================================
48
+ // Column Types
49
+ // ==========================================================
50
+
51
+ /** Column render function */
52
+ export type ColumnRenderFn = (value: unknown, row: RowData, cell: HTMLElement) => unknown;
53
+
54
+ /** Column configuration as provided by user */
55
+ export interface ColumnConfig {
56
+ index?: string;
57
+ type?: 'selection' | 'actions' | string;
58
+ text?: string;
59
+ flex?: number;
60
+ width?: number;
61
+ render?: ColumnRenderFn;
62
+ header?: {
63
+ align?: HeaderAlign;
64
+ };
65
+ sort?: boolean;
66
+ filter?: boolean | string | FilterConfig;
67
+ actions?: ActionConfig[];
68
+ wrap?: boolean | number;
69
+ resizable?: boolean;
70
+ reorderable?: boolean;
71
+ summary?: string | SummaryConfig;
72
+ }
73
+
74
+ /** Normalized column after processing */
75
+ export interface NormalizedColumn {
76
+ _id: string;
77
+ index?: string;
78
+ type?: string;
79
+ text: string;
80
+ flex: number | null;
81
+ width?: number;
82
+ render: ColumnRenderFn | null;
83
+ header: {
84
+ align: HeaderAlign;
85
+ };
86
+ sortable: boolean;
87
+ filter: FilterConfig | null;
88
+ actions?: ActionConfig[];
89
+ wrap: number | false;
90
+ resizable: boolean;
91
+ reorderable: boolean;
92
+ summary: SummaryConfig | null;
93
+ }
94
+
95
+ /** Action button configuration */
96
+ export interface ActionConfig {
97
+ icon?: string;
98
+ tooltip?: string;
99
+ danger?: boolean;
100
+ onClick?: (row: RowData, cell: unknown) => void;
101
+ eztype?: string;
102
+ [key: string]: unknown;
103
+ }
104
+
105
+ /** Summary configuration */
106
+ export interface SummaryConfig {
107
+ type: 'count' | 'sum' | 'avg' | 'average' | 'min' | 'max';
108
+ }
109
+
110
+ // ==========================================================
111
+ // Filter Types
112
+ // ==========================================================
113
+
114
+ export interface FilterConfig {
115
+ operator?: string;
116
+ itemRender?: unknown;
117
+ }
118
+
119
+ export interface FilterCondition {
120
+ field: string;
121
+ operator: string;
122
+ value: unknown;
123
+ }
124
+
125
+ export interface FilterSnapshot {
126
+ field: string;
127
+ operator: string;
128
+ value: unknown;
129
+ }
130
+
131
+ // ==========================================================
132
+ // Sort Types
133
+ // ==========================================================
134
+
135
+ export interface Sorter {
136
+ property: string;
137
+ direction: SortDirection;
138
+ }
139
+
140
+ export interface SortConfig {
141
+ property: string;
142
+ direction?: SortDirection | string;
143
+ }
144
+
145
+ export interface SortSnapshot {
146
+ property: string;
147
+ direction: SortDirection;
148
+ }
149
+
150
+ // ==========================================================
151
+ // Selection Types
152
+ // ==========================================================
153
+
154
+ export interface SelectionConfig {
155
+ mode?: SelectionMode;
156
+ toggle?: boolean;
157
+ selected?: (string | number)[];
158
+ width?: number;
159
+ }
160
+
161
+ export interface SelectionSnapshot {
162
+ mode: SelectionMode;
163
+ selected: string[];
164
+ lastIndex: number | null;
165
+ }
166
+
167
+ // ==========================================================
168
+ // Header Types
169
+ // ==========================================================
170
+
171
+ export interface HeaderConfig {
172
+ align?: HeaderAlign;
173
+ cls?: string;
174
+ height?: number;
175
+ visible?: boolean;
176
+ }
177
+
178
+ // ==========================================================
179
+ // Controller Types
180
+ // ==========================================================
181
+
182
+ export interface EzGridControllerState {
183
+ data: RowData[];
184
+ loading: boolean;
185
+ error: Error | null;
186
+ page: number;
187
+ pageSize: number;
188
+ total: number;
189
+ mode: DataMode;
190
+ }
191
+
192
+ export interface TransportParams {
193
+ page: number;
194
+ pageSize: number;
195
+ sort: SortSnapshot | null;
196
+ filters: FilterSnapshot[] | null;
197
+ [key: string]: unknown;
198
+ }
199
+
200
+ export interface TransportResult {
201
+ data: RowData[];
202
+ total?: number;
203
+ }
204
+
205
+ export type TransportFn = (params: TransportParams) => Promise<TransportResult>;
206
+
207
+ export interface RemoteConfig {
208
+ transport: TransportFn | null;
209
+ autoLoad: boolean;
210
+ pageSize: number;
211
+ }
212
+
213
+ export interface EzGridModel {
214
+ primaryKey?: string;
215
+ process(record: RowData): RowData;
216
+ processAll(records: RowData[]): RowData[];
217
+ }
218
+
219
+ // ==========================================================
220
+ // Remote Config Types
221
+ // ==========================================================
222
+
223
+ export interface RemoteApiConfig {
224
+ read?: string;
225
+ create?: string;
226
+ update?: string;
227
+ delete?: string;
228
+ }
229
+
230
+ export interface RemoteSourceConfig {
231
+ dataPath?: string;
232
+ countPath?: string;
233
+ }
234
+
235
+ export interface RemoteListenTo {
236
+ beforeLoad?: ((params: TransportParams, ctx: BeforeLoadContext) => TransportParams | void) | string;
237
+ afterLoad?: ((result: TransportResult, ctx: AfterLoadContext) => TransportResult | void) | string;
238
+ onError?: ((error: Error, ctx: ErrorContext) => void) | string;
239
+ }
240
+
241
+ export interface RemoteConfigInput {
242
+ api: string | RemoteApiConfig;
243
+ source?: RemoteSourceConfig;
244
+ filter?: FilterMode;
245
+ listenTo?: RemoteListenTo;
246
+ }
247
+
248
+ export interface BeforeLoadContext {
249
+ grid: EzGridRef;
250
+ remote: unknown;
251
+ }
252
+
253
+ export interface AfterLoadContext {
254
+ grid: EzGridRef;
255
+ remote: unknown;
256
+ params: TransportParams;
257
+ response: unknown;
258
+ }
259
+
260
+ export interface ErrorContext {
261
+ grid: EzGridRef;
262
+ remote: unknown;
263
+ params: TransportParams;
264
+ }
265
+
266
+ // ==========================================================
267
+ // Persistence Types
268
+ // ==========================================================
269
+
270
+ export interface ColumnsSnapshot {
271
+ visibility: Record<string, boolean>;
272
+ order: string[] | null;
273
+ widths: Record<string, number>;
274
+ }
275
+
276
+ export interface GridStateSnapshot {
277
+ columnState: ColumnsSnapshot | null;
278
+ sortState: Sorter[] | null;
279
+ selectionState: SelectionSnapshot | null;
280
+ }
281
+
282
+ // ==========================================================
283
+ // Event Types
284
+ // ==========================================================
285
+
286
+ export type EventCallback = (payload?: unknown) => void;
287
+
288
+ export interface SelectionChangeEvent {
289
+ keys: string[];
290
+ rows: RowData[];
291
+ count: number;
292
+ }
293
+
294
+ // ==========================================================
295
+ // TitleBar Types
296
+ // ==========================================================
297
+
298
+ export interface TitleBarContext {
299
+ grid: EzGridRef;
300
+ controller: EzGridController | null;
301
+ selection: {
302
+ keys: string[];
303
+ rows: RowData[];
304
+ count: number;
305
+ };
306
+ state: EzGridControllerState | null;
307
+ bind: unknown;
308
+ config: EzGridConfig;
309
+ }
310
+
311
+ export interface ToolConfig {
312
+ requiresSelection?: boolean;
313
+ minSelection?: number;
314
+ onClick?: (grid: EzGridRef) => void;
315
+ eztype?: string;
316
+ [key: string]: unknown;
317
+ }
318
+
319
+ // ==========================================================
320
+ // Grid Config Types
321
+ // ==========================================================
322
+
323
+ export interface EzGridConfig {
324
+ id?: string;
325
+ columns?: ColumnConfig[];
326
+ data?: RowData[];
327
+ bind?: { data?: string; title?: string };
328
+ selection?: boolean | SelectionConfig;
329
+ header?: boolean | HeaderConfig;
330
+ sort?: SortConfig | SortConfig[];
331
+ variant?: 'elevated' | 'flat' | 'outlined' | string;
332
+ stateful?: boolean;
333
+ statefulPersist?: boolean;
334
+ rowKey?: string | RowKeyFn;
335
+ controller?: string;
336
+ model?: string;
337
+ remote?: RemoteConfigInput;
338
+ store?: unknown;
339
+ autoLoad?: boolean;
340
+ pageSize?: number;
341
+ overRules?: string;
342
+ listenTo?: {
343
+ onRowClick?: RowCallback | string;
344
+ onRowDoubleClick?: RowCallback | string;
345
+ onRowContextMenu?: RowContextMenuCallback | string;
346
+ };
347
+ onRowClick?: RowCallback | string;
348
+ onRowDoubleClick?: RowCallback | string;
349
+ onRowContextMenu?: RowContextMenuCallback | string;
350
+ cls?: string | string[];
351
+ layout?: 'vbox' | 'hbox';
352
+ flex?: number;
353
+ init?: (grid: EzGridRef) => void;
354
+ skipInit?: boolean;
355
+ title?: string | ((ctx: TitleBarContext) => unknown);
356
+ tools?: ToolConfig[] | ((ctx: TitleBarContext) => ToolConfig[]);
357
+ titleBar?: (ctx: TitleBarContext) => unknown;
358
+ showSelectionCount?: boolean;
359
+ rowHeight?: number;
360
+ emptyText?: string;
361
+ [key: string]: unknown;
362
+ }
363
+
364
+ // ==========================================================
365
+ // Grid Reference Types (for cross-module communication)
366
+ // ==========================================================
367
+
368
+ /** Main grid reference interface */
369
+ export interface EzGridRef {
370
+ el?: HTMLElement | null;
371
+ config: EzGridConfig;
372
+ controller: EzGridController | null;
373
+ selection: EzGridSelectionRef;
374
+ columns: NormalizedColumn[];
375
+ header: HeaderConfig | false;
376
+ rowKey: RowKeyFn;
377
+ stateful?: boolean;
378
+ statefulPersist?: boolean;
379
+
380
+ // Instances
381
+ headerInstance?: EzGridHeaderRef;
382
+ _bodyInstance?: EzGridBodyRef;
383
+ _footerInstance?: EzGridFooterRef;
384
+ _filtersInstance?: EzGridFiltersRef;
385
+
386
+ // Internal state
387
+ _lifecycle?: EzGridLifecycleRef;
388
+ _persistence?: EzGridPersistenceRef;
389
+ _remote?: EzGridRemoteRef;
390
+ _context?: { route?: string; view?: string };
391
+ _localSortBaseline?: RowData[] | null;
392
+ _hasLocalSortBaseline?: boolean;
393
+ _rowClickHandler?: RowCallback | null;
394
+ _rowDoubleClickHandler?: RowCallback | null;
395
+ _rowContextMenuHandler?: RowContextMenuCallback | null;
396
+
397
+ // Callbacks
398
+ _onLoadingChanged?: (loading: boolean) => void;
399
+ _onError?: (error: Error | null) => void;
400
+ _onColumnsChanged: () => void;
401
+ _onSelectionChanged: () => void;
402
+ _onFiltersChanged?: (snapshot: FilterSnapshot[] | null) => void;
403
+
404
+ // Public methods
405
+ getSelection: () => string[];
406
+ isSelected: (row: RowData) => boolean;
407
+ isAllSelected: () => boolean;
408
+ selectAll: () => void;
409
+ clearSelection: () => void;
410
+ toggleRow: (row: RowData, index: number) => void;
411
+ selectRange: (toIndex: number) => void;
412
+ getVisibleColumns: () => NormalizedColumn[];
413
+ isRemoteMode: () => boolean;
414
+ isColumnSorted?: (colId: string) => boolean;
415
+ getColumnSortDirection?: (colId: string) => SortDirection | null;
416
+ toggleSort?: (colId: string) => void;
417
+ setColumnWidth?: (colId: string, width: number) => void;
418
+ moveColumn?: (colId: string, toIndex: number) => void;
419
+ refreshBody: () => Promise<void>;
420
+ on: (event: string, callback: EventCallback) => void;
421
+ off: (event: string, callback: EventCallback) => void;
422
+ emit: (event: string, payload?: unknown) => void;
423
+ }
424
+
425
+ // ==========================================================
426
+ // Controller Interface
427
+ // ==========================================================
428
+
429
+ export interface EzGridController {
430
+ grid: EzGridRef;
431
+ state: EzGridControllerState;
432
+ _model?: EzGridModel;
433
+ _remoteConfig?: RemoteConfig;
434
+ _isLoadingRemote: boolean;
435
+ _pendingRemoteReload: boolean;
436
+ _lastSortSnapshot: SortSnapshot | null;
437
+ _lastFilterSnapshot: FilterSnapshot[] | null;
438
+
439
+ // Event methods
440
+ on: (event: string, fn: EventCallback) => void;
441
+ off: (event: string, fn: EventCallback) => void;
442
+ emit: (event: string, payload?: unknown) => void;
443
+
444
+ // State methods
445
+ load: (params?: Partial<TransportParams>) => Promise<void>;
446
+ reload: () => Promise<void>;
447
+ requestReload: (reason?: string) => Promise<void>;
448
+ setPage: (page: number) => void;
449
+ setPageSize: (size: number) => void;
450
+ setSortSnapshot: (snapshot: SortSnapshot | null) => void;
451
+ setFilterSnapshot: (snapshot: FilterSnapshot[] | null) => void;
452
+ setData: (data: RowData[], meta?: { total?: number }) => void;
453
+ setLoading: (value: boolean) => void;
454
+ setError: (error: Error | null) => void;
455
+ setRemoteConfig: (config: Partial<RemoteConfig & { transport?: TransportFn }>) => void;
456
+ appendData: (data: RowData[]) => void;
457
+ clear: () => void;
458
+ addRecord: (record: RowData) => void;
459
+ updateRecord: (key: unknown, updates: Partial<RowData>) => boolean;
460
+ removeRecord: (key: unknown) => boolean;
461
+
462
+ // Hooks for controller
463
+ beforeRowRender?: (row: RowData, ctx: RowRenderContext) => boolean | void;
464
+ afterRowRender?: (el: HTMLElement, row: RowData, ctx: RowRenderContext) => void;
465
+ beforeCellRender?: (value: unknown, row: RowData, column: NormalizedColumn, ctx: RowRenderContext) => boolean | void;
466
+ afterCellRender?: (el: HTMLElement, value: unknown, row: RowData, column: NormalizedColumn, ctx: RowRenderContext) => void;
467
+
468
+ // Remote support
469
+ supportsRemoteSort?: boolean;
470
+ sort?: (columnId: string, direction: SortDirection) => void;
471
+ }
472
+
473
+ export interface RowRenderContext {
474
+ index: number;
475
+ row: RowData;
476
+ rowId: string | number | null;
477
+ columns: NormalizedColumn[];
478
+ grid: EzGridRef;
479
+ rowEl: HTMLElement | null;
480
+ isFirst: boolean;
481
+ isLast: boolean;
482
+ }
483
+
484
+ // ==========================================================
485
+ // Sub-component Reference Interfaces
486
+ // ==========================================================
487
+
488
+ export interface EzGridSelectionRef {
489
+ enabled: boolean;
490
+ mode: SelectionMode;
491
+ toggle: boolean;
492
+ selected: Set<string>;
493
+ lastIndex: number | null;
494
+ isEnabled: () => boolean;
495
+ isSelected: (row: RowData) => boolean;
496
+ getSelection: () => string[];
497
+ clear: () => void;
498
+ toggleRow: (row: RowData, index: number) => void;
499
+ selectRange: (toIndex: number) => void;
500
+ selectAll: () => void;
501
+ isAllSelected: () => boolean;
502
+ snapshot: () => SelectionSnapshot | null;
503
+ restore: (snapshot: SelectionSnapshot | null) => void;
504
+ }
505
+
506
+ export interface EzGridColumnsRef {
507
+ columns: NormalizedColumn[];
508
+ state: {
509
+ visibility: Record<string, boolean>;
510
+ order: string[] | null;
511
+ widths: Record<string, number>;
512
+ };
513
+ getVisibleColumns: () => NormalizedColumn[];
514
+ hide: (colId: string) => void;
515
+ show: (colId: string) => void;
516
+ toggle: (colId: string) => void;
517
+ setWidth: (colId: string, width: number) => void;
518
+ resetWidth: (colId: string) => void;
519
+ move: (colId: string, toIndex: number) => void;
520
+ snapshot: () => ColumnsSnapshot;
521
+ restore: (snapshot: ColumnsSnapshot | null) => void;
522
+ }
523
+
524
+ export interface EzGridSortRef {
525
+ sorters: Sorter[];
526
+ getSorters: () => Sorter[];
527
+ getSorterFor: (property: string) => Sorter | null;
528
+ isSorted: (property: string) => boolean;
529
+ toggleSort: (property: string) => void;
530
+ clear: () => void;
531
+ sortBy: (colId: string, direction?: SortDirection) => void;
532
+ snapshot: () => Sorter[] | null;
533
+ restore: (snapshot: Sorter[] | null) => void;
534
+ getSortSnapshot: () => SortSnapshot | null;
535
+ applyLocalSort: () => void;
536
+ }
537
+
538
+ export interface EzGridLifecycleRef {
539
+ onControllerDataChange: () => void;
540
+ markHydrated: () => void;
541
+ suspend: <T>(fn: () => Promise<T>) => Promise<void>;
542
+ destroy: () => void;
543
+ onLoadingChanged: (loading: boolean) => void;
544
+ onError: (error: Error | null) => void;
545
+ }
546
+
547
+ export interface EzGridPersistenceRef {
548
+ getStateKey: () => string;
549
+ getStorageKey: () => string;
550
+ load: () => GridStateSnapshot | null;
551
+ save: () => void;
552
+ getRegistryEntry: () => unknown;
553
+ setRegistryEntry: (controller: unknown) => void;
554
+ hasRegistryEntry: () => boolean;
555
+ updateColumnState: (snapshot: ColumnsSnapshot | null) => void;
556
+ updateSortState: (snapshot: Sorter[] | null) => void;
557
+ updateSelectionState: (snapshot: SelectionSnapshot | null) => void;
558
+ }
559
+
560
+ export interface EzGridRemoteRef {
561
+ config: {
562
+ api: RemoteApiConfig;
563
+ source: { dataPath: string; countPath: string };
564
+ filter: FilterMode;
565
+ listenTo: RemoteListenTo;
566
+ } | null;
567
+ isEnabled: () => boolean;
568
+ load: (params?: Partial<TransportParams>) => Promise<TransportResult>;
569
+ }
570
+
571
+ export interface EzGridHeaderRef {
572
+ refreshColumns: () => Promise<void>;
573
+ }
574
+
575
+ export interface EzGridBodyRef {
576
+ data: RowData[];
577
+ setLoading: (loading: boolean) => void;
578
+ setError: (error: Error | null) => void;
579
+ updateSelectionVisuals: () => void;
580
+ refreshData: (data: RowData[]) => Promise<void>;
581
+ }
582
+
583
+ export interface EzGridFooterRef {
584
+ refresh: () => void;
585
+ }
586
+
587
+ export interface EzGridFiltersRef {
588
+ clear: () => void;
589
+ refresh: () => void;
590
+ }
591
+
592
+ // ==========================================================
593
+ // Export Options
594
+ // ==========================================================
595
+
596
+ export interface ExportCSVOptions {
597
+ filename?: string;
598
+ includeHeaders?: boolean;
599
+ separator?: string;
600
+ selectedOnly?: boolean;
601
+ }
602
+
603
+ export interface ExportExcelOptions {
604
+ filename?: string;
605
+ includeHeaders?: boolean;
606
+ selectedOnly?: boolean;
607
+ }