@rttui/skin-anocca 1.0.16 → 1.0.17
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/dist/cjs/HeaderPinButtons.cjs +109 -0
- package/dist/cjs/HeaderPinButtons.cjs.map +10 -0
- package/dist/cjs/RowPinButtons.cjs +75 -0
- package/dist/cjs/RowPinButtons.cjs.map +10 -0
- package/dist/cjs/index.cjs +383 -0
- package/dist/cjs/index.cjs.map +10 -0
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/stories/ReactTanstackTableUiStory.stories.cjs +234 -0
- package/dist/cjs/stories/ReactTanstackTableUiStory.stories.cjs.map +10 -0
- package/dist/cjs/stories/ReactTanstackTableUiStoryComponent.cjs +147 -0
- package/dist/cjs/stories/ReactTanstackTableUiStoryComponent.cjs.map +10 -0
- package/dist/cjs/stories/createSourceCode.cjs +92 -0
- package/dist/cjs/stories/createSourceCode.cjs.map +10 -0
- package/dist/mjs/HeaderPinButtons.mjs +79 -0
- package/dist/mjs/HeaderPinButtons.mjs.map +10 -0
- package/dist/mjs/RowPinButtons.mjs +45 -0
- package/dist/mjs/RowPinButtons.mjs.map +10 -0
- package/dist/mjs/index.mjs +352 -0
- package/dist/mjs/index.mjs.map +10 -0
- package/dist/mjs/package.json +5 -0
- package/dist/mjs/stories/ReactTanstackTableUiStory.stories.mjs +204 -0
- package/dist/mjs/stories/ReactTanstackTableUiStory.stories.mjs.map +10 -0
- package/dist/mjs/stories/ReactTanstackTableUiStoryComponent.mjs +110 -0
- package/dist/mjs/stories/ReactTanstackTableUiStoryComponent.mjs.map +10 -0
- package/{src/stories/createSourceCode.ts → dist/mjs/stories/createSourceCode.mjs} +13 -4
- package/dist/mjs/stories/createSourceCode.mjs.map +10 -0
- package/dist/types/HeaderPinButtons.d.ts +1 -0
- package/dist/types/RowPinButtons.d.ts +4 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stories/ReactTanstackTableUiStory.stories.d.ts +72 -0
- package/dist/types/stories/ReactTanstackTableUiStoryComponent.d.ts +15 -0
- package/dist/types/stories/createSourceCode.d.ts +5 -0
- package/package.json +5 -2
- package/.storybook/main.ts +0 -18
- package/.storybook/preview.ts +0 -14
- package/CHANGELOG.md +0 -126
- package/index.html +0 -13
- package/src/HeaderPinButtons.tsx +0 -81
- package/src/RowPinButtons.tsx +0 -40
- package/src/index.tsx +0 -460
- package/src/stories/ReactTanstackTableUiStory.mdx +0 -147
- package/src/stories/ReactTanstackTableUiStory.stories.tsx +0 -207
- package/src/stories/ReactTanstackTableUiStoryComponent.tsx +0 -113
- package/src/stories/ScrollbarWidthSpecified.mdx +0 -42
- package/tsconfig.json +0 -34
- package/tsconfig.types.json +0 -9
- package/vite.config.ts +0 -23
@@ -0,0 +1,110 @@
|
|
1
|
+
// packages/skin-anocca/src/stories/ReactTanstackTableUiStoryComponent.tsx
|
2
|
+
import { Box, ScopedCssBaseline, ThemeProvider, Typography } from "@mui/material";
|
3
|
+
import { useTheme } from "@mui/material/styles";
|
4
|
+
import {
|
5
|
+
decorateColumnHelper,
|
6
|
+
ReactTanstackTableUi as TableComponent
|
7
|
+
} from "@rttui/core";
|
8
|
+
import {
|
9
|
+
createColumnHelper,
|
10
|
+
useReactTable
|
11
|
+
} from "@tanstack/react-table";
|
12
|
+
import { HeaderPinButtons } from "../HeaderPinButtons.mjs";
|
13
|
+
import React from "react";
|
14
|
+
import { RowPinButtons } from "../RowPinButtons.mjs";
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
16
|
+
var smallData = [
|
17
|
+
{ id: "1", name: "John", age: 20, city: "New York" },
|
18
|
+
{ id: "2", name: "Jane", age: 21, city: "Los Angeles" },
|
19
|
+
{ id: "3", name: "Jim", age: 22, city: "Chicago" }
|
20
|
+
];
|
21
|
+
var bigData = Array.from({ length: 1000 }, (_, i) => ({
|
22
|
+
id: i.toString(),
|
23
|
+
name: `Person ${i}`,
|
24
|
+
age: 20 + i,
|
25
|
+
city: `City ${i}`,
|
26
|
+
...Object.fromEntries(Array.from({ length: 100 }, (_2, j) => [`col${j}`, `Value ${i}-${j}`]))
|
27
|
+
}));
|
28
|
+
var ReactTanstackTableUi = (props) => {
|
29
|
+
const theme = useTheme();
|
30
|
+
const data = props.data === "big" ? bigData : smallData;
|
31
|
+
const columns = React.useMemo(() => {
|
32
|
+
const columnHelper = decorateColumnHelper(createColumnHelper(), {
|
33
|
+
header: (original) => /* @__PURE__ */ jsxs(Box, {
|
34
|
+
sx: { display: "flex", gap: 2 },
|
35
|
+
children: [
|
36
|
+
original,
|
37
|
+
props.enableColumnPinning && /* @__PURE__ */ jsx(HeaderPinButtons, {})
|
38
|
+
]
|
39
|
+
})
|
40
|
+
});
|
41
|
+
const fewColumns = [
|
42
|
+
columnHelper.accessor("name", {
|
43
|
+
header: "Name",
|
44
|
+
cell: (info) => /* @__PURE__ */ jsxs(Box, {
|
45
|
+
sx: { display: "flex", gap: 2, flex: 1 },
|
46
|
+
children: [
|
47
|
+
/* @__PURE__ */ jsx(Typography, {
|
48
|
+
variant: "body2",
|
49
|
+
children: info.getValue()
|
50
|
+
}),
|
51
|
+
props.enableRowPinning && /* @__PURE__ */ jsx(Box, {
|
52
|
+
sx: { flexGrow: 1 }
|
53
|
+
}),
|
54
|
+
props.enableRowPinning && /* @__PURE__ */ jsx(RowPinButtons, {
|
55
|
+
row: info.row
|
56
|
+
})
|
57
|
+
]
|
58
|
+
}),
|
59
|
+
meta: props.meta?.["name"]
|
60
|
+
}),
|
61
|
+
columnHelper.accessor("age", {
|
62
|
+
header: "Age",
|
63
|
+
meta: props.meta?.["age"],
|
64
|
+
cell: (info) => /* @__PURE__ */ jsx(Typography, {
|
65
|
+
variant: "body2",
|
66
|
+
children: info.getValue()
|
67
|
+
}),
|
68
|
+
size: 50
|
69
|
+
}),
|
70
|
+
columnHelper.accessor("city", {
|
71
|
+
header: "City",
|
72
|
+
meta: props.meta?.["city"],
|
73
|
+
cell: (info) => /* @__PURE__ */ jsx(Typography, {
|
74
|
+
variant: "body2",
|
75
|
+
children: info.getValue()
|
76
|
+
})
|
77
|
+
})
|
78
|
+
];
|
79
|
+
const manyColumns = [
|
80
|
+
...fewColumns,
|
81
|
+
...Array.from({ length: 100 }, (_, i) => columnHelper.accessor(`col${i}`, {
|
82
|
+
header: `Column ${i}`,
|
83
|
+
cell: (info) => /* @__PURE__ */ jsx(Typography, {
|
84
|
+
variant: "body2",
|
85
|
+
children: info.getValue()
|
86
|
+
})
|
87
|
+
}))
|
88
|
+
];
|
89
|
+
return props.columns === "few" ? fewColumns : manyColumns;
|
90
|
+
}, [props.columns, props.enableColumnPinning, props.enableRowPinning, props.meta]);
|
91
|
+
const table = useReactTable({
|
92
|
+
...props,
|
93
|
+
data,
|
94
|
+
columns
|
95
|
+
});
|
96
|
+
return /* @__PURE__ */ jsx(ScopedCssBaseline, {
|
97
|
+
children: /* @__PURE__ */ jsx(ThemeProvider, {
|
98
|
+
theme,
|
99
|
+
children: /* @__PURE__ */ jsx(TableComponent, {
|
100
|
+
...props,
|
101
|
+
table
|
102
|
+
})
|
103
|
+
})
|
104
|
+
});
|
105
|
+
};
|
106
|
+
export {
|
107
|
+
ReactTanstackTableUi
|
108
|
+
};
|
109
|
+
|
110
|
+
//# debugId=6CD65E7FABB356E264756E2164756E21
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/stories/ReactTanstackTableUiStoryComponent.tsx"],
|
4
|
+
"sourcesContent": [
|
5
|
+
"import { Box, ScopedCssBaseline, ThemeProvider, Typography } from \"@mui/material\";\nimport { useTheme } from \"@mui/material/styles\";\nimport {\n decorateColumnHelper,\n ReactTanstackTableUi as TableComponent,\n} from \"@rttui/core\";\nimport {\n ColumnDef,\n ColumnMeta,\n createColumnHelper,\n Table,\n TableOptions,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { HeaderPinButtons } from \"../HeaderPinButtons.mjs\";\nimport React from \"react\";\nimport { RowPinButtons } from \"../RowPinButtons.mjs\";\ntype Person = {\n id: string;\n name: string;\n age: number;\n city: string;\n} & Record<`col${number}`, string>;\n\nconst smallData: Person[] = [\n { id: \"1\", name: \"John\", age: 20, city: \"New York\" },\n { id: \"2\", name: \"Jane\", age: 21, city: \"Los Angeles\" },\n { id: \"3\", name: \"Jim\", age: 22, city: \"Chicago\" },\n];\n\nconst bigData: Person[] = Array.from({ length: 1000 }, (_, i) => ({\n id: i.toString(),\n name: `Person ${i}`,\n age: 20 + i,\n city: `City ${i}`,\n ...Object.fromEntries(\n Array.from({ length: 100 }, (_, j) => [`col${j}`, `Value ${i}-${j}`]),\n ),\n}));\n\nexport const ReactTanstackTableUi = (\n props: {\n data: \"big\" | \"small\";\n columns: \"many\" | \"few\";\n meta?: Record<string, ColumnMeta<Person, string>>;\n } & Omit<TableOptions<Person>, \"data\" | \"columns\"> &\n Omit<React.ComponentProps<typeof TableComponent>, \"table\">,\n) => {\n const theme = useTheme();\n const data: Person[] = props.data === \"big\" ? bigData : smallData;\n\n const columns: ColumnDef<Person>[] = React.useMemo(() => {\n const columnHelper = decorateColumnHelper(createColumnHelper<Person>(), {\n header: (original) => (\n <Box sx={{ display: \"flex\", gap: 2 }}>\n {original}\n {props.enableColumnPinning && <HeaderPinButtons />}\n </Box>\n ),\n });\n\n const fewColumns = [\n columnHelper.accessor(\"name\", {\n header: \"Name\",\n cell: (info) => (\n <Box sx={{ display: \"flex\", gap: 2, flex: 1 }}>\n <Typography variant=\"body2\">{info.getValue()}</Typography>\n {props.enableRowPinning && <Box sx={{ flexGrow: 1 }} />}\n {props.enableRowPinning && <RowPinButtons row={info.row} />}\n </Box>\n ),\n meta: props.meta?.[\"name\"],\n }),\n columnHelper.accessor(\"age\", {\n header: \"Age\",\n meta: props.meta?.[\"age\"],\n cell: (info) => <Typography variant=\"body2\">{info.getValue()}</Typography>,\n size: 50,\n }),\n columnHelper.accessor(\"city\", {\n header: \"City\",\n meta: props.meta?.[\"city\"],\n cell: (info) => <Typography variant=\"body2\">{info.getValue()}</Typography>,\n }),\n ];\n\n const manyColumns = [\n ...fewColumns,\n ...Array.from({ length: 100 }, (_, i) =>\n columnHelper.accessor(`col${i}`, {\n header: `Column ${i}`,\n cell: (info) => <Typography variant=\"body2\">{info.getValue()}</Typography>,\n }),\n ),\n ];\n\n return props.columns === \"few\" ? fewColumns : manyColumns;\n }, [props.columns, props.enableColumnPinning, props.enableRowPinning, props.meta]);\n\n const table = useReactTable({\n ...props,\n data,\n columns,\n });\n\n return (\n <ScopedCssBaseline>\n <ThemeProvider theme={theme}>\n <TableComponent {...props} table={table as Table<unknown>} />\n </ThemeProvider>\n </ScopedCssBaseline>\n );\n};\n"
|
6
|
+
],
|
7
|
+
"mappings": ";AAAA;AACA;AACA;AAAA;AAAA,0BAEE;AAAA;AAEF;AAAA;AAAA;AAAA;AAQA;AACA;AACA;AAAA;AAQA,IAAM,YAAsB;AAAA,EAC1B,EAAE,IAAI,KAAK,MAAM,QAAQ,KAAK,IAAI,MAAM,WAAW;AAAA,EACnD,EAAE,IAAI,KAAK,MAAM,QAAQ,KAAK,IAAI,MAAM,cAAc;AAAA,EACtD,EAAE,IAAI,KAAK,MAAM,OAAO,KAAK,IAAI,MAAM,UAAU;AACnD;AAEA,IAAM,UAAoB,MAAM,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC,GAAG,OAAO;AAAA,EAChE,IAAI,EAAE,SAAS;AAAA,EACf,MAAM,UAAU;AAAA,EAChB,KAAK,KAAK;AAAA,EACV,MAAM,QAAQ;AAAA,KACX,OAAO,YACR,MAAM,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,IAAG,MAAM,CAAC,MAAM,KAAK,SAAS,KAAK,GAAG,CAAC,CACtE;AACF,EAAE;AAEK,IAAM,uBAAuB,CAClC,UAMG;AAAA,EACH,MAAM,QAAQ,SAAS;AAAA,EACvB,MAAM,OAAiB,MAAM,SAAS,QAAQ,UAAU;AAAA,EAExD,MAAM,UAA+B,MAAM,QAAQ,MAAM;AAAA,IACvD,MAAM,eAAe,qBAAqB,mBAA2B,GAAG;AAAA,MACtE,QAAQ,CAAC,6BACP,KAGE,KAHF;AAAA,QAAK,IAAI,EAAE,SAAS,QAAQ,KAAK,EAAE;AAAA,QAAnC,UAGE;AAAA,UAFC;AAAA,UACA,MAAM,uCAAuB,IAAC,kBAAD,EAAkB;AAAA;AAAA,OAChD;AAAA,IAEN,CAAC;AAAA,IAED,MAAM,aAAa;AAAA,MACjB,aAAa,SAAS,QAAQ;AAAA,QAC5B,QAAQ;AAAA,QACR,MAAM,CAAC,yBACL,KAIE,KAJF;AAAA,UAAK,IAAI,EAAE,SAAS,QAAQ,KAAK,GAAG,MAAM,EAAE;AAAA,UAA5C,UAIE;AAAA,4BAHA,IAA+C,YAA/C;AAAA,cAAY,SAAQ;AAAA,cAApB,UAA6B,KAAK,SAAS;AAAA,aAAI;AAAA,YAC9C,MAAM,oCAAoB,IAAC,KAAD;AAAA,cAAK,IAAI,EAAE,UAAU,EAAE;AAAA,aAAG;AAAA,YACpD,MAAM,oCAAoB,IAAC,eAAD;AAAA,cAAe,KAAK,KAAK;AAAA,aAAK;AAAA;AAAA,SACzD;AAAA,QAEJ,MAAM,MAAM,OAAO;AAAA,MACrB,CAAC;AAAA,MACD,aAAa,SAAS,OAAO;AAAA,QAC3B,QAAQ;AAAA,QACR,MAAM,MAAM,OAAO;AAAA,QACnB,MAAM,CAAC,yBAAS,IAA+C,YAA/C;AAAA,UAAY,SAAQ;AAAA,UAApB,UAA6B,KAAK,SAAS;AAAA,SAAI;AAAA,QAC/D,MAAM;AAAA,MACR,CAAC;AAAA,MACD,aAAa,SAAS,QAAQ;AAAA,QAC5B,QAAQ;AAAA,QACR,MAAM,MAAM,OAAO;AAAA,QACnB,MAAM,CAAC,yBAAS,IAA+C,YAA/C;AAAA,UAAY,SAAQ;AAAA,UAApB,UAA6B,KAAK,SAAS;AAAA,SAAI;AAAA,MACjE,CAAC;AAAA,IACH;AAAA,IAEA,MAAM,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,GAAG,MAAM,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,GAAG,MACjC,aAAa,SAAS,MAAM,KAAK;AAAA,QAC/B,QAAQ,UAAU;AAAA,QAClB,MAAM,CAAC,yBAAS,IAA+C,YAA/C;AAAA,UAAY,SAAQ;AAAA,UAApB,UAA6B,KAAK,SAAS;AAAA,SAAI;AAAA,MACjE,CAAC,CACH;AAAA,IACF;AAAA,IAEA,OAAO,MAAM,YAAY,QAAQ,aAAa;AAAA,KAC7C,CAAC,MAAM,SAAS,MAAM,qBAAqB,MAAM,kBAAkB,MAAM,IAAI,CAAC;AAAA,EAEjF,MAAM,QAAQ,cAAc;AAAA,OACvB;AAAA,IACH;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EAED,uBACE,IAIE,mBAJF;AAAA,8BACE,IAEE,eAFF;AAAA,MAAe;AAAA,MAAf,0BACE,IAAC,gBAAD;AAAA,WAAoB;AAAA,QAAO;AAAA,OAAgC;AAAA,KAC3D;AAAA,GACF;AAAA;",
|
8
|
+
"debugId": "6CD65E7FABB356E264756E2164756E21",
|
9
|
+
"names": []
|
10
|
+
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
// packages/skin-anocca/src/stories/createSourceCode.ts
|
2
|
+
var createSourceCode = (opts) => {
|
2
3
|
return `import { createColumnHelper, useReactTable, getCoreRowModel } from "@tanstack/react-table";
|
3
4
|
import { Box } from "@mui/material";
|
4
5
|
import { HeaderPinButtons } from "@rttui/skin-anocca";
|
@@ -28,7 +29,8 @@ const columnHelper = decorateColumnHelper(createColumnHelper<Person>(), {
|
|
28
29
|
|
29
30
|
const columns = [
|
30
31
|
columnHelper.accessor("name", {
|
31
|
-
header: "Name",${opts?.nameMeta ?
|
32
|
+
header: "Name",${opts?.nameMeta ? `
|
33
|
+
` + opts.nameMeta : ""}
|
32
34
|
}),
|
33
35
|
columnHelper.accessor("age", {
|
34
36
|
header: "Age",
|
@@ -42,12 +44,19 @@ const columns = [
|
|
42
44
|
const table = useReactTable({
|
43
45
|
data,
|
44
46
|
columns,
|
45
|
-
getCoreRowModel: getCoreRowModel()${opts?.hookOptions ?
|
47
|
+
getCoreRowModel: getCoreRowModel()${opts?.hookOptions ? `
|
48
|
+
` + opts.hookOptions : ""}
|
46
49
|
});
|
47
50
|
|
48
51
|
<ReactTanstackTableUi
|
49
52
|
table={table}
|
50
|
-
enableColumnPinning${opts?.props ?
|
53
|
+
enableColumnPinning${opts?.props ? `
|
54
|
+
` + opts.props : ""}
|
51
55
|
/>
|
52
56
|
`;
|
53
57
|
};
|
58
|
+
export {
|
59
|
+
createSourceCode
|
60
|
+
};
|
61
|
+
|
62
|
+
//# debugId=C53576C0D339686564756E2164756E21
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/stories/createSourceCode.ts"],
|
4
|
+
"sourcesContent": [
|
5
|
+
"export const createSourceCode = (opts?: { hookOptions?: string, props?: string, nameMeta?: string }) => {\n return `import { createColumnHelper, useReactTable, getCoreRowModel } from \"@tanstack/react-table\";\nimport { Box } from \"@mui/material\";\nimport { HeaderPinButtons } from \"@rttui/skin-anocca\";\nimport { ReactTanstackTableUi, decorateColumnHelper } from \"@rttui/core\";\n\ntype Person = {\n id: string;\n name: string;\n age: number;\n city: string;\n};\n\nconst data: Person[] = [\n { id: \"1\", name: \"John\", age: 20, city: \"New York\" },\n { id: \"2\", name: \"Jane\", age: 21, city: \"Los Angeles\" },\n { id: \"3\", name: \"Jim\", age: 22, city: \"Chicago\" },\n];\n\nconst columnHelper = decorateColumnHelper(createColumnHelper<Person>(), {\n header: (original) => (\n <Box sx={{ display: \"flex\", gap: 2 }}>\n {original}\n {props.enableColumnPinning && <HeaderPinButtons />}\n </Box>\n ),\n});\n\nconst columns = [\n columnHelper.accessor(\"name\", {\n header: \"Name\",${opts?.nameMeta ? '\\n' + opts.nameMeta : ''}\n }),\n columnHelper.accessor(\"age\", {\n header: \"Age\",\n size: 50,\n }),\n columnHelper.accessor(\"city\", {\n header: \"City\",\n }),\n];\n\nconst table = useReactTable({\n data,\n columns,\n getCoreRowModel: getCoreRowModel()${opts?.hookOptions ? '\\n' + opts.hookOptions : ''}\n});\n\n<ReactTanstackTableUi\n table={table}\n enableColumnPinning${opts?.props ? '\\n' + opts.props : ''}\n/>\n`;\n};\n"
|
6
|
+
],
|
7
|
+
"mappings": ";AAAO,IAAM,mBAAmB,CAAC,SAAuE;AAAA,EACtG,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBA6BY,MAAM,WAAW;AAAA,IAAO,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAcvB,MAAM,cAAc;AAAA,IAAO,KAAK,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,uBAK7D,MAAM,QAAQ;AAAA,IAAO,KAAK,QAAQ;AAAA;AAAA;AAAA;",
|
8
|
+
"debugId": "C53576C0D339686564756E2164756E21",
|
9
|
+
"names": []
|
10
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const HeaderPinButtons: () => import("react/jsx-runtime").JSX.Element | null;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
2
|
+
declare const meta: {
|
3
|
+
title: string;
|
4
|
+
component: (props: {
|
5
|
+
data: "big" | "small";
|
6
|
+
columns: "many" | "few";
|
7
|
+
meta?: Record<string, import("@tanstack/react-table").ColumnMeta<{
|
8
|
+
id: string;
|
9
|
+
name: string;
|
10
|
+
age: number;
|
11
|
+
city: string;
|
12
|
+
} & Record<`col${number}`, string>, string>>;
|
13
|
+
} & Omit<import("@tanstack/react-table").TableOptions<{
|
14
|
+
id: string;
|
15
|
+
name: string;
|
16
|
+
age: number;
|
17
|
+
city: string;
|
18
|
+
} & Record<`col${number}`, string>>, "data" | "columns"> & Omit<React.ComponentProps<typeof import("@rttui/core").ReactTanstackTableUi>, "table">) => import("react/jsx-runtime").JSX.Element;
|
19
|
+
parameters: {
|
20
|
+
layout: string;
|
21
|
+
};
|
22
|
+
argTypes: {
|
23
|
+
data: {
|
24
|
+
control: "select";
|
25
|
+
};
|
26
|
+
columns: {
|
27
|
+
control: "select";
|
28
|
+
};
|
29
|
+
pinColsRelativeTo: {
|
30
|
+
control: "select";
|
31
|
+
options: string[];
|
32
|
+
};
|
33
|
+
skin: {
|
34
|
+
control: "object";
|
35
|
+
table: {
|
36
|
+
disable: true;
|
37
|
+
};
|
38
|
+
};
|
39
|
+
};
|
40
|
+
args: {
|
41
|
+
width: number;
|
42
|
+
height: number;
|
43
|
+
skin: import("@rttui/core").Skin;
|
44
|
+
autoCrushColumns: false;
|
45
|
+
data: "big";
|
46
|
+
columns: "few";
|
47
|
+
getCoreRowModel: (table: import("@tanstack/react-table").Table<any>) => () => import("@tanstack/react-table").RowModel<any>;
|
48
|
+
pinColsRelativeTo: "cols";
|
49
|
+
fillAvailableSpaceAfterCrush: false;
|
50
|
+
scrollbarWidth: number;
|
51
|
+
getRowId: (row: {
|
52
|
+
id: string;
|
53
|
+
name: string;
|
54
|
+
age: number;
|
55
|
+
city: string;
|
56
|
+
} & Record<`col${number}`, string>) => string;
|
57
|
+
};
|
58
|
+
};
|
59
|
+
export default meta;
|
60
|
+
type Story = StoryObj<typeof meta>;
|
61
|
+
export declare const Basic: Story;
|
62
|
+
export declare const AutoCrushColumns: Story;
|
63
|
+
export declare const AutoCrushColumnsExceptName: Story;
|
64
|
+
export declare const PinRelativeToCols: Story;
|
65
|
+
export declare const PinRelativeToTable: Story;
|
66
|
+
export declare const FillAvailableSpaceAfterCrush: Story;
|
67
|
+
export declare const FillAvailableSpaceAfterCrushExceptName: Story;
|
68
|
+
export declare const FillAvailableSpaceAfterCrushWithoutSpecifiedScrollbarWidth: Story;
|
69
|
+
export declare const CanPinRowsRelativeToRows: Story;
|
70
|
+
export declare const CanPinRowsRelativeToTable: Story;
|
71
|
+
export declare const SizeByLargestHeader: Story;
|
72
|
+
export declare const SizeByLargestHeaderWithMeta: Story;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { ReactTanstackTableUi as TableComponent } from "@rttui/core";
|
2
|
+
import { ColumnMeta, TableOptions } from "@tanstack/react-table";
|
3
|
+
import React from "react";
|
4
|
+
type Person = {
|
5
|
+
id: string;
|
6
|
+
name: string;
|
7
|
+
age: number;
|
8
|
+
city: string;
|
9
|
+
} & Record<`col${number}`, string>;
|
10
|
+
export declare const ReactTanstackTableUi: (props: {
|
11
|
+
data: "big" | "small";
|
12
|
+
columns: "many" | "few";
|
13
|
+
meta?: Record<string, ColumnMeta<Person, string>>;
|
14
|
+
} & Omit<TableOptions<Person>, "data" | "columns"> & Omit<React.ComponentProps<typeof TableComponent>, "table">) => import("react/jsx-runtime").JSX.Element;
|
15
|
+
export {};
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rttui/skin-anocca",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.17",
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
5
5
|
"dependencies": {
|
6
|
-
"@rttui/core": "^1.0.
|
6
|
+
"@rttui/core": "^1.0.16"
|
7
7
|
},
|
8
8
|
"module": "./dist/mjs/index.mjs",
|
9
9
|
"types": "./dist/types/index.d.ts",
|
@@ -17,6 +17,9 @@
|
|
17
17
|
"publishConfig": {
|
18
18
|
"access": "public"
|
19
19
|
},
|
20
|
+
"files": [
|
21
|
+
"dist"
|
22
|
+
],
|
20
23
|
"scripts": {
|
21
24
|
"dev": "vite",
|
22
25
|
"build": "tsc -b && vite build",
|
package/.storybook/main.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import type { StorybookConfig } from '@storybook/react-vite';
|
2
|
-
|
3
|
-
const config: StorybookConfig = {
|
4
|
-
"stories": [
|
5
|
-
"../src/**/*.mdx",
|
6
|
-
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
7
|
-
],
|
8
|
-
"addons": [
|
9
|
-
"@storybook/addon-essentials",
|
10
|
-
"@storybook/addon-onboarding",
|
11
|
-
"@storybook/addon-interactions"
|
12
|
-
],
|
13
|
-
"framework": {
|
14
|
-
"name": "@storybook/react-vite",
|
15
|
-
"options": {}
|
16
|
-
}
|
17
|
-
};
|
18
|
-
export default config;
|
package/.storybook/preview.ts
DELETED
package/CHANGELOG.md
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
# @rttui/skin-anocca
|
2
|
-
|
3
|
-
## 1.0.16
|
4
|
-
|
5
|
-
### Patch Changes
|
6
|
-
|
7
|
-
- fix invalid build
|
8
|
-
|
9
|
-
## 1.0.15
|
10
|
-
|
11
|
-
### Patch Changes
|
12
|
-
|
13
|
-
- Improve column sizing API
|
14
|
-
- Updated dependencies
|
15
|
-
- @rttui/core@1.0.15
|
16
|
-
|
17
|
-
## 1.0.14
|
18
|
-
|
19
|
-
### Patch Changes
|
20
|
-
|
21
|
-
- Add a storybook
|
22
|
-
- Updated dependencies
|
23
|
-
- @rttui/core@1.0.14
|
24
|
-
|
25
|
-
## 1.0.13
|
26
|
-
|
27
|
-
### Patch Changes
|
28
|
-
|
29
|
-
- Updated dependencies
|
30
|
-
- @rttui/core@1.0.13
|
31
|
-
|
32
|
-
## 1.0.12
|
33
|
-
|
34
|
-
### Patch Changes
|
35
|
-
|
36
|
-
- Updated dependencies
|
37
|
-
- @rttui/core@1.0.12
|
38
|
-
|
39
|
-
## 1.0.11
|
40
|
-
|
41
|
-
### Patch Changes
|
42
|
-
|
43
|
-
- Better styling and auto measure columns
|
44
|
-
- Updated dependencies
|
45
|
-
- @rttui/core@1.0.11
|
46
|
-
|
47
|
-
## 1.0.10
|
48
|
-
|
49
|
-
### Patch Changes
|
50
|
-
|
51
|
-
- Updated dependencies
|
52
|
-
- @rttui/core@1.0.10
|
53
|
-
|
54
|
-
## 1.0.9
|
55
|
-
|
56
|
-
### Patch Changes
|
57
|
-
|
58
|
-
- Updated dependencies
|
59
|
-
- @rttui/core@1.0.9
|
60
|
-
|
61
|
-
## 1.0.8
|
62
|
-
|
63
|
-
### Patch Changes
|
64
|
-
|
65
|
-
- Updated dependencies
|
66
|
-
- @rttui/core@1.0.8
|
67
|
-
|
68
|
-
## 1.0.7
|
69
|
-
|
70
|
-
### Patch Changes
|
71
|
-
|
72
|
-
- Updated dependencies
|
73
|
-
- @rttui/core@1.0.7
|
74
|
-
|
75
|
-
## 1.0.6
|
76
|
-
|
77
|
-
### Patch Changes
|
78
|
-
|
79
|
-
- Updated dependencies
|
80
|
-
- @rttui/core@1.0.6
|
81
|
-
|
82
|
-
## 1.0.5
|
83
|
-
|
84
|
-
### Patch Changes
|
85
|
-
|
86
|
-
- Fix build
|
87
|
-
- Updated dependencies
|
88
|
-
- @rttui/core@1.0.5
|
89
|
-
|
90
|
-
## 1.0.4
|
91
|
-
|
92
|
-
### Patch Changes
|
93
|
-
|
94
|
-
- new build method
|
95
|
-
- Updated dependencies
|
96
|
-
- @rttui/core@1.0.4
|
97
|
-
|
98
|
-
## 1.0.3
|
99
|
-
|
100
|
-
### Patch Changes
|
101
|
-
|
102
|
-
- 51c73d3: build with bun build instead
|
103
|
-
- Updated dependencies [51c73d3]
|
104
|
-
- @rttui/core@1.0.3
|
105
|
-
|
106
|
-
## 1.0.2
|
107
|
-
|
108
|
-
### Patch Changes
|
109
|
-
|
110
|
-
- fix lib build
|
111
|
-
- Updated dependencies
|
112
|
-
- @rttui/core@1.0.2
|
113
|
-
|
114
|
-
## 1.0.1
|
115
|
-
|
116
|
-
### Patch Changes
|
117
|
-
|
118
|
-
- Fix dependencies
|
119
|
-
- Updated dependencies
|
120
|
-
- @rttui/core@1.0.1
|
121
|
-
|
122
|
-
## 1.0.0
|
123
|
-
|
124
|
-
### Major Changes
|
125
|
-
|
126
|
-
- First release
|
package/index.html
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8" />
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
-
<title>Vite + React + TS</title>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<div id="root"></div>
|
11
|
-
<script type="module" src="/src/main.tsx"></script>
|
12
|
-
</body>
|
13
|
-
</html>
|
package/src/HeaderPinButtons.tsx
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
import { useVirtualHeader } from "@rttui/core";
|
2
|
-
import { MdChevronLeft, MdChevronRight, MdClose } from "react-icons/md";
|
3
|
-
|
4
|
-
export const HeaderPinButtons = () => {
|
5
|
-
const vHeader = useVirtualHeader();
|
6
|
-
const header = vHeader.header;
|
7
|
-
if (!header) {
|
8
|
-
return null;
|
9
|
-
}
|
10
|
-
const isPinned = vHeader.isPinned;
|
11
|
-
return (
|
12
|
-
<div style={{ display: "flex", gap: "-4px", justifyContent: "flex-start" }}>
|
13
|
-
{isPinned !== "start" ? (
|
14
|
-
<button
|
15
|
-
style={{
|
16
|
-
border: "none",
|
17
|
-
background: "transparent",
|
18
|
-
cursor: "pointer",
|
19
|
-
padding: "2px",
|
20
|
-
borderRadius: "4px",
|
21
|
-
display: "flex",
|
22
|
-
alignItems: "center",
|
23
|
-
opacity: 0.5,
|
24
|
-
}}
|
25
|
-
onClick={() => {
|
26
|
-
if (!header) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
header.column.pin("left");
|
30
|
-
}}
|
31
|
-
>
|
32
|
-
<MdChevronLeft />
|
33
|
-
</button>
|
34
|
-
) : null}
|
35
|
-
{isPinned ? (
|
36
|
-
<button
|
37
|
-
style={{
|
38
|
-
border: "none",
|
39
|
-
background: "transparent",
|
40
|
-
cursor: "pointer",
|
41
|
-
padding: "2px",
|
42
|
-
borderRadius: "4px",
|
43
|
-
display: "flex",
|
44
|
-
alignItems: "center",
|
45
|
-
opacity: 0.7,
|
46
|
-
}}
|
47
|
-
onClick={() => {
|
48
|
-
if (!header) {
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
header.column.pin(false);
|
52
|
-
}}
|
53
|
-
>
|
54
|
-
<MdClose />
|
55
|
-
</button>
|
56
|
-
) : null}
|
57
|
-
{isPinned !== "end" ? (
|
58
|
-
<button
|
59
|
-
style={{
|
60
|
-
border: "none",
|
61
|
-
background: "transparent",
|
62
|
-
cursor: "pointer",
|
63
|
-
padding: "2px",
|
64
|
-
borderRadius: "4px",
|
65
|
-
display: "flex",
|
66
|
-
alignItems: "center",
|
67
|
-
opacity: 0.5,
|
68
|
-
}}
|
69
|
-
onClick={() => {
|
70
|
-
if (!header) {
|
71
|
-
return;
|
72
|
-
}
|
73
|
-
header.column.pin("right");
|
74
|
-
}}
|
75
|
-
>
|
76
|
-
<MdChevronRight />
|
77
|
-
</button>
|
78
|
-
) : null}
|
79
|
-
</div>
|
80
|
-
);
|
81
|
-
};
|
package/src/RowPinButtons.tsx
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { Row } from "@tanstack/react-table";
|
2
|
-
import { IconButton, Stack } from "@mui/material";
|
3
|
-
import { FiX, FiChevronUp, FiChevronDown } from "react-icons/fi";
|
4
|
-
|
5
|
-
export function RowPinButtons({ row }: { row: Row<any> }) {
|
6
|
-
if (!row.getCanPin()) {
|
7
|
-
return null;
|
8
|
-
}
|
9
|
-
|
10
|
-
if (row.getIsPinned()) {
|
11
|
-
return (
|
12
|
-
<IconButton
|
13
|
-
onClick={() => row.pin(false, true, true)}
|
14
|
-
size="small"
|
15
|
-
sx={{ color: "text.secondary" }}
|
16
|
-
>
|
17
|
-
<FiX size={16} />
|
18
|
-
</IconButton>
|
19
|
-
);
|
20
|
-
}
|
21
|
-
|
22
|
-
return (
|
23
|
-
<Stack direction="row">
|
24
|
-
<IconButton
|
25
|
-
onClick={() => row.pin("top", true, true)}
|
26
|
-
size="small"
|
27
|
-
sx={{ color: "text.secondary" }}
|
28
|
-
>
|
29
|
-
<FiChevronUp size={16} />
|
30
|
-
</IconButton>
|
31
|
-
<IconButton
|
32
|
-
onClick={() => row.pin("bottom", true, true)}
|
33
|
-
size="small"
|
34
|
-
sx={{ color: "text.secondary" }}
|
35
|
-
>
|
36
|
-
<FiChevronDown size={16} />
|
37
|
-
</IconButton>
|
38
|
-
</Stack>
|
39
|
-
);
|
40
|
-
}
|