jsl-ui 10.0.4 → 10.0.6
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/docs/GridComponent.md +28 -11
- package/examples/showcase/grids.ts +3 -3
- package/lib/components/select/SelectStyle.scss +1 -1
- package/lib/components/tabs/TabsStyle.scss +1 -1
- package/lib/grid.css +3329 -746
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/package.json +1 -1
package/docs/GridComponent.md
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
# GridComponent
|
|
2
2
|
|
|
3
|
+
`GridComponent<T>` wraps the grid for use in a JSL render tree. It accepts an array or promise of rows, column definitions, grid options, and an optional height.
|
|
4
|
+
|
|
3
5
|
```ts
|
|
4
6
|
import { GridComponent, NumericFormatter } from "jsl-ui";
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
interface Request { Id: number; Name: string; Amount: number; }
|
|
9
|
+
|
|
10
|
+
const grid = new GridComponent<Request>(
|
|
11
|
+
[{ Id: 1, Name: "Office supplies", Amount: 1250.5 }],
|
|
12
|
+
[
|
|
13
|
+
{ id: "Name", field: "Name", name: "Request", width: 180, sortable: true },
|
|
14
|
+
{ id: "Amount", field: "Amount", name: "Amount", width: 140,
|
|
15
|
+
sortable: true, formatter: NumericFormatter, headerCssClass: "right" }
|
|
16
|
+
],
|
|
17
|
+
{ primaryKey: "Id", showHeaderMenu: true, saveColumnsKey: "requests-grid" },
|
|
18
|
+
"360px"
|
|
11
19
|
);
|
|
12
|
-
grid.initEvents(g => { /* subscribe to grid events here */ });
|
|
13
20
|
```
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
22
|
+
## Patterns and features
|
|
23
|
+
|
|
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:** Set formatters, editors, widths, `sortable`, and `filterable` per column. Enable `editable` in grid options to edit cells; the demos show text, number, date, time, boolean, lookup, and custom editors. Use grid events such as `onBeforeEditCell` and `onAfterEdit` for application rules.
|
|
26
|
+
- **Derived and grouped data:** Use `addFormula(field, calculate, dependencies)` for calculated values, then `triggerAllFormulas()` for initial values. The grid's DataView supports filters, grouping, expand/collapse, and aggregators for group summaries.
|
|
27
|
+
- **Sorting and layout:** `multiColumnSort` and `numberedMultiColumnSort` support prioritized sorts. `frozenColumn`, `rowHeight`/`autoHeight`, `showColumnGroups` with each column's `columnGroup`, and footer rows cover wide or structured grids.
|
|
28
|
+
- **Interaction and rendering:** Examples include row and cell selection, manual row reordering (`allowRowMove`), custom cell formatters, rendered JSL components, asynchronous cell rendering, variable row heights, column spans, and undo/redo. Disable sorting when manual row order should remain authoritative.
|
|
29
|
+
- **Styling:** `NumericFormatter` aligns cell values; set `headerCssClass: "right"` or `"center"` explicitly to align headers. Keep `content-box` sizing on cells and headers so padding and borders do not disrupt grid measurements.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
- [GridComponent showcase](../examples/showcase/grids.ts): sorting, editing, formatters, grouping, frozen columns, formulas, totals, and row reordering.
|
|
34
|
+
- [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).
|
|
35
|
+
|
|
36
|
+
The focused demos mostly use `createJSLGrid` directly and show the underlying grid APIs; use the showcase for `GridComponent` patterns.
|
|
@@ -104,7 +104,7 @@ const editorSampleColumns: ISlickColumn[] = [
|
|
|
104
104
|
const editorCatalog = new GridComponent(editorSamples, editorSampleColumns, {
|
|
105
105
|
primaryKey: "id", editable: true, autoEdit: false, rowHeight: 38
|
|
106
106
|
}, "340px");
|
|
107
|
-
const editorCatalogStatus: IJSLVNode = { tag: "p", content: "Double-click a cell
|
|
107
|
+
const editorCatalogStatus: IJSLVNode = { tag: "p", content: "Double-click a cell to edit. Enter commits; Escape cancels.", attr: { role: "status", class: "sample-status" } };
|
|
108
108
|
editorCatalog.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {
|
|
109
109
|
editorCatalogStatus.content = "Updated " + args.column.name + " for sample " + args.item.id + ".";
|
|
110
110
|
JSLRender.lastCreatedRenderer?.refresh();
|
|
@@ -192,7 +192,7 @@ export const gridShowcase: IJSLVNode = {
|
|
|
192
192
|
] },
|
|
193
193
|
{ tag: "div", attr: { class: "grid-samples" }, children: [
|
|
194
194
|
card("grid-basic", "Browse and sort", "30 projects. 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),
|
|
195
|
-
card("grid-editable", "Edit in place", "Double-click an editable cell
|
|
195
|
+
card("grid-editable", "Edit in place", "Double-click an editable cell. Enter commits and Escape cancels. Editors retain their existing behavior and styling in this step.", editable, [edits]),
|
|
196
196
|
card("grid-editors-formatters", "Formatters and editors", "Try text, multiline, numeric, date, time, boolean, lookup, multi-lookup, and autosuggest editors. The adjacent columns demonstrate the matching display formatters; TimeFormatter displays a Date value, while TimeEditor edits a time string.", editorCatalog, [editorCatalogStatus]),
|
|
197
197
|
card("grid-grouped", "Grouped projects", "45 projects grouped by team. Expand and collapse groups independently.", grouped, [
|
|
198
198
|
{ tag: "div", attr: { class: "sample-row" }, children: [
|
|
@@ -213,4 +213,4 @@ export const gridShowcase: IJSLVNode = {
|
|
|
213
213
|
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. Filter dialogs, menus, and lifecycle behavior are reserved for later steps.")
|
|
214
214
|
] }
|
|
215
215
|
]
|
|
216
|
-
};
|
|
216
|
+
};
|