@khester/dynamics-cell-renderers 1.1.0 → 1.1.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/package.json +7 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 khester
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @khester/dynamics-cell-renderers
2
+
3
+ React cell renderer components for Dynamics 365 grids — read-only and editable renderers for common Dataverse field types (text, link, currency, date, number, optionset, toggle, icon, progress, rating, lookup, composite).
4
+
5
+ ## What it does
6
+
7
+ Provides a set of small, focused Fluent UI v8 components that render a single grid cell for a given field type. Each read-only renderer (e.g. `CurrencyCell`, `DateCell`, `OptionSetCell`, `LookupCell`) takes a shared `CellRendererProps<T>` shape — `item`, `column`, `value`, `itemKey` — and formats the value via `@khester/dynamics-utils`, honoring per-column options on `IReusableColumn<T>` (currency code, locale, color maps, progress max, rating style, etc.). Editable variants (`EditableTextCell`, `EditableNumberCell`, `EditableDateCell`, `EditableOptionSetCell`, `EditableLookupCell`, `EditableRatingCell`) add in-cell editing with dirty/error indicators and validation callbacks. The package also exports the column/cell type definitions and the CSS-in-JS style classes the renderers use.
8
+
9
+ ## When to use it
10
+
11
+ Reach for this package when you need the **leaf-level cell rendering** for a Dynamics grid, or when you are **authoring a new cell renderer** — new renderers go here. In practice you rarely import these directly: `@dataverse-kit/grid-kit` wraps these renderers behind its registry-driven `DataGrid`/detail-list hosts, so use grid-kit when you want a whole grid. Use `@dataverse-kit/surface-kit` for form shells/containers and `@khester/reusable-components` for custom-page controls. Import this package directly when you're building a custom grid host or extending the renderer set.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @khester/dynamics-cell-renderers
17
+ ```
18
+
19
+ Peer dependencies (not bundled): `react` / `react-dom` (>=17) and `@fluentui/react` (^8). Formatting/color utilities come from `@khester/dynamics-utils`.
20
+
21
+ ## Minimal example
22
+
23
+ ```tsx
24
+ import { CurrencyCell, EditableTextCell } from '@khester/dynamics-cell-renderers';
25
+ import type { IReusableColumn } from '@khester/dynamics-cell-renderers';
26
+
27
+ type Row = { key: string; name: string; revenue: number };
28
+ const row: Row = { key: 'a1', name: 'Contoso', revenue: 1500000 };
29
+
30
+ const revenueColumn: IReusableColumn<Row> = {
31
+ key: 'revenue',
32
+ name: 'Revenue',
33
+ fieldName: 'revenue',
34
+ minWidth: 120,
35
+ fieldType: 'currency',
36
+ currencyCode: 'USD',
37
+ locale: 'en-US',
38
+ };
39
+
40
+ // Read-only currency cell
41
+ <CurrencyCell item={row} column={revenueColumn} value={row.revenue} itemKey={row.key} />;
42
+
43
+ // Editable text cell with dirty/validation tracking
44
+ <EditableTextCell
45
+ item={row}
46
+ column={{ key: 'name', name: 'Name', fieldName: 'name', minWidth: 160, fieldType: 'text' }}
47
+ value={row.name}
48
+ itemKey={row.key}
49
+ isEditMode
50
+ isDirty={false}
51
+ onValueChange={(rowKey, field, next, original) => console.log(rowKey, field, next, original)}
52
+ />;
53
+ ```
54
+
55
+ ## Key exports
56
+
57
+ | Export | Purpose |
58
+ |--------|---------|
59
+ | `TextCell` / `LinkCell` / `NumberCell` | Read-only text, hyperlink, and numeric cell renderers |
60
+ | `CurrencyCell` / `DateCell` | Locale-aware currency and date renderers |
61
+ | `OptionSetCell` / `ToggleCell` / `ColoredCell` | OptionSet badge, two-option toggle, and color-mapped cells |
62
+ | `IconCell` / `ProgressBarCell` / `RatingCell` | Icon button, progress bar, and star/emoji rating renderers |
63
+ | `LookupCell` / `CompositeCell` | Lookup display (with navigation) and multi-slot composite renderer |
64
+ | `EditableTextCell` / `EditableNumberCell` / `EditableDateCell` | Inline-editable text, number, and date cells with dirty/error state |
65
+ | `EditableOptionSetCell` / `EditableLookupCell` / `EditableRatingCell` | Inline-editable optionset dropdown, lookup search, and rating cells |
66
+ | `CellRendererProps` / `IReusableColumn` / `ListFieldType` | Core types: shared cell props, extended column config, and field-type union |
67
+ | `cellClass`, `currencyCellClass`, `getDetailsListStyles`, … | CSS-in-JS style classes shared by the renderers and host grids |
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@khester/dynamics-cell-renderers",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
+ "license": "MIT",
4
5
  "description": "Cell renderer components for Dynamics 365 grids: text, currency, date, lookup, optionset, progress, and editable variants",
5
6
  "main": "dist/index.js",
6
7
  "module": "dist/index.esm.js",
7
8
  "types": "dist/index.d.ts",
8
- "files": ["dist"],
9
+ "files": [
10
+ "dist"
11
+ ],
9
12
  "scripts": {
13
+ "prepublishOnly": "npm run build",
10
14
  "build": "rollup -c",
11
15
  "dev": "rollup -c -w",
12
16
  "test": "jest --passWithNoTests",
@@ -18,7 +22,7 @@
18
22
  "clean:dist": "rimraf dist"
19
23
  },
20
24
  "dependencies": {
21
- "@khester/dynamics-utils": "^1.2.0"
25
+ "@khester/dynamics-utils": "^1.2.1"
22
26
  },
23
27
  "peerDependencies": {
24
28
  "@fluentui/react": "^8.115.6",