@iyulab/flex-table 0.56.1 → 0.57.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 +12 -0
- package/README.md +2 -2
- package/dist/{flex-table-DKBcfNA4.js → flex-table-B1W8VEBa.js} +5 -2
- package/dist/flex-table.d.ts +7 -9
- package/dist/flex-table.js +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/skills/iyulab-flex-table/references/api.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.57.0] - 2026-10-07
|
|
4
|
+
|
|
5
|
+
### Changed (breaking)
|
|
6
|
+
|
|
7
|
+
- **`getSelectedRows()` returns the selected rows** (`DataRow[]` — the rows `data` holds, in `data` order), the same
|
|
8
|
+
shape as `u-rich-table`'s `getSelectedRows()`. It returned `{ selectedIds, selectedIndices, selectedRows }`, so code
|
|
9
|
+
written for one table read `undefined` from the other (`getSelectedRows().length`). Every selected id, on every page,
|
|
10
|
+
is `selectedRowIds`; positions in `data` come with `selection-change` (`selectedIndices`), whose detail is unchanged.
|
|
11
|
+
|
|
12
|
+
**Migrating**: `getSelectedRows().selectedRows` → `getSelectedRows()` · `.selectedIds` → `[...selectedRowIds]` ·
|
|
13
|
+
`.selectedIndices` → the `selection-change` detail, or `getSelectedRows().map((r) => table.data.indexOf(r))`.
|
|
14
|
+
|
|
3
15
|
## [0.56.1] - 2026-10-07
|
|
4
16
|
|
|
5
17
|
### Fixed
|
package/README.md
CHANGED
|
@@ -258,7 +258,7 @@ Every row keeps its own value. Sorting, filtering, copying, CSV/XLSX export and
|
|
|
258
258
|
| `deselectAll()` | `void` | Deselect every row, on every page |
|
|
259
259
|
| `selectWhere(predicate)` | `void` | Add the rows in view for which `predicate(row, dataIndex)` is true |
|
|
260
260
|
| `setSelection(ids)` | `void` | Replace the selection with these row ids. The same set again does nothing and fires nothing |
|
|
261
|
-
| `getSelectedRows()` | `
|
|
261
|
+
| `getSelectedRows()` | `DataRow[]` | The selected rows `data` holds, in `data` order — the same shape as `u-rich-table`'s. Every selected id (all pages) is `selectedRowIds`; positions come with `selection-change` (`selectedIndices`) |
|
|
262
262
|
| `getRowId(row)` | `string` | The id selection keeps for a row |
|
|
263
263
|
| `selectedRowIds` (getter) | `ReadonlySet<string>` | Ids of the selected rows, all pages (a copy) |
|
|
264
264
|
|
|
@@ -268,7 +268,7 @@ Row selection is kept by **row id**, not by position, so a checkmark stays on it
|
|
|
268
268
|
table.rowKey = 'orderNo'; // or: table.rowKey = (row) => `${row.site}/${row.no}`
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
A keyed row stays selected when `data` is replaced, so in a server-paged grid the selection spans pages (`
|
|
271
|
+
A keyed row stays selected when `data` is replaced, so in a server-paged grid the selection spans pages (`selectedRowIds` names them all; `getSelectedRows()` holds the ones on this page). A row without a key is named by the row object itself (a session-local id `#n`): it follows the row while the same object is in `data` and leaves the selection when it is gone. Set `clear-selection-on-data-change` when every new `data` should start a new selection (a new search):
|
|
272
272
|
|
|
273
273
|
```html
|
|
274
274
|
<flex-table selectable clear-selection-on-data-change></flex-table>
|
|
@@ -1844,6 +1844,9 @@ var K = {
|
|
|
1844
1844
|
return this._filteredIndices.length;
|
|
1845
1845
|
}
|
|
1846
1846
|
getSelectedRows() {
|
|
1847
|
+
return this._selectionSnapshot().selectedRows;
|
|
1848
|
+
}
|
|
1849
|
+
_selectionSnapshot() {
|
|
1847
1850
|
let e = [];
|
|
1848
1851
|
if (this._rowSelection.selectedCount > 0) for (let t = 0; t < this.data.length; t++) this._rowSelection.isSelected(this.getRowId(this.data[t])) && e.push(t);
|
|
1849
1852
|
return {
|
|
@@ -1880,7 +1883,7 @@ var K = {
|
|
|
1880
1883
|
}
|
|
1881
1884
|
}
|
|
1882
1885
|
_dispatchRowSelectionEvent() {
|
|
1883
|
-
this._emit("selection-change", this.
|
|
1886
|
+
this._emit("selection-change", this._selectionSnapshot());
|
|
1884
1887
|
}
|
|
1885
1888
|
_visibleRowIds() {
|
|
1886
1889
|
let e = this._visibleIdsCache;
|
|
@@ -2081,7 +2084,7 @@ var K = {
|
|
|
2081
2084
|
}), this._dispatchUndoStateEvent(), n;
|
|
2082
2085
|
}
|
|
2083
2086
|
deleteRows(e) {
|
|
2084
|
-
let t = e ?? (this.selectable ? this.
|
|
2087
|
+
let t = e ?? (this.selectable ? this._selectionSnapshot().selectedIndices : this._getSelectedDataRows());
|
|
2085
2088
|
if (t.length === 0) return;
|
|
2086
2089
|
let n = [...t].sort((e, t) => t - e), r = [];
|
|
2087
2090
|
for (let e of n) e >= 0 && e < this.data.length && (r.push({
|
package/dist/flex-table.d.ts
CHANGED
|
@@ -192,15 +192,13 @@ export declare class FlexTable extends LitElement {
|
|
|
192
192
|
/** Number of rows after filtering (before pagination). */
|
|
193
193
|
get filteredRowCount(): number;
|
|
194
194
|
/**
|
|
195
|
-
* The
|
|
196
|
-
* `
|
|
197
|
-
* `
|
|
198
|
-
*/
|
|
199
|
-
getSelectedRows():
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
selectedRows: DataRow[];
|
|
203
|
-
};
|
|
195
|
+
* The selected rows that `data` holds, in `data` order (filtered-out rows included) — the same shape
|
|
196
|
+
* as `u-rich-table`'s. Every selected id, on every page, is `selectedRowIds`; positions in `data` come
|
|
197
|
+
* with `selection-change` (`selectedIndices`).
|
|
198
|
+
*/
|
|
199
|
+
getSelectedRows(): DataRow[];
|
|
200
|
+
/** The selection as `selection-change` reports it. */
|
|
201
|
+
private _selectionSnapshot;
|
|
204
202
|
/** The id row selection keeps for `row` — its `rowKey` value as a string, or `#n` for a row without one. */
|
|
205
203
|
getRowId(row: DataRow): string;
|
|
206
204
|
/** Ids of the selected rows — every page, including rows not in `data` now. A copy. */
|
package/dist/flex-table.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "./flex-table-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./flex-table-B1W8VEBa.js";
|
|
2
2
|
import { t as o } from "./locale-Cfm-vJji.js";
|
|
3
3
|
export { a as FlexTable, e as RowSelectionState, t as UndoStack, n as effectiveAlign, i as exportData, o as flexTableLocale, r as renderCell };
|
package/dist/react.js
CHANGED
package/package.json
CHANGED
|
@@ -119,7 +119,7 @@ Enter/Escape and blur-to-commit behavior.
|
|
|
119
119
|
| `selectAll()` / `deselectAll()` | `selectAll`: the rows in view (multi mode only) · `deselectAll`: every page |
|
|
120
120
|
| `selectWhere(predicate)` | `(row, dataIndex) => boolean` over the visible rows |
|
|
121
121
|
| `setSelection(ids)` | Replace with these row ids; the same set again fires nothing |
|
|
122
|
-
| `getSelectedRows()` | `
|
|
122
|
+
| `getSelectedRows()` | `DataRow[]` — the selected rows `data` holds (as `u-rich-table`) · ids of every page: `selectedRowIds` |
|
|
123
123
|
| `getRowId(row)` · `selectedRowIds` | A row's id · the selected ids (all pages) |
|
|
124
124
|
|
|
125
125
|
### Filtering, undo, comments, import/export
|