@masterteam/data-table
v0.0.1
Published
Masterteam entity-aware tables and portal renderer for the independent data grid.
Readme
@masterteam/data-table
Entity Info integration for the independent Angular 21 @masterteam/data-grid.
Use MtDataGridComponent directly. It owns all UI, inputs, outputs, API, grouping,
filters, pagination, charts, pivot and exports. This package's primary API adds
entity renderers and column helpers, with no grid component, toolbar, profiles,
layout or feature restrictions. The grid retains the demo's visual defaults. For a visible native Columns/Filters
rail with closed panels, pass [sideBar]="{toolPanels: ['columns', 'filters']}".
Omit defaultToolPanel; hiddenByDefault hides the entire rail. Consumers choose
position: 'left' in RTL and 'right' in LTR to place it at the logical end.
Usage
Import MtDataGridComponent / MtColumnDef from @masterteam/data-grid and
mtEntityColumn from @masterteam/data-table. Build normal column definitions;
for entity columns supply viewType and an entity(row) resolver returning the
existing EntityData contract. No screen cell templates are required.
mtEntityColumn<T> accepts every native MtColumnDef<T> option. Explicit native
options override inferred entity defaults, including custom renderers, getters,
filters, editing, pinning, grouping, aggregation, pivot and chart roles. Native
field / colId / headerName work directly; catalog key / label and hidden
remain optional shorthands. Incoming rows and metadata are never mutated.
Ordinary, entity and custom columns can coexist. Future grid features require no
forwarding API because the consumer owns the actual grid instance.
MtDataTableEntityCell is public for direct cellRenderer composition.
Its cellRendererParams.entity resolves EntityData. Existing EntityPreview
components handle comparisons, notes and drawers, with compact cell presentation.
Plain Text and Number cells use the same shared EntityText directly when no
comparison or authored note needs the full preview wrapper. No value renderer,
tooltip, markup handling or table typography is replaced. Other types keep the
full EntityPreview path. This avoids redundant dispatch components in dense grids.
Grouped keys reuse Entity Info through the native groupValueRenderer hook; group footers retain aggregate values. Plain Text uses table typography at the entity-cell boundary.
Typed values and native exports
mtEntityCellValues separates display, identity, sorting/filtering, mathematical
and export values. Numbers preserve zero/null; categories retain stable identities
and localized labels; User values use their canonical id when rawValue is
absent, keeping equally named users distinct. Dates remain dates; rich text exports as readable text.
Collections receive conservative defaults which callers can override. Currency
aggregation requires compatible-unit capability or an explicit native override.
Pass mtEntityExportValue as the native CSV/Excel processCellCallback for typed
entity exports. It preserves numbers/dates, exports category labels, and leaves
ordinary values and aggregate totals intact. Native export configuration remains
fully available. Permissions, loading, persistence, localization, PDF/print and
operational actions remain consumer responsibilities.
Load @masterteam/data-grid/assets/data-grid.css once. Entity components inherit
provideMTComponents, Transloco and product fonts. There is no new entity-grid
provider. Showcase /data-table demonstrates the original grid with ordinary
and entity columns; /data-grid/demo remains the full grid reference.
Existing consumers
Earlier portal/Studio orchestration is isolated in the explicit
@masterteam/data-table/legacy entry point to preserve existing consumers during
migration. Its component, compatibility renderer and query/state utilities are
transitional; see legacy documentation. Dependencies uses the
original grid directly. Other portal/Studio migrations remain separately tracked
in integration notes.
Verification
pnpm --filter @masterteam/data-table test:ci runs entity and transitional contracts.
pnpm --filter @masterteam/data-table test:api checks strict positive/negative consumers.
Shared design-system icons
Use provideMTGridIcons() from @masterteam/data-table/icons in application providers. It loads the same packaged Masterteam glyph map used by the showcase before bootstrap. This optional DS bridge supplies icons only. Both apps must serve assets/icons-map.generated.json. Without this provider the independent grid uses fallback icons.
Calculated numeric chart ticks/aggregates use their supplied value, retaining percent and currency units from entity metadata. Ordinary cells retain the entity display text. Native valueFormatter overrides remain authoritative.
