@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.
- package/declarations/components/simple-table/body.d.ts +428 -0
- package/declarations/components/simple-table/cell.d.ts +427 -0
- package/declarations/components/simple-table/column.d.ts +419 -0
- package/declarations/components/simple-table/footer.d.ts +430 -0
- package/declarations/components/simple-table/header.d.ts +430 -0
- package/declarations/components/simple-table/index.d.ts +446 -0
- package/declarations/components/simple-table/row.d.ts +430 -0
- package/declarations/components/simple-table/simple-table-body.d.ts +238 -0
- package/declarations/components/simple-table/simple-table-cell.d.ts +231 -0
- package/declarations/components/simple-table/simple-table-column.d.ts +225 -0
- package/declarations/components/simple-table/simple-table-footer.d.ts +237 -0
- package/declarations/components/simple-table/simple-table-header.d.ts +237 -0
- package/declarations/components/simple-table/simple-table-row.d.ts +236 -0
- package/declarations/components/simple-table/simple-table.d.ts +249 -0
- package/declarations/components/table/cell-default.d.ts +43 -0
- package/declarations/components/table/cell-for.d.ts +38 -0
- package/declarations/components/table/cell-rendering-context.d.ts +24 -0
- package/declarations/components/table/checkbox.d.ts +50 -0
- package/declarations/components/table/column-visibility.d.ts +416 -0
- package/declarations/components/table/icons.d.ts +11 -0
- package/declarations/components/table/index.d.ts +2 -7
- package/declarations/components/table/sort-button.d.ts +413 -0
- package/declarations/components/table/table-body.d.ts +10 -7
- package/declarations/components/table/table-cell.d.ts +4 -4
- package/declarations/components/table/table-column.d.ts +20 -3
- package/declarations/components/table/table-footer.d.ts +3 -3
- package/declarations/components/table/table-header.d.ts +5 -3
- package/declarations/components/table/table-row.d.ts +20 -6
- package/declarations/components/table/table.d.ts +335 -111
- package/declarations/components/table/typed-cell-for.d.ts +34 -0
- package/declarations/components/table/types.d.ts +38 -7
- package/declarations/components/table/utils.d.ts +4 -8
- package/declarations/components/table-legacy/index.d.ts +9 -0
- package/declarations/components/table-legacy/table-body.d.ts +374 -0
- package/declarations/components/table-legacy/table-cell.d.ts +364 -0
- package/declarations/components/table-legacy/table-column.d.ts +357 -0
- package/declarations/components/table-legacy/table-footer.d.ts +365 -0
- package/declarations/components/table-legacy/table-header.d.ts +364 -0
- package/declarations/components/table-legacy/table-row.d.ts +373 -0
- package/declarations/components/table-legacy/table.d.ts +437 -0
- package/declarations/components/table-legacy/types.d.ts +20 -0
- package/declarations/components/table-legacy/utils.d.ts +16 -0
- package/declarations/index.d.ts +1 -0
- package/declarations/template-registry.d.ts +3 -1
- package/declarations/utils/tableManager.d.ts +25 -0
- package/declarations/utils/typed-table.d.ts +32 -0
- package/dist/_app_/components/table.js +1 -0
- package/dist/components/dropdown.js +1 -1
- package/dist/components/listbox.js +1 -1
- package/dist/components/table.js +2 -0
- package/dist/components/table.js.map +1 -0
- package/dist/index-OHRSSSqD.js +528 -0
- package/dist/index-OHRSSSqD.js.map +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{listManager-D4_vozfz.js → listManager-CKsOd2zS.js} +2 -2
- package/dist/{listManager-D4_vozfz.js.map → listManager-CKsOd2zS.js.map} +1 -1
- package/dist/listManager-Dth1-3Si.js +439 -0
- package/dist/listManager-Dth1-3Si.js.map +1 -0
- package/dist/listbox-BHb3ozlg.js +204 -0
- package/dist/listbox-BHb3ozlg.js.map +1 -0
- package/dist/listbox-CkGwpiDp.js +203 -0
- package/dist/listbox-CkGwpiDp.js.map +1 -0
- package/dist/listbox-ClqgWnnA.js +204 -0
- package/dist/listbox-ClqgWnnA.js.map +1 -0
- package/dist/listbox-rcGFjxs0.js +112 -47
- package/dist/listbox-y30VBGX-.js +204 -0
- package/dist/listbox-y30VBGX-.js.map +1 -0
- package/dist/simple-table-B7dwVNtZ.js +528 -0
- package/dist/simple-table-B7dwVNtZ.js.map +1 -0
- package/dist/simple-table-OHRSSSqD.js +528 -0
- package/dist/simple-table-OHRSSSqD.js.map +1 -0
- package/dist/table-B2HDNKJZ.js +406 -0
- package/dist/table-B2HDNKJZ.js.map +1 -0
- package/dist/table-BDc4IZIE.js +878 -0
- package/dist/table-BDc4IZIE.js.map +1 -0
- package/dist/table-BFkVEZvb.js +392 -0
- package/dist/table-BFkVEZvb.js.map +1 -0
- package/dist/table-BqvHQi0L.js +878 -0
- package/dist/table-BqvHQi0L.js.map +1 -0
- package/dist/table-C7ch3NLp.js +395 -0
- package/dist/table-C7ch3NLp.js.map +1 -0
- package/dist/table-CLHR4-J5.js +395 -0
- package/dist/table-CLHR4-J5.js.map +1 -0
- package/dist/table-COm7aEZ1.js +341 -0
- package/dist/table-COm7aEZ1.js.map +1 -0
- package/dist/table-CSzsuwXt.js +394 -0
- package/dist/table-CSzsuwXt.js.map +1 -0
- package/dist/table-CVCiVPCB.js +878 -0
- package/dist/table-CVCiVPCB.js.map +1 -0
- package/dist/table-CcYV8m90.js +341 -0
- package/dist/table-CcYV8m90.js.map +1 -0
- package/dist/table-DEK1U06v.js +632 -0
- package/dist/table-DEK1U06v.js.map +1 -0
- package/dist/table-DGQbKRn3.js +395 -0
- package/dist/table-DGQbKRn3.js.map +1 -0
- package/dist/table-DnQQJItF.js +632 -0
- package/dist/table-DnQQJItF.js.map +1 -0
- package/dist/table-DrBJt7Eh.js +395 -0
- package/dist/table-DrBJt7Eh.js.map +1 -0
- package/dist/table-SVR6fEqh.js +877 -0
- package/dist/table-SVR6fEqh.js.map +1 -0
- package/dist/table-XUYqiKyi.js +394 -0
- package/dist/table-XUYqiKyi.js.map +1 -0
- package/dist/table-footer-DTLYf3Ac.js +553 -0
- package/dist/table-footer-DTLYf3Ac.js.map +1 -0
- package/dist/types-B-8cgOds.js +524 -0
- package/dist/types-B-8cgOds.js.map +1 -0
- package/dist/types-CJuwIIDs.js +524 -0
- package/dist/types-CJuwIIDs.js.map +1 -0
- package/dist/types-CuXFudgJ.js +526 -0
- package/dist/types-CuXFudgJ.js.map +1 -0
- package/dist/types-DkKoxFKn.js +524 -0
- package/dist/types-DkKoxFKn.js.map +1 -0
- package/dist/utils/listManager.js +1 -1
- package/package.json +9 -7
- package/dist/table-92ff_YNO.js +0 -277
- package/dist/table-92ff_YNO.js.map +0 -1
- package/dist/table-9AY4L0Gb.js +0 -197
- package/dist/table-9AY4L0Gb.js.map +0 -1
- package/dist/table-9lHVhRR5.js +0 -241
- package/dist/table-9lHVhRR5.js.map +0 -1
- package/dist/table-BIkLOscH.js +0 -269
- package/dist/table-BIkLOscH.js.map +0 -1
- package/dist/table-BPp_OXkX.js +0 -206
- package/dist/table-BPp_OXkX.js.map +0 -1
- package/dist/table-BQBLUGgl.js +0 -208
- package/dist/table-BQBLUGgl.js.map +0 -1
- package/dist/table-BUboQojw.js +0 -267
- package/dist/table-BUboQojw.js.map +0 -1
- package/dist/table-BUrvD0CN.js +0 -324
- package/dist/table-BUrvD0CN.js.map +0 -1
- package/dist/table-B_z4aWPh.js +0 -276
- package/dist/table-B_z4aWPh.js.map +0 -1
- package/dist/table-Bi_i2GOl.js +0 -279
- package/dist/table-Bi_i2GOl.js.map +0 -1
- package/dist/table-BkWhyzMo.js +0 -214
- package/dist/table-BkWhyzMo.js.map +0 -1
- package/dist/table-Bp_EqrlK.js +0 -309
- package/dist/table-Bp_EqrlK.js.map +0 -1
- package/dist/table-Bq1HGB9C.js +0 -240
- package/dist/table-Bq1HGB9C.js.map +0 -1
- package/dist/table-C-_mQMW_.js +0 -141
- package/dist/table-C-_mQMW_.js.map +0 -1
- package/dist/table-CaBDs-LD.js +0 -269
- package/dist/table-CaBDs-LD.js.map +0 -1
- package/dist/table-CcbmieDl.js +0 -329
- package/dist/table-CcbmieDl.js.map +0 -1
- package/dist/table-CdLut7xT.js +0 -172
- package/dist/table-CdLut7xT.js.map +0 -1
- package/dist/table-Cs_Xm3-T.js +0 -144
- package/dist/table-Cs_Xm3-T.js.map +0 -1
- package/dist/table-CwxlKxz0.js +0 -185
- package/dist/table-CwxlKxz0.js.map +0 -1
- package/dist/table-D1jyvvdd.js +0 -242
- package/dist/table-D1jyvvdd.js.map +0 -1
- package/dist/table-D7QCvl0_.js +0 -269
- package/dist/table-D7QCvl0_.js.map +0 -1
- package/dist/table-DApb61os.js +0 -185
- package/dist/table-DApb61os.js.map +0 -1
- package/dist/table-DFIwJpJO.js +0 -144
- package/dist/table-DFIwJpJO.js.map +0 -1
- package/dist/table-DIZvtyjH.js +0 -185
- package/dist/table-DIZvtyjH.js.map +0 -1
- package/dist/table-DYOLmjfk.js +0 -325
- package/dist/table-DYOLmjfk.js.map +0 -1
- package/dist/table-Da60U9eH.js +0 -269
- package/dist/table-Da60U9eH.js.map +0 -1
- package/dist/table-Dcyk7CLS.js +0 -144
- package/dist/table-Dcyk7CLS.js.map +0 -1
- package/dist/table-DzNT9tDs.js +0 -280
- package/dist/table-DzNT9tDs.js.map +0 -1
- package/dist/table-EDCy6SCT.js +0 -214
- package/dist/table-EDCy6SCT.js.map +0 -1
- package/dist/table-GRGxN-x5.js +0 -309
- package/dist/table-GRGxN-x5.js.map +0 -1
- package/dist/table-Lk0tmBng.js +0 -309
- package/dist/table-Lk0tmBng.js.map +0 -1
- package/dist/table-k5i2kvUD.js +0 -324
- package/dist/table-k5i2kvUD.js.map +0 -1
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { hash } from '@ember/helper';
|
|
3
|
+
import { useStyles, twMerge } from '@frontile/theme';
|
|
4
|
+
import { modifier } from 'ember-modifier';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
import { k as keyAndLabelForItem } from './listManager-D4_vozfz.js';
|
|
8
|
+
import { headlessTable } from '@universal-ember/table';
|
|
9
|
+
import { columns } from '@universal-ember/table/plugins';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Helper to extract Frontile sticky options from a universal-ember column's pluginOptions
|
|
13
|
+
*/
|
|
14
|
+
function extractFrontileOptions(column) {
|
|
15
|
+
if (!column?.config?.pluginOptions) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Find the frontile plugin option
|
|
20
|
+
const pluginOptions = column.config.pluginOptions;
|
|
21
|
+
const frontileOption = pluginOptions.find(option => Array.isArray(option) && option[0] === 'frontile');
|
|
22
|
+
if (frontileOption && typeof frontileOption[1] === 'function') {
|
|
23
|
+
return frontileOption[1]();
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class TableColumn extends Component {
|
|
29
|
+
get isSticky() {
|
|
30
|
+
const frontileOptions = extractFrontileOptions(this.args.column);
|
|
31
|
+
return frontileOptions?.isSticky ?? this.args.isSticky ?? false;
|
|
32
|
+
}
|
|
33
|
+
get stickyPosition() {
|
|
34
|
+
const frontileOptions = extractFrontileOptions(this.args.column);
|
|
35
|
+
return frontileOptions?.stickyPosition ?? this.args.stickyPosition ?? 'left';
|
|
36
|
+
}
|
|
37
|
+
get styles() {
|
|
38
|
+
return this.args.styleFns || useStyles().table();
|
|
39
|
+
}
|
|
40
|
+
get classNames() {
|
|
41
|
+
const options = {
|
|
42
|
+
isSticky: this.isSticky,
|
|
43
|
+
stickyPosition: this.isSticky ? this.stickyPosition : undefined,
|
|
44
|
+
class: this.args.class
|
|
45
|
+
};
|
|
46
|
+
return this.styles.th(options);
|
|
47
|
+
}
|
|
48
|
+
getColumnModifier = () => {
|
|
49
|
+
if (this.args.tableInstance && this.args.column) {
|
|
50
|
+
return this.args.tableInstance.modifiers.columnHeader;
|
|
51
|
+
} else {
|
|
52
|
+
// noop modifier
|
|
53
|
+
return modifier((_element, _positional) => {});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
static {
|
|
57
|
+
setComponentTemplate(precompileTemplate("\n <th class={{this.classNames}} data-test-id=\"table-column\" data-component=\"table-column\" data-key={{if @column @column.key @key}} {{(this.getColumnModifier) @column}} ...attributes>\n {{yield}}\n </th>\n ", {
|
|
58
|
+
strictMode: true
|
|
59
|
+
}), this);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
class TableHeader extends Component {
|
|
64
|
+
get styles() {
|
|
65
|
+
return this.args.styleFns || useStyles().table();
|
|
66
|
+
}
|
|
67
|
+
get classNames() {
|
|
68
|
+
const options = {
|
|
69
|
+
isSticky: this.args.isSticky,
|
|
70
|
+
stickyPosition: this.args.isSticky ? 'top' : undefined,
|
|
71
|
+
class: twMerge(this.args.class, this.args.classes?.thead)
|
|
72
|
+
};
|
|
73
|
+
return this.styles.thead(options);
|
|
74
|
+
}
|
|
75
|
+
get rowClassNames() {
|
|
76
|
+
const options = {
|
|
77
|
+
class: twMerge('', this.args.classes?.tr || ''),
|
|
78
|
+
isSticky: false
|
|
79
|
+
};
|
|
80
|
+
return this.styles.tr(options);
|
|
81
|
+
}
|
|
82
|
+
get columns() {
|
|
83
|
+
return this.args.columns || [];
|
|
84
|
+
}
|
|
85
|
+
static {
|
|
86
|
+
setComponentTemplate(precompileTemplate("\n <thead class={{this.classNames}} data-test-id=\"table-header\" data-component=\"table-header\" ...attributes>\n <tr class={{this.rowClassNames}}>\n {{#if (has-block)}}\n {{yield (hash Column=TableColumn columns=this.columns)}}\n {{else}}\n {{#each @columns as |column|}}\n <TableColumn @column={{column}}>\n {{column.name}}\n </TableColumn>\n {{/each}}\n {{/if}}\n </tr>\n </thead>\n ", {
|
|
87
|
+
strictMode: true,
|
|
88
|
+
scope: () => ({
|
|
89
|
+
hash,
|
|
90
|
+
TableColumn
|
|
91
|
+
})
|
|
92
|
+
}), this);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
class TableCell extends Component {
|
|
97
|
+
get isSticky() {
|
|
98
|
+
return this.args.isSticky ?? false;
|
|
99
|
+
}
|
|
100
|
+
get stickyPosition() {
|
|
101
|
+
return this.args.stickyPosition ?? 'left';
|
|
102
|
+
}
|
|
103
|
+
get styles() {
|
|
104
|
+
return this.args.styleFns || useStyles().table();
|
|
105
|
+
}
|
|
106
|
+
get classNames() {
|
|
107
|
+
const options = {
|
|
108
|
+
isSticky: this.isSticky,
|
|
109
|
+
stickyPosition: this.isSticky ? this.stickyPosition : undefined,
|
|
110
|
+
isInStickyRow: this.args.isInStickyRow || false,
|
|
111
|
+
class: twMerge(this.args.class || '', this.args.classes?.td || '')
|
|
112
|
+
};
|
|
113
|
+
return this.styles.td(options);
|
|
114
|
+
}
|
|
115
|
+
static {
|
|
116
|
+
setComponentTemplate(precompileTemplate("\n <td class={{this.classNames}} data-test-id=\"table-cell\" data-component=\"table-cell\" data-column={{if @column @column.key}} ...attributes>\n {{yield}}\n </td>\n ", {
|
|
117
|
+
strictMode: true
|
|
118
|
+
}), this);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
class TableRow extends Component {
|
|
123
|
+
get isSticky() {
|
|
124
|
+
if (this.args.isSticky) return true;
|
|
125
|
+
if (this.args.stickyKeys && this.args.row) {
|
|
126
|
+
return this.args.stickyKeys.includes(this.rowKey);
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
get styles() {
|
|
131
|
+
return this.args.styleFns || useStyles().table();
|
|
132
|
+
}
|
|
133
|
+
get classNames() {
|
|
134
|
+
const options = {
|
|
135
|
+
isSticky: this.isSticky,
|
|
136
|
+
stickyPosition: this.isSticky ? 'top' : undefined,
|
|
137
|
+
hasStickyHeader: this.args.isStickyHeader || false,
|
|
138
|
+
class: twMerge(this.args.class || '', this.args.classes?.tr || '')
|
|
139
|
+
};
|
|
140
|
+
return this.styles.tr(options);
|
|
141
|
+
}
|
|
142
|
+
get rowKey() {
|
|
143
|
+
if (this.args.row) {
|
|
144
|
+
// Universal-ember Row objects have structure: { data, table, index }
|
|
145
|
+
// Extract the actual data from the row wrapper
|
|
146
|
+
const row = this.args.row;
|
|
147
|
+
const actualData = row.data || row;
|
|
148
|
+
try {
|
|
149
|
+
const {
|
|
150
|
+
key
|
|
151
|
+
} = keyAndLabelForItem(actualData);
|
|
152
|
+
return key;
|
|
153
|
+
} catch (error) {
|
|
154
|
+
// Fallback: use the row index if key extraction fails
|
|
155
|
+
return row.index?.toString() || '';
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
get columns() {
|
|
161
|
+
return this.args.columns || [];
|
|
162
|
+
}
|
|
163
|
+
getRowModifier = () => {
|
|
164
|
+
if (this.args.tableInstance && this.args.row) {
|
|
165
|
+
return this.args.tableInstance.modifiers.row;
|
|
166
|
+
} else {
|
|
167
|
+
// noop modifier
|
|
168
|
+
return modifier((_element, _positional) => {});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
static {
|
|
172
|
+
setComponentTemplate(precompileTemplate("\n <tr class={{this.classNames}} data-test-id=\"table-row\" data-component=\"table-row\" data-key={{this.rowKey}} {{(this.getRowModifier) @row}} ...attributes>\n {{#if (has-block)}}\n {{yield (hash Cell=TableCell columns=this.columns)}}\n {{else}}\n {{#each @columns as |column|}}\n {{#if @row}}\n {{#let (column.getValueForRow @row) as |value|}}\n <TableCell @row={{@row}} @column={{column}} @isInStickyRow={{this.isSticky}} @styleFns={{@styleFns}} @classes={{@classes}}>\n {{value}}\n </TableCell>\n {{/let}}\n {{/if}}\n {{/each}}\n {{/if}}\n </tr>\n ", {
|
|
173
|
+
strictMode: true,
|
|
174
|
+
scope: () => ({
|
|
175
|
+
hash,
|
|
176
|
+
TableCell
|
|
177
|
+
})
|
|
178
|
+
}), this);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
class TableBody extends Component {
|
|
183
|
+
get styles() {
|
|
184
|
+
return this.args.styleFns || useStyles().table();
|
|
185
|
+
}
|
|
186
|
+
get classNames() {
|
|
187
|
+
const mergedClass = twMerge(this.args.class, this.args.classes?.tbody);
|
|
188
|
+
return this.styles.tbody({
|
|
189
|
+
class: mergedClass
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
get rows() {
|
|
193
|
+
return this.args.rows || [];
|
|
194
|
+
}
|
|
195
|
+
get columns() {
|
|
196
|
+
return this.args.columns || [];
|
|
197
|
+
}
|
|
198
|
+
static {
|
|
199
|
+
setComponentTemplate(precompileTemplate("\n <tbody class={{this.classNames}} data-test-id=\"table-body\" data-component=\"table-body\" ...attributes>\n {{#if (has-block)}}\n {{yield (hash Row=TableRow Cell=TableCell rows=this.rows columns=this.columns)}}\n {{else}}\n {{#each @rows as |row|}}\n {{#if (has-block \"row\")}}\n {{yield (hash row=row Row=TableRow Cell=TableCell) to=\"row\"}}\n {{else}}\n <TableRow @row={{row}} @columns={{@columns}} @styleFns={{@styleFns}} @classes={{@classes}}>\n {{#each @columns as |column|}}\n {{#let (column.getValueForRow row) as |value|}}\n <TableCell @row={{row}} @column={{column}} @styleFns={{@styleFns}} @classes={{@classes}}>\n {{value}}\n </TableCell>\n {{/let}}\n {{/each}}\n </TableRow>\n {{/if}}\n {{/each}}\n {{/if}}\n </tbody>\n ", {
|
|
200
|
+
strictMode: true,
|
|
201
|
+
scope: () => ({
|
|
202
|
+
hash,
|
|
203
|
+
TableRow,
|
|
204
|
+
TableCell
|
|
205
|
+
})
|
|
206
|
+
}), this);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
class TableFooter extends Component {
|
|
211
|
+
get styles() {
|
|
212
|
+
return this.args.styleFns || useStyles().table();
|
|
213
|
+
}
|
|
214
|
+
get classNames() {
|
|
215
|
+
const options = {
|
|
216
|
+
isSticky: this.args.isSticky ?? false,
|
|
217
|
+
stickyPosition: this.args.isSticky ? 'bottom' : undefined,
|
|
218
|
+
class: twMerge(this.args.class, this.args.classes?.tfoot)
|
|
219
|
+
};
|
|
220
|
+
return this.styles.tfoot(options);
|
|
221
|
+
}
|
|
222
|
+
get rowClassNames() {
|
|
223
|
+
const options = {
|
|
224
|
+
class: twMerge('', this.args.classes?.tr || ''),
|
|
225
|
+
isSticky: false
|
|
226
|
+
};
|
|
227
|
+
return this.styles.tr(options);
|
|
228
|
+
}
|
|
229
|
+
static {
|
|
230
|
+
setComponentTemplate(precompileTemplate("\n <tfoot class={{this.classNames}} data-test-id=\"table-footer\" data-component=\"table-footer\" ...attributes>\n <tr class={{this.rowClassNames}}>\n {{#if (has-block)}}\n {{yield (hash Column=TableColumn)}}\n {{else}}\n {{#each @columns as |column|}}\n <TableColumn @key={{column.key}}>\n {{column.name}}\n </TableColumn>\n {{/each}}\n {{/if}}\n </tr>\n </tfoot>\n ", {
|
|
231
|
+
strictMode: true,
|
|
232
|
+
scope: () => ({
|
|
233
|
+
hash,
|
|
234
|
+
TableColumn
|
|
235
|
+
})
|
|
236
|
+
}), this);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
class Table extends Component {
|
|
241
|
+
// Needed to make glint happy with generic components
|
|
242
|
+
TableBody = TableBody;
|
|
243
|
+
TableFooter = TableFooter;
|
|
244
|
+
TableRow = TableRow;
|
|
245
|
+
TableCell = TableCell;
|
|
246
|
+
TableColumn = TableColumn;
|
|
247
|
+
TableHeader = TableHeader;
|
|
248
|
+
// Transform Frontile ColumnConfig to universal-ember ColumnConfig with pluginOptions
|
|
249
|
+
processColumns(columns) {
|
|
250
|
+
return columns.map(column => {
|
|
251
|
+
const {
|
|
252
|
+
isSticky,
|
|
253
|
+
stickyPosition,
|
|
254
|
+
...universalColumn
|
|
255
|
+
} = column;
|
|
256
|
+
// If we have Frontile-specific sticky options, embed them in pluginOptions
|
|
257
|
+
if (isSticky !== undefined || stickyPosition !== undefined) {
|
|
258
|
+
const frontileOption = ['frontile', () => ({
|
|
259
|
+
isSticky,
|
|
260
|
+
stickyPosition
|
|
261
|
+
})];
|
|
262
|
+
return {
|
|
263
|
+
...universalColumn,
|
|
264
|
+
pluginOptions: [...(universalColumn.pluginOptions || []), frontileOption]
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
return universalColumn;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
tableInstance = headlessTable(this, {
|
|
271
|
+
data: () => this.args.items,
|
|
272
|
+
columns: () => this.processColumns(this.args.columns),
|
|
273
|
+
plugins: []
|
|
274
|
+
});
|
|
275
|
+
get styles() {
|
|
276
|
+
const {
|
|
277
|
+
table
|
|
278
|
+
} = useStyles();
|
|
279
|
+
return table({
|
|
280
|
+
size: this.args.size,
|
|
281
|
+
layout: this.args.layout,
|
|
282
|
+
striped: this.args.isStriped,
|
|
283
|
+
isScrollable: this.args.isScrollable || false,
|
|
284
|
+
hasStickyHeader: this.args.isStickyHeader || false,
|
|
285
|
+
class: this.args.classes?.base
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
get wrapperClassNames() {
|
|
289
|
+
return this.styles.wrapper({
|
|
290
|
+
class: this.args.classes?.wrapper
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
calculateHeaderHeight = modifier(el => {
|
|
294
|
+
if (this.args.isStickyHeader) {
|
|
295
|
+
const updateHeight = () => {
|
|
296
|
+
const thead = el.querySelector('thead');
|
|
297
|
+
if (thead) {
|
|
298
|
+
const headerHeight = Math.round(thead.offsetHeight);
|
|
299
|
+
el.style.setProperty('--table-header-height', `${headerHeight}px`);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
requestAnimationFrame(updateHeight);
|
|
303
|
+
// Update on resize
|
|
304
|
+
let observer;
|
|
305
|
+
observer = new ResizeObserver(updateHeight);
|
|
306
|
+
observer.observe(el);
|
|
307
|
+
return () => {
|
|
308
|
+
if (observer) {
|
|
309
|
+
observer.disconnect();
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
get tableClassNames() {
|
|
315
|
+
return this.styles.table({
|
|
316
|
+
class: this.args.classes?.table
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
get columns() {
|
|
320
|
+
return this.args.columns;
|
|
321
|
+
}
|
|
322
|
+
get footerColumns() {
|
|
323
|
+
return this.args.footerColumns || [];
|
|
324
|
+
}
|
|
325
|
+
get items() {
|
|
326
|
+
return this.tableInstance.rows.values();
|
|
327
|
+
}
|
|
328
|
+
get headlessColumns() {
|
|
329
|
+
return columns.for(this.tableInstance);
|
|
330
|
+
}
|
|
331
|
+
get headlessRows() {
|
|
332
|
+
return this.tableInstance.rows.values();
|
|
333
|
+
}
|
|
334
|
+
static {
|
|
335
|
+
setComponentTemplate(precompileTemplate("\n <div class={{this.wrapperClassNames}} {{this.calculateHeaderHeight}} {{this.tableInstance.modifiers.container}} data-component=\"table-wrapper\">\n <table class={{this.tableClassNames}} data-test-id=\"table\" data-component=\"table\" ...attributes>\n <this.TableHeader @columns={{this.headlessColumns}} @isSticky={{@isStickyHeader}} @styleFns={{this.styles}} @classes={{this.args.classes}}>\n {{#each this.headlessColumns as |column|}}\n <this.TableColumn @column={{column}} @styleFns={{this.styles}} @tableInstance={{this.tableInstance}}>\n {{column.name}}\n </this.TableColumn>\n {{/each}}\n </this.TableHeader>\n\n <this.TableBody @columns={{this.headlessColumns}} @rows={{this.headlessRows}} @styleFns={{this.styles}} @classes={{this.args.classes}}>\n {{#each this.headlessRows as |row|}}\n <this.TableRow @row={{row}} @columns={{this.headlessColumns}} @stickyKeys={{@stickyKeys}} @isStickyHeader={{@isStickyHeader}} @styleFns={{this.styles}} @classes={{this.args.classes}} @tableInstance={{this.tableInstance}}>\n {{#each this.headlessColumns as |column|}}\n <this.TableCell @row={{row}} @column={{column}} @styleFns={{this.styles}} @classes={{this.args.classes}}>\n {{column.getValueForRow row}}\n </this.TableCell>\n {{/each}}\n </this.TableRow>\n {{else}}\n {{#if @emptyContent}}\n <this.TableRow @styleFns={{this.styles}} @classes={{this.args.classes}} @tableInstance={{this.tableInstance}} data-test-id=\"table-empty-row\">\n <this.TableCell colspan={{this.columns.length}} @styleFns={{this.styles}} @classes={{this.args.classes}} @class={{(this.styles.emptyCell)}} data-test-id=\"table-empty-cell\">\n {{@emptyContent}}\n </this.TableCell>\n </this.TableRow>\n {{/if}}\n {{/each}}\n </this.TableBody>\n\n {{#if this.footerColumns.length}}\n <this.TableFooter @columns={{this.footerColumns}} @isSticky={{@isStickyFooter}} @styleFns={{this.styles}} @classes={{this.args.classes}}>\n {{#each this.footerColumns as |column|}}\n <this.TableColumn @key={{column.key}} @styleFns={{this.styles}} @tableInstance={{this.tableInstance}}>\n {{column.name}}\n </this.TableColumn>\n {{/each}}\n </this.TableFooter>\n {{/if}}\n </table>\n </div>\n ", {
|
|
336
|
+
strictMode: true
|
|
337
|
+
}), this);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
class SimpleTableColumn extends Component {
|
|
342
|
+
get styles() {
|
|
343
|
+
return this.args.styleFns || useStyles().table();
|
|
344
|
+
}
|
|
345
|
+
get classNames() {
|
|
346
|
+
const options = {
|
|
347
|
+
isSticky: false,
|
|
348
|
+
stickyPosition: undefined,
|
|
349
|
+
class: this.args.class
|
|
350
|
+
};
|
|
351
|
+
return this.styles.th(options);
|
|
352
|
+
}
|
|
353
|
+
static {
|
|
354
|
+
setComponentTemplate(precompileTemplate("\n <th class={{this.classNames}} data-test-id=\"table-column\" data-component=\"table-column\" ...attributes>\n {{yield}}\n </th>\n ", {
|
|
355
|
+
strictMode: true
|
|
356
|
+
}), this);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
class SimpleTableHeader extends Component {
|
|
361
|
+
get styles() {
|
|
362
|
+
return this.args.styleFns || useStyles().table();
|
|
363
|
+
}
|
|
364
|
+
get classNames() {
|
|
365
|
+
const options = {
|
|
366
|
+
isSticky: false,
|
|
367
|
+
stickyPosition: undefined,
|
|
368
|
+
class: twMerge(this.args.class, this.args.classes?.thead)
|
|
369
|
+
};
|
|
370
|
+
return this.styles.thead(options);
|
|
371
|
+
}
|
|
372
|
+
get rowClassNames() {
|
|
373
|
+
const options = {
|
|
374
|
+
class: twMerge('', this.args.classes?.tr || ''),
|
|
375
|
+
isSticky: false
|
|
376
|
+
};
|
|
377
|
+
return this.styles.tr(options);
|
|
378
|
+
}
|
|
379
|
+
static {
|
|
380
|
+
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 </thead>\n ", {
|
|
381
|
+
strictMode: true,
|
|
382
|
+
scope: () => ({
|
|
383
|
+
hash,
|
|
384
|
+
SimpleTableColumn
|
|
385
|
+
})
|
|
386
|
+
}), this);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
class SimpleTableCell extends Component {
|
|
391
|
+
get styles() {
|
|
392
|
+
return this.args.styleFns || useStyles().table();
|
|
393
|
+
}
|
|
394
|
+
get classNames() {
|
|
395
|
+
const options = {
|
|
396
|
+
isSticky: false,
|
|
397
|
+
stickyPosition: undefined,
|
|
398
|
+
isInStickyRow: false,
|
|
399
|
+
class: twMerge(this.args.class || '', this.args.classes?.td || '')
|
|
400
|
+
};
|
|
401
|
+
return this.styles.td(options);
|
|
402
|
+
}
|
|
403
|
+
static {
|
|
404
|
+
setComponentTemplate(precompileTemplate("\n <td class={{this.classNames}} data-test-id=\"table-cell\" data-component=\"table-cell\" ...attributes>\n {{yield}}\n </td>\n ", {
|
|
405
|
+
strictMode: true
|
|
406
|
+
}), this);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
class SimpleTableRow extends Component {
|
|
411
|
+
get styles() {
|
|
412
|
+
return this.args.styleFns || useStyles().table();
|
|
413
|
+
}
|
|
414
|
+
get classNames() {
|
|
415
|
+
const options = {
|
|
416
|
+
isSticky: false,
|
|
417
|
+
stickyPosition: undefined,
|
|
418
|
+
hasStickyHeader: false,
|
|
419
|
+
class: twMerge(this.args.class || '', this.args.classes?.tr || '')
|
|
420
|
+
};
|
|
421
|
+
return this.styles.tr(options);
|
|
422
|
+
}
|
|
423
|
+
static {
|
|
424
|
+
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 ", {
|
|
425
|
+
strictMode: true,
|
|
426
|
+
scope: () => ({
|
|
427
|
+
hash,
|
|
428
|
+
SimpleTableCell
|
|
429
|
+
})
|
|
430
|
+
}), this);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
class SimpleTableBody extends Component {
|
|
435
|
+
get styles() {
|
|
436
|
+
return this.args.styleFns || useStyles().table();
|
|
437
|
+
}
|
|
438
|
+
get classNames() {
|
|
439
|
+
const mergedClass = twMerge(this.args.class, this.args.classes?.tbody);
|
|
440
|
+
return this.styles.tbody({
|
|
441
|
+
class: mergedClass
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
static {
|
|
445
|
+
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 ", {
|
|
446
|
+
strictMode: true,
|
|
447
|
+
scope: () => ({
|
|
448
|
+
hash,
|
|
449
|
+
SimpleTableRow,
|
|
450
|
+
SimpleTableCell
|
|
451
|
+
})
|
|
452
|
+
}), this);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
class SimpleTableFooter extends Component {
|
|
457
|
+
get styles() {
|
|
458
|
+
return this.args.styleFns || useStyles().table();
|
|
459
|
+
}
|
|
460
|
+
get classNames() {
|
|
461
|
+
const options = {
|
|
462
|
+
isSticky: false,
|
|
463
|
+
stickyPosition: undefined,
|
|
464
|
+
class: twMerge(this.args.class, this.args.classes?.tfoot)
|
|
465
|
+
};
|
|
466
|
+
return this.styles.tfoot(options);
|
|
467
|
+
}
|
|
468
|
+
get rowClassNames() {
|
|
469
|
+
const options = {
|
|
470
|
+
class: twMerge('', this.args.classes?.tr || ''),
|
|
471
|
+
isSticky: false
|
|
472
|
+
};
|
|
473
|
+
return this.styles.tr(options);
|
|
474
|
+
}
|
|
475
|
+
static {
|
|
476
|
+
setComponentTemplate(precompileTemplate("\n <tfoot class={{this.classNames}} data-test-id=\"table-footer\" data-component=\"table-footer\" ...attributes>\n <tr class={{this.rowClassNames}}>\n {{yield (hash Column=SimpleTableColumn)}}\n </tr>\n </tfoot>\n ", {
|
|
477
|
+
strictMode: true,
|
|
478
|
+
scope: () => ({
|
|
479
|
+
hash,
|
|
480
|
+
SimpleTableColumn
|
|
481
|
+
})
|
|
482
|
+
}), this);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
class SimpleTable extends Component {
|
|
487
|
+
// Needed to make glint happy with generic components
|
|
488
|
+
SimpleTableBody = SimpleTableBody;
|
|
489
|
+
SimpleTableFooter = SimpleTableFooter;
|
|
490
|
+
SimpleTableRow = SimpleTableRow;
|
|
491
|
+
SimpleTableCell = SimpleTableCell;
|
|
492
|
+
SimpleTableColumn = SimpleTableColumn;
|
|
493
|
+
SimpleTableHeader = SimpleTableHeader;
|
|
494
|
+
get styles() {
|
|
495
|
+
const {
|
|
496
|
+
table
|
|
497
|
+
} = useStyles();
|
|
498
|
+
return table({
|
|
499
|
+
size: this.args.size,
|
|
500
|
+
layout: this.args.layout,
|
|
501
|
+
striped: this.args.isStriped,
|
|
502
|
+
isScrollable: false,
|
|
503
|
+
hasStickyHeader: false,
|
|
504
|
+
class: this.args.classes?.base
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
get wrapperClassNames() {
|
|
508
|
+
return this.styles.wrapper({
|
|
509
|
+
class: this.args.classes?.wrapper
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
get tableClassNames() {
|
|
513
|
+
return this.styles.table({
|
|
514
|
+
class: this.args.classes?.table
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
static {
|
|
518
|
+
setComponentTemplate(precompileTemplate("\n <div class={{this.wrapperClassNames}} data-component=\"table-wrapper\">\n <table class={{this.tableClassNames}} data-test-id=\"table\" data-component=\"table\" ...attributes>\n {{yield (hash Header=(component this.SimpleTableHeader styleFns=this.styles classes=this.args.classes) Body=(component this.SimpleTableBody styleFns=this.styles classes=this.args.classes) Footer=(component this.SimpleTableFooter styleFns=this.styles classes=this.args.classes) Column=(component this.SimpleTableColumn styleFns=this.styles) Row=(component this.SimpleTableRow styleFns=this.styles classes=this.args.classes) Cell=(component this.SimpleTableCell styleFns=this.styles classes=this.args.classes))}}\n </table>\n </div>\n ", {
|
|
519
|
+
strictMode: true,
|
|
520
|
+
scope: () => ({
|
|
521
|
+
hash
|
|
522
|
+
})
|
|
523
|
+
}), this);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export { SimpleTable as S, Table as T, TableHeader as a, TableBody as b, TableFooter as c, TableColumn as d, TableRow as e, TableCell as f, SimpleTableHeader as g, SimpleTableBody as h, SimpleTableFooter as i, SimpleTableColumn as j, SimpleTableRow as k, SimpleTableCell as l };
|
|
528
|
+
//# sourceMappingURL=simple-table-B7dwVNtZ.js.map
|