@masterteam/data-table 0.0.0-stage → 0.0.1

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/README.md CHANGED
@@ -1,3 +1,74 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @masterteam/data-table
2
+
3
+ Entity Info integration for the independent Angular 21 `@masterteam/data-grid`.
4
+ Use `MtDataGridComponent` directly. It owns all UI, inputs, outputs, API, grouping,
5
+ filters, pagination, charts, pivot and exports. This package's primary API adds
6
+ entity renderers and column helpers, with no grid component, toolbar, profiles,
7
+ layout or feature restrictions. The grid retains the demo's visual defaults. For a visible native Columns/Filters
8
+ rail with closed panels, pass `[sideBar]="{toolPanels: ['columns', 'filters']}"`.
9
+ Omit `defaultToolPanel`; `hiddenByDefault` hides the entire rail. Consumers choose
10
+ `position: 'left'` in RTL and `'right'` in LTR to place it at the logical end.
11
+
12
+ ## Usage
13
+
14
+ Import `MtDataGridComponent` / `MtColumnDef` from `@masterteam/data-grid` and
15
+ `mtEntityColumn` from `@masterteam/data-table`. Build normal column definitions;
16
+ for entity columns supply `viewType` and an `entity(row)` resolver returning the
17
+ existing `EntityData` contract. No screen cell templates are required.
18
+
19
+ `mtEntityColumn<T>` accepts every native `MtColumnDef<T>` option. Explicit native
20
+ options override inferred entity defaults, including custom renderers, getters,
21
+ filters, editing, pinning, grouping, aggregation, pivot and chart roles. Native
22
+ `field` / `colId` / `headerName` work directly; catalog `key` / `label` and `hidden`
23
+ remain optional shorthands. Incoming rows and metadata are never mutated.
24
+ Ordinary, entity and custom columns can coexist. Future grid features require no
25
+ forwarding API because the consumer owns the actual grid instance.
26
+
27
+ `MtDataTableEntityCell` is public for direct `cellRenderer` composition.
28
+ Its `cellRendererParams.entity` resolves EntityData. Existing EntityPreview
29
+ components handle comparisons, notes and drawers, with compact cell presentation.
30
+ Plain Text and Number cells use the same shared `EntityText` directly when no
31
+ comparison or authored note needs the full preview wrapper. No value renderer,
32
+ tooltip, markup handling or table typography is replaced. Other types keep the
33
+ full EntityPreview path. This avoids redundant dispatch components in dense grids.
34
+ 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.
35
+
36
+ ## Typed values and native exports
37
+
38
+ `mtEntityCellValues` separates display, identity, sorting/filtering, mathematical
39
+ and export values. Numbers preserve zero/null; categories retain stable identities
40
+ and localized labels; User values use their canonical `id` when `rawValue` is
41
+ absent, keeping equally named users distinct. Dates remain dates; rich text exports as readable text.
42
+ Collections receive conservative defaults which callers can override. Currency
43
+ aggregation requires compatible-unit capability or an explicit native override.
44
+
45
+ Pass `mtEntityExportValue` as the native CSV/Excel `processCellCallback` for typed
46
+ entity exports. It preserves numbers/dates, exports category labels, and leaves
47
+ ordinary values and aggregate totals intact. Native export configuration remains
48
+ fully available. Permissions, loading, persistence, localization, PDF/print and
49
+ operational actions remain consumer responsibilities.
50
+
51
+ Load `@masterteam/data-grid/assets/data-grid.css` once. Entity components inherit
52
+ `provideMTComponents`, Transloco and product fonts. There is no new entity-grid
53
+ provider. Showcase `/data-table` demonstrates the original grid with ordinary
54
+ and entity columns; `/data-grid/demo` remains the full grid reference.
55
+
56
+ ## Existing consumers
57
+
58
+ Earlier portal/Studio orchestration is isolated in the explicit
59
+ `@masterteam/data-table/legacy` entry point to preserve existing consumers during
60
+ migration. Its component, compatibility renderer and query/state utilities are
61
+ transitional; see [legacy documentation](legacy/README.md). Dependencies uses the
62
+ original grid directly. Other portal/Studio migrations remain separately tracked
63
+ in [integration notes](../../../.github/instructions/data-table/README.md).
64
+
65
+ ## Verification
66
+
67
+ `pnpm --filter @masterteam/data-table test:ci` runs entity and transitional contracts.
68
+ `pnpm --filter @masterteam/data-table test:api` checks strict positive/negative consumers.
69
+
70
+ ## Shared design-system icons
71
+
72
+ 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.
73
+
74
+ 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.
@@ -0,0 +1,113 @@
1
+ import { makeEnvironmentProviders, provideAppInitializer, inject } from '@angular/core';
2
+ import { HttpClient, HttpBackend } from '@angular/common/http';
3
+ import { MT_GRID_ICONS } from '@masterteam/data-grid';
4
+ import { firstValueFrom } from 'rxjs';
5
+
6
+ /** Closest @masterteam/icons glyph for every grid semantic and historical alias. */
7
+ const glyphs = {
8
+ 'sort-asc': 'arrow.arrow-up',
9
+ 'sort-desc': 'arrow.arrow-down',
10
+ 'sort-none': 'arrow.chevron-selector-vertical',
11
+ reset: 'arrow.refresh-ccw-01',
12
+ expand: 'arrow.chevron-right',
13
+ collapse: 'arrow.chevron-down',
14
+ pdf: 'file.file-06',
15
+ export: 'general.download-01',
16
+ asc: 'arrow.arrow-up',
17
+ desc: 'arrow.arrow-down',
18
+ hide: 'general.eye-off',
19
+ blocked: 'general.slash-circle-01',
20
+ pin: 'general.pin-01',
21
+ columns: 'layout.columns-03',
22
+ chevron: 'arrow.chevron-right',
23
+ 'chevron-start': 'arrow.chevron-left-double',
24
+ check: 'general.check',
25
+ menu: 'general.dots-vertical',
26
+ move: 'editor.move',
27
+ left: 'arrow.arrow-left',
28
+ right: 'arrow.arrow-right',
29
+ close: 'general.x-close',
30
+ copy: 'general.copy-01',
31
+ cut: 'editor.scissors-01',
32
+ paste: 'file.clipboard',
33
+ save: 'general.download-01',
34
+ 'tree-open': 'arrow.chevron-down',
35
+ 'tree-closed': 'arrow.chevron-right',
36
+ group: 'layout.rows-03',
37
+ csv: 'file.file-06',
38
+ excel: 'layout.table',
39
+ search: 'general.search-lg',
40
+ filter: 'general.filter-lines',
41
+ cancel: 'general.x-close',
42
+ 'small-down': 'arrow.chevron-down',
43
+ grip: 'general.dots-grid',
44
+ arrows: 'custom.arrows',
45
+ 'tree-indeterminate': 'general.minus',
46
+ aggregation: 'editor.type-01',
47
+ pivot: 'layout.grid-01',
48
+ 'filter-add': 'general.plus',
49
+ cross: 'general.x-close',
50
+ 'chevron-up': 'arrow.chevron-up',
51
+ 'chevron-down': 'arrow.chevron-down',
52
+ first: 'arrow.chevron-left-double',
53
+ previous: 'arrow.chevron-left',
54
+ next: 'arrow.chevron-right',
55
+ last: 'arrow.chevron-right-double',
56
+ chart: 'chart.bar-chart-01',
57
+ maximize: 'arrow.expand-01',
58
+ minimize: 'layout.minimize-01',
59
+ 'chart-link': 'general.link-01',
60
+ 'chart-unlink': 'general.link-broken-01',
61
+ 'chart-edit': 'general.settings-04',
62
+ 'chevron-right': 'arrow.chevron-right',
63
+ 'eye-off': 'general.eye-off',
64
+ minus: 'general.minus',
65
+ values: 'editor.type-01',
66
+ download: 'general.download-01',
67
+ link: 'general.link-01',
68
+ unlink: 'general.link-broken-01',
69
+ settings: 'general.settings-04',
70
+ 'chevron-left': 'arrow.chevron-left',
71
+ 'chevron-end': 'arrow.chevron-right-double',
72
+ 'filter-active': 'general.filter-funnel-01',
73
+ 'filters-panel': 'general.filter-lines',
74
+ 'pin-left': 'general.pin-01',
75
+ 'pin-right': 'general.pin-01',
76
+ unpin: 'general.pin-02',
77
+ autosize: 'custom.arrows',
78
+ 'chart-bar': 'chart.horizontal-bar-chart-01',
79
+ 'chart-line': 'chart.line-chart-up-01',
80
+ 'chart-pie': 'chart.pie-chart-01',
81
+ 'chart-area': 'chart.bar-line-chart',
82
+ 'chart-scatter': 'chart.bar-chart-10',
83
+ data: 'dev.database-01',
84
+ format: 'editor.paint',
85
+ plus: 'general.plus',
86
+ eye: 'general.eye',
87
+ loading: 'general.loading-01',
88
+ };
89
+ /** Populated before bootstrap from the same packaged asset map used by mt-icon. */
90
+ const gridDsIcons = {};
91
+ async function loadGridDsIcons(http) {
92
+ const icons = await firstValueFrom(http.get('assets/icons-map.generated.json'));
93
+ for (const [name, glyph] of Object.entries(glyphs)) {
94
+ const svg = icons[glyph];
95
+ if (!svg)
96
+ throw new Error(`Missing DS grid glyph: ${glyph}`);
97
+ gridDsIcons[name] = svg.replace('<svg ', '<svg width="100%" height="100%" ');
98
+ }
99
+ }
100
+ /** The same Masterteam icon bridge for showcase and products. No grid UI or feature policy. */
101
+ function provideMTGridIcons() {
102
+ return makeEnvironmentProviders([
103
+ { provide: MT_GRID_ICONS, useValue: gridDsIcons },
104
+ provideAppInitializer(() => loadGridDsIcons(new HttpClient(inject(HttpBackend)))),
105
+ ]);
106
+ }
107
+
108
+ /**
109
+ * Generated bundle index. Do not edit.
110
+ */
111
+
112
+ export { gridDsIcons, loadGridDsIcons, provideMTGridIcons };
113
+ //# sourceMappingURL=masterteam-data-table-icons.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"masterteam-data-table-icons.mjs","sources":["../../../../packages/masterteam/data-table/icons/public-api.ts","../../../../packages/masterteam/data-table/icons/masterteam-data-table-icons.ts"],"sourcesContent":["import {\r\n inject,\r\n makeEnvironmentProviders,\r\n provideAppInitializer,\r\n} from '@angular/core';\r\nimport { HttpBackend } from '@angular/common/http';\r\nimport { MT_GRID_ICONS } from '@masterteam/data-grid';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport type { GridIconName } from '@masterteam/data-grid';\r\nimport type { MTIcon } from '@masterteam/icons';\r\nimport { firstValueFrom } from 'rxjs';\r\n\r\n/** Closest @masterteam/icons glyph for every grid semantic and historical alias. */\r\nconst glyphs = {\r\n 'sort-asc': 'arrow.arrow-up',\r\n 'sort-desc': 'arrow.arrow-down',\r\n 'sort-none': 'arrow.chevron-selector-vertical',\r\n reset: 'arrow.refresh-ccw-01',\r\n expand: 'arrow.chevron-right',\r\n collapse: 'arrow.chevron-down',\r\n pdf: 'file.file-06',\r\n export: 'general.download-01',\r\n asc: 'arrow.arrow-up',\r\n desc: 'arrow.arrow-down',\r\n hide: 'general.eye-off',\r\n blocked: 'general.slash-circle-01',\r\n pin: 'general.pin-01',\r\n columns: 'layout.columns-03',\r\n chevron: 'arrow.chevron-right',\r\n 'chevron-start': 'arrow.chevron-left-double',\r\n check: 'general.check',\r\n menu: 'general.dots-vertical',\r\n move: 'editor.move',\r\n left: 'arrow.arrow-left',\r\n right: 'arrow.arrow-right',\r\n close: 'general.x-close',\r\n copy: 'general.copy-01',\r\n cut: 'editor.scissors-01',\r\n paste: 'file.clipboard',\r\n save: 'general.download-01',\r\n 'tree-open': 'arrow.chevron-down',\r\n 'tree-closed': 'arrow.chevron-right',\r\n group: 'layout.rows-03',\r\n csv: 'file.file-06',\r\n excel: 'layout.table',\r\n search: 'general.search-lg',\r\n filter: 'general.filter-lines',\r\n cancel: 'general.x-close',\r\n 'small-down': 'arrow.chevron-down',\r\n grip: 'general.dots-grid',\r\n arrows: 'custom.arrows',\r\n 'tree-indeterminate': 'general.minus',\r\n aggregation: 'editor.type-01',\r\n pivot: 'layout.grid-01',\r\n 'filter-add': 'general.plus',\r\n cross: 'general.x-close',\r\n 'chevron-up': 'arrow.chevron-up',\r\n 'chevron-down': 'arrow.chevron-down',\r\n first: 'arrow.chevron-left-double',\r\n previous: 'arrow.chevron-left',\r\n next: 'arrow.chevron-right',\r\n last: 'arrow.chevron-right-double',\r\n chart: 'chart.bar-chart-01',\r\n maximize: 'arrow.expand-01',\r\n minimize: 'layout.minimize-01',\r\n 'chart-link': 'general.link-01',\r\n 'chart-unlink': 'general.link-broken-01',\r\n 'chart-edit': 'general.settings-04',\r\n 'chevron-right': 'arrow.chevron-right',\r\n 'eye-off': 'general.eye-off',\r\n minus: 'general.minus',\r\n values: 'editor.type-01',\r\n download: 'general.download-01',\r\n link: 'general.link-01',\r\n unlink: 'general.link-broken-01',\r\n settings: 'general.settings-04',\r\n 'chevron-left': 'arrow.chevron-left',\r\n 'chevron-end': 'arrow.chevron-right-double',\r\n 'filter-active': 'general.filter-funnel-01',\r\n 'filters-panel': 'general.filter-lines',\r\n 'pin-left': 'general.pin-01',\r\n 'pin-right': 'general.pin-01',\r\n unpin: 'general.pin-02',\r\n autosize: 'custom.arrows',\r\n 'chart-bar': 'chart.horizontal-bar-chart-01',\r\n 'chart-line': 'chart.line-chart-up-01',\r\n 'chart-pie': 'chart.pie-chart-01',\r\n 'chart-area': 'chart.bar-line-chart',\r\n 'chart-scatter': 'chart.bar-chart-10',\r\n data: 'dev.database-01',\r\n format: 'editor.paint',\r\n plus: 'general.plus',\r\n eye: 'general.eye',\r\n loading: 'general.loading-01',\r\n} satisfies Record<GridIconName, MTIcon>;\r\n\r\n/** Populated before bootstrap from the same packaged asset map used by mt-icon. */\r\nexport const gridDsIcons: Partial<Record<GridIconName, string>> = {};\r\nexport async function loadGridDsIcons(http: HttpClient): Promise<void> {\r\n const icons = await firstValueFrom(\r\n http.get<Record<string, string>>('assets/icons-map.generated.json'),\r\n );\r\n for (const [name, glyph] of Object.entries(glyphs)) {\r\n const svg = icons[glyph];\r\n if (!svg) throw new Error(`Missing DS grid glyph: ${glyph}`);\r\n gridDsIcons[name as GridIconName] = svg.replace(\r\n '<svg ',\r\n '<svg width=\"100%\" height=\"100%\" ',\r\n );\r\n }\r\n}\r\n\r\n/** The same Masterteam icon bridge for showcase and products. No grid UI or feature policy. */\r\nexport function provideMTGridIcons() {\r\n return makeEnvironmentProviders([\r\n { provide: MT_GRID_ICONS, useValue: gridDsIcons },\r\n provideAppInitializer(() =>\r\n loadGridDsIcons(new HttpClient(inject(HttpBackend))),\r\n ),\r\n ]);\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAYA;AACA,MAAM,MAAM,GAAG;AACb,IAAA,UAAU,EAAE,gBAAgB;AAC5B,IAAA,WAAW,EAAE,kBAAkB;AAC/B,IAAA,WAAW,EAAE,iCAAiC;AAC9C,IAAA,KAAK,EAAE,sBAAsB;AAC7B,IAAA,MAAM,EAAE,qBAAqB;AAC7B,IAAA,QAA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