canvas-datagrid 0.25.4 → 0.27.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/CHANGELOG.md CHANGED
@@ -7,6 +7,351 @@ All notable changes to this project will be documented in this file.
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
+ ## 0.27.0 - 2026-11-07
11
+
12
+ ### Changed
13
+
14
+ - **Breaking:** the default `auto` width and height now size the grid to the
15
+ element it is placed in. When the parent has a size of its own in a
16
+ dimension (a fixed height, a flex or grid track, the width of a block), the
17
+ grid fills it, leaving room for the parent's other content, and follows the
18
+ parent when it is resized. When the parent has no size of its own (a
19
+ content-sized height, a shrink-to-fit width) the grid grows to fit its rows
20
+ and columns as before, but no further than the viewport, and scrolls for the
21
+ rest. Grids that previously relied on `auto` to grow to their content now
22
+ fill their container and show scroll bars when the data is larger; set
23
+ `style.width`/`style.height` explicitly to keep a fixed size.
24
+ - Tree grids and cell grids show scroll bars when their data overflows them,
25
+ whatever the parent grid's `width`/`height` style is.
26
+
27
+ ### Fixed
28
+
29
+ - The mouse wheel over a tree grid scrolled the parent grid as well, and with
30
+ nested tree grids every ancestor scrolled. Only the grid under the pointer
31
+ scrolls now, even when it has nothing left to scroll in that direction. The
32
+ pointer over a tree grid no longer counts as hovering the parent's row, and
33
+ collapsing a tree grid removes its wheel listener from the parent.
34
+
35
+ ## 0.26.0 - 2026-09-19
36
+
37
+ Version note: the project restarted its numbering at 0.3.0 in 2021 while the
38
+ registry still held 0.22 to 0.25.4, so every release since then sorted below
39
+ 0.25.4 and `latest` had to be forced by hand. This release continues from
40
+ 0.25.4 instead, which makes npm's version ordering correct again. There is
41
+ no 0.5.0 release; the changes below were briefly tagged as such.
42
+
43
+
44
+ ### Added
45
+
46
+ - `activecellchanged` event (Tomasz Pędraszewski, #582)
47
+ - `fillLastColumn` attribute: the last visible column fills the remaining grid width and its outer edge cannot be resized (Cauho, #589, fixes #474)
48
+ - `allowGridExpandOnPaste` attribute: pasted data larger than the grid adds rows and columns (Roman Stetsyk, #553, fixes #552); the expansion happens in one pass
49
+ - `allowColumnSelection` attribute: when false, header clicks sort without selecting the column (#473)
50
+ - `maxCanvasSize` attribute: auto-sized grids stop growing at the browser canvas limit and scroll for the rest (#254)
51
+ - `datachanged` fires for every data mutation with `e.source` (`edit`, `paste`, `cut`, `delete`, `fill`, `addrow`, ...); `afterpaste` cell tuples carry the pasted value (#250, #512, #549)
52
+ - A `ResizeObserver` on the host and its parent keeps auto/percentage-sized grids in sync with layout changes without calling `resize()` (#289, #239)
53
+ - `getColumnWidth` and `getRowHeight` are public (#448)
54
+ - `dist/types.d.ts` is a real module with a default-exported factory, `canvasDatagrid` class/namespace and `CanvasDatagridArgs`; `npm test` type-checks it (#567)
55
+ - CSS font shorthand support: weights/styles are kept, pt/em/rem/% sizes are converted (#157)
56
+ - Docs: "Using with React/Vue/Angular", "Using with TypeScript", "Use a custom editor for a cell", "Load data on demand with fetch", "Sparkline charts", "Large arrays"; demo scripts moved into the docs (evanbenjamin, #570)
57
+
58
+ ### Changed
59
+
60
+ - `resizerow` always carries `rowIndex`, `height`, `width`, `x`, `y`, `draggingItem`; `cellHeight` and `row` remain as aliases (#503)
61
+ - `grid.changes` is keyed by the bound row index instead of the view row index (#418)
62
+ - `singleSelectionMode` now also limits drag, shift and ctrl selection to one row/cell (#472)
63
+ - Column reordering no longer requires `allowRowReordering`; the right part of each header is a reorder grab zone (`columnGrabZoneSize`) and a plain header click still sorts (#514)
64
+ - A mouseup anywhere ends a selection drag, not only a mouseup over the canvas
65
+ - `touchstart` is a passive listener (#328)
66
+ - `treeHorizontalScroll` is documented as reserved/not implemented (#314)
67
+ - CI runs on Node 20/22 with current GitHub Actions; the docs build works on Node 23+ (#574 build)
68
+
69
+ ### Fixed
70
+
71
+ - Delete/Backspace, cut and the fill handle respect `editable: false` (#587, #458)
72
+ - Deleting the edited row in `beforeendedit` no longer re-adds it (#583)
73
+ - `treeGridAttributes` are applied to child grids (#444)
74
+ - `fitColumnToValues()` without a name fits every column and unknown names no longer throw (#193)
75
+ - Setting `columnOrder` redraws (#160)
76
+ - `verticalAlignment: 'bottom'` is no longer one line too high (#530)
77
+ - The number filter matches numeric cell values (#431)
78
+ - `rendertext` handlers may supply lines without a width; right/center alignment no longer blanks the column (#460)
79
+ - Assigning a new array to `e.items` in the `contextmenu` event replaces the menu (#263)
80
+ - `scrollIndexRect` is initialised before the first draw (#226)
81
+ - Touch handlers tolerate a missing starting cell (#554)
82
+ - Copy with an active cell but no selection no longer throws (#566)
83
+ - The string sorter coerces values so numbers and blanks sort consistently (#256)
84
+ - The enum editor opens its picker immediately where supported (#230)
85
+ - The web component's MutationObserver is disconnected on dispose/disconnect and never stacked; dispose is idempotent and removes every listener (#237, #338, #455)
86
+ - No `eval` in the bundles; the grid works under a CSP without `unsafe-eval` (#311)
87
+ - The context menu survives the click macOS Safari sends after a ctrl-click (#521)
88
+ - Docs: `{@link}` tags render as links (#574); broken demo links (#540, #562, #563, #568); the format-data example no longer throws on invalid dates (#576); the rendertext example uses `formattext` (#262)
89
+
90
+ ## 0.4.7 - 2023-05-22
91
+
92
+ - Ensure only cells from selection get copied onto clipboard (mdebrauw, #556)
93
+ - Fix clearing of data when filter applied (mdebrauw, #560)
94
+ - Fixes 'paste into wrong cell when columns are reordered' (romanstetsyk, #518)
95
+
96
+ ## 0.4.6 - 2023-04-03
97
+
98
+ ## Added
99
+
100
+ - Add class name to allow targeting context menu by CSS (ilyaem, #526)
101
+
102
+ ## Changed
103
+
104
+ - Add more tests for properties `selections` and `selectionList` (hangxingliu, #505)
105
+ - Improve row/column resizing (velitasali, #502)
106
+ - Re-implement(Optimize) select function (hangxingliu, #498)
107
+
108
+ ## Fixed
109
+
110
+ - Fix sorting on header click (romanstetsyk, #550)
111
+ - Fix activeColumnHeaderCell docs (HitomiTenshi, #513)
112
+ - Fix some small bugs (hangxingliu, #504)
113
+
114
+ ## 0.4.5 - 2022-03-16
115
+
116
+ ## Added
117
+
118
+ - Added support for filling cells using a user-passed fill function (velitasali, #500)
119
+
120
+ ## 0.4.4 - 2022-02-23
121
+
122
+ ## Added
123
+
124
+ - Introduce frozen style markers (like Google Sheets) (xianzhi3, hangxingliu, #483)
125
+ - Dispatch column hide/unhide events (mdebrauw, #491)
126
+ - Allow cell editor overflow with long content (xianzhi3, #492)
127
+
128
+ ## Fixed
129
+
130
+ - Fix bug that cleared the canvas under a certain unusual refresh flow (hangxingliu, #494)
131
+
132
+ ## 0.4.3 - 2022-02-16
133
+
134
+ ## Added
135
+
136
+ - Ability to hide rows/cols with UI toggle (hangxingliu, #480)
137
+ - Add Vue setup instructions (Bouke Versteegh, #482)
138
+
139
+ ## Fixed
140
+
141
+ - Update column resizing including header (xianzhi3, #486)
142
+
143
+ ## 0.4.2 - 2022-01-22
144
+
145
+ ## Fixed
146
+
147
+ - Cancel moving when cursor exits grid (xianzhi3 #476)
148
+ - Fix clearing cells when grid is filtered (mdebrauw, #478)
149
+
150
+ ## 0.4.1 - 2022-01-19
151
+
152
+ ## Fixed
153
+
154
+ - Update row/column selection (xianzhi3, #467)
155
+ - Fix the behavior of the conext menu item used to hide column (hangxingliu, #470)
156
+
157
+ ## 0.4.0 - 2022-01-10
158
+
159
+ ## Added
160
+
161
+ - Feature: Add column/row grouping for tables (xianzhi3, #453)
162
+ - Feature: Add support for grouped columns (hangxingliu, #443)
163
+
164
+ ## Fixed
165
+
166
+ - Update ESLint config for incorrect errors. (hangxingliu, #465)
167
+ - Fix: Columns are hidden when there are frozen columns and hidden columns simultaneously (hangxingliu, #462)
168
+ - Fix: null values are cast to strings ('null') on copy (mdebrauw, #461)
169
+
170
+ ## 0.3.25 - 2021-12-22
171
+
172
+ ### Fixed
173
+
174
+ - Fix null value bug when copying value (ndrsn)
175
+ - Fix setting property `dragOffset` of undefined (Lie Yue, #457)
176
+ - Fix cell editing in the inner grid (Liu Yue, #456)
177
+
178
+ ## 0.3.24 - 2021-12-22
179
+
180
+ ### Changed
181
+
182
+ - Prevent default when handling cut event and cleanup utility functions (mdebrauw, #454)
183
+
184
+ ## 0.3.23 - 2021-12-16
185
+
186
+ ### Fixed
187
+
188
+ - Slight refactor and set minimum width when resizing (mdebrauw, #452)
189
+
190
+ ## 0.3.22 - 2021-12-15
191
+
192
+ ### Changed
193
+
194
+ - Resize selected columns simultaneously (mdebrauw, #451)
195
+ - Refactor `cut` and `copy` event handlers (mdebrauw, #450)
196
+
197
+ ## 0.3.21 - 2021-12-08
198
+
199
+ ### Added
200
+
201
+ - Add `afterdelete` event and `deleteSelectedData()` public method (mdebrauw, #446)
202
+
203
+ ### Fixed
204
+
205
+ - Remove mousemove at body when dispose (faimaklg, #449)
206
+ - Fire event when resizing column by double clicking column border (mdebrauw, #447)
207
+ - Fix filter button active/hover states, remove inline grid button after menu item click (xianzhi3, #445)
208
+
209
+ ## 0.3.20 - 2021-12-04
210
+
211
+ ### Added
212
+
213
+ - Add option for dropdown button when filtering (xianzhi3, #442)
214
+
215
+ ## 0.3.19 - 2021-11-24
216
+
217
+ ### Fixed
218
+
219
+ - Fix copy when column name or cell value is number (faimaklg, #402)
220
+ - Fix moving multiple columns or rows (xianzhi3, #390)
221
+ - Fix position of scroll bar with frozen pane xianzhi3, (#393)
222
+
223
+ ## 0.3.18 - 2021-11-18
224
+
225
+ No changes; had to bump version number because race condition caused 0.3.16 to be published instead of 0.3.17.
226
+
227
+ ## 0.3.17 - 2021-11-18
228
+
229
+ ### Fixed
230
+
231
+ - Do not render row gaps when sorting (ndrsn, #391)
232
+
233
+ ## 0.3.16 - 2021-11-18
234
+
235
+ ### Fixed
236
+
237
+ - Fix string sort when value is null/undefined (faimaklg, #388)
238
+
239
+ ## 0.3.15 - 2021-11-18
240
+
241
+ ### Fixed
242
+
243
+ - Fix highlighting incorrect column after repositioning column (xianzhi3, #399)
244
+ - Reverse sort order icon (faimaklg, #387)
245
+ - Fix link in tutorials (slominskir, #386)
246
+
247
+ ## 0.3.14 - 2021-10-20
248
+
249
+ ### Added
250
+
251
+ - Emit affected cells in `cut` event (mdebrauw, #383)
252
+
253
+ ## 0.3.13 - 2021-10-18
254
+
255
+ ### Changed
256
+
257
+ - `afterpaste` event now includes bound row/column index (mdebrauw, #381)
258
+ - Adds selectedCells to selectionchanged event (mdebrauw, #380)
259
+ - Add keepFocusOnMouseOut attribute (mdebrauw, #379)
260
+ - Better pasting of clipboard data (mdebrauw, #378)
261
+
262
+ ## 0.3.12 - 2021-10-11
263
+
264
+ ### Changed
265
+
266
+ - New options to exclude frozen rows when filtering and sorting (mdebrauw, #377)
267
+
268
+ ## 0.3.11 - 2021-10-04
269
+
270
+ ### Fixed
271
+
272
+ - Fix inconsistent selection behavior between touch and mouse (tmaroschik, #376)
273
+
274
+ ## 0.3.10 - 2021-10-04
275
+
276
+ ### Changed
277
+
278
+ - Allow shrinking selections with keyboard (mdebrauw, #375)
279
+
280
+ ## 0.3.9 - 2021-09-22
281
+
282
+ ### Fixed
283
+
284
+ - Fix buggy paste behavior introduced in #371 (mdebrauw, #373)
285
+
286
+ ## 0.3.8 - 2021-09-09
287
+
288
+ ### Fixed
289
+
290
+ - Fix autoscroll issue when selecting a cell on top or bottom row (mdebrauw, #369)
291
+ - Make copy and pasting more like Excel (faimaklg, #371)
292
+
293
+ ## 0.3.7 - 2021-08-30
294
+
295
+ ### Fixed
296
+
297
+ - Fix paste in filter mode (mdebrauw, #370)
298
+
299
+ ## 0.3.6 - 2021-08-16
300
+
301
+ Same as previous release but bumped version to get package to publish to NPM.
302
+
303
+ ## 0.3.5 - 2021-08-13
304
+
305
+ ### Fixed
306
+
307
+ - Fix missing text where value has multiple '-' (faimaklg, #363)
308
+
309
+ ## 0.3.4 - 2021-03-11
310
+
311
+ ### Added
312
+
313
+ - Adds option 'hoverMode' (twojtylak, #350)
314
+
315
+ ## 0.3.3 - 2021-02-08
316
+
317
+ ### Fixed
318
+
319
+ - Fixes situation where undefined `data` breaks drawing (ndrsn, #344)
320
+
321
+ ## 0.3.2 - 2021-02-05
322
+
323
+ ### Added
324
+
325
+ - Now shows row gaps when filtering data
326
+
327
+ ### Removed
328
+
329
+ - Remove unused currentFilter
330
+ - Drop support for IE11
331
+
332
+ ### Fixed
333
+
334
+ - Ctrl+click to select also emits selectionchanged event (ndrsn, #342)
335
+ - Pass row index to defaultValue function (ndrsn, #265)
336
+ - Rename getColummnWidth -> getColumnWidth (ndrsn, #281)
337
+
338
+ ## 0.3.1 - 2021-02-01
339
+
340
+ Nothing changed here, it was a failed attempt to get the type definitions
341
+ file automatically included in the NPM release.
342
+
343
+ ## 0.3.0 - 2021-02-01
344
+
345
+ ### Added
346
+
347
+ - Adds TypeScript type definitions (josh-hemphill, #333)
348
+
349
+ ### Changed
350
+
351
+ - Make distinction between original data and view data (ndrsn, #334)
352
+ - Fixes typo and possible bug (voderl, #339)
353
+ - Split up tests into separate files (ndrsn)
354
+
10
355
  ## 0.25.4 - 2020-11-26
11
356
 
12
357
  ### Changed
package/README.md CHANGED
@@ -1,47 +1,40 @@
1
- canvas-datagrid
2
- ---------------
1
+ # canvas-datagrid
3
2
 
4
- [Demo](https://canvas-datagrid.js.org/demo.html) - City of Chicago government employee list. Thanks to [data.gov](https://www.data.gov/).
3
+ [Demo](https://canvas-datagrid.js.org/examples/create-new-grid)
5
4
 
6
- ![canvas-datagrid](https://canvas-datagrid.js.org/images/datagrid1.png)
5
+ ![canvas-datagrid](https://canvas-datagrid.js.org/assets/images/datagrid1-a4d23a352c39919c40450d272a1cd4bd.png)
7
6
 
8
7
  [![NPM](https://img.shields.io/npm/v/canvas-datagrid.svg)](https://www.npmjs.com/package/canvas-datagrid)
9
8
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
10
9
  [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/TonyGermaneri/canvas-datagrid)
11
10
 
12
-
13
- * Works with Firefox, IE11, Edge, Safari and Chrome.
14
- * Native support for touch devices (phones and tablets).
15
- * Rich [documentation](https://canvas-datagrid.js.org/), [tutorials](https://canvas-datagrid.js.org/#tutorials), and [slack support](https://canvas-datagrid.slack.com/).
16
- * Single canvas element, drawn in immediate mode, data size does not impact performance.
17
- * Support for unlimited rows and columns without paging or loading.
18
- * Rich API of events, methods and properties using the familiar W3C DOM interface.
19
- * Extensible styling, filtering, formatting, resizing, selecting, and ordering.
20
- * Support for hierarchal drill in style row level inner grids as well grids in cells.
21
- * Customizable hierarchal context menu.
22
- * Built in and custom styles.
23
- * W3C Web Component. Works in all frameworks.
24
- * Per-user styles, column sizes, row sizes, view preferences and settings using localStorage.
25
- * Small file size
11
+ - Works with Firefox, Edge, Safari and Chrome.
12
+ - Native support for touch devices (phones and tablets).
13
+ - Rich [documentation](https://canvas-datagrid.js.org/), [examples](https://canvas-datagrid.js.org/examples), and [slack support](https://canvas-datagrid.slack.com/).
14
+ - Single canvas element, drawn in immediate mode, data size does not impact performance.
15
+ - Support for unlimited rows and columns without paging or loading.
16
+ - Rich API of events, methods and properties using the familiar W3C DOM interface.
17
+ - Extensible styling, filtering, formatting, resizing, selecting, and ordering.
18
+ - Support for hierarchal drill in style row level inner grids as well grids in cells.
19
+ - Customizable hierarchal context menu.
20
+ - Built in and custom styles.
21
+ - W3C Web Component. Works in all frameworks.
22
+ - Per-user styles, column sizes, row sizes, view preferences and settings using localStorage.
23
+ - Small file size
26
24
 
27
25
  [Documentation](https://canvas-datagrid.js.org/)
28
26
 
29
- [Tutorials](https://canvas-datagrid.js.org/#tutorials)
27
+ [Examples](https://canvas-datagrid.js.org/examples)
30
28
 
31
29
  [Slack Support](https://canvas-datagrid.slack.com/) (message author for invite)
32
30
 
33
- [Style Builder](https://canvas-datagrid.js.org/styleBuilder.html)
31
+ [Style reference](https://canvas-datagrid.js.org/reference/styling)
34
32
 
35
33
  [Download latest version (minified)](https://canvas-datagrid.js.org/canvas-datagrid.js)
36
34
 
37
- [Tests](https://canvas-datagrid.js.org/test/tests.html)
38
-
39
35
  [Source Code](https://github.com/TonyGermaneri/canvas-datagrid)
40
36
 
41
- [Latest Test Coverage](https://canvas-datagrid.js.org/build/report/lcov-report/index.html)
42
-
43
- Installation
44
- ------------
37
+ ## Installation
45
38
 
46
39
  With [npm](https://www.npmjs.com/package/canvas-datagrid)
47
40
 
@@ -49,7 +42,6 @@ With [npm](https://www.npmjs.com/package/canvas-datagrid)
49
42
  npm install canvas-datagrid
50
43
  ```
51
44
 
52
-
53
45
  Place the single source file `./dist/canvas-datagrid.js` in your web page using a script tag that points to the source or use webpack.
54
46
 
55
47
  ```html
@@ -64,30 +56,26 @@ Alternatively, instead of downloading and installing, you can link directly to a
64
56
 
65
57
  A function will be added to the global scope of the web page called `canvasDatagrid` as well as module loader definitions.
66
58
 
67
- Getting started
68
- ---------------
59
+ ## Getting started
69
60
 
70
- Works [with webpack](https://canvas-datagrid.js.org/amdDemo.html), [without webpack](https://canvas-datagrid.js.org/demo.html) or as a [web component](https://canvas-datagrid.js.org/webcomponentDemo.html).
61
+ Works [with a bundler](https://canvas-datagrid.js.org/examples/Webpack3-AMD), [without one](https://canvas-datagrid.js.org/getting-started#using-pure-javascript) or as a [web component](https://canvas-datagrid.js.org/getting-started#using-as-a-web-component).
71
62
  No matter how you load it, `canvasDatagrid` is declared in the global scope.
72
63
 
73
64
  Canvas-datagrid is a [Web Component](https://www.webcomponents.org/element/TonyGermaneri/canvas-datagrid) when
74
65
  in a compatible browser, otherwise it is a `<canvas>` tag.
75
66
 
76
- Using pure JavaScript
77
- ---------------------
67
+ ## Using pure JavaScript
78
68
 
79
69
  ```js
80
70
  var grid = canvasDatagrid();
81
71
  document.body.appendChild(grid);
82
72
  grid.data = [
83
- {col1: 'row 1 column 1', col2: 'row 1 column 2', col3: 'row 1 column 3'},
84
- {col1: 'row 2 column 1', col2: 'row 2 column 2', col3: 'row 2 column 3'}
73
+ { col1: 'row 1 column 1', col2: 'row 1 column 2', col3: 'row 1 column 3' },
74
+ { col1: 'row 2 column 1', col2: 'row 2 column 2', col3: 'row 2 column 3' },
85
75
  ];
86
76
  ```
87
77
 
88
-
89
- Using Web Component
90
- -------------------
78
+ ## Using Web Component
91
79
 
92
80
  <!--
93
81
  ```
@@ -101,10 +89,11 @@ Using Web Component
101
89
  -->
102
90
 
103
91
  ```html
104
- <canvas-datagrid class="myGridStyle" data="data can go here too">[
105
- {"col1": "row 1 column 1", "col2": "row 1 column 2", "col3": "row 1 column 3"},
106
- {"col1": "row 2 column 1", "col2": "row 2 column 2", "col3": "row 2 column 3"}
107
- ]</canvas-datagrid>
92
+ <canvas-datagrid class="myGridStyle" data="data can go here too"
93
+ >[ {"col1": "row 1 column 1", "col2": "row 1 column 2", "col3": "row 1 column
94
+ 3"}, {"col1": "row 2 column 1", "col2": "row 2 column 2", "col3": "row 2
95
+ column 3"} ]</canvas-datagrid
96
+ >
108
97
  ```
109
98
 
110
99
  or
@@ -112,56 +101,85 @@ or
112
101
  ```js
113
102
  var grid = document.createElement('canvas-datagrid');
114
103
  grid.data = [
115
- {"col1": "row 1 column 1", "col2": "row 1 column 2", "col3": "row 1 column 3"},
116
- {"col1": "row 2 column 1", "col2": "row 2 column 2", "col3": "row 2 column 3"}
104
+ { col1: 'row 1 column 1', col2: 'row 1 column 2', col3: 'row 1 column 3' },
105
+ { col1: 'row 2 column 1', col2: 'row 2 column 2', col3: 'row 2 column 3' },
117
106
  ];
118
107
  ```
119
108
 
120
-
121
- Using Vue
122
- ---------
109
+ ## Using Vue
123
110
 
124
111
  ```vue
125
112
  <canvas-datagrid :data.prop="[{"col1": "row 1 column 1"}]"></canvas-datagrid>
126
113
  ```
127
114
 
115
+ See [Using with Vue](https://canvas-datagrid.js.org/examples/vue-demo) for a full component, and [Using with React](https://canvas-datagrid.js.org/examples/react-demo) for React.
128
116
 
129
- More Demos
130
- ----------
131
-
132
- * [Using Vue](https://canvas-datagrid.js.org/vueExample.html)
117
+ ## Using TypeScript
133
118
 
134
- * [Using Webpack3: AMD](https://canvas-datagrid.js.org/amdDemo.html)
119
+ Type declarations are included. Import the factory and, when you need them, the instance and argument types:
135
120
 
136
- * [Using React](https://canvas-datagrid.js.org/reactExample.html)
137
-
138
- * [Web component example](https://canvas-datagrid.js.org/webcomponentDemo.html)
139
-
140
- * [Loading data with XHR](https://canvas-datagrid.js.org/demo.html)
121
+ ```ts
122
+ import canvasDatagrid, {
123
+ type canvasDatagrid as CanvasDatagrid,
124
+ type CanvasDatagridArgs,
125
+ } from 'canvas-datagrid';
126
+ ```
141
127
 
142
- * [Sparkline example](https://canvas-datagrid.js.org/sparklineDemo.html)
128
+ The declarations are generated from JSDoc and are not strict-clean yet, so keep `skipLibCheck: true` in your `tsconfig.json`.
143
129
 
144
- * [XHR data paging demo Jeopardy Questions API](https://canvas-datagrid.js.org/xhrPagingDemo.html)
130
+ ## More Demos
145
131
 
146
- Note about XHR paging demo: Thanks to [jservice](http://jservice.io/) for the use of the free paging API. You must "load unsafe scripts" or relevant command to allow HTTPS (github) to make XHR requests to HTTP (Jeopardy Questions API). There is nothing unsafe about this.
132
+ - [Using with React](https://canvas-datagrid.js.org/examples/react-demo)
133
+ - [Using with Vue](https://canvas-datagrid.js.org/examples/vue-demo)
134
+ - [Using with a bundler or module loader](https://canvas-datagrid.js.org/examples/Webpack3-AMD)
135
+ - [Create a web component grid](https://canvas-datagrid.js.org/examples/create-a-web-component-grid)
136
+ - [Load data on demand with fetch](https://canvas-datagrid.js.org/examples/xhr-demo)
137
+ - [Sparkline charts in cells](https://canvas-datagrid.js.org/examples/sparkline)
138
+ - [Large arrays](https://canvas-datagrid.js.org/examples/largeArrays)
139
+ - [Use a custom editor for a cell](https://canvas-datagrid.js.org/examples/custom-cell-editor)
140
+ - [All examples](https://canvas-datagrid.js.org/examples)
147
141
 
148
- Building & Testing
149
- ------------------
142
+ ## Building & Testing
150
143
 
151
- To install development dependencies. Required to build or test.
144
+ To install development dependencies. Required to build or test.
152
145
 
153
146
  npm install
154
147
 
155
- To build production and debug versions.
148
+ To build production and debug versions:
156
149
 
157
150
  npm run build
158
151
 
159
- To build documentation.
152
+ To build documentation:
160
153
 
161
- npm run build-docs
154
+ npm run build:docs
162
155
 
163
- To run tests. Note: Headless tests will mostly fail due to lack of headless canvas pixel detection support. Use VM testing or your browser.
156
+ To build types:
164
157
 
165
- npm test
158
+ npm run build:types
159
+
160
+ To run tests. Note: Headless tests will mostly fail due to lack of headless canvas pixel detection support. Use VM testing or your browser.
166
161
 
162
+ npm test
167
163
 
164
+ ### Windows 10 WSL Testing
165
+ *This is info for wsl version 1. v2 seems to be [different](https://dev.to/davelsan/comment/nnf5).*
166
+
167
+ - `CHROME_BIN` needs to be set to the location of your Google Chrome exe in Windows. (e.g. `/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`)
168
+ *in WSL, `export CHROME_BIN='path/to/chrome'`*
169
+ - Chrome needs access to [karma's temp folder](https://stackoverflow.com/a/56204265/292067).
170
+ - Create a `tmp` folder on the same Windows drive as your repo.
171
+ - set `TEMP` to a folder that exists on the same Windows drive as your repo. (matching capitalization probably matters)
172
+ *in WSL, `export TEMP='/Temp/karma'`, if your repo is on drive C, then create folder C:\Temp\karma*
173
+ - karma.conf.js needs to be edited
174
+ - Change the browser from `ChromeHeadless` to `Chrome`
175
+ - Modify to run ChromeHeadless without sandboxing. This is not ideal, but it seems to be necessary in [WSL](https://github.com/microsoft/WSL/issues/3282) and [Linux containers](https://docs.travis-ci.com/user/chrome#sandboxing) ([see also](https://github.com/karma-runner/karma-chrome-launcher/issues/158#issuecomment-339265457))
176
+ - Add a custom launcher
177
+ ```
178
+ customLaunchers: {
179
+ ChromeHeadlessNoSandbox: {
180
+ base: 'ChromeHeadless',
181
+ flags: ['--no-sandbox']
182
+ }
183
+ }
184
+ ```
185
+ - Change the browser from `ChromeHeadless` to `ChromeHeadlessNoSandbox`