@sebgroup/green-core 3.8.1 → 3.10.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.
- package/components/card/card.styles.js +1 -0
- package/components/card-linked/card-linked.styles.js +1 -1
- package/components/table/table.component.d.ts +27 -7
- package/components/table/table.component.js +730 -101
- package/components/table/table.imports.js +8 -0
- package/components/table/table.stories.data.d.ts +8 -5
- package/components/table/table.stories.data.js +705 -31
- package/components/table/table.styles.js +409 -189
- package/components/table/table.types.d.ts +97 -11
- package/custom-elements.json +4838 -4724
- package/gds-element.js +1 -1
- package/generated/locales/da.d.ts +4 -1
- package/generated/locales/da.js +4 -1
- package/generated/locales/de.d.ts +4 -1
- package/generated/locales/de.js +4 -1
- package/generated/locales/fi.d.ts +4 -1
- package/generated/locales/fi.js +4 -1
- package/generated/locales/fr.d.ts +4 -1
- package/generated/locales/fr.js +4 -1
- package/generated/locales/it.d.ts +4 -1
- package/generated/locales/it.js +4 -1
- package/generated/locales/nl.d.ts +4 -1
- package/generated/locales/nl.js +4 -1
- package/generated/locales/no.d.ts +4 -1
- package/generated/locales/no.js +4 -1
- package/generated/locales/sv.d.ts +4 -1
- package/generated/locales/sv.js +4 -1
- package/generated/mcp/card-pattern-01/api.md +2 -1
- package/generated/mcp/components.json +1 -1
- package/generated/mcp/icons.json +1 -1
- package/generated/mcp/index.json +1 -1
- package/generated/mcp/table/angular.md +1 -0
- package/generated/mcp/table/api.md +32 -2
- package/generated/mcp/table/react.md +1 -0
- package/generated/mcp/tokens.json +1 -1
- package/generated/react/index.d.ts +9 -9
- package/generated/react/index.js +9 -9
- package/generated/react/table/index.d.ts +10 -4
- package/package.json +1 -1
- package/patterns/card-pattern-01/card-pattern-01.component.d.ts +2 -1
- package/patterns/card-pattern-01/card-pattern-01.component.js +49 -25
- package/shared-styles/rbcb-toggle.style.js +1 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -3,47 +3,121 @@
|
|
|
3
3
|
* TABLE TYPES
|
|
4
4
|
* ============================================================================
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Column definition describing how a row field is rendered and behaves.
|
|
8
|
+
*/
|
|
6
9
|
export interface Column {
|
|
10
|
+
/** Property key in the row object and the basis for generated slot names. */
|
|
7
11
|
key: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional raw value extractor used for display, sorting, and search when a
|
|
14
|
+
* simple row[key] lookup is not sufficient.
|
|
15
|
+
*/
|
|
8
16
|
value?: (row: any) => string;
|
|
17
|
+
/** Text shown in the column header. */
|
|
9
18
|
label: string;
|
|
19
|
+
/** Enables click-to-sort for the column header. */
|
|
10
20
|
sortable?: boolean;
|
|
21
|
+
/** Vertical alignment for cell content. */
|
|
11
22
|
align?: 'start' | 'center' | 'stretch' | 'end';
|
|
23
|
+
/** Horizontal justification for cell content. */
|
|
12
24
|
justify?: 'start' | 'center' | 'space-between' | 'end';
|
|
25
|
+
/** Controls whether the column is shown in the table and settings UI. */
|
|
13
26
|
visible?: boolean;
|
|
27
|
+
/** Fixed CSS width for the column. */
|
|
14
28
|
width?: string;
|
|
29
|
+
/** Keeps the column pinned to the left or right while horizontally scrolling. */
|
|
30
|
+
sticky?: 'left' | 'right';
|
|
15
31
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
width?: string;
|
|
21
|
-
sticky?: boolean;
|
|
22
|
-
}
|
|
32
|
+
/**
|
|
33
|
+
* Footer row configuration for aggregated or summary content rendered through
|
|
34
|
+
* `tfoot:columnKey` slots.
|
|
35
|
+
*/
|
|
23
36
|
export interface Tfoot {
|
|
37
|
+
/** Optional first-cell label rendered as a row header for accessibility. */
|
|
24
38
|
label?: string;
|
|
39
|
+
/** Pins the footer row to the bottom of the scroll area. */
|
|
25
40
|
sticky?: boolean;
|
|
26
41
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Built-in expandable metadata available on each row.
|
|
44
|
+
*/
|
|
45
|
+
export type RowMeta<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
46
|
+
/** Marks whether this row should render an expand toggle. */
|
|
47
|
+
isExpandable?: boolean;
|
|
48
|
+
/** Optional per-row label for collapsed state toggle action. */
|
|
49
|
+
expandLabel?: string;
|
|
50
|
+
/** Optional per-row label for expanded state toggle action. */
|
|
51
|
+
collapseLabel?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Async readiness signal for slotted full-width expanded content.
|
|
54
|
+
* Called when the row is expanded. The table shows a loading skeleton
|
|
55
|
+
* until the returned promise resolves, then reveals the
|
|
56
|
+
* `expand:ROW_KEY:full` slot. Consumers can resolve immediately or
|
|
57
|
+
* after fetching dynamic data into the slot.
|
|
58
|
+
*/
|
|
59
|
+
fullContent?: () => Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Optional expected number of sub rows, used to size loading placeholders
|
|
62
|
+
* while async sub rows are being resolved.
|
|
63
|
+
*/
|
|
64
|
+
subRowCount?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Async sub row provider called when the parent row is expanded.
|
|
67
|
+
* The table shows skeleton placeholder rows (sized by `subRowCount`)
|
|
68
|
+
* until the returned promise resolves, then renders the child rows
|
|
69
|
+
* using the same column structure. Consumers can resolve immediately
|
|
70
|
+
* with pre-fetched data or after a dynamic fetch.
|
|
71
|
+
*/
|
|
72
|
+
subRows?: () => Promise<Row<T>[]>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Generic table row shape. Consumers extend this with application-specific
|
|
76
|
+
* fields while keeping built-in row metadata strongly typed.
|
|
77
|
+
*/
|
|
78
|
+
export type Row<T extends Record<string, unknown> = Record<string, unknown>> = Omit<T, keyof RowMeta<T>> & RowMeta<T>;
|
|
79
|
+
/**
|
|
80
|
+
* Internal table state used to drive paging, sorting, searching, and column
|
|
81
|
+
* visibility.
|
|
82
|
+
*/
|
|
30
83
|
export interface State {
|
|
84
|
+
/** Current page number, using 1-based indexing. */
|
|
31
85
|
page: number;
|
|
86
|
+
/** Number of rows requested per page. */
|
|
32
87
|
rows: number;
|
|
88
|
+
/** Column key currently used for sorting. */
|
|
33
89
|
sortColumn?: string;
|
|
90
|
+
/** Active sort direction for the current sort column. */
|
|
34
91
|
sortDirection?: 'asc' | 'desc';
|
|
92
|
+
/** Current search term applied to the dataset. */
|
|
35
93
|
searchQuery: string;
|
|
94
|
+
/** Set of column keys currently visible in the table. */
|
|
36
95
|
visibleColumns: Set<string>;
|
|
37
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Request object sent from the table to the data provider for fetching the
|
|
99
|
+
* current page of rows.
|
|
100
|
+
*/
|
|
38
101
|
export interface Request {
|
|
102
|
+
/** Current page number, using 1-based indexing. */
|
|
39
103
|
page: number;
|
|
104
|
+
/** Number of rows requested per page. */
|
|
40
105
|
rows: number;
|
|
106
|
+
/** Column key to sort by. */
|
|
41
107
|
sortColumn?: string;
|
|
108
|
+
/** Requested sort direction. */
|
|
42
109
|
sortDirection?: 'asc' | 'desc';
|
|
110
|
+
/** Optional search term to filter the dataset. */
|
|
43
111
|
searchQuery?: string;
|
|
44
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Data provider response containing the current page rows and the total number
|
|
115
|
+
* of matching rows for pagination.
|
|
116
|
+
*/
|
|
45
117
|
export interface Response<T> {
|
|
118
|
+
/** Rows to render for the current page. */
|
|
46
119
|
rows: T[];
|
|
120
|
+
/** Total number of matching rows across all pages. */
|
|
47
121
|
total: number;
|
|
48
122
|
}
|
|
49
123
|
/**
|
|
@@ -65,25 +139,37 @@ export declare const DENSITY_CONFIG: {
|
|
|
65
139
|
readonly dropdown: "medium";
|
|
66
140
|
};
|
|
67
141
|
};
|
|
142
|
+
/** Density options for the table's built-in controls. */
|
|
68
143
|
export type Density = 'comfortable' | 'compact' | 'spacious';
|
|
144
|
+
/** Cached data provider result keyed by page, rows, sort, and search state. */
|
|
69
145
|
export interface CacheEntry<T> {
|
|
146
|
+
/** Cached rows for the request key. */
|
|
70
147
|
rows: T[];
|
|
148
|
+
/** Cached total matching row count. */
|
|
71
149
|
total: number;
|
|
150
|
+
/** Timestamp in milliseconds used to expire stale cache entries. */
|
|
72
151
|
timestamp: number;
|
|
73
152
|
}
|
|
153
|
+
/** Map of cache keys to cached table responses. */
|
|
74
154
|
export interface Cache<T> {
|
|
75
155
|
[key: string]: CacheEntry<T>;
|
|
76
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Slot-enabled cell value used to compose rich cell content while preserving a
|
|
159
|
+
* fallback value for sorting, searching, and string coercion.
|
|
160
|
+
*/
|
|
77
161
|
export type SlotValue = {
|
|
162
|
+
/** Fallback plain value used for display, search, and sort comparisons. */
|
|
78
163
|
value?: unknown;
|
|
164
|
+
/** Ordered slot ids that define the cell layout. Use `value` for inline text. */
|
|
79
165
|
slots: string[];
|
|
166
|
+
/** Optional row key override used when generating slot names. */
|
|
80
167
|
key?: string | number;
|
|
81
168
|
};
|
|
82
169
|
export declare const isSlotValue: (value: unknown) => value is SlotValue;
|
|
83
170
|
export declare function Slot(config: SlotValue): SlotValue;
|
|
84
171
|
export declare function Slot(value?: unknown, slots?: string[], key?: string | number): SlotValue;
|
|
85
172
|
export declare function Slot(value?: unknown, key?: string | number, slots?: string[]): SlotValue;
|
|
86
|
-
export type TableActions = Actions;
|
|
87
173
|
export type TableColumn = Column;
|
|
88
174
|
export type TableRow = Row;
|
|
89
175
|
export type TableState = State;
|