@inglorious/web 4.5.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/package.json +4 -6
- package/types/select.d.ts +0 -136
- package/types/table.d.ts +0 -248
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/web",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "A new web framework that leverages the power of the Inglorious Store combined with the performance and simplicity of lit-html.",
|
|
5
5
|
"author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,14 +47,12 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"sideEffects":
|
|
51
|
-
"**/*.css"
|
|
52
|
-
],
|
|
50
|
+
"sideEffects": false,
|
|
53
51
|
"dependencies": {
|
|
54
52
|
"@lit-labs/ssr-client": "^1.1.8",
|
|
55
53
|
"lit-html": "^3.3.1",
|
|
56
|
-
"@inglorious/
|
|
57
|
-
"@inglorious/
|
|
54
|
+
"@inglorious/store": "9.6.0",
|
|
55
|
+
"@inglorious/utils": "3.7.3"
|
|
58
56
|
},
|
|
59
57
|
"devDependencies": {
|
|
60
58
|
"prettier": "^3.6.2",
|
package/types/select.d.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type { TemplateResult } from "lit-html"
|
|
2
|
-
import type { Api } from "./mount"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents an option in the select component.
|
|
6
|
-
* Can be a simple string/number or an object with value and label.
|
|
7
|
-
*/
|
|
8
|
-
export type SelectOption =
|
|
9
|
-
| string
|
|
10
|
-
| number
|
|
11
|
-
| {
|
|
12
|
-
value: string | number
|
|
13
|
-
label?: string
|
|
14
|
-
disabled?: boolean
|
|
15
|
-
[key: string]: any
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents the state of a select entity.
|
|
20
|
-
*/
|
|
21
|
-
export interface SelectEntity {
|
|
22
|
-
/** A unique identifier for the select entity. */
|
|
23
|
-
id: string | number
|
|
24
|
-
/** The entity type (usually 'select'). */
|
|
25
|
-
type: string
|
|
26
|
-
/** The list of options available for selection. */
|
|
27
|
-
options: SelectOption[]
|
|
28
|
-
/** Whether the dropdown is currently open. */
|
|
29
|
-
isOpen: boolean
|
|
30
|
-
/** The current search term entered by the user. */
|
|
31
|
-
searchTerm: string
|
|
32
|
-
/** The index of the currently focused option (for keyboard navigation). */
|
|
33
|
-
focusedIndex: number
|
|
34
|
-
/** Whether multiple options can be selected. */
|
|
35
|
-
isMulti: boolean
|
|
36
|
-
/** The currently selected value(s). */
|
|
37
|
-
selectedValue: string | number | (string | number)[] | null
|
|
38
|
-
/** Whether the options are currently loading. */
|
|
39
|
-
isLoading: boolean
|
|
40
|
-
/** Whether the select component is disabled. */
|
|
41
|
-
isDisabled: boolean
|
|
42
|
-
/** Whether the user can search through options. */
|
|
43
|
-
isSearchable: boolean
|
|
44
|
-
/** Whether the selection can be cleared. */
|
|
45
|
-
isClearable: boolean
|
|
46
|
-
/** Whether new options can be created by the user. */
|
|
47
|
-
isCreatable: boolean
|
|
48
|
-
/** Placeholder text to display when no value is selected. */
|
|
49
|
-
placeholder: string
|
|
50
|
-
/** Message to display when no options match the search term. */
|
|
51
|
-
noOptionsMessage: string
|
|
52
|
-
/** Message to display while options are loading. */
|
|
53
|
-
loadingMessage: string
|
|
54
|
-
/** Property name to group options by. */
|
|
55
|
-
groupBy: string | null
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The select type implementation.
|
|
60
|
-
*/
|
|
61
|
-
export declare const select: {
|
|
62
|
-
/**
|
|
63
|
-
* Initializes the select entity with default state.
|
|
64
|
-
* @param {SelectEntity} entity
|
|
65
|
-
*/
|
|
66
|
-
create(entity: SelectEntity): void
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Renders the select component.
|
|
70
|
-
* @param entity The select entity.
|
|
71
|
-
* @param api The store API.
|
|
72
|
-
*/
|
|
73
|
-
render(entity: SelectEntity, api: Api): TemplateResult
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Opens the select dropdown.
|
|
77
|
-
* @param entity The select entity.
|
|
78
|
-
*/
|
|
79
|
-
open(entity: SelectEntity): void
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Closes the select dropdown.
|
|
83
|
-
* @param entity The select entity.
|
|
84
|
-
*/
|
|
85
|
-
close(entity: SelectEntity): void
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Toggles the select dropdown open/closed state.
|
|
89
|
-
* @param entity The select entity.
|
|
90
|
-
*/
|
|
91
|
-
toggle(entity: SelectEntity): void
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Selects an option.
|
|
95
|
-
* @param entity The select entity.
|
|
96
|
-
* @param option The option to select.
|
|
97
|
-
*/
|
|
98
|
-
optionSelect(entity: SelectEntity, option: SelectOption): void
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Clears the current selection.
|
|
102
|
-
* @param entity The select entity.
|
|
103
|
-
*/
|
|
104
|
-
clear(entity: SelectEntity): void
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Updates the search term and filters options.
|
|
108
|
-
* @param entity The select entity.
|
|
109
|
-
* @param term The new search term.
|
|
110
|
-
*/
|
|
111
|
-
searchChange(entity: SelectEntity, term: string): void
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Moves focus to the next option.
|
|
115
|
-
* @param entity The select entity.
|
|
116
|
-
*/
|
|
117
|
-
focusNext(entity: SelectEntity): void
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Moves focus to the previous option.
|
|
121
|
-
* @param entity The select entity.
|
|
122
|
-
*/
|
|
123
|
-
focusPrev(entity: SelectEntity): void
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Moves focus to the first option.
|
|
127
|
-
* @param entity The select entity.
|
|
128
|
-
*/
|
|
129
|
-
focusFirst(entity: SelectEntity): void
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Moves focus to the last option.
|
|
133
|
-
* @param entity The select entity.
|
|
134
|
-
*/
|
|
135
|
-
focusLast(entity: SelectEntity): void
|
|
136
|
-
}
|
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
|
-
}
|