@spectric/ui 0.0.20 → 0.0.21

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.
@@ -1,315 +1,412 @@
1
- import { html, LitElement, PropertyValues, render, TemplateResult } from 'lit';
1
+ import { html, LitElement, PropertyValues, TemplateResult } from "lit";
2
2
  import "../pagination";
3
- import "./header"
4
- import "./body"
5
- import { customElement, property, state, } from 'lit/decorators.js';
6
- import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from '../types';
7
- import "./virtualBody"
8
- import "./table.css"
9
- export const TableElementTag = "spectric-table"
10
- import { spreadProps } from '../../utils/spread';
11
- import { PaginationChangeProps, PaginationProps } from '../pagination';
12
- import { FilterEvent } from './cell';
13
- import { createSortChain } from './sorting';
3
+ import "./header";
4
+ import "./body";
5
+ import { customElement, property, state } from "lit/decorators.js";
6
+ import {
7
+ HTMLElementTagWithEvents,
8
+ ReactElementWithPropsAndEvents,
9
+ } from "../types";
10
+ import "./virtualBody";
11
+ import "./table.css";
12
+ export const TableElementTag = "spectric-table";
13
+ import { spreadProps } from "../../utils/spread";
14
+ import { PaginationChangeProps, PaginationProps } from "../pagination";
15
+ import { FilterEvent } from "./cell";
16
+ import { createSortChain } from "./sorting";
14
17
 
15
- export type { TableProps, TableEvents }
18
+ export type { TableProps, TableEvents };
16
19
 
17
- export type DomRenderable = HTMLElement | TemplateResult | string | number | null
20
+ export type DomRenderable =
21
+ | HTMLElement
22
+ | TemplateResult
23
+ | string
24
+ | number
25
+ | null
26
+ | undefined;
18
27
  export enum TableSelectOptions {
19
- multi = "multi",
20
- single = "single",
21
- none = "none"
28
+ multi = "multi",
29
+ single = "single",
30
+ none = "none",
22
31
  }
23
32
 
24
33
  export enum TableSortOption {
25
- multi = "multi",
26
- single = "single",
34
+ multi = "multi",
35
+ single = "single",
27
36
  }
28
- export type TableSortOptionTypes = `${TableSortOption}`
37
+ export type TableSortOptionTypes = `${TableSortOption}`;
29
38
  export enum TableSortDirection {
30
- ascending = "ascending",
31
- descending = "descending",
32
- none = "none"
39
+ ascending = "ascending",
40
+ descending = "descending",
41
+ none = "none",
33
42
  }
34
- export type TableSortDirectionTypes = `${TableSortDirection}`
43
+ export type TableSortDirectionTypes = `${TableSortDirection}`;
35
44
  export type ColumnSettings<T> = {
36
- [TABLE_CREATED_SELECTION_COLUMN]?: boolean
37
- width?: number
38
- /**
39
- * Enabled/disables resizing by dragging column header Default true
40
- */
41
- allowResize?: boolean
42
- whiteSpace?: "nowrap";
43
- hidden?: boolean
44
- sortable?: boolean
45
- sortDirection?: TableSortDirectionTypes
46
- filterable?: boolean
47
- title?: DomRenderable
48
- /**
49
- * Key to used for getting data from an object for a cell
50
- */
51
- key?: string
52
- /**
53
- * Render function to render a table cell for displaying custom html
54
- */
55
- render?: (row: T, index: number, table: SpectricTableElement<T>) => DomRenderable
56
- /**
57
- * Custom comparator function for sorting
58
- */
59
- compareFn?: ((a: T, b: T) => number) | undefined
60
- }
61
- export type TableSelectOptionsTypes = `${TableSelectOptions}`
45
+ [TABLE_CREATED_SELECTION_COLUMN]?: boolean;
46
+ width?: number;
47
+ /**
48
+ * Enabled/disables resizing by dragging column header Default true
49
+ */
50
+ allowResize?: boolean;
51
+ whiteSpace?: "nowrap";
52
+ hidden?: boolean;
53
+ sortable?: boolean;
54
+ sortDirection?: TableSortDirectionTypes;
55
+ filterable?: boolean;
56
+ title?: DomRenderable | ((table: SpectricTableElement<T>) => DomRenderable);
57
+ /**
58
+ * Key to used for getting data from an object for a cell
59
+ */
60
+ key?: string;
61
+ /**
62
+ * Render function to render a table cell for displaying custom html
63
+ */
64
+ render?: (
65
+ row: T,
66
+ index: number,
67
+ table: SpectricTableElement<T>
68
+ ) => DomRenderable;
69
+ /**
70
+ * Custom comparator function for sorting
71
+ */
72
+ compareFn?: ((a: T, b: T) => number) | undefined;
73
+ };
74
+ export type TableSelectOptionsTypes = `${TableSelectOptions}`;
62
75
  export interface TableDataOptions<T> {
63
- pagination?: PaginationProps
64
- columns: ColumnSettings<T>[]
65
- sortOrder?: string[]
76
+ pagination?: PaginationProps;
77
+ columns: ColumnSettings<T>[];
78
+ sortOrder?: string[];
66
79
  }
