@malloydata/render 0.0.124-dev240210014322 → 0.0.124
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/dist/bundle/bundled_renderer.js +7553 -7355
- package/dist/bundle/bundled_renderer.min.js +155 -126
- package/dist/component/render.d.ts +4 -0
- package/dist/component/render.js +21 -4
- package/dist/component/table.d.ts +8 -1
- package/dist/component/table.js +33 -4
- package/package.json +3 -2
|
@@ -12,6 +12,10 @@ export declare class MalloyRender extends LitElement {
|
|
|
12
12
|
metadata: RenderResultMetadata;
|
|
13
13
|
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
14
14
|
updateTheme(modelTheme?: Tag, localTheme?: Tag): void;
|
|
15
|
+
getTableScrollState(): {
|
|
16
|
+
isAtTop: boolean;
|
|
17
|
+
isAtBottom: boolean;
|
|
18
|
+
} | null;
|
|
15
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
16
20
|
}
|
|
17
21
|
declare global {
|
package/dist/component/render.js
CHANGED
|
@@ -94,11 +94,23 @@ let MalloyRender = class MalloyRender extends lit_1.LitElement {
|
|
|
94
94
|
this.style.setProperty('--malloy-render--table-pinned-background', tablePinnedBackground);
|
|
95
95
|
this.style.setProperty('--malloy-render--table-pinned-border', tablePinnedBorder);
|
|
96
96
|
}
|
|
97
|
+
getTableScrollState() {
|
|
98
|
+
var _a;
|
|
99
|
+
const mt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#root > malloy-table');
|
|
100
|
+
return mt
|
|
101
|
+
? {
|
|
102
|
+
isAtTop: mt.isAtTop,
|
|
103
|
+
isAtBottom: mt.isAtBottom,
|
|
104
|
+
}
|
|
105
|
+
: null;
|
|
106
|
+
}
|
|
97
107
|
render() {
|
|
98
|
-
return (0, lit_1.html) `<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
return (0, lit_1.html) `<div id="root">
|
|
109
|
+
<malloy-table
|
|
110
|
+
exportparts="table-container: container"
|
|
111
|
+
.data=${this._result.data}
|
|
112
|
+
></malloy-table>
|
|
113
|
+
</div>`;
|
|
102
114
|
}
|
|
103
115
|
};
|
|
104
116
|
exports.MalloyRender = MalloyRender;
|
|
@@ -133,6 +145,11 @@ MalloyRender.styles = (0, lit_1.css) `
|
|
|
133
145
|
'calt' 1;
|
|
134
146
|
}
|
|
135
147
|
}
|
|
148
|
+
|
|
149
|
+
#root {
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 100%;
|
|
152
|
+
}
|
|
136
153
|
`;
|
|
137
154
|
__decorate([
|
|
138
155
|
(0, decorators_js_1.property)({ attribute: false })
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataArray } from '@malloydata/malloy';
|
|
2
2
|
import { LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
3
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
4
|
import { RenderResultMetadata } from './render-result-metadata';
|
|
4
5
|
import { TableLayout } from './table-layout';
|
|
5
6
|
type TableContext = {
|
|
@@ -15,8 +16,14 @@ export declare class Table extends LitElement {
|
|
|
15
16
|
parentCtx: TableContext | undefined;
|
|
16
17
|
ctx: TableContext;
|
|
17
18
|
metadata: RenderResultMetadata;
|
|
18
|
-
|
|
19
|
+
isAtTop: boolean;
|
|
20
|
+
isAtBottom: boolean;
|
|
21
|
+
scrollRef: Ref<HTMLDivElement>;
|
|
22
|
+
private handleScrollCheck;
|
|
23
|
+
firstUpdated(): void;
|
|
24
|
+
private _scrollerSize;
|
|
19
25
|
private _handleScroll;
|
|
26
|
+
connectedCallback(): void;
|
|
20
27
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
21
28
|
private renderHeader;
|
|
22
29
|
private renderField;
|
package/dist/component/table.js
CHANGED
|
@@ -31,8 +31,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
exports.Table = void 0;
|
|
32
32
|
const lit_1 = require("lit");
|
|
33
33
|
const decorators_js_1 = require("lit/decorators.js");
|
|
34
|
+
const ref_js_1 = require("lit/directives/ref.js");
|
|
34
35
|
const class_map_js_1 = require("lit/directives/class-map.js");
|
|
35
36
|
const context_1 = require("@lit/context");
|
|
37
|
+
const resize_controller_js_1 = require("@lit-labs/observers/resize-controller.js");
|
|
36
38
|
const util_1 = require("./util");
|
|
37
39
|
const render_numeric_field_1 = require("./render-numeric-field");
|
|
38
40
|
const result_context_1 = require("./result-context");
|
|
@@ -44,6 +46,30 @@ let Table = class Table extends lit_1.LitElement {
|
|
|
44
46
|
this.rowLimit = Infinity;
|
|
45
47
|
this.pinnedHeader = false;
|
|
46
48
|
this._scrolling = false;
|
|
49
|
+
this.isAtTop = true;
|
|
50
|
+
this.isAtBottom = true;
|
|
51
|
+
this.scrollRef = (0, ref_js_1.createRef)();
|
|
52
|
+
this._scrollerSize = new resize_controller_js_1.ResizeController(this, {
|
|
53
|
+
target: null,
|
|
54
|
+
callback: () => this.handleScrollCheck(),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
handleScrollCheck() {
|
|
58
|
+
const scroller = this.scrollRef.value;
|
|
59
|
+
if (scroller) {
|
|
60
|
+
this.isAtTop = scroller.scrollTop === 0;
|
|
61
|
+
this.isAtBottom =
|
|
62
|
+
scroller.scrollTop + scroller.clientHeight >= scroller.scrollHeight;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
firstUpdated() {
|
|
66
|
+
if (this.scrollRef.value)
|
|
67
|
+
this._scrollerSize.observe(this.scrollRef.value);
|
|
68
|
+
}
|
|
69
|
+
_handleScroll(e) {
|
|
70
|
+
const target = e.target;
|
|
71
|
+
this._scrolling = target.scrollTop > 0;
|
|
72
|
+
this.handleScrollCheck();
|
|
47
73
|
}
|
|
48
74
|
connectedCallback() {
|
|
49
75
|
super.connectedCallback();
|
|
@@ -60,10 +86,6 @@ let Table = class Table extends lit_1.LitElement {
|
|
|
60
86
|
};
|
|
61
87
|
}
|
|
62
88
|
}
|
|
63
|
-
_handleScroll(e) {
|
|
64
|
-
const target = e.target;
|
|
65
|
-
this._scrolling = target.scrollTop > 0;
|
|
66
|
-
}
|
|
67
89
|
// If rendering a pinned header, render it within the current ShadowDOM root so we can use CSS to style the nested table headers when scrolling
|
|
68
90
|
createRenderRoot() {
|
|
69
91
|
if (this.pinnedHeader)
|
|
@@ -216,6 +238,7 @@ let Table = class Table extends lit_1.LitElement {
|
|
|
216
238
|
@scroll=${this._handleScroll}
|
|
217
239
|
class="table-wrapper"
|
|
218
240
|
part=${this.ctx.root ? 'table-container' : lit_1.nothing}
|
|
241
|
+
ref=${(0, ref_js_1.ref)(this.scrollRef)}
|
|
219
242
|
>
|
|
220
243
|
${renderStickyHeader()}
|
|
221
244
|
<table>
|
|
@@ -366,6 +389,12 @@ __decorate([
|
|
|
366
389
|
(0, context_1.consume)({ context: result_context_1.resultContext }),
|
|
367
390
|
(0, decorators_js_1.property)({ attribute: false })
|
|
368
391
|
], Table.prototype, "metadata", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
(0, decorators_js_1.property)({ reflect: true, type: Boolean })
|
|
394
|
+
], Table.prototype, "isAtTop", void 0);
|
|
395
|
+
__decorate([
|
|
396
|
+
(0, decorators_js_1.property)({ reflect: true, type: Boolean })
|
|
397
|
+
], Table.prototype, "isAtBottom", void 0);
|
|
369
398
|
__decorate([
|
|
370
399
|
(0, decorators_js_1.eventOptions)({ passive: true })
|
|
371
400
|
], Table.prototype, "_handleScroll", null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/render",
|
|
3
|
-
"version": "0.0.124
|
|
3
|
+
"version": "0.0.124",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
"build-storybook": "storybook build"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"@lit-labs/observers": "^2.0.2",
|
|
27
28
|
"@lit/context": "^1.1.0",
|
|
28
|
-
"@malloydata/malloy": "^0.0.124
|
|
29
|
+
"@malloydata/malloy": "^0.0.124",
|
|
29
30
|
"@types/luxon": "^2.4.0",
|
|
30
31
|
"lit": "^3.0.2",
|
|
31
32
|
"lodash": "^4.17.20",
|