mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Use inline sort/filter getters instead of mapping columns
Replace the satisfies-ColumnsType + .map(applyColumn) approach with inline tableState.sortOrder()/filteredValue() getters set per column, so the column arrays stay plain literals (no satisfies, no constraints; UsersTable stays any[]). Move useColumnSearch into util/ next to useTableQueryState. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4e94092730
commit
8cacdc5112
12 files changed
+86
-67
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { Table } from "antd";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
|
||||
import {
|
||||
BaseWebPlugin, PageLayout, PageHeader, Control, ControlContext, notifyErrorHandler,
|
||||
@@ -87,12 +86,14 @@ function StoragePage() {
|
||||
<PageHeader title="Storage" />
|
||||
<Table
|
||||
className="subspace-storage-storage"
|
||||
columns={([
|
||||
columns={[
|
||||
{
|
||||
title: "Resource",
|
||||
key: "resource",
|
||||
...resourceSearch,
|
||||
onFilter: matchesResource,
|
||||
filteredValue: tableState.filteredValue("resource"),
|
||||
sortOrder: tableState.sortOrder("resource"),
|
||||
sorter: (a, b) => {
|
||||
let aName = getLocaleName(a[1].name);
|
||||
let bName = getLocaleName(b[1].name);
|
||||
@@ -121,9 +122,10 @@ function StoragePage() {
|
||||
key: "quantity",
|
||||
align: "right",
|
||||
sorter: (a, b) => a[1].count - b[1].count,
|
||||
sortOrder: tableState.sortOrder("quantity"),
|
||||
render: (_, item) => numberFormat.format(item[1].count),
|
||||
},
|
||||
] satisfies ColumnsType<[string, Item]>).map(tableState.applyColumn)}
|
||||
]}
|
||||
dataSource={storage}
|
||||
rowKey={item => item[0]}
|
||||
pagination={tableState.pagination}
|
||||
|
||||
Reference in new issue
Block a user