@mintplayer/web-components 1.1.0 → 1.3.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/accordion/src/styles/accordion.styles.d.ts +2 -0
- package/card/index.mjs +246 -363
- package/card/src/card-classes.d.ts +0 -7
- package/card/src/card-global.styles.d.ts +2 -0
- package/card/src/index.d.ts +0 -9
- package/card/src/mp-card.element.d.ts +45 -18
- package/chunks/mp-datatable-Con0yQue.mjs +1125 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +105 -1
- package/datatable/src/index.d.ts +1 -1
- package/datatable/src/types/column-def.d.ts +12 -1
- package/datatable/src/types/index.d.ts +2 -1
- package/datatable/src/types/tree.d.ts +42 -0
- package/file-manager/index.mjs +1 -1
- package/package.json +1 -1
- package/timeline/index.mjs +716 -0
- package/timeline/src/components/index.d.ts +2 -0
- package/timeline/src/components/mp-timeline-item.d.ts +63 -0
- package/timeline/src/components/mp-timeline.d.ts +85 -0
- package/timeline/src/index.d.ts +5 -0
- package/timeline/src/styles/index.d.ts +2 -0
- package/timeline/src/styles/timeline-item.styles.d.ts +2 -0
- package/timeline/src/styles/timeline.styles.d.ts +2 -0
- package/timeline-core/index.mjs +23 -0
- package/timeline-core/src/index.d.ts +2 -0
- package/timeline-core/src/models/context.d.ts +39 -0
- package/timeline-core/src/models/index.d.ts +2 -0
- package/timeline-core/src/models/timeline-item.d.ts +44 -0
- package/timeline-core/src/resolve-sides.d.ts +12 -0
- package/card/src/mp-card-body.element.d.ts +0 -12
- package/card/src/mp-card-footer.element.d.ts +0 -14
- package/card/src/mp-card-group.element.d.ts +0 -9
- package/card/src/mp-card-header.element.d.ts +0 -24
- package/card/src/mp-card-img.element.d.ts +0 -28
- package/card/src/mp-card-link.element.d.ts +0 -24
- package/card/src/mp-card-subtitle.element.d.ts +0 -9
- package/card/src/mp-card-text.element.d.ts +0 -9
- package/card/src/mp-card-title.element.d.ts +0 -13
- package/chunks/mp-datatable-CpAu8JJD.mjs +0 -750
package/datatable/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import { SortColumn } from '../sort';
|
|
3
|
-
import { DatatableColumnDef, RowKey, RowRenderer } from '../types';
|
|
3
|
+
import { DatatableColumnDef, RowKey, RowRenderer, TreeFetchResponse, TreeIdKey, TreeSelectionStrategy } from '../types';
|
|
4
4
|
export type DatatableSelectionMode = 'none' | 'single' | 'multiple';
|
|
5
5
|
export interface RowEventDetail<T = unknown> {
|
|
6
6
|
row: T;
|
|
@@ -40,6 +40,8 @@ export declare class MpDatatable extends LitElement {
|
|
|
40
40
|
private _focusedRowKey;
|
|
41
41
|
private _rowKey;
|
|
42
42
|
private _columnWidths;
|
|
43
|
+
/** Becomes `true` after the first measure-once pass locks column widths. Drives the `.measured` class on the table (→ `table-layout: fixed`). */
|
|
44
|
+
private _hasMeasuredInitial;
|
|
43
45
|
private _loading;
|
|
44
46
|
private _emptyMessage;
|
|
45
47
|
private _pagination;
|
|
@@ -58,6 +60,22 @@ export declare class MpDatatable extends LitElement {
|
|
|
58
60
|
private _resizeObserver;
|
|
59
61
|
private _scrollListener;
|
|
60
62
|
private _viewportHeight;
|
|
63
|
+
private _tree;
|
|
64
|
+
private _idKey;
|
|
65
|
+
private _childCountKey;
|
|
66
|
+
private _treeIndent;
|
|
67
|
+
private _expandedIds;
|
|
68
|
+
private _selectionStrategy;
|
|
69
|
+
/** Children fetched per parentId (only first page for v1). */
|
|
70
|
+
private _childCache;
|
|
71
|
+
/** Server-reported totalRecords per parentId; missing = use childCountKey on the row. */
|
|
72
|
+
private _childTotals;
|
|
73
|
+
/** Parents with an in-flight fetch; suppresses re-requests. */
|
|
74
|
+
private _pendingFetches;
|
|
75
|
+
/** Per-render memo of `getFlatList()`. Invalidated in `willUpdate`. */
|
|
76
|
+
private _cachedFlatList;
|
|
77
|
+
/** Per-render memo of the set of row keys whose loaded subtree is partially selected. */
|
|
78
|
+
private _cachedIndeterminateKeys;
|
|
61
79
|
/** When true, the WC sorts `data` itself using `sortRows`. Set `false` if the consumer sorts externally. */
|
|
62
80
|
get autoSort(): boolean;
|
|
63
81
|
set autoSort(value: boolean);
|
|
@@ -93,6 +111,31 @@ export declare class MpDatatable extends LitElement {
|
|
|
93
111
|
set focusedRowKey(value: string | null);
|
|
94
112
|
get rowKey(): RowKey;
|
|
95
113
|
set rowKey(value: RowKey);
|
|
114
|
+
/** Enable tree mode (chevron column, nested expansion, lazy children). */
|
|
115
|
+
get tree(): boolean;
|
|
116
|
+
set tree(value: boolean);
|
|
117
|
+
/**
|
|
118
|
+
* Property name or function that extracts the stable row identity used as
|
|
119
|
+
* the expansion key and as `parentId` in `mp-datatable-fetch-request`.
|
|
120
|
+
* Required when `tree=true`.
|
|
121
|
+
*/
|
|
122
|
+
get idKey(): TreeIdKey | null;
|
|
123
|
+
set idKey(value: TreeIdKey | null);
|
|
124
|
+
/**
|
|
125
|
+
* Property name on the row that holds the direct-child count. Drives both
|
|
126
|
+
* chevron visibility AND placeholder reservation. Required when `tree=true`.
|
|
127
|
+
*/
|
|
128
|
+
get childCountKey(): string | null;
|
|
129
|
+
set childCountKey(value: string | null);
|
|
130
|
+
/** Indent in rem per depth level on the chevron cell. Default `1.25`. */
|
|
131
|
+
get treeIndent(): number;
|
|
132
|
+
set treeIndent(value: number);
|
|
133
|
+
/** Two-way binding target: set of expanded-row id values (per `idKey`). */
|
|
134
|
+
get expandedIds(): Set<unknown>;
|
|
135
|
+
set expandedIds(value: Set<unknown> | ReadonlyArray<unknown> | null | undefined);
|
|
136
|
+
/** `'flat'` (default) or `'cascading'`. When `tree=true`, cascading is recommended. */
|
|
137
|
+
get selectionStrategy(): TreeSelectionStrategy;
|
|
138
|
+
set selectionStrategy(value: TreeSelectionStrategy);
|
|
96
139
|
get loading(): boolean;
|
|
97
140
|
set loading(value: boolean);
|
|
98
141
|
get emptyMessage(): string;
|
|
@@ -120,8 +163,26 @@ export declare class MpDatatable extends LitElement {
|
|
|
120
163
|
set resizableColumns(value: boolean);
|
|
121
164
|
connectedCallback(): void;
|
|
122
165
|
protected firstUpdated(): void;
|
|
166
|
+
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
167
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
168
|
+
/**
|
|
169
|
+
* Run the auto-size-once pass after the first batch of rows lands in the
|
|
170
|
+
* DOM. Columns with an explicit `col.width` are pinned to that value
|
|
171
|
+
* without measurement; the rest are measured from their natural
|
|
172
|
+
* (`table-layout: auto`) width via `getBoundingClientRect()` on the
|
|
173
|
+
* `<th>`. Once any column gets a width, `_hasMeasuredInitial` flips and
|
|
174
|
+
* the table renders with `table-layout: fixed` so the widths are
|
|
175
|
+
* authoritative and overflowing content clips with ellipsis.
|
|
176
|
+
*/
|
|
177
|
+
private maybeMeasureInitialColumnWidths;
|
|
178
|
+
private measureColumnWidth;
|
|
123
179
|
disconnectedCallback(): void;
|
|
124
180
|
private refreshVirtualRange;
|
|
181
|
+
/**
|
|
182
|
+
* Walk the visible viewport for placeholder rows whose parent isn't cached
|
|
183
|
+
* and isn't already in-flight. Emit a fetch-request per such parent.
|
|
184
|
+
*/
|
|
185
|
+
private maybeFetchPlaceholdersInViewport;
|
|
125
186
|
render(): TemplateResult;
|
|
126
187
|
private getVirtualSpacerHeights;
|
|
127
188
|
private renderHeader;
|
|
@@ -131,7 +192,50 @@ export declare class MpDatatable extends LitElement {
|
|
|
131
192
|
private renderFooter;
|
|
132
193
|
private setPerPage;
|
|
133
194
|
private getEffectiveData;
|
|
195
|
+
/**
|
|
196
|
+
* Flat list of visible rows including expansion + placeholders. Computed
|
|
197
|
+
* each render in tree mode; flat mode produces a trivial mapping of `_data`
|
|
198
|
+
* (after sort+pagination) with default metadata.
|
|
199
|
+
*
|
|
200
|
+
* Memoised via `_cachedFlatList`, cleared in `willUpdate`. Multiple calls
|
|
201
|
+
* during the same render cycle (`computeVisibleRows`,
|
|
202
|
+
* `getVirtualSpacerHeights`, aria-rowcount) share one computation.
|
|
203
|
+
*/
|
|
204
|
+
private getFlatList;
|
|
134
205
|
private computeVisibleRows;
|
|
206
|
+
private extractId;
|
|
207
|
+
private extractChildCount;
|
|
208
|
+
/** Walks the loaded subtree of `row` and returns the rowKey for every descendant. */
|
|
209
|
+
private collectDescendantKeys;
|
|
210
|
+
/** Some-but-not-all loaded descendants selected → indeterminate parent checkbox. */
|
|
211
|
+
private isParentIndeterminate;
|
|
212
|
+
/**
|
|
213
|
+
* Per-render memo: the set of row keys whose loaded subtree is partially
|
|
214
|
+
* selected. Built in one DFS over `_childCache` so each loaded parent is
|
|
215
|
+
* visited exactly once per render. Replaces the previous
|
|
216
|
+
* `collectDescendantKeys`-per-visible-row recursion which was O(visible ×
|
|
217
|
+
* descendants) per render.
|
|
218
|
+
*/
|
|
219
|
+
private getIndeterminateKeys;
|
|
220
|
+
/**
|
|
221
|
+
* Toggle a row's expanded state. On expand, fires a fetch-request event if
|
|
222
|
+
* children aren't cached yet so the wrapper can bridge to the consumer's
|
|
223
|
+
* `[fetch]` callback. Always fires `expanded-ids-change`.
|
|
224
|
+
*/
|
|
225
|
+
private toggleExpand;
|
|
226
|
+
private emitExpandedIdsChange;
|
|
227
|
+
/** Emit a fetch-request event the wrapper will bridge to the consumer's `[fetch]`. */
|
|
228
|
+
private requestChildrenFetch;
|
|
229
|
+
/**
|
|
230
|
+
* Public method called by the framework wrapper after the consumer's
|
|
231
|
+
* `[fetch]` callback resolves. Populates the cache + total for the parent,
|
|
232
|
+
* clears the pending flag, and rerenders so placeholders disappear.
|
|
233
|
+
*/
|
|
234
|
+
setFetchResponse(parentId: unknown | null, response: TreeFetchResponse): void;
|
|
235
|
+
/** Drop cached children for one parent (or all). Used on sort change / refresh. */
|
|
236
|
+
invalidateChildren(parentId?: unknown): void;
|
|
237
|
+
/** Keyboard handling on a tree-mode row. Arrow keys + Enter/Space toggle expansion. */
|
|
238
|
+
private onRowKeydown;
|
|
135
239
|
private hasRowClickListeners;
|
|
136
240
|
private onHeaderClick;
|
|
137
241
|
private onRowClick;
|
package/datatable/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { MpDatatable } from './components';
|
|
2
2
|
export type { DatatableSelectionMode, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, } from './components';
|
|
3
|
-
export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, RowKey, RowRenderer, } from './types';
|
|
3
|
+
export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, RowKey, RowRenderer, RowRenderContext, TreeIdKey, TreeSelectionStrategy, TreeFetchRequestDetail, TreeFetchResponse, TreeRowExpandDetail, TreeExpandedIdsChangeDetail, } from './types';
|
|
4
4
|
export type { SortColumn, SortDirection } from './sort';
|
|
5
5
|
export { computeNextSort, sortRows } from './sort';
|
|
6
6
|
export { datatableStyles } from './styles';
|
|
@@ -3,15 +3,26 @@ export type CellContent = string | number | boolean | null | undefined | Templat
|
|
|
3
3
|
export type CellRenderer<T = unknown> = (row: T, column: DatatableColumnDef<T>, rowIndex: number) => CellContent;
|
|
4
4
|
export type HeaderRenderer<T = unknown> = (column: DatatableColumnDef<T>) => CellContent;
|
|
5
5
|
export type RowKey<T = unknown> = (row: T, rowIndex: number) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Per-row renderer context — tree-mode metadata passed alongside the row.
|
|
8
|
+
* In flat mode every field is its trivial default (depth 0, not expanded, not a placeholder).
|
|
9
|
+
*/
|
|
10
|
+
export interface RowRenderContext {
|
|
11
|
+
depth: number;
|
|
12
|
+
isExpanded: boolean;
|
|
13
|
+
isPlaceholder: boolean;
|
|
14
|
+
}
|
|
6
15
|
/**
|
|
7
16
|
* Per-row renderer. Returns the cell content for an entire row: either an
|
|
8
17
|
* array of `Node`s (one `<td>` per data column, in column order) or a single
|
|
9
18
|
* `Node` that already contains the cells.
|
|
10
19
|
*
|
|
20
|
+
* `row` is `undefined` for placeholder rows (tree-mode, children pending fetch).
|
|
21
|
+
*
|
|
11
22
|
* Used by the Angular wrapper to bridge `*bsRowTemplate` Angular templates
|
|
12
23
|
* into the WC's shadow DOM via EmbeddedViewRef-managed nodes.
|
|
13
24
|
*/
|
|
14
|
-
export type RowRenderer<T = unknown> = (row: T | undefined, rowIndex: number) => ReadonlyArray<Node> | Node | undefined;
|
|
25
|
+
export type RowRenderer<T = unknown> = (row: T | undefined, rowIndex: number, context?: RowRenderContext) => ReadonlyArray<Node> | Node | undefined;
|
|
15
26
|
export interface DatatableColumnDef<T = unknown> {
|
|
16
27
|
/** Data property name + sort key. */
|
|
17
28
|
name: string;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, RowKey, RowRenderer, } from './column-def';
|
|
1
|
+
export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, RowKey, RowRenderer, RowRenderContext, } from './column-def';
|
|
2
|
+
export type { TreeFetchRequestDetail, TreeFetchResponse, TreeRowExpandDetail, TreeExpandedIdsChangeDetail, TreeIdKey, TreeSelectionStrategy, } from './tree';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SortColumn } from '../sort';
|
|
2
|
+
/**
|
|
3
|
+
* Selector for the row's stable identity in tree mode. Used as the expansion
|
|
4
|
+
* key and as the parentId reference returned from `mp-datatable-fetch-request`.
|
|
5
|
+
* Can be a property name on the row object OR a function that derives the id.
|
|
6
|
+
*/
|
|
7
|
+
export type TreeIdKey<T = unknown> = keyof T | string | ((row: T) => unknown);
|
|
8
|
+
/**
|
|
9
|
+
* Selection cascading mode for tree-mode datatables.
|
|
10
|
+
* - `flat`: leaf-only selection; checking a parent doesn't propagate.
|
|
11
|
+
* - `cascading`: checking a parent selects parent + all currently-loaded
|
|
12
|
+
* descendants; the parent shows an indeterminate state when some-but-not-all
|
|
13
|
+
* of its loaded descendants are selected.
|
|
14
|
+
*/
|
|
15
|
+
export type TreeSelectionStrategy = 'flat' | 'cascading';
|
|
16
|
+
/**
|
|
17
|
+
* Detail of `mp-datatable-fetch-request` — emitted by the WC when it needs
|
|
18
|
+
* data for a parent (tree mode, lazy children). The wrapper bridges this to
|
|
19
|
+
* the consumer's `[fetch]` callback and calls `setFetchResponse()` with the
|
|
20
|
+
* result. `parentId === null` means roots.
|
|
21
|
+
*/
|
|
22
|
+
export interface TreeFetchRequestDetail {
|
|
23
|
+
parentId: unknown | null;
|
|
24
|
+
page: number;
|
|
25
|
+
perPage: number;
|
|
26
|
+
sortColumns: SortColumn[];
|
|
27
|
+
}
|
|
28
|
+
/** Response shape consumed by `setFetchResponse()`. */
|
|
29
|
+
export interface TreeFetchResponse<T = unknown> {
|
|
30
|
+
data: T[];
|
|
31
|
+
totalRecords: number;
|
|
32
|
+
page: number;
|
|
33
|
+
perPage: number;
|
|
34
|
+
}
|
|
35
|
+
export interface TreeRowExpandDetail<T = unknown> {
|
|
36
|
+
row: T;
|
|
37
|
+
depth: number;
|
|
38
|
+
parentId: unknown | null;
|
|
39
|
+
}
|
|
40
|
+
export interface TreeExpandedIdsChangeDetail {
|
|
41
|
+
expandedIds: Set<unknown>;
|
|
42
|
+
}
|
package/file-manager/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { createRef as v, ref as w } from "lit/directives/ref.js";
|
|
|
5
5
|
import { styleMap as y } from "lit/directives/style-map.js";
|
|
6
6
|
import "../chunks/mp-splitter-C8cGCmac.mjs";
|
|
7
7
|
import "../chunks/mp-treeview-Bfq4_IVW.mjs";
|
|
8
|
-
import "../chunks/mp-datatable-
|
|
8
|
+
import "../chunks/mp-datatable-Con0yQue.mjs";
|
|
9
9
|
const $ = b(`:host {
|
|
10
10
|
display: flex;
|
|
11
11
|
flex-direction: column;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|