@fluid-topics/ft-filterable-table 0.2.22 → 0.3.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropertyValues, TemplateResult } from "lit";
|
|
2
|
-
import {
|
|
2
|
+
import { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import "@fluid-topics/ft-select";
|
|
4
4
|
import "@fluid-topics/ft-text-field";
|
|
5
5
|
import "@fluid-topics/ft-button";
|
|
@@ -32,14 +32,14 @@ export interface FtFilterableTableProperties<T extends Record<string, any>> {
|
|
|
32
32
|
stickyHeaders: boolean;
|
|
33
33
|
}
|
|
34
34
|
export declare const FtFilterableTableCssVariables: {
|
|
35
|
-
headerBackground: FtCssVariable;
|
|
36
|
-
oddRowBackground: FtCssVariable;
|
|
37
|
-
evenRowBackground: FtCssVariable;
|
|
38
|
-
rowHoverBackground: FtCssVariable;
|
|
39
|
-
stickyHeaderZIndex: FtCssVariable;
|
|
40
|
-
colorOnSurfaceHigh: FtCssVariable;
|
|
41
|
-
titleFont: FtCssVariable;
|
|
42
|
-
contentFont: FtCssVariable;
|
|
35
|
+
headerBackground: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
36
|
+
oddRowBackground: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
37
|
+
evenRowBackground: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
38
|
+
rowHoverBackground: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
39
|
+
stickyHeaderZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
40
|
+
colorOnSurfaceHigh: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
41
|
+
titleFont: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
42
|
+
contentFont: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
43
43
|
};
|
|
44
44
|
export declare class FtFilterableTable<T extends Record<string, any>> extends FtLitElement implements FtFilterableTableProperties<T> {
|
|
45
45
|
data: Array<T>;
|
|
@@ -8,26 +8,26 @@ import { css, html } from "lit";
|
|
|
8
8
|
import { property, state } from "lit/decorators.js";
|
|
9
9
|
import { repeat } from "lit/directives/repeat.js";
|
|
10
10
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
11
|
-
import { designSystemVariables,
|
|
11
|
+
import { designSystemVariables, FtCssVariableFactory, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
12
12
|
import "@fluid-topics/ft-select";
|
|
13
13
|
import "@fluid-topics/ft-text-field";
|
|
14
14
|
import "@fluid-topics/ft-button";
|
|
15
15
|
import { FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
16
|
-
import { classMap } from
|
|
16
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
17
17
|
export class RowClickEvent extends CustomEvent {
|
|
18
18
|
constructor(data) {
|
|
19
19
|
super("row-click", { detail: data });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
export const FtFilterableTableCssVariables = {
|
|
23
|
-
headerBackground:
|
|
24
|
-
oddRowBackground:
|
|
25
|
-
evenRowBackground:
|
|
26
|
-
rowHoverBackground:
|
|
27
|
-
stickyHeaderZIndex:
|
|
28
|
-
colorOnSurfaceHigh:
|
|
29
|
-
titleFont:
|
|
30
|
-
contentFont:
|
|
23
|
+
headerBackground: FtCssVariableFactory.create("--ft-filterable-table-header-background", "COLOR", "whitesmoke"),
|
|
24
|
+
oddRowBackground: FtCssVariableFactory.create("--ft-filterable-table-odd-row-background", "COLOR", "#FFFFFF"),
|
|
25
|
+
evenRowBackground: FtCssVariableFactory.create("--ft-filterable-table-even-row-background", "COLOR", "#fdfdfd"),
|
|
26
|
+
rowHoverBackground: FtCssVariableFactory.create("--ft-filterable-table-row-hover-background", "COLOR", "#fafafa"),
|
|
27
|
+
stickyHeaderZIndex: FtCssVariableFactory.create("--ft-filterable-table-sticky-header-zindex", "NUMBER", "100"),
|
|
28
|
+
colorOnSurfaceHigh: FtCssVariableFactory.external(designSystemVariables.colorOnSurfaceHigh, "Design system"),
|
|
29
|
+
titleFont: FtCssVariableFactory.external(designSystemVariables.titleFont, "Design system"),
|
|
30
|
+
contentFont: FtCssVariableFactory.external(designSystemVariables.contentFont, "Design system"),
|
|
31
31
|
};
|
|
32
32
|
const DEFAULT_RENDER = (v) => html `${v}`;
|
|
33
33
|
const DEFAULT_COMPARATOR = (a, b) => a - b;
|
|
@@ -125,8 +125,8 @@ export class FtFilterableTable extends FtLitElement {
|
|
|
125
125
|
}
|
|
126
126
|
renderHeader(column, index) {
|
|
127
127
|
const classes = {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
"header-cell": true,
|
|
129
|
+
"header-cell--sticky": this.stickyHeaders
|
|
130
130
|
};
|
|
131
131
|
return html `
|
|
132
132
|
<div class="${classMap(classes)}">
|
|
@@ -134,10 +134,10 @@ export class FtFilterableTable extends FtLitElement {
|
|
|
134
134
|
<span class="column-title">${column.title}</span>
|
|
135
135
|
${this.renderColumnSort(column, index)}
|
|
136
136
|
</div>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
${column.filter ? html `
|
|
138
|
+
<div class="column-filter">
|
|
139
|
+
${this.renderColumnFilter(column, index)}
|
|
140
|
+
</div>` : null}
|
|
141
141
|
</div>
|
|
142
142
|
`;
|
|
143
143
|
}
|
|
@@ -246,7 +246,7 @@ FtFilterableTable.styles = css `
|
|
|
246
246
|
padding: .5rem 1rem;
|
|
247
247
|
font-family: ${FtFilterableTableCssVariables.titleFont};
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
|
|
250
250
|
.header-cell--sticky {
|
|
251
251
|
top: 0;
|
|
252
252
|
z-index: ${FtFilterableTableCssVariables.stickyHeaderZIndex};
|