@fluid-topics/ft-table 1.2.30 → 1.2.32
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 +1 -1
- package/build/ft-table.light.js +488 -1078
- package/build/ft-table.min.js +481 -1071
- package/build/ftds-table.d.ts +0 -2
- package/build/ftds-table.js +14 -8
- package/build/ftds-table.properties.d.ts +6 -0
- package/build/ftds-table.properties.js +6 -0
- package/build/ftds-table.styles.js +23 -1
- package/package.json +7 -7
package/build/ftds-table.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { nothing, PropertyValues, TemplateResult } from "lit";
|
|
2
|
-
import "@fluid-topics/ft-select";
|
|
3
|
-
import "@fluid-topics/ft-text-field";
|
|
4
2
|
import "@fluid-topics/ft-button";
|
|
5
3
|
import "@fluid-topics/ft-typography";
|
|
6
4
|
import { FtdsTableProperties, Sort } from "./ftds-table.properties";
|
package/build/ftds-table.js
CHANGED
|
@@ -6,8 +6,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
8
|
import { repeat } from "lit/directives/repeat.js";
|
|
9
|
-
import "@fluid-topics/ft-select";
|
|
10
|
-
import "@fluid-topics/ft-text-field";
|
|
11
9
|
import "@fluid-topics/ft-button";
|
|
12
10
|
import "@fluid-topics/ft-typography";
|
|
13
11
|
import { FtdsTableChangeEvent } from "./ftds-table.properties";
|
|
@@ -43,10 +41,14 @@ class FtdsTable extends FtLitElement {
|
|
|
43
41
|
}
|
|
44
42
|
renderHeader(column, index) {
|
|
45
43
|
var _a, _b;
|
|
46
|
-
const
|
|
44
|
+
const headerCellClasses = {
|
|
47
45
|
"header-cell": true,
|
|
48
46
|
"header-cell--sticky": this.stickyHeaders
|
|
49
47
|
};
|
|
48
|
+
const columnTitleContainerClasses = {
|
|
49
|
+
"column-title-container": true,
|
|
50
|
+
["column-title-container--text-align-" + column.textAlign]: true
|
|
51
|
+
};
|
|
50
52
|
let ariaSort;
|
|
51
53
|
if ((_a = column.sortable) !== null && _a !== void 0 ? _a : true) {
|
|
52
54
|
if (((_b = this.currentSort) === null || _b === void 0 ? void 0 : _b.column) === index) {
|
|
@@ -57,13 +59,13 @@ class FtdsTable extends FtLitElement {
|
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
return html `
|
|
60
|
-
<th class="${classMap(
|
|
62
|
+
<th class="${classMap(headerCellClasses)}" role="columnheader" scope="col" aria-sort=${ariaSort !== null && ariaSort !== void 0 ? ariaSort : nothing}
|
|
61
63
|
part="${this.columnPart("header-cell", index)}">
|
|
62
|
-
<div class="
|
|
64
|
+
<div class="${classMap(columnTitleContainerClasses)}"
|
|
63
65
|
part="${this.columnPart("title-container", index)}">
|
|
64
66
|
<span class="column-title"
|
|
65
67
|
part="${this.columnPart("title", index)}">
|
|
66
|
-
<ft-typography variant="
|
|
68
|
+
<ft-typography variant="caption-1-semibold">
|
|
67
69
|
${column.title}
|
|
68
70
|
</ft-typography>
|
|
69
71
|
</span>
|
|
@@ -131,15 +133,19 @@ class FtdsTable extends FtLitElement {
|
|
|
131
133
|
}
|
|
132
134
|
renderCell(column, columnIndex, row, rowIndex) {
|
|
133
135
|
var _a;
|
|
136
|
+
const classes = {
|
|
137
|
+
"cell": true,
|
|
138
|
+
["cell--text-align-" + column.textAlign]: true
|
|
139
|
+
};
|
|
134
140
|
const renderer = (_a = column.render) !== null && _a !== void 0 ? _a : FtdsTable.DEFAULT_RENDER;
|
|
135
141
|
const render = (value) => {
|
|
136
142
|
const rendered = renderer(value, rowIndex);
|
|
137
143
|
return typeof rendered === "string" ? unsafeHTML(rendered) : rendered;
|
|
138
144
|
};
|
|
139
145
|
return html `
|
|
140
|
-
<td class="
|
|
146
|
+
<td class="${classMap(classes)}" role="cell"
|
|
141
147
|
part="${this.columnPart("cell", columnIndex)} cell-row-${rowIndex} cell-column-${columnIndex}-row-${rowIndex}">
|
|
142
|
-
<ft-typography variant="caption-
|
|
148
|
+
<ft-typography variant="caption-1-medium">${render(this.getValue(column, row))}</ft-typography>
|
|
143
149
|
</td>
|
|
144
150
|
`;
|
|
145
151
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { TemplateResult } from "lit";
|
|
2
2
|
export type Getter<T> = (o: T) => any;
|
|
3
|
+
export declare enum FtColumnAlignment {
|
|
4
|
+
left = "left",
|
|
5
|
+
center = "center",
|
|
6
|
+
right = "right"
|
|
7
|
+
}
|
|
3
8
|
export interface ColumnConfiguration<T> {
|
|
4
9
|
title: string | TemplateResult;
|
|
5
10
|
getter: string | Getter<T>;
|
|
@@ -8,6 +13,7 @@ export interface ColumnConfiguration<T> {
|
|
|
8
13
|
defaultSortOrder?: "asc" | "desc";
|
|
9
14
|
comparator?: (a: any, b: any) => number;
|
|
10
15
|
gridTemplateColumn?: string;
|
|
16
|
+
textAlign?: FtColumnAlignment;
|
|
11
17
|
}
|
|
12
18
|
export interface Sort {
|
|
13
19
|
column: number;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export var FtColumnAlignment;
|
|
2
|
+
(function (FtColumnAlignment) {
|
|
3
|
+
FtColumnAlignment["left"] = "left";
|
|
4
|
+
FtColumnAlignment["center"] = "center";
|
|
5
|
+
FtColumnAlignment["right"] = "right";
|
|
6
|
+
})(FtColumnAlignment || (FtColumnAlignment = {}));
|
|
1
7
|
export class RowClickEvent extends CustomEvent {
|
|
2
8
|
constructor(data) {
|
|
3
9
|
super("row-click", { detail: data });
|
|
@@ -55,7 +55,6 @@ export const designSystemStyles = css `
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.header-cell {
|
|
58
|
-
gap: ${table.headerCellHorizontalGap};
|
|
59
58
|
padding: ${table.headerCellVerticalPadding} ${table.headerCellHorizontalPadding};
|
|
60
59
|
vertical-align: baseline;
|
|
61
60
|
}
|
|
@@ -89,9 +88,19 @@ export const designSystemStyles = css `
|
|
|
89
88
|
|
|
90
89
|
.column-title-container {
|
|
91
90
|
display: flex;
|
|
91
|
+
row-gap: ${table.headerCellHorizontalGap};
|
|
92
92
|
align-items: baseline;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
.column-title-container--text-align-right {
|
|
96
|
+
justify-content: flex-end;
|
|
97
|
+
margin-right: -.5rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.column-title-container--text-align-center {
|
|
101
|
+
justify-content: center;
|
|
102
|
+
}
|
|
103
|
+
|
|
95
104
|
.column-title {
|
|
96
105
|
white-space: normal;
|
|
97
106
|
margin: 0 .5rem 0 0;
|
|
@@ -107,6 +116,19 @@ export const designSystemStyles = css `
|
|
|
107
116
|
position: relative;
|
|
108
117
|
}
|
|
109
118
|
|
|
119
|
+
.cell ft-typography {
|
|
120
|
+
display: flex;
|
|
121
|
+
column-gap: ${table.dataCellVerticalGap};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.cell--text-align-right ft-typography {
|
|
125
|
+
justify-content: flex-end;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.cell--text-align-center ft-typography {
|
|
129
|
+
justify-content: center;
|
|
130
|
+
}
|
|
131
|
+
|
|
110
132
|
.row > .cell {
|
|
111
133
|
border-bottom: ${table.dataRowBorderWidth} solid ${table.dataRowBorderColor};
|
|
112
134
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-table",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.32",
|
|
4
4
|
"description": "A dynamic table",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"main": "build/index.js",
|
|
11
|
-
"web": "build/
|
|
11
|
+
"web": "build/ftds-table.min.js",
|
|
12
12
|
"typings": "build/index",
|
|
13
13
|
"files": [
|
|
14
14
|
"build/**/*.ts",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@fluid-topics/design-system-variables": "0.1.
|
|
26
|
-
"@fluid-topics/ft-button": "1.2.
|
|
27
|
-
"@fluid-topics/ft-typography": "1.2.
|
|
28
|
-
"@fluid-topics/ft-wc-utils": "1.2.
|
|
25
|
+
"@fluid-topics/design-system-variables": "0.1.92",
|
|
26
|
+
"@fluid-topics/ft-button": "1.2.32",
|
|
27
|
+
"@fluid-topics/ft-typography": "1.2.32",
|
|
28
|
+
"@fluid-topics/ft-wc-utils": "1.2.32",
|
|
29
29
|
"lit": "3.1.0"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "c769ac81850509ca28719724fc6721be863ba415"
|
|
32
32
|
}
|