@inglorious/web 4.4.0 → 4.5.1
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/README.md +22 -221
- package/package.json +5 -28
- package/src/form/handlers.js +332 -0
- package/src/form/helpers.js +32 -0
- package/src/form/index.js +4 -373
- package/src/index.js +1 -0
- package/src/router/handlers.js +345 -0
- package/src/router/helpers.js +46 -0
- package/src/router/index.js +5 -384
- package/src/test.js +1 -1
- package/types/index.d.ts +0 -3
- package/src/list/index.js +0 -7
- package/src/list/logic.js +0 -75
- package/src/list/rendering.js +0 -105
- package/src/select/base.css +0 -52
- package/src/select/index.js +0 -7
- package/src/select/logic.js +0 -332
- package/src/select/rendering.js +0 -352
- package/src/select/theme.css +0 -133
- package/src/table/base.css +0 -34
- package/src/table/filters/date.js +0 -42
- package/src/table/filters/number.js +0 -22
- package/src/table/filters/range.js +0 -40
- package/src/table/filters/select.js +0 -34
- package/src/table/filters/text.js +0 -22
- package/src/table/filters.js +0 -24
- package/src/table/index.js +0 -7
- package/src/table/logic.js +0 -573
- package/src/table/rendering.js +0 -340
- package/src/table/theme.css +0 -83
- package/types/list.d.ts +0 -91
- package/types/select.d.ts +0 -136
- package/types/table.d.ts +0 -248
package/types/table.d.ts
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import type { TemplateResult } from "lit-html"
|
|
2
|
-
import type { Api } from "./mount"
|
|
3
|
-
import type { SelectOption } from "./select"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents a single row of data in the table.
|
|
7
|
-
*/
|
|
8
|
-
export type TableRow = Record<string, any>
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents a column definition for the table.
|
|
12
|
-
*/
|
|
13
|
-
export interface TableColumn {
|
|
14
|
-
/** The unique identifier for the column (usually matches a property in the data). */
|
|
15
|
-
id: string
|
|
16
|
-
/** The display label for the column header. */
|
|
17
|
-
title: string
|
|
18
|
-
/** The type of data in the column. */
|
|
19
|
-
type?: "string" | "number" | "boolean" | "date"
|
|
20
|
-
/** Whether the column is sortable. */
|
|
21
|
-
isSortable?: boolean
|
|
22
|
-
/** Whether the column is filterable. */
|
|
23
|
-
isFilterable?: boolean
|
|
24
|
-
/** Filter configuration. */
|
|
25
|
-
filter?: {
|
|
26
|
-
type: "text" | "number" | "range" | "select" | "date" | "time" | "datetime"
|
|
27
|
-
options?: SelectOption[]
|
|
28
|
-
[key: string]: any
|
|
29
|
-
}
|
|
30
|
-
/** The width of the column, in pixels or as a string (e.g., '10%'). */
|
|
31
|
-
width?: number | string
|
|
32
|
-
/** Optional formatter key or function. */
|
|
33
|
-
formatter?: string | ((value: any) => any)
|
|
34
|
-
/** Custom sort function for a column, operating on two rows. */
|
|
35
|
-
sortFn?: (a: TableRow, b: TableRow) => number
|
|
36
|
-
/** Custom filter function for a column, operating on a single row. */
|
|
37
|
-
filterFn?: (row: TableRow, filterValue: any) => boolean
|
|
38
|
-
/** Custom format function. */
|
|
39
|
-
format?: (value: any) => string
|
|
40
|
-
/** Any other custom properties. */
|
|
41
|
-
[key: string]: any
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Represents the state of a table entity.
|
|
46
|
-
*/
|
|
47
|
-
export interface TableEntity<T extends TableRow = TableRow> {
|
|
48
|
-
/** A unique identifier for the table entity. */
|
|
49
|
-
id: string | number
|
|
50
|
-
/** The entity type. */
|
|
51
|
-
type: string
|
|
52
|
-
/** The data array to display. */
|
|
53
|
-
data: T[]
|
|
54
|
-
/** The column definitions. */
|
|
55
|
-
columns: TableColumn[]
|
|
56
|
-
/** Sorting state. */
|
|
57
|
-
sorts: { column: string; direction: "asc" | "desc" }[]
|
|
58
|
-
/** Filtering state. */
|
|
59
|
-
filters: Record<string, any>
|
|
60
|
-
/** Search state. */
|
|
61
|
-
search: { value: string; placeholder?: string } | null
|
|
62
|
-
/** Selected row IDs. */
|
|
63
|
-
selection: (string | number)[]
|
|
64
|
-
/** Pagination state. */
|
|
65
|
-
pagination: { page: number; pageSize: number } | null
|
|
66
|
-
/** The property on a row object that uniquely identifies it. Defaults to 'id'. */
|
|
67
|
-
rowId?: string
|
|
68
|
-
/** Whether multi-select is enabled. */
|
|
69
|
-
isMultiSelect: boolean
|
|
70
|
-
/** Any other custom properties. */
|
|
71
|
-
[key: string]: any
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The table type implementation.
|
|
76
|
-
*/
|
|
77
|
-
export declare const table: {
|
|
78
|
-
/**
|
|
79
|
-
* Initializes the table entity with default state.
|
|
80
|
-
* @param entity The table entity.
|
|
81
|
-
*/
|
|
82
|
-
create(entity: TableEntity): void
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Toggles sorting for a specific column.
|
|
86
|
-
* @param entity The table entity.
|
|
87
|
-
* @param columnId The ID of the column to sort by.
|
|
88
|
-
*/
|
|
89
|
-
sortChange(entity: TableEntity, columnId: string): void
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Clears all active sorts.
|
|
93
|
-
* @param entity The table entity.
|
|
94
|
-
*/
|
|
95
|
-
sortsClear(entity: TableEntity): void
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Updates the filter value for a specific column.
|
|
99
|
-
* @param entity The table entity.
|
|
100
|
-
* @param payload The filter change payload containing columnId and value.
|
|
101
|
-
*/
|
|
102
|
-
filterChange(
|
|
103
|
-
entity: TableEntity,
|
|
104
|
-
payload: { columnId: string; value: any },
|
|
105
|
-
): void
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Clears all active filters.
|
|
109
|
-
* @param entity The table entity.
|
|
110
|
-
*/
|
|
111
|
-
filtersClear(entity: TableEntity): void
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Updates the global search term.
|
|
115
|
-
* @param entity The table entity.
|
|
116
|
-
* @param search The new search string.
|
|
117
|
-
*/
|
|
118
|
-
searchChange(entity: TableEntity, search: string): void
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Changes the current page index.
|
|
122
|
-
* @param entity The table entity.
|
|
123
|
-
* @param page The new page index (0-based).
|
|
124
|
-
*/
|
|
125
|
-
pageChange(entity: TableEntity, page: number): void
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Moves to the next page.
|
|
129
|
-
* @param entity The table entity.
|
|
130
|
-
*/
|
|
131
|
-
pageNext(entity: TableEntity): void
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Moves to the previous page.
|
|
135
|
-
* @param entity The table entity.
|
|
136
|
-
*/
|
|
137
|
-
pagePrev(entity: TableEntity): void
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Changes the page size (number of items per page).
|
|
141
|
-
* @param entity The table entity.
|
|
142
|
-
* @param pageSize The new page size.
|
|
143
|
-
*/
|
|
144
|
-
pageSizeChange(entity: TableEntity, pageSize: number): void
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Selects a specific row.
|
|
148
|
-
* @param entity The table entity.
|
|
149
|
-
* @param rowId The ID of the row to select.
|
|
150
|
-
*/
|
|
151
|
-
rowSelect(entity: TableEntity, rowId: string | number): void
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Deselects a specific row.
|
|
155
|
-
* @param entity The table entity.
|
|
156
|
-
* @param rowId The ID of the row to deselect.
|
|
157
|
-
*/
|
|
158
|
-
rowDeselect(entity: TableEntity, rowId: string | number): void
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Toggles selection for a specific row.
|
|
162
|
-
* @param entity The table entity.
|
|
163
|
-
* @param rowId The ID of the row to toggle.
|
|
164
|
-
*/
|
|
165
|
-
rowToggle(entity: TableEntity, rowId: string | number): void
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Toggles selection for all currently visible rows.
|
|
169
|
-
* @param entity The table entity.
|
|
170
|
-
*/
|
|
171
|
-
rowsToggleAll(entity: TableEntity): void
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Selects all currently visible rows.
|
|
175
|
-
* @param entity The table entity.
|
|
176
|
-
*/
|
|
177
|
-
rowsSelectAll(entity: TableEntity): void
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Clears the current row selection.
|
|
181
|
-
* @param entity The table entity.
|
|
182
|
-
*/
|
|
183
|
-
selectionClear(entity: TableEntity): void
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Renders the table component.
|
|
187
|
-
* @param entity The table entity.
|
|
188
|
-
* @param api The store API.
|
|
189
|
-
*/
|
|
190
|
-
render(entity: TableEntity, api: Api): TemplateResult
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Renders the table header.
|
|
194
|
-
* @param entity The table entity.
|
|
195
|
-
* @param api The store API.
|
|
196
|
-
*/
|
|
197
|
-
renderHeader(entity: TableEntity, api: Api): TemplateResult
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Renders the table body.
|
|
201
|
-
* @param entity The table entity.
|
|
202
|
-
* @param api The store API.
|
|
203
|
-
*/
|
|
204
|
-
renderBody(entity: TableEntity, api: Api): TemplateResult
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Renders a single row.
|
|
208
|
-
* @param entity The table entity.
|
|
209
|
-
* @param payload The payload for rendering the row.
|
|
210
|
-
* @param payload.row The data item for the row.
|
|
211
|
-
* @param payload.index The index of the row.
|
|
212
|
-
* @param api The store API.
|
|
213
|
-
*/
|
|
214
|
-
renderRow(
|
|
215
|
-
entity: TableEntity,
|
|
216
|
-
payload: { row: TableRow; index: number },
|
|
217
|
-
api: Api,
|
|
218
|
-
): TemplateResult
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Renders a single cell.
|
|
222
|
-
* @param entity The table entity.
|
|
223
|
-
* @param payload The payload for rendering the cell.
|
|
224
|
-
* @param payload.cell The data for the cell.
|
|
225
|
-
* @param payload.index The column index of the cell.
|
|
226
|
-
* @param api The store API.
|
|
227
|
-
*/
|
|
228
|
-
renderCell(
|
|
229
|
-
entity: TableEntity,
|
|
230
|
-
payload: { cell: any; index: number },
|
|
231
|
-
api: Api,
|
|
232
|
-
): TemplateResult
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Renders the value of a cell.
|
|
236
|
-
* @param entity The table entity.
|
|
237
|
-
* @param payload The payload for rendering the value.
|
|
238
|
-
* @param payload.value The raw value from the data item.
|
|
239
|
-
* @param payload.column The column definition.
|
|
240
|
-
* @param payload.index The column index.
|
|
241
|
-
* @param api The store API.
|
|
242
|
-
*/
|
|
243
|
-
renderValue(
|
|
244
|
-
entity: TableEntity,
|
|
245
|
-
payload: { value: any; column: TableColumn; index: number },
|
|
246
|
-
api: Api,
|
|
247
|
-
): any
|
|
248
|
-
}
|