@triptyk/ember-yeti-table 3.0.0 → 3.0.1
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/LICENSE.md +1 -1
- package/README.md +9 -115
- package/declarations/components/yeti-table/body.d.ts +32 -0
- package/declarations/components/yeti-table/body.d.ts.map +1 -0
- package/declarations/components/yeti-table/header.d.ts +33 -0
- package/declarations/components/yeti-table/header.d.ts.map +1 -0
- package/declarations/components/yeti-table/pagination.d.ts +40 -0
- package/declarations/components/yeti-table/pagination.d.ts.map +1 -0
- package/declarations/components/yeti-table/table.d.ts +21 -0
- package/declarations/components/yeti-table/table.d.ts.map +1 -0
- package/declarations/components/yeti-table/tbody/row/cell.d.ts +44 -0
- package/declarations/components/yeti-table/tbody/row/cell.d.ts.map +1 -0
- package/declarations/components/yeti-table/tbody/row.d.ts +37 -0
- package/declarations/components/yeti-table/tbody/row.d.ts.map +1 -0
- package/declarations/components/yeti-table/tbody.d.ts +29 -0
- package/declarations/components/yeti-table/tbody.d.ts.map +1 -0
- package/declarations/components/yeti-table/tfoot/row/cell.d.ts +40 -0
- package/declarations/components/yeti-table/tfoot/row/cell.d.ts.map +1 -0
- package/declarations/components/yeti-table/tfoot/row.d.ts +37 -0
- package/declarations/components/yeti-table/tfoot/row.d.ts.map +1 -0
- package/declarations/components/yeti-table/tfoot.d.ts +27 -0
- package/declarations/components/yeti-table/tfoot.d.ts.map +1 -0
- package/declarations/components/yeti-table/thead/row/cell.d.ts +54 -0
- package/declarations/components/yeti-table/thead/row/cell.d.ts.map +1 -0
- package/declarations/components/yeti-table/thead/row/column.d.ts +69 -0
- package/declarations/components/yeti-table/thead/row/column.d.ts.map +1 -0
- package/declarations/components/yeti-table/thead/row.d.ts +55 -0
- package/declarations/components/yeti-table/thead/row.d.ts.map +1 -0
- package/declarations/components/yeti-table/thead.d.ts +34 -0
- package/declarations/components/yeti-table/thead.d.ts.map +1 -0
- package/declarations/components/yeti-table.d.ts +107 -0
- package/declarations/components/yeti-table.d.ts.map +1 -0
- package/declarations/index.d.ts +1 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +1 -0
- package/declarations/template-registry.d.ts.map +1 -0
- package/declarations/themes/default-theme.d.ts +3 -27
- package/declarations/themes/default-theme.d.ts.map +1 -1
- package/declarations/types.d.ts +82 -0
- package/declarations/types.d.ts.map +1 -0
- package/declarations/utils/create-regex.d.ts +1 -1
- package/declarations/utils/create-regex.d.ts.map +1 -1
- package/declarations/utils/filtering-utils.d.ts +2 -4
- package/declarations/utils/filtering-utils.d.ts.map +1 -1
- package/declarations/utils/sorting-utils.d.ts +6 -15
- package/declarations/utils/sorting-utils.d.ts.map +1 -1
- package/dist/components/yeti-table/body.js +19 -14
- package/dist/components/yeti-table/body.js.map +1 -1
- package/dist/components/yeti-table/header.js +10 -10
- package/dist/components/yeti-table/header.js.map +1 -1
- package/dist/components/yeti-table/pagination.js +14 -44
- package/dist/components/yeti-table/pagination.js.map +1 -1
- package/dist/components/yeti-table/table.js +1 -23
- package/dist/components/yeti-table/table.js.map +1 -1
- package/dist/components/yeti-table/tbody/row/cell.js +12 -12
- package/dist/components/yeti-table/tbody/row/cell.js.map +1 -1
- package/dist/components/yeti-table/tbody/row.js +15 -21
- package/dist/components/yeti-table/tbody/row.js.map +1 -1
- package/dist/components/yeti-table/tbody.js +1 -0
- package/dist/components/yeti-table/tbody.js.map +1 -1
- package/dist/components/yeti-table/tfoot/row/cell.js +9 -9
- package/dist/components/yeti-table/tfoot/row/cell.js.map +1 -1
- package/dist/components/yeti-table/tfoot/row.js +11 -11
- package/dist/components/yeti-table/tfoot/row.js.map +1 -1
- package/dist/components/yeti-table/tfoot.js +1 -0
- package/dist/components/yeti-table/tfoot.js.map +1 -1
- package/dist/components/yeti-table/thead/row/cell.js +11 -8
- package/dist/components/yeti-table/thead/row/cell.js.map +1 -1
- package/dist/components/yeti-table/thead/row/column.js +27 -128
- package/dist/components/yeti-table/thead/row/column.js.map +1 -1
- package/dist/components/yeti-table/thead/row.js +15 -15
- package/dist/components/yeti-table/thead/row.js.map +1 -1
- package/dist/components/yeti-table/thead.js +3 -22
- package/dist/components/yeti-table/thead.js.map +1 -1
- package/dist/components/yeti-table.js +99 -303
- package/dist/components/yeti-table.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/template-registry.js +2 -0
- package/dist/template-registry.js.map +1 -0
- package/dist/themes/default-theme.js +3 -2
- package/dist/themes/default-theme.js.map +1 -1
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/create-regex.js +6 -6
- package/dist/utils/create-regex.js.map +1 -1
- package/dist/utils/filtering-utils.js +20 -8
- package/dist/utils/filtering-utils.js.map +1 -1
- package/dist/utils/sorting-utils.js +13 -18
- package/dist/utils/sorting-utils.js.map +1 -1
- package/package.json +37 -16
- package/src/components/yeti-table/{body.gjs → body.gts} +49 -45
- package/src/components/yeti-table/header.gts +67 -0
- package/src/components/yeti-table/pagination.gts +118 -0
- package/src/components/yeti-table/table.gts +27 -0
- package/src/components/yeti-table/tbody/row/{cell.gjs → cell.gts} +38 -19
- package/src/components/yeti-table/tbody/row.gts +76 -0
- package/src/components/yeti-table/tbody.gts +53 -0
- package/src/components/yeti-table/tfoot/row/cell.gts +64 -0
- package/src/components/yeti-table/tfoot/row.gts +59 -0
- package/src/components/yeti-table/tfoot.gts +41 -0
- package/src/components/yeti-table/thead/row/{cell.gjs → cell.gts} +36 -13
- package/src/components/yeti-table/thead/row/column.gts +177 -0
- package/src/components/yeti-table/thead/row.gts +105 -0
- package/src/components/yeti-table/thead.gts +65 -0
- package/src/components/yeti-table.gts +629 -0
- package/src/template-registry.ts +10 -0
- package/src/themes/{default-theme.js → default-theme.ts} +5 -1
- package/src/types.ts +94 -0
- package/src/utils/{create-regex.js → create-regex.ts} +10 -10
- package/src/utils/filtering-utils.ts +91 -0
- package/src/utils/{sorting-utils.js → sorting-utils.ts} +35 -26
- package/dist/_app_/themes/default-theme.js +0 -1
- package/dist/_app_/utils/create-regex.js +0 -1
- package/dist/_app_/utils/filtering-utils.js +0 -1
- package/dist/_app_/utils/sorting-utils.js +0 -1
- package/src/components/yeti-table/header.gjs +0 -54
- package/src/components/yeti-table/pagination.gjs +0 -155
- package/src/components/yeti-table/table.gjs +0 -34
- package/src/components/yeti-table/tbody/row.gjs +0 -89
- package/src/components/yeti-table/tbody.gjs +0 -55
- package/src/components/yeti-table/tfoot/row/cell.gjs +0 -45
- package/src/components/yeti-table/tfoot/row.gjs +0 -44
- package/src/components/yeti-table/tfoot.gjs +0 -33
- package/src/components/yeti-table/thead/row/column.gjs +0 -260
- package/src/components/yeti-table/thead/row.gjs +0 -71
- package/src/components/yeti-table/thead.gjs +0 -45
- package/src/components/yeti-table.gjs +0 -780
- package/src/utils/filtering-utils.js +0 -75
- /package/src/{.gitkeep → index.ts} +0 -0
|
@@ -3,43 +3,21 @@ import { helper } from '@ember/component/helper';
|
|
|
3
3
|
import Component from '@glimmer/component';
|
|
4
4
|
import { localCopy } from 'tracked-toolbox';
|
|
5
5
|
import { on } from '@ember/modifier';
|
|
6
|
-
import {
|
|
6
|
+
import { uniqueId } from '@ember/helper';
|
|
7
7
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
8
|
import { setComponentTemplate } from '@ember/component';
|
|
9
9
|
import { g, i, n } from 'decorator-transforms/runtime-esm';
|
|
10
10
|
|
|
11
11
|
class Pagination extends Component {
|
|
12
|
-
guid = guidFor(this);
|
|
13
|
-
static {
|
|
14
|
-
setComponentTemplate(precompileTemplate("<div class={{@theme.pagination.controls}} ...attributes>\n {{#if this.showInfo}}\n <div class={{@theme.pagination.info}}>\n Showing\n {{@paginationData.pageStart}}\n to\n {{@paginationData.pageEnd}}\n of\n {{@paginationData.totalRows}}\n entries\n </div>\n {{/if}}\n\n {{#if this.showPageSizeSelector}}\n <div class={{@theme.pagination.pageSize}}>\n <label for=\"page-size-select-{{this.guid}}\">Rows per page:</label>\n <select id=\"page-size-select-{{this.guid}}\" disabled={{@disabled}} {{on \"change\" this.changePageSize}}>\n {{#each this.pageSizes as |pageSize|}}\n <option value={{pageSize}} selected={{this.isPaginationNumberSelected pageSize}}>{{pageSize}}</option>\n {{/each}}\n </select>\n </div>\n {{/if}}\n\n {{#if this.showButtons}}\n <button type=\"button\" class={{@theme.pagination.previous}} disabled={{this.shouldDisablePrevious}} {{on \"click\" @paginationActions.previousPage}}>\n Previous\n </button>\n\n <button type=\"button\" class={{@theme.pagination.next}} disabled={{this.shouldDisableNext}} {{on \"click\" @paginationActions.nextPage}}>\n Next\n </button>\n {{/if}}\n</div>", {
|
|
15
|
-
strictMode: true,
|
|
16
|
-
scope: () => ({
|
|
17
|
-
on
|
|
18
|
-
})
|
|
19
|
-
}), this);
|
|
20
|
-
}
|
|
21
|
-
// theme;
|
|
22
|
-
// paginationData;
|
|
23
|
-
// paginationActions;
|
|
24
|
-
// disabled;
|
|
25
|
-
// helper function used, needed while working with ember <= 4.4. Works without helper function in ember > 4.4
|
|
26
12
|
isPaginationNumberSelected = helper(([number]) => {
|
|
27
13
|
return number === this.args.paginationData.pageSize;
|
|
28
14
|
});
|
|
29
15
|
get shouldDisablePrevious() {
|
|
30
|
-
return this.args.paginationData.isFirstPage || this.args.disabled;
|
|
16
|
+
return !!this.args.paginationData.isFirstPage || !!this.args.disabled;
|
|
31
17
|
}
|
|
32
18
|
get shouldDisableNext() {
|
|
33
|
-
return this.args.paginationData.isLastPage || this.args.disabled;
|
|
19
|
+
return !!this.args.paginationData.isLastPage || !!this.args.disabled;
|
|
34
20
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Array of page sizes to populate the page size `<select>`.
|
|
37
|
-
* Particularly useful with an array helper, e.g `@pageSizes={{array 10 12 23 50 100}}`
|
|
38
|
-
* Defaults to `[10, 15, 20, 25]`.
|
|
39
|
-
*
|
|
40
|
-
* @argument pageSizes
|
|
41
|
-
* @type {Number}
|
|
42
|
-
*/
|
|
43
21
|
static {
|
|
44
22
|
g(this.prototype, "pageSizes", [localCopy('args.pageSizes', [10, 15, 20, 25])]);
|
|
45
23
|
}
|
|
@@ -48,38 +26,30 @@ class Pagination extends Component {
|
|
|
48
26
|
g(this.prototype, "showInfo", [localCopy('args.showInfo', true)]);
|
|
49
27
|
}
|
|
50
28
|
#showInfo = (i(this, "showInfo"), void 0);
|
|
51
|
-
/**
|
|
52
|
-
* Used to show/hide some textual information about the current page. Defaults to `true`.
|
|
53
|
-
*
|
|
54
|
-
* @argument showInfo
|
|
55
|
-
* @type {Boolean}
|
|
56
|
-
*/
|
|
57
29
|
static {
|
|
58
30
|
g(this.prototype, "showPageSizeSelector", [localCopy('args.showPageSizeSelector', true)]);
|
|
59
31
|
}
|
|
60
32
|
#showPageSizeSelector = (i(this, "showPageSizeSelector"), void 0);
|
|
61
|
-
/**
|
|
62
|
-
* Used to show/hide the page size selector. Defaults to `true`.
|
|
63
|
-
*
|
|
64
|
-
* @argument showPageSizeSelector
|
|
65
|
-
* @type {Boolean}
|
|
66
|
-
*/
|
|
67
33
|
static {
|
|
68
34
|
g(this.prototype, "showButtons", [localCopy('args.showButtons', true)]);
|
|
69
35
|
}
|
|
70
36
|
#showButtons = (i(this, "showButtons"), void 0);
|
|
71
|
-
/**
|
|
72
|
-
* Used to show/hide the previous and next page buttons. Defaults to `true`.
|
|
73
|
-
*
|
|
74
|
-
* @argument showButtons
|
|
75
|
-
* @type {Boolean}
|
|
76
|
-
*/
|
|
77
37
|
changePageSize(ev) {
|
|
78
|
-
|
|
38
|
+
const target = ev.target;
|
|
39
|
+
this.args.paginationActions.changePageSize(target.value);
|
|
79
40
|
}
|
|
80
41
|
static {
|
|
81
42
|
n(this.prototype, "changePageSize", [action]);
|
|
82
43
|
}
|
|
44
|
+
static {
|
|
45
|
+
setComponentTemplate(precompileTemplate("<div class={{@theme.pagination.controls}} ...attributes>\n {{#if this.showInfo}}\n <div class={{@theme.pagination.info}}>\n Showing\n {{@paginationData.pageStart}}\n to\n {{@paginationData.pageEnd}}\n of\n {{@paginationData.totalRows}}\n entries\n </div>\n {{/if}}\n\n {{#if this.showPageSizeSelector}}\n <div class={{@theme.pagination.pageSize}}>\n {{#let (uniqueId) as |selectId|}}\n <label for=\"page-size-select-{{selectId}}\">Rows per page:</label>\n <select id=\"page-size-select-{{selectId}}\" disabled={{@disabled}} {{on \"change\" this.changePageSize}}>\n {{#each this.pageSizes as |pageSize|}}\n <option value={{pageSize}} selected={{this.isPaginationNumberSelected pageSize}}>{{pageSize}}</option>\n {{/each}}\n </select>\n {{/let}}\n </div>\n {{/if}}\n\n {{#if this.showButtons}}\n <button type=\"button\" class={{@theme.pagination.previous}} disabled={{this.shouldDisablePrevious}} {{on \"click\" @paginationActions.previousPage}}>\n Previous\n </button>\n\n <button type=\"button\" class={{@theme.pagination.next}} disabled={{this.shouldDisableNext}} {{on \"click\" @paginationActions.nextPage}}>\n Next\n </button>\n {{/if}}\n</div>", {
|
|
46
|
+
strictMode: true,
|
|
47
|
+
scope: () => ({
|
|
48
|
+
uniqueId,
|
|
49
|
+
on
|
|
50
|
+
})
|
|
51
|
+
}), this);
|
|
52
|
+
}
|
|
83
53
|
}
|
|
84
54
|
|
|
85
55
|
export { Pagination as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sources":["../../../src/components/yeti-table/pagination.
|
|
1
|
+
{"version":3,"file":"pagination.js","sources":["../../../src/components/yeti-table/pagination.gts"],"sourcesContent":["import { action } from '@ember/object';\nimport { helper } from '@ember/component/helper';\nimport Component from '@glimmer/component';\nimport { localCopy } from 'tracked-toolbox';\n\nimport { on } from '@ember/modifier';\n\nimport type { PaginationActions, PaginationData, Theme } from '../../types.ts';\nimport { uniqueId } from '@ember/helper';\n\n/**\n Simple pagination controls component that is included to help you get started quickly.\n\n @class Pagination\n*/\n\nexport interface PaginationSignature {\n Element: HTMLDivElement;\n Args: {\n theme?: Theme;\n paginationData: PaginationData;\n paginationActions: PaginationActions;\n disabled?: boolean;\n pageSizes?: number[];\n showInfo?: boolean;\n showPageSizeSelector?: boolean;\n showButtons?: boolean;\n };\n Blocks: { default: [] };\n}\n\nexport default class Pagination extends Component<PaginationSignature> {\n isPaginationNumberSelected = helper(([number]: [number]) => {\n return number === this.args.paginationData.pageSize;\n });\n\n get shouldDisablePrevious(): boolean {\n return !!this.args.paginationData.isFirstPage || !!this.args.disabled;\n }\n\n get shouldDisableNext(): boolean {\n return !!this.args.paginationData.isLastPage || !!this.args.disabled;\n }\n\n @localCopy('args.pageSizes', [10, 15, 20, 25])\n pageSizes!: number[];\n\n @localCopy('args.showInfo', true)\n showInfo!: boolean;\n\n @localCopy('args.showPageSizeSelector', true)\n showPageSizeSelector!: boolean;\n\n @localCopy('args.showButtons', true)\n showButtons!: boolean;\n\n @action\n changePageSize(ev: Event): void {\n const target = ev.target as HTMLSelectElement;\n this.args.paginationActions.changePageSize(target.value);\n }\n\n <template>\n <div class={{@theme.pagination.controls}} ...attributes>\n {{#if this.showInfo}}\n <div class={{@theme.pagination.info}}>\n Showing\n {{@paginationData.pageStart}}\n to\n {{@paginationData.pageEnd}}\n of\n {{@paginationData.totalRows}}\n entries\n </div>\n {{/if}}\n\n {{#if this.showPageSizeSelector}}\n <div class={{@theme.pagination.pageSize}}>\n {{#let (uniqueId) as |selectId|}}\n <label for=\"page-size-select-{{selectId}}\">Rows per page:</label>\n <select\n id=\"page-size-select-{{selectId}}\"\n disabled={{@disabled}}\n {{on \"change\" this.changePageSize}}\n >\n {{#each this.pageSizes as |pageSize|}}\n <option\n value={{pageSize}}\n selected={{this.isPaginationNumberSelected pageSize}}\n >{{pageSize}}</option>\n {{/each}}\n </select>\n {{/let}}\n </div>\n {{/if}}\n\n {{#if this.showButtons}}\n <button\n type=\"button\"\n class={{@theme.pagination.previous}}\n disabled={{this.shouldDisablePrevious}}\n {{on \"click\" @paginationActions.previousPage}}\n >\n Previous\n </button>\n\n <button\n type=\"button\"\n class={{@theme.pagination.next}}\n disabled={{this.shouldDisableNext}}\n {{on \"click\" @paginationActions.nextPage}}\n >\n Next\n </button>\n {{/if}}\n </div>\n </template>\n}\n"],"names":["Pagination","Component","isPaginationNumberSelected","helper","number","args","paginationData","pageSize","shouldDisablePrevious","isFirstPage","disabled","shouldDisableNext","isLastPage","g","prototype","localCopy","i","changePageSize","ev","target","paginationActions","value","n","action","setComponentTemplate","precompileTemplate","strictMode","scope","uniqueId","on"],"mappings":";;;;;;;;;;AA+Be,MAAMA,mBAAmBC,SAAA,CAAU;AAChDC,EAAAA,0BAAA,GAA6BC,MAAA,CAAO,CAAC,CAACC,MAAA,CAAiB,KAAA;IACrD,OAAOA,WAAW,IAAI,CAACC,IAAI,CAACC,cAAc,CAACC,QAAQ;AACrD,EAAA,CAAA,CAAA;EAEA,IAAIC,qBAAAA,GAAiC;AACnC,IAAA,OAAO,CAAC,CAAC,IAAI,CAACH,IAAI,CAACC,cAAc,CAACG,WAAW,IAAI,CAAC,CAAC,IAAI,CAACJ,IAAI,CAACK,QAAQ;AACvE,EAAA;EAEA,IAAIC,iBAAAA,GAA6B;AAC/B,IAAA,OAAO,CAAC,CAAC,IAAI,CAACN,IAAI,CAACC,cAAc,CAACM,UAAU,IAAI,CAAC,CAAC,IAAI,CAACP,IAAI,CAACK,QAAQ;AACtE,EAAA;AAAA,EAAA;AAAAG,IAAAA,CAAA,MAAAC,SAAA,EAAA,WAAA,EAAA,CAECC,UAAU,gBAAA,EAAkB,CAAC,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,CAAG,CAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,UAAA,EAAA,CAG5CC,UAAU,eAAA,EAAiB,IAAA,CAAA,CAAA,CAAA;AAAA;EAAA,SAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,UAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,sBAAA,EAAA,CAG3BC,UAAU,2BAAA,EAA6B,IAAA,CAAA,CAAA,CAAA;AAAA;EAAA,qBAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,sBAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAGvCC,UAAU,kBAAA,EAAoB,IAAA,CAAA,CAAA,CAAA;AAAA;EAAA,YAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,aAAA,CAAA,EAAA,MAAA;EAI/BC,cAAAA,CAAeC,EAAS,EAAQ;AAC9B,IAAA,MAAMC,MAAA,GAASD,EAAA,CAAGC,MAAU;IAC5B,IAAI,CAACd,IAAI,CAACe,iBAAiB,CAACH,cAAc,CAACE,OAAOE,KAAK,CAAA;AACzD,EAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAR,SAAA,EAAA,gBAAA,EAAA,CAJCS,MAAA,CAAA,CAAA;AAAA;AAMD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,owCAAA,EAsDA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,QAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -6,31 +6,9 @@ import templateOnly from '@ember/component/template-only';
|
|
|
6
6
|
A simple component that just renders the `<table>` element with the correct
|
|
7
7
|
theme classes.
|
|
8
8
|
|
|
9
|
-
This component should only be needed when using `@renderTableElement={{false}}` to render
|
|
10
|
-
the table element yourself. Please refer to the `@renderTableElement` documentation for
|
|
11
|
-
more information.
|
|
12
|
-
|
|
13
|
-
Example:
|
|
14
|
-
|
|
15
|
-
```hbs
|
|
16
|
-
<YetiTable @data={{this.data}} @pagination={{true}} @renderTableElement={{false}} as |t|>
|
|
17
|
-
|
|
18
|
-
<t.table> {{!-- we render the given table component ourselves --}}
|
|
19
|
-
<t.header as |header|>
|
|
20
|
-
...
|
|
21
|
-
</t.header>
|
|
22
|
-
|
|
23
|
-
<t.body/>
|
|
24
|
-
</t.table>
|
|
25
|
-
|
|
26
|
-
<t.pagination/> {{!-- pagination controls outside the <table> element --}}
|
|
27
|
-
|
|
28
|
-
</YetiTable>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
9
|
@class Table
|
|
32
10
|
*/
|
|
33
|
-
|
|
11
|
+
const Table = setComponentTemplate(precompileTemplate("<table class={{@theme.table}} ...attributes>\n {{yield}}\n</table>", {
|
|
34
12
|
strictMode: true
|
|
35
13
|
}), templateOnly());
|
|
36
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sources":["../../../src/components/yeti-table/table.
|
|
1
|
+
{"version":3,"file":"table.js","sources":["../../../src/components/yeti-table/table.gts"],"sourcesContent":["import type { TemplateOnlyComponent } from '@ember/component/template-only';\n\nimport type { Theme } from '../../types.ts';\n\n/**\n A simple component that just renders the `<table>` element with the correct\n theme classes.\n\n @class Table\n*/\n\nexport interface TableSignature {\n Element: HTMLTableElement;\n Args: {\n theme?: Theme;\n parent?: unknown;\n };\n Blocks: { default: [] };\n}\n\nconst Table: TemplateOnlyComponent<TableSignature> = <template>\n <table class={{@theme.table}} ...attributes>\n {{yield}}\n </table>\n</template>;\n\nexport default Table;\n"],"names":["Table","setComponentTemplate","precompileTemplate","strictMode","templateOnly"],"mappings":";;;;AAIA;;;;;AAKA;AAWA,MAAMA,KAA6B,GAAAC,oBAAA,CAAkBC,kBAAA,CAAA,qEAAA,EAIrD;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
|
|
@@ -6,29 +6,29 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
6
6
|
import { g, i } from 'decorator-transforms/runtime-esm';
|
|
7
7
|
|
|
8
8
|
class TBodyCell extends Component {
|
|
9
|
-
static {
|
|
10
|
-
setComponentTemplate(precompileTemplate("{{#if this.column.visible}}\n <td class=\"{{@class}} {{this.column.columnClass}} {{@theme.tbodyCell}}\" ...attributes>\n {{yield (hash prop=this.column.prop)}}\n </td>\n{{/if}}", {
|
|
11
|
-
strictMode: true,
|
|
12
|
-
scope: () => ({
|
|
13
|
-
hash
|
|
14
|
-
})
|
|
15
|
-
}), this);
|
|
16
|
-
}
|
|
17
9
|
static {
|
|
18
10
|
g(this.prototype, "index", [tracked]);
|
|
19
11
|
}
|
|
20
12
|
#index = (i(this, "index"), void 0);
|
|
21
13
|
get column() {
|
|
22
|
-
return this.args.columns[this.index]
|
|
14
|
+
return this.args.columns?.[this.index ?? -1] ?? {};
|
|
23
15
|
}
|
|
24
|
-
constructor() {
|
|
25
|
-
super(
|
|
16
|
+
constructor(owner, args) {
|
|
17
|
+
super(owner, args);
|
|
26
18
|
this.index = this.args.parent?.registerCell(this);
|
|
27
19
|
}
|
|
28
20
|
willDestroy() {
|
|
29
|
-
super.willDestroy(
|
|
21
|
+
super.willDestroy();
|
|
30
22
|
this.args.parent?.unregisterCell(this);
|
|
31
23
|
}
|
|
24
|
+
static {
|
|
25
|
+
setComponentTemplate(precompileTemplate("{{#if this.column.visible}}\n <td class=\"{{@class}} {{this.column.columnClass}} {{@theme.tbodyCell}}\" ...attributes>\n {{yield (hash prop=this.column.prop)}}\n </td>\n{{/if}}", {
|
|
26
|
+
strictMode: true,
|
|
27
|
+
scope: () => ({
|
|
28
|
+
hash
|
|
29
|
+
})
|
|
30
|
+
}), this);
|
|
31
|
+
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { TBodyCell as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/tbody/row/cell.
|
|
1
|
+
{"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/tbody/row/cell.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport type Owner from '@ember/owner';\n\nimport { hash } from '@ember/helper';\n\nimport type { ColumnDefinition, Theme } from '../../../../types.ts';\n\n/**\n @class TBodyCell\n\n Renders a `<td>` element (if its corresponding column definition has `@visible={{true}}`).\n ```hbs\n <row.cell>\n {{person.firstName}}\n </row.cell>\n\n If the prop name was used when the column header was defined, it is yielded in a hash\n ```hbs\n <row.cell as |column|>\n {{get person column.prop}}\n </row.cell>\n ```\n*/\n\nexport interface TBodyCellParent {\n registerCell(cell: TBodyCell): number;\n unregisterCell(cell: TBodyCell): void;\n}\n\nexport interface TBodyCellSignature {\n Element: HTMLTableCellElement;\n Args: {\n class?: string;\n theme?: Theme;\n parent?: TBodyCellParent;\n columns?: ColumnDefinition[];\n };\n Blocks: { default: [{ prop: string | undefined }] };\n}\n\nexport default class TBodyCell extends Component<TBodyCellSignature> {\n @tracked\n index: number | undefined;\n\n get column(): ColumnDefinition {\n return this.args.columns?.[this.index ?? -1] ?? {};\n }\n\n constructor(owner: Owner, args: TBodyCellSignature['Args']) {\n super(owner, args);\n this.index = this.args.parent?.registerCell(this);\n }\n\n willDestroy(): void {\n super.willDestroy();\n this.args.parent?.unregisterCell(this);\n }\n\n <template>\n {{#if this.column.visible}}\n <td\n class=\"{{@class}} {{this.column.columnClass}} {{@theme.tbodyCell}}\"\n ...attributes\n >\n {{yield (hash prop=this.column.prop)}}\n </td>\n {{/if}}\n </template>\n}\n"],"names":["TBodyCell","Component","g","prototype","tracked","i","column","args","columns","index","constructor","owner","parent","registerCell","willDestroy","unregisterCell","setComponentTemplate","precompileTemplate","strictMode","scope","hash"],"mappings":";;;;;;;AAyCe,MAAMA,kBAAkBC,SAAA,CAAU;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CAC9CC,OAAA,CAAA,CAAA;AAAA;EAAA,MAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,OAAA,CAAA,EAAA,MAAA;EAGD,IAAIC,SAA2B;AAC7B,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,GAAG,IAAI,CAACC,KAAK,IAAI,EAAC,CAAE,IAAI,EAAC;AACnD,EAAA;AAEAC,EAAAA,WAAAA,CAAYC,KAAY,EAAEJ,IAAgC,EAAE;AAC1D,IAAA,KAAK,CAACI,KAAA,EAAOJ,IAAA,CAAA;AACb,IAAA,IAAI,CAACE,KAAK,GAAG,IAAI,CAACF,IAAI,CAACK,MAAM,EAAEC,YAAA,CAAa,IAAI,CAAA;AAClD,EAAA;AAEAC,EAAAA,WAAAA,GAAoB;IAClB,KAAK,CAACA,WAAA,EAAA;IACN,IAAI,CAACP,IAAI,CAACK,MAAM,EAAEG,eAAe,IAAI,CAAA;AACvC,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,uLAAA,EASA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -8,39 +8,33 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
8
8
|
import { n } from 'decorator-transforms/runtime-esm';
|
|
9
9
|
|
|
10
10
|
class TBodyRow extends Component {
|
|
11
|
-
static {
|
|
12
|
-
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-invalid-interactive --}}\n<tr class=\"{{@theme.tbodyRow}} {{@theme.row}}\" {{on \"click\" this.handleClick}} role={{if @onClick \"button\"}} ...attributes>\n {{yield (hash cell=(component Cell theme=@theme parent=this columns=@columns))}}\n</tr>", {
|
|
13
|
-
strictMode: true,
|
|
14
|
-
scope: () => ({
|
|
15
|
-
on,
|
|
16
|
-
hash,
|
|
17
|
-
Cell: TBodyCell
|
|
18
|
-
})
|
|
19
|
-
}), this);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Adds a click action to the row.
|
|
23
|
-
*
|
|
24
|
-
* @argument onClick
|
|
25
|
-
* @type Function
|
|
26
|
-
*/
|
|
27
11
|
cells = [];
|
|
28
12
|
registerCell(cell) {
|
|
29
|
-
|
|
13
|
+
const index = this.cells.length;
|
|
30
14
|
this.cells.push(cell);
|
|
31
15
|
return index;
|
|
32
16
|
}
|
|
33
17
|
unregisterCell(cell) {
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
const cells = this.cells;
|
|
19
|
+
const index = cells.indexOf(cell);
|
|
36
20
|
cells.splice(index, 1);
|
|
37
21
|
}
|
|
38
|
-
handleClick() {
|
|
39
|
-
this.args.onClick?.(
|
|
22
|
+
handleClick(event) {
|
|
23
|
+
this.args.onClick?.(event);
|
|
40
24
|
}
|
|
41
25
|
static {
|
|
42
26
|
n(this.prototype, "handleClick", [action]);
|
|
43
27
|
}
|
|
28
|
+
static {
|
|
29
|
+
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-invalid-interactive --}}\n<tr class=\"{{@theme.tbodyRow}} {{@theme.row}}\" {{on \"click\" this.handleClick}} role={{if @onClick \"button\"}} ...attributes>\n {{yield (hash cell=(component Cell theme=@theme parent=this columns=@columns))}}\n</tr>", {
|
|
30
|
+
strictMode: true,
|
|
31
|
+
scope: () => ({
|
|
32
|
+
on,
|
|
33
|
+
hash,
|
|
34
|
+
Cell: TBodyCell
|
|
35
|
+
})
|
|
36
|
+
}), this);
|
|
37
|
+
}
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
export { TBodyRow as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.js","sources":["../../../../src/components/yeti-table/tbody/row.
|
|
1
|
+
{"version":3,"file":"row.js","sources":["../../../../src/components/yeti-table/tbody/row.gts"],"sourcesContent":["import { action } from '@ember/object';\nimport Component from '@glimmer/component';\n\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\n\nimport type { WithBoundArgs } from '@glint/template';\n\nimport Cell from './row/cell.gts';\nimport type {\n ColumnDefinition,\n RowClickHandler,\n Theme,\n} from '../../../types.ts';\n\n/**\n Renders a `<tr>` element and yields the cell component.\n\n @class TBodyRow\n @yield {object} row\n @yield {Component} row.cell - the cell component\n*/\n\ninterface TBodyCellLike {\n index?: number;\n}\n\nexport interface TBodyRowSignature {\n Element: HTMLTableRowElement;\n Args: {\n theme?: Theme;\n columns?: ColumnDefinition[];\n onClick?: RowClickHandler;\n };\n Blocks: {\n default: [\n { cell: WithBoundArgs<typeof Cell, 'theme' | 'parent' | 'columns'> },\n ];\n };\n}\n\nexport default class TBodyRow extends Component<TBodyRowSignature> {\n cells: TBodyCellLike[] = [];\n\n registerCell(cell: TBodyCellLike): number {\n const index = this.cells.length;\n this.cells.push(cell);\n return index;\n }\n\n unregisterCell(cell: TBodyCellLike): void {\n const cells = this.cells;\n const index = cells.indexOf(cell);\n\n cells.splice(index, 1);\n }\n\n @action\n handleClick(event: MouseEvent): void {\n this.args.onClick?.(event);\n }\n\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n <tr\n class=\"{{@theme.tbodyRow}} {{@theme.row}}\"\n {{on \"click\" this.handleClick}}\n role={{if @onClick \"button\"}}\n ...attributes\n >\n {{yield\n (hash cell=(component Cell theme=@theme parent=this columns=@columns))\n }}\n </tr>\n </template>\n}\n"],"names":["TBodyRow","Component","cells","registerCell","cell","index","length","push","unregisterCell","indexOf","splice","handleClick","event","args","onClick","n","prototype","action","setComponentTemplate","precompileTemplate","strictMode","scope","on","hash","Cell"],"mappings":";;;;;;;;;AAyCe,MAAMA,iBAAiBC,SAAA,CAAU;AAC9CC,EAAAA,KAAA,GAAyB,EAAE;EAE3BC,YAAAA,CAAaC,IAAmB,EAAU;AACxC,IAAA,MAAMC,KAAA,GAAQ,IAAI,CAACH,KAAK,CAACI,MAAM;AAC/B,IAAA,IAAI,CAACJ,KAAK,CAACK,IAAI,CAACH,IAAA,CAAA;AAChB,IAAA,OAAOC,KAAA;AACT,EAAA;EAEAG,cAAAA,CAAeJ,IAAmB,EAAQ;AACxC,IAAA,MAAMF,KAAA,GAAQ,IAAI,CAACA,KAAK;AACxB,IAAA,MAAMG,KAAA,GAAQH,KAAA,CAAMO,OAAO,CAACL,IAAA,CAAA;AAE5BF,IAAAA,KAAA,CAAMQ,MAAM,CAACL,KAAA,EAAO,CAAA,CAAA;AACtB,EAAA;EAGAM,WAAAA,CAAYC,KAAiB,EAAQ;AACnC,IAAA,IAAI,CAACC,IAAI,CAACC,OAAO,GAAGF,KAAA,CAAA;AACtB,EAAA;AAAA,EAAA;IAAAG,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAHCC,MAAA,CAAA,CAAA;AAAA;AAKD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,uRAAA,EAYA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAC,IAAA;AAAAC,cAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -4,6 +4,7 @@ import TBodyRow from './tbody/row.js';
|
|
|
4
4
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
5
|
import { setComponentTemplate } from '@ember/component';
|
|
6
6
|
|
|
7
|
+
// eslint-disable-next-line ember/no-empty-glimmer-component-classes
|
|
7
8
|
class TBody extends Component {
|
|
8
9
|
static {
|
|
9
10
|
setComponentTemplate(precompileTemplate("<tbody class={{@theme.tbody}} ...attributes>\n {{yield (hash row=(component TBodyRow theme=@theme onClick=@onRowClick columns=@columns)) @data}}\n</tbody>", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tbody.js","sources":["../../../src/components/yeti-table/tbody.
|
|
1
|
+
{"version":3,"file":"tbody.js","sources":["../../../src/components/yeti-table/tbody.gts"],"sourcesContent":["import Component from '@glimmer/component';\n\nimport { hash } from '@ember/helper';\n\nimport type { WithBoundArgs } from '@glint/template';\n\nimport TBodyRow from './tbody/row.gts';\nimport type {\n ColumnDefinition,\n Row,\n RowClickHandler,\n Theme,\n} from '../../types.ts';\n\n/**\n Renders a `<tbody>` element and yields the row component and data. You must iterate each row.\n\n @class TBody\n*/\n\nexport interface TBodySignature {\n Element: HTMLTableSectionElement;\n Args: {\n theme?: Theme;\n data?: Row[];\n columns?: ColumnDefinition[];\n onRowClick?: RowClickHandler;\n };\n Blocks: {\n default: [\n {\n row: WithBoundArgs<typeof TBodyRow, 'theme' | 'onClick' | 'columns'>;\n },\n Row[] | undefined,\n ];\n };\n}\n\n// eslint-disable-next-line ember/no-empty-glimmer-component-classes\nexport default class TBody extends Component<TBodySignature> {\n <template>\n <tbody class={{@theme.tbody}} ...attributes>\n {{yield\n (hash\n row=(component\n TBodyRow theme=@theme onClick=@onRowClick columns=@columns\n )\n )\n @data\n }}\n </tbody>\n </template>\n}\n"],"names":["TBody","Component","setComponentTemplate","precompileTemplate","strictMode","scope","hash","TBodyRow"],"mappings":";;;;;;AAsCA;AACe,MAAMA,cAAcC,SAAA,CAAU;AAC3C,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,6JAAA,EAWA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -5,26 +5,26 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
5
5
|
import { g, i } from 'decorator-transforms/runtime-esm';
|
|
6
6
|
|
|
7
7
|
class TFootCell extends Component {
|
|
8
|
-
static {
|
|
9
|
-
setComponentTemplate(precompileTemplate("{{#if this.column.visible}}\n <td class=\"{{@class}} {{@theme.tfootCell}}\" ...attributes>\n {{yield}}\n </td>\n{{/if}}", {
|
|
10
|
-
strictMode: true
|
|
11
|
-
}), this);
|
|
12
|
-
}
|
|
13
8
|
static {
|
|
14
9
|
g(this.prototype, "index", [tracked]);
|
|
15
10
|
}
|
|
16
11
|
#index = (i(this, "index"), void 0);
|
|
17
12
|
get column() {
|
|
18
|
-
return this.args.columns[this.index];
|
|
13
|
+
return this.args.columns?.[this.index ?? -1];
|
|
19
14
|
}
|
|
20
|
-
constructor() {
|
|
21
|
-
super(
|
|
15
|
+
constructor(owner, args) {
|
|
16
|
+
super(owner, args);
|
|
22
17
|
this.index = this.args.parent?.registerCell(this);
|
|
23
18
|
}
|
|
24
19
|
willDestroy() {
|
|
25
|
-
super.willDestroy(
|
|
20
|
+
super.willDestroy();
|
|
26
21
|
this.args.parent?.unregisterCell(this);
|
|
27
22
|
}
|
|
23
|
+
static {
|
|
24
|
+
setComponentTemplate(precompileTemplate("{{#if this.column.visible}}\n <td class=\"{{@class}} {{@theme.tfootCell}}\" ...attributes>\n {{yield}}\n </td>\n{{/if}}", {
|
|
25
|
+
strictMode: true
|
|
26
|
+
}), this);
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export { TFootCell as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/tfoot/row/cell.
|
|
1
|
+
{"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/tfoot/row/cell.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport type Owner from '@ember/owner';\n\nimport type { ColumnDefinition, Theme } from '../../../../types.ts';\n\n/**\n Renders a `<td>` element and yields for the developer to supply content.\n\n ```hbs\n <table.tfoot as |foot|>\n <foot.row as |row|>\n <row.cell>\n Footer content\n </row.cell>\n </foot.row>\n </table.tfoot>\n ```\n @class TFootCell\n */\n\nexport interface TFootCellParent {\n registerCell(cell: TFootCell): number;\n unregisterCell(cell: TFootCell): void;\n}\n\nexport interface TFootCellSignature {\n Element: HTMLTableCellElement;\n Args: {\n class?: string;\n theme?: Theme;\n parent?: TFootCellParent;\n columns?: ColumnDefinition[];\n };\n Blocks: { default: [] };\n}\n\nexport default class TFootCell extends Component<TFootCellSignature> {\n @tracked\n index: number | undefined;\n\n get column(): ColumnDefinition | undefined {\n return this.args.columns?.[this.index ?? -1];\n }\n\n constructor(owner: Owner, args: TFootCellSignature['Args']) {\n super(owner, args);\n\n this.index = this.args.parent?.registerCell(this);\n }\n\n willDestroy(): void {\n super.willDestroy();\n this.args.parent?.unregisterCell(this);\n }\n\n <template>\n {{#if this.column.visible}}\n <td class=\"{{@class}} {{@theme.tfootCell}}\" ...attributes>\n {{yield}}\n </td>\n {{/if}}\n </template>\n}\n"],"names":["TFootCell","Component","g","prototype","tracked","i","column","args","columns","index","constructor","owner","parent","registerCell","willDestroy","unregisterCell","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;AAqCe,MAAMA,kBAAkBC,SAAA,CAAU;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CAC9CC,OAAA,CAAA,CAAA;AAAA;EAAA,MAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,OAAA,CAAA,EAAA,MAAA;EAGD,IAAIC,MAAAA,GAAuC;AACzC,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,GAAG,IAAI,CAACC,KAAK,IAAI,EAAC,CAAE;AAC9C,EAAA;AAEAC,EAAAA,WAAAA,CAAYC,KAAY,EAAEJ,IAAgC,EAAE;AAC1D,IAAA,KAAK,CAACI,KAAA,EAAOJ,IAAA,CAAA;AAEb,IAAA,IAAI,CAACE,KAAK,GAAG,IAAI,CAACF,IAAI,CAACK,MAAM,EAAEC,YAAA,CAAa,IAAI,CAAA;AAClD,EAAA;AAEAC,EAAAA,WAAAA,GAAoB;IAClB,KAAK,CAACA,WAAA,EAAA;IACN,IAAI,CAACP,IAAI,CAACK,MAAM,EAAEG,eAAe,IAAI,CAAA;AACvC,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8HAAA,EAMA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -5,6 +5,17 @@ import { precompileTemplate } from '@ember/template-compilation';
|
|
|
5
5
|
import { setComponentTemplate } from '@ember/component';
|
|
6
6
|
|
|
7
7
|
class TFootRow extends Component {
|
|
8
|
+
cells = [];
|
|
9
|
+
registerCell(cell) {
|
|
10
|
+
const index = this.cells.length;
|
|
11
|
+
this.cells.push(cell);
|
|
12
|
+
return index;
|
|
13
|
+
}
|
|
14
|
+
unregisterCell(cell) {
|
|
15
|
+
const cells = this.cells;
|
|
16
|
+
const index = cells.indexOf(cell);
|
|
17
|
+
cells.splice(index, 1);
|
|
18
|
+
}
|
|
8
19
|
static {
|
|
9
20
|
setComponentTemplate(precompileTemplate("<tr class=\"{{@class}} {{@theme.tfootRow}} {{@theme.row}}\" ...attributes>\n {{yield (hash cell=(component Cell theme=@theme parent=this columns=@columns))}}\n</tr>", {
|
|
10
21
|
strictMode: true,
|
|
@@ -14,17 +25,6 @@ class TFootRow extends Component {
|
|
|
14
25
|
})
|
|
15
26
|
}), this);
|
|
16
27
|
}
|
|
17
|
-
cells = [];
|
|
18
|
-
registerCell(cell) {
|
|
19
|
-
let index = this.cells.length;
|
|
20
|
-
this.cells.push(cell);
|
|
21
|
-
return index;
|
|
22
|
-
}
|
|
23
|
-
unregisterCell(cell) {
|
|
24
|
-
let cells = this.cells;
|
|
25
|
-
let index = cells.indexOf(cell);
|
|
26
|
-
cells.splice(index, 1);
|
|
27
|
-
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export { TFootRow as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.js","sources":["../../../../src/components/yeti-table/tfoot/row.
|
|
1
|
+
{"version":3,"file":"row.js","sources":["../../../../src/components/yeti-table/tfoot/row.gts"],"sourcesContent":["import Component from '@glimmer/component';\n\nimport { hash } from '@ember/helper';\n\nimport type { WithBoundArgs } from '@glint/template';\n\nimport Cell from './row/cell.gts';\nimport type { ColumnDefinition, Theme } from '../../../types.ts';\n\n/**\n Renders a `<tr>` element and yields cell component.\n\n @class TFootRow\n @yield {object} row\n @yield {Component} row.cell\n*/\n\ninterface TFootCellLike {\n index?: number;\n}\n\nexport interface TFootRowSignature {\n Element: HTMLTableRowElement;\n Args: {\n class?: string;\n theme?: Theme;\n columns?: ColumnDefinition[];\n parent?: unknown;\n };\n Blocks: {\n default: [\n { cell: WithBoundArgs<typeof Cell, 'theme' | 'parent' | 'columns'> },\n ];\n };\n}\n\nexport default class TFootRow extends Component<TFootRowSignature> {\n cells: TFootCellLike[] = [];\n\n registerCell(cell: TFootCellLike): number {\n const index = this.cells.length;\n this.cells.push(cell);\n return index;\n }\n\n unregisterCell(cell: TFootCellLike): void {\n const cells = this.cells;\n const index = cells.indexOf(cell);\n cells.splice(index, 1);\n }\n\n <template>\n <tr class=\"{{@class}} {{@theme.tfootRow}} {{@theme.row}}\" ...attributes>\n {{yield\n (hash cell=(component Cell theme=@theme parent=this columns=@columns))\n }}\n </tr>\n </template>\n}\n"],"names":["TFootRow","Component","cells","registerCell","cell","index","length","push","unregisterCell","indexOf","splice","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Cell"],"mappings":";;;;;;AAoCe,MAAMA,iBAAiBC,SAAA,CAAU;AAC9CC,EAAAA,KAAA,GAAyB,EAAE;EAE3BC,YAAAA,CAAaC,IAAmB,EAAU;AACxC,IAAA,MAAMC,KAAA,GAAQ,IAAI,CAACH,KAAK,CAACI,MAAM;AAC/B,IAAA,IAAI,CAACJ,KAAK,CAACK,IAAI,CAACH,IAAA,CAAA;AAChB,IAAA,OAAOC,KAAA;AACT,EAAA;EAEAG,cAAAA,CAAeJ,IAAmB,EAAQ;AACxC,IAAA,MAAMF,KAAA,GAAQ,IAAI,CAACA,KAAK;AACxB,IAAA,MAAMG,KAAA,GAAQH,KAAA,CAAMO,OAAO,CAACL,IAAA,CAAA;AAC5BF,IAAAA,KAAA,CAAMQ,MAAM,CAACL,KAAA,EAAO,CAAA,CAAA;AACtB,EAAA;AAEA,EAAA;IAAAM,oBAAA,CAAAC,kBAAA,CAAA,uKAAA,EAMA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,cAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -4,6 +4,7 @@ import TFootRow from './tfoot/row.js';
|
|
|
4
4
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
5
|
import { setComponentTemplate } from '@ember/component';
|
|
6
6
|
|
|
7
|
+
// eslint-disable-next-line ember/no-empty-glimmer-component-classes
|
|
7
8
|
class TFoot extends Component {
|
|
8
9
|
static {
|
|
9
10
|
setComponentTemplate(precompileTemplate("<tfoot class={{@theme.tfoot}} ...attributes>\n {{yield (hash row=(component TFootRow columns=@columns theme=@theme parent=@parent))}}\n</tfoot>", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tfoot.js","sources":["../../../src/components/yeti-table/tfoot.
|
|
1
|
+
{"version":3,"file":"tfoot.js","sources":["../../../src/components/yeti-table/tfoot.gts"],"sourcesContent":["import Component from '@glimmer/component';\n\nimport { hash } from '@ember/helper';\n\nimport type { WithBoundArgs } from '@glint/template';\n\nimport TFootRow from './tfoot/row.gts';\nimport type { ColumnDefinition, Theme } from '../../types.ts';\n\n/**\n Renders a `<tfoot>` element and yields the row component.\n\n @class TTFoot\n*/\n\nexport interface TFootSignature {\n Element: HTMLTableSectionElement;\n Args: {\n theme?: Theme;\n columns?: ColumnDefinition[];\n parent?: unknown;\n };\n Blocks: {\n default: [\n { row: WithBoundArgs<typeof TFootRow, 'columns' | 'theme' | 'parent'> },\n ];\n };\n}\n\n// eslint-disable-next-line ember/no-empty-glimmer-component-classes\nexport default class TFoot extends Component<TFootSignature> {\n <template>\n <tfoot class={{@theme.tfoot}} ...attributes>\n {{yield\n (hash\n row=(component TFootRow columns=@columns theme=@theme parent=@parent)\n )\n }}\n </tfoot>\n </template>\n}\n"],"names":["TFoot","Component","setComponentTemplate","precompileTemplate","strictMode","scope","hash","TFootRow"],"mappings":";;;;;;AA6BA;AACe,MAAMA,cAAcC,SAAA,CAAU;AAC3C,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,kJAAA,EAQA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -3,21 +3,24 @@ import { precompileTemplate } from '@ember/template-compilation';
|
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
5
|
class THeadCell extends Component {
|
|
6
|
-
static {
|
|
7
|
-
setComponentTemplate(precompileTemplate("{{#if this.column.visible}}\n <th class=\"{{@class}} {{@theme.theadCell}}\" ...attributes>\n {{yield}}\n </th>\n{{/if}}", {
|
|
8
|
-
strictMode: true
|
|
9
|
-
}), this);
|
|
10
|
-
}
|
|
11
6
|
// Assigned when the cell is registered
|
|
12
7
|
column = undefined;
|
|
13
|
-
constructor() {
|
|
14
|
-
super(
|
|
8
|
+
constructor(owner, args) {
|
|
9
|
+
super(owner, args);
|
|
15
10
|
this.column = this.args.parent?.registerCell(this);
|
|
16
11
|
}
|
|
17
12
|
willDestroy() {
|
|
18
|
-
super.willDestroy(
|
|
13
|
+
super.willDestroy();
|
|
19
14
|
this.args.parent?.unregisterCell(this);
|
|
20
15
|
}
|
|
16
|
+
get prop() {
|
|
17
|
+
return this.args.prop;
|
|
18
|
+
}
|
|
19
|
+
static {
|
|
20
|
+
setComponentTemplate(precompileTemplate("{{#if this.column.visible}}\n <th class=\"{{@class}} {{@theme.theadCell}}\" ...attributes>\n {{yield}}\n </th>\n{{/if}}", {
|
|
21
|
+
strictMode: true
|
|
22
|
+
}), this);
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export { THeadCell as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/thead/row/cell.
|
|
1
|
+
{"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/thead/row/cell.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport type Owner from '@ember/owner';\n\nimport type { ColumnDefinition, Theme } from '../../../../types.ts';\n\n/**\n An component yielded from the head.row component that is used to define\n a cell in a row of the head of the table. Would be used for filters or any other\n additional information in the table head for a column\n\n ```hbs\n <table.thead as |head|>\n <head.row as |row|>\n <row.cell>\n <input\n class=\"input\" type=\"search\" placeholder=\"Search last name\"\n value={{this.lastNameFilter}}\n {{on \"input\"\n (pipe\n (pick \"target.value\")\n (fn (mut this.lastNameFilter))\n )\n }}\n >\n </row.cell>\n </head.row>\n </table.thead>\n ```\n\n @class THeadCell\n @yield {object} cell\n\n */\nexport interface THeadCellParent {\n registerCell(cell: THeadCell): ColumnDefinition | undefined;\n unregisterCell(cell: THeadCell): void;\n}\n\nexport interface THeadCellSignature {\n Element: HTMLTableCellElement;\n Args: {\n class?: string;\n theme?: Theme;\n parent?: THeadCellParent;\n prop?: string;\n };\n Blocks: { default: [] };\n}\n\nexport default class THeadCell extends Component<THeadCellSignature> {\n // Assigned when the cell is registered\n column: ColumnDefinition | undefined = undefined;\n\n constructor(owner: Owner, args: THeadCellSignature['Args']) {\n super(owner, args);\n this.column = this.args.parent?.registerCell(this);\n }\n\n willDestroy(): void {\n super.willDestroy();\n this.args.parent?.unregisterCell(this);\n }\n\n get prop(): string | undefined {\n return this.args.prop;\n }\n\n <template>\n {{#if this.column.visible}}\n <th class=\"{{@class}} {{@theme.theadCell}}\" ...attributes>\n {{yield}}\n </th>\n {{/if}}\n </template>\n}\n"],"names":["THeadCell","Component","column","undefined","constructor","owner","args","parent","registerCell","willDestroy","unregisterCell","prop","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;AAiDe,MAAMA,kBAAkBC,SAAA,CAAU;AAC/C;AACAC,EAAAA,MAAA,GAAuCC,SAAA;AAEvCC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAgC,EAAE;AAC1D,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AACb,IAAA,IAAI,CAACJ,MAAM,GAAG,IAAI,CAACI,IAAI,CAACC,MAAM,EAAEC,YAAA,CAAa,IAAI,CAAA;AACnD,EAAA;AAEAC,EAAAA,WAAAA,GAAoB;IAClB,KAAK,CAACA,WAAA,EAAA;IACN,IAAI,CAACH,IAAI,CAACC,MAAM,EAAEG,eAAe,IAAI,CAAA;AACvC,EAAA;EAEA,IAAIC,IAAAA,GAA2B;AAC7B,IAAA,OAAO,IAAI,CAACL,IAAI,CAACK,IAAI;AACvB,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8HAAA,EAMA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|