jsl-ui 10.4.0 → 10.4.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.
@@ -22,7 +22,7 @@ const grid = new GridComponent<Request>(
22
22
  ## Patterns and features
23
23
 
24
24
  - **Identity and lifecycle:** Use a unique, stable `primaryKey` and keep the component instance stable across parent renders. Register setup and event handlers with `initEvents()`; `getRef()` resolves after the grid mounts. A stable `saveColumnsKey` preserves column settings.
25
- - **Columns and editing:** Columns default their `field` to their `id`. Set `sortable` and `filterable` on columns and `showHeaderMenu: true` to expose sorting and filtering in the header menu. Enable `editable` and provide column editors to edit cells; use `onAfterEdit` for application updates. Custom header icons can be supplied through `column.header.buttons`.
25
+ - **Columns and editing:** Columns default their `field` to their `id`. Set `sortable` and `filterable` on columns and `showHeaderMenu: true` to expose sorting and filtering in the header menu. For a custom filter row, set `showHeaderRow: true` and register `onHeaderRowCellRendered` in `initEvents()`; use `explicitInitialization: true` and call `grid.init()` after registering the handler. Enable `editable` and provide column editors to edit cells; use `onAfterEdit` for application updates. Custom header icons can be supplied through `column.header.buttons`.
26
26
  - **Formulas and totals:** Use `addFormula(field, calculate, dependencies)` and `triggerAllFormulas()` for calculated values. For grouped totals, configure DataView grouping with an aggregator such as `SumAggregator`, enable `displayTotalsRow`, and use a column's `groupTotalsFormatter` to format the result. Set `aggregateCollapsed: true` to keep totals visible when groups are collapsed.
27
27
  - **Variable row heights:** Set `variableRowHeight: true` and give individual data items a `__height` in pixels. Rows without a height, including group headers, use `rowHeight` (40 px by default). Heights are explicit, not measured from wrapped content; call `grid.refresh()` after changing them.
28
28
  - **Hierarchical rows:** Use `IndentFormatter` for the tree column and initialize `GridTree` in `initEvents()` with the parent ID field. Keep parents before their descendants in the data, with each subtree contiguous; ordinary sorting can break that order.
@@ -33,7 +33,7 @@ const grid = new GridComponent<Request>(
33
33
 
34
34
  ## Examples
35
35
 
36
- - [GridComponent showcase](../examples/showcase/grids.ts): interactive examples for sorting, editing, grouping and totals, hierarchy, cell components, selection, variable heights, and more. Each example has a **Show code** option.
36
+ - [GridComponent showcase](../examples/showcase/grids.ts): interactive examples for sorting, header-menu filters, a custom filter row, editing, grouping and totals, hierarchy, cell components, selection, variable heights, and more. Each example has a **Show code** option.
37
37
  - [Focused grid demos](../examples/grid/g-01-basic.html): [large-data grouping and filters](../examples/grid/g-02-grouping.html), [custom formatters and editors](../examples/grid/g-03-customformatter-forcefit.html), [JSL cell components](../examples/grid/g-06-cellcomponents.html), [async rendering](../examples/grid/g-07-asyncrender.html), [selection](../examples/grid/g-10-selection.html), [column spans](../examples/grid/g-11-colspan.html), [undo/redo](../examples/grid/g-12-undo-redo.html), [filter row](../examples/grid/g-13-filterrow.html), and [row reordering](../examples/grid/g-14-reorder.html).
38
38
 
39
39
  The focused demos mostly use `createJSLGrid` directly and show the underlying grid APIs; use the showcase for `GridComponent` patterns.
@@ -60,6 +60,44 @@ const basicData = data(100).map((project, index) => ({ ...project, team: basicTe
60
60
  const basic = new GridComponent(basicData, columns().map(column => ({ ...column, filterable: true })), {
61
61
  primaryKey: "id", multiColumnSort: true, numberedMultiColumnSort: true, showHeaderMenu: true
62
62
  }, "300px");
63
+ const filterRowValues: Record<string, string> = {};
64
+ const filterRow = new GridComponent(data(30), [
65
+ { id: "id", name: "ID", width: 65, sortable: true },
66
+ { id: "name", name: "Project", width: 230, sortable: true },
67
+ { id: "team", name: "Team", width: 140, sortable: true },
68
+ { id: "budget", name: "Budget", width: 125, sortable: true, headerCssClass: "right", formatter: NumericFormatter, format: "#,0" },
69
+ { id: "date", name: "Start date", width: 140, sortable: true, formatter: DateFormatter }
70
+ ], {
71
+ primaryKey: "id", showHeaderRow: true, headerRowHeight: 36, explicitInitialization: true,
72
+ enableColumnReorder: false
73
+ }, "320px");
74
+ filterRow.initEvents(grid => {
75
+ grid.onHeaderRowCellRendered.subscribe((_event, args) => {
76
+ const input = document.createElement("input");
77
+ input.type = "search";
78
+ input.placeholder = "Filter…";
79
+ input.setAttribute("aria-label", "Filter " + args.column.name);
80
+ input.value = filterRowValues[args.column.id] || "";
81
+ input.style.width = "100%";
82
+ input.style.boxSizing = "border-box";
83
+ args.node.textContent = "";
84
+ args.node.appendChild(input);
85
+ input.addEventListener("input", () => {
86
+ filterRowValues[args.column.id] = input.value.toLowerCase();
87
+ grid.refreshFilters(true);
88
+ });
89
+ });
90
+ grid.addFilter({ field: "-", match: item => Object.keys(filterRowValues).every(id => {
91
+ const query = filterRowValues[id];
92
+ if (!query) return true;
93
+ const column = grid.getColumnById(id);
94
+ if (!column) return true;
95
+ const value = grid.getDataItemValueForColumn(item, column);
96
+ const displayValue = grid.getFormattedValue(column, value, item) || "";
97
+ return displayValue.toLowerCase().includes(query);
98
+ }) });
99
+ grid.init();
100
+ });
63
101
  let projectStarred = false;
64
102
  const projectHeaderButton = {
65
103
  html: "☆", tooltip: "Star project column", cssClass: "grid-header-action",
@@ -389,6 +427,7 @@ export const gridShowcase: IJSLVNode = {
389
427
  { tag: "div", attr: { class: "grid-samples" }, children: [
390
428
  category("grid-browsing", "Browsing & layout", [
391
429
  card("grid-basic", "Browse, sort & filter", "100 projects across 10 teams. Open a column header menu and choose Filter to select values. Click a heading to sort, then Shift-click other headings to add sort levels. Numbers show sorting priority. Select rows and resize or reorder columns.", basic),
430
+ card("grid-filter-row", "Filter row", "Type in one or more fields to filter project, team, budget, or formatted start date. Active fields combine, so each matching row must satisfy every entered filter.", filterRow),
392
431
  card("grid-header-menu-icons", "Column menus & header icons", "Open a column menu to sort or filter. Click the star in the Project heading to toggle it, or the Team information icon to show a message.", headerActions),
393
432
  card("grid-frozen", "Frozen columns", "12 columns and 120 projects. The ID and project stay visible while you scroll through ownership, status, dates, hours, and office details, even on wide screens.", frozen),
394
433
  card("grid-large", "A larger dataset", "10,000 rows with an explicit rowHeight of 28 px. This example also checks that applications can retain the original density.", large),
@@ -439,7 +478,7 @@ export const gridShowcase: IJSLVNode = {
439
478
  { tag: "details", attr: { class: "usage" }, children: [
440
479
  text("summary", "Grid showcase scope"),
441
480
  text("p", 'NumericFormatter supplies right-aligned cells; NumericFormatter and DateFormatter apply tabular numerals. Set headerCssClass: "right" or "center" explicitly to match a column’s content. Header alignment is never inferred from its formatter.'),
442
- text("p", "These examples use the existing GridComponent constructor, column definitions, editors, and DataView APIs. The default row height is 40 px; rowHeight can retain a different density. Column headers fit up to two lines. Core presentation follows the shared theme and inherits the host's typography. The Browse, sort & filter example demonstrates the Excel filter from a column header menu.")
481
+ text("p", "These examples use the existing GridComponent constructor, column definitions, editors, and DataView APIs. The default row height is 40 px; rowHeight can retain a different density. Column headers fit up to two lines. Core presentation follows the shared theme and inherits the host's typography. Browse, sort & filter demonstrates the Excel filter from a column header menu; Filter row demonstrates custom inputs on the grid header row.")
443
482
  ] }
444
483
  ]
445
484
  };
@@ -72,6 +72,7 @@ export const showcaseSources: Record<string, string> = {
72
72
  "overlays": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { OverlayComponent } from \"../../components/overlay/OverlayComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content=IJSLVNode|IJSLComponent;\n\nconst text=(tag:string,content:string):IJSLVNode=>({tag,content});\n\nconst group=(children:Content[],className?:string):IJSLVNode=>({tag:\"div\",attr:{class:className},children});\n\nconst button=(content:string,click:()=>void)=>new ButtonComponent({content,click,type:\"button\",outlined:true,size:\"small\"});\n\nfunction section(id:string,number:string,title:string,copy:string,children:Content[],usage:string):IJSLVNode {\n return {tag:\"section\",attr:{id,class:\"component-section\",\"aria-labelledby\":id+\"-title\"},children:[\n group([text(\"p\",\"THE ESSENTIALS / \"+number),{tag:\"h2\",content:title,attr:{id:id+\"-title\",class:\"section-title\"}},text(\"p\",copy)],\"hero-copy\"),\n group(children,\"sample-card remaining-demo\"),\n {tag:\"details\",attr:{class:\"usage\"},children:[text(\"summary\",title+\" usage & compatibility\"),text(\"p\",usage)]}\n ]};\n}\n\nconst overlayCopy=()=>group([text(\"h2\",\"Workspace settings\"),text(\"p\",\"A little room for secondary tasks, without leaving your current view.\"),new ButtonComponent({content:\"Save settings\",type:\"button\",click:()=>overlay.close()})]);\n\nlet overlay:OverlayComponent;\n\nlet allowClose=false;\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n section(\"overlays\",\"20\",\"Overlays\",\"Focused panels that slide in from the side or the top.\",[\n group([button(\"Open side panel\",()=>{overlay=OverlayComponent.show({content:overlayCopy(),ariaLabel:\"Workspace settings\",size:\"26rem\"});}),button(\"Open top panel\",()=>{overlay=OverlayComponent.show({content:overlayCopy(),direction:\"top\",size:\"20rem\",ariaLabel:\"Workspace settings\"});}),button(\"Try close guard\",()=>{allowClose=false;overlay=OverlayComponent.show({ariaLabel:\"Protected panel\",onClose:()=>allowClose,content:group([text(\"h2\",\"A protected panel\"),text(\"p\",\"Closing is blocked until you choose Allow close.\"),button(\"Allow close\",()=>{allowClose=true;overlay.close();})])});})],\"sample-row\")\n],\"show(), close(), content, direction, size, animation, dismissal flags, and callbacks remain. onClose returning false vetoes dismissal. Native modal dialogs contain keyboard focus, support nested panels, and restore focus on close. ariaLabel and closeButtonLabel provide accessible names.\")\n);",
73
73
  "ribbons": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { RibbonMenuComponent } from \"../../components/ribbon-menu/RibbonMenuComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content=IJSLVNode|IJSLComponent;\n\nconst text=(tag:string,content:string):IJSLVNode=>({tag,content});\n\nconst group=(children:Content[],className?:string):IJSLVNode=>({tag:\"div\",attr:{class:className},children});\n\nconst button=(content:string,click:()=>void)=>new ButtonComponent({content,click,type:\"button\",outlined:true,size:\"small\"});\n\nfunction section(id:string,number:string,title:string,copy:string,children:Content[],usage:string):IJSLVNode {\n return {tag:\"section\",attr:{id,class:\"component-section\",\"aria-labelledby\":id+\"-title\"},children:[\n group([text(\"p\",\"THE ESSENTIALS / \"+number),{tag:\"h2\",content:title,attr:{id:id+\"-title\",class:\"section-title\"}},text(\"p\",copy)],\"hero-copy\"),\n group(children,\"sample-card remaining-demo\"),\n {tag:\"details\",attr:{class:\"usage\"},children:[text(\"summary\",title+\" usage & compatibility\"),text(\"p\",usage)]}\n ]};\n}\n\nconst ribbonStatus=text(\"p\",\"Choose an action.\");\n\nribbonStatus.attr={role:\"status\"};\n\nconst ribbonAction=(content:string)=>button(content,()=>{ribbonStatus.content=content+\" selected.\";});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n section(\"ribbons\",\"21\",\"Ribbon menus\",\"Related actions grouped in a flexible, themed toolbar.\",[\n new RibbonMenuComponent([{title:\"Project\",children:[ribbonAction(\"New\"),ribbonAction(\"Open\"),ribbonAction(\"Save\")]},{title:\"Edit\",children:[ribbonAction(\"Undo\"),ribbonAction(\"Redo\")]},{title:\"View\",children:[new ButtonComponent({content:\"Details\",toggle:true,outlined:true,type:\"button\"}),new ButtonComponent({content:\"Unavailable\",enabled:false,type:\"button\"})]}]),ribbonStatus\n],\"The groups constructor and group title/children interface remain unchanged. Groups wrap with available space and use the normal ButtonComponent styles, including toggles and disabled actions.\")\n);",
74
74
  "grid-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst basicTeams = [\"Design\", \"Engineering\", \"Operations\", \"Research\", \"Product\", \"Marketing\", \"Finance\", \"Support\", \"Security\", \"Customer Success\"];\n\nconst basicData = data(100).map((project, index) => ({ ...project, team: basicTeams[index % basicTeams.length] }));\n\nconst basic = new GridComponent(basicData, columns().map(column => ({ ...column, filterable: true })), {\n primaryKey: \"id\", multiColumnSort: true, numberedMultiColumnSort: true, showHeaderMenu: true\n}, \"300px\");\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-basic\", \"Browse, sort & filter\", \"100 projects across 10 teams. Open a column header menu and choose Filter to select values. Click a heading to sort, then Shift-click other headings to add sort levels. Numbers show sorting priority. Select rows and resize or reorder columns.\", basic)\n);",
75
+ "grid-filter-row": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst filterRowValues: Record<string, string> = {};\n\nconst filterRow = new GridComponent(data(30), [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 230, sortable: true },\n { id: \"team\", name: \"Team\", width: 140, sortable: true },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" },\n { id: \"date\", name: \"Start date\", width: 140, sortable: true, formatter: DateFormatter }\n], {\n primaryKey: \"id\", showHeaderRow: true, headerRowHeight: 36, explicitInitialization: true,\n enableColumnReorder: false\n}, \"320px\");\n\nfilterRow.initEvents(grid => {\n grid.onHeaderRowCellRendered.subscribe((_event, args) => {\n const input = document.createElement(\"input\");\n input.type = \"search\";\n input.placeholder = \"Filter…\";\n input.setAttribute(\"aria-label\", \"Filter \" + args.column.name);\n input.value = filterRowValues[args.column.id] || \"\";\n input.style.width = \"100%\";\n input.style.boxSizing = \"border-box\";\n args.node.textContent = \"\";\n args.node.appendChild(input);\n input.addEventListener(\"input\", () => {\n filterRowValues[args.column.id] = input.value.toLowerCase();\n grid.refreshFilters(true);\n });\n });\n grid.addFilter({ field: \"-\", match: item => Object.keys(filterRowValues).every(id => {\n const query = filterRowValues[id];\n if (!query) return true;\n const column = grid.getColumnById(id);\n if (!column) return true;\n const value = grid.getDataItemValueForColumn(item, column);\n const displayValue = grid.getFormattedValue(column, value, item) || \"\";\n return displayValue.toLowerCase().includes(query);\n }) });\n grid.init();\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-filter-row\", \"Filter row\", \"Type in one or more fields to filter project, team, budget, or formatted start date. Active fields combine, so each matching row must satisfy every entered filter.\", filterRow)\n);",
75
76
  "grid-header-menu-icons": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nlet projectStarred = false;\n\nconst projectHeaderButton = {\n html: \"☆\", tooltip: \"Star project column\", cssClass: \"grid-header-action\",\n handler: (event: MouseEvent) => {\n projectStarred = !projectStarred;\n projectHeaderButton.html = projectStarred ? \"★\" : \"☆\";\n projectHeaderButton.tooltip = projectStarred ? \"Unstar project column\" : \"Star project column\";\n projectHeaderButton.cssClass = \"grid-header-action\" + (projectStarred ? \" grid-header-starred\" : \"\");\n const button = event.currentTarget as HTMLElement;\n button.textContent = projectHeaderButton.html;\n button.title = projectHeaderButton.tooltip;\n button.classList.toggle(\"grid-header-starred\", projectStarred);\n }\n};\n\nconst headerActions = new GridComponent(data(12), [\n { id: \"id\", name: \"ID\", width: 65, sortable: true, filterable: true },\n { id: \"name\", name: \"Project\", width: 245, sortable: true, filterable: true, header: { buttons: [\n projectHeaderButton\n ] } },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, filterable: true, header: { buttons: [\n { html: \"i\", tooltip: \"About team column\", cssClass: \"grid-header-action\", handler: () => {\n window.alert(\"The Team column shows the team responsible for each project.\");\n } }\n ] } },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, filterable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" }\n], { primaryKey: \"id\", showHeaderMenu: true }, \"300px\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-header-menu-icons\", \"Column menus & header icons\", \"Open a column menu to sort or filter. Click the star in the Project heading to toggle it, or the Team information icon to show a message.\", headerActions)\n);",
76
77
  "grid-frozen": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst frozenData = data(120).map((project, index) => ({\n ...project,\n owner: [\"Alex Morgan\", \"Sam Weber\", \"Jordan Lee\", \"Robin Taylor\"][index % 4],\n status: [\"Planning\", \"In progress\", \"In review\", \"Complete\"][index % 4],\n due: new Date(2026, 11, 1 + index % 28),\n plannedHours: 80 + index * 4,\n actualHours: 25 + index * 3,\n location: [\"Vienna\", \"London\", \"Berlin\", \"New York\"][index % 4]\n}));\n\nconst frozenColumns: ISlickColumn[] = [\n ...columns().map(column => ({ ...column, width: column.id === \"name\" ? 300 : 180 })),\n { id: \"owner\", name: \"Project owner\", width: 200, sortable: true },\n { id: \"status\", name: \"Status\", width: 180, sortable: true },\n { id: \"due\", name: \"Due date\", width: 180, sortable: true, formatter: DateFormatter },\n { id: \"plannedHours\", name: \"Planned hours\", width: 180, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" },\n { id: \"actualHours\", name: \"Actual hours\", width: 180, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" },\n { id: \"location\", name: \"Office\", width: 180, sortable: true }\n];\n\nconst frozen = new GridComponent(frozenData, frozenColumns, {\n primaryKey: \"id\", frozenColumn: 1\n}, \"320px\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-frozen\", \"Frozen columns\", \"12 columns and 120 projects. The ID and project stay visible while you scroll through ownership, status, dates, hours, and office details, even on wide screens.\", frozen)\n);",
77
78
  "grid-large": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst large = new GridComponent(data(10000), columns(), { primaryKey: \"id\", rowHeight: 28 }, \"320px\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-large\", \"A larger dataset\", \"10,000 rows with an explicit rowHeight of 28 px. This example also checks that applications can retain the original density.\", large)\n);",
package/lib/grid.css CHANGED
@@ -1986,12 +1986,28 @@ input.editor-text, textarea.editor-text {
1986
1986
  text-align: center;
1987
1987
  padding: 1.25rem .625rem;
1988
1988
  font-size: .8125rem;
1989
+ position: absolute;
1990
+ top: 0;
1991
+ left: 0;
1992
+ right: 0;
1989
1993
  }
1990
1994
 
1991
1995
  .sel-empty[hidden] {
1992
1996
  display: none;
1993
1997
  }
1994
1998
 
1999
+ .sel-status {
2000
+ color: var(--jsl-color-text-muted);
2001
+ text-align: center;
2002
+ flex: none;
2003
+ padding: .375rem .625rem;
2004
+ font-size: .75rem;
2005
+ }
2006
+
2007
+ .sel-status[hidden] {
2008
+ display: none;
2009
+ }
2010
+
1995
2011
  .sel-dd-animate {
1996
2012
  animation: .12s ease-out jsl-select-appear;
1997
2013
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsl-ui",
3
- "version": "10.4.0",
3
+ "version": "10.4.1",
4
4
  "main": "lib/index.js",
5
5
  "description": "javascript UI library",
6
6
  "files": [