@rttui/skin-anocca 1.0.21 → 1.0.23
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/README.md +1 -54
- package/dist/cjs/AnoccaSkin.cjs +377 -0
- package/dist/cjs/AnoccaSkin.cjs.map +10 -0
- package/dist/cjs/HeaderPinButtons.cjs +2 -2
- package/dist/cjs/HeaderPinButtons.cjs.map +3 -3
- package/dist/cjs/TableHeaderRow.cjs +45 -0
- package/dist/cjs/TableHeaderRow.cjs.map +10 -0
- package/dist/cjs/index.cjs +10 -350
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/AnoccaSkin.mjs +346 -0
- package/dist/mjs/AnoccaSkin.mjs.map +10 -0
- package/dist/mjs/HeaderPinButtons.mjs +2 -2
- package/dist/mjs/HeaderPinButtons.mjs.map +3 -3
- package/dist/mjs/TableHeaderRow.mjs +15 -0
- package/dist/mjs/TableHeaderRow.mjs.map +10 -0
- package/dist/mjs/index.mjs +9 -348
- package/dist/mjs/index.mjs.map +4 -4
- package/dist/mjs/package.json +1 -1
- package/dist/types/AnoccaSkin.d.ts +3 -0
- package/dist/types/TableHeaderRow.d.ts +3 -0
- package/dist/types/index.d.ts +4 -3
- package/package.json +3 -11
- package/dist/cjs/stories/ReactTanstackTableUiStory.stories.cjs +0 -309
- package/dist/cjs/stories/ReactTanstackTableUiStory.stories.cjs.map +0 -10
- package/dist/cjs/stories/ReactTanstackTableUiStoryComponent.cjs +0 -186
- package/dist/cjs/stories/ReactTanstackTableUiStoryComponent.cjs.map +0 -10
- package/dist/cjs/stories/createSourceCode.cjs +0 -92
- package/dist/cjs/stories/createSourceCode.cjs.map +0 -10
- package/dist/mjs/stories/ReactTanstackTableUiStory.stories.mjs +0 -279
- package/dist/mjs/stories/ReactTanstackTableUiStory.stories.mjs.map +0 -10
- package/dist/mjs/stories/ReactTanstackTableUiStoryComponent.mjs +0 -155
- package/dist/mjs/stories/ReactTanstackTableUiStoryComponent.mjs.map +0 -10
- package/dist/mjs/stories/createSourceCode.mjs +0 -62
- package/dist/mjs/stories/createSourceCode.mjs.map +0 -10
- package/dist/types/stories/ReactTanstackTableUiStory.stories.d.ts +0 -81
- package/dist/types/stories/ReactTanstackTableUiStoryComponent.d.ts +0 -17
- package/dist/types/stories/createSourceCode.d.ts +0 -5
package/dist/mjs/index.mjs
CHANGED
@@ -1,352 +1,13 @@
|
|
1
|
-
// packages/skin-anocca/src/index.
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
TableCell,
|
7
|
-
TableFooter,
|
8
|
-
TableHead,
|
9
|
-
TableRow,
|
10
|
-
useTheme
|
11
|
-
} from "@mui/material";
|
12
|
-
import {
|
13
|
-
useTableContext,
|
14
|
-
useTableCssVars
|
15
|
-
} from "@rttui/core";
|
16
|
-
import React from "react";
|
17
|
-
import { flexRender } from "@tanstack/react-table";
|
18
|
-
import { jsx } from "react/jsx-runtime";
|
19
|
-
var AnoccaSkin = {
|
20
|
-
rowHeight: 32,
|
21
|
-
headerRowHeight: 32,
|
22
|
-
footerRowHeight: 32,
|
23
|
-
OverlayContainer: ({ children }) => {
|
24
|
-
const { width, height } = useTableContext();
|
25
|
-
const cssVars = useTableCssVars();
|
26
|
-
return /* @__PURE__ */ jsx("div", {
|
27
|
-
className: "rttui-overlay-container",
|
28
|
-
style: {
|
29
|
-
position: "relative",
|
30
|
-
width: width + "px",
|
31
|
-
height: height + "px",
|
32
|
-
...cssVars
|
33
|
-
},
|
34
|
-
children
|
35
|
-
});
|
36
|
-
},
|
37
|
-
OuterContainer: ({ children }) => {
|
38
|
-
const { tableContainerRef } = useTableContext();
|
39
|
-
return /* @__PURE__ */ jsx(Paper, {
|
40
|
-
ref: tableContainerRef,
|
41
|
-
className: "outer-container",
|
42
|
-
elevation: 2,
|
43
|
-
sx: {
|
44
|
-
overflow: "auto",
|
45
|
-
width: "var(--table-container-width)",
|
46
|
-
height: "var(--table-container-height)",
|
47
|
-
position: "relative",
|
48
|
-
contain: "paint",
|
49
|
-
willChange: "transform",
|
50
|
-
borderRadius: 1
|
51
|
-
},
|
52
|
-
children
|
53
|
-
});
|
54
|
-
},
|
55
|
-
TableScroller: () => {
|
56
|
-
return /* @__PURE__ */ jsx("div", {
|
57
|
-
className: "table-scroller",
|
58
|
-
style: {
|
59
|
-
width: "var(--table-width)",
|
60
|
-
height: "calc(var(--table-height) + var(--header-height) + var(--footer-height))",
|
61
|
-
position: "absolute"
|
62
|
-
}
|
63
|
-
});
|
64
|
-
},
|
65
|
-
TableHeader: ({ children }) => {
|
66
|
-
return /* @__PURE__ */ jsx(TableHead, {
|
67
|
-
component: "div",
|
68
|
-
className: "thead",
|
69
|
-
sx: {
|
70
|
-
position: "sticky",
|
71
|
-
top: 0,
|
72
|
-
width: "var(--table-width)",
|
73
|
-
zIndex: 2,
|
74
|
-
backgroundColor: (theme) => theme.palette.background.paper,
|
75
|
-
boxShadow: (theme) => `0 1px 0 ${theme.palette.divider}`,
|
76
|
-
display: "flex",
|
77
|
-
flexDirection: "column",
|
78
|
-
justifyContent: "flex-start",
|
79
|
-
alignItems: "stretch"
|
80
|
-
},
|
81
|
-
children
|
82
|
-
});
|
83
|
-
},
|
84
|
-
TableFooter: ({ children }) => {
|
85
|
-
return /* @__PURE__ */ jsx(TableFooter, {
|
86
|
-
component: "div",
|
87
|
-
className: "table-footer",
|
88
|
-
sx: {
|
89
|
-
position: "sticky",
|
90
|
-
bottom: -1,
|
91
|
-
width: "var(--table-width)",
|
92
|
-
zIndex: 2,
|
93
|
-
backgroundColor: (theme) => theme.palette.background.paper,
|
94
|
-
boxShadow: (theme) => `0 -1px 0 ${theme.palette.divider}`
|
95
|
-
},
|
96
|
-
children
|
97
|
-
});
|
98
|
-
},
|
99
|
-
HeaderRow: TableHeaderRow,
|
100
|
-
HeaderCell: React.forwardRef((props, ref) => {
|
101
|
-
return /* @__PURE__ */ jsx(TableHeaderCell, {
|
102
|
-
...props,
|
103
|
-
ref
|
104
|
-
});
|
105
|
-
}),
|
106
|
-
TableBody: ({ children }) => {
|
107
|
-
return /* @__PURE__ */ jsx(TableBody, {
|
108
|
-
component: "div",
|
109
|
-
className: "table-body",
|
110
|
-
sx: {
|
111
|
-
position: "relative",
|
112
|
-
width: "var(--table-width)",
|
113
|
-
height: "var(--table-height)",
|
114
|
-
display: "flex",
|
115
|
-
flexDirection: "column",
|
116
|
-
justifyContent: "flex-start",
|
117
|
-
alignItems: "stretch"
|
118
|
-
},
|
119
|
-
children
|
120
|
-
});
|
121
|
-
},
|
122
|
-
PinnedRows: ({ children, position, pinned }) => {
|
123
|
-
if (pinned.length === 0) {
|
124
|
-
return null;
|
125
|
-
}
|
126
|
-
const style = {
|
127
|
-
position: "sticky",
|
128
|
-
zIndex: 3
|
129
|
-
};
|
130
|
-
if (position === "top") {
|
131
|
-
style.top = "var(--header-height)";
|
132
|
-
style.borderBottom = (theme) => `1px solid ${theme.palette.divider}`;
|
133
|
-
style.boxShadow = "0 4px 8px -4px rgba(0, 0, 0, 0.15), 0 6px 12px -6px rgba(0, 0, 0, 0.1)";
|
134
|
-
} else if (position === "bottom") {
|
135
|
-
style.bottom = "var(--footer-height)";
|
136
|
-
style.borderTop = (theme) => `1px solid ${theme.palette.divider}`;
|
137
|
-
style.boxShadow = "0 -4px 8px -4px rgba(0, 0, 0, 0.15), 0 -6px 12px -6px rgba(0, 0, 0, 0.1)";
|
138
|
-
}
|
139
|
-
const Component = position === "top" ? TableHead : TableFooter;
|
140
|
-
return /* @__PURE__ */ jsx(Component, {
|
141
|
-
component: "div",
|
142
|
-
className: `sticky-${position}-rows`,
|
143
|
-
sx: style,
|
144
|
-
children
|
145
|
-
});
|
146
|
-
},
|
147
|
-
PinnedCols: ({ children, position, pinned }) => {
|
148
|
-
if (pinned.length === 0) {
|
149
|
-
return null;
|
150
|
-
}
|
151
|
-
const style = {
|
152
|
-
position: "sticky",
|
153
|
-
zIndex: 3,
|
154
|
-
display: "flex"
|
155
|
-
};
|
156
|
-
if (position === "left") {
|
157
|
-
style.left = 0;
|
158
|
-
} else if (position === "right") {
|
159
|
-
style.right = 0;
|
160
|
-
}
|
161
|
-
return /* @__PURE__ */ jsx(Box, {
|
162
|
-
component: "div",
|
163
|
-
className: `sticky-${position}-cols`,
|
164
|
-
sx: style,
|
165
|
-
children
|
166
|
-
});
|
167
|
-
},
|
168
|
-
TableRowWrapper: React.forwardRef(({ children, flatIndex, dndStyle }, ref) => {
|
169
|
-
const theme = useTheme();
|
170
|
-
const backgroundColor = (theme2) => {
|
171
|
-
const baseColor = flatIndex % 2 === 0 ? theme2.palette.background.paper : theme2.palette.mode === "dark" ? theme2.palette.grey[900] : theme2.palette.grey[100];
|
172
|
-
return baseColor;
|
173
|
-
};
|
174
|
-
const vars = {
|
175
|
-
"--row-background-color": backgroundColor(theme)
|
176
|
-
};
|
177
|
-
return /* @__PURE__ */ jsx(Box, {
|
178
|
-
sx: {
|
179
|
-
...dndStyle,
|
180
|
-
...vars,
|
181
|
-
width: "var(--table-width)",
|
182
|
-
display: "flex",
|
183
|
-
flexDirection: "column",
|
184
|
-
justifyContent: "flex-start",
|
185
|
-
alignItems: "stretch"
|
186
|
-
},
|
187
|
-
"data-index": flatIndex,
|
188
|
-
ref,
|
189
|
-
children
|
190
|
-
});
|
191
|
-
}),
|
192
|
-
TableRow: ({ children }) => {
|
193
|
-
return /* @__PURE__ */ jsx(TableRow, {
|
194
|
-
component: "div",
|
195
|
-
className: "table-row",
|
196
|
-
sx: {
|
197
|
-
position: "relative",
|
198
|
-
width: "var(--table-width)",
|
199
|
-
display: "flex",
|
200
|
-
height: "var(--row-height)",
|
201
|
-
zIndex: 1,
|
202
|
-
boxSizing: "border-box",
|
203
|
-
backgroundColor: "var(--row-background-color)",
|
204
|
-
"&:hover": {
|
205
|
-
backgroundColor: (theme) => {
|
206
|
-
return theme.palette.mode === "dark" ? "#1e1e52" : "#E3F2FD";
|
207
|
-
}
|
208
|
-
}
|
209
|
-
},
|
210
|
-
children
|
211
|
-
});
|
212
|
-
},
|
213
|
-
TableRowExpandedContent: ({ children }) => {
|
214
|
-
const { table } = useTableContext();
|
215
|
-
return /* @__PURE__ */ jsx(TableRow, {
|
216
|
-
component: "div",
|
217
|
-
className: "expanded-row",
|
218
|
-
sx: {
|
219
|
-
backgroundColor: (theme) => theme.palette.background.default
|
220
|
-
},
|
221
|
-
children: /* @__PURE__ */ jsx(TableCell, {
|
222
|
-
component: "div",
|
223
|
-
className: "expanded-cell",
|
224
|
-
colSpan: table.getAllLeafColumns().length,
|
225
|
-
sx: {
|
226
|
-
padding: 2
|
227
|
-
},
|
228
|
-
children
|
229
|
-
})
|
230
|
-
});
|
231
|
-
},
|
232
|
-
Cell: React.forwardRef(({ children, header, isMeasuring, isLastPinned, isLast, isLastCenter }, ref) => {
|
233
|
-
const { isPinned } = header;
|
234
|
-
const { table } = useTableContext();
|
235
|
-
return /* @__PURE__ */ jsx(TableCell, {
|
236
|
-
className: "td",
|
237
|
-
component: "div",
|
238
|
-
ref,
|
239
|
-
sx: {
|
240
|
-
height: "var(--row-height)",
|
241
|
-
width: isMeasuring ? "auto" : header.width,
|
242
|
-
overflow: "hidden",
|
243
|
-
textOverflow: "ellipsis",
|
244
|
-
whiteSpace: "nowrap",
|
245
|
-
zIndex: isPinned ? 5 : 0,
|
246
|
-
boxSizing: "border-box",
|
247
|
-
fontSize: "0.875rem",
|
248
|
-
color: "text.primary",
|
249
|
-
alignItems: "center",
|
250
|
-
gap: "8px",
|
251
|
-
display: "flex",
|
252
|
-
justifyContent: "flex-start",
|
253
|
-
alignContent: "center",
|
254
|
-
padding: "6px 12px",
|
255
|
-
backgroundColor: "var(--row-background-color)",
|
256
|
-
borderBottom: "none",
|
257
|
-
flexShrink: 0,
|
258
|
-
position: "relative",
|
259
|
-
borderRight: (isPinned === "start" && !isLastPinned || !isPinned) && !isLast && !(isLastCenter && table.getIsSomeColumnsPinned("right")) ? (theme) => `1px solid ${theme.palette.divider}` : undefined,
|
260
|
-
borderLeft: isPinned === "end" && !isLastPinned ? (theme) => `1px solid ${theme.palette.divider}` : undefined,
|
261
|
-
".table-row:hover &": {
|
262
|
-
backgroundColor: (theme) => {
|
263
|
-
return theme.palette.mode === "dark" ? "#1e1e52" : "#E3F2FD";
|
264
|
-
},
|
265
|
-
zIndex: isPinned ? 2 : 0
|
266
|
-
}
|
267
|
-
},
|
268
|
-
children
|
269
|
-
});
|
270
|
-
}),
|
271
|
-
PinnedColsOverlay: ({ position }) => {
|
272
|
-
const { table } = useTableContext();
|
273
|
-
if (!table.getIsSomeColumnsPinned(position)) {
|
274
|
-
return null;
|
275
|
-
}
|
276
|
-
const width = position === "left" ? table.getLeftTotalSize() : table.getRightTotalSize();
|
277
|
-
const style = {
|
278
|
-
width,
|
279
|
-
[position]: 0,
|
280
|
-
position: "sticky",
|
281
|
-
top: 0,
|
282
|
-
bottom: 0,
|
283
|
-
zIndex: 20,
|
284
|
-
pointerEvents: "none"
|
285
|
-
};
|
286
|
-
if (position === "left") {
|
287
|
-
style.boxShadow = "4px 0 8px -4px rgba(0, 0, 0, 0.15), 6px 0 12px -6px rgba(0, 0, 0, 0.1)";
|
288
|
-
} else if (position === "right") {
|
289
|
-
style.boxShadow = "-4px 0 8px -4px rgba(0, 0, 0, 0.15), -6px 0 12px -6px rgba(0, 0, 0, 0.1)";
|
290
|
-
}
|
291
|
-
return /* @__PURE__ */ jsx("div", {
|
292
|
-
className: `pinned-${position}-overlay`,
|
293
|
-
style
|
294
|
-
});
|
295
|
-
}
|
296
|
-
};
|
297
|
-
var TableHeaderCell = React.forwardRef(({
|
298
|
-
headerId,
|
299
|
-
isPinned,
|
300
|
-
width,
|
301
|
-
header,
|
302
|
-
type,
|
303
|
-
isLast,
|
304
|
-
isLastPinned,
|
305
|
-
isLastCenter,
|
306
|
-
isMeasuring
|
307
|
-
}, ref) => {
|
308
|
-
const { table } = useTableContext();
|
309
|
-
return /* @__PURE__ */ jsx(TableCell, {
|
310
|
-
ref,
|
311
|
-
component: "div",
|
312
|
-
className: "th",
|
313
|
-
"data-header-id": headerId,
|
314
|
-
"data-is-pinned": isPinned,
|
315
|
-
sx: {
|
316
|
-
transition: "background-color 0.2s ease",
|
317
|
-
whiteSpace: "nowrap",
|
318
|
-
zIndex: isPinned ? 1 : 0,
|
319
|
-
display: "flex",
|
320
|
-
overflow: "hidden",
|
321
|
-
height: "var(--header-row-height)",
|
322
|
-
width: isMeasuring ? "auto" : width,
|
323
|
-
position: "relative",
|
324
|
-
flexShrink: 0,
|
325
|
-
alignItems: "center",
|
326
|
-
gap: "8px",
|
327
|
-
justifyContent: "space-between",
|
328
|
-
padding: "6px 12px",
|
329
|
-
boxSizing: "border-box",
|
330
|
-
fontWeight: 600,
|
331
|
-
backgroundColor: isPinned ? (theme) => theme.palette.background.paper : "transparent",
|
332
|
-
borderRight: (isPinned === "start" && !isLastPinned || !isPinned) && !isLast && !(isLastCenter && table.getIsSomeColumnsPinned("right")) ? (theme) => `1px solid ${theme.palette.divider}` : undefined,
|
333
|
-
borderLeft: isPinned === "end" && !isLastPinned ? (theme) => `1px solid ${theme.palette.divider}` : undefined
|
334
|
-
},
|
335
|
-
children: /* @__PURE__ */ jsx("div", {
|
336
|
-
style: { flex: 1, display: "flex", justifyContent: "flex-start" },
|
337
|
-
children: header && !header.isPlaceholder ? flexRender(header.column.columnDef[type], header.getContext()) : null
|
338
|
-
})
|
339
|
-
});
|
340
|
-
});
|
341
|
-
function TableHeaderRow({ children }) {
|
342
|
-
return /* @__PURE__ */ jsx(TableRow, {
|
343
|
-
component: "div",
|
344
|
-
sx: { height: "var(--row-height)", display: "flex" },
|
345
|
-
children
|
346
|
-
});
|
347
|
-
}
|
1
|
+
// packages/skin-anocca/src/index.ts
|
2
|
+
import { AnoccaSkin } from "./AnoccaSkin.mjs";
|
3
|
+
import { TableHeaderRow } from "./TableHeaderRow.mjs";
|
4
|
+
import { HeaderPinButtons } from "./HeaderPinButtons.mjs";
|
5
|
+
import { RowPinButtons } from "./RowPinButtons.mjs";
|
348
6
|
export {
|
7
|
+
TableHeaderRow,
|
8
|
+
RowPinButtons,
|
9
|
+
HeaderPinButtons,
|
349
10
|
AnoccaSkin
|
350
11
|
};
|
351
12
|
|
352
|
-
//# debugId=
|
13
|
+
//# debugId=6AF25DD9FEF54D7E64756E2164756E21
|
package/dist/mjs/index.mjs.map
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../src/index.
|
3
|
+
"sources": ["../../src/index.ts"],
|
4
4
|
"sourcesContent": [
|
5
|
-
"import {\n Box,\n Paper,\n SxProps,\n TableBody,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n Theme,\n useTheme,\n} from \"@mui/material\";\nimport {\n Skin,\n useTableContext,\n useTableCssVars,\n VirtualHeader,\n} from \"@rttui/core\";\nimport React, { CSSProperties } from \"react\";\nimport { flexRender } from \"@tanstack/react-table\";\n\nconst AnoccaSkin: Skin = {\n rowHeight: 32,\n headerRowHeight: 32,\n footerRowHeight: 32,\n OverlayContainer: ({ children }) => {\n const { width, height } = useTableContext();\n const cssVars = useTableCssVars();\n return (\n <div\n className=\"rttui-overlay-container\"\n style={{\n position: \"relative\",\n width: width + \"px\",\n height: height + \"px\",\n ...cssVars,\n }}\n >\n {children}\n </div>\n );\n },\n OuterContainer: ({ children }) => {\n const { tableContainerRef } = useTableContext();\n\n return (\n <Paper\n ref={tableContainerRef}\n className=\"outer-container\"\n elevation={2}\n sx={{\n overflow: \"auto\",\n width: \"var(--table-container-width)\",\n height: \"var(--table-container-height)\",\n position: \"relative\",\n contain: \"paint\",\n willChange: \"transform\",\n borderRadius: 1,\n }}\n >\n {children}\n </Paper>\n );\n },\n TableScroller: () => {\n return (\n <div\n className=\"table-scroller\"\n style={{\n width: \"var(--table-width)\",\n height:\n \"calc(var(--table-height) + var(--header-height) + var(--footer-height))\",\n position: \"absolute\",\n }}\n ></div>\n );\n },\n TableHeader: ({ children }) => {\n return (\n <TableHead\n component=\"div\"\n className=\"thead\"\n sx={{\n position: \"sticky\",\n top: 0,\n width: \"var(--table-width)\",\n zIndex: 2,\n backgroundColor: (theme) => theme.palette.background.paper,\n boxShadow: (theme) => `0 1px 0 ${theme.palette.divider}`,\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"flex-start\",\n alignItems: \"stretch\",\n }}\n >\n {children}\n </TableHead>\n );\n },\n TableFooter: ({ children }) => {\n return (\n <TableFooter\n component=\"div\"\n className=\"table-footer\"\n sx={{\n position: \"sticky\",\n bottom: -1,\n width: \"var(--table-width)\",\n zIndex: 2,\n backgroundColor: (theme) => theme.palette.background.paper,\n boxShadow: (theme) => `0 -1px 0 ${theme.palette.divider}`,\n }}\n >\n {children}\n </TableFooter>\n );\n },\n HeaderRow: TableHeaderRow,\n HeaderCell: React.forwardRef((props, ref) => {\n return <TableHeaderCell {...props} ref={ref} />;\n }),\n TableBody: ({ children }) => {\n return (\n <TableBody\n component=\"div\"\n className=\"table-body\"\n sx={{\n position: \"relative\",\n width: \"var(--table-width)\",\n height: \"var(--table-height)\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"flex-start\",\n alignItems: \"stretch\",\n }}\n >\n {children}\n </TableBody>\n );\n },\n PinnedRows: ({ children, position, pinned }) => {\n if (pinned.length === 0) {\n return null;\n }\n\n const style: SxProps<Theme> = {\n position: \"sticky\",\n zIndex: 3,\n };\n if (position === \"top\") {\n style.top = \"var(--header-height)\";\n style.borderBottom = (theme) => `1px solid ${theme.palette.divider}`;\n style.boxShadow =\n \"0 4px 8px -4px rgba(0, 0, 0, 0.15), 0 6px 12px -6px rgba(0, 0, 0, 0.1)\";\n } else if (position === \"bottom\") {\n style.bottom = \"var(--footer-height)\";\n style.borderTop = (theme) => `1px solid ${theme.palette.divider}`;\n style.boxShadow =\n \"0 -4px 8px -4px rgba(0, 0, 0, 0.15), 0 -6px 12px -6px rgba(0, 0, 0, 0.1)\";\n }\n\n const Component = position === \"top\" ? TableHead : TableFooter;\n\n return (\n <Component\n component=\"div\"\n className={`sticky-${position}-rows`}\n sx={style}\n >\n {children}\n </Component>\n );\n },\n PinnedCols: ({ children, position, pinned }) => {\n if (pinned.length === 0) {\n return null;\n }\n\n const style: SxProps<Theme> = {\n position: \"sticky\",\n zIndex: 3,\n display: \"flex\",\n };\n\n if (position === \"left\") {\n style.left = 0;\n } else if (position === \"right\") {\n style.right = 0;\n }\n\n return (\n <Box component=\"div\" className={`sticky-${position}-cols`} sx={style}>\n {children}\n </Box>\n );\n },\n\n TableRowWrapper: React.forwardRef(\n ({ children, flatIndex, dndStyle }, ref) => {\n const theme = useTheme();\n const backgroundColor = (theme: Theme) => {\n const baseColor =\n flatIndex % 2 === 0\n ? theme.palette.background.paper\n : theme.palette.mode === \"dark\"\n ? theme.palette.grey[900]\n : theme.palette.grey[100];\n return baseColor;\n };\n\n const vars: Record<string, string> = {\n \"--row-background-color\": backgroundColor(theme),\n };\n\n return (\n <Box\n sx={{\n ...dndStyle,\n ...vars,\n width: \"var(--table-width)\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"flex-start\",\n alignItems: \"stretch\",\n }}\n data-index={flatIndex}\n ref={ref}\n >\n {children}\n </Box>\n );\n },\n ),\n TableRow: ({ children }) => {\n return (\n <TableRow\n component=\"div\"\n className=\"table-row\"\n sx={{\n position: \"relative\",\n width: \"var(--table-width)\",\n display: \"flex\",\n height: \"var(--row-height)\",\n zIndex: 1,\n boxSizing: \"border-box\",\n backgroundColor: \"var(--row-background-color)\",\n \"&:hover\": {\n backgroundColor: (theme) => {\n // Always use solid background colors for all cells on hover\n return theme.palette.mode === \"dark\"\n ? \"#1e1e52\" // Dark blue solid color\n : \"#E3F2FD\"; // Light blue solid color\n },\n },\n }}\n >\n {children}\n </TableRow>\n );\n },\n TableRowExpandedContent: ({ children }) => {\n const { table } = useTableContext();\n return (\n <TableRow\n component=\"div\"\n className=\"expanded-row\"\n sx={{\n backgroundColor: (theme) => theme.palette.background.default,\n }}\n >\n <TableCell\n component=\"div\"\n className=\"expanded-cell\"\n colSpan={table.getAllLeafColumns().length}\n sx={{\n padding: 2,\n }}\n >\n {children}\n </TableCell>\n </TableRow>\n );\n },\n Cell: React.forwardRef(\n (\n { children, header, isMeasuring, isLastPinned, isLast, isLastCenter },\n ref,\n ) => {\n const { isPinned } = header;\n const { table } = useTableContext();\n return (\n <TableCell\n className=\"td\"\n component=\"div\"\n ref={ref}\n sx={{\n height: \"var(--row-height)\",\n width: isMeasuring ? \"auto\" : header.width,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n zIndex: isPinned ? 5 : 0,\n boxSizing: \"border-box\",\n fontSize: \"0.875rem\",\n color: \"text.primary\",\n alignItems: \"center\",\n gap: \"8px\",\n display: \"flex\",\n justifyContent: \"flex-start\",\n alignContent: \"center\",\n padding: \"6px 12px\",\n backgroundColor: \"var(--row-background-color)\",\n borderBottom: \"none\",\n flexShrink: 0,\n position: \"relative\",\n borderRight:\n ((isPinned === \"start\" && !isLastPinned) || !isPinned) &&\n !isLast &&\n !(isLastCenter && table.getIsSomeColumnsPinned(\"right\"))\n ? (theme) => `1px solid ${theme.palette.divider}`\n : undefined,\n borderLeft:\n isPinned === \"end\" && !isLastPinned\n ? (theme) => `1px solid ${theme.palette.divider}`\n : undefined,\n \".table-row:hover &\": {\n backgroundColor: (theme) => {\n // Always use solid background colors for all cells on hover\n return theme.palette.mode === \"dark\"\n ? \"#1e1e52\" // Dark blue solid color\n : \"#E3F2FD\"; // Light blue solid color\n },\n zIndex: isPinned ? 2 : 0,\n },\n }}\n >\n {children}\n </TableCell>\n );\n },\n ),\n PinnedColsOverlay: ({ position }) => {\n const { table } = useTableContext();\n if (!table.getIsSomeColumnsPinned(position)) {\n return null;\n }\n const width =\n position === \"left\"\n ? table.getLeftTotalSize()\n : table.getRightTotalSize();\n\n const style: CSSProperties = {\n width,\n [position]: 0,\n position: \"sticky\",\n top: 0,\n bottom: 0,\n zIndex: 20,\n pointerEvents: \"none\",\n };\n\n if (position === \"left\") {\n style.boxShadow =\n \"4px 0 8px -4px rgba(0, 0, 0, 0.15), 6px 0 12px -6px rgba(0, 0, 0, 0.1)\";\n } else if (position === \"right\") {\n style.boxShadow =\n \"-4px 0 8px -4px rgba(0, 0, 0, 0.15), -6px 0 12px -6px rgba(0, 0, 0, 0.1)\";\n }\n return <div className={`pinned-${position}-overlay`} style={style} />;\n },\n};\n\nconst TableHeaderCell = React.forwardRef<\n HTMLDivElement,\n VirtualHeader & {\n type: \"header\" | \"footer\";\n isLast: boolean;\n isFirst: boolean;\n isLastPinned: boolean;\n isFirstPinned: boolean;\n isLastCenter: boolean;\n isFirstCenter: boolean;\n isMeasuring: boolean;\n }\n>(\n (\n {\n headerId,\n isPinned,\n width,\n header,\n type,\n isLast,\n isLastPinned,\n isLastCenter,\n isMeasuring,\n },\n ref,\n ) => {\n const { table } = useTableContext();\n return (\n <TableCell\n ref={ref}\n component=\"div\"\n className=\"th\"\n data-header-id={headerId}\n data-is-pinned={isPinned}\n sx={{\n transition: \"background-color 0.2s ease\",\n whiteSpace: \"nowrap\",\n zIndex: isPinned ? 1 : 0,\n display: \"flex\",\n overflow: \"hidden\",\n height: \"var(--header-row-height)\",\n width: isMeasuring ? \"auto\" : width,\n position: \"relative\",\n flexShrink: 0,\n alignItems: \"center\",\n gap: \"8px\",\n justifyContent: \"space-between\",\n padding: \"6px 12px\",\n boxSizing: \"border-box\",\n fontWeight: 600,\n backgroundColor: isPinned\n ? (theme) => theme.palette.background.paper\n : \"transparent\",\n borderRight:\n ((isPinned === \"start\" && !isLastPinned) || !isPinned) &&\n !isLast &&\n !(isLastCenter && table.getIsSomeColumnsPinned(\"right\"))\n ? (theme) => `1px solid ${theme.palette.divider}`\n : undefined,\n borderLeft:\n isPinned === \"end\" && !isLastPinned\n ? (theme) => `1px solid ${theme.palette.divider}`\n : undefined,\n }}\n >\n <div style={{ flex: 1, display: \"flex\", justifyContent: \"flex-start\" }}>\n {header && !header.isPlaceholder\n ? flexRender(header.column.columnDef[type], header.getContext())\n : null}\n </div>\n </TableCell>\n );\n },\n);\n\nexport { AnoccaSkin };\n\nfunction TableHeaderRow({ children }: { children: React.ReactNode }) {\n return (\n <TableRow\n component=\"div\"\n sx={{ height: \"var(--row-height)\", display: \"flex\" }}\n >\n {children}\n </TableRow>\n );\n}\n"
|
5
|
+
"export { AnoccaSkin } from \"./AnoccaSkin.mjs\";\nexport { TableHeaderRow } from \"./TableHeaderRow.mjs\";\nexport { HeaderPinButtons } from \"./HeaderPinButtons.mjs\";\nexport { RowPinButtons } from \"./RowPinButtons.mjs\";\n"
|
6
6
|
],
|
7
|
-
"mappings": ";AAAA;
|
8
|
-
"debugId": "
|
7
|
+
"mappings": ";AAAA;AACA;AACA;AACA;",
|
8
|
+
"debugId": "6AF25DD9FEF54D7E64756E2164756E21",
|
9
9
|
"names": []
|
10
10
|
}
|
package/dist/mjs/package.json
CHANGED
package/dist/types/index.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export {
|
1
|
+
export { AnoccaSkin } from "./AnoccaSkin";
|
2
|
+
export { TableHeaderRow } from "./TableHeaderRow";
|
3
|
+
export { HeaderPinButtons } from "./HeaderPinButtons";
|
4
|
+
export { RowPinButtons } from "./RowPinButtons";
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rttui/skin-anocca",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.23",
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
5
5
|
"dependencies": {
|
6
|
-
"@rttui/core": "^1.0.
|
6
|
+
"@rttui/core": "^1.0.22"
|
7
7
|
},
|
8
8
|
"module": "./dist/mjs/index.mjs",
|
9
9
|
"types": "./dist/types/index.d.ts",
|
@@ -19,13 +19,5 @@
|
|
19
19
|
},
|
20
20
|
"files": [
|
21
21
|
"dist"
|
22
|
-
]
|
23
|
-
"scripts": {
|
24
|
-
"dev": "vite",
|
25
|
-
"build": "tsc -b && vite build",
|
26
|
-
"lint": "eslint .",
|
27
|
-
"preview": "vite preview",
|
28
|
-
"storybook": "storybook dev -p 6006",
|
29
|
-
"build-storybook": "storybook build"
|
30
|
-
}
|
22
|
+
]
|
31
23
|
}
|