infi-grid 1.0.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +141 -0
  2. package/README.md +654 -0
  3. package/fesm2022/infi-grid.mjs +10314 -0
  4. package/fesm2022/infi-grid.mjs.map +1 -0
  5. package/index.d.ts +5 -0
  6. package/lib/components/cell-editor.component.d.ts +42 -0
  7. package/lib/components/filter-popup.component.d.ts +89 -0
  8. package/lib/components/filter-row.component.d.ts +104 -0
  9. package/lib/components/grid.component.d.ts +155 -0
  10. package/lib/components/header-row.component.d.ts +76 -0
  11. package/lib/components/row.component.d.ts +106 -0
  12. package/lib/components/summary-row.component.d.ts +40 -0
  13. package/lib/components/tooltip-controller.d.ts +43 -0
  14. package/lib/components/viewport.component.d.ts +217 -0
  15. package/lib/core/accessor.d.ts +6 -0
  16. package/lib/core/config-resolver.d.ts +16 -0
  17. package/lib/core/defaults.d.ts +7 -0
  18. package/lib/core/filter-engine.d.ts +44 -0
  19. package/lib/core/format.d.ts +11 -0
  20. package/lib/core/keys.d.ts +24 -0
  21. package/lib/core/row-ops.d.ts +20 -0
  22. package/lib/core/sort-engine.d.ts +11 -0
  23. package/lib/core/summary-engine.d.ts +35 -0
  24. package/lib/core/template-registry.d.ts +27 -0
  25. package/lib/core/theme.d.ts +2 -0
  26. package/lib/core/tooltip-position.d.ts +24 -0
  27. package/lib/core/values.d.ts +21 -0
  28. package/lib/core/virtual-math.d.ts +57 -0
  29. package/lib/directives/grid-template-component.d.ts +16 -0
  30. package/lib/directives/outlet.directive.d.ts +25 -0
  31. package/lib/directives/template.directives.d.ts +98 -0
  32. package/lib/grid.module.d.ts +15 -0
  33. package/lib/models/api.types.d.ts +249 -0
  34. package/lib/models/column.types.d.ts +184 -0
  35. package/lib/models/config.types.d.ts +390 -0
  36. package/lib/models/crud.types.d.ts +179 -0
  37. package/lib/models/data.types.d.ts +41 -0
  38. package/lib/models/events.types.d.ts +98 -0
  39. package/lib/models/filter.types.d.ts +78 -0
  40. package/lib/models/index.d.ts +12 -0
  41. package/lib/models/selection.types.d.ts +173 -0
  42. package/lib/models/sort.types.d.ts +22 -0
  43. package/lib/models/summary.types.d.ts +78 -0
  44. package/lib/models/template.types.d.ts +126 -0
  45. package/lib/models/tooltip.types.d.ts +48 -0
  46. package/lib/state/filter-popup.service.d.ts +30 -0
  47. package/lib/state/grid-api.d.ts +4 -0
  48. package/lib/state/grid-store.d.ts +584 -0
  49. package/lib/state/tooltip.service.d.ts +38 -0
  50. package/package.json +41 -0
  51. package/public-api.d.ts +8 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,141 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0