67
80
  interface TableProps<T> extends TableDataOptions<T> {
68
- data: T[]
69
- select: TableSelectOptionsTypes
70
- sort?: TableSortOptionTypes
71
- rowHeight?: number
81
+ data: T[];
82
+ select: TableSelectOptionsTypes;
83
+ sort?: TableSortOptionTypes;
84
+ rowHeight?: number;
72
85
  }
73
86
 
74
87
  export type DomEvent<T> = Event & {
75
- target: T
76
- }
88
+ target: T;
89
+ };
77
90
 
78
91
  export const TD_BorderAndPadding = 4;
79
- const TABLE_CREATED_SELECTION_COLUMN = Symbol("spectric-table-selection-column")
92
+ const TABLE_CREATED_SELECTION_COLUMN = Symbol(
93
+ "spectric-table-selection-column"
94
+ );
80
95
  /**
81
96
  * React example
82
97
  * <iframe width="100%" height="400px" src="https://stackblitz.com/edit/react-ts-2ue7azag?ctl=1&embed=1&file=App.tsx&hideExplorer=1&hideNavigation=1"/>
83
98
  *
84
99
  */
85
100
  @customElement(TableElementTag)
86
- export class SpectricTableElement<T = any> extends LitElement implements TableProps<T> {
87
- @property({ type: Array, attribute: false })
88
- data: T[] = [];
89
- @property({ type: Object, attribute: false })
90
- pagination?: PaginationProps;
91
- @property({ attribute: false })
92
- columns: ColumnSettings<T>[] = [];
93
- @property({ type: String, reflect: true })
94
- select: TableSelectOptionsTypes = TableSelectOptions.none;
95
- @property({ type: String, reflect: true })
96
- sort: TableSortOptionTypes = TableSortOption.single;
97
-
98
- @property({ type: Array, reflect: false })
99
- sortOrder: string[] = [];
100
- /**
101
- * Needed for virtualization
102
- */
103
- @property({ type: Number, reflect: true })
104
- rowHeight: number = 25;
105
- /**
106
- * Needed for virtualization
107
- */
108
- @property({ type: Number, reflect: true })
109
- fontSize: number = 16;
110
-
111
- static getDefaultDataSorterAndPaginatior<T>(data: T[]) {
112
- return (props: TableDataOptions<T>) => {
113
- //let sorts = props.columns.filter(column => column.sortable && column.sortDirection && column.sortDirection !== TableSortDirection.none)
114
- let sorts = (props.sortOrder || []).map(key => props.columns.find(col => col.key === key) as ColumnSettings<T>)
115
- let rows = [...data] // Need to copy the array to prevent mutating the ordering of the original data
116
- if (sorts.length) {
117
- let sortChain = createSortChain(sorts)
118
- rows.sort((a, b) => {
119
- for (let sort of sortChain) {
120
- let result = sort(a, b)
121
- if (result) {
122
- return result
123
- }
124
- }
125
- return 0
126
- })
127
- }
101
+ export class SpectricTableElement<T = any>
102
+ extends LitElement
103
+ implements TableProps<T>
104
+ {
105
+ @property({ type: Array, attribute: false })
106
+ data: T[] = [];
107
+ @property({ type: Object, attribute: false })
108
+ pagination?: PaginationProps;
109
+ @property({ attribute: false })
110
+ columns: ColumnSettings<T>[] = [];
111
+ @property({ type: String, reflect: true })
112
+ select: TableSelectOptionsTypes = TableSelectOptions.none;
113
+ @property({ type: String, reflect: true })
114
+ sort: TableSortOptionTypes = TableSortOption.single;
128
115
 
129
- if (!props.pagination) {
130
- return rows
131
- }
132
- let { page, pageSize } = props.pagination
133
- if (!page || !pageSize) {
134
- return rows
116
+ @property({ type: Array, reflect: false })
117
+ sortOrder: string[] = [];
118
+ /**
119
+ * Needed for virtualization
120
+ */
121
+ @property({ type: Number, reflect: true })
122
+ rowHeight: number = 25;
123
+ /**
124
+ * Needed for virtualization
125
+ */
126
+ @property({ type: Number, reflect: true })
127
+ fontSize: number = 16;
128
+ static getDefaultDataSorterAndPaginatior<T>(data: T[]) {
129
+ return (props: TableDataOptions<T>) => {
130
+ //let sorts = props.columns.filter(column => column.sortable && column.sortDirection && column.sortDirection !== TableSortDirection.none)
131
+ let sorts = (props.sortOrder || []).map(
132
+ (key) =>
133
+ props.columns.find((col) => col.key === key) as ColumnSettings<T>
134
+ );
135
+ let rows = [...data]; // Need to copy the array to prevent mutating the ordering of the original data
136
+ if (sorts.length) {
137
+ let sortChain = createSortChain(sorts);
138
+ rows.sort((a, b) => {
139
+ for (let sort of sortChain) {
140
+ let result = sort(a, b);
141
+ if (result) {
142
+ return result;
135
143
  }
136
- return !props.pagination ? rows : rows.slice((page - 1) * pageSize, (page) * pageSize)
137
- }
138
- }
144
+ }
145
+ return 0;
146
+ });
147
+ }
139
148
 
140
- private _handlePaginationChange = (e: CustomEvent<PaginationChangeProps>) => {
141
- if (this.pagination) {
142
- let pagination = { ...this.pagination, ...e.detail }
143
-
144
- let { totalItems, page, pageSize } = pagination
145
- if (totalItems && page && pageSize && ((page - 1) * pageSize) > totalItems) {
146
- pagination.page = 1
147
- }
148
- this.pagination = pagination
149
- }
150
- this.dispatchEvent(new CustomEvent<PaginationChangeProps>("paginationChange", { detail: e.detail }))
151
- this._emitChange()
149
+ if (!props.pagination) {
150
+ return rows;
151
+ }
152
+ let { page, pageSize } = props.pagination;
153
+ if (!page || !pageSize) {
154
+ return rows;
155
+ }
156
+ return !props.pagination
157
+ ? rows
158
+ : rows.slice((page - 1) * pageSize, page * pageSize);
152
159
  };
153
- private _handleSortChange = (e: CustomEvent<ColumnSettings<T>>) => {
154
- let columnSetting = e.detail
155
- let column = this.columns.find(col => col.key == columnSetting.key)
156
- if (!column || column.key === undefined) {
157
- console.warn("Unable to find sort column")
158
- return
159
- }
160
- if (this.sort == TableSortOption.single) {
161
- //Single column sort so we reset the sort direction for all columns
162
- this.columns.forEach(col => {
163
- col.sortDirection = TableSortDirection.none
164
- })
165
- this.sortOrder = []
166
- }
167
- column.sortDirection = columnSetting.sortDirection;
168
- if (!column.sortDirection || column.sortDirection === "none") {
169
- let index = this.sortOrder.findIndex(col => col === column.key)
170
- if (index !== -1) {
171
- this.sortOrder.splice(index, 1)
172
- }
173
- } else {
174
- let index = this.sortOrder.findIndex(col => col === column.key)
175
- if (index === -1) {
176
- this.sortOrder = [...this.sortOrder, column.key]
177
- }
178
- }
179
- this.columns = [...this.columns]
180
- this._emitChange()
181
- }
182
- private _handleColumnResize = (e: CustomEvent<ColumnSettings<T>>) => {
183
- let columnSetting = e.detail
184
- let index = this.columns.findIndex(col => col.key == columnSetting.key)
185
- this.columns[index] = { ...this.columns[index] }
186
- this.columns = [...this.columns]
187
- this._emitChange()
188
- }
160
+ }
189
161
 
190
- private _emitChange = () => {
191
- let { pagination, columns, sortOrder } = this
192
- this.dispatchEvent(new CustomEvent<TableDataOptions<T>>("change", { detail: { pagination, columns, sortOrder } }))
162
+ private _handlePaginationChange = (e: CustomEvent<PaginationChangeProps>) => {
163
+ if (this.pagination) {
164
+ let pagination = { ...this.pagination, ...e.detail };
165
+
166
+ let { totalItems, page, pageSize } = pagination;
167
+ if (
168
+ totalItems &&
169
+ page &&
170
+ pageSize &&
171
+ (page - 1) * pageSize > totalItems
172
+ ) {
173
+ pagination.page = 1;
174
+ }
175
+ this.pagination = pagination;
193
176
  }
194
- //@ts-ignore
195
- private __DO_NOT_USE_filter = () => {
196
- //This is only here to auto document events that bubble up from lower components
197
- this.dispatchEvent(new CustomEvent<FilterEvent<T>>("filter"))
198
- this.dispatchEvent(new CustomEvent<ColumnSettings<T>>("sortChange"))
177
+ this.dispatchEvent(
178
+ new CustomEvent<PaginationChangeProps>("paginationChange", {
179
+ detail: e.detail,
180
+ })
181
+ );
182
+ this._emitChange();
183
+ };
184
+ private _handleSortChange = (e: CustomEvent<ColumnSettings<T>>) => {
185
+ let columnSetting = e.detail;
186
+ let column = this.columns.find((col) => col.key == columnSetting.key);
187
+ if (!column || column.key === undefined) {
188
+ console.warn("Unable to find sort column");
189
+ return;
199
190
  }
200
- @state()
201
- private selected: T[] = [];
202
- protected createRenderRoot(): HTMLElement | DocumentFragment {
203
- return this
191
+ if (this.sort == TableSortOption.single) {
192
+ //Single column sort so we reset the sort direction for all columns
193
+ this.columns.forEach((col) => {
194
+ col.sortDirection = TableSortDirection.none;
195
+ });
196
+ this.sortOrder = [];
204
197
  }
205
- deselectAll() {
206
- this.selected = []
207
- this.dispatchEvent(new CustomEvent("selected", { detail: this.selected }))
198
+ column.sortDirection = columnSetting.sortDirection;
199
+ if (!column.sortDirection || column.sortDirection === "none") {
200
+ let index = this.sortOrder.findIndex((col) => col === column.key);
201
+ if (index !== -1) {
202
+ this.sortOrder.splice(index, 1);
203
+ }
204
+ } else {
205
+ let index = this.sortOrder.findIndex((col) => col === column.key);
206
+ if (index === -1) {
207
+ this.sortOrder = [...this.sortOrder, column.key];
208
+ }
208
209
  }
209
- selectAll() {
210
- this.selected = [...this.data]
211
- this.dispatchEvent(new CustomEvent("selected", { detail: this.selected }))
210
+ this.columns = [...this.columns];
211
+ this._emitChange();
212
+ };
213
+ private _handleColumnResize = (e: CustomEvent<ColumnSettings<T>>) => {
214
+ let columnSetting = e.detail;
215
+ let index = this.columns.findIndex((col) => col.key == columnSetting.key);
216
+ this.columns[index] = { ...this.columns[index] };
217
+ this.columns = [...this.columns];
218
+ this._emitChange();
219
+ };
220
+
221
+ private _emitChange = () => {
222
+ let { pagination, columns, sortOrder } = this;
223
+ this.dispatchEvent(
224
+ new CustomEvent<TableDataOptions<T>>("change", {
225
+ detail: { pagination, columns, sortOrder },
226
+ })
227
+ );
228
+ };
229
+ //@ts-ignore
230
+ private __DO_NOT_USE_filter = () => {
231
+ //This is only here to auto document events that bubble up from lower components
232
+ this.dispatchEvent(new CustomEvent<FilterEvent<T>>("filter"));
233
+ this.dispatchEvent(new CustomEvent<ColumnSettings<T>>("sortChange"));
234
+ };
235
+ @state()
236
+ private selected: T[] = [];
237
+ protected createRenderRoot(): HTMLElement | DocumentFragment {
238
+ return this;
239
+ }
240
+ forceRefreshofSelectionColumn() {
241
+ // Because lit reuses dom elements for speed/effeciency it wont update unless the props are a different object.
242
+ // So we set the selection colum to a "new object" to force the rerender
243
+ let index = this.columns.findIndex(
244
+ (col) => col[TABLE_CREATED_SELECTION_COLUMN]
245
+ );
246
+ if (index !== -1) {
247
+ this.columns[index] = { ...this.selectColumnConfig };
212
248
  }
213
- _handleSelectAllChange = (e: DomEvent<HTMLInputElement>) => {
214
- e.stopPropagation()
215
- if (e.target.checked) {
216
- this.selectAll()
217
- } else {
218
- this.deselectAll()
219
- }
249
+ }
250
+ setSelected(selected: T[]) {
251
+ this.selected = selected;
252
+ this.forceRefreshofSelectionColumn();
253
+ }
254
+ deselectAll() {
255
+ this.selected = [];
256
+ this.forceRefreshofSelectionColumn();
257
+ this.dispatchEvent(new CustomEvent("selected", { detail: this.selected }));
258
+ }
259
+ selectAll() {
260
+ this.selected = [...this.data];
261
+ this.forceRefreshofSelectionColumn();
262
+ this.dispatchEvent(new CustomEvent("selected", { detail: this.selected }));
263
+ }
264
+ _handleSelectAllChange = (e: DomEvent<HTMLInputElement>) => {
265
+ e.stopPropagation();
266
+ if (e.target.checked) {
267
+ this.selectAll();
268
+ } else {
269
+ this.deselectAll();
220
270
  }
221
- protected update(changedProperties: PropertyValues): void {
222
- if (changedProperties.has("columns")) {
223
- if (this.select !== TableSelectOptions.none) {
224
- if (!this.columns.find(col => col[TABLE_CREATED_SELECTION_COLUMN])) {
225
- this.columns.unshift({
226
- [TABLE_CREATED_SELECTION_COLUMN]: true,
227
- title: this.select === "multi" ? html`<spectric-input variant="checkbox" @change=${this._handleSelectAllChange} .helperText=${"Select All"}></spectric-input>` : null,
228
- render: (row) => {
229
- let container = document.createElement("div")
230
- let checked = this.selected.includes(row)
231
- let template = html`<spectric-input variant="checkbox" class="table-checkbox-${this.select}" .helperText=${""} ${spreadProps({ checked })} @change=${(e: DomEvent<HTMLInputElement>) => {
232
- e.stopPropagation()
233
- let index = this.selected.findIndex(value => value === row)
234
- if (e.target.checked && index !== -1) {
235
- return
236
- }
237
- else if (!e.target.checked && index === -1) {
238
- return
239
- }
240
- else if (!e.target.checked && index !== -1) {
241
- this.selected.splice(index, 1)
242
- }
243
- if (e.target.checked) {
244
- if (this.select === "single") {
245
- this.selected = []
246
- }
247
- this.selected.push(row)
248
- }
249
- this.dispatchEvent(new CustomEvent("selected", { detail: [...this.selected] }))
250
- }}></spectric-input>`
251
- render(template, container)
252
- return template
253
- }
254
- })
255
- }
256
- }
257
- }
258
- if (changedProperties.has("select")) {
259
- if (this.select === "single" && this.selected.length > 1) {
260
- this.selected = [this.selected[0]]
261
- this.dispatchEvent(new CustomEvent("selected", { detail: [...this.selected] }))
271
+ };
272
+ private selectColumnConfig: ColumnSettings<T> = {
273
+ [TABLE_CREATED_SELECTION_COLUMN]: true,
274
+ width: 39,
275
+ title: (table) => {
276
+ return table.select === "multi"
277
+ ? html`<spectric-input
278
+ variant="checkbox"
279
+ @change=${table._handleSelectAllChange}
280
+ .helperText=${"Select All"}
281
+ ></spectric-input>`
282
+ : null;
283
+ },
284
+ render: (row: T, _index, table) => {
285
+ let checked = table.selected.includes(row);
286
+ let template = html`<spectric-input
287
+ variant="checkbox"
288
+ class="table-checkbox-${table.select}"
289
+ .helperText=${""}
290
+ ${spreadProps({ checked })}
291
+ @change=${(e: DomEvent<HTMLInputElement>) => {
292
+ e.stopPropagation();
293
+ let index = table.selected.findIndex((value) => value === row);
294
+ if (e.target.checked && index !== -1) {
295
+ return;
296
+ } else if (!e.target.checked && index === -1) {
297
+ return;
298
+ } else if (!e.target.checked && index !== -1) {
299
+ table.selected.splice(index, 1);
300
+ }
301
+ if (e.target.checked) {
302
+ if (table.select === "single") {
303
+ table.selected = [];
304
+ table.forceRefreshofSelectionColumn();
262
305
  }
306
+ table.selected.push(row);
307
+ }
308
+ table.dispatchEvent(
309
+ new CustomEvent("selected", { detail: [...table.selected] })
310
+ );
311
+ }}
312
+ ></spectric-input>`;
313
+ return template;
314
+ },
315
+ };
316
+ protected update(changedProperties: PropertyValues): void {
317
+ if (changedProperties.has("columns")) {
318
+ if (this.select !== TableSelectOptions.none) {
319
+ if (!this.columns.find((col) => col[TABLE_CREATED_SELECTION_COLUMN])) {
320
+ this.columns.unshift(this.selectColumnConfig);
263
321
  }
264
- super.update(changedProperties)
322
+ }
265
323
  }
266
- protected render(): unknown {
267
- let columns = this.columns.filter(column => !column.hidden)
268
- let rowHeight = this.rowHeight - TD_BorderAndPadding;
269
- if (rowHeight < this.fontSize + TD_BorderAndPadding) {
270
- rowHeight = this.fontSize + TD_BorderAndPadding
271
- }
272
- return html`
273
- <div class="table-wrapper" style="--rowHeight:${rowHeight}px;--fontSize:${this.fontSize}px;--lineClamp:${Math.floor(rowHeight / this.fontSize)}">
274
- <div role="table">
275
- <spectric-table-header .columns=${columns} @sortChange=${this._handleSortChange} @columnResize=${this._handleColumnResize}></spectric-table-header>
276
- <spectric-table-virtual-body .columns=${columns} .data=${this.data} .table=${this} .rowHeight=${rowHeight}></spectric-table-virtual-body>
277
- </div>
278
- </div>
279
- ${this.pagination ? html`<spectric-pagination ${spreadProps(this.pagination)} @change=${this._handlePaginationChange}></spectric-pagination>` : null}
280
- `;
324
+ if (changedProperties.has("select")) {
325
+ if (this.select === "single" && this.selected.length > 1) {
326
+ this.selected = [this.selected[0]];
327
+ this.dispatchEvent(
328
+ new CustomEvent("selected", { detail: [...this.selected] })
329
+ );
330
+ }
331
+ }
332
+ super.update(changedProperties);
333
+ }
334
+ protected render(): unknown {
335
+ let columns = this.columns.filter((column) => !column.hidden);
336
+ let rowHeight = this.rowHeight - TD_BorderAndPadding;
337
+ if (rowHeight < this.fontSize + TD_BorderAndPadding) {
338
+ rowHeight = this.fontSize + TD_BorderAndPadding;
281
339
  }
340
+ return html`
341
+ <div
342
+ class="table-wrapper"
343
+ style="--rowHeight:${rowHeight}px;--fontSize:${this
344
+ .fontSize}px;--lineClamp:${Math.floor(rowHeight / this.fontSize)}"
345
+ >
346
+ <div role="table">
347
+ <spectric-table-header
348
+ .columns=${columns}
349
+ .table=${this}
350
+ @sortChange=${this._handleSortChange}
351
+ @columnResize=${this._handleColumnResize}
352
+ ></spectric-table-header>
353
+ <spectric-table-virtual-body
354
+ .columns=${columns}
355
+ .data=${this.data}
356
+ .table=${this}
357
+ .rowHeight=${rowHeight}
358
+ ></spectric-table-virtual-body>
359
+ </div>
360
+ </div>
361
+ ${this.pagination
362
+ ? html`<spectric-pagination
363
+ ${spreadProps(this.pagination)}
364
+ @change=${this._handlePaginationChange}
365
+ ></spectric-pagination>`
366
+ : null}
367
+ `;
368
+ }
282
369
  }
283
370
 
284
371
  interface TableEvents {
285
- 'change': (event: CustomEvent<TableDataOptions<any>>) => void;
286
- 'paginationChange': (event: CustomEvent<PaginationChangeProps>) => void;
287
- 'filter': (event: CustomEvent<FilterEvent<any>>) => void;
288
- 'sortChange': (event: CustomEvent<ColumnSettings<any>>) => void;
289
- 'selected': (event: CustomEvent<any[]>) => void;
372
+ change: (event: CustomEvent<TableDataOptions<any>>) => void;
373
+ paginationChange: (event: CustomEvent<PaginationChangeProps>) => void;
374
+ filter: (event: CustomEvent<FilterEvent<any>>) => void;
375
+ sortChange: (event: CustomEvent<ColumnSettings<any>>) => void;
376
+ selected: (event: CustomEvent<any[]>) => void;
290
377
  }
291
378
 
292
379
  declare global {
293
- interface HTMLElementTagNameMap {
294
- [TableElementTag]: HTMLElementTagWithEvents<SpectricTableElement<any>, TableEvents>
295
-
380
+ interface HTMLElementTagNameMap {
381
+ [TableElementTag]: HTMLElementTagWithEvents<
382
+ SpectricTableElement<any>,
383
+ TableEvents
384
+ >;
385
+ }
386
+ namespace JSX {
387
+ interface IntrinsicElements {
388
+ /**
389
+ * @see {@link TableElement}
390
+ */
391
+ [TableElementTag]: ReactElementWithPropsAndEvents<
392
+ SpectricTableElement<any>,
393
+ TableProps<any>,
394
+ TableEvents
395
+ >;
296
396
  }
397
+ }
398
+ namespace React {
297
399
  namespace JSX {
298
- interface IntrinsicElements {
299
- /**
300
- * @see {@link TableElement}
301
- */
302
- [TableElementTag]: ReactElementWithPropsAndEvents<SpectricTableElement<any>, TableProps<any>, TableEvents>;
303
- }
304
- }
305
- namespace React {
306
- namespace JSX {
307
- interface IntrinsicElements {
308
- /**
309
- * @see {@link TableElement}
310
- */
311
- [TableElementTag]: ReactElementWithPropsAndEvents<SpectricTableElement<any>, TableProps<any>, TableEvents>
312
- }
313
- }
400
+ interface IntrinsicElements {
401
+ /**
402
+ * @see {@link TableElement}
403
+ */
404
+ [TableElementTag]: ReactElementWithPropsAndEvents<
405
+ SpectricTableElement<any>,
406
+ TableProps<any>,
407
+ TableEvents
408
+ >;
409
+ }
314
410
  }
411
+ }
315
412
  }