@jh-grid/jhgrid-js 0.1.2 → 0.2.0

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/README.md CHANGED
@@ -8,46 +8,22 @@ performance, editing, filtering, and frozen columns, running in your browser rig
8
8
 
9
9
  ![JH Grid screenshot](docs/images/jhgrid.png)
10
10
 
11
- > This repository distributes the **pre-built bundle** (`jhgrid.esm.js` / `jhgrid.js` /
12
- > `jhgrid.min.js`) plus its documentation, not the buildable source tree. See [`docs/`](docs/README.md)
13
- > for the full reference.
14
-
15
11
  ---
16
12
 
17
13
  ## Features
18
14
 
19
- - Smooth rendering via `requestAnimationFrame` + Canvas 2D, synced to your display's native refresh rate (60Hz, 120Hz, 144Hz, etc.), not capped at 60fps
20
- - 2D virtual scrolling: only visible cells are drawn
21
- - Chunk-based async data loading with prefetch & cache
22
- - HiDPI / Retina display support (devicePixelRatio scaling)
23
- - Draggable scrollbars (vertical + horizontal)
24
- - Left/right frozen columns (`frozenCols` / `frozenColsRight`)
25
- - **Cell click**: single cell selection with blue border highlight
26
- - **Cell drag**: multi-cell range selection with fill overlay
27
- - **Row selection**: single/multi row selection (`rowSelection: 'single' | 'multi'`), with an optional select-all header checkbox (`columnDefs[].headerCheckbox`)
28
- - **Row drag reorder**: drag rows by the row-number gutter (`rowReorder: true`)
29
- - **Double-click to edit**: per-column editable/readonly control
30
- - **Ctrl+C / Ctrl+V**: copy & paste (single cell or range, TSV format)
31
- - **Ctrl+Z / Ctrl+Y**: undo / redo (cell edits, row/column add/delete)
32
- - **Column validation**: declarative required/pattern/min/max/length/custom rules with red-border + tooltip error display (`min`/`max` compare chronologically on a `type: 'date'` column)
33
- - **In-cell action buttons**: `type: 'button'` columns render a clickable pill per row (e.g. "Delete", "Approve") independent of `editableCols`
34
- - **Date / rich-text / image cell types**: `type: 'date'` opens a native date/datetime picker; `type: 'richtext'` opens an inline bold/italic/underline/strikethrough editor; `type: 'image'` renders a cell image (`fit: 'cover' | 'contain'`, size-aware decoding, shared LRU cache), plus a pluggable `CellEditors`/`CellRenderers` registry (`registerCellEditor()`/`registerCellRenderer()`) for fully custom editors and renderers
35
- - **Set filter**: checkbox list of a column's distinct values in the header filter panel (`setFilterValues()`)
36
- - **Quick filter**: global cross-column search term (`setQuickFilter()` / `getQuickFilter()` / `clearQuickFilter()`)
37
- - **Single-column sort**: `setSort()` / `removeSort()` / `clearSort()`
38
- - **Row / column CRUD**: `addRow()`/`deleteRow()`/`undeleteRow()`, `addColumn()`/`deleteColumn()`/`undeleteColumn()`, with matching `getNew*()`/`getDeleted*()` accessors for diff-based saves
39
- - **Column hide/show**: `hideColumn()` / `showColumn()` / `isColumnVisible()` / `getHiddenColumns()`, plus per-row/column resize (`setRowHeight()`, `autoFitColumns()`)
40
- - **Multi-level header groups**: `columnDefs[].group` (or explicit `headerRows`) merges header cells across levels
41
- - **Per-row / per-cell styling callbacks**: `rowHighlighter` / `cellBackground` for conditional formatting
42
- - **State snapshot/restore**: `getState()` / `setState()` for saving and restoring grid state (filters, sort, column order/visibility, edits)
43
- - **Built-in localization**: `locale` option with bundled `KO_I18N` / `JA_I18N` / `ZH_I18N` text packs, per-key `i18n` overrides, and locale-aware number/date/currency cell rendering
44
- - **Accessibility**: ARIA labeling, keyboard-navigable header/row focus, and automatic high-contrast (`forced-colors`) theme remapping
45
- - **CSV export + print preview**: `exportCsv()`, `printGrid()`
46
- - **Arrow key navigation**: keyboard-driven cell movement
47
- - **Enter / Tab**: commit edit and move to next row / column
48
- - Text overflow with ellipsis (`…`): O(log n) binary search
49
- - Fully themeable
50
- - Zero dependencies
15
+ - **Canvas rendering + 2D virtualization** - smooth at 60/120/144Hz, HiDPI-aware
16
+ - **Large-data loading** - chunk-based async loading with prefetch & cache
17
+ - **Frozen columns & scrollbars** - left/right freezing with draggable vertical/horizontal scrollbars
18
+ - **Selection & row operations** - cell/range selection, single/multi row selection, row drag reorder
19
+ - **Editing** - inline editing, validation, undo/redo, TSV copy & paste
20
+ - **Rich cell types** - dropdown, multiselect, checkbox, date, richtext, image, button, plus custom editors/renderers
21
+ - **Filtering & sorting** - set filter, quick filter, single-column sort
22
+ - **CRUD & change tracking** - row/column add/delete with diff-based persistence
23
+ - **Headers & styling** - multi-level headers, conditional row/cell styling
24
+ - **State & export** - state snapshot/restore, CSV export, print preview
25
+ - **i18n & accessibility** - KO/JA/ZH localization, ARIA, keyboard navigation, high-contrast support
26
+ - **Zero dependencies & theming** - fully themeable with no runtime dependencies
51
27
 
