Skip to content

Commit 5503c57

Browse files
authored
refactor: convert group row to ts (#868)
* chore: use pion Renderable and keep group row TS * chore(lint): fix * refactor: export from main pionjs
1 parent 56a0303 commit 5503c57

File tree

7 files changed

+82
-49
lines changed

7 files changed

+82
-49
lines changed

package-lock.json

Lines changed: 30 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"@neovici/cosmoz-spinner": "^1.0.1",
119119
"@neovici/cosmoz-utils": "^6.14.2",
120120
"@neovici/nullxlsx": "^3.0.0",
121-
"@pionjs/pion": "^2.0.0",
121+
"@pionjs/pion": "^2.11.0",
122122
"@polymer/polymer": "^3.3.0",
123123
"file-saver-es": "^2.0.0",
124124
"i18next": "^25.6.0",

src/cosmoz-omnitable-group-row.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/cosmoz-omnitable-group-row.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { component } from '@pionjs/pion';
2+
import { nothing } from 'lit-html';
3+
import { GroupItem } from './grouped-list/utils';
4+
import { Column, RenderContext } from './lib/types';
5+
6+
interface GroupRowProps {
7+
column: Column;
8+
item: RenderContext['item'];
9+
selected: boolean;
10+
folded: boolean;
11+
group: GroupItem;
12+
}
13+
14+
const GroupRow = ({ column, item, selected, folded, group }: GroupRowProps) => {
15+
if (!column) {
16+
return nothing;
17+
}
18+
19+
return (column.renderGroup ?? column.renderCell)?.(column, {
20+
item,
21+
selected,
22+
folded,
23+
group,
24+
});
25+
};
26+
27+
customElements.define(
28+
'cosmoz-omnitable-group-row',
29+
component(GroupRow, { useShadowDOM: false }),
30+
);

src/lib/render-footer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { html, TemplateResult } from 'lit-html';
1+
import { html } from 'lit-html';
2+
import type { Renderable } from '@pionjs/pion';
23
import { t } from 'i18next';
34
import { saveAsCsvAction, CsvColumn } from './save-as-csv-action';
45
import { saveAsXlsxAction, XlsxColumn } from './save-as-xlsx-action';
@@ -21,7 +22,7 @@ export const renderFooter = ({
2122
xlsxFilename,
2223
xlsxSheetname,
2324
topPlacement,
24-
}: RenderFooterParams): TemplateResult =>
25+
}: RenderFooterParams): Renderable =>
2526
html`<cosmoz-bottom-bar
2627
id="bottomBar"
2728
?active=${!isEmpty(selectedItems.length)}

0 commit comments

Comments
 (0)