{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "grid-column-template",
  "framework": "javascript",
  "type": "registry:component",
  "component": "Grid",
  "variant": "column-template",
  "dependencies": [
    "@syncfusion/ej2-grids"
  ],
  "description": "Data grid with a column template that renders each customer as an avatar with initials, a tinted color, and a delivery status badge.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/javascript/llms.txt",
    "skillPack": "syncfusion/javascript-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/javascript/grid-column-template.md"
  },
  "files": [
    {
      "target": "src/components/grid-column-template/grid.html",
      "content": "<div class=\"control-section\">\n    <div class=\"content-wrapper\">\n        <div id=\"container\"></div>\n    </div>\n</div>"
    },
    {
      "target": "src/components/grid-column-template/grid.ts",
      "content": "import { Grid, Page } from '@syncfusion/ej2-grids';\nimport { orderData } from '../datasource/grid-data';\n\nGrid.Inject(Page);\n\nconst palette: string[] = ['#6366f1', '#0ea5e9', '#10b981', '#f59e0b', '#ec4899', '#8b5cf6'];\n\nfunction prepare(): Object[] {\n    return (orderData as any[]).map((o: any) => {\n        const days: number = Math.max(0, Math.round((new Date(o.ShippedDate).getTime() - new Date(o.OrderDate).getTime()) / 86400000));\n        const s = days <= 5 ? { label: 'Fast', color: '#059669', bg: '#d1fae5' }\n            : days <= 10 ? { label: 'On time', color: '#0369a1', bg: '#e0f2fe' }\n            : { label: 'Delayed', color: '#b45309', bg: '#fef3c7' };\n        return {\n            ...o,\n            Initials: o.ShipName.trim().split(/\\s+/).map((p: string) => p[0]).slice(0, 2).join('').toUpperCase(),\n            Color: palette[[...o.CustomerID].reduce((sum: number, c: string) => sum + c.charCodeAt(0), 0) % palette.length],\n            StatusText: s.label + ' · ' + days + 'd', StatusColor: s.color, StatusBg: s.bg\n        };\n    });\n}\n\nexport function initColumnTemplateGrid(): void {\n    const orderTemplate: string = '<span style=\"font-family:monospace;font-size:12px;background:#f1f5f9;color:#334155;padding:4px 8px;border-radius:6px\">#${OrderID}</span>';\n    const customerTemplate: string =\n        '<div style=\"display:flex;align-items:center;gap:12px\">' +\n        '<span style=\"background:${Color};width:38px;height:38px;border-radius:12px;color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:13px\">${Initials}</span>' +\n        '<div style=\"display:flex;flex-direction:column;justify-content:center\">' +\n        '<span style=\"display:block;font-weight:600;color:#0f172a;line-height:20px\">${ShipName}</span>' +\n        '<span style=\"display:block;font-size:12px;color:#94a3b8;line-height:16px\">${CustomerID}</span></div></div>';\n    const destinationTemplate: string =\n        '<div style=\"display:flex;flex-direction:column;justify-content:center\">' +\n        '<span style=\"display:block;color:#0f172a;line-height:20px\">${ShipCity}</span>' +\n        '<span style=\"display:block;font-size:12px;color:#94a3b8;line-height:16px\">${ShipCountry}</span></div>';\n    const statusTemplate: string =\n        '<span style=\"background:${StatusBg};color:${StatusColor};border-radius:999px;padding:2px 10px;font-size:12px;font-weight:600\">${StatusText}</span>';\n\n    const grid: Grid = new Grid({\n        dataSource: prepare(),\n        height: 440,\n        rowHeight: 64,\n        allowPaging: true,\n        pageSettings: { pageSize: 8 },\n        gridLines: 'Horizontal',\n        columns: [\n            { field: 'OrderID', headerText: 'Order', width: 110, template: orderTemplate, isPrimaryKey: true },\n            { field: 'ShipName', headerText: 'Ship To', width: 240, template: customerTemplate },\n            { field: 'ShipCity', headerText: 'Destination', width: 150, template: destinationTemplate },\n            { headerText: 'Status', width: 150, template: statusTemplate },\n            { field: 'Freight', headerText: 'Freight', width: 120, format: 'C2', textAlign: 'Right' }\n        ]\n    });\n    grid.appendTo('#container');\n}"
    }
  ]
}