4
+
5
+ First release of InfiGrid, published as `infi-grid`. It is angpackage-grid 1.2.1 under its new name: the same features, behaviour, configuration, API, events and types. Only the names change (the README's "Coming from angpackage-grid" has the full table):
6
+
7
+ - The package: `angpackage-grid` → `infi-grid` (`npm install infi-grid`).
8
+ - The component: `<ang-grid>` → `<infi-grid>`; `AngGridComponent`, `AngGridModule` and `ANG_GRID` → `InfiGridComponent`, `InfiGridModule` and `INFI_GRID`.
9
+ - The template directives: `angGrid…` → `infiGrid…` (for example `angGridCell` → `infiGridCell`).
10
+ - The CSS: classes `.ang-grid…` → `.infi-grid…`, theme variables `--ang-grid-*` → `--infi-grid-*`.
11
+
12
+ ## angpackage-grid releases
13
+
14
+ The releases below were published as `angpackage-grid`, under its names.
15
+
16
+ ### 1.2.1
17
+
18
+ Fast scrolling without blank rows or columns, cell reuse by column type (`templateKey`), and the filter row fix.
19
+
20
+ #### Added
21
+ - `templateKey` (column): template cells are reused while scrolling sideways, and a cell that leaves the view is given to a column with the same key. Rows get enough cells for the most columns of each key that can be in view, so once each cell has met its kind, scrolling only updates cells instead of re-rendering their content. Use it when columns share a template that renders different content, for example one template with an `@switch` on the column's type. Without keys, nothing changes.
22
+ - Why it matters: re-rendering a cell's content creates views. That is slow for rich cells (components, form controls), and in zone.js apps it also makes Angular check the whole application, so fast sideways scrolling or scrollbar jumps could leave parts of the grid blank for a moment.
23
+
24
+ - `virtualization.syncScroll` (default `true`): fast scrolling never shows blank rows or columns. See Fixes.
25
+
26
+ #### Fixes
27
+ - Fast scrolling (a mouse-wheel flick, a trackpad fling, a scrollbar drag) no longer shows blank rows or columns. Browsers scroll on their own thread and show the new position before the page's code runs; the grid draws the rows and columns for it a frame later (more on a slow PC, or while the first scroll after loading sets everything up), so areas past the drawn ones were blank until it caught up, the whole body during a fast scrollbar drag. Now the drawn content stays where it is while the browser scrolls, and moves in the same frame as the rows and columns drawn for the new position: it can follow the scrollbar a frame late, but is never blank. The header, the summary row and the pinned checkbox and action columns move with it, so nothing gets out of line.
28
+ - The checkbox and action columns are placed by the grid instead of being sticky in every row. A sticky element in each row made the browser draw every row as a separate layer (about 70 layers for a typical grid instead of about 6), with more work for each frame and rows that could be drawn a frame apart.
29
+ - Nothing changes once scrolling stops: the grid looks the same as before. `virtualization: { syncScroll: false }` brings back the earlier behaviour.
30
+ - The filter row (`filtering.mode: 'row'` or `'both'`) is shown only while at least one displayed column is filterable. With filtering off (`filtering.enabled: false` with no column set to `filterable: true`, every column `filterable: false`, or the filterable columns hidden), an empty row used to stay under the header. The rows, the loading, empty and error overlays and the inline add row now start right under the header, and `aria-rowindex` counts only the header row.
31
+
32
+ #### Behaviour changes
33
+ 1. The viewport has three more wrapper elements, with or without `syncScroll`: `.ang-grid__stage` and `.ang-grid__stage-inner` around the header, the rows and the summary row, and `.ang-grid__rows-track` around the rows. CSS that relies on the old nesting with `>` (for example `.ang-grid__rows > .ang-grid__row`) needs updating; selectors without `>` keep working.
34
+ 2. With `syncScroll`, the checkbox and action columns (`.ang-grid__pin`) are absolutely positioned by the grid (class `is-placed`) instead of `position: sticky`. Custom CSS that sets their `position`, `left` or `right` can move them. `virtualization: { syncScroll: false }` makes them sticky again.
35
+
36
+ ### 1.2.0
37
+
38
+ Fixes and changes from the 1.1 test report, and cell selection.
39
+
40
+ #### Fixes
41
+ - The row and header checkboxes show the selection right after every change, in zone.js and zoneless apps: a click, the keyboard, the API, a filter, a sort or a data refresh. In zone.js apps, a clicked row's box could stay unchecked (and the header box miss its indeterminate state) until the next scroll.
42
+
43
+ #### Row selection
44
+ - `selection.clickBehavior` is removed; the mode decides what a click (checkbox, or cell and row with `selectOnClick`) and Space do:
45
+ - `'multiple'`: toggle that row and keep the other selected rows. Shift+click and Shift+↑/↓ select the rows from the last clicked row, keeping the rows selected before; repeating Shift grows or shrinks that range. Ctrl/Cmd+click is the same as a click.
46
+ - `'single'`: select that row instead of the selected one; on the selected row, deselect it.
47
+ - Changing `selection.mode` at runtime: `'none'` deselects every row, `'single'` keeps only the last selected row (`selectionChange` with source `'api'`).
48
+
49
+ #### Cell selection (new, off by default)
50
+ - `cellSelection: { enabled, activeRow }`, a section of its own: no `selection` option applies to it.
51
+ - A click or the keyboard (arrows, Home/End, Page Up/Down, Ctrl+Home/End, Tab between editors) selects one cell: focus outline, `is-selected`, `aria-selected`.
52
+ - It follows its row by key through sorting, filtering, scrolling and refreshes, and is cleared when its row leaves the data or its column is removed.
53
+ - Clicks never change the row selection while it is on (`selectOnClick` is ignored). Rows are selected with the checkbox column, the keyboard and the API.
54
+ - `activeRow`: the selected cell's row gets `.ang-grid__row--active` (`--ang-grid-active-row-bg`). Visual only.
55
+ - `(cellSelectionChange)`: the cell's row, key, indexes, field, column, value and formatted value, the previous cell, the source and the DOM event. `cancel` in `(cellClick)`/`(rowClick)` stops the cell selection.
56
+ - API: `getSelectedCell()`, `selectCell(key, field, { scroll })`, `clearCellSelection()`.
57
+ - Theme variables: `--ang-grid-active-row-bg`, `--ang-grid-selected-cell-bg`.
58
+
59
+ #### Behaviour changes
60
+ 1. `selection.clickBehavior` is removed (setting it is a type error; a value that still arrives at runtime is ignored).
61
+ - Multiple mode: a plain click used to replace the selection (the default, `'replace'`); it now toggles the row. Apps whose users relied on a click replacing the selection can use `'single'` mode.
62
+ - Single mode: a click on the selected row now deselects it.
63
+ 2. Shift+click in multiple mode keeps the rows selected before the range (it used to replace them unless Ctrl/Cmd was held).
64
+ 3. Changing `selection.mode` at runtime reduces the selection, as described above.
65
+
66
+ ### 1.1.0
67
+
68
+ All additions are opt-in or backwards compatible, except the behaviour changes listed at the end.
69
+
70
+ #### Row identity and data refresh
71
+ - `primaryKey` (field, dot path or function) identifies rows. Duplicate and missing keys are reported once through `(gridError)` (source `'data'`).
72
+ - `setData()`, `refreshData()` (re-read the same array after `push`/`splice`), and `dataRefresh` options for what a refresh keeps (filter, sort, selection, scroll).
73
+ - New outputs: `(dataRefresh)` and `(loadingChange)`.
74
+ - Lookups by key: `getRowKey()`, `getRowByKey()`, `getRowIndexByKey()`, `scrollToRowByKey()`.
75
+ - Every API method is also available on the component instance (for `@ViewChild`).
76
+ - Fix: after changing the array in place, `refresh()` now also updates the row count and the empty state.
77
+
78
+ #### Row selection
79
+ - `selection.mode`: `'single'` or `'multiple'`.
80
+ - Selecting by click (Ctrl/Cmd toggles, Shift selects a range), a pinned checkbox column with select-all (indeterminate state), or the keyboard (Space, Shift+arrows, Ctrl/Cmd+A).
81
+ - `rowSelectable`, `selectAllScope`, and `onFilter` (rows hidden by a filter are deselected by default).
82
+ - API: `selectRowByKey`, `deselectRowByKey`, `selectRowsByKeys`, `deselectRowsByKeys`, `toggleRowSelection`, `selectAll`, `deselectAll`, `clearSelection`, `getSelectedRows`, `getSelectedKeys`, `isRowSelected`.
83
+ - Events: `(selectionChange)` (added/removed rows, old/new row in single mode, previous/current selection), `(rowSelected)`, `(rowDeselected)`, `(selectionCleared)`, and the cancelable `(selectionClick)`.
84
+
85
+ #### Add, update and delete
86
+ - API: `addRow()`, `beginAddRow()` (the inline add row), `updateRow()`, `deleteRow()`, `deleteRows()`, `requestDeleteRows()` and `deleteSelectedRows()` (both with confirmation). Each returns a `GridCrudResult`.
87
+ - Validation:
88
+ - column `required`, `defaultValue` and `editableOnAdd`;
89
+ - `editing.newRow` (initializer) and `editing.rowValidator`;
90
+ - unique, present primary keys. Keys can't be changed.
91
+ - UI:
92
+ - `editing.actionColumn`, pinned at the right: ✎ 🗑 per row, ✓ ✕ while editing, + in the header.
93
+ - The Delete key (`allowDelete`).
94
+ - A delete confirmation dialog, or your own `angGridDeleteConfirm` template.
95
+ - Events: the cancelable `(rowAdding)`, `(rowUpdating)` and `(rowDeleting)`; then `(rowAdded)`, `(rowUpdated)` (with an `oldRow` snapshot) and `(rowDeleted)`.
96
+ - `(dataChange)`: adds and deletes never change your array; they emit a new one (`[(data)]` works).
97
+
98
+ #### Batch editing
99
+ - `editing.batch`: changes are kept as pending changes.
100
+ - New, modified and deleted rows are marked; deleted rows stay visible with a restore button.
101
+ - Undo and redo, also with Ctrl/Cmd+Z and Ctrl/Cmd+Shift+Z or Ctrl+Y.
102
+ - A built-in toolbar with the change count, Undo, Redo, Discard and Save.
103
+ - API: `saveChanges(handler?)` (Promise or Observable handler, or `editing.saveHandler`; a failed save keeps everything pending), `cancelChanges()`, `getPendingChanges()`, `hasPendingChanges()`, `undo()`, `redo()`, `canUndo()`, `canRedo()`.
104
+ - Events: `(changesSaved)`, `(changesCancelled)`, `(changesSaveFailed)`, `(pendingChange)`.
105
+
106
+ #### Tooltips
107
+ - `tooltips`: cut-off text by default, or always, or never; show and hide delays; placement with flipping near the window edges; `disabledTypes`.
108
+ - Column options: `tooltip` (on/off, mode, or a function), `description` (always shown in the header tooltip), `headerTooltip`, and tooltip templates (`angGridCellTooltip`, `angGridHeaderTooltip`, or per column).
109
+ - Keyboard focus shows tooltips too. They are accessible (`role="tooltip"`, `aria-describedby`).
110
+ - There is one element per grid, removed with the grid.
111
+
112
+ #### Filtering
113
+ - The popup:
114
+ - offers "Clear filter" and "Clear all filters";
115
+ - takes up to 5 conditions (`maxConditions`) with add and remove buttons and one AND/OR choice.
116
+ - Filter row (`filtering.mode: 'row' | 'both'`):
117
+ - a debounced input per column (`rowDebounce`), with an operator menu and a clear button;
118
+ - a select for booleans;
119
+ - Tab moves in column order.
120
+ - Filtered headers get an accent line, and their filter button reads "(filtered)".
121
+ - API: `clearAllFilters()`, `isFiltered()`, `getDisplayedRowCount()`.
122
+
123
+ #### Events and columns
124
+ - `(rowDoubleClick)`, `(headerClick)`, `(cellContextMenu)` (`events.preventContextMenu`), `(cellMouseEnter)` and `(cellMouseLeave)`. The mouse events are matched once per frame and never fire while scrolling.
125
+ - Click events carry `key`, `dataIndex` and `formattedValue`, and a `cancel` flag that stops the grid's own reaction.
126
+ - `events.clickMode: 'waitForDoubleClick'`.
127
+ - `(columnResize)` adds `column`, `oldWidth`, `newWidth` and `source` (`'user' | 'api' | 'reset'`). New: `resetColumnWidth()`.
128
+
129
+ #### Behaviour changes
130
+ 1. The second click of a double click no longer emits `cellClick`/`rowClick`.
131
+ 2. Cut-off cells and headers show a tooltip by default (`tooltips.enabled: false` turns it off). The native `title` of headers and summary cells is replaced by it.
132
+ 3. In the filter popup, more conditions are added with "+ Add condition", with no empty second row any more. "Clear" became "Clear filter", in the popup header.
133
+ 4. With a `primaryKey`, the key column isn't editable.
134
+ 5. Inline edits emit `(rowUpdating)` and `(rowUpdated)`; `required` and `editing.rowValidator` apply to them.
135
+ 6. In row edit mode, a checkbox editor no longer saves the row when ticked.
136
+ 7. Summaries of computed columns update when the fields they use are edited.
137
+ 8. The sort-order badge only takes space in multi-column sorts, so header labels have more room.
138
+
139
+ ### 1.0.0
140
+
141
+ First release: row and column virtualization, Excel-style filtering, multi-sort, editing (cell, row and grid modes), summaries, templates, loading/empty/error states, theming and the grid API.