twico-ui 1.27.0 → 1.28.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 +7 -0
- package/dist/index.cjs +35 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +35 -17
- package/dist/index.mjs.map +1 -1
- package/llms.txt +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Twico UI are documented here (newest first). This file is generated automatically on each release by [semantic-release](https://semantic-release.gitbook.io/) from [Conventional Commits](https://www.conventionalcommits.org/) — do not edit it by hand. The same notes appear on each [GitHub Release](https://github.com/EncryptionL/twico-ui/releases).
|
|
4
4
|
|
|
5
|
+
# [1.28.0](https://github.com/EncryptionL/twico-ui/compare/v1.27.0...v1.28.0) (2026-08-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **datatable:** selection-aware batch actions (predicate disabled/hidden) + onRowSelectionChange ([#322](https://github.com/EncryptionL/twico-ui/issues/322)) ([33a1c36](https://github.com/EncryptionL/twico-ui/commit/33a1c36340e36cf0c9cc763cda7ed5d26fd46baa))
|
|
11
|
+
|
|
5
12
|
# [1.27.0](https://github.com/EncryptionL/twico-ui/compare/v1.26.0...v1.27.0) (2026-08-03)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.cjs
CHANGED
|
@@ -9158,6 +9158,7 @@ function Datatable({
|
|
|
9158
9158
|
onServerChange,
|
|
9159
9159
|
onColumnVisibilityChange,
|
|
9160
9160
|
batchActions = [],
|
|
9161
|
+
onRowSelectionChange,
|
|
9161
9162
|
showExport = false,
|
|
9162
9163
|
showDensity = false,
|
|
9163
9164
|
showPivot = false,
|
|
@@ -10410,6 +10411,18 @@ function Datatable({
|
|
|
10410
10411
|
setFocus((f) => ({ r: Math.min(f.r, Math.max(0, leafRows.length - 1)), c: Math.min(f.c, Math.max(0, ordered.length - 1)) }));
|
|
10411
10412
|
}, [leafRows.length, ordered.length, pageVal]);
|
|
10412
10413
|
const selectedRows = React51__namespace.default.useMemo(() => rows.filter((r2, i) => selected.has(keyOf(r2, i))), [rows, selected]);
|
|
10414
|
+
const selKeys = React51__namespace.default.useMemo(() => [...selected], [selected]);
|
|
10415
|
+
const onRowSelRef = React51__namespace.default.useRef(onRowSelectionChange);
|
|
10416
|
+
onRowSelRef.current = onRowSelectionChange;
|
|
10417
|
+
const prevRowSelSigRef = React51__namespace.default.useRef("");
|
|
10418
|
+
React51__namespace.default.useEffect(() => {
|
|
10419
|
+
const cb = onRowSelRef.current;
|
|
10420
|
+
if (!cb) return;
|
|
10421
|
+
const sig = selKeys.join(",");
|
|
10422
|
+
if (sig === prevRowSelSigRef.current) return;
|
|
10423
|
+
prevRowSelSigRef.current = sig;
|
|
10424
|
+
cb(selKeys, selectedRows);
|
|
10425
|
+
}, [selKeys, selectedRows]);
|
|
10413
10426
|
function clearSelection() {
|
|
10414
10427
|
setSelected(/* @__PURE__ */ new Set());
|
|
10415
10428
|
}
|
|
@@ -10506,11 +10519,11 @@ function Datatable({
|
|
|
10506
10519
|
}
|
|
10507
10520
|
patch[c.field] = v;
|
|
10508
10521
|
});
|
|
10509
|
-
const
|
|
10522
|
+
const selKeys2 = new Set(selected);
|
|
10510
10523
|
const changedRows = [];
|
|
10511
10524
|
const nextAll = rows.map((r2, i) => {
|
|
10512
10525
|
const k = keyOf(r2, i);
|
|
10513
|
-
if (!
|
|
10526
|
+
if (!selKeys2.has(k)) return r2;
|
|
10514
10527
|
const updated = { ...r2, ...patch };
|
|
10515
10528
|
changedRows.push(updated);
|
|
10516
10529
|
return updated;
|
|
@@ -11400,21 +11413,26 @@ function Datatable({
|
|
|
11400
11413
|
/* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.pencil }),
|
|
11401
11414
|
"Edit"
|
|
11402
11415
|
] }) : null,
|
|
11403
|
-
batchActions.map((a, i) =>
|
|
11404
|
-
"
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
"
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
a.
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11416
|
+
batchActions.map((a, i) => {
|
|
11417
|
+
const isHidden = typeof a.hidden === "function" ? a.hidden(selKeys, selectedRows) : !!a.hidden;
|
|
11418
|
+
if (isHidden) return null;
|
|
11419
|
+
const isDisabled = typeof a.disabled === "function" ? a.disabled(selKeys, selectedRows) : !!a.disabled;
|
|
11420
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11421
|
+
"button",
|
|
11422
|
+
{
|
|
11423
|
+
type: "button",
|
|
11424
|
+
className: "twc-dt__batch-btn",
|
|
11425
|
+
"data-danger": a.danger || void 0,
|
|
11426
|
+
disabled: isDisabled,
|
|
11427
|
+
onClick: (e) => a.onClick?.(selKeys, selectedRows, clearSelection, { anchorEl: e.currentTarget }),
|
|
11428
|
+
children: [
|
|
11429
|
+
a.icon,
|
|
11430
|
+
a.label
|
|
11431
|
+
]
|
|
11432
|
+
},
|
|
11433
|
+
i
|
|
11434
|
+
);
|
|
11435
|
+
})
|
|
11418
11436
|
] })
|
|
11419
11437
|
] }) : null,
|
|
11420
11438
|
isDiff && diff.showSummary !== false ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__diff-summary", "aria-label": "Diff summary", children: [
|