@triptyk/ember-yeti-table 3.0.0

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.
Files changed (89) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +132 -0
  3. package/addon-main.cjs +4 -0
  4. package/declarations/themes/default-theme.d.ts +28 -0
  5. package/declarations/themes/default-theme.d.ts.map +1 -0
  6. package/declarations/utils/create-regex.d.ts +2 -0
  7. package/declarations/utils/create-regex.d.ts.map +1 -0
  8. package/declarations/utils/filtering-utils.d.ts +5 -0
  9. package/declarations/utils/filtering-utils.d.ts.map +1 -0
  10. package/declarations/utils/sorting-utils.d.ts +24 -0
  11. package/declarations/utils/sorting-utils.d.ts.map +1 -0
  12. package/dist/_app_/components/yeti-table/body.js +1 -0
  13. package/dist/_app_/components/yeti-table/header.js +1 -0
  14. package/dist/_app_/components/yeti-table/pagination.js +1 -0
  15. package/dist/_app_/components/yeti-table/table.js +1 -0
  16. package/dist/_app_/components/yeti-table/tbody/row/cell.js +1 -0
  17. package/dist/_app_/components/yeti-table/tbody/row.js +1 -0
  18. package/dist/_app_/components/yeti-table/tbody.js +1 -0
  19. package/dist/_app_/components/yeti-table/tfoot/row/cell.js +1 -0
  20. package/dist/_app_/components/yeti-table/tfoot/row.js +1 -0
  21. package/dist/_app_/components/yeti-table/tfoot.js +1 -0
  22. package/dist/_app_/components/yeti-table/thead/row/cell.js +1 -0
  23. package/dist/_app_/components/yeti-table/thead/row/column.js +1 -0
  24. package/dist/_app_/components/yeti-table/thead/row.js +1 -0
  25. package/dist/_app_/components/yeti-table/thead.js +1 -0
  26. package/dist/_app_/components/yeti-table.js +1 -0
  27. package/dist/_app_/themes/default-theme.js +1 -0
  28. package/dist/_app_/utils/create-regex.js +1 -0
  29. package/dist/_app_/utils/filtering-utils.js +1 -0
  30. package/dist/_app_/utils/sorting-utils.js +1 -0
  31. package/dist/components/yeti-table/body.js +37 -0
  32. package/dist/components/yeti-table/body.js.map +1 -0
  33. package/dist/components/yeti-table/header.js +30 -0
  34. package/dist/components/yeti-table/header.js.map +1 -0
  35. package/dist/components/yeti-table/pagination.js +86 -0
  36. package/dist/components/yeti-table/pagination.js.map +1 -0
  37. package/dist/components/yeti-table/table.js +38 -0
  38. package/dist/components/yeti-table/table.js.map +1 -0
  39. package/dist/components/yeti-table/tbody/row/cell.js +35 -0
  40. package/dist/components/yeti-table/tbody/row/cell.js.map +1 -0
  41. package/dist/components/yeti-table/tbody/row.js +47 -0
  42. package/dist/components/yeti-table/tbody/row.js.map +1 -0
  43. package/dist/components/yeti-table/tbody.js +20 -0
  44. package/dist/components/yeti-table/tbody.js.map +1 -0
  45. package/dist/components/yeti-table/tfoot/row/cell.js +31 -0
  46. package/dist/components/yeti-table/tfoot/row/cell.js.map +1 -0
  47. package/dist/components/yeti-table/tfoot/row.js +31 -0
  48. package/dist/components/yeti-table/tfoot/row.js.map +1 -0
  49. package/dist/components/yeti-table/tfoot.js +20 -0
  50. package/dist/components/yeti-table/tfoot.js.map +1 -0
  51. package/dist/components/yeti-table/thead/row/cell.js +24 -0
  52. package/dist/components/yeti-table/thead/row/cell.js.map +1 -0
  53. package/dist/components/yeti-table/thead/row/column.js +202 -0
  54. package/dist/components/yeti-table/thead/row/column.js.map +1 -0
  55. package/dist/components/yeti-table/thead/row.js +41 -0
  56. package/dist/components/yeti-table/thead/row.js.map +1 -0
  57. package/dist/components/yeti-table/thead.js +35 -0
  58. package/dist/components/yeti-table/thead.js.map +1 -0
  59. package/dist/components/yeti-table.js +618 -0
  60. package/dist/components/yeti-table.js.map +1 -0
  61. package/dist/themes/default-theme.js +51 -0
  62. package/dist/themes/default-theme.js.map +1 -0
  63. package/dist/utils/create-regex.js +34 -0
  64. package/dist/utils/create-regex.js.map +1 -0
  65. package/dist/utils/filtering-utils.js +55 -0
  66. package/dist/utils/filtering-utils.js.map +1 -0
  67. package/dist/utils/sorting-utils.js +93 -0
  68. package/dist/utils/sorting-utils.js.map +1 -0
  69. package/package.json +124 -0
  70. package/src/.gitkeep +0 -0
  71. package/src/components/yeti-table/body.gjs +94 -0
  72. package/src/components/yeti-table/header.gjs +54 -0
  73. package/src/components/yeti-table/pagination.gjs +155 -0
  74. package/src/components/yeti-table/table.gjs +34 -0
  75. package/src/components/yeti-table/tbody/row/cell.gjs +51 -0
  76. package/src/components/yeti-table/tbody/row.gjs +89 -0
  77. package/src/components/yeti-table/tbody.gjs +55 -0
  78. package/src/components/yeti-table/tfoot/row/cell.gjs +45 -0
  79. package/src/components/yeti-table/tfoot/row.gjs +44 -0
  80. package/src/components/yeti-table/tfoot.gjs +33 -0
  81. package/src/components/yeti-table/thead/row/cell.gjs +52 -0
  82. package/src/components/yeti-table/thead/row/column.gjs +260 -0
  83. package/src/components/yeti-table/thead/row.gjs +71 -0
  84. package/src/components/yeti-table/thead.gjs +45 -0
  85. package/src/components/yeti-table.gjs +780 -0
  86. package/src/themes/default-theme.js +53 -0
  87. package/src/utils/create-regex.js +65 -0
  88. package/src/utils/filtering-utils.js +75 -0
  89. package/src/utils/sorting-utils.js +108 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row.js","sources":["../../../../src/components/yeti-table/tbody/row.gjs"],"sourcesContent":["import { action } from '@ember/object';\n\nimport Component from '@glimmer/component';\n\n/**\n Renders a `<tr>` element and yields the cell component.\n ```hbs\n <body.row as |row|>\n <row.cell>\n {{person.firstName}} #{{index}}\n </row.cell>\n <row.cell>\n {{person.lastName}}\n </row.cell>\n <row.cell>\n {{person.points}}\n </row.cell>\n </body.row>\n ```\n Remember you can customize each `<tr>` class or `@onClick` handler based on the row data\n because you have access to it from the body component.\n\n ```hbs\n <table.body as |body person|>\n <body.row class={{if person.isInvalid \"error\"}} as |row|>\n <row.cell>\n {{person.firstName}}\n </row.cell>\n <row.cell>\n {{person.lastName}}\n </row.cell>\n <row.cell>\n {{person.points}}\n </row.cell>\n </body.row>\n </table.body>\n ```\n\n @class TBodyRow\n @yield {object} row\n @yield {Component} row.cell - the cell component\n*/\n// template imports\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport Cell from './row/cell.gjs';\n\nexport default class TBodyRow extends Component {\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 /**\n * Adds a click action to the row.\n *\n * @argument onClick\n * @type Function\n */\n\n cells = [];\n\n registerCell(cell) {\n let index = this.cells.length;\n this.cells.push(cell);\n return index;\n }\n\n unregisterCell(cell) {\n let cells = this.cells;\n let index = cells.indexOf(cell);\n\n cells.splice(index, 1);\n }\n\n @action\n handleClick() {\n this.args.onClick?.(...arguments);\n }\n}\n"],"names":["TBodyRow","Component","setComponentTemplate","precompileTemplate","strictMode","scope","on","hash","Cell","cells","registerCell","cell","index","length","push","unregisterCell","indexOf","splice","handleClick","args","onClick","arguments","n","prototype","action"],"mappings":";;;;;;;;;AA+Ce,MAAMA,QAAA,SAAiBC,SAAA,CAAA;AACpC,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;AAEV;;;;;;AAOAC,EAAAA,KAAA,GAAQ,EAAE;EAEVC,YAAAA,CAAaC,IAAI,EAAE;AACjB,IAAA,IAAIC,KAAA,GAAQ,IAAI,CAACH,KAAK,CAACI,MAAM;AAC7B,IAAA,IAAI,CAACJ,KAAK,CAACK,IAAI,CAACH,IAAA,CAAA;AAChB,IAAA,OAAOC,KAAA;AACT,EAAA;EAEAG,cAAAA,CAAeJ,IAAI,EAAE;AACnB,IAAA,IAAIF,KAAA,GAAQ,IAAI,CAACA,KAAK;AACtB,IAAA,IAAIG,KAAA,GAAQH,KAAA,CAAMO,OAAO,CAACL,IAAA,CAAA;AAE1BF,IAAAA,KAAA,CAAMQ,MAAM,CAACL,KAAA,EAAO,CAAA,CAAA;AACtB,EAAA;AAGAM,EAAAA,WAAAA,GAAc;AACZ,IAAA,IAAI,CAACC,IAAI,CAACC,OAAO,GAAA,GAAMC,SAAA,CAAA;AACzB,EAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAHCC,MAAA,CAAA,CAAA;AAAA;AAIH;;;;"}
