@fluid-topics/ft-filterable-table 0.1.7 → 0.1.8
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,8 @@
|
|
|
1
1
|
import { PropertyValues, TemplateResult } from "lit";
|
|
2
|
-
import {
|
|
2
|
+
import { FtCssVariable, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import "@fluid-topics/ft-select";
|
|
4
|
+
import "@fluid-topics/ft-text-field";
|
|
5
|
+
import "@fluid-topics/ft-button";
|
|
3
6
|
export declare type Getter<T> = (o: T) => any;
|
|
4
7
|
export interface ColumnConfiguration<T> {
|
|
5
8
|
title: string | TemplateResult;
|
|
@@ -37,7 +40,6 @@ export declare const FtFilterableTableCssVariables: {
|
|
|
37
40
|
contentFont: FtCssVariable;
|
|
38
41
|
};
|
|
39
42
|
export declare class FtFilterableTable<T extends Record<string, any>> extends FtLitElement implements FtFilterableTableProperties<T> {
|
|
40
|
-
static elementDefinitions: ElementDefinitionsMap;
|
|
41
43
|
data: Array<T>;
|
|
42
44
|
columns: Array<ColumnConfiguration<T>>;
|
|
43
45
|
sort?: Sort;
|
|
@@ -9,9 +9,10 @@ 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
11
|
import { customElement, designSystemVariables, FtCssVariable, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
12
|
+
import "@fluid-topics/ft-select";
|
|
13
|
+
import "@fluid-topics/ft-text-field";
|
|
14
|
+
import "@fluid-topics/ft-button";
|
|
15
|
+
import { FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
15
16
|
export class RowClickEvent extends CustomEvent {
|
|
16
17
|
constructor(data) {
|
|
17
18
|
super("row-click", { detail: data });
|
|
@@ -31,6 +32,8 @@ const DEFAULT_COMPARATOR = (a, b) => a - b;
|
|
|
31
32
|
const DEFAULT_STRINGIFY = (v) => "" + v;
|
|
32
33
|
let FtFilterableTable = class FtFilterableTable extends FtLitElement {
|
|
33
34
|
constructor() {
|
|
35
|
+
// Don't scope components here or web components cannot be used in columns render method
|
|
36
|
+
// static elementDefinitions: ElementDefinitionsMap = {}
|
|
34
37
|
super(...arguments);
|
|
35
38
|
this.data = [];
|
|
36
39
|
this.columns = [];
|
|
@@ -312,12 +315,6 @@ let FtFilterableTable = class FtFilterableTable extends FtLitElement {
|
|
|
312
315
|
return typeof column.stringify === "function" ? column.stringify(value, index) : DEFAULT_STRINGIFY(value);
|
|
313
316
|
}
|
|
314
317
|
};
|
|
315
|
-
FtFilterableTable.elementDefinitions = {
|
|
316
|
-
"ft-button": FtButton,
|
|
317
|
-
"ft-select": FtSelect,
|
|
318
|
-
"ft-select-option": FtSelectOption,
|
|
319
|
-
"ft-text-field": FtTextField,
|
|
320
|
-
};
|
|
321
318
|
__decorate([
|
|
322
319
|
property({ attribute: false })
|
|
323
320
|
], FtFilterableTable.prototype, "data", void 0);
|
|
@@ -440,7 +440,8 @@ const Se=e.css`:host{font-family:var(--mdc-icon-font, "Material Icons");font-wei
|
|
|
440
440
|
color: ${Ce.colorOnSurfaceDisabled};
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
.ft-select:not(.ft-select--disabled) .ft-select--input-panel
|
|
443
|
+
.ft-select:not(.ft-select--disabled) .ft-select--input-panel,
|
|
444
|
+
.ft-select:not(.ft-select--disabled) .ft-select--option {
|
|
444
445
|
cursor: pointer;
|
|
445
446
|
}
|
|
446
447
|
|
|
@@ -1109,4 +1110,4 @@ const Se=e.css`:host{font-family:var(--mdc-icon-font, "Material Icons");font-wei
|
|
|
1109
1110
|
</ft-select>
|
|
1110
1111
|
`:null}return null}renderCell(t,i,r){var a;const n=null!==(a=t.render)&&void 0!==a?a:ti;return e.html`
|
|
1111
1112
|
<div class="cell">${(t=>{const e=n(t,r);return"string"==typeof e?o.unsafeHTML(e):e})(this.getValue(t,i))}</div>
|
|
1112
|
-
`}getValue(t,e){return"string"==typeof t.getter?e[t.getter]:t.getter(e)}getValueAsString(t,e,i){const r=this.getValue(t,e);return"function"==typeof t.stringify?t.stringify(r,i):(t=>""+t)(r)}},
|
|
1113
|
+
`}getValue(t,e){return"string"==typeof t.getter?e[t.getter]:t.getter(e)}getValueAsString(t,e,i){const r=this.getValue(t,e);return"function"==typeof t.stringify?t.stringify(r,i):(t=>""+t)(r)}},Ye([i.property({attribute:!1})],t.FtFilterableTable.prototype,"data",void 0),Ye([i.property({attribute:!1})],t.FtFilterableTable.prototype,"columns",void 0),Ye([i.property({attribute:!1})],t.FtFilterableTable.prototype,"sort",void 0),Ye([i.state()],t.FtFilterableTable.prototype,"currentSort",void 0),t.FtFilterableTable=Ye([a.customElement("ft-filterable-table")],t.FtFilterableTable),t.FtFilterableTableCssVariables=Qe,t.RowClickEvent=Je,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litUnsafeHTML,ftGlobals.wcUtils,ftGlobals.litClassMap,ftGlobals.litStyleMap);
|
|
@@ -533,7 +533,8 @@ const xi=s`:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:
|
|
|
533
533
|
color: ${Si.colorOnSurfaceDisabled};
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
-
.ft-select:not(.ft-select--disabled) .ft-select--input-panel
|
|
536
|
+
.ft-select:not(.ft-select--disabled) .ft-select--input-panel,
|
|
537
|
+
.ft-select:not(.ft-select--disabled) .ft-select--option {
|
|
537
538
|
cursor: pointer;
|
|
538
539
|
}
|
|
539
540
|
|
|
@@ -1208,4 +1209,4 @@ function(t,e,i){let r,o=t;return"object"==typeof t?(o=t.slot,r=t):r={flatten:e},
|
|
|
1208
1209
|
</ft-select>
|
|
1209
1210
|
`:null}return null}renderCell(t,e,i){var r;const o=null!==(r=t.render)&&void 0!==r?r:Xi;return j`
|
|
1210
1211
|
<div class="cell">${(t=>{const e=o(t,i);return"string"==typeof e?St(e):e})(this.getValue(t,e))}</div>
|
|
1211
|
-
`}getValue(t,e){return"string"==typeof t.getter?e[t.getter]:t.getter(e)}getValueAsString(t,e,i){const r=this.getValue(t,e);return"function"==typeof t.stringify?t.stringify(r,i):(t=>""+t)(r)}},
|
|
1212
|
+
`}getValue(t,e){return"string"==typeof t.getter?e[t.getter]:t.getter(e)}getValueAsString(t,e,i){const r=this.getValue(t,e);return"function"==typeof t.stringify?t.stringify(r,i):(t=>""+t)(r)}},Ki([nt({attribute:!1})],t.FtFilterableTable.prototype,"data",void 0),Ki([nt({attribute:!1})],t.FtFilterableTable.prototype,"columns",void 0),Ki([nt({attribute:!1})],t.FtFilterableTable.prototype,"sort",void 0),Ki([st()],t.FtFilterableTable.prototype,"currentSort",void 0),t.FtFilterableTable=Ki([Ct("ft-filterable-table")],t.FtFilterableTable),t.FtFilterableTableCssVariables=Gi,t.RowClickEvent=qi,Object.defineProperty(t,"t",{value:!0})}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-filterable-table",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "A dynamic table with filters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@fluid-topics/ft-button": "^0.1.
|
|
26
|
-
"@fluid-topics/ft-select": "^0.1.
|
|
27
|
-
"@fluid-topics/ft-text-field": "^0.1.
|
|
28
|
-
"@fluid-topics/ft-wc-utils": "^0.1.
|
|
25
|
+
"@fluid-topics/ft-button": "^0.1.8",
|
|
26
|
+
"@fluid-topics/ft-select": "^0.1.8",
|
|
27
|
+
"@fluid-topics/ft-text-field": "^0.1.8",
|
|
28
|
+
"@fluid-topics/ft-wc-utils": "^0.1.8",
|
|
29
29
|
"lit": "^2.0.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "45fdf008556920bbd5fcc2e766c273aed959178d"
|
|
32
32
|
}
|