@frontile/collections 0.17.0-beta.25 → 0.17.0-beta.26

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 (180) hide show
  1. package/declarations/components/simple-table/body.d.ts +428 -0
  2. package/declarations/components/simple-table/cell.d.ts +427 -0
  3. package/declarations/components/simple-table/column.d.ts +419 -0
  4. package/declarations/components/simple-table/footer.d.ts +430 -0
  5. package/declarations/components/simple-table/header.d.ts +430 -0
  6. package/declarations/components/simple-table/index.d.ts +446 -0
  7. package/declarations/components/simple-table/row.d.ts +430 -0
  8. package/declarations/components/simple-table/simple-table-body.d.ts +238 -0
  9. package/declarations/components/simple-table/simple-table-cell.d.ts +231 -0
  10. package/declarations/components/simple-table/simple-table-column.d.ts +225 -0
  11. package/declarations/components/simple-table/simple-table-footer.d.ts +237 -0
  12. package/declarations/components/simple-table/simple-table-header.d.ts +237 -0
  13. package/declarations/components/simple-table/simple-table-row.d.ts +236 -0
  14. package/declarations/components/simple-table/simple-table.d.ts +249 -0
  15. package/declarations/components/table/cell-default.d.ts +43 -0
  16. package/declarations/components/table/cell-for.d.ts +38 -0
  17. package/declarations/components/table/cell-rendering-context.d.ts +24 -0
  18. package/declarations/components/table/checkbox.d.ts +50 -0
  19. package/declarations/components/table/column-visibility.d.ts +416 -0
  20. package/declarations/components/table/icons.d.ts +11 -0
  21. package/declarations/components/table/index.d.ts +2 -7
  22. package/declarations/components/table/sort-button.d.ts +413 -0
  23. package/declarations/components/table/table-body.d.ts +10 -7
  24. package/declarations/components/table/table-cell.d.ts +4 -4
  25. package/declarations/components/table/table-column.d.ts +20 -3
  26. package/declarations/components/table/table-footer.d.ts +3 -3
  27. package/declarations/components/table/table-header.d.ts +5 -3
  28. package/declarations/components/table/table-row.d.ts +20 -6
  29. package/declarations/components/table/table.d.ts +335 -111
  30. package/declarations/components/table/typed-cell-for.d.ts +34 -0
  31. package/declarations/components/table/types.d.ts +38 -7
  32. package/declarations/components/table/utils.d.ts +4 -8
  33. package/declarations/components/table-legacy/index.d.ts +9 -0
  34. package/declarations/components/table-legacy/table-body.d.ts +374 -0
  35. package/declarations/components/table-legacy/table-cell.d.ts +364 -0
  36. package/declarations/components/table-legacy/table-column.d.ts +357 -0
  37. package/declarations/components/table-legacy/table-footer.d.ts +365 -0
  38. package/declarations/components/table-legacy/table-header.d.ts +364 -0
  39. package/declarations/components/table-legacy/table-row.d.ts +373 -0
  40. package/declarations/components/table-legacy/table.d.ts +437 -0
  41. package/declarations/components/table-legacy/types.d.ts +20 -0
  42. package/declarations/components/table-legacy/utils.d.ts +16 -0
  43. package/declarations/index.d.ts +1 -0
  44. package/declarations/template-registry.d.ts +3 -1
  45. package/declarations/utils/tableManager.d.ts +25 -0
  46. package/declarations/utils/typed-table.d.ts +32 -0
  47. package/dist/_app_/components/table.js +1 -0
  48. package/dist/components/dropdown.js +1 -1
  49. package/dist/components/listbox.js +1 -1
  50. package/dist/components/table.js +2 -0
  51. package/dist/components/table.js.map +1 -0
  52. package/dist/index-OHRSSSqD.js +528 -0
  53. package/dist/index-OHRSSSqD.js.map +1 -0
  54. package/dist/index.js +2 -1
  55. package/dist/index.js.map +1 -1
  56. package/dist/{listManager-D4_vozfz.js → listManager-CKsOd2zS.js} +2 -2
  57. package/dist/{listManager-D4_vozfz.js.map → listManager-CKsOd2zS.js.map} +1 -1
  58. package/dist/listManager-Dth1-3Si.js +439 -0
  59. package/dist/listManager-Dth1-3Si.js.map +1 -0
  60. package/dist/listbox-BHb3ozlg.js +204 -0
  61. package/dist/listbox-BHb3ozlg.js.map +1 -0
  62. package/dist/listbox-CkGwpiDp.js +203 -0
  63. package/dist/listbox-CkGwpiDp.js.map +1 -0
  64. package/dist/listbox-ClqgWnnA.js +204 -0
  65. package/dist/listbox-ClqgWnnA.js.map +1 -0
  66. package/dist/listbox-rcGFjxs0.js +112 -47
  67. package/dist/listbox-y30VBGX-.js +204 -0
  68. package/dist/listbox-y30VBGX-.js.map +1 -0
  69. package/dist/simple-table-B7dwVNtZ.js +528 -0
  70. package/dist/simple-table-B7dwVNtZ.js.map +1 -0
  71. package/dist/simple-table-OHRSSSqD.js +528 -0
  72. package/dist/simple-table-OHRSSSqD.js.map +1 -0
  73. package/dist/table-B2HDNKJZ.js +406 -0
  74. package/dist/table-B2HDNKJZ.js.map +1 -0
  75. package/dist/table-BDc4IZIE.js +878 -0
  76. package/dist/table-BDc4IZIE.js.map +1 -0
  77. package/dist/table-BFkVEZvb.js +392 -0
  78. package/dist/table-BFkVEZvb.js.map +1 -0
  79. package/dist/table-BqvHQi0L.js +878 -0
  80. package/dist/table-BqvHQi0L.js.map +1 -0
  81. package/dist/table-C7ch3NLp.js +395 -0
  82. package/dist/table-C7ch3NLp.js.map +1 -0
  83. package/dist/table-CLHR4-J5.js +395 -0
  84. package/dist/table-CLHR4-J5.js.map +1 -0
  85. package/dist/table-COm7aEZ1.js +341 -0
  86. package/dist/table-COm7aEZ1.js.map +1 -0
  87. package/dist/table-CSzsuwXt.js +394 -0
  88. package/dist/table-CSzsuwXt.js.map +1 -0
  89. package/dist/table-CVCiVPCB.js +878 -0
  90. package/dist/table-CVCiVPCB.js.map +1 -0
  91. package/dist/table-CcYV8m90.js +341 -0
  92. package/dist/table-CcYV8m90.js.map +1 -0
  93. package/dist/table-DEK1U06v.js +632 -0
  94. package/dist/table-DEK1U06v.js.map +1 -0
  95. package/dist/table-DGQbKRn3.js +395 -0
  96. package/dist/table-DGQbKRn3.js.map +1 -0
  97. package/dist/table-DnQQJItF.js +632 -0
  98. package/dist/table-DnQQJItF.js.map +1 -0
  99. package/dist/table-DrBJt7Eh.js +395 -0
  100. package/dist/table-DrBJt7Eh.js.map +1 -0
  101. package/dist/table-SVR6fEqh.js +877 -0
  102. package/dist/table-SVR6fEqh.js.map +1 -0
  103. package/dist/table-XUYqiKyi.js +394 -0
  104. package/dist/table-XUYqiKyi.js.map +1 -0
  105. package/dist/table-footer-DTLYf3Ac.js +553 -0
  106. package/dist/table-footer-DTLYf3Ac.js.map +1 -0
  107. package/dist/types-B-8cgOds.js +524 -0
  108. package/dist/types-B-8cgOds.js.map +1 -0
  109. package/dist/types-CJuwIIDs.js +524 -0
  110. package/dist/types-CJuwIIDs.js.map +1 -0
  111. package/dist/types-CuXFudgJ.js +526 -0
  112. package/dist/types-CuXFudgJ.js.map +1 -0
  113. package/dist/types-DkKoxFKn.js +524 -0
  114. package/dist/types-DkKoxFKn.js.map +1 -0
  115. package/dist/utils/listManager.js +1 -1
  116. package/package.json +9 -7
  117. package/dist/table-92ff_YNO.js +0 -277
  118. package/dist/table-92ff_YNO.js.map +0 -1
  119. package/dist/table-9AY4L0Gb.js +0 -197
  120. package/dist/table-9AY4L0Gb.js.map +0 -1
  121. package/dist/table-9lHVhRR5.js +0 -241
  122. package/dist/table-9lHVhRR5.js.map +0 -1
  123. package/dist/table-BIkLOscH.js +0 -269
  124. package/dist/table-BIkLOscH.js.map +0 -1
  125. package/dist/table-BPp_OXkX.js +0 -206
  126. package/dist/table-BPp_OXkX.js.map +0 -1
  127. package/dist/table-BQBLUGgl.js +0 -208
  128. package/dist/table-BQBLUGgl.js.map +0 -1
  129. package/dist/table-BUboQojw.js +0 -267
  130. package/dist/table-BUboQojw.js.map +0 -1
  131. package/dist/table-BUrvD0CN.js +0 -324
  132. package/dist/table-BUrvD0CN.js.map +0 -1
  133. package/dist/table-B_z4aWPh.js +0 -276
  134. package/dist/table-B_z4aWPh.js.map +0 -1
  135. package/dist/table-Bi_i2GOl.js +0 -279
  136. package/dist/table-Bi_i2GOl.js.map +0 -1
  137. package/dist/table-BkWhyzMo.js +0 -214
  138. package/dist/table-BkWhyzMo.js.map +0 -1
  139. package/dist/table-Bp_EqrlK.js +0 -309
  140. package/dist/table-Bp_EqrlK.js.map +0 -1
  141. package/dist/table-Bq1HGB9C.js +0 -240
  142. package/dist/table-Bq1HGB9C.js.map +0 -1
  143. package/dist/table-C-_mQMW_.js +0 -141
  144. package/dist/table-C-_mQMW_.js.map +0 -1
  145. package/dist/table-CaBDs-LD.js +0 -269
  146. package/dist/table-CaBDs-LD.js.map +0 -1
  147. package/dist/table-CcbmieDl.js +0 -329
  148. package/dist/table-CcbmieDl.js.map +0 -1
  149. package/dist/table-CdLut7xT.js +0 -172
  150. package/dist/table-CdLut7xT.js.map +0 -1
  151. package/dist/table-Cs_Xm3-T.js +0 -144
  152. package/dist/table-Cs_Xm3-T.js.map +0 -1
  153. package/dist/table-CwxlKxz0.js +0 -185
  154. package/dist/table-CwxlKxz0.js.map +0 -1
  155. package/dist/table-D1jyvvdd.js +0 -242
  156. package/dist/table-D1jyvvdd.js.map +0 -1
  157. package/dist/table-D7QCvl0_.js +0 -269
  158. package/dist/table-D7QCvl0_.js.map +0 -1
  159. package/dist/table-DApb61os.js +0 -185
  160. package/dist/table-DApb61os.js.map +0 -1
  161. package/dist/table-DFIwJpJO.js +0 -144
  162. package/dist/table-DFIwJpJO.js.map +0 -1
  163. package/dist/table-DIZvtyjH.js +0 -185
  164. package/dist/table-DIZvtyjH.js.map +0 -1
  165. package/dist/table-DYOLmjfk.js +0 -325
  166. package/dist/table-DYOLmjfk.js.map +0 -1
  167. package/dist/table-Da60U9eH.js +0 -269
  168. package/dist/table-Da60U9eH.js.map +0 -1
  169. package/dist/table-Dcyk7CLS.js +0 -144
  170. package/dist/table-Dcyk7CLS.js.map +0 -1
  171. package/dist/table-DzNT9tDs.js +0 -280
  172. package/dist/table-DzNT9tDs.js.map +0 -1
  173. package/dist/table-EDCy6SCT.js +0 -214
  174. package/dist/table-EDCy6SCT.js.map +0 -1
  175. package/dist/table-GRGxN-x5.js +0 -309
  176. package/dist/table-GRGxN-x5.js.map +0 -1
  177. package/dist/table-Lk0tmBng.js +0 -309
  178. package/dist/table-Lk0tmBng.js.map +0 -1
  179. package/dist/table-k5i2kvUD.js +0 -324
  180. package/dist/table-k5i2kvUD.js.map +0 -1
