{"_id":"@dojo-ng/data-grid-formats","name":"@dojo-ng/data-grid-formats","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@dojo-ng/data-grid-formats","version":"0.1.0","license":"BSD-3-Clause","description":"Value-formatting plugin for @dojo-ng/data-grid (Intl number/currency/percent/date via @dojo-ng/i18n)","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"dependencies":{"@dojo-ng/data-grid":"^0.1.0","@dojo-ng/i18n":"^0.1.0","@tanstack/table-core":"^8.0.0","lit":"^3.3.0"},"_id":"@dojo-ng/data-grid-formats@0.1.0","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-ImeMb76RSOPnmgSSOgSXj+ohln+6TBzN2UbdE+DOgZ1y15KSdCfW2sm1y/e7hIgR/dVJXrMp3ogOcD39b1pGkw==","shasum":"fdc01397a7e84f7922043660ee051e4bfd31aac6","tarball":"https://registry.npmjs.org/@dojo-ng/data-grid-formats/-/data-grid-formats-0.1.0.tgz","fileCount":6,"unpackedSize":7019,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEo4U8xHzygalprCX03MgamMwc+qDxnHxDnq12N8EivnAiARPKbfxOb5ogSr2xZpEfLb5NPTQW4LBaxzS7QgVv9TnQ=="}]},"_npmUser":{"name":"bitranch","email":"bill@bitranch.com"},"directories":{},"maintainers":[{"name":"saysomething","email":"joshs@holmescorp.com"},{"name":"bitranch","email":"bill@bitranch.com"},{"name":"jepe","email":"jeffreyp@holmescorp.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/data-grid-formats_0.1.0_1788374426701_0.16356540866810665"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-02T18:40:26.491Z","0.1.0":"2026-09-02T18:40:26.828Z","modified":"2026-09-02T18:40:27.050Z"},"maintainers":[{"name":"saysomething","email":"joshs@holmescorp.com"},{"name":"bitranch","email":"bill@bitranch.com"},{"name":"jepe","email":"jeffreyp@holmescorp.com"}],"description":"Value-formatting plugin for @dojo-ng/data-grid (Intl number/currency/percent/date via @dojo-ng/i18n)","license":"BSD-3-Clause","readme":"# @dojo-ng/data-grid-formats\n\nValue-formatting plugin for @dojo-ng/data-grid (Intl number/currency/percent/date via @dojo-ng/i18n)\n\nPart of [Dojo NG](../../README.md), a framework-agnostic web component library. BSD-3-Clause.\n\n> Declarative per-column value formatting: set `format` on a `GridColumn` — a `{ kind: \"number\"|\"currency\"|\"percent\"|\"date\"|\"time\"|\"datetime\", options?, currency? }` descriptor (delegated to memoized `Intl` instances via `@dojo-ng/i18n`, never hand-rolled) or a plain `(value, row) => string` function — and `renderCell` formats only that column, returning `undefined` (so other plugins and the core default proceed) for columns without `format`. Locale-reactive: `setup()` attaches a `LocaleController` to the host, so a runtime `lang` change on the grid or an ancestor reformats every value with no plugin reconfiguration. Place this plugin AFTER structural and component plugins in the `plugins` array — it is the fallback formatter, so a plugin ordered after it that also targets the same column would only ever see the already-formatted string, not the raw value.\n\n## Install\n\n```bash\nnpm install @dojo-ng/data-grid-formats\n```\n\n## Usage\n\nSet `format` on a column; other columns are untouched. Formatting follows the active locale (set `lang` on the grid or an ancestor).\n\n```html\n<dj-data-grid id=\"g\"></dj-data-grid>\n<script type=\"module\">\n  import \"@dojo-ng/data-grid\";\n  import { formatsPlugin } from \"@dojo-ng/data-grid-formats\";\n  const g = document.getElementById(\"g\");\n  g.columns = [\n    { id: \"name\", header: \"Name\" },\n    { id: \"price\", header: \"Price\", format: { kind: \"currency\", currency: \"USD\" } },\n    { id: \"when\", header: \"Updated\", format: { kind: \"date\" } },\n    { id: \"growth\", header: \"Growth\", format: (v) => (v >= 0 ? \"+\" : \"\") + v + \"%\" },\n  ];\n  g.data = [{ name: \"Widget\", price: 1234.5, when: \"2026-07-01\", growth: 4 }];\n  g.plugins = [formatsPlugin()];\n</script>\n```\n","readmeFilename":"README.md","_rev":"1-29248cbb5c6ea42a6237552a4d6bf133"}