52
28
  ---
53
29
 
@@ -68,25 +44,27 @@ The package ships as **ES Modules only** and includes its own TypeScript declara
68
44
  modern Node ESM can consume it directly. CommonJS `require('@jh-grid/jhgrid-js')` is *not* supported; use a
69
45
  dynamic `await import('@jh-grid/jhgrid-js')` if you must load it from a CJS file.
70
46
 
71
- ### Option B: Static ES module (no bundler)
47
+ ### Option B: ES Module (source as-is)
72
48
 
73
- `jhgrid.esm.js` is a single self-contained ES module file: deploy it as-is as a static resource
74
- (e.g. from a Spring Boot static resource path) and import it directly, no build step required:
49
+ No build step or package manager: deploy the source as-is as a static resource and import it as
50
+ an ES Module (e.g. from a Spring Boot static resource path).
75
51
 
76
52
  ```html
77
53
  <script type="module">
78
- import { JHGrid } from '/static/jhgrid.esm.js';
54
+ import { JHGrid } from '/canvas-grid/index.js';
79
55
  </script>
80
56
  ```
81
57
 
82
58
  ### Option C: CDN (single bundled script)
83
59
 
84
- `jhgrid.min.js` is an IIFE build served straight from this repository via jsDelivr, no npm
85
- install required. Everything is exposed on a single global, `JHGrid` (the grid constructor is
60
+ A pre-bundled IIFE build is generated with `npm run build` (`esbuild`, see
61
+ `dist/jhgrid/dist/jhgrid.min.js`) and served straight from GitHub via jsDelivr, no npm publish
62
+ required. Everything is exposed on a single global, `JHGrid` (the grid constructor is
86
63
  `JHGrid.JHGrid`):
87
64
 
88
65
  ```html
89
- <!-- pin an exact tag/commit for production; @latest always serves the latest commit on that branch -->
66
+ <!-- pin an exact tag for production; @latest resolves to the newest git tag -->
67
+ <!-- dist/jhgrid/'s contents are pushed as the repo root, so the CDN path is dist/jhgrid.min.js -->
90
68
  <script src="https://cdn.jsdelivr.net/gh/JH-Grid/JHGrid@latest/dist/jhgrid.min.js"></script>
91
69
  <script>
92
70
  const grid = new JHGrid.JHGrid({
@@ -96,6 +74,10 @@ install required. Everything is exposed on a single global, `JHGrid` (the grid c
96
74
  </script>
97
75
  ```
98
76
 
77
+ Run `npm run build` (minified, for CDN/production) or `npm run build:dev` (unminified, for
78
+ debugging) after changing source files; the `dist/` output must be committed for jsDelivr to
79
+ serve it.
80
+
99
81
  ---
100
82
 
101
83
  ## Quick Start
@@ -169,14 +151,21 @@ const grid = new JHGrid({
169
151
  See [`fetchPage`](docs/api.md#fetchpage-single-callback-alternative) for a single-callback
170
152
  alternative to `fetchMeta`+`fetchData` when your backend already returns both together.
171
153
 
154
+ The kitchen-sink demo exercises every column type, renderer, and callback at once:
155
+
156
+ ```bash
157
+ node demo/server.mjs
158
+ # open http://localhost:8123/
159
+ ```
160
+
172
161
  ---
173
162
 
174
163
  ## Documentation
175
164
 
176
165
  **[Browse the docs online](https://jh-grid.github.io/JHGrid/)**, or read them directly in
177
- [`docs/`](docs/README.md):
166
+ [`docs/`](docs/README.md), since this README stays a quick landing page:
178
167
 
179
- - **[API Reference](docs/api.md)**: every constructor option, the data source interface, pagination, and all public methods
168
+ - **[API Reference](docs/api.md)**: every constructor option, the data source interface, pagination, and all public methods (filtering, sorting, row/column CRUD, editors, export)
180
169
  - **[Theming](docs/theming.md)**: the full theme object, styling with your own CSS via `--jhg-*` custom properties, and canvas motion tuning
181
170
  - **[Interaction Reference](docs/interaction.md)**: every mouse and keyboard interaction
182
171
  - **[Spring Boot Integration](docs/integration.md)**: backend API shape and SQL pagination