@@ -0,0 +1,632 @@
1
+ import Component from '@glimmer/component';
2
+ import { hash, fn } from '@ember/helper';
3
+ import { useStyles, twMerge } from '@frontile/theme';
4
+ import { modifier } from 'ember-modifier';
5
+ import { tracked } from '@glimmer/tracking';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+ import { d as decorateMethodV2, a as decorateFieldV2, i as initializeDeferredDecorator, k as keyAndLabelForItem } from './listManager-CKsOd2zS.js';
9
+ import { action } from '@ember/object';
10
+ import { Dropdown } from './components/dropdown.js';
11
+ import { isVisible, show, hide, ColumnVisibility as ColumnVisibility$1 } from '@universal-ember/table/plugins/column-visibility';
12
+ import templateOnly from '@ember/component/template-only';
13
+ import { press } from '@frontile/utilities';
14
+ import { SortDirection, DataSorting, sortDirection, sort, isSortable } from '@universal-ember/table/plugins/data-sorting';
15
+ import { headlessTable } from '@universal-ember/table';
16
+ import { columns } from '@universal-ember/table/plugins';
17
+
18
+ class SimpleTableColumn extends Component {
19
+ get styles() {
20
+ return this.args.styleFns || useStyles().table();
21
+ }
22
+ get classNames() {
23
+ const options = {
24
+ isSticky: this.args.isSticky || false,
25
+ stickyPosition: this.args.isSticky ? this.args.stickyPosition || 'left' : undefined,
26
+ class: this.args.class
27
+ };
28
+ return this.styles.th(options);
29
+ }
30
+ static {
31
+ setComponentTemplate(precompileTemplate("\n <th class={{this.classNames}} data-test-id=\"table-column\" data-component=\"table-column\" ...attributes>\n {{yield}}\n </th>\n ", {
32
+ strictMode: true
33
+ }), this);
34
+ }
35
+ }
36
+
37
+ class SimpleTableHeader extends Component {
38
+ get styles() {
39
+ return this.args.styleFns || useStyles().table();
40
+ }
41
+ get classNames() {
42
+ const options = {
43
+ isSticky: this.args.isSticky || false,
44
+ stickyPosition: this.args.isSticky ? 'top' : undefined,
45
+ class: twMerge(this.args.class, this.args.classes?.thead)
46
+ };
47
+ return this.styles.thead(options);
48
+ }
49
+ get rowClassNames() {
50
+ const options = {
51
+ class: twMerge('', this.args.classes?.tr || ''),
52
+ isSticky: false
53
+ };
54
+ return this.styles.tr(options);
55
+ }
56
+ get separatorClassNames() {
57
+ return this.styles.separator({
58
+ class: this.args.classes?.separator
59
+ });
60
+ }
61
+ static {
62
+ setComponentTemplate(precompileTemplate("\n <thead class={{this.classNames}} data-test-id=\"table-header\" data-component=\"table-header\" ...attributes>\n <tr class={{this.rowClassNames}}>\n {{yield (hash Column=SimpleTableColumn)}}\n </tr>\n <tr class={{this.separatorClassNames}} />\n </thead>\n ", {
63
+ strictMode: true,
64
+ scope: () => ({
65
+ hash,
66
+ SimpleTableColumn
67
+ })
68
+ }), this);
69
+ }
70
+ }
71
+
72
+ class SimpleTableCell extends Component {
73
+ get styles() {
74
+ return this.args.styleFns || useStyles().table();
75
+ }
76
+ get classNames() {
77
+ const options = {
78
+ isSticky: this.args.isSticky || false,
79
+ stickyPosition: this.args.isSticky ? this.args.stickyPosition || 'left' : undefined,
80
+ isInStickyRow: this.args.isInStickyRow || false,
81
+ class: twMerge(this.args.class || '', this.args.classes?.td || '')
82
+ };
83
+ return this.styles.td(options);
84
+ }
85
+ static {
86
+ setComponentTemplate(precompileTemplate("\n <td class={{this.classNames}} data-test-id=\"table-cell\" data-component=\"table-cell\" ...attributes>\n {{yield}}\n </td>\n ", {
87
+ strictMode: true
88
+ }), this);
89
+ }
90
+ }
91
+
92
+ class SimpleTableRow extends Component {
93
+ get styles() {
94
+ return this.args.styleFns || useStyles().table();
95
+ }
96
+ get classNames() {
97
+ const options = {
98
+ isSticky: this.args.isSticky || false,
99
+ stickyPosition: this.args.isSticky ? 'top' : undefined,
100
+ hasStickyHeader: this.args.hasStickyHeader || false,
101
+ class: twMerge(this.args.class || '', this.args.classes?.tr || '')
102
+ };
103
+ return this.styles.tr(options);
104
+ }
105
+ static {
106
+ setComponentTemplate(precompileTemplate("\n <tr class={{this.classNames}} data-test-id=\"table-row\" data-component=\"table-row\" ...attributes>\n {{yield (hash Cell=SimpleTableCell)}}\n </tr>\n ", {
107
+ strictMode: true,
108
+ scope: () => ({
109
+ hash,
110
+ SimpleTableCell
111
+ })
112
+ }), this);
113
+ }
114
+ }
115
+
116
+ class SimpleTableBody extends Component {
117
+ get styles() {
118
+ return this.args.styleFns || useStyles().table();
119
+ }
120
+ get classNames() {
121
+ const mergedClass = twMerge(this.args.class, this.args.classes?.tbody);
122
+ return this.styles.tbody({
123
+ class: mergedClass
124
+ });
125
+ }
126
+ static {
127
+ setComponentTemplate(precompileTemplate("\n <tbody class={{this.classNames}} data-test-id=\"table-body\" data-component=\"table-body\" ...attributes>\n {{yield (hash Row=SimpleTableRow Cell=SimpleTableCell)}}\n </tbody>\n ", {
128
+ strictMode: true,
129
+ scope: () => ({
130
+ hash,
131
+ SimpleTableRow,
132
+ SimpleTableCell
133
+ })
134
+ }), this);
135
+ }
136
+ }
137
+
138
+ class SimpleTableFooter extends Component {
139
+ get styles() {
140
+ return this.args.styleFns || useStyles().table();
141
+ }
142
+ get classNames() {
143
+ const options = {
144
+ isSticky: this.args.isSticky || false,
145
+ stickyPosition: this.args.isSticky ? 'bottom' : undefined,
146
+ class: twMerge(this.args.class, this.args.classes?.tfoot)
147
+ };
148
+ return this.styles.tfoot(options);
149
+ }
150
+ get rowClassNames() {
151
+ const options = {
152
+ class: twMerge('', this.args.classes?.tr || ''),
153
+ isSticky: false
154
+ };
155
+ return this.styles.tr(options);
156
+ }
157
+ get separatorClassNames() {
158
+ return this.styles.separator({
159
+ class: this.args.classes?.separator
160
+ });
161
+ }
162
+ static {
163
+ setComponentTemplate(precompileTemplate("\n <tfoot class={{this.classNames}} data-test-id=\"table-footer\" data-component=\"table-footer\" ...attributes>\n <tr class={{this.separatorClassNames}} />\n <tr class={{this.rowClassNames}}>\n {{yield (hash Column=SimpleTableColumn)}}\n </tr>\n </tfoot>\n ", {
164
+ strictMode: true,
165
+ scope: () => ({
166
+ hash,
167
+ SimpleTableColumn
168
+ })
169
+ }), this);
170
+ }
171
+ }
172
+
173
+ class SimpleTable extends Component {
174
+ get hasWrapper() {
175
+ return this.args.hasWrapper ?? true;
176
+ }
177
+ get styles() {
178
+ const {
179
+ table
180
+ } = useStyles();
181
+ return table({
182
+ size: this.args.size,
183
+ layout: this.args.layout,
184
+ striped: this.args.isStriped,
185
+ isScrollable: this.args.isScrollable || false,
186
+ hasStickyHeader: false,
187
+ isLoading: this.args.hasCustomLoading ? false : this.args.isLoading || false,
188
+ loadingColor: this.args.loadingColor,
189
+ class: this.args.classes?.base
190
+ });
191
+ }
192
+ get wrapperClassNames() {
193
+ return this.styles.wrapper({
194
+ class: this.args.classes?.wrapper
195
+ });
196
+ }
197
+ get tableClassNames() {
198
+ return this.styles.table({
199
+ class: this.args.classes?.table
200
+ });
201
+ }
202
+ static {
203
+ setComponentTemplate(precompileTemplate("\n {{#if this.hasWrapper}}\n <div class={{this.wrapperClassNames}} data-component=\"table-wrapper\">\n <table class={{this.tableClassNames}} data-test-id=\"table\" data-component=\"table\" data-loading={{if this.args.isLoading \"true\" \"false\"}} ...attributes>\n {{yield (hash Header=(component SimpleTableHeader styleFns=this.styles classes=this.args.classes) Body=(component SimpleTableBody styleFns=this.styles classes=this.args.classes) Footer=(component SimpleTableFooter styleFns=this.styles classes=this.args.classes) Column=(component SimpleTableColumn styleFns=this.styles) Row=(component SimpleTableRow styleFns=this.styles classes=this.args.classes) Cell=(component SimpleTableCell styleFns=this.styles classes=this.args.classes))}}\n </table>\n </div>\n {{else}}\n <table class={{this.tableClassNames}} data-test-id=\"table\" data-component=\"table\" data-loading={{if this.args.isLoading \"true\" \"false\"}} ...attributes>\n {{yield (hash Header=(component SimpleTableHeader styleFns=this.styles classes=this.args.classes) Body=(component SimpleTableBody styleFns=this.styles classes=this.args.classes) Footer=(component SimpleTableFooter styleFns=this.styles classes=this.args.classes) Column=(component SimpleTableColumn styleFns=this.styles) Row=(component SimpleTableRow styleFns=this.styles classes=this.args.classes) Cell=(component SimpleTableCell styleFns=this.styles classes=this.args.classes))}}\n </table>\n {{/if}}\n ", {
204
+ strictMode: true,
205
+ scope: () => ({
206
+ hash,
207
+ SimpleTableHeader,
208
+ SimpleTableBody,
209
+ SimpleTableFooter,
210
+ SimpleTableColumn,
211
+ SimpleTableRow,
212
+ SimpleTableCell
213
+ })
214
+ }), this);
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Helper to extract Frontile sticky options from a universal-ember column's pluginOptions
220
+ */
221
+ function extractFrontileOptions(column) {
222
+ if (!column?.config?.pluginOptions) {
223
+ return undefined;
224
+ }
225
+
226
+ // Find the frontile plugin option
227
+ const pluginOptions = column.config.pluginOptions;
228
+ const frontileOption = pluginOptions.find(option => Array.isArray(option) && option[0] === 'frontile');
229
+ if (frontileOption && typeof frontileOption[1] === 'function') {
230
+ return frontileOption[1]();
231
+ }
232
+ return undefined;
233
+ }
234
+
235
+ /**
236
+ * Icon components used in the table component
237
+ */
238
+ const ChevronUpIcon = setComponentTemplate(precompileTemplate("\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" ...attributes>\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"m4.5 15.75 7.5-7.5 7.5 7.5\" />\n </svg>\n", {
239
+ strictMode: true
240
+ }), templateOnly());
241
+ const ChevronDownIcon = setComponentTemplate(precompileTemplate("\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" ...attributes>\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"m19.5 8.25-7.5 7.5-7.5-7.5\" />\n </svg>\n", {
242
+ strictMode: true
243
+ }), templateOnly());
244
+ const ColumnVisibilityIcon = setComponentTemplate(precompileTemplate("\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" ...attributes>\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125Z\" />\n </svg>\n", {
245
+ strictMode: true
246
+ }), templateOnly());
247
+
248
+ class ColumnVisibility extends Component {
249
+ get styles() {
250
+ const {
251
+ table
252
+ } = useStyles();
253
+ return table();
254
+ }
255
+ get size() {
256
+ return this.args.size ?? 'xs';
257
+ }
258
+ get columns() {
259
+ return this.args.tableInstance?.columns.values() || [];
260
+ }
261
+ get selectedKeys() {
262
+ return this.columns.filter(column => isVisible(column)).map(column => column.key);
263
+ }
264
+ get allColumnKeys() {
265
+ return this.columns.map(column => column.key);
266
+ }
267
+ handleSelectionChange(selectedKeys) {
268
+ this.columns.forEach(column => {
269
+ if (selectedKeys.includes(column.key)) {
270
+ if (!isVisible(column)) {
271
+ show(column);
272
+ }
273
+ } else {
274
+ if (isVisible(column)) {
275
+ hide(column);
276
+ }
277
+ }
278
+ });
279
+ }
280
+ static {
281
+ decorateMethodV2(this.prototype, "handleSelectionChange", [action]);
282
+ }
283
+ static {
284
+ setComponentTemplate(precompileTemplate("\n <Dropdown @closeOnItemSelect={{false}} ...attributes>\n <:default as |d|>\n <d.Trigger @intent=\"default\" @size={{this.size}} @class={{(this.styles.columnVisibilityButton)}}>\n\n {{#if (has-block \"icon\")}}\n {{yield to=\"icon\"}}\n {{else}}\n <ColumnVisibilityIcon class={{(this.styles.columnVisibilityIcon)}} />\n {{/if}}\n {{yield}}\n </d.Trigger>\n\n <d.Menu @selectionMode=\"multiple\" @selectedKeys={{this.selectedKeys}} @onSelectionChange={{this.handleSelectionChange}} as |Item|>\n {{#each @tableInstance.columns as |column|}}\n <Item @key={{column.key}}>\n {{column.name}}\n </Item>\n {{/each}}\n </d.Menu>\n </:default>\n </Dropdown>\n ", {
285
+ strictMode: true,
286
+ scope: () => ({
287
+ Dropdown,
288
+ ColumnVisibilityIcon
289
+ })
290
+ }), this);
291
+ }
292
+ }
293
+
294
+ /**
295
+ * Conditional rendering component for table cells. Only renders its content
296
+ * when the current column key matches the specified @key argument.
297
+ *
298
+ * Usage:
299
+ * ```hbs
300
+ * <c.For @key="status">
301
+ * <StatusBadge @status={{c.value}} />
302
+ * </c.For>
303
+ * ```
304
+ */
305
+ class CellForComponent extends Component {
306
+ get shouldRender() {
307
+ const matches = this.args.column.key === this.args.key;
308
+ // If this component matches the current column, claim the key
309
+ // so that CellDefaultComponent knows not to render
310
+ if (matches) {
311
+ this.args.registry.claimKey(this.args.key);
312
+ }
313
+ return matches;
314
+ }
315
+ static {
316
+ setComponentTemplate(precompileTemplate("\n {{#if this.shouldRender}}\n {{yield}}\n {{/if}}\n ", {
317
+ strictMode: true
318
+ }), this);
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Default/fallback rendering component for table cells. Only renders its content
324
+ * when no CellForComponent has claimed the current column key.
325
+ *
326
+ * Usage:
327
+ * ```hbs
328
+ * <c.Default>
329
+ * Default: {{c.value}}
330
+ * </c.Default>
331
+ *
332
+ * <!-- Or with explicit exclusions -->
333
+ * <c.Default @except={{array "status" "actions"}}>
334
+ * {{c.value}}
335
+ * </c.Default>
336
+ * ```
337
+ */
338
+ class CellDefaultComponent extends Component {
339
+ get shouldRender() {
340
+ const currentKey = this.args.column.key;
341
+ // Check explicit exclusions first
342
+ if (this.args.except?.includes(currentKey)) {
343
+ return false;
344
+ }
345
+ // Check if any CellForComponent has claimed this key
346
+ return !this.args.registry.isKeyClaimed(currentKey);
347
+ }
348
+ static {
349
+ setComponentTemplate(precompileTemplate("\n {{#if this.shouldRender}}\n {{yield}}\n {{/if}}\n ", {
350
+ strictMode: true
351
+ }), this);
352
+ }
353
+ }
354
+
355
+ class SortButton extends Component {
356
+ get styles() {
357
+ const {
358
+ table
359
+ } = useStyles();
360
+ return table();
361
+ }
362
+ get showUpIcon() {
363
+ return this.args.sortDirection === SortDirection.Ascending;
364
+ }
365
+ static {
366
+ setComponentTemplate(precompileTemplate("\n <button type=\"button\" class=\"{{(this.styles.sortButton)}}\" data-sort-direction={{@sortDirection}} data-sorted=\"{{@isSorted}}\" {{press @onSort}} ...attributes>\n <span>\n {{@column.name}}\n </span>\n {{#if this.showUpIcon}}\n <ChevronUpIcon class={{(this.styles.sortIcon)}} data-sorted=\"{{@isSorted}}\" aria-hidden=\"true\" />\n {{else}}\n <ChevronDownIcon class={{(this.styles.sortIcon)}} data-sorted=\"{{@isSorted}}\" aria-hidden=\"true\" />\n {{/if}}\n </button>\n ", {
367
+ strictMode: true,
368
+ scope: () => ({
369
+ press,
370
+ ChevronUpIcon,
371
+ ChevronDownIcon
372
+ })
373
+ }), this);
374
+ }
375
+ }
376
+
377
+ /**
378
+ * Context class to track which column keys have been claimed by CellForComponent
379
+ * instances during cell rendering. This enables CellDefaultComponent to only
380
+ * render when no specific column renderer has claimed the current column key.
381
+ */
382
+ class CellRenderingContext {
383
+ claimedKeys = new Set();
384
+
385
+ /**
386
+ * Mark a column key as claimed by a CellForComponent
387
+ */
388
+ claimKey(key) {
389
+ this.claimedKeys.add(key);
390
+ }
391
+
392
+ /**
393
+ * Check if a column key has been claimed by any CellForComponent
394
+ */
395
+ isKeyClaimed(key) {
396
+ return this.claimedKeys.has(key);
397
+ }
398
+
399
+ /**
400
+ * Reset the claimed keys (called between cell renders)
401
+ */
402
+ reset() {
403
+ this.claimedKeys.clear();
404
+ }
405
+
406
+ /**
407
+ * Get all claimed keys (useful for debugging)
408
+ */
409
+ get claimedKeysList() {
410
+ return Array.from(this.claimedKeys);
411
+ }
412
+ }
413
+
414
+ class Table extends Component {
415
+ ColumnVisibility = ColumnVisibility;
416
+ CellFor = CellForComponent;
417
+ CellDefault = CellDefaultComponent;
418
+ SortButton = SortButton;
419
+ // Tracked state for sorting
420
+ static {
421
+ decorateFieldV2(this.prototype, "sorts", [tracked], function () {
422
+ return [];
423
+ });
424
+ }
425
+ #sorts = (initializeDeferredDecorator(this, "sorts"), void 0);
426
+ constructor(owner, args) {
427
+ super(owner, args);
428
+ // Initialize sorts from initialSort if provided (only on mount)
429
+ if (args.initialSort) {
430
+ this.sorts = [args.initialSort];
431
+ }
432
+ }
433
+ // Transform Frontile ColumnConfig to universal-ember ColumnConfig with pluginOptions
434
+ processColumns(columns) {
435
+ if (!columns) return [];
436
+ return columns.map(column => {
437
+ const {
438
+ isSticky,
439
+ stickyPosition,
440
+ isVisible,
441
+ isSortable,
442
+ sortProperty,
443
+ Cell,
444
+ value,
445
+ ...baseColumn
446
+ } = column;
447
+ const pluginOptions = [];
448
+ // Add Frontile sticky options if present
449
+ if (isSticky !== undefined || stickyPosition !== undefined) {
450
+ const frontileOption = ['frontile', () => ({
451
+ isSticky,
452
+ stickyPosition
453
+ })];
454
+ pluginOptions.push(frontileOption);
455
+ }
456
+ // Add ColumnVisibility plugin option if isVisible is explicitly set
457
+ if (isVisible !== undefined) {
458
+ pluginOptions.push(ColumnVisibility$1.forColumn(() => ({
459
+ isVisible
460
+ })));
461
+ }
462
+ // Add DataSorting plugin option - always add it to override the default (true) with our default (false)
463
+ pluginOptions.push(DataSorting.forColumn(() => ({
464
+ isSortable: isSortable ?? false,
465
+ sortProperty
466
+ })));
467
+ // Create the universal-ember column configuration
468
+ const universalColumn = {
469
+ key: baseColumn.key,
470
+ name: baseColumn.name,
471
+ pluginOptions: pluginOptions.length > 0 ? pluginOptions : undefined
472
+ };
473
+ // Add value function if provided
474
+ if (value) {
475
+ universalColumn.value = value;
476
+ }
477
+ // Add Cell component if provided
478
+ if (Cell) {
479
+ universalColumn.Cell = Cell;
480
+ }
481
+ return universalColumn;
482
+ });
483
+ }
484
+ // Handler for sort state changes from the DataSorting plugin
485
+ handleSortChange = newSorts => {
486
+ this.sorts = newSorts;
487
+ };
488
+ tableInstance = headlessTable(this, {
489
+ data: () => this.sortedItems,
490
+ columns: () => this.processColumns(this.args.columns),
491
+ plugins: [ColumnVisibility$1, DataSorting.with(() => ({
492
+ sorts: this.sorts,
493
+ onSort: this.handleSortChange
494
+ }))]
495
+ });
496
+ // Computed property that returns sorted items based on current sort state
497
+ get sortedItems() {
498
+ const items = this.args.items || [];
499
+ // If no onSort handler or no active sorts, return items as-is
500
+ if (!this.args.onSort || this.sorts.length === 0) {
501
+ return items;
502
+ }
503
+ // Only use the first sort item (single column sorting)
504
+ const sortDescriptor = this.sorts[0];
505
+ if (!sortDescriptor) {
506
+ return items;
507
+ }
508
+ return this.args.onSort(items, sortDescriptor);
509
+ }
510
+ get styles() {
511
+ const {
512
+ table
513
+ } = useStyles();
514
+ return table({
515
+ size: this.args.size,
516
+ layout: this.args.layout,
517
+ striped: this.args.isStriped,
518
+ isScrollable: this.args.isScrollable || false,
519
+ hasStickyHeader: this.args.isStickyHeader || false,
520
+ isLoading: this.args.isLoading || false,
521
+ loadingColor: this.args.loadingColor,
522
+ class: this.args.classes?.base
523
+ });
524
+ }
525
+ get wrapperClassNames() {
526
+ return this.styles.wrapper({
527
+ class: this.args.classes?.wrapper
528
+ });
529
+ }
530
+ calculateHeaderHeight = modifier(el => {
531
+ if (this.args.isStickyHeader) {
532
+ const updateHeight = () => {
533
+ const thead = el.querySelector('thead');
534
+ if (thead) {
535
+ const headerHeight = Math.round(thead.offsetHeight);
536
+ el.style.setProperty('--table-header-height', `${headerHeight}px`);
537
+ }
538
+ };
539
+ requestAnimationFrame(updateHeight);
540
+ // Update on resize
541
+ let observer;
542
+ observer = new ResizeObserver(updateHeight);
543
+ observer.observe(el);
544
+ return () => {
545
+ if (observer) {
546
+ observer.disconnect();
547
+ }
548
+ };
549
+ }
550
+ });
551
+ get tableClassNames() {
552
+ return this.styles.table({
553
+ class: this.args.classes?.table
554
+ });
555
+ }
556
+ get columns() {
557
+ return this.args.columns || [];
558
+ }
559
+ get footerColumns() {
560
+ return this.args.footerColumns || [];
561
+ }
562
+ get items() {
563
+ return this.tableInstance.rows.values();
564
+ }
565
+ get headlessColumns() {
566
+ return columns.for(this.tableInstance);
567
+ }
568
+ get headlessRows() {
569
+ return this.tableInstance.rows.values();
570
+ }
571
+ // Helper to check if a column is sticky
572
+ columnIsSticky = column => {
573
+ const frontileOptions = extractFrontileOptions(column);
574
+ return frontileOptions?.isSticky ?? false;
575
+ };
576
+ // Helper to get column sticky position
577
+ columnStickyPosition = column => {
578
+ const frontileOptions = extractFrontileOptions(column);
579
+ return frontileOptions?.stickyPosition;
580
+ };
581
+ // Helper to check if a row is sticky
582
+ rowIsSticky = row => {
583
+ if (!this.args.stickyKeys) return false;
584
+ const rowKey = this.getRowKey(row);
585
+ return this.args.stickyKeys.includes(rowKey);
586
+ };
587
+ // Helper to get row key (from existing TableRow logic)
588
+ getRowKey = row => {
589
+ if (row) {
590
+ const actualData = row.data || row;
591
+ try {
592
+ const {
593
+ key
594
+ } = keyAndLabelForItem(actualData);
595
+ return key;
596
+ } catch (error) {
597
+ return row.index?.toString() || '';
598
+ }
599
+ }
600
+ return '';
601
+ };
602
+ // Create cell context with registry for custom cell rendering
603
+ createCellContext = (column, row) => {
604
+ const registry = new CellRenderingContext();
605
+ return {
606
+ column,
607
+ row,
608
+ value: column.getValueForRow(row),
609
+ registry
610
+ };
611
+ };
612
+ // Helper to check if column is currently sorted
613
+ columnIsSorted = column => {
614
+ return sortDirection(column) !== 'none';
615
+ };
616
+ static {
617
+ setComponentTemplate(precompileTemplate("\n <div class={{this.wrapperClassNames}} {{this.calculateHeaderHeight}} {{this.tableInstance.modifiers.container}} data-component=\"table-wrapper\">\n {{#if (has-block \"toolbar\")}}\n <div class=\"table-toolbar\" data-component=\"table-toolbar\">\n {{yield (hash ColumnVisibility=(component this.ColumnVisibility tableInstance=this.tableInstance)) to=\"toolbar\"}}\n </div>\n {{/if}}\n\n <SimpleTable @classes={{this.args.classes}} @size={{@size}} @layout={{@layout}} @isStriped={{@isStriped}} @isScrollable={{@isScrollable}} @hasWrapper={{false}} @isLoading={{@isLoading}} @loadingColor={{@loadingColor}} @hasCustomLoading={{has-block \"loading\"}} as |t|>\n <t.Header @isSticky={{@isStickyHeader}}>\n {{#each this.headlessColumns as |column|}}\n <t.Column {{this.tableInstance.modifiers.columnHeader column}} @isSticky={{this.columnIsSticky column}} @stickyPosition={{this.columnStickyPosition column}} data-key={{column.key}} data-sortable=\"{{(isColumnSortable column)}}\">\n {{#if (has-block \"header\")}}\n {{yield (hash column=column isSortable=(isColumnSortable column) sortDirection=(getColumnSortDirection column) isSorted=(this.columnIsSorted column) onSort=(fn sortColumn column)) to=\"header\"}}\n {{else if (isColumnSortable column)}}\n <this.SortButton @column={{column}} @sortDirection={{getColumnSortDirection column}} @isSorted={{this.columnIsSorted column}} @onSort={{fn sortColumn column}} />\n {{else}}\n {{column.name}}\n {{/if}}\n </t.Column>\n {{/each}}\n </t.Header>\n\n <t.Body>\n {{#if (has-block \"loading\")}}\n {{#if @isLoading}}\n <t.Row data-test-id=\"table-loading-row\">\n <t.Cell colspan={{this.headlessColumns.length}} data-test-id=\"table-loading-cell\">\n {{yield to=\"loading\"}}\n </t.Cell>\n </t.Row>\n {{else}}\n {{#each this.headlessRows as |row|}}\n <t.Row {{this.tableInstance.modifiers.row row}} @isSticky={{this.rowIsSticky row}} @hasStickyHeader={{@isStickyHeader}} data-key={{this.getRowKey row}}>\n {{#each this.headlessColumns as |column|}}\n <t.Cell @isSticky={{this.columnIsSticky column}} @stickyPosition={{this.columnStickyPosition column}} @isInStickyRow={{this.rowIsSticky row}} data-column={{column.key}}>\n {{#if (has-block \"cell\")}}\n {{#let (this.createCellContext column row) as |cellContext|}}\n {{yield (hash column=cellContext.column value=cellContext.value row=cellContext.row For=(component this.CellFor column=column registry=cellContext.registry) Default=(component this.CellDefault column=column registry=cellContext.registry)) to=\"cell\"}}\n {{/let}}\n {{else}}\n {{#if column.Cell}}\n <column.Cell @row={{row}} @column={{column}} />\n {{else}}\n {{column.getValueForRow row}}\n {{/if}}\n {{/if}}\n </t.Cell>\n {{/each}}\n </t.Row>\n {{else}}\n {{#if (has-block \"empty\")}}\n <t.Row data-test-id=\"table-empty-row\">\n <t.Cell @class={{(this.styles.empty)}} colspan={{this.headlessColumns.length}} data-test-id=\"table-empty-cell\">\n {{yield to=\"empty\"}}\n </t.Cell>\n </t.Row>\n {{else if @emptyContent}}\n <t.Row data-test-id=\"table-empty-row\">\n <t.Cell @class={{(this.styles.empty)}} colspan={{this.headlessColumns.length}} data-test-id=\"table-empty-cell\">\n {{@emptyContent}}\n </t.Cell>\n </t.Row>\n {{/if}}\n {{/each}}\n {{/if}}\n {{else}}\n {{#each this.headlessRows as |row|}}\n <t.Row {{this.tableInstance.modifiers.row row}} @isSticky={{this.rowIsSticky row}} @hasStickyHeader={{@isStickyHeader}} data-key={{this.getRowKey row}}>\n {{#each this.headlessColumns as |column|}}\n <t.Cell @isSticky={{this.columnIsSticky column}} @stickyPosition={{this.columnStickyPosition column}} @isInStickyRow={{this.rowIsSticky row}} data-column={{column.key}}>\n {{#if (has-block \"cell\")}}\n {{#let (this.createCellContext column row) as |cellContext|}}\n {{yield (hash column=cellContext.column value=cellContext.value row=cellContext.row For=(component this.CellFor column=column registry=cellContext.registry) Default=(component this.CellDefault column=column registry=cellContext.registry)) to=\"cell\"}}\n {{/let}}\n {{else}}\n {{#if column.Cell}}\n <column.Cell @row={{row}} @column={{column}} />\n {{else}}\n {{column.getValueForRow row}}\n {{/if}}\n {{/if}}\n </t.Cell>\n {{/each}}\n </t.Row>\n {{else}}\n {{#if (has-block \"empty\")}}\n <t.Row data-test-id=\"table-empty-row\">\n <t.Cell @class={{(this.styles.empty)}} colspan={{this.headlessColumns.length}} data-test-id=\"table-empty-cell\">\n {{yield to=\"empty\"}}\n </t.Cell>\n </t.Row>\n {{else if @emptyContent}}\n <t.Row data-test-id=\"table-empty-row\">\n <t.Cell @class={{(this.styles.empty)}} colspan={{this.headlessColumns.length}} data-test-id=\"table-empty-cell\">\n {{@emptyContent}}\n </t.Cell>\n </t.Row>\n {{/if}}\n {{/each}}\n {{/if}}\n </t.Body>\n\n {{#if this.footerColumns.length}}\n <t.Footer @isSticky={{@isStickyFooter}}>\n {{#each this.footerColumns as |column|}}\n <t.Column data-key={{column.key}}>\n {{column.name}}\n </t.Column>\n {{/each}}\n </t.Footer>\n {{/if}}\n </SimpleTable>\n </div>\n ", {
618
+ strictMode: true,
619
+ scope: () => ({
620
+ hash,
621
+ SimpleTable,
622
+ isColumnSortable: isSortable,
623
+ getColumnSortDirection: sortDirection,
624
+ fn,
625
+ sortColumn: sort
626
+ })
627
+ }), this);
628
+ }
629
+ }
630
+
631
+ export { SimpleTable as S, Table as T };
632
+ //# sourceMappingURL=table-DEK1U06v.js.map