Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
b121ea9
fix: refactor ideas
tcoile Jan 28, 2025
58d4e0e
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Feb 4, 2025
2187c63
ci: add data source file
achou-mpr Feb 4, 2025
4b8ae18
fix: changes to table example html, co-authored by Tom Coile
achou-mpr Feb 4, 2025
cd908b2
ci: temp for data source
achou-mpr Feb 4, 2025
0311680
fix: use rxjs in data source for table
achou-mpr Feb 5, 2025
7f45682
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Feb 5, 2025
f4c2c74
fix: remove props from table column
achou-mpr Feb 5, 2025
74dfeb5
fix: remove old logic for new hsi ui table
achou-mpr Feb 6, 2025
ff28423
fix: update to not sort automatically
achou-mpr Feb 6, 2025
5ca17fb
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Feb 6, 2025
6673cf0
fix: remove original table component files
achou-mpr Feb 6, 2025
9b062a1
fix: update table example styling, use single sort header
achou-mpr Feb 7, 2025
04d6590
fix: update tests for data source
achou-mpr Feb 10, 2025
38f49ad
fix: remove duplicate styling, remove width prop from table col
achou-mpr Feb 10, 2025
9c6d836
fix: remove view encapsulation
achou-mpr Feb 10, 2025
594ed5d
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Feb 26, 2025
9f4d19c
fix: remove override from disconnect and connect in data source
achou-mpr Feb 26, 2025
73d1ef8
fix: rename dataSource sort function
achou-mpr Feb 26, 2025
34b94cb
fix: add column builder class
achou-mpr Feb 26, 2025
fb1a39a
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Mar 12, 2025
89e000b
fix: add internal id to table column
achou-mpr Mar 12, 2025
38f1b49
fix: add custom sort example, table columns builder
achou-mpr Mar 13, 2025
9a64f5c
fix: update custom sort example link
achou-mpr Mar 13, 2025
d78b78e
fix: more updates to custom sort
achou-mpr Mar 13, 2025
32ea479
fix: docs for table
achou-mpr Mar 13, 2025
924c37d
fix: remove single sort header entirely from table
achou-mpr Mar 20, 2025
96c2c05
fix: expose columns and columnids in datasource
achou-mpr Mar 20, 2025
4390b1d
fix: remove custom sort example, duplicated in regular table example
achou-mpr Mar 20, 2025
689bb24
fix: add get value by key pipe
achou-mpr Mar 20, 2025
3509308
fix: use getvaluebykey pipe in examples
achou-mpr Mar 24, 2025
5955214
fix: add subkey functionality
achou-mpr Mar 24, 2025
3f230f7
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Mar 24, 2025
c003eaa
fix: more table docs updates
achou-mpr Mar 24, 2025
ad75654
Merge branch 'main' into table-refactor-ideas
cemcshane Mar 27, 2025
2ae3090
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Apr 4, 2025
4918dfa
fix: add better table styling example
achou-mpr Apr 4, 2025
2fb5fae
fix: view encapsulation for builder method docs styling in table content
achou-mpr Apr 4, 2025
f1e0883
fix: update docs for both table column builders
achou-mpr Apr 4, 2025
2981fed
fix: update table builder docs
achou-mpr Apr 7, 2025
21a73b6
fix: default in builder doc
achou-mpr Apr 7, 2025
d01e7d3
fix: add css class prop to table column
achou-mpr Apr 8, 2025
9a8d914
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Apr 25, 2025
f8ef599
fix: work
achou-mpr May 7, 2025
13044ad
fix: get basic sort to work without actually understanding anything
tcoile May 7, 2025
3db2330
fix: clean up code, add styling icons
achou-mpr Jun 9, 2025
c1c763c
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Jun 10, 2025
35c7e74
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Jun 16, 2025
4c20b66
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Jun 19, 2025
087a7a9
Merge branch 'main' of https://github.com/mathematica-org/frontend-sh…
achou-mpr Jun 30, 2025
b54afc1
Merge branch 'main' into tanstack-investigate
tcoile Jul 15, 2025
c865463
fix: comment out broken code whoop
tcoile Jul 15, 2025
3e0fd36
Merge branch 'tanstack-investigate' of https://github.com/mathematica…
tcoile Jul 15, 2025
1fcb945
docs: add charts to tanstack example
tcoile Jul 16, 2025
f89a168
fix: remove old key value pipe
achou-mpr Jul 16, 2025
c067248
fix: remove old table example
achou-mpr Jul 16, 2025
191a798
Revert "fix: remove old table example"
achou-mpr Jul 18, 2025
43c6563
Revert "fix: remove old key value pipe"
achou-mpr Jul 18, 2025
9fd6382
fix: add back table example component
achou-mpr Jul 18, 2025
53e93ff
docs: mark old table as deprecated
achou-mpr Jul 21, 2025
f306030
docs: add deprecated note to table md
achou-mpr Jul 21, 2025
5fdef61
docs: builders should be deprecated too
achou-mpr Jul 21, 2025
bb79c89
Merge pull request #700 from mathematica-org/698-mark-old-table-depre…
tcoile Aug 13, 2025
636edc6
Merge branch 'main' into tanstack-investigate
achou-mpr Aug 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
<ng-template let-section #customAngular>
@switch (section.content) {
@case ('simple table') {
<app-single-panel-example-display
height="600px"
path="app/content/ui-components/table-content/tanstack-example"
class="example"
label="Tanstack table example"
>
<app-tanstack-example></app-tanstack-example>
</app-single-panel-example-display>
}
@case ('deprecated simple table') {
<app-single-panel-example-display
height="600px"
path="app/content/ui-components/table-content/table-example"
class="example"
label="table example"
label="Deprectated table example"
>
<app-table-example></app-table-example>
</app-single-panel-example-display>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
ViewEncapsulation,
} from '@angular/core';
import { SinglePanelExampleDisplayComponent } from '../../../platform/single-panel-example-display/single-panel-example-display.component';
import { ContentContainerComponent } from '../../content-container/content-container.component';
import { TableExampleComponent } from './table-example/table-example.component';
import { TanstackExampleComponent } from './tanstack-example/tanstack-example.component';

@Component({
selector: 'app-table-content',
imports: [
CommonModule,
SinglePanelExampleDisplayComponent,
TableExampleComponent,
TanstackExampleComponent,
ContentContainerComponent,
TableExampleComponent,
],
templateUrl: './table-content.component.html',
styleUrls: ['../../examples.scss', './table-content.component.scss'],
styleUrls: [
'../../examples.scss',
'../../api-documentation.scss',
'./table-content.component.scss',
],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
export class TableContentComponent {}
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
<hsi-ui-table [config$]="config$"></hsi-ui-table>
@if (dataSource.columns$ | async; as columns) {
<table cdk-table [dataSource]="dataSource" class="table-container">
@for (column of columns; track column.id) {
<ng-container [cdkColumnDef]="column.id">
@if (column.sortable) {
<th
scope="col"
cdk-header-cell
*cdkHeaderCellDef="let element"
(click)="dataSource.sort(column)"
>
<div class="header-cell-sort">
{{ column.label }}
<span
[ngClass]="[
'material-sort-icon',
column.sortDirection,
column.activelySorted ? 'actively-sorted' : '',
'material-symbols-outlined',
]"
[attr.aria-hidden]="true"
>{{ sortIcon }}</span
>
</div></th
>
} @else {
<th cdk-header-cell *cdkHeaderCellDef="let element">
{{ column.label }}
</th>
}
<td
class="table-cell"
[class.sorted-cell]="column.sortable"
cdk-cell
*cdkCellDef="let element"
>
{{ element | getValueByKey: column.key }}
</td>
</ng-container>
}
<tr cdk-header-row *cdkHeaderRowDef="dataSource.columnIds$ | async"></tr>
<tr
cdk-row
*cdkRowDef="let row; columns: dataSource.columnIds$ | async"
></tr>
</table>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@use 'vars' as *;
@use 'functions' as *;
@use 'colors';
$icon-width: 0.9rem;
$icon-left-margin: 0.2rem;
$icon-right-margin: 0.4rem;

.header-cell-sort {
display: flex;
align-items: flex-end;
justify-content: flex-end;
&:hover {
cursor: pointer;
}
}

.material-symbols-outlined {
display: flex;
justify-content: center;
width: $icon-width;
height: 1.2rem;
font-size: 1.25rem;
margin-left: $icon-left-margin;
margin-right: $icon-right-margin;
opacity: 0.25;
transition: all 150ms ease-in-out;

&:hover {
opacity: 0.75;
}

&.actively-sorted {
opacity: 1;
}
}

.desc {
transform: rotate(180deg);
}

.table-cell {
text-align: right;

&.sorted-cell {
padding-right: $icon-left-margin + $icon-width + $icon-right-margin;
}
}

.table-container {
border-spacing: 0;
td:last-child {
&.left {
padding-right: 0;
}
}

th:last-child {
&.left {
padding-right: 0;
}
}

th {
vertical-align: bottom;
&.sorted-header {
padding-right: 0;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,121 @@
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { TableColumn, TableModule } from '@hsi/ui-components';
import { BehaviorSubject } from 'rxjs';
import {
ChangeDetectionStrategy,
Component,
Input,
OnInit,
} from '@angular/core';
import { GetValueByKeyPipe } from '@hsi/app-dev-kit';
import {
HsiUiTableDataSource,
TableColumnsBuilder,
TableModule,
} from '@hsi/ui-components';
import { of } from 'rxjs';

enum ColumnNames {
fruit = 'Fruit',
colorName = 'Color',
inventory = 'Inventory',
price = 'Sell price',
}

enum FruitInfo {
fruit = 'fruit',
colorName = 'color',
inventory = 'metrics.inventory',
price = 'metrics.price',
}

class FruitType {
fruit: string;
color: string;
metrics: {
inventory: number;
price: number;
};
}

/**
* @deprecated This component is deprecated. See `tanstack-example.component.ts` for the recommended implementation.
*/
@Component({
selector: 'app-table-example',
imports: [CommonModule, TableModule],
standalone: true,
imports: [CommonModule, TableModule, GetValueByKeyPipe],
templateUrl: './table-example.component.html',
styleUrl: './table-example.component.scss',
styleUrls: ['../../../examples.scss', './table-example.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TableExampleComponent {
config$ = new BehaviorSubject({
data: [
{ fruit: 'apple', color: 'red' },
{ fruit: 'orange', color: 'orange' },
{ fruit: 'banana', color: 'yellow' },
],
columns: [
new TableColumn<{ fruit: string; color: string }>({
label: 'Fruit',
getFormattedValue: (x) => x.fruit,
sortable: true,
}),
new TableColumn<{ fruit: string; color: string }>({
label: 'Color',
getFormattedValue: (x) => x.color,
sortable: true,
}),
],
});
export class TableExampleComponent implements OnInit {
@Input() sortIcon: string = 'arrow_upward';
dataSource: HsiUiTableDataSource<FruitType>;

ngOnInit(): void {
this.setTableData();
}

setTableData() {
const initData$ = of([
{
fruit: 'lemon',
color: 'yellow',
metrics: { inventory: 10, price: 1.2 },
},
{
fruit: 'mango',
color: 'orange',
metrics: { inventory: 5, price: 2.5 },
},
{
fruit: 'avocado',
color: 'green',
metrics: { inventory: 20, price: 3.0 },
},
{
fruit: 'apple',
color: 'red',
metrics: { inventory: 15, price: 1.5 },
},
{
fruit: 'orange',
color: 'orange',
metrics: { inventory: 20, price: 1.8 },
},
{
fruit: 'banana',
color: 'yellow',
metrics: { inventory: 5, price: 1.0 },
},
]);
const initColumns$ = of(
new TableColumnsBuilder<FruitType>()
.addColumn(
(column) =>
column
.label(ColumnNames.fruit)
.displayKey(FruitInfo.fruit)
.ascendingSortFunction((a, b) => a.fruit.localeCompare(b.fruit))
.sortOrder(1)
.sortable(true)
.sortDirection('asc') // initial sort direction
)
.addColumn((column) =>
column
.displayKey(FruitInfo.colorName)
.label(ColumnNames.colorName)
.sortable(true)
.ascendingSortFunction((a, b) => a.color.localeCompare(b.color))
)
.addColumn((column) =>
column
.displayKey(FruitInfo.inventory)
.label(ColumnNames.inventory)
.sortable(true)
.getSortValue((x) => x.metrics.inventory)
)
.getConfig()
);
this.dataSource = new HsiUiTableDataSource(initData$, initColumns$);
}
}
Loading