@fluid-topics/ft-filterable-table 0.2.1 → 0.2.4

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.
@@ -13,6 +13,7 @@ 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 'lit/directives/class-map.js';
16
17
  export class RowClickEvent extends CustomEvent {
17
18
  constructor(data) {
18
19
  super("row-click", { detail: data });
@@ -23,6 +24,7 @@ export const FtFilterableTableCssVariables = {
23
24
  oddRowBackground: FtCssVariable.create("--ft-filterable-table-odd-row-background", "COLOR", "#FFFFFF"),
24
25
  evenRowBackground: FtCssVariable.create("--ft-filterable-table-even-row-background", "COLOR", "#fdfdfd"),
25
26
  rowHoverBackground: FtCssVariable.create("--ft-filterable-table-row-hover-background", "COLOR", "#fafafa"),
27
+ stickyHeaderZIndex: FtCssVariable.create("--ft-filterable-table-sticky-header-zindex", "NUMBER", "100"),
26
28
  colorOnSurfaceHigh: FtCssVariable.external(designSystemVariables.colorOnSurfaceHigh, "Design system"),
27
29
  titleFont: FtCssVariable.external(designSystemVariables.titleFont, "Design system"),
28
30
  contentFont: FtCssVariable.external(designSystemVariables.contentFont, "Design system"),
@@ -37,6 +39,7 @@ export class FtFilterableTable extends FtLitElement {
37
39
  super(...arguments);
38
40
  this.data = [];
39
41
  this.columns = [];
42
+ this.stickyHeaders = false;
40
43
  this.filters = [];
41
44
  this.selectData = [];
42
45
  }
@@ -121,15 +124,20 @@ export class FtFilterableTable extends FtLitElement {
121
124
  this.requestUpdate();
122
125
  }
123
126
  renderHeader(column, index) {
127
+ const classes = {
128
+ 'header-cell': true,
129
+ 'header-cell--sticky': this.stickyHeaders
130
+ };
124
131
  return html `
125
- <div class="header-cell">
132
+ <div class="${classMap(classes)}">
126
133
  <div class="column-title-container">
127
134
  <span class="column-title">${column.title}</span>
128
135
  ${this.renderColumnSort(column, index)}
129
136
  </div>
137
+ ${column.filter ? html `
130
138
  <div class="column-filter">
131
139
  ${this.renderColumnFilter(column, index)}
132
- </div>
140
+ </div>` : null}
133
141
  </div>
134
142
  `;
135
143
  }
@@ -238,6 +246,12 @@ FtFilterableTable.styles = css `
238
246
  padding: .5rem 1rem;
239
247
  font-family: ${FtFilterableTableCssVariables.titleFont};
240
248
  }
249
+
250
+ .header-cell--sticky {
251
+ top: 0;
252
+ z-index: ${FtFilterableTableCssVariables.stickyHeaderZIndex};
253
+ position: sticky;
254
+ }
241
255
 
242
256
  .header-cell:first-of-type {
243
257
  border-radius: .5rem 0 0 0;
@@ -261,6 +275,9 @@ FtFilterableTable.styles = css `
261
275
  white-space: nowrap;
262
276
  text-transform: uppercase;
263
277
  margin-right: .5rem;
278
+ font-weight: normal;
279
+ letter-spacing: 1.5px;
280
+ font-size: 0.8em;
264
281
  }
265
282
 
266
283
  .column-filter {
@@ -326,6 +343,9 @@ __decorate([
326
343
  __decorate([
327
344
  property({ attribute: false })
328
345
  ], FtFilterableTable.prototype, "sort", void 0);
346
+ __decorate([
347
+ property()
348
+ ], FtFilterableTable.prototype, "stickyHeaders", void 0);
329
349
  __decorate([
330
350
  state()
331
351
  ], FtFilterableTable.prototype, "currentSort", void 0);