twico-ui 1.20.1 → 1.20.2
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 +33 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +33 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
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.20.2](https://github.com/EncryptionL/twico-ui/compare/v1.20.1...v1.20.2) (2026-07-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **datatable:** restore persisted column order with new columns at their code position ([c1095eb](https://github.com/EncryptionL/twico-ui/commit/c1095eb238239914491ea004a3c297d33c98d69b)), closes [#259](https://github.com/EncryptionL/twico-ui/issues/259) [#284](https://github.com/EncryptionL/twico-ui/issues/284)
|
|
11
|
+
|
|
5
12
|
## [1.20.1](https://github.com/EncryptionL/twico-ui/compare/v1.20.0...v1.20.1) (2026-07-23)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.cjs
CHANGED
|
@@ -8647,6 +8647,37 @@ var filterTypeOf = (col) => {
|
|
|
8647
8647
|
if (ft === "number" || ft === "string") return ft;
|
|
8648
8648
|
return col && col.type === "number" ? "number" : "string";
|
|
8649
8649
|
};
|
|
8650
|
+
function mergeColOrder(saved, propFields) {
|
|
8651
|
+
const known = new Set(propFields);
|
|
8652
|
+
const result = saved.filter((f) => known.has(f));
|
|
8653
|
+
const placed = new Set(result);
|
|
8654
|
+
for (let i = 0; i < propFields.length; i++) {
|
|
8655
|
+
const f = propFields[i];
|
|
8656
|
+
if (!f || placed.has(f)) continue;
|
|
8657
|
+
let at = 0;
|
|
8658
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
8659
|
+
const idx = result.indexOf(propFields[j]);
|
|
8660
|
+
if (idx !== -1) {
|
|
8661
|
+
at = idx + 1;
|
|
8662
|
+
break;
|
|
8663
|
+
}
|
|
8664
|
+
}
|
|
8665
|
+
if (at === 0) {
|
|
8666
|
+
let before = result.length;
|
|
8667
|
+
for (let j = i + 1; j < propFields.length; j++) {
|
|
8668
|
+
const idx = result.indexOf(propFields[j]);
|
|
8669
|
+
if (idx !== -1) {
|
|
8670
|
+
before = idx;
|
|
8671
|
+
break;
|
|
8672
|
+
}
|
|
8673
|
+
}
|
|
8674
|
+
at = before;
|
|
8675
|
+
}
|
|
8676
|
+
result.splice(at, 0, f);
|
|
8677
|
+
placed.add(f);
|
|
8678
|
+
}
|
|
8679
|
+
return result;
|
|
8680
|
+
}
|
|
8650
8681
|
var getColVal = (col, row) => col && col.valueGetter ? col.valueGetter(row) : row == null ? void 0 : row[col && col.field];
|
|
8651
8682
|
var diffValueNode = (col, v, row) => col.renderCell ? col.renderCell(v, row) : col.valueFormatter ? col.valueFormatter(v, row) : v == null ? "" : v;
|
|
8652
8683
|
function renderDiffCell(col, val, row) {
|
|
@@ -9222,9 +9253,7 @@ function Datatable({
|
|
|
9222
9253
|
if (typeof s.page === "number" && !pageControlled) setInternalPage(Math.max(0, Math.floor(s.page)));
|
|
9223
9254
|
if (typeof s.pageSize === "number" && !pageSizeControlled) setInternalRpp(s.pageSize > 0 ? s.pageSize : 10);
|
|
9224
9255
|
if (Array.isArray(s.columnOrder)) {
|
|
9225
|
-
|
|
9226
|
-
const missing = cols.map((c) => c.field).filter((f) => f && !savedOrder.includes(f));
|
|
9227
|
-
setOrder([...savedOrder, ...missing]);
|
|
9256
|
+
setOrder(mergeColOrder(s.columnOrder, cols.map((c) => c.field).filter(Boolean)));
|
|
9228
9257
|
}
|
|
9229
9258
|
if (s.columnWidths && typeof s.columnWidths === "object") setWidths(Object.fromEntries(Object.entries(s.columnWidths).filter(([f, w]) => known.has(f) && typeof w === "number")));
|
|
9230
9259
|
if (s.columnVisibility && typeof s.columnVisibility === "object") setHidden(new Set(Object.keys(s.columnVisibility).filter((f) => known.has(f) && s.columnVisibility[f] === false)));
|
|
@@ -9336,12 +9365,7 @@ function Datatable({
|
|
|
9336
9365
|
}));
|
|
9337
9366
|
const pivotActive = pivotOn && pivotConfig.rows.length > 0 && pivotConfig.values.length > 0;
|
|
9338
9367
|
React51__namespace.default.useEffect(() => {
|
|
9339
|
-
setOrder((prev) =>
|
|
9340
|
-
const fields = columns.map((c) => c.field);
|
|
9341
|
-
const kept = prev.filter((f) => fields.includes(f));
|
|
9342
|
-
const added = fields.filter((f) => !kept.includes(f));
|
|
9343
|
-
return [...kept, ...added];
|
|
9344
|
-
});
|
|
9368
|
+
setOrder((prev) => mergeColOrder(prev, columns.map((c) => c.field).filter(Boolean)));
|
|
9345
9369
|
}, [columns]);
|
|
9346
9370
|
const densitySyncedRef = React51__namespace.default.useRef(false);
|
|
9347
9371
|
React51__namespace.default.useEffect(() => {
|