@rozie-ui/data-table-lit 0.2.3 → 0.2.5
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 +2 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +9 -1
- package/package.json +2 -2
- package/src/DataTable.ts +15 -1
- package/src/themes/base.css +15 -0
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ npm i @rozie-ui/data-table-lit
|
|
|
10
10
|
|
|
11
11
|
Peer dependencies: `lit + @lit/context + @lit-labs/preact-signals + @preact/signals-core + @tanstack/table-core + @tanstack/virtual-core + @rozie-ui/popover-lit`. Install them alongside this package.
|
|
12
12
|
|
|
13
|
+
Also installed: `@rozie/runtime-lit` — Rozie's small, tree-shaken runtime helper package (controllable state, keyboard navigation, event modifiers, and safe interpolation). It arrives as a regular dependency, so npm pulls it for you. Your bundler keeps only the helpers this component actually uses — typically a few hundred bytes to a few KB, minified and gzipped. [What's in it and what it costs](https://github.com/One-Learning-Community/rozie.js/blob/main/docs/guide/output-and-runtime.md).
|
|
14
|
+
|
|
13
15
|
## Usage
|
|
14
16
|
|
|
15
17
|
Columns may be declared as a `:columns` config array **or** as `<Column>` children (or both — an id-keyed last-write-wins union). Per-cell rendering is one parent `#cell` / `#colHeader` renderer on `<DataTable>`, dispatched by `columnId`, so it works the same with either column form.
|
package/dist/index.cjs
CHANGED
|
@@ -205,6 +205,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
205
205
|
}
|
|
206
206
|
}))(this)
|
|
207
207
|
});
|
|
208
|
+
this._rozieSlotDistributor = new _rozie_runtime_lit.RozieSlotDistributor(this);
|
|
208
209
|
this._hasSlotDefault = false;
|
|
209
210
|
this._hasSlotGroupBar = false;
|
|
210
211
|
this._hasSlotSelectAll = false;
|
|
@@ -3167,6 +3168,12 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3167
3168
|
return col.getFacetedMinMaxValues() || null;
|
|
3168
3169
|
};
|
|
3169
3170
|
}
|
|
3171
|
+
static {
|
|
3172
|
+
this.shadowRootOptions = {
|
|
3173
|
+
...lit.LitElement.shadowRootOptions,
|
|
3174
|
+
slotAssignment: "manual"
|
|
3175
|
+
};
|
|
3176
|
+
}
|
|
3170
3177
|
static {
|
|
3171
3178
|
this.styles = lit.css`
|
|
3172
3179
|
:host{display:contents}
|
|
@@ -4664,6 +4671,7 @@ __decorate([(0, lit_decorators_js.queryAssignedElements)({
|
|
|
4664
4671
|
flatten: true
|
|
4665
4672
|
})], DataTable.prototype, "_slotDetailElements", void 0);
|
|
4666
4673
|
__decorate([(0, lit_decorators_js.property)({ attribute: false })], DataTable.prototype, "detail", void 0);
|
|
4674
|
+
__decorate([(0, lit_decorators_js.property)({ attribute: false })], DataTable.prototype, "rozieSlots", void 0);
|
|
4667
4675
|
DataTable = __decorate([(0, lit_decorators_js.customElement)("rozie-data-table")], DataTable);
|
|
4668
4676
|
var DataTable_default = DataTable;
|
|
4669
4677
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ import { LitElement } from "lit";
|
|
|
3
3
|
//#region src/DataTable.d.ts
|
|
4
4
|
declare const DataTable_base: typeof LitElement;
|
|
5
5
|
declare class DataTable extends DataTable_base {
|
|
6
|
+
static shadowRootOptions: ShadowRootInit;
|
|
6
7
|
static styles: _$lit.CSSResult;
|
|
7
8
|
/**
|
|
8
9
|
* The row data — `model: true`, so a committed cell/row edit writes a **fresh** array back through `r-model:data` (uncontrolled fallback `dataDefault`). A stable reference per Rozie's setup-once model — fed directly into table-core (never map/cloned in the watcher).
|
|
@@ -169,6 +170,7 @@ declare class DataTable extends DataTable_base {
|
|
|
169
170
|
private __rozieWatchInitial_0;
|
|
170
171
|
private __rozieWatchInitial_1;
|
|
171
172
|
private __rozieCtxProvider_data_table_columns;
|
|
173
|
+
private _rozieSlotDistributor;
|
|
172
174
|
private _hasSlotDefault;
|
|
173
175
|
private _slotDefaultElements;
|
|
174
176
|
private _hasSlotGroupBar;
|
|
@@ -233,6 +235,7 @@ declare class DataTable extends DataTable_base {
|
|
|
233
235
|
detail?: (scope: {
|
|
234
236
|
row: any;
|
|
235
237
|
}) => unknown;
|
|
238
|
+
rozieSlots?: Record<string, (scope: any) => unknown>;
|
|
236
239
|
private _disconnectCleanups;
|
|
237
240
|
private _rozieTornDown;
|
|
238
241
|
private _armListeners;
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { LitElement } from "lit";
|
|
|
3
3
|
//#region src/DataTable.d.ts
|
|
4
4
|
declare const DataTable_base: typeof LitElement;
|
|
5
5
|
declare class DataTable extends DataTable_base {
|
|
6
|
+
static shadowRootOptions: ShadowRootInit;
|
|
6
7
|
static styles: _$lit.CSSResult;
|
|
7
8
|
/**
|
|
8
9
|
* The row data — `model: true`, so a committed cell/row edit writes a **fresh** array back through `r-model:data` (uncontrolled fallback `dataDefault`). A stable reference per Rozie's setup-once model — fed directly into table-core (never map/cloned in the watcher).
|
|
@@ -169,6 +170,7 @@ declare class DataTable extends DataTable_base {
|
|
|
169
170
|
private __rozieWatchInitial_0;
|
|
170
171
|
private __rozieWatchInitial_1;
|
|
171
172
|
private __rozieCtxProvider_data_table_columns;
|
|
173
|
+
private _rozieSlotDistributor;
|
|
172
174
|
private _hasSlotDefault;
|
|
173
175
|
private _slotDefaultElements;
|
|
174
176
|
private _hasSlotGroupBar;
|
|
@@ -233,6 +235,7 @@ declare class DataTable extends DataTable_base {
|
|
|
233
235
|
detail?: (scope: {
|
|
234
236
|
row: any;
|
|
235
237
|
}) => unknown;
|
|
238
|
+
rozieSlots?: Record<string, (scope: any) => unknown>;
|
|
236
239
|
private _disconnectCleanups;
|
|
237
240
|
private _rozieTornDown;
|
|
238
241
|
private _armListeners;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, css, html, nothing } from "lit";
|
|
2
2
|
import { customElement, property, query, queryAssignedElements, state } from "lit/decorators.js";
|
|
3
3
|
import { SignalWatcher, effect, signal, untracked } from "@lit-labs/preact-signals";
|
|
4
|
-
import { createLitControllableProperty, rozieAttr, rozieDisplay, rozieStyle } from "@rozie/runtime-lit";
|
|
4
|
+
import { RozieSlotDistributor, createLitControllableProperty, rozieAttr, rozieDisplay, rozieStyle } from "@rozie/runtime-lit";
|
|
5
5
|
import { ContextConsumer, ContextProvider, createContext } from "@lit/context";
|
|
6
6
|
import { repeat } from "lit/directives/repeat.js";
|
|
7
7
|
import "@rozie-ui/popover-lit";
|
|
@@ -201,6 +201,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
|
|
|
201
201
|
}
|
|
202
202
|
}))(this)
|
|
203
203
|
});
|
|
204
|
+
this._rozieSlotDistributor = new RozieSlotDistributor(this);
|
|
204
205
|
this._hasSlotDefault = false;
|
|
205
206
|
this._hasSlotGroupBar = false;
|
|
206
207
|
this._hasSlotSelectAll = false;
|
|
@@ -3163,6 +3164,12 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
|
|
|
3163
3164
|
return col.getFacetedMinMaxValues() || null;
|
|
3164
3165
|
};
|
|
3165
3166
|
}
|
|
3167
|
+
static {
|
|
3168
|
+
this.shadowRootOptions = {
|
|
3169
|
+
...LitElement.shadowRootOptions,
|
|
3170
|
+
slotAssignment: "manual"
|
|
3171
|
+
};
|
|
3172
|
+
}
|
|
3166
3173
|
static {
|
|
3167
3174
|
this.styles = css`
|
|
3168
3175
|
:host{display:contents}
|
|
@@ -4660,6 +4667,7 @@ __decorate([queryAssignedElements({
|
|
|
4660
4667
|
flatten: true
|
|
4661
4668
|
})], DataTable.prototype, "_slotDetailElements", void 0);
|
|
4662
4669
|
__decorate([property({ attribute: false })], DataTable.prototype, "detail", void 0);
|
|
4670
|
+
__decorate([property({ attribute: false })], DataTable.prototype, "rozieSlots", void 0);
|
|
4663
4671
|
DataTable = __decorate([customElement("rozie-data-table")], DataTable);
|
|
4664
4672
|
var DataTable_default = DataTable;
|
|
4665
4673
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozie-ui/data-table-lit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"src"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@rozie/runtime-lit": "0.
|
|
48
|
+
"@rozie/runtime-lit": "0.6.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"lit": "^3.2",
|
package/src/DataTable.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, css, html, nothing } from 'lit';
|
|
2
2
|
import { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js';
|
|
3
3
|
import { SignalWatcher, effect, signal, untracked } from '@lit-labs/preact-signals';
|
|
4
|
-
import { createLitControllableProperty, rozieAttr, rozieDisplay, rozieStyle } from '@rozie/runtime-lit';
|
|
4
|
+
import { RozieSlotDistributor, createLitControllableProperty, rozieAttr, rozieDisplay, rozieStyle } from '@rozie/runtime-lit';
|
|
5
5
|
import { ContextProvider, createContext } from '@lit/context';
|
|
6
6
|
import { repeat } from 'lit/directives/repeat.js';
|
|
7
7
|
import '@rozie-ui/popover-lit';
|
|
@@ -91,6 +91,8 @@ interface RozieDetailSlotCtx {
|
|
|
91
91
|
|
|
92
92
|
@customElement('rozie-data-table')
|
|
93
93
|
export default class DataTable extends SignalWatcher(LitElement) {
|
|
94
|
+
static shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, slotAssignment: 'manual' };
|
|
95
|
+
|
|
94
96
|
static styles = css`
|
|
95
97
|
:host{display:contents}
|
|
96
98
|
.rozie-data-table[data-rozie-s-d5dcab4c] {
|
|
@@ -631,6 +633,8 @@ private __rozieCtxProvider_data_table_columns = new ContextProvider(this, { cont
|
|
|
631
633
|
}
|
|
632
634
|
}))(this) });
|
|
633
635
|
|
|
636
|
+
private _rozieSlotDistributor = new RozieSlotDistributor(this);
|
|
637
|
+
|
|
634
638
|
@state() private _hasSlotDefault = false;
|
|
635
639
|
@queryAssignedElements({ flatten: true }) private _slotDefaultElements!: Element[];
|
|
636
640
|
@state() private _hasSlotGroupBar = false;
|
|
@@ -657,6 +661,16 @@ private __rozieCtxProvider_data_table_columns = new ContextProvider(this, { cont
|
|
|
657
661
|
@state() private _hasSlotDetail = false;
|
|
658
662
|
@queryAssignedElements({ slot: 'detail', flatten: true }) private _slotDetailElements!: Element[];
|
|
659
663
|
@property({ attribute: false }) detail?: (scope: { row: any }) => unknown;
|
|
664
|
+
// Phase 79 Plan 08 (R4) contract for 79-09: the record intake for
|
|
665
|
+
// record-routed slot fills. 79-09's consumer-side emitSlotFiller
|
|
666
|
+
// accumulates an object literal onto the SAME `.rozieSlots=${{ ... }}`
|
|
667
|
+
// open-tag binding; the KEY is the fill's authored (possibly
|
|
668
|
+
// non-identifier) name and the VALUE is a scope-taking render
|
|
669
|
+
// function. `rozieSlots?.[name]` must be checked BEFORE the legacy
|
|
670
|
+
// named function-prop / <slot> fallback (AC-9). Attribute
|
|
671
|
+
// deserialization is disabled — this is a function-valued record,
|
|
672
|
+
// never reflected to/from an HTML attribute.
|
|
673
|
+
@property({ attribute: false }) rozieSlots?: Record<string, (scope: any) => unknown>;
|
|
660
674
|
|
|
661
675
|
private _disconnectCleanups: Array<() => void> = [];
|
|
662
676
|
// Re-parenting guard: set true once the deferred teardown has actually
|
package/src/themes/base.css
CHANGED
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
*/
|
|
25
25
|
.rozie-data-table-wrap,
|
|
26
26
|
.rozie-data-table {
|
|
27
|
+
/* NOTE (see file-head comment): most of the tokens below are declared but
|
|
28
|
+
never read via a CSS var() inside THIS component's own scoped <style> —
|
|
29
|
+
that is by design. This is the public surface; the "Wire the PUBLIC
|
|
30
|
+
tokens..." block further down assigns each one onto the short internal
|
|
31
|
+
--rdt-* custom property the component actually reads. A future audit
|
|
32
|
+
must not delete these as dead — they are the intended public API. */
|
|
33
|
+
|
|
27
34
|
/* ── palette (the few values most consumers will set) ───────────────────── */
|
|
28
35
|
--rozie-data-table-fg: inherit;
|
|
29
36
|
--rozie-data-table-accent: #0066cc;
|
|
@@ -62,6 +69,14 @@
|
|
|
62
69
|
/* ── disabled pagination controls ──────────────────────────────────────── */
|
|
63
70
|
--rozie-data-table-disabled-opacity: 0.4;
|
|
64
71
|
|
|
72
|
+
/* ── virtual scroll (row windowing, req-3/D-06) ─────────────────────────── */
|
|
73
|
+
/* Read with NO fallback at its one use site (`max-height: var(--rozie-data-table-max-height);`
|
|
74
|
+
on `.rdt-scroll`) — when unset the property is invalid at computed-value
|
|
75
|
+
time and the rule behaves as if `max-height` were never declared there,
|
|
76
|
+
i.e. `none` (unbounded). Declaring `none` here is the render-neutral
|
|
77
|
+
equivalent of that unset behavior, made explicit and overridable. */
|
|
78
|
+
--rozie-data-table-max-height: none;
|
|
79
|
+
|
|
65
80
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
66
81
|
* Wire the PUBLIC tokens onto the INTERNAL `--rdt-*` the component reads. A
|
|
67
82
|
* bridge only needs to remap the public tokens above; these passthroughs do
|