@@ -0,0 +1,20 @@
1
+ import Component from '@glimmer/component';
2
+ import { hash } from '@ember/helper';
3
+ import TBodyRow from './tbody/row.js';
4
+ import { precompileTemplate } from '@ember/template-compilation';
5
+ import { setComponentTemplate } from '@ember/component';
6
+
7
+ class TBody extends Component {
8
+ static {
9
+ setComponentTemplate(precompileTemplate("<tbody class={{@theme.tbody}} ...attributes>\n {{yield (hash row=(component TBodyRow theme=@theme onClick=@onRowClick columns=@columns)) @data}}\n</tbody>", {
10
+ strictMode: true,
11
+ scope: () => ({
12
+ hash,
13
+ TBodyRow
14
+ })
15
+ }), this);
16
+ }
17
+ }
18
+
19
+ export { TBody as default };
20
+ //# sourceMappingURL=tbody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tbody.js","sources":["../../../src/components/yeti-table/tbody.gjs"],"sourcesContent":["import Component from '@glimmer/component';\n\n/**\n Renders a `<tbody>` element and yields the row component and data. You must iterate each row\n ```hbs\n <table.tbody as |body data|>\n {{#each data as |person index|}}\n <body.row as |row|>\n <row.cell>\n {{person.firstName}} #{{index}}\n </row.cell>\n <row.cell>\n {{person.lastName}}\n </row.cell>\n <row.cell>\n {{person.points}}\n </row.cell>\n </body.row>\n {{/each}}\n </table.tbody>\n ```\n Remember that you must perform the {{#each}} to iterate over the `@data` array.\n\n This component does not provide a blockless variation\n\n @class TBody\n @yield {object} body\n @yield {Component} body.row - the row component\n @yield {Array} data\n*/\nimport { hash } from '@ember/helper';\nimport TBodyRow from './tbody/row.gjs';\n\n// eslint-disable-next-line ember/no-empty-glimmer-component-classes\nexport default class TBody extends Component {\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 * Adds a click action to each row, called with the clicked row's data as an argument.\n * Can be used with both the blockless and block invocations.\n *\n * @argument onRowClick\n * @type Function\n */\n}\n"],"names":["TBody","Component","setComponentTemplate","precompileTemplate","strictMode","scope","hash","TBodyRow"],"mappings":";;;;;;AAkCe,MAAMA,KAAA,SAAcC,SAAA,CAAA;AACjC,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;AAQZ;;;;"}
@@ -0,0 +1,31 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked } from '@glimmer/tracking';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+ import { g, i } from 'decorator-transforms/runtime-esm';
6
+
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
+ static {
14
+ g(this.prototype, "index", [tracked]);
15
+ }
16
+ #index = (i(this, "index"), void 0);
17
+ get column() {
18
+ return this.args.columns[this.index];
19
+ }
20
+ constructor() {
21
+ super(...arguments);
22
+ this.index = this.args.parent?.registerCell(this);
23
+ }
24
+ willDestroy() {
25
+ super.willDestroy(...arguments);
26
+ this.args.parent?.unregisterCell(this);
27
+ }
28
+ }
29
+
30
+ export { TFootCell as default };
31
+ //# sourceMappingURL=cell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/tfoot/row/cell.gjs"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\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 default class TFootCell extends Component {\n <template>\n {{#if this.column.visible}}\n <td class=\"{{@class}} {{@theme.tfootCell}}\" ...attributes>\n {{yield}}\n </td>\n {{/if}}\n </template>\n\n @tracked\n index;\n\n get column() {\n return this.args.columns[this.index];\n }\n\n constructor() {\n super(...arguments);\n\n this.index = this.args.parent?.registerCell(this);\n }\n\n willDestroy() {\n super.willDestroy(...arguments);\n this.args.parent?.unregisterCell(this);\n }\n}\n"],"names":["TFootCell","Component","setComponentTemplate","precompileTemplate","strictMode","g","prototype","tracked","i","column","args","columns","index","constructor","arguments","parent","registerCell","willDestroy","unregisterCell"],"mappings":";;;;;;AAkBe,MAAMA,SAAA,SAAkBC,SAAA,CAAA;AACrC,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8HAAA,EAMA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AANA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CAQTC,OAAA,CAAA,CAAA;AAAA;EAAA,MAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,OAAA,CAAA,EAAA,MAAA;EAGD,IAAIC,MAAAA,GAAS;IACX,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,CAAC,IAAI,CAACC,KAAK,CAAC;AACtC,EAAA;AAEAC,EAAAA,WAAAA,GAAc;IACZ,KAAK,CAAA,GAAIC,SAAA,CAAA;AAET,IAAA,IAAI,CAACF,KAAK,GAAG,IAAI,CAACF,IAAI,CAACK,MAAM,EAAEC,YAAA,CAAa,IAAI,CAAA;AAClD,EAAA;AAEAC,EAAAA,WAAAA,GAAc;AACZ,IAAA,KAAK,CAACA,WAAA,CAAA,GAAeH,SAAA,CAAA;IACrB,IAAI,CAACJ,IAAI,CAACK,MAAM,EAAEG,eAAe,IAAI,CAAA;AACvC,EAAA;AACF;;;;"}
@@ -0,0 +1,31 @@
1
+ import Component from '@glimmer/component';
2
+ import { hash } from '@ember/helper';
3
+ import TFootCell from './row/cell.js';
4
+ import { precompileTemplate } from '@ember/template-compilation';
5
+ import { setComponentTemplate } from '@ember/component';
6
+
7
+ class TFootRow extends Component {
8
+ static {
9
+ 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
+ strictMode: true,
11
+ scope: () => ({
12
+ hash,
13
+ Cell: TFootCell
14
+ })
15
+ }), this);
16
+ }
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
+ }
29
+
30
+ export { TFootRow as default };
31
+ //# sourceMappingURL=row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row.js","sources":["../../../../src/components/yeti-table/tfoot/row.gjs"],"sourcesContent":["import Component from '@glimmer/component';\n\n/**\n Renders a `<tr>` element and yields cell component.\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\n @class TFootRow\n @yield {object} row\n @yield {Component} row.cell\n*/\n\nimport { hash } from '@ember/helper';\nimport Cell from './row/cell.gjs';\n\nexport default class TFootRow extends Component {\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 cells = [];\n\n registerCell(cell) {\n let index = this.cells.length;\n this.cells.push(cell);\n return index;\n }\n\n unregisterCell(cell) {\n let cells = this.cells;\n let index = cells.indexOf(cell);\n cells.splice(index, 1);\n }\n}\n"],"names":["TFootRow","Component","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Cell","cells","registerCell","cell","index","length","push","unregisterCell","indexOf","splice"],"mappings":";;;;;;AAsBe,MAAMA,QAAA,SAAiBC,SAAA,CAAA;AACpC,EAAA;IAAAC,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;AACVC,EAAAA,KAAA,GAAQ,EAAE;EAEVC,YAAAA,CAAaC,IAAI,EAAE;AACjB,IAAA,IAAIC,KAAA,GAAQ,IAAI,CAACH,KAAK,CAACI,MAAM;AAC7B,IAAA,IAAI,CAACJ,KAAK,CAACK,IAAI,CAACH,IAAA,CAAA;AAChB,IAAA,OAAOC,KAAA;AACT,EAAA;EAEAG,cAAAA,CAAeJ,IAAI,EAAE;AACnB,IAAA,IAAIF,KAAA,GAAQ,IAAI,CAACA,KAAK;AACtB,IAAA,IAAIG,KAAA,GAAQH,KAAA,CAAMO,OAAO,CAACL,IAAA,CAAA;AAC1BF,IAAAA,KAAA,CAAMQ,MAAM,CAACL,KAAA,EAAO,CAAA,CAAA;AACtB,EAAA;AACF;;;;"}
@@ -0,0 +1,20 @@
1
+ import Component from '@glimmer/component';
2
+ import { hash } from '@ember/helper';
3
+ import TFootRow from './tfoot/row.js';
4
+ import { precompileTemplate } from '@ember/template-compilation';
5
+ import { setComponentTemplate } from '@ember/component';
6
+
7
+ class TFoot extends Component {
8
+ static {
9
+ setComponentTemplate(precompileTemplate("<tfoot class={{@theme.tfoot}} ...attributes>\n {{yield (hash row=(component TFootRow columns=@columns theme=@theme parent=@parent))}}\n</tfoot>", {
10
+ strictMode: true,
11
+ scope: () => ({
12
+ hash,
13
+ TFootRow
14
+ })
15
+ }), this);
16
+ }
17
+ }
18
+
19
+ export { TFoot as default };
20
+ //# sourceMappingURL=tfoot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tfoot.js","sources":["../../../src/components/yeti-table/tfoot.gjs"],"sourcesContent":["import Component from '@glimmer/component';\n\n/**\n Renders a `<tfoot>` element and yields the row component.\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\n @class TTFoot\n @yield {object} footer\n @yield {Component} footer.row\n*/\nimport { hash } from '@ember/helper';\nimport TFootRow from './tfoot/row.gjs';\n\n// eslint-disable-next-line ember/no-empty-glimmer-component-classes\nexport default class TFoot extends Component {\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":";;;;;;AAsBe,MAAMA,KAAA,SAAcC,SAAA,CAAA;AACjC,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;;;;"}
@@ -0,0 +1,24 @@
1
+ import Component from '@glimmer/component';
2
+ import { precompileTemplate } from '@ember/template-compilation';
3
+ import { setComponentTemplate } from '@ember/component';
4
+
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
+ // Assigned when the cell is registered
12
+ column = undefined;
13
+ constructor() {
14
+ super(...arguments);
15
+ this.column = this.args.parent?.registerCell(this);
16
+ }
17
+ willDestroy() {
18
+ super.willDestroy(...arguments);
19
+ this.args.parent?.unregisterCell(this);
20
+ }
21
+ }
22
+
23
+ export { THeadCell as default };
24
+ //# sourceMappingURL=cell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell.js","sources":["../../../../../src/components/yeti-table/thead/row/cell.gjs"],"sourcesContent":["import Component from '@glimmer/component';\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 default class THeadCell extends Component {\n <template>\n {{#if this.column.visible}}\n <th class=\"{{@class}} {{@theme.theadCell}}\" ...attributes>\n {{yield}}\n </th>\n {{/if}}\n </template>\n\n // Assigned when the cell is registered\n column = undefined;\n\n constructor() {\n super(...arguments);\n this.column = this.args.parent?.registerCell(this);\n }\n\n willDestroy() {\n super.willDestroy(...arguments);\n this.args.parent?.unregisterCell(this);\n }\n}\n"],"names":["THeadCell","Component","setComponentTemplate","precompileTemplate","strictMode","column","undefined","constructor","arguments","args","parent","registerCell","willDestroy","unregisterCell"],"mappings":";;;;AA8Be,MAAMA,SAAA,SAAkBC,SAAA,CAAA;AACrC,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8HAAA,EAMA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AAEV;AACAC,EAAAA,MAAA,GAASC,SAAA;AAETC,EAAAA,WAAAA,GAAc;IACZ,KAAK,CAAA,GAAIC,SAAA,CAAA;AACT,IAAA,IAAI,CAACH,MAAM,GAAG,IAAI,CAACI,IAAI,CAACC,MAAM,EAAEC,YAAA,CAAa,IAAI,CAAA;AACnD,EAAA;AAEAC,EAAAA,WAAAA,GAAc;AACZ,IAAA,KAAK,CAACA,WAAA,CAAA,GAAeJ,SAAA,CAAA;IACrB,IAAI,CAACC,IAAI,CAACC,MAAM,EAAEG,eAAe,IAAI,CAAA;AACvC,EAAA;AACF;;;;"}
@@ -0,0 +1,202 @@
1
+ import { isArray } from '@ember/array';
2
+ import { assert } from '@ember/debug';
3
+ import Component from '@glimmer/component';
4
+ import { modifier } from 'ember-modifier';
5
+ import { localCopy } from 'tracked-toolbox';
6
+ import { on } from '@ember/modifier';
7
+ import { hash, fn } from '@ember/helper';
8
+ import { precompileTemplate } from '@ember/template-compilation';
9
+ import { setComponentTemplate } from '@ember/component';
10
+ import { g, i } from 'decorator-transforms/runtime-esm';
11
+
12
+ class Column extends Component {
13
+ static {
14
+ setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-invalid-interactive --}}\n{{#if this.visible}}\n <th role={{if this.sortable \"button\"}} class=\"{{@class}}\n {{@theme.theadCell}}\n {{if this.sortable @theme.sorting.columnSortable}}\n {{if this.isSorted @theme.sorting.columnSorted}}\n {{if this.isAscSorted @theme.sorting.columnSortedAsc}}\n {{if this.isDescSorted @theme.sorting.columnSortedDesc}}\" {{on \"click\" (if this.sortable (fn @onClick this) this.noop)}} {{this.updateName}} ...attributes>\n {{yield (hash isSorted=this.isSorted isAscSorted=this.isAscSorted isDescSorted=this.isDescSorted)}}\n </th>\n{{/if}}", {
15
+ strictMode: true,
16
+ scope: () => ({
17
+ on,
18
+ fn,
19
+ hash
20
+ })
21
+ }), this);
22
+ }
23
+ /**
24
+ * An important argument that Yeti Table uses to tie this column to a certain property on
25
+ * each row object of the original `@data` (or `@loadFunction`) that was passed in.
26
+ *
27
+ * This is the argument that Yeti Table uses to filter and sort the data.
28
+ *
29
+ * This argument also allows Yeti Table to keep itself up to date when the original
30
+ * data changes. NOTE: If this property is a nested property (one that contains periods),
31
+ * the table will not update when this property changes. This is due to `@each` only supporting
32
+ * one level of properties.
33
+ *
34
+ * If you don't need sorting, filtering or automatic table unrolling (using the blockless
35
+ * body component), then this property is optional.
36
+ *
37
+ * @argument prop
38
+ * @type {String}
39
+ */
40
+ get prop() {
41
+ return this.args.prop;
42
+ }
43
+ /**
44
+ * Set to `false` to hide the entire column across all rows. Keep in mind that this property
45
+ * won't just hide the column using css. The DOM for the column will be removed. Defaults to `true`.
46
+ *
47
+ * @argument visible
48
+ * @type {Boolean}
49
+ */
50
+ static {
51
+ g(this.prototype, "visible", [localCopy('args.visible', true)]);
52
+ }
53
+ #visible = (i(this, "visible"), void 0);
54
+ static {
55
+ g(this.prototype, "sortable", [localCopy('args.sortable', true)]);
56
+ }
57
+ #sortable = (i(this, "sortable"), void 0);
58
+ /**
59
+ * Used to turn off sorting clicking on this column (clicks won't toggle sorting anymore).
60
+ * Useful on avatar columns, for example, where a sorting order doesn't really make sense.
61
+ * Defaults to the `<YetiTable>` `@sortable` argument (which in turn defaults to `true`).
62
+ *
63
+ * @argument sortable
64
+ * @type Boolean
65
+ */
66
+ static {
67
+ g(this.prototype, "sort", [localCopy('args.sort')]);
68
+ }
69
+ #sort = (i(this, "sort"), void 0);
70
+ /**
71
+ * Optionally use an `asc` or `desc` string on this argument to turn on ascending or descending sorting
72
+ * on this column. Useful to turn on default sortings on the table.
73
+ * @argument sort
74
+ * @type {String}
75
+ */
76
+ static {
77
+ g(this.prototype, "filterable", [localCopy('args.filterable', true)]);
78
+ }
79
+ #filterable = (i(this, "filterable"), void 0);
80
+ /**
81
+ * Use `@sortSequence` to customize the sequence in which the sorting order will cycle when
82
+ * clicking on this column header. You can either pass in a comma-separated string or an array
83
+ * of strings. Accepted values are `'asc'`, `'desc'` and `'unsorted'`. The default value is `['asc', 'desc']`
84
+ * or whatever the global table sortSequence value is.
85
+ *
86
+ * @argument sortSequence
87
+ * @type Array
88
+ */
89
+ /**
90
+ * Used to turn off filtering for this column. When `false`, Yeti Table won't look for
91
+ * values on this column. Defaults to `true`.
92
+ *
93
+ * @argument filterable
94
+ * @type {Boolean}
95
+ */
96
+ /**
97
+ * The column filter. If passed in, Yeti Table will search this column for rows that contain this
98
+ * string and show those rows.
99
+ *
100
+ * The column definitions `@filter` argument is subtractive, meaning that it will filter out rows
101
+ * from the subset that passes the general `@filter`.
102
+ *
103
+ * @argument filter
104
+ * @type {String}
105
+ */
106
+ get filter() {
107
+ return this.args.filter;
108
+ }
109
+ /**
110
+ * An optional function to customize the filtering logic *on this column*. This function should return true
111
+ * or false to either include or exclude the row on the resulting set. If this function depends
112
+ * on a value, pass that value as the `@filterUsing` argument.
113
+ *
114
+ * This function will be called with two arguments:
115
+ * - `value` - the current data cell to use for filtering
116
+ * - `filterUsing` - the value you passed in as `@filterUsing`
117
+ *
118
+ * @argument filterFunction
119
+ * @type {Function}
120
+ */
121
+ get filterFunction() {
122
+ return this.args.filterFunction;
123
+ }
124
+ /**
125
+ * If you `@filterFunction` function depends on a different value (other that `@filter`)
126
+ * to show, pass it in this argument. Yeti Table uses this argument to know when to recalculate
127
+ * the fitlered rows.
128
+ *
129
+ * @argument filterUsing
130
+ * @type {String}
131
+ */
132
+ get filterUsing() {
133
+ return this.args.filterUsing;
134
+ }
135
+ /**
136
+ * Used to add a class to all the cells in this column.
137
+ *
138
+ * @argument columnClass
139
+ * @type {String}
140
+ */
141
+ get columnClass() {
142
+ return this.args.columnClass;
143
+ }
144
+ /**
145
+ * This property is a human-readable representation of the name of the column.
146
+ * It defaults to the trimmed `textContent` of the `<th>` element, but can be overridden
147
+ * by using a `@name="your custom name"` argument.
148
+ *
149
+ * @argument name
150
+ * @type {String}
151
+ */
152
+ static {
153
+ g(this.prototype, "name", [localCopy('args.name')]);
154
+ }
155
+ #name = (i(this, "name"), void 0);
156
+ /**
157
+ * An optional function to be invoked whenever this column is clicked
158
+ *
159
+ * This function will be called with two arguments:
160
+ * - `column` - the column that was clicked
161
+ *
162
+ * @argument onClick
163
+ * @type {Function}
164
+ */
165
+ get isAscSorted() {
166
+ return this.sort === 'asc';
167
+ }
168
+ get isDescSorted() {
169
+ return this.sort === 'desc';
170
+ }
171
+ get isSorted() {
172
+ return this.isAscSorted || this.isDescSorted;
173
+ }
174
+ get normalizedSortSequence() {
175
+ let sortSequence = this.args.sortSequence;
176
+ assert('@sortSequence must be either a comma-separated string or an array. Got `${sortSequence}.`', isArray(sortSequence) || typeof sortSequence === 'string');
177
+ if (isArray(sortSequence)) {
178
+ return sortSequence;
179
+ } else if (typeof sortSequence === 'string') {
180
+ return sortSequence.split(',').map(s => s.trim());
181
+ } else {
182
+ return [];
183
+ }
184
+ }
185
+ constructor() {
186
+ super(...arguments);
187
+ this.args.parent?.registerColumn(this);
188
+ }
189
+ willDestroy() {
190
+ super.willDestroy(...arguments);
191
+ this.args.parent?.unregisterColumn(this);
192
+ }
193
+ updateName = modifier(element => {
194
+ if (!this.args.name) {
195
+ this.name = element.textContent.trim();
196
+ }
197
+ });
198
+ noop = () => {};
199
+ }
200
+
201
+ export { Column as default };
202
+ //# sourceMappingURL=column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column.js","sources":["../../../../../src/components/yeti-table/thead/row/column.gjs"],"sourcesContent":["import { isArray } from '@ember/array';\nimport { assert } from '@ember/debug';\n\nimport Component from '@glimmer/component';\nimport { modifier } from 'ember-modifier';\nimport { localCopy } from 'tracked-toolbox';\n\n/**\n An important component yielded from the header or head.row component that is used to define\n a column of the table.\n\n ```hbs\n <table.header as |header|>\n <header.column @prop=\"firstName\" as |column|>\n First name\n {{if column.isAscSorted \"(sorted asc)\"}}\n {{if column.isDescSorted \"(sorted desc)\"}}\n </header.column>\n </table.header>\n ```\n\n ```hbs\n <table.thead as |head|>\n <head.row as |row|>\n <row.column @prop=\"firstName\" as |column|>\n First name\n {{if column.isAscSorted \"(sorted asc)\"}}\n {{if column.isDescSorted \"(sorted desc)\"}}\n </row.column>\n </head.row>\n </table.thead>\n ```\n\n @class Column\n @yield {object} column\n @yield {boolean} column.isSorted - `true` if column is sorted ascending or descending\n @yield {boolean} column.isAscSorted - `true` if column is sorted ascending\n @yield {boolean} column.isDescSorted - `true` if column is sorted descending\n*/\nimport { on } from '@ember/modifier';\nimport { fn, hash } from '@ember/helper';\n\nexport default class Column extends Component {\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n {{#if this.visible}}\n <th\n role={{if this.sortable \"button\"}}\n class=\"{{@class}}\n {{@theme.theadCell}}\n {{if this.sortable @theme.sorting.columnSortable}}\n {{if this.isSorted @theme.sorting.columnSorted}}\n {{if this.isAscSorted @theme.sorting.columnSortedAsc}}\n {{if this.isDescSorted @theme.sorting.columnSortedDesc}}\"\n {{on \"click\" (if this.sortable (fn @onClick this) this.noop)}}\n {{this.updateName}}\n ...attributes\n >\n {{yield\n (hash\n isSorted=this.isSorted\n isAscSorted=this.isAscSorted\n isDescSorted=this.isDescSorted\n )\n }}\n </th>\n {{/if}}\n </template>\n /**\n * An important argument that Yeti Table uses to tie this column to a certain property on\n * each row object of the original `@data` (or `@loadFunction`) that was passed in.\n *\n * This is the argument that Yeti Table uses to filter and sort the data.\n *\n * This argument also allows Yeti Table to keep itself up to date when the original\n * data changes. NOTE: If this property is a nested property (one that contains periods),\n * the table will not update when this property changes. This is due to `@each` only supporting\n * one level of properties.\n *\n * If you don't need sorting, filtering or automatic table unrolling (using the blockless\n * body component), then this property is optional.\n *\n * @argument prop\n * @type {String}\n */\n get prop() {\n return this.args.prop;\n }\n\n /**\n * Set to `false` to hide the entire column across all rows. Keep in mind that this property\n * won't just hide the column using css. The DOM for the column will be removed. Defaults to `true`.\n *\n * @argument visible\n * @type {Boolean}\n */\n @localCopy('args.visible', true)\n visible;\n\n /**\n * Used to turn off sorting clicking on this column (clicks won't toggle sorting anymore).\n * Useful on avatar columns, for example, where a sorting order doesn't really make sense.\n * Defaults to the `<YetiTable>` `@sortable` argument (which in turn defaults to `true`).\n *\n * @argument sortable\n * @type Boolean\n */\n @localCopy('args.sortable', true)\n sortable;\n\n /**\n * Optionally use an `asc` or `desc` string on this argument to turn on ascending or descending sorting\n * on this column. Useful to turn on default sortings on the table.\n\n * @argument sort\n * @type {String}\n */\n @localCopy('args.sort')\n sort;\n\n /**\n * Use `@sortSequence` to customize the sequence in which the sorting order will cycle when\n * clicking on this column header. You can either pass in a comma-separated string or an array\n * of strings. Accepted values are `'asc'`, `'desc'` and `'unsorted'`. The default value is `['asc', 'desc']`\n * or whatever the global table sortSequence value is.\n *\n * @argument sortSequence\n * @type Array\n */\n\n /**\n * Used to turn off filtering for this column. When `false`, Yeti Table won't look for\n * values on this column. Defaults to `true`.\n *\n * @argument filterable\n * @type {Boolean}\n */\n @localCopy('args.filterable', true)\n filterable;\n\n /**\n * The column filter. If passed in, Yeti Table will search this column for rows that contain this\n * string and show those rows.\n *\n * The column definitions `@filter` argument is subtractive, meaning that it will filter out rows\n * from the subset that passes the general `@filter`.\n *\n * @argument filter\n * @type {String}\n */\n get filter() {\n return this.args.filter;\n }\n\n /**\n * An optional function to customize the filtering logic *on this column*. This function should return true\n * or false to either include or exclude the row on the resulting set. If this function depends\n * on a value, pass that value as the `@filterUsing` argument.\n *\n * This function will be called with two arguments:\n * - `value` - the current data cell to use for filtering\n * - `filterUsing` - the value you passed in as `@filterUsing`\n *\n * @argument filterFunction\n * @type {Function}\n */\n get filterFunction() {\n return this.args.filterFunction;\n }\n\n /**\n * If you `@filterFunction` function depends on a different value (other that `@filter`)\n * to show, pass it in this argument. Yeti Table uses this argument to know when to recalculate\n * the fitlered rows.\n *\n * @argument filterUsing\n * @type {String}\n */\n get filterUsing() {\n return this.args.filterUsing;\n }\n\n /**\n * Used to add a class to all the cells in this column.\n *\n * @argument columnClass\n * @type {String}\n */\n get columnClass() {\n return this.args.columnClass;\n }\n\n /**\n * This property is a human-readable representation of the name of the column.\n * It defaults to the trimmed `textContent` of the `<th>` element, but can be overridden\n * by using a `@name=\"your custom name\"` argument.\n *\n * @argument name\n * @type {String}\n */\n @localCopy('args.name')\n name;\n\n /**\n * An optional function to be invoked whenever this column is clicked\n *\n * This function will be called with two arguments:\n * - `column` - the column that was clicked\n *\n * @argument onClick\n * @type {Function}\n */\n\n get isAscSorted() {\n return this.sort === 'asc';\n }\n\n get isDescSorted() {\n return this.sort === 'desc';\n }\n\n get isSorted() {\n return this.isAscSorted || this.isDescSorted;\n }\n\n get normalizedSortSequence() {\n let sortSequence = this.args.sortSequence;\n assert(\n '@sortSequence must be either a comma-separated string or an array. Got `${sortSequence}.`',\n isArray(sortSequence) || typeof sortSequence === 'string',\n );\n\n if (isArray(sortSequence)) {\n return sortSequence;\n } else if (typeof sortSequence === 'string') {\n return sortSequence.split(',').map((s) => s.trim());\n } else {\n return [];\n }\n }\n\n constructor() {\n super(...arguments);\n\n this.args.parent?.registerColumn(this);\n }\n\n willDestroy() {\n super.willDestroy(...arguments);\n this.args.parent?.unregisterColumn(this);\n }\n\n updateName = modifier((element) => {\n if (!this.args.name) {\n this.name = element.textContent.trim();\n }\n });\n\n noop = () => {};\n}\n"],"names":["Column","Component","setComponentTemplate","precompileTemplate","strictMode","scope","on","fn","hash","prop","args","g","prototype","localCopy","i","filter","filterFunction","filterUsing","columnClass","isAscSorted","sort","isDescSorted","isSorted","normalizedSortSequence","sortSequence","assert","isArray","split","map","s","trim","constructor","arguments","parent","registerColumn","willDestroy","unregisterColumn","updateName","modifier","element","name","textContent","noop"],"mappings":"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"}
@@ -0,0 +1,41 @@
1
+ import Component from '@glimmer/component';
2
+ import Column from './row/column.js';
3
+ import THeadCell from './row/cell.js';
4
+ import { hash } from '@ember/helper';
5
+ import { precompileTemplate } from '@ember/template-compilation';
6
+ import { setComponentTemplate } from '@ember/component';
7
+
8
+ class THeadRow extends Component {
9
+ static {
10
+ setComponentTemplate(precompileTemplate("<tr class=\"{{@trClass}} {{@theme.theadRow}} {{@theme.row}}\" ...attributes>\n {{yield (hash column=(component Column sortable=@sortable sortSequence=@sortSequence onClick=@onColumnClick theme=@theme parent=@parent) cell=(component Cell theme=@theme parent=this))}}\n</tr>", {
11
+ strictMode: true,
12
+ scope: () => ({
13
+ hash,
14
+ Column,
15
+ Cell: THeadCell
16
+ })
17
+ }), this);
18
+ }
19
+ cells = [];
20
+ registerCell(cell) {
21
+ let column;
22
+ if (cell.prop) {
23
+ column = this.args.columns.findBy('prop', cell.prop);
24
+ cell.column = column;
25
+ } else {
26
+ let index = this.cells.length;
27
+ column = this.args.columns[index];
28
+ return column;
29
+ }
30
+ this.cells.push(cell);
31
+ return column;
32
+ }
33
+ unregisterCell(cell) {
34
+ let cells = this.cells;
35
+ let index = cells.indexOf(cell);
36
+ cells.splice(index, 1);
37
+ }
38
+ }
39
+
40
+ export { THeadRow as default };
41
+ //# sourceMappingURL=row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row.js","sources":["../../../../src/components/yeti-table/thead/row.gjs"],"sourcesContent":["import Component from '@glimmer/component';\n\n/**\n Renders a `<tr>` element and yields the column and cell component.\n ```hbs\n <table.thead as |head|>\n <head.row as |row|>\n <row.column @prop=\"firstName\" as |column|>\n First name\n {{if column.isAscSorted \"(sorted asc)\"}}\n {{if column.isDescSorted \"(sorted desc)\"}}\n </row.column>\n </head.row>\n </table.thead>\n ```\n\n @class THeadRow\n @yield {Component} column\n @yield {Component} cell\n*/\n\nimport Column from './row/column.gjs';\nimport Cell from './row/cell.gjs';\nimport { hash } from '@ember/helper';\n\nexport default class THeadRow extends Component {\n <template>\n <tr class=\"{{@trClass}} {{@theme.theadRow}} {{@theme.row}}\" ...attributes>\n {{yield\n (hash\n column=(component\n Column\n sortable=@sortable\n sortSequence=@sortSequence\n onClick=@onColumnClick\n theme=@theme\n parent=@parent\n )\n cell=(component Cell theme=@theme parent=this)\n )\n }}\n </tr>\n </template>\n\n cells = [];\n\n registerCell(cell) {\n let column;\n\n if (cell.prop) {\n column = this.args.columns.findBy('prop', cell.prop);\n cell.column = column;\n } else {\n let index = this.cells.length;\n column = this.args.columns[index];\n\n return column;\n }\n\n this.cells.push(cell);\n\n return column;\n }\n\n unregisterCell(cell) {\n let cells = this.cells;\n let index = cells.indexOf(cell);\n\n cells.splice(index, 1);\n }\n}\n"],"names":["THeadRow","Component","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Column","Cell","cells","registerCell","cell","column","prop","args","columns","findBy","index","length","push","unregisterCell","indexOf","splice"],"mappings":";;;;;;;AAyBe,MAAMA,QAAA,SAAiBC,SAAA,CAAA;AACpC,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,mRAAA,EAgBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;QAAAC,MAAA;AAAAC,cAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AAEVC,EAAAA,KAAA,GAAQ,EAAE;EAEVC,YAAAA,CAAaC,IAAI,EAAE;AACjB,IAAA,IAAIC,MAAA;IAEJ,IAAID,IAAA,CAAKE,IAAI,EAAE;AACbD,MAAAA,MAAA,GAAS,IAAI,CAACE,IAAI,CAACC,OAAO,CAACC,MAAM,CAAC,MAAA,EAAQL,IAAA,CAAKE,IAAI,CAAA;MACnDF,IAAA,CAAKC,MAAM,GAAGA,MAAA;AAChB,IAAA,CAAA,MAAO;AACL,MAAA,IAAIK,KAAA,GAAQ,IAAI,CAACR,KAAK,CAACS,MAAM;MAC7BN,MAAA,GAAS,IAAI,CAACE,IAAI,CAACC,OAAO,CAACE,KAAA,CAAM;AAEjC,MAAA,OAAOL,MAAA;AACT,IAAA;AAEA,IAAA,IAAI,CAACH,KAAK,CAACU,IAAI,CAACR,IAAA,CAAA;AAEhB,IAAA,OAAOC,MAAA;AACT,EAAA;EAEAQ,cAAAA,CAAeT,IAAI,EAAE;AACnB,IAAA,IAAIF,KAAA,GAAQ,IAAI,CAACA,KAAK;AACtB,IAAA,IAAIQ,KAAA,GAAQR,KAAA,CAAMY,OAAO,CAACV,IAAA,CAAA;AAE1BF,IAAAA,KAAA,CAAMa,MAAM,CAACL,KAAA,EAAO,CAAA,CAAA;AACtB,EAAA;AACF;;;;"}
@@ -0,0 +1,35 @@
1
+ import { hash } from '@ember/helper';
2
+ import THeadRow from './thead/row.js';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+ import templateOnly from '@ember/component/template-only';
6
+
7
+ /**
8
+ Renders a `<thead>` element and yields the row component.
9
+
10
+ ```hbs
11
+ <table.thead as |head|>
12
+ <head.row as |row|>
13
+ <row.column @prop="firstName" as |column|>
14
+ First name
15
+ {{if column.isAscSorted "(sorted asc)"}}
16
+ {{if column.isDescSorted "(sorted desc)"}}
17
+ </row.column>
18
+ </head.row>
19
+ </table.thead>
20
+ ```
21
+
22
+ @class THead
23
+ @yield {object} head
24
+ @yield {Component} head.row
25
+ */
26
+ var THead = setComponentTemplate(precompileTemplate("<thead class={{@theme.thead}} ...attributes>\n {{yield (hash row=(component THead sortable=@sortable sortSequence=@sortSequence onColumnClick=@onColumnClick columns=@columns theme=@theme parent=@parent))}}\n</thead>", {
27
+ strictMode: true,
28
+ scope: () => ({
29
+ hash,
30
+ THead: THeadRow
31
+ })
32
+ }), templateOnly());
33
+
34
+ export { THead as default };
35
+ //# sourceMappingURL=thead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thead.js","sources":["../../../src/components/yeti-table/thead.gjs"],"sourcesContent":["/**\n Renders a `<thead>` element and yields the row component.\n\n ```hbs\n <table.thead as |head|>\n <head.row as |row|>\n <row.column @prop=\"firstName\" as |column|>\n First name\n {{if column.isAscSorted \"(sorted asc)\"}}\n {{if column.isDescSorted \"(sorted desc)\"}}\n </row.column>\n </head.row>\n </table.thead>\n ```\n\n @class THead\n @yield {object} head\n @yield {Component} head.row\n*/\nimport { hash } from '@ember/helper';\nimport THead from './thead/row.gjs';\n\n<template>\n <thead class={{@theme.thead}} ...attributes>\n {{yield\n (hash\n row=(component\n THead\n sortable=@sortable\n sortSequence=@sortSequence\n onColumnClick=@onColumnClick\n columns=@columns\n theme=@theme\n parent=@parent\n )\n )\n }}\n </thead>\n</template>\n/**\n * Adds a click action to the thead, called with the clicked column as an argument.\n *\n * @argument onColumnClick - action that is called when the column header is clicked\n * @type Function\n */\n"],"names":["setComponentTemplate","precompileTemplate","strictMode","scope","hash","THead","templateOnly"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBA;AAIA,YAAAA,oBAAA,CAAAC,kBAAA,CAAA,0NAAA,EAgBA;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;AAAAC,WAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;;;;"}