@simple-table/angular 4.1.1 → 4.1.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/dist/fesm2022/simple-table-angular.mjs +659 -0
- package/dist/fesm2022/simple-table-angular.mjs.map +1 -0
- package/dist/index.d.ts +263 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +24 -24
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +0 -1
- package/dist/index.es.js +0 -2
- package/dist/index.es.js.map +0 -1
- package/dist/types/MountRegistry.d.ts +0 -15
- package/dist/types/buildVanillaConfig.d.ts +0 -7
- package/dist/types/index.d.ts +0 -8
- package/dist/types/lib/SimpleTableComponent.d.ts +0 -92
- package/dist/types/lib/provideSimpleTable.d.ts +0 -23
- package/dist/types/types.d.ts +0 -106
- package/dist/types/utils/wrapAngularRenderer.d.ts +0 -26
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { createComponent, EventEmitter, inject, ElementRef, ApplicationRef, EnvironmentInjector, Output, Input, Component, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { collectHeaderAccessors, asRows, SimpleTableVanilla, headersStructurallyEqual, rowsShallowUnchanged } from 'simple-table-core';
|
|
4
|
+
export { PIVOT_ACCESSOR_PREFIX, PIVOT_BLANK_LABEL, PIVOT_CHILDREN_KEY, PIVOT_IS_TOTAL_KEY, asRows, buildPivotAccessor, buildPivotRowTotalAccessor, pivotRows } from 'simple-table-core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Wraps an Angular standalone component into a function that returns an
|
|
8
|
+
* HTMLElement, matching the vanilla renderer contract expected by
|
|
9
|
+
* simple-table-core.
|
|
10
|
+
*
|
|
11
|
+
* Requires references to the running Angular ApplicationRef and
|
|
12
|
+
* EnvironmentInjector so it can attach the dynamically-created component
|
|
13
|
+
* to the change detection tree and trigger a synchronous flush before
|
|
14
|
+
* returning the element to the vanilla rendering pipeline.
|
|
15
|
+
*
|
|
16
|
+
* Pass an optional {@link MountRegistry} so core's `onRendererHostDiscard` can
|
|
17
|
+
* destroy the ComponentRef (including any CDK Overlay / floating UI) when the
|
|
18
|
+
* host is discarded. The table adapter always supplies a registry; the public
|
|
19
|
+
* helper used for one-shot static slots (e.g. `tableEmptyStateRenderer`) may omit it.
|
|
20
|
+
*
|
|
21
|
+
* These are injected automatically when the consumer uses
|
|
22
|
+
* `provideSimpleTable()` in their application providers.
|
|
23
|
+
*/
|
|
24
|
+
function wrapAngularRenderer(component, appRef, injector, registry) {
|
|
25
|
+
return (props) => {
|
|
26
|
+
const el = document.createElement("div");
|
|
27
|
+
const componentRef = createComponent(component, {
|
|
28
|
+
environmentInjector: injector,
|
|
29
|
+
hostElement: el,
|
|
30
|
+
});
|
|
31
|
+
// Assign input props to the component instance.
|
|
32
|
+
Object.assign(componentRef.instance, props);
|
|
33
|
+
// Attach to the application's view tree so Angular tracks it.
|
|
34
|
+
appRef.attachView(componentRef.hostView);
|
|
35
|
+
// Synchronous change detection flush — ensures the rendered output is
|
|
36
|
+
// in the DOM before we return the element to the vanilla pipeline.
|
|
37
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
38
|
+
registry?.register(el, () => {
|
|
39
|
+
appRef.detachView(componentRef.hostView);
|
|
40
|
+
componentRef.destroy();
|
|
41
|
+
});
|
|
42
|
+
return el;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Like {@link wrapAngularRenderer}, but reuses one wrapper per accessor so
|
|
47
|
+
* unstable column rebuilds keep a stable function identity on ColumnDef.
|
|
48
|
+
*/
|
|
49
|
+
function wrapCachedAngularRenderer(component, appRef, injector, registry, accessor, kind) {
|
|
50
|
+
const cache = kind === "cell" ? registry.cellRendererCache : registry.headerRendererCache;
|
|
51
|
+
const existing = cache.get(accessor);
|
|
52
|
+
if (existing) {
|
|
53
|
+
existing.component = component;
|
|
54
|
+
return existing.wrapped;
|
|
55
|
+
}
|
|
56
|
+
const slot = {
|
|
57
|
+
component,
|
|
58
|
+
wrapped: null,
|
|
59
|
+
};
|
|
60
|
+
const wrapped = (props) => {
|
|
61
|
+
const el = document.createElement("div");
|
|
62
|
+
const componentRef = createComponent(slot.component, {
|
|
63
|
+
environmentInjector: injector,
|
|
64
|
+
hostElement: el,
|
|
65
|
+
});
|
|
66
|
+
Object.assign(componentRef.instance, props);
|
|
67
|
+
appRef.attachView(componentRef.hostView);
|
|
68
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
69
|
+
registry.register(el, () => {
|
|
70
|
+
appRef.detachView(componentRef.hostView);
|
|
71
|
+
componentRef.destroy();
|
|
72
|
+
});
|
|
73
|
+
return el;
|
|
74
|
+
};
|
|
75
|
+
slot.wrapped = wrapped;
|
|
76
|
+
cache.set(accessor, slot);
|
|
77
|
+
return wrapped;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Resolve column definitions. */
|
|
81
|
+
function resolveAngularColumns(config) {
|
|
82
|
+
const headers = config.columns;
|
|
83
|
+
if (!headers) {
|
|
84
|
+
throw new Error("SimpleTable requires `columns`");
|
|
85
|
+
}
|
|
86
|
+
return headers;
|
|
87
|
+
}
|
|
88
|
+
function buildVanillaConfig(config, registry, appRef, injector) {
|
|
89
|
+
const { columns: _columns, rows, footerRenderer, emptyStateRenderer, errorStateRenderer, loadingStateRenderer, tableEmptyStateRenderer, headerDropdown, columnEditorConfig, icons, rowButtons, onColumnOrderChange, onColumnWidthChange, onHeaderEdit, onColumnSelect, enableColumnEditor, enableColumnEditorInitOpen, enablePagination, onTableReady, hoverRowBackground, oddColumnBackground, oddEvenRowBackground, ...rest } = config;
|
|
90
|
+
const wrap = (component) => wrapAngularRenderer(component, appRef, injector, registry);
|
|
91
|
+
function transformIcons(iconsConfig) {
|
|
92
|
+
const result = {};
|
|
93
|
+
for (const [key, value] of Object.entries(iconsConfig)) {
|
|
94
|
+
if (value == null)
|
|
95
|
+
continue;
|
|
96
|
+
if (typeof value === "string" ||
|
|
97
|
+
value instanceof HTMLElement ||
|
|
98
|
+
value instanceof SVGSVGElement) {
|
|
99
|
+
result[key] = value;
|
|
100
|
+
}
|
|
101
|
+
else if (value.ɵcmp) {
|
|
102
|
+
result[key] = wrap(value)({});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
result[key] = value;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
function transformColumnEditorConfig(cfg) {
|
|
111
|
+
const { rowRenderer, customRenderer, ...cfgRest } = cfg;
|
|
112
|
+
return {
|
|
113
|
+
...cfgRest,
|
|
114
|
+
...(rowRenderer ? { rowRenderer: wrap(rowRenderer) } : {}),
|
|
115
|
+
...(customRenderer ? { customRenderer: wrap(customRenderer) } : {}),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function transformHeader(header) {
|
|
119
|
+
const { cellRenderer, headerRenderer, children, nestedTable, ...headerRest } = header;
|
|
120
|
+
const accessor = String(header.accessor);
|
|
121
|
+
const transformed = { ...headerRest };
|
|
122
|
+
if (cellRenderer) {
|
|
123
|
+
if (cellRenderer.ɵcmp) {
|
|
124
|
+
transformed.cellRenderer = wrapCachedAngularRenderer(cellRenderer, appRef, injector, registry, accessor, "cell");
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
transformed.cellRenderer = cellRenderer;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (headerRenderer) {
|
|
131
|
+
if (headerRenderer.ɵcmp) {
|
|
132
|
+
transformed.headerRenderer = wrapCachedAngularRenderer(headerRenderer, appRef, injector, registry, accessor, "header");
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
transformed.headerRenderer = headerRenderer;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (children)
|
|
139
|
+
transformed.children = children.map(transformHeader);
|
|
140
|
+
if (nestedTable) {
|
|
141
|
+
const nestedFull = { ...nestedTable, rows: [] };
|
|
142
|
+
transformed.nestedTable = buildVanillaConfig(nestedFull, registry, appRef, injector);
|
|
143
|
+
}
|
|
144
|
+
return transformed;
|
|
145
|
+
}
|
|
146
|
+
const columns = resolveAngularColumns(config);
|
|
147
|
+
registry.pruneRendererCaches(collectHeaderAccessors(columns));
|
|
148
|
+
// `rest` still carries TData-bound callbacks (getRowId, onCellEdit, …).
|
|
149
|
+
// Widen once here — the vanilla runtime is Row-shaped.
|
|
150
|
+
const shared = rest;
|
|
151
|
+
const vanillaConfig = {
|
|
152
|
+
...shared,
|
|
153
|
+
rows: asRows(rows),
|
|
154
|
+
columns: columns.map(transformHeader),
|
|
155
|
+
enableColumnEditor,
|
|
156
|
+
enableColumnEditorInitOpen,
|
|
157
|
+
enablePagination,
|
|
158
|
+
onTableReady,
|
|
159
|
+
hoverRowBackground,
|
|
160
|
+
oddColumnBackground,
|
|
161
|
+
oddEvenRowBackground,
|
|
162
|
+
// Authoritative mount teardown: core calls this before it permanently
|
|
163
|
+
// discards any host element, so the registry destroys exactly the affected
|
|
164
|
+
// Angular ComponentRefs (including CDK Overlay / floating UI).
|
|
165
|
+
onRendererHostDiscard: registry.disposeHost,
|
|
166
|
+
};
|
|
167
|
+
if (onColumnOrderChange) {
|
|
168
|
+
vanillaConfig.onColumnOrderChange = (headers) => onColumnOrderChange(headers);
|
|
169
|
+
}
|
|
170
|
+
if (onColumnWidthChange) {
|
|
171
|
+
vanillaConfig.onColumnWidthChange = (headers) => onColumnWidthChange(headers);
|
|
172
|
+
}
|
|
173
|
+
if (onHeaderEdit) {
|
|
174
|
+
vanillaConfig.onHeaderEdit = (header, newLabel) => onHeaderEdit(header, newLabel);
|
|
175
|
+
}
|
|
176
|
+
if (onColumnSelect) {
|
|
177
|
+
vanillaConfig.onColumnSelect = (header) => onColumnSelect(header);
|
|
178
|
+
}
|
|
179
|
+
if (footerRenderer !== undefined) {
|
|
180
|
+
if (footerRenderer.ɵcmp) {
|
|
181
|
+
vanillaConfig.footerRenderer = wrap(footerRenderer);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
vanillaConfig.footerRenderer = footerRenderer;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (emptyStateRenderer !== undefined) {
|
|
188
|
+
if (emptyStateRenderer.ɵcmp) {
|
|
189
|
+
vanillaConfig.emptyStateRenderer = wrap(emptyStateRenderer);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
vanillaConfig.emptyStateRenderer = emptyStateRenderer;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (errorStateRenderer !== undefined) {
|
|
196
|
+
if (errorStateRenderer.ɵcmp) {
|
|
197
|
+
vanillaConfig.errorStateRenderer = wrap(errorStateRenderer);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
vanillaConfig.errorStateRenderer = errorStateRenderer;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (loadingStateRenderer !== undefined) {
|
|
204
|
+
if (loadingStateRenderer.ɵcmp) {
|
|
205
|
+
vanillaConfig.loadingStateRenderer = wrap(loadingStateRenderer);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
vanillaConfig.loadingStateRenderer = loadingStateRenderer;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (tableEmptyStateRenderer !== undefined) {
|
|
212
|
+
vanillaConfig.tableEmptyStateRenderer = tableEmptyStateRenderer;
|
|
213
|
+
}
|
|
214
|
+
if (headerDropdown !== undefined) {
|
|
215
|
+
vanillaConfig.headerDropdown = wrap(headerDropdown);
|
|
216
|
+
}
|
|
217
|
+
if (columnEditorConfig !== undefined) {
|
|
218
|
+
vanillaConfig.columnEditorConfig = transformColumnEditorConfig(columnEditorConfig);
|
|
219
|
+
}
|
|
220
|
+
if (icons !== undefined) {
|
|
221
|
+
vanillaConfig.icons = transformIcons(icons);
|
|
222
|
+
}
|
|
223
|
+
if (rowButtons !== undefined) {
|
|
224
|
+
vanillaConfig.rowButtons = rowButtons.map((button) => wrap(button));
|
|
225
|
+
}
|
|
226
|
+
return vanillaConfig;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Tracks imperative Angular mounts and caches wrapped cell/header renderers per
|
|
231
|
+
* accessor so unstable column rebuilds keep stable wrapper identity.
|
|
232
|
+
*/
|
|
233
|
+
const MOUNT_ID_ATTR = "data-st-mount-id";
|
|
234
|
+
class MountRegistry {
|
|
235
|
+
constructor() {
|
|
236
|
+
this.entries = new Map();
|
|
237
|
+
this.nextId = 0;
|
|
238
|
+
this.cellRendererCache = new Map();
|
|
239
|
+
this.headerRendererCache = new Map();
|
|
240
|
+
this.disposeHost = (host) => {
|
|
241
|
+
if (typeof host.getAttribute !== "function")
|
|
242
|
+
return;
|
|
243
|
+
const ids = [];
|
|
244
|
+
const selfId = host.getAttribute(MOUNT_ID_ATTR);
|
|
245
|
+
if (selfId !== null)
|
|
246
|
+
ids.push(selfId);
|
|
247
|
+
const tagged = host.querySelectorAll(`[${MOUNT_ID_ATTR}]`);
|
|
248
|
+
tagged.forEach((el) => {
|
|
249
|
+
const id = el.getAttribute(MOUNT_ID_ATTR);
|
|
250
|
+
if (id !== null)
|
|
251
|
+
ids.push(id);
|
|
252
|
+
});
|
|
253
|
+
for (const id of ids) {
|
|
254
|
+
const dispose = this.entries.get(id);
|
|
255
|
+
if (!dispose)
|
|
256
|
+
continue;
|
|
257
|
+
this.entries.delete(id);
|
|
258
|
+
dispose();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
register(container, dispose) {
|
|
263
|
+
const id = `st-mount-${this.nextId++}`;
|
|
264
|
+
container.setAttribute(MOUNT_ID_ATTR, id);
|
|
265
|
+
this.entries.set(id, dispose);
|
|
266
|
+
}
|
|
267
|
+
clear() {
|
|
268
|
+
this.cellRendererCache.clear();
|
|
269
|
+
this.headerRendererCache.clear();
|
|
270
|
+
for (const dispose of this.entries.values()) {
|
|
271
|
+
dispose();
|
|
272
|
+
}
|
|
273
|
+
this.entries.clear();
|
|
274
|
+
}
|
|
275
|
+
pruneRendererCaches(liveAccessors) {
|
|
276
|
+
for (const key of this.cellRendererCache.keys()) {
|
|
277
|
+
if (!liveAccessors.has(key))
|
|
278
|
+
this.cellRendererCache.delete(key);
|
|
279
|
+
}
|
|
280
|
+
for (const key of this.headerRendererCache.keys()) {
|
|
281
|
+
if (!liveAccessors.has(key))
|
|
282
|
+
this.headerRendererCache.delete(key);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
get size() {
|
|
286
|
+
return this.entries.size;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* SimpleTable — Angular adapter for simple-table-core.
|
|
292
|
+
*
|
|
293
|
+
* Accepts the same props as SimpleTableProps (the vanilla user-facing API) but
|
|
294
|
+
* with Angular component types for all renderer props.
|
|
295
|
+
*
|
|
296
|
+
* Prefer typed `rows` / `columns` (`AngularColumnDef<MyRow>`). For a typed
|
|
297
|
+
* imperative handle, use `@ViewChild(SimpleTableComponent) table!: SimpleTableComponent<MyRow>`
|
|
298
|
+
* or listen to `(tableReady)`.
|
|
299
|
+
*/
|
|
300
|
+
class SimpleTableComponent {
|
|
301
|
+
constructor() {
|
|
302
|
+
/** Emits the TableAPI once the table has mounted. */
|
|
303
|
+
this.tableReady = new EventEmitter();
|
|
304
|
+
this.instance = null;
|
|
305
|
+
this.registry = new MountRegistry();
|
|
306
|
+
this.hostEl = inject((ElementRef));
|
|
307
|
+
this.appRef = inject(ApplicationRef);
|
|
308
|
+
this.envInjector = inject(EnvironmentInjector);
|
|
309
|
+
}
|
|
310
|
+
ngOnInit() {
|
|
311
|
+
const container = this.hostEl.nativeElement.querySelector("div");
|
|
312
|
+
if (!container)
|
|
313
|
+
return;
|
|
314
|
+
const props = this.getProps();
|
|
315
|
+
this.instance = new SimpleTableVanilla(container, buildVanillaConfig(props, this.registry, this.appRef, this.envInjector));
|
|
316
|
+
this.instance.mount();
|
|
317
|
+
this.syncedDefaultHeaders = resolveAngularColumns(props);
|
|
318
|
+
this.syncedRows = props.rows;
|
|
319
|
+
this.tableReady.emit(this.instance.getAPI());
|
|
320
|
+
}
|
|
321
|
+
ngOnChanges() {
|
|
322
|
+
if (!this.instance)
|
|
323
|
+
return;
|
|
324
|
+
const props = this.getProps();
|
|
325
|
+
const fullConfig = buildVanillaConfig(props, this.registry, this.appRef, this.envInjector);
|
|
326
|
+
const patch = { ...fullConfig };
|
|
327
|
+
const resolvedColumns = resolveAngularColumns(props);
|
|
328
|
+
const headersUnchanged = headersStructurallyEqual(this.syncedDefaultHeaders, resolvedColumns);
|
|
329
|
+
this.syncedDefaultHeaders = resolvedColumns;
|
|
330
|
+
if (headersUnchanged) {
|
|
331
|
+
delete patch.columns;
|
|
332
|
+
}
|
|
333
|
+
const rowsUnchanged = rowsShallowUnchanged(this.syncedRows, props.rows, props.getRowId);
|
|
334
|
+
this.syncedRows = props.rows;
|
|
335
|
+
if (rowsUnchanged) {
|
|
336
|
+
delete patch.rows;
|
|
337
|
+
}
|
|
338
|
+
this.instance.update(patch);
|
|
339
|
+
}
|
|
340
|
+
ngOnDestroy() {
|
|
341
|
+
this.instance?.destroy();
|
|
342
|
+
this.instance = null;
|
|
343
|
+
this.syncedDefaultHeaders = undefined;
|
|
344
|
+
this.syncedRows = undefined;
|
|
345
|
+
this.registry.clear();
|
|
346
|
+
}
|
|
347
|
+
/** Returns the full imperative TableAPI. Use via @ViewChild or (tableReady) output. */
|
|
348
|
+
getAPI() {
|
|
349
|
+
return this.instance?.getAPI() ?? null;
|
|
350
|
+
}
|
|
351
|
+
getProps() {
|
|
352
|
+
const props = {
|
|
353
|
+
rows: this.rows,
|
|
354
|
+
};
|
|
355
|
+
if (this.columns !== undefined)
|
|
356
|
+
props.columns = this.columns;
|
|
357
|
+
if (this.footerRenderer !== undefined)
|
|
358
|
+
props.footerRenderer = this.footerRenderer;
|
|
359
|
+
if (this.loadingStateRenderer !== undefined)
|
|
360
|
+
props.loadingStateRenderer = this.loadingStateRenderer;
|
|
361
|
+
if (this.errorStateRenderer !== undefined)
|
|
362
|
+
props.errorStateRenderer = this.errorStateRenderer;
|
|
363
|
+
if (this.emptyStateRenderer !== undefined)
|
|
364
|
+
props.emptyStateRenderer = this.emptyStateRenderer;
|
|
365
|
+
if (this.tableEmptyStateRenderer !== undefined)
|
|
366
|
+
props.tableEmptyStateRenderer = this.tableEmptyStateRenderer;
|
|
367
|
+
if (this.headerDropdown !== undefined)
|
|
368
|
+
props.headerDropdown = this.headerDropdown;
|
|
369
|
+
if (this.columnEditorConfig !== undefined)
|
|
370
|
+
props.columnEditorConfig = this.columnEditorConfig;
|
|
371
|
+
if (this.onCellClick !== undefined)
|
|
372
|
+
props.onCellClick = this.onCellClick;
|
|
373
|
+
if (this.onCellEdit !== undefined)
|
|
374
|
+
props.onCellEdit = this.onCellEdit;
|
|
375
|
+
if (this.onSortChange !== undefined)
|
|
376
|
+
props.onSortChange = this.onSortChange;
|
|
377
|
+
if (this.onFilterChange !== undefined)
|
|
378
|
+
props.onFilterChange = this.onFilterChange;
|
|
379
|
+
if (this.onRowSelectionChange !== undefined)
|
|
380
|
+
props.onRowSelectionChange = this.onRowSelectionChange;
|
|
381
|
+
if (this.onRowGroupExpand !== undefined)
|
|
382
|
+
props.onRowGroupExpand = this.onRowGroupExpand;
|
|
383
|
+
if (this.onColumnOrderChange !== undefined)
|
|
384
|
+
props.onColumnOrderChange = this.onColumnOrderChange;
|
|
385
|
+
if (this.onColumnVisibilityChange !== undefined)
|
|
386
|
+
props.onColumnVisibilityChange = this.onColumnVisibilityChange;
|
|
387
|
+
if (this.onColumnWidthChange !== undefined)
|
|
388
|
+
props.onColumnWidthChange = this.onColumnWidthChange;
|
|
389
|
+
if (this.onPageChange !== undefined)
|
|
390
|
+
props.onPageChange = this.onPageChange;
|
|
391
|
+
if (this.onLoadMore !== undefined)
|
|
392
|
+
props.onLoadMore = this.onLoadMore;
|
|
393
|
+
if (this.onTableReady !== undefined)
|
|
394
|
+
props.onTableReady = this.onTableReady;
|
|
395
|
+
if (this.rowGrouping !== undefined)
|
|
396
|
+
props.rowGrouping = this.rowGrouping;
|
|
397
|
+
if (this.pivot !== undefined)
|
|
398
|
+
props.pivot = this.pivot;
|
|
399
|
+
if (this.onPivotChange !== undefined)
|
|
400
|
+
props.onPivotChange = this.onPivotChange;
|
|
401
|
+
if (this.enableRowSelection !== undefined)
|
|
402
|
+
props.enableRowSelection = this.enableRowSelection;
|
|
403
|
+
if (this.theme !== undefined)
|
|
404
|
+
props.theme = this.theme;
|
|
405
|
+
if (this.quickFilter !== undefined)
|
|
406
|
+
props.quickFilter = this.quickFilter;
|
|
407
|
+
if (this.isLoading !== undefined)
|
|
408
|
+
props.isLoading = this.isLoading;
|
|
409
|
+
if (this.getRowId !== undefined)
|
|
410
|
+
props.getRowId = this.getRowId;
|
|
411
|
+
if (this.enablePagination !== undefined)
|
|
412
|
+
props.enablePagination = this.enablePagination;
|
|
413
|
+
if (this.rowsPerPage !== undefined)
|
|
414
|
+
props.rowsPerPage = this.rowsPerPage;
|
|
415
|
+
if (this.serverSidePagination !== undefined)
|
|
416
|
+
props.serverSidePagination = this.serverSidePagination;
|
|
417
|
+
if (this.totalRowCount !== undefined)
|
|
418
|
+
props.totalRowCount = this.totalRowCount;
|
|
419
|
+
if (this.height !== undefined)
|
|
420
|
+
props.height = this.height;
|
|
421
|
+
if (this.maxHeight !== undefined)
|
|
422
|
+
props.maxHeight = this.maxHeight;
|
|
423
|
+
if (this.scrollParent !== undefined)
|
|
424
|
+
props.scrollParent = this.scrollParent;
|
|
425
|
+
if (this.infiniteScrollThreshold !== undefined)
|
|
426
|
+
props.infiniteScrollThreshold = this.infiniteScrollThreshold;
|
|
427
|
+
if (this.columnResizing !== undefined)
|
|
428
|
+
props.columnResizing = this.columnResizing;
|
|
429
|
+
if (this.columnReordering !== undefined)
|
|
430
|
+
props.columnReordering = this.columnReordering;
|
|
431
|
+
if (this.enableColumnEditor !== undefined)
|
|
432
|
+
props.enableColumnEditor = this.enableColumnEditor;
|
|
433
|
+
if (this.enableColumnEditorInitOpen !== undefined)
|
|
434
|
+
props.enableColumnEditorInitOpen = this.enableColumnEditorInitOpen;
|
|
435
|
+
if (this.enableColumnEditorInitOpen !== undefined)
|
|
436
|
+
props.enableColumnEditorInitOpen = this.enableColumnEditorInitOpen;
|
|
437
|
+
if (this.selectableCells !== undefined)
|
|
438
|
+
props.selectableCells = this.selectableCells;
|
|
439
|
+
if (this.selectableColumns !== undefined)
|
|
440
|
+
props.selectableColumns = this.selectableColumns;
|
|
441
|
+
if (this.enableHeaderEditing !== undefined)
|
|
442
|
+
props.enableHeaderEditing = this.enableHeaderEditing;
|
|
443
|
+
if (this.onHeaderEdit !== undefined)
|
|
444
|
+
props.onHeaderEdit = this.onHeaderEdit;
|
|
445
|
+
if (this.customTheme !== undefined)
|
|
446
|
+
props.customTheme = this.customTheme;
|
|
447
|
+
if (this.icons !== undefined)
|
|
448
|
+
props.icons = this.icons;
|
|
449
|
+
if (this.externalFilterHandling !== undefined)
|
|
450
|
+
props.externalFilterHandling = this.externalFilterHandling;
|
|
451
|
+
if (this.externalSortHandling !== undefined)
|
|
452
|
+
props.externalSortHandling = this.externalSortHandling;
|
|
453
|
+
if (this.columnBorders !== undefined)
|
|
454
|
+
props.columnBorders = this.columnBorders;
|
|
455
|
+
if (this.rowButtons !== undefined)
|
|
456
|
+
props.rowButtons = this.rowButtons;
|
|
457
|
+
if (this.hideFooter !== undefined)
|
|
458
|
+
props.hideFooter = this.hideFooter;
|
|
459
|
+
if (this.footerPosition !== undefined)
|
|
460
|
+
props.footerPosition = this.footerPosition;
|
|
461
|
+
if (this.initialSortColumn !== undefined)
|
|
462
|
+
props.initialSortColumn = this.initialSortColumn;
|
|
463
|
+
if (this.initialSortDirection !== undefined)
|
|
464
|
+
props.initialSortDirection = this.initialSortDirection;
|
|
465
|
+
if (this.expandAll !== undefined)
|
|
466
|
+
props.expandAll = this.expandAll;
|
|
467
|
+
if (this.autoExpandColumns !== undefined)
|
|
468
|
+
props.autoExpandColumns = this.autoExpandColumns;
|
|
469
|
+
if (this.animations !== undefined)
|
|
470
|
+
props.animations = this.animations;
|
|
471
|
+
if (this.enableVirtualization !== undefined)
|
|
472
|
+
props.enableVirtualization = this.enableVirtualization;
|
|
473
|
+
if (this.hoverRowBackground !== undefined)
|
|
474
|
+
props.hoverRowBackground = this.hoverRowBackground;
|
|
475
|
+
if (this.hoverRowBackground !== undefined)
|
|
476
|
+
props.hoverRowBackground = this.hoverRowBackground;
|
|
477
|
+
if (this.oddColumnBackground !== undefined)
|
|
478
|
+
props.oddColumnBackground = this.oddColumnBackground;
|
|
479
|
+
if (this.oddColumnBackground !== undefined)
|
|
480
|
+
props.oddColumnBackground = this.oddColumnBackground;
|
|
481
|
+
if (this.oddEvenRowBackground !== undefined)
|
|
482
|
+
props.oddEvenRowBackground = this.oddEvenRowBackground;
|
|
483
|
+
if (this.oddEvenRowBackground !== undefined)
|
|
484
|
+
props.oddEvenRowBackground = this.oddEvenRowBackground;
|
|
485
|
+
return props;
|
|
486
|
+
}
|
|
487
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.27", ngImport: i0, type: SimpleTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
488
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.27", type: SimpleTableComponent, isStandalone: true, selector: "simple-table", inputs: { rows: "rows", columns: "columns", footerRenderer: "footerRenderer", loadingStateRenderer: "loadingStateRenderer", errorStateRenderer: "errorStateRenderer", emptyStateRenderer: "emptyStateRenderer", tableEmptyStateRenderer: "tableEmptyStateRenderer", headerDropdown: "headerDropdown", columnEditorConfig: "columnEditorConfig", onCellClick: "onCellClick", onCellEdit: "onCellEdit", onSortChange: "onSortChange", onFilterChange: "onFilterChange", onRowSelectionChange: "onRowSelectionChange", onRowGroupExpand: "onRowGroupExpand", onColumnOrderChange: "onColumnOrderChange", onColumnVisibilityChange: "onColumnVisibilityChange", onColumnWidthChange: "onColumnWidthChange", onPageChange: "onPageChange", onLoadMore: "onLoadMore", onTableReady: "onTableReady", rowGrouping: "rowGrouping", pivot: "pivot", onPivotChange: "onPivotChange", enableRowSelection: "enableRowSelection", theme: "theme", quickFilter: "quickFilter", isLoading: "isLoading", getRowId: "getRowId", enablePagination: "enablePagination", rowsPerPage: "rowsPerPage", serverSidePagination: "serverSidePagination", totalRowCount: "totalRowCount", height: "height", maxHeight: "maxHeight", scrollParent: "scrollParent", infiniteScrollThreshold: "infiniteScrollThreshold", columnResizing: "columnResizing", columnReordering: "columnReordering", enableColumnEditor: "enableColumnEditor", enableColumnEditorInitOpen: "enableColumnEditorInitOpen", selectableCells: "selectableCells", selectableColumns: "selectableColumns", enableHeaderEditing: "enableHeaderEditing", onHeaderEdit: "onHeaderEdit", customTheme: "customTheme", icons: "icons", externalFilterHandling: "externalFilterHandling", externalSortHandling: "externalSortHandling", columnBorders: "columnBorders", rowButtons: "rowButtons", hideFooter: "hideFooter", footerPosition: "footerPosition", initialSortColumn: "initialSortColumn", initialSortDirection: "initialSortDirection", expandAll: "expandAll", autoExpandColumns: "autoExpandColumns", animations: "animations", enableVirtualization: "enableVirtualization", hoverRowBackground: "hoverRowBackground", oddColumnBackground: "oddColumnBackground", oddEvenRowBackground: "oddEvenRowBackground" }, outputs: { tableReady: "tableReady" }, usesOnChanges: true, ngImport: i0, template: `<div #host></div>`, isInline: true, styles: [":host{display:block}\n"] }); }
|
|
489
|
+
}
|
|
490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.27", ngImport: i0, type: SimpleTableComponent, decorators: [{
|
|
491
|
+
type: Component,
|
|
492
|
+
args: [{ selector: "simple-table", standalone: true, template: `<div #host></div>`, styles: [":host{display:block}\n"] }]
|
|
493
|
+
}], propDecorators: { rows: [{
|
|
494
|
+
type: Input,
|
|
495
|
+
args: [{ required: true }]
|
|
496
|
+
}], columns: [{
|
|
497
|
+
type: Input
|
|
498
|
+
}], footerRenderer: [{
|
|
499
|
+
type: Input
|
|
500
|
+
}], loadingStateRenderer: [{
|
|
501
|
+
type: Input
|
|
502
|
+
}], errorStateRenderer: [{
|
|
503
|
+
type: Input
|
|
504
|
+
}], emptyStateRenderer: [{
|
|
505
|
+
type: Input
|
|
506
|
+
}], tableEmptyStateRenderer: [{
|
|
507
|
+
type: Input
|
|
508
|
+
}], headerDropdown: [{
|
|
509
|
+
type: Input
|
|
510
|
+
}], columnEditorConfig: [{
|
|
511
|
+
type: Input
|
|
512
|
+
}], onCellClick: [{
|
|
513
|
+
type: Input
|
|
514
|
+
}], onCellEdit: [{
|
|
515
|
+
type: Input
|
|
516
|
+
}], onSortChange: [{
|
|
517
|
+
type: Input
|
|
518
|
+
}], onFilterChange: [{
|
|
519
|
+
type: Input
|
|
520
|
+
}], onRowSelectionChange: [{
|
|
521
|
+
type: Input
|
|
522
|
+
}], onRowGroupExpand: [{
|
|
523
|
+
type: Input
|
|
524
|
+
}], onColumnOrderChange: [{
|
|
525
|
+
type: Input
|
|
526
|
+
}], onColumnVisibilityChange: [{
|
|
527
|
+
type: Input
|
|
528
|
+
}], onColumnWidthChange: [{
|
|
529
|
+
type: Input
|
|
530
|
+
}], onPageChange: [{
|
|
531
|
+
type: Input
|
|
532
|
+
}], onLoadMore: [{
|
|
533
|
+
type: Input
|
|
534
|
+
}], onTableReady: [{
|
|
535
|
+
type: Input
|
|
536
|
+
}], rowGrouping: [{
|
|
537
|
+
type: Input
|
|
538
|
+
}], pivot: [{
|
|
539
|
+
type: Input
|
|
540
|
+
}], onPivotChange: [{
|
|
541
|
+
type: Input
|
|
542
|
+
}], enableRowSelection: [{
|
|
543
|
+
type: Input
|
|
544
|
+
}], theme: [{
|
|
545
|
+
type: Input
|
|
546
|
+
}], quickFilter: [{
|
|
547
|
+
type: Input
|
|
548
|
+
}], isLoading: [{
|
|
549
|
+
type: Input
|
|
550
|
+
}], getRowId: [{
|
|
551
|
+
type: Input
|
|
552
|
+
}], enablePagination: [{
|
|
553
|
+
type: Input
|
|
554
|
+
}], rowsPerPage: [{
|
|
555
|
+
type: Input
|
|
556
|
+
}], serverSidePagination: [{
|
|
557
|
+
type: Input
|
|
558
|
+
}], totalRowCount: [{
|
|
559
|
+
type: Input
|
|
560
|
+
}], height: [{
|
|
561
|
+
type: Input
|
|
562
|
+
}], maxHeight: [{
|
|
563
|
+
type: Input
|
|
564
|
+
}], scrollParent: [{
|
|
565
|
+
type: Input
|
|
566
|
+
}], infiniteScrollThreshold: [{
|
|
567
|
+
type: Input
|
|
568
|
+
}], columnResizing: [{
|
|
569
|
+
type: Input
|
|
570
|
+
}], columnReordering: [{
|
|
571
|
+
type: Input
|
|
572
|
+
}], enableColumnEditor: [{
|
|
573
|
+
type: Input
|
|
574
|
+
}], enableColumnEditorInitOpen: [{
|
|
575
|
+
type: Input
|
|
576
|
+
}], selectableCells: [{
|
|
577
|
+
type: Input
|
|
578
|
+
}], selectableColumns: [{
|
|
579
|
+
type: Input
|
|
580
|
+
}], enableHeaderEditing: [{
|
|
581
|
+
type: Input
|
|
582
|
+
}], onHeaderEdit: [{
|
|
583
|
+
type: Input
|
|
584
|
+
}], customTheme: [{
|
|
585
|
+
type: Input
|
|
586
|
+
}], icons: [{
|
|
587
|
+
type: Input
|
|
588
|
+
}], externalFilterHandling: [{
|
|
589
|
+
type: Input
|
|
590
|
+
}], externalSortHandling: [{
|
|
591
|
+
type: Input
|
|
592
|
+
}], columnBorders: [{
|
|
593
|
+
type: Input
|
|
594
|
+
}], rowButtons: [{
|
|
595
|
+
type: Input
|
|
596
|
+
}], hideFooter: [{
|
|
597
|
+
type: Input
|
|
598
|
+
}], footerPosition: [{
|
|
599
|
+
type: Input
|
|
600
|
+
}], initialSortColumn: [{
|
|
601
|
+
type: Input
|
|
602
|
+
}], initialSortDirection: [{
|
|
603
|
+
type: Input
|
|
604
|
+
}], expandAll: [{
|
|
605
|
+
type: Input
|
|
606
|
+
}], autoExpandColumns: [{
|
|
607
|
+
type: Input
|
|
608
|
+
}], animations: [{
|
|
609
|
+
type: Input
|
|
610
|
+
}], enableVirtualization: [{
|
|
611
|
+
type: Input
|
|
612
|
+
}], hoverRowBackground: [{
|
|
613
|
+
type: Input
|
|
614
|
+
}], oddColumnBackground: [{
|
|
615
|
+
type: Input
|
|
616
|
+
}], oddEvenRowBackground: [{
|
|
617
|
+
type: Input
|
|
618
|
+
}], tableReady: [{
|
|
619
|
+
type: Output
|
|
620
|
+
}] } });
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Call this in your application's `providers` array (or `bootstrapApplication`
|
|
624
|
+
* providers) to register the dependencies that simple-table-angular's renderer
|
|
625
|
+
* bridge needs — specifically `ApplicationRef` and `EnvironmentInjector`.
|
|
626
|
+
*
|
|
627
|
+
* These are already provided by Angular's platform by default, so in practice
|
|
628
|
+
* this function is a no-op placeholder that serves as a clear signal to
|
|
629
|
+
* consumers that the adapter has been correctly wired up. If future versions
|
|
630
|
+
* need custom providers they will be added here without breaking the call site.
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* // main.ts
|
|
634
|
+
* bootstrapApplication(AppComponent, {
|
|
635
|
+
* providers: [provideSimpleTable()],
|
|
636
|
+
* });
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* // app.module.ts
|
|
640
|
+
* @NgModule({ providers: [provideSimpleTable()] })
|
|
641
|
+
* export class AppModule {}
|
|
642
|
+
*/
|
|
643
|
+
function provideSimpleTable() {
|
|
644
|
+
return makeEnvironmentProviders([
|
|
645
|
+
// ApplicationRef and EnvironmentInjector are part of Angular's core platform
|
|
646
|
+
// and are available without any additional registration.
|
|
647
|
+
// This factory is intentionally empty — it exists for API symmetry with
|
|
648
|
+
// other Angular ecosystem libraries and to allow non-breaking additions later.
|
|
649
|
+
]);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// Component
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Generated bundle index. Do not edit.
|
|
656
|
+
*/
|
|
657
|
+
|
|
658
|
+
export { SimpleTableComponent, provideSimpleTable, wrapAngularRenderer };
|
|
659
|
+
//# sourceMappingURL=simple-table-angular.mjs.map
|