@ornery/ui-grid-vanilla 1.0.7 → 5.0.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/README.md +1 -1
- package/dist/adopt-styles.d.ts +2 -0
- package/dist/adopt-styles.d.ts.map +1 -0
- package/dist/attribute-bridge.d.ts +39 -0
- package/dist/attribute-bridge.d.ts.map +1 -0
- package/dist/browser/ui-grid-element.js +4 -4
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/components/grid-body-cell/grid-body-cell.d.ts +19 -0
- package/dist/components/grid-body-cell/grid-body-cell.d.ts.map +1 -0
- package/dist/components/grid-body-cell/index.d.ts +2 -0
- package/dist/components/grid-body-cell/index.d.ts.map +1 -0
- package/dist/components/grid-cell-editor/grid-cell-editor.d.ts +28 -0
- package/dist/components/grid-cell-editor/grid-cell-editor.d.ts.map +1 -0
- package/dist/components/grid-cell-editor/index.d.ts +2 -0
- package/dist/components/grid-cell-editor/index.d.ts.map +1 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.d.ts +32 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.d.ts.map +1 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.template.d.ts +8 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.template.d.ts.map +1 -0
- package/dist/components/grid-filter-cell/index.d.ts +2 -0
- package/dist/components/grid-filter-cell/index.d.ts.map +1 -0
- package/dist/components/grid-group-row/grid-group-row.d.ts +55 -0
- package/dist/components/grid-group-row/grid-group-row.d.ts.map +1 -0
- package/dist/components/grid-group-row/grid-group-row.template.d.ts +12 -0
- package/dist/components/grid-group-row/grid-group-row.template.d.ts.map +1 -0
- package/dist/components/grid-group-row/index.d.ts +2 -0
- package/dist/components/grid-group-row/index.d.ts.map +1 -0
- package/dist/components/grid-header-cell/grid-header-cell.d.ts +13 -0
- package/dist/components/grid-header-cell/grid-header-cell.d.ts.map +1 -0
- package/dist/components/grid-header-cell/index.d.ts +2 -0
- package/dist/components/grid-header-cell/index.d.ts.map +1 -0
- package/dist/components/grid-pagination/grid-pagination.d.ts +45 -0
- package/dist/components/grid-pagination/grid-pagination.d.ts.map +1 -0
- package/dist/components/grid-pagination/grid-pagination.template.d.ts +17 -0
- package/dist/components/grid-pagination/grid-pagination.template.d.ts.map +1 -0
- package/dist/components/grid-pagination/index.d.ts +2 -0
- package/dist/components/grid-pagination/index.d.ts.map +1 -0
- package/dist/components/grid-template/grid-template.d.ts +31 -0
- package/dist/components/grid-template/grid-template.d.ts.map +1 -0
- package/dist/components/grid-template/index.d.ts +2 -0
- package/dist/components/grid-template/index.d.ts.map +1 -0
- package/dist/events.d.ts +43 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/focus.d.ts +100 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/framework-slots.d.ts +170 -0
- package/dist/framework-slots.d.ts.map +1 -0
- package/dist/grid-controller.d.ts +363 -0
- package/dist/grid-controller.d.ts.map +1 -0
- package/dist/icons.d.ts +34 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/index.d.ts +11 -902
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/patch.d.ts +88 -0
- package/dist/patch.d.ts.map +1 -0
- package/dist/render.d.ts +62 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/templates/index.d.ts +24 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/ui-grid-empty.template.d.ts +8 -0
- package/dist/ui-grid-empty.template.d.ts.map +1 -0
- package/dist/ui-grid-shell.template.d.ts +17 -0
- package/dist/ui-grid-shell.template.d.ts.map +1 -0
- package/dist/ui-grid-standalone.element.d.ts +309 -0
- package/dist/ui-grid-standalone.element.d.ts.map +1 -0
- package/dist/utils/cell-class.d.ts +9 -0
- package/dist/utils/cell-class.d.ts.map +1 -0
- package/dist/utils/display-items.d.ts +11 -0
- package/dist/utils/display-items.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +22 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/package.json +13 -10
- package/tsconfig.dts.json +15 -0
- package/tsconfig.json +0 -1
- package/tsup.config.ts +1 -1
- package/dist/index.d.mts +0 -904
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM event wiring for the grid element.
|
|
3
|
+
*
|
|
4
|
+
* One entry point — `bindEvents(el)` — attaches every shadow-root event
|
|
5
|
+
* listener the grid needs: click, focusin/out, input, mousedown (selection
|
|
6
|
+
* drag + column resize), dblclick, keydown, blur, dragstart/over/leave/
|
|
7
|
+
* drop/end, wheel, scroll. Each handler is a standalone function declared
|
|
8
|
+
* inside `bindEvents` so it closes over the element and keeps the coupling
|
|
9
|
+
* local.
|
|
10
|
+
*
|
|
11
|
+
* Supporting helpers (`observeTemplateSlots`, `syncHeaderHorizontalScroll`,
|
|
12
|
+
* `maybeTriggerInfiniteScroll`) also live here because they are only used
|
|
13
|
+
* by the event path.
|
|
14
|
+
*/
|
|
15
|
+
import type { UiGridStandaloneElement } from './ui-grid-standalone.element';
|
|
16
|
+
/**
|
|
17
|
+
* Watch the element's light DOM for `<template slot="…">` changes so
|
|
18
|
+
* consumer template edits trigger a re-render. Ports the old grid's
|
|
19
|
+
* observer that let template updates flow through without an explicit
|
|
20
|
+
* options re-assign.
|
|
21
|
+
*/
|
|
22
|
+
export declare function observeTemplateSlots(el: UiGridStandaloneElement): void;
|
|
23
|
+
/**
|
|
24
|
+
* Mirror horizontal scroll from the body viewport onto the header +
|
|
25
|
+
* filter strips. The strips are real scroll containers (necessary for
|
|
26
|
+
* `position: sticky` on pinned cells), so they need scrollLeft set
|
|
27
|
+
* imperatively to stay aligned with the body.
|
|
28
|
+
*/
|
|
29
|
+
export declare function syncHeaderHorizontalScroll(el: UiGridStandaloneElement, scrollLeft: number): void;
|
|
30
|
+
/**
|
|
31
|
+
* Ask the controller to evaluate whether the current scroll position
|
|
32
|
+
* should request more data at the top or bottom — ports the old grid's
|
|
33
|
+
* `handleScroll → loadData` check. The controller raises
|
|
34
|
+
* `needLoadMoreData` / `needLoadMoreDataTop` when thresholds are crossed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function maybeTriggerInfiniteScroll(el: UiGridStandaloneElement): void;
|
|
37
|
+
/**
|
|
38
|
+
* Attach every shadow-root listener the grid needs. Idempotent: a
|
|
39
|
+
* `__uiGridBound` marker on the shadow root prevents re-binding on
|
|
40
|
+
* reconnect.
|
|
41
|
+
*/
|
|
42
|
+
export declare function bindEvents(el: UiGridStandaloneElement): void;
|
|
43
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAaH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAsB5E;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,uBAAuB,GAAG,IAAI,CAiCtE;AAmBD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,uBAAuB,EAC3B,UAAU,EAAE,MAAM,GACjB,IAAI,CAWN;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,uBAAuB,GAAG,IAAI,CAW5E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,uBAAuB,GAAG,IAAI,CAktB5D"}
|
package/dist/focus.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard navigation + focused-cell management.
|
|
3
|
+
*
|
|
4
|
+
* `moveGridFocus` is the central router: arrow keys, Tab/Enter inside an
|
|
5
|
+
* edit session, Home/End, Ctrl+Home/End all funnel through it. It knows
|
|
6
|
+
* how to walk the visible-row list (skipping group headers + expandable
|
|
7
|
+
* rows), moves the `cell-focused` decoration, nudges virtualization to
|
|
8
|
+
* bring off-screen targets into view, and DOM-focuses the target cell.
|
|
9
|
+
*
|
|
10
|
+
* Each function takes the element as its first argument and reads its
|
|
11
|
+
* internal state (snapshot / controller / focusedCell / shadowRoot)
|
|
12
|
+
* directly.
|
|
13
|
+
*/
|
|
14
|
+
import type { UiGridStandaloneElement } from './ui-grid-standalone.element';
|
|
15
|
+
export type GridMoveDirection = 'left' | 'right' | 'up' | 'down' | 'rowStart' | 'rowEnd' | 'top' | 'bottom';
|
|
16
|
+
/**
|
|
17
|
+
* Commit the in-flight edit, then move keyboard focus relative to the
|
|
18
|
+
* committed cell. Splits commit + focus across two paint frames: commit
|
|
19
|
+
* runs synchronously (editor unmounts, cell re-renders with the new
|
|
20
|
+
* value), then focus moves to the adjacent cell in a microtask so the
|
|
21
|
+
* blur handler's re-entry guard doesn't race the focus attempt.
|
|
22
|
+
*
|
|
23
|
+
* If the source cell was being edited, the destination cell also enters
|
|
24
|
+
* edit mode provided its column is editable — Tab/Enter inside an edit
|
|
25
|
+
* session stays continuous. Arrow nav outside an edit session does NOT
|
|
26
|
+
* auto-enter edit.
|
|
27
|
+
*/
|
|
28
|
+
export declare function commitAndMove(el: UiGridStandaloneElement, fromRowId: string | null, fromColumnName: string | null, direction: 'left' | 'right' | 'up' | 'down'): void;
|
|
29
|
+
/**
|
|
30
|
+
* Move focus relative to `(rowId, columnName)`. Uses the snapshot's
|
|
31
|
+
* display-items order so ArrowDown skips over group headers + expandable
|
|
32
|
+
* rows to whatever row comes visually next. `top` / `bottom` jump to the
|
|
33
|
+
* first/last visible row; `rowStart` / `rowEnd` jump to the first/last
|
|
34
|
+
* column of the current row.
|
|
35
|
+
*/
|
|
36
|
+
export declare function moveGridFocus(el: UiGridStandaloneElement, direction: GridMoveDirection, rowId: string | null, columnName: string | null, opts?: {
|
|
37
|
+
resumeEdit?: boolean;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Ensure the row for `rowId` is inside the virtualization window before
|
|
41
|
+
* focus moves there. When virtualization is on, a distant row isn't yet
|
|
42
|
+
* rendered into the DOM — scroll to bring it in, let the virtual-body
|
|
43
|
+
* rebuild on the next frame, then `focusCellElement`'s retry picks it up.
|
|
44
|
+
*/
|
|
45
|
+
export declare function scrollFocusedRowIntoView(el: UiGridStandaloneElement, rowId: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Toggle the `cell-focused` class between the previous and next cells.
|
|
48
|
+
* The grid shell doesn't re-render on every arrow press — we hand-mutate
|
|
49
|
+
* the two affected cells instead to avoid touching the rest of the DOM.
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyFocusedCellClass(el: UiGridStandaloneElement, previous: {
|
|
52
|
+
rowId: string;
|
|
53
|
+
columnName: string;
|
|
54
|
+
} | null, next: {
|
|
55
|
+
rowId: string;
|
|
56
|
+
columnName: string;
|
|
57
|
+
} | null): void;
|
|
58
|
+
/**
|
|
59
|
+
* DOM-focus the body cell matching the given row/column. Retries across
|
|
60
|
+
* two animation frames so a scroll-triggered virtual-body rebuild has
|
|
61
|
+
* time to bring the target row into the DOM before we give up.
|
|
62
|
+
*/
|
|
63
|
+
export declare function focusCellElement(el: UiGridStandaloneElement, rowId: string | null, columnName: string | null): void;
|
|
64
|
+
/**
|
|
65
|
+
* Dispatch a plain click on a body cell through the selection module.
|
|
66
|
+
* Mirrors the old `ui.grid.selection.uiGridCell` directive: shift-click
|
|
67
|
+
* ranges, ctrl/meta toggles one, plain click respects
|
|
68
|
+
* `enableFullRowSelection` + `enableSelectRowOnFocus` +
|
|
69
|
+
* `modifierKeysToMultiSelect`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function handleRowSelectionClick(el: UiGridStandaloneElement, rowId: string, columnName: string, event: Event): void;
|
|
72
|
+
/**
|
|
73
|
+
* Click handler for the row-header checkbox column. Differs from the
|
|
74
|
+
* full-row click only in that shift/ctrl semantics mirror the old
|
|
75
|
+
* selection module (shift-select pulls from `lastSelectedRow` regardless
|
|
76
|
+
* of modifier).
|
|
77
|
+
*/
|
|
78
|
+
export declare function handleRowHeaderCheckboxClick(el: UiGridStandaloneElement, rowId: string, event: Event): void;
|
|
79
|
+
/**
|
|
80
|
+
* Does a keydown event match a cellNav key-override descriptor?
|
|
81
|
+
* Undefined fields on the override are treated as wildcards. Used by the
|
|
82
|
+
* event bus to decide whether a key should be handled internally or
|
|
83
|
+
* forwarded to the consumer via `viewPortKeyDown`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function matchesKeyOverride(override: {
|
|
86
|
+
keyCode?: number;
|
|
87
|
+
key?: string;
|
|
88
|
+
shiftKey?: boolean;
|
|
89
|
+
ctrlKey?: boolean;
|
|
90
|
+
altKey?: boolean;
|
|
91
|
+
metaKey?: boolean;
|
|
92
|
+
}, event: KeyboardEvent): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Measure the natural content width of a column by cloning visible cells
|
|
95
|
+
* into a hidden max-content container. This avoids measuring the CSS Grid
|
|
96
|
+
* track width (which just reflects the current column size) and instead
|
|
97
|
+
* returns the width the content actually needs.
|
|
98
|
+
*/
|
|
99
|
+
export declare function measureAutoColumnWidth(el: UiGridStandaloneElement, columnName: string): number;
|
|
100
|
+
//# sourceMappingURL=focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../src/focus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAI5E,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,UAAU,GACV,QAAQ,GACR,KAAK,GACL,QAAQ,CAAC;AAEb;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,uBAAuB,EAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,SAAS,E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jB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,EACD,KAAK,EAAE,aAAa,GACnB,OAAO,CAQT;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA0C9F"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-rendered slot bridge for the vanilla grid element.
|
|
3
|
+
*
|
|
4
|
+
* The vanilla grid renders every cell / header / filter / group / expandable
|
|
5
|
+
* / empty-state via string-interpolated templates by default. When a
|
|
6
|
+
* framework wrapper (Angular, React, or any other consumer) wants to own
|
|
7
|
+
* rendering of a slot with its own templating engine, it calls
|
|
8
|
+
* `setFrameworkRenderedSlots()` on the element to flip slot kinds into
|
|
9
|
+
* "slot placeholder" mode.
|
|
10
|
+
*
|
|
11
|
+
* In that mode the element emits `<slot name="…">` placeholders at the
|
|
12
|
+
* usual render sites. The wrapper listens for the `*SlotsChanged` event
|
|
13
|
+
* this module dispatches and inserts light-DOM nodes with matching `slot`
|
|
14
|
+
* attributes carrying its framework-rendered content. Slot projection then
|
|
15
|
+
* composes the wrapper's view back into the shadow tree without the
|
|
16
|
+
* wrapper ever touching the shadow DOM directly.
|
|
17
|
+
*
|
|
18
|
+
* Slot naming conventions:
|
|
19
|
+
* - `cell-<columnName>-<rowId>` per-cell (one slot per rendered body cell)
|
|
20
|
+
* - `header-<columnName>` per-column, singleton
|
|
21
|
+
* - `filter-<columnName>` per-column, singleton
|
|
22
|
+
* - `group-row-<groupId>` per-group
|
|
23
|
+
* - `expandable-row-<rowId>` per-row
|
|
24
|
+
* - `empty` singleton
|
|
25
|
+
*/
|
|
26
|
+
import { type GridCellTemplateContext, type GridColumnDef, type GridExpandableTemplateContext, type GridHeaderTemplateContext, type GridLabels, type GridRow, type GroupItem } from '@ornery/ui-grid-core';
|
|
27
|
+
/** Which slot kinds the element should render as `<slot>` placeholders. */
|
|
28
|
+
export interface FrameworkRenderedSlotsConfig {
|
|
29
|
+
/** Column names whose body cells are framework-rendered. Everything else
|
|
30
|
+
* continues to use the vanilla interpolation path. */
|
|
31
|
+
cells?: readonly string[];
|
|
32
|
+
/** Column names whose header cells are framework-rendered. */
|
|
33
|
+
headers?: readonly string[];
|
|
34
|
+
/** Column names whose filter cells are framework-rendered. */
|
|
35
|
+
filters?: readonly string[];
|
|
36
|
+
/** When true, group rows are emitted as slot placeholders. */
|
|
37
|
+
groupRow?: boolean;
|
|
38
|
+
/** When true, expandable detail rows are emitted as slot placeholders. */
|
|
39
|
+
expandableRow?: boolean;
|
|
40
|
+
/** When true, the empty-state panel is emitted as a slot placeholder. */
|
|
41
|
+
emptyState?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface FrameworkCellSlot {
|
|
44
|
+
slotName: string;
|
|
45
|
+
columnName: string;
|
|
46
|
+
rowId: string;
|
|
47
|
+
rowIndex: number;
|
|
48
|
+
context: GridCellTemplateContext;
|
|
49
|
+
}
|
|
50
|
+
export interface FrameworkHeaderSlot {
|
|
51
|
+
slotName: string;
|
|
52
|
+
columnName: string;
|
|
53
|
+
context: GridHeaderTemplateContext;
|
|
54
|
+
}
|
|
55
|
+
export interface FrameworkFilterSlot {
|
|
56
|
+
slotName: string;
|
|
57
|
+
columnName: string;
|
|
58
|
+
value: string;
|
|
59
|
+
placeholder: string;
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
column: GridColumnDef;
|
|
62
|
+
}
|
|
63
|
+
export interface FrameworkGroupRowSlot {
|
|
64
|
+
slotName: string;
|
|
65
|
+
groupId: string;
|
|
66
|
+
field: string;
|
|
67
|
+
label: string;
|
|
68
|
+
count: number;
|
|
69
|
+
depth: number;
|
|
70
|
+
collapsed: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface FrameworkExpandableRowSlot {
|
|
73
|
+
slotName: string;
|
|
74
|
+
rowId: string;
|
|
75
|
+
rowIndex: number;
|
|
76
|
+
context: GridExpandableTemplateContext;
|
|
77
|
+
}
|
|
78
|
+
export interface FrameworkEmptyStateSlot {
|
|
79
|
+
slotName: 'empty';
|
|
80
|
+
heading: string;
|
|
81
|
+
description: string;
|
|
82
|
+
labels: GridLabels;
|
|
83
|
+
}
|
|
84
|
+
export interface FrameworkSlotDelta<TSlot> {
|
|
85
|
+
added: TSlot[];
|
|
86
|
+
removed: TSlot[];
|
|
87
|
+
}
|
|
88
|
+
export declare function cellSlotName(column: GridColumnDef): string;
|
|
89
|
+
export declare function cellSlotNameForRow(column: GridColumnDef, row: GridRow): string;
|
|
90
|
+
export declare function headerSlotName(column: GridColumnDef): string;
|
|
91
|
+
export declare function filterSlotName(column: GridColumnDef): string;
|
|
92
|
+
export declare function groupRowSlotName(group: GroupItem): string;
|
|
93
|
+
export declare function expandableRowSlotName(row: GridRow): string;
|
|
94
|
+
/**
|
|
95
|
+
* Bridge state + behavior. The element creates one instance, reads the
|
|
96
|
+
* `has*` methods during render to decide which path to take, calls the
|
|
97
|
+
* `stage*` methods as it emits slot placeholders, and calls `flush()` at
|
|
98
|
+
* the end of each render pass to emit the add/remove delta.
|
|
99
|
+
*/
|
|
100
|
+
export declare class FrameworkSlotBridge {
|
|
101
|
+
private readonly host;
|
|
102
|
+
private flaggedCells;
|
|
103
|
+
private flaggedHeaders;
|
|
104
|
+
private flaggedFilters;
|
|
105
|
+
private flaggedGroupRow;
|
|
106
|
+
private flaggedExpandableRow;
|
|
107
|
+
private flaggedEmptyState;
|
|
108
|
+
private lastCellSlots;
|
|
109
|
+
private lastExpandableRowSlots;
|
|
110
|
+
private lastGroupRowSlots;
|
|
111
|
+
private lastHeaderSlots;
|
|
112
|
+
private lastFilterSlots;
|
|
113
|
+
private lastEmptyStateSlot;
|
|
114
|
+
private pendingCellSlots;
|
|
115
|
+
private pendingExpandableRowSlots;
|
|
116
|
+
private pendingGroupRowSlots;
|
|
117
|
+
private pendingHeaderSlots;
|
|
118
|
+
private pendingFilterSlots;
|
|
119
|
+
private pendingEmptyStateSlot;
|
|
120
|
+
constructor(host: EventTarget);
|
|
121
|
+
/**
|
|
122
|
+
* Apply a slots config. Returns true when the structural set changed (and
|
|
123
|
+
* therefore a re-render is required), false when the config is a no-op.
|
|
124
|
+
*/
|
|
125
|
+
configure(config: FrameworkRenderedSlotsConfig): boolean;
|
|
126
|
+
hasCell(columnName: string): boolean;
|
|
127
|
+
hasHeader(columnName: string): boolean;
|
|
128
|
+
hasFilter(columnName: string): boolean;
|
|
129
|
+
hasGroupRow(): boolean;
|
|
130
|
+
hasExpandableRow(): boolean;
|
|
131
|
+
hasEmptyState(): boolean;
|
|
132
|
+
stageCell(column: GridColumnDef, row: GridRow, rowIndex: number): void;
|
|
133
|
+
/**
|
|
134
|
+
* Carry forward every previously-known cell slot for `rowId` into the
|
|
135
|
+
* current pending set. Used by the structural patch path when a row's
|
|
136
|
+
* fingerprint matches the previous render's: `stageCell` would normally
|
|
137
|
+
* re-record the slot during cell rendering, but the fingerprint
|
|
138
|
+
* short-circuit skips the render pass for unchanged rows. Without this,
|
|
139
|
+
* `flush()` would diff pending (missing the row's slots) against last
|
|
140
|
+
* (containing them) and emit a spurious `removed` for every cell of the
|
|
141
|
+
* unchanged row, destroying the framework wrappers' projected content.
|
|
142
|
+
*/
|
|
143
|
+
carryRowCells(rowId: string): void;
|
|
144
|
+
stageExpandableRow(row: GridRow, rowIndex: number): void;
|
|
145
|
+
stageGroupRow(group: GroupItem): void;
|
|
146
|
+
stageHeader(column: GridColumnDef): void;
|
|
147
|
+
stageFilter(column: GridColumnDef, value: string, placeholder: string, disabled: boolean): void;
|
|
148
|
+
stageEmptyState(heading: string, description: string, labels: GridLabels): void;
|
|
149
|
+
/**
|
|
150
|
+
* Diff pending vs. last, dispatch `*SlotsChanged` events for every kind
|
|
151
|
+
* that moved, then swap last = pending and reset pending. Called at the
|
|
152
|
+
* end of every render pass.
|
|
153
|
+
*/
|
|
154
|
+
flush(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Data-only patch variant: merge pending entries into last without firing
|
|
157
|
+
* events, since the slot structure hasn't changed (only cell contexts
|
|
158
|
+
* refreshed). Wrappers that need context updates subscribe to
|
|
159
|
+
* `rowsVisibleChanged`.
|
|
160
|
+
*/
|
|
161
|
+
mergePendingIntoLast(): void;
|
|
162
|
+
/**
|
|
163
|
+
* On element teardown, emit `removed` for every remaining slot so wrappers
|
|
164
|
+
* can destroy their views.
|
|
165
|
+
*/
|
|
166
|
+
flushRemovals(): void;
|
|
167
|
+
private diffAndEmit;
|
|
168
|
+
private diffAndEmitSingleton;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=framework-slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-slots.d.ts","sourceRoot":"","sources":["../src/framework-slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,KAAK,SAAS,EACf,MAAM,sBAAsB,CAAC;AAE9B,2EAA2E;AAC3E,MAAM,WAAW,4BAA4B;IAC3C;0DACsD;IACtD,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,UAAU,CAAC,EAAE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