@fluid-topics/ft-table 1.3.44 → 1.3.46
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/build/ft-table.light.js +241 -223
- package/build/ft-table.min.js +162 -144
- package/build/ftds-table.js +22 -22
- package/build/ftds-table.styles.js +5 -5
- package/package.json +6 -6
package/build/ftds-table.js
CHANGED
|
@@ -8,7 +8,7 @@ import { html, nothing } from "lit";
|
|
|
8
8
|
import { repeat } from "lit/directives/repeat.js";
|
|
9
9
|
import "@fluid-topics/ft-button";
|
|
10
10
|
import "@fluid-topics/ft-typography";
|
|
11
|
-
import {
|
|
11
|
+
import { FtdsTypographyVariants } from "@fluid-topics/ft-typography";
|
|
12
12
|
import { FtdsTableChangeEvent, RowClickEvent } from "./ftds-table.properties";
|
|
13
13
|
import { property, queryAll, state } from "lit/decorators.js";
|
|
14
14
|
import { DesignSystemFamily } from "@fluid-topics/design-system-variables";
|
|
@@ -37,11 +37,11 @@ class FtdsTable extends FtLitElement {
|
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
39
|
var _a;
|
|
40
|
-
|
|
40
|
+
const data = this.sortData(this.data);
|
|
41
41
|
return html `
|
|
42
42
|
<table class="table"
|
|
43
43
|
role="table"
|
|
44
|
-
aria-label
|
|
44
|
+
aria-label="${(_a = this.ariaLabel) !== null && _a !== void 0 ? _a : nothing}"
|
|
45
45
|
>
|
|
46
46
|
${this.renderHeaderRow()}
|
|
47
47
|
<tbody>
|
|
@@ -55,11 +55,11 @@ class FtdsTable extends FtLitElement {
|
|
|
55
55
|
var _a, _b, _c, _d;
|
|
56
56
|
const headerCellClasses = {
|
|
57
57
|
"header-cell": true,
|
|
58
|
-
"header-cell--sticky": this.stickyHeaders
|
|
58
|
+
"header-cell--sticky": this.stickyHeaders,
|
|
59
59
|
};
|
|
60
60
|
const columnTitleContainerClasses = {
|
|
61
61
|
"column-title-container": true,
|
|
62
|
-
["column-title-container--text-align-" + column.textAlign]: true
|
|
62
|
+
["column-title-container--text-align-" + column.textAlign]: true,
|
|
63
63
|
};
|
|
64
64
|
const styles = (_b = (_a = column.styles) === null || _a === void 0 ? void 0 : _a.headerCell) !== null && _b !== void 0 ? _b : {};
|
|
65
65
|
let ariaSort;
|
|
@@ -72,15 +72,15 @@ class FtdsTable extends FtLitElement {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return html `
|
|
75
|
-
<th class="${classMap(headerCellClasses)}" style="${styleMap(styles)}" role="columnheader" scope="col" aria-sort
|
|
75
|
+
<th class="${classMap(headerCellClasses)}" style="${styleMap(styles)}" role="columnheader" scope="col" aria-sort="${ariaSort !== null && ariaSort !== void 0 ? ariaSort : nothing}"
|
|
76
76
|
part="${this.columnPart("header-cell", index)}">
|
|
77
77
|
<div class="${classMap(columnTitleContainerClasses)}"
|
|
78
78
|
part="${this.columnPart("title-container", index)}">
|
|
79
79
|
<span class="column-title"
|
|
80
80
|
part="${this.columnPart("title", index)}">
|
|
81
|
-
<
|
|
81
|
+
<ftds-typography variant="${FtdsTypographyVariants.caption1semibold}">
|
|
82
82
|
${column.title}
|
|
83
|
-
</
|
|
83
|
+
</ftds-typography>
|
|
84
84
|
</span>
|
|
85
85
|
${this.renderColumnSort(column, index)}
|
|
86
86
|
</div>
|
|
@@ -94,9 +94,9 @@ class FtdsTable extends FtLitElement {
|
|
|
94
94
|
};
|
|
95
95
|
return html `
|
|
96
96
|
<thead>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
<tr class="${classMap(classes)}" role="row">
|
|
98
|
+
${repeat(this.columns, (_, index) => "header-cell-" + index, (column, index) => this.renderHeader(column, index))}
|
|
99
|
+
</tr>
|
|
100
100
|
</thead>
|
|
101
101
|
`;
|
|
102
102
|
}
|
|
@@ -105,10 +105,10 @@ class FtdsTable extends FtLitElement {
|
|
|
105
105
|
"row": true,
|
|
106
106
|
"row--clickable": this.clickableRows,
|
|
107
107
|
"row--active": rowIndex === this.activeRowIndex,
|
|
108
|
-
"row--highlighted": rowIndex === this.highlightedRowIndex
|
|
108
|
+
"row--highlighted": rowIndex === this.highlightedRowIndex,
|
|
109
109
|
};
|
|
110
110
|
return html `
|
|
111
|
-
<tr class="${classMap(classes)}" role="row" tabindex
|
|
111
|
+
<tr class="${classMap(classes)}" role="row" tabindex="${this.clickableRows ? "0" : nothing}"
|
|
112
112
|
part="table-row-${rowIndex}"
|
|
113
113
|
@keydown=${this.clickableRows ? (e) => this.handleRowKeyDown(e, row) : nothing}
|
|
114
114
|
@click=${this.clickableRows ? () => this.dispatchRowClickEvent(row) : nothing}
|
|
@@ -123,7 +123,7 @@ class FtdsTable extends FtLitElement {
|
|
|
123
123
|
renderSortButton(sortIcon, label, sort, index) {
|
|
124
124
|
return html `
|
|
125
125
|
<ftds-button
|
|
126
|
-
family
|
|
126
|
+
family="${DesignSystemFamily.neutral}"
|
|
127
127
|
icon="${sortIcon}"
|
|
128
128
|
label="${label}"
|
|
129
129
|
@click=${sort}
|
|
@@ -135,7 +135,7 @@ class FtdsTable extends FtLitElement {
|
|
|
135
135
|
var _a;
|
|
136
136
|
const classes = {
|
|
137
137
|
"cell": true,
|
|
138
|
-
["cell--text-align-" + column.textAlign]: true
|
|
138
|
+
["cell--text-align-" + column.textAlign]: true,
|
|
139
139
|
};
|
|
140
140
|
const renderer = (_a = column.render) !== null && _a !== void 0 ? _a : FtdsTable.DEFAULT_RENDER;
|
|
141
141
|
const render = (value) => {
|
|
@@ -145,7 +145,7 @@ class FtdsTable extends FtLitElement {
|
|
|
145
145
|
return html `
|
|
146
146
|
<td class="${classMap(classes)}" role="cell"
|
|
147
147
|
part="${this.columnPart("cell", columnIndex)} cell-row-${rowIndex} cell-column-${columnIndex}-row-${rowIndex}">
|
|
148
|
-
<
|
|
148
|
+
<ftds-typography variant="${FtdsTypographyVariants.caption1medium}">${render(this.getValue(column, row))}</ftds-typography>
|
|
149
149
|
</td>
|
|
150
150
|
`;
|
|
151
151
|
}
|
|
@@ -158,7 +158,7 @@ class FtdsTable extends FtLitElement {
|
|
|
158
158
|
const defaultSort = (_a = column.defaultSortOrder) !== null && _a !== void 0 ? _a : "asc";
|
|
159
159
|
this.currentSort = {
|
|
160
160
|
column: index,
|
|
161
|
-
order: isSorted && ((_b = this.currentSort) === null || _b === void 0 ? void 0 : _b.order) === defaultSort ? this.getOppositeSortOrder(defaultSort) : defaultSort
|
|
161
|
+
order: isSorted && ((_b = this.currentSort) === null || _b === void 0 ? void 0 : _b.order) === defaultSort ? this.getOppositeSortOrder(defaultSort) : defaultSort,
|
|
162
162
|
};
|
|
163
163
|
this.dispatchChangeEvent();
|
|
164
164
|
};
|
|
@@ -171,11 +171,11 @@ class FtdsTable extends FtLitElement {
|
|
|
171
171
|
var _a, _b;
|
|
172
172
|
return html `
|
|
173
173
|
<tr class="row" role="row">
|
|
174
|
-
<td colspan
|
|
174
|
+
<td colspan="${this.columns.length}" class="cell no-content" role="cell">
|
|
175
175
|
${((_a = this.emptyState) === null || _a === void 0 ? void 0 : _a.noImage) ? nothing : cactusSvg}
|
|
176
|
-
<
|
|
176
|
+
<ftds-typography variant="${FtdsTypographyVariants.body2medium}">
|
|
177
177
|
${(_b = this.emptyState) === null || _b === void 0 ? void 0 : _b.content}
|
|
178
|
-
</
|
|
178
|
+
</ftds-typography>
|
|
179
179
|
</td>
|
|
180
180
|
</tr>
|
|
181
181
|
`;
|
|
@@ -200,7 +200,7 @@ class FtdsTable extends FtLitElement {
|
|
|
200
200
|
if (this.currentSort && !this.disableDataManipulation) {
|
|
201
201
|
const column = this.columns[this.currentSort.column];
|
|
202
202
|
const ascComparator = (_a = column.comparator) !== null && _a !== void 0 ? _a : FtdsTable.DEFAULT_COMPARATOR;
|
|
203
|
-
const comparator = this.currentSort.order === "asc" ? ascComparator : (
|
|
203
|
+
const comparator = this.currentSort.order === "asc" ? ascComparator : (a, b) => -ascComparator(a, b);
|
|
204
204
|
return [...data].sort((a, b) => comparator(this.getValue(column, a), this.getValue(column, b)));
|
|
205
205
|
}
|
|
206
206
|
return data;
|
|
@@ -218,7 +218,7 @@ class FtdsTable extends FtLitElement {
|
|
|
218
218
|
}
|
|
219
219
|
dispatchChangeEvent() {
|
|
220
220
|
this.dispatchEvent(new FtdsTableChangeEvent({
|
|
221
|
-
sort: this.currentSort
|
|
221
|
+
sort: this.currentSort,
|
|
222
222
|
}));
|
|
223
223
|
}
|
|
224
224
|
handleRowKeyDown(e, row) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
import { table } from "@fluid-topics/design-system-variables";
|
|
3
3
|
export { table as FtdsTableCssVariables } from "@fluid-topics/design-system-variables";
|
|
4
|
-
//language=css
|
|
4
|
+
// language=css
|
|
5
5
|
export const designSystemStyles = css `
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
@@ -118,17 +118,17 @@ export const designSystemStyles = css `
|
|
|
118
118
|
position: relative;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.cell:not(.no-content)
|
|
121
|
+
.cell:not(.no-content) ftds-typography {
|
|
122
122
|
display: flex;
|
|
123
123
|
flex-wrap: wrap;
|
|
124
124
|
column-gap: ${table.dataCellVerticalGap};
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
.cell--text-align-right
|
|
127
|
+
.cell--text-align-right ftds-typography {
|
|
128
128
|
justify-content: flex-end;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
.cell--text-align-center
|
|
131
|
+
.cell--text-align-center ftds-typography {
|
|
132
132
|
justify-content: center;
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -154,7 +154,7 @@ export const designSystemStyles = css `
|
|
|
154
154
|
padding: 24px;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
td.no-content >
|
|
157
|
+
td.no-content > ftds-typography {
|
|
158
158
|
display: flex;
|
|
159
159
|
justify-content: center;
|
|
160
160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-table",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.46",
|
|
4
4
|
"description": "A dynamic table",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@fluid-topics/design-system-variables": "2.53.1",
|
|
26
|
-
"@fluid-topics/ft-assets": "1.3.
|
|
27
|
-
"@fluid-topics/ft-button": "1.3.
|
|
28
|
-
"@fluid-topics/ft-typography": "1.3.
|
|
29
|
-
"@fluid-topics/ft-wc-utils": "1.3.
|
|
26
|
+
"@fluid-topics/ft-assets": "1.3.46",
|
|
27
|
+
"@fluid-topics/ft-button": "1.3.46",
|
|
28
|
+
"@fluid-topics/ft-typography": "1.3.46",
|
|
29
|
+
"@fluid-topics/ft-wc-utils": "1.3.46",
|
|
30
30
|
"lit": "3.1.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "d6cf25d6ed0dead8c7aff4f94a493c35d12f1392"
|
|
33
33
|
}
|