schummar-table 0.7.1 → 0.8.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/dist/cjs/index.js +441 -387
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mui4Theme.js +5 -5
- package/dist/cjs/mui4Theme.js.map +1 -1
- package/dist/cjs/mui5Theme.js +6 -6
- package/dist/cjs/mui5Theme.js.map +1 -1
- package/dist/cjs/tableTheme.js +20 -7
- package/dist/cjs/tableTheme.js.map +1 -1
- package/dist/es/index.js +442 -388
- package/dist/es/index.js.map +1 -1
- package/dist/es/mui4Theme.js +5 -5
- package/dist/es/mui4Theme.js.map +1 -1
- package/dist/es/mui5Theme.js +6 -6
- package/dist/es/mui5Theme.js.map +1 -1
- package/dist/es/tableTheme.js +20 -7
- package/dist/es/tableTheme.js.map +1 -1
- package/dist/types/components/columnFooter.d.ts +1 -0
- package/dist/types/components/columnHeader.d.ts +1 -2
- package/dist/types/components/virtualized.d.ts +2 -1
- package/dist/types/theme/defaultTheme/defaultClasses.d.ts +3 -0
- package/dist/types/types.d.ts +12 -3
- package/package.json +11 -11
package/dist/es/mui4Theme.js
CHANGED
|
@@ -37,7 +37,7 @@ import "react-dom";
|
|
|
37
37
|
import "@emotion/react";
|
|
38
38
|
const mui4Theme = {
|
|
39
39
|
components: {
|
|
40
|
-
Button: (props) => jsx(Button, __spreadProps(__spreadValues({}, props), {
|
|
40
|
+
Button: (props) => /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({}, props), {
|
|
41
41
|
size: "small",
|
|
42
42
|
fullWidth: true,
|
|
43
43
|
css: {
|
|
@@ -45,11 +45,11 @@ const mui4Theme = {
|
|
|
45
45
|
},
|
|
46
46
|
color: props.variant === "contained" ? "primary" : "inherit"
|
|
47
47
|
})),
|
|
48
|
-
IconButton: (props) => jsx(IconButton, __spreadProps(__spreadValues({}, props), {
|
|
48
|
+
IconButton: (props) => /* @__PURE__ */ jsx(IconButton, __spreadProps(__spreadValues({}, props), {
|
|
49
49
|
size: "small",
|
|
50
50
|
color: "inherit"
|
|
51
51
|
})),
|
|
52
|
-
Checkbox: (props) => jsx(Checkbox, __spreadProps(__spreadValues({}, props), {
|
|
52
|
+
Checkbox: (props) => /* @__PURE__ */ jsx(Checkbox, __spreadProps(__spreadValues({}, props), {
|
|
53
53
|
color: "primary",
|
|
54
54
|
size: "medium"
|
|
55
55
|
})),
|
|
@@ -61,7 +61,7 @@ const mui4Theme = {
|
|
|
61
61
|
} = _b, props = __objRest(_b, [
|
|
62
62
|
"endIcon"
|
|
63
63
|
]);
|
|
64
|
-
return jsx(TextField, __spreadProps(__spreadValues({}, props), {
|
|
64
|
+
return /* @__PURE__ */ jsx(TextField, __spreadProps(__spreadValues({}, props), {
|
|
65
65
|
InputProps: {
|
|
66
66
|
endAdornment: endIcon
|
|
67
67
|
},
|
|
@@ -85,7 +85,7 @@ function Mui4TableThemeProvider({
|
|
|
85
85
|
}
|
|
86
86
|
}, mui4Theme, theme != null ? theme : {});
|
|
87
87
|
}, [muiTheme, theme]);
|
|
88
|
-
return jsx(TableThemeContext.Provider, {
|
|
88
|
+
return /* @__PURE__ */ jsx(TableThemeContext.Provider, {
|
|
89
89
|
value: _theme,
|
|
90
90
|
children
|
|
91
91
|
});
|
package/dist/es/mui4Theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mui4Theme.js","sources":["../../src/theme/mui4Theme/index.tsx"],"sourcesContent":["import { Badge, Button, Checkbox, CircularProgress, IconButton, TextField, useTheme } from '@material-ui/core';\nimport { ReactNode, useMemo } from 'react';\nimport { PartialTableTheme } from '../../types';\nimport { Popover } from '../defaultTheme/popover';\nimport { mergeThemes, TableThemeContext } from '../tableTheme';\n\nexport const mui4Theme: PartialTableTheme = {\n components: {\n Button: (props) => (\n <Button\n {...props}\n size=\"small\"\n fullWidth\n css={{ justifyContent: 'start !important' }}\n color={props.variant === 'contained' ? 'primary' : 'inherit'}\n />\n ),\n IconButton: (props) => <IconButton {...props} size=\"small\" color=\"inherit\" />,\n Checkbox: (props) => <Checkbox {...props} color=\"primary\" size=\"medium\" />,\n Popover,\n Badge,\n TextField: ({ endIcon, ...props }) => <TextField {...props} InputProps={{ endAdornment: endIcon }} size=\"small\" variant=\"outlined\" />,\n Spinner: CircularProgress,\n },\n};\n\nexport function Mui4TableThemeProvider({ theme, children }: { theme?: PartialTableTheme; children: ReactNode }) {\n const muiTheme = useTheme();\n\n const _theme = useMemo(() => {\n return mergeThemes(\n {\n colors: {\n primary: muiTheme.palette.primary,\n secondary: muiTheme.palette.secondary,\n },\n },\n mui4Theme,\n theme ?? {},\n );\n }, [muiTheme, theme]);\n\n return <TableThemeContext.Provider value={_theme}>{children}</TableThemeContext.Provider>;\n}\n"],"names":["mui4Theme","components","Button","props","
|
|
1
|
+
{"version":3,"file":"mui4Theme.js","sources":["../../src/theme/mui4Theme/index.tsx"],"sourcesContent":["import { Badge, Button, Checkbox, CircularProgress, IconButton, TextField, useTheme } from '@material-ui/core';\nimport { ReactNode, useMemo } from 'react';\nimport { PartialTableTheme } from '../../types';\nimport { Popover } from '../defaultTheme/popover';\nimport { mergeThemes, TableThemeContext } from '../tableTheme';\n\nexport const mui4Theme: PartialTableTheme = {\n components: {\n Button: (props) => (\n <Button\n {...props}\n size=\"small\"\n fullWidth\n css={{ justifyContent: 'start !important' }}\n color={props.variant === 'contained' ? 'primary' : 'inherit'}\n />\n ),\n IconButton: (props) => <IconButton {...props} size=\"small\" color=\"inherit\" />,\n Checkbox: (props) => <Checkbox {...props} color=\"primary\" size=\"medium\" />,\n Popover,\n Badge,\n TextField: ({ endIcon, ...props }) => <TextField {...props} InputProps={{ endAdornment: endIcon }} size=\"small\" variant=\"outlined\" />,\n Spinner: CircularProgress,\n },\n};\n\nexport function Mui4TableThemeProvider({ theme, children }: { theme?: PartialTableTheme; children: ReactNode }) {\n const muiTheme = useTheme();\n\n const _theme = useMemo(() => {\n return mergeThemes(\n {\n colors: {\n primary: muiTheme.palette.primary,\n secondary: muiTheme.palette.secondary,\n },\n },\n mui4Theme,\n theme ?? {},\n );\n }, [muiTheme, theme]);\n\n return <TableThemeContext.Provider value={_theme}>{children}</TableThemeContext.Provider>;\n}\n"],"names":["mui4Theme","components","Button","props","justifyContent","variant","IconButton","Checkbox","Popover","Badge","TextField","endIcon","endAdornment","Spinner","CircularProgress","theme","children","muiTheme","useTheme","_theme","useMemo","mergeThemes","colors","primary","palette","secondary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMaA,YAA+B;AAAA,EAC1CC,YAAY;AAAA,IACVC,QAASC,+BACN,yCACKA;MACJ,MAAK;AAAA,MACL;MACA,KAAK;AAAA,QAAEC,gBAAgB;AAAA;MACvB,OAAOD,MAAME,YAAY,cAAc,YAAY;AAAA;IAGvDC,YAAaH,+BAAW,6CAAeA;MAAO,MAAK;AAAA,MAAQ,OAAM;AAAA;IACjEI,UAAWJ,+BAAW,2CAAaA;MAAO,OAAM;AAAA,MAAU,MAAK;AAAA;IAC/DK;AAAAA,IACAC;AAAAA,IACAC,WAAW,CAAC;AAAA,mBAAEC;AAAAA;AAAAA,UAAF,IAAcR,kBAAd,IAAcA;AAAAA,QAAZQ;AAAAA;iCAAyB,4CAAcR;QAAO,YAAY;AAAA,UAAES,cAAcD;AAAAA;QAAW,MAAK;AAAA,QAAQ,SAAQ;AAAA;;IACxHE,SAASC;AAAAA;AAhB+B;gCAoBL;AAAA,EAAEC;AAAAA,EAAOC;AAAAA,GAAgE;QACxGC,WAAWC;QAEXC,SAASC,QAAQ,MAAM;WACpBC,YACL;AAAA,MACEC,QAAQ;AAAA,QACNC,SAASN,SAASO,QAAQD;AAAAA,QAC1BE,WAAWR,SAASO,QAAQC;AAAAA;OAGhCzB,WACAe,wBAAS,EARO;AAAA,KAUjB,CAACE,UAAUF,KAAX,CAXmB;6BAad,kBAAkB;IAAS,OAAOI;AAAAA;;AAC3C;;"}
|
package/dist/es/mui5Theme.js
CHANGED
|
@@ -37,7 +37,7 @@ import "react-dom";
|
|
|
37
37
|
import "@emotion/react";
|
|
38
38
|
const mui5Theme = {
|
|
39
39
|
components: {
|
|
40
|
-
Button: (props) => jsx(Button, __spreadProps(__spreadValues({}, props), {
|
|
40
|
+
Button: (props) => /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({}, props), {
|
|
41
41
|
size: "small",
|
|
42
42
|
fullWidth: true,
|
|
43
43
|
css: {
|
|
@@ -45,14 +45,14 @@ const mui5Theme = {
|
|
|
45
45
|
},
|
|
46
46
|
color: props.variant === "contained" ? "primary" : "inherit"
|
|
47
47
|
})),
|
|
48
|
-
IconButton: (props) => jsx(IconButton, __spreadProps(__spreadValues({}, props), {
|
|
48
|
+
IconButton: (props) => /* @__PURE__ */ jsx(IconButton, __spreadProps(__spreadValues({}, props), {
|
|
49
49
|
size: "small",
|
|
50
50
|
css: {
|
|
51
51
|
fontSize: "0.8em"
|
|
52
52
|
},
|
|
53
53
|
color: "inherit"
|
|
54
54
|
})),
|
|
55
|
-
Checkbox: (props) => jsx(Checkbox, __spreadProps(__spreadValues({}, props), {
|
|
55
|
+
Checkbox: (props) => /* @__PURE__ */ jsx(Checkbox, __spreadProps(__spreadValues({}, props), {
|
|
56
56
|
color: "primary",
|
|
57
57
|
size: "small"
|
|
58
58
|
})),
|
|
@@ -64,14 +64,14 @@ const mui5Theme = {
|
|
|
64
64
|
} = _b, props = __objRest(_b, [
|
|
65
65
|
"endIcon"
|
|
66
66
|
]);
|
|
67
|
-
return jsx(TextField, __spreadProps(__spreadValues({}, props), {
|
|
67
|
+
return /* @__PURE__ */ jsx(TextField, __spreadProps(__spreadValues({}, props), {
|
|
68
68
|
InputProps: {
|
|
69
69
|
endAdornment: endIcon
|
|
70
70
|
},
|
|
71
71
|
size: "small"
|
|
72
72
|
}));
|
|
73
73
|
},
|
|
74
|
-
Spinner: (props) => jsx(CircularProgress, __spreadProps(__spreadValues({}, props), {
|
|
74
|
+
Spinner: (props) => /* @__PURE__ */ jsx(CircularProgress, __spreadProps(__spreadValues({}, props), {
|
|
75
75
|
size: 20
|
|
76
76
|
}))
|
|
77
77
|
}
|
|
@@ -89,7 +89,7 @@ function Mui5TableThemeProvider({
|
|
|
89
89
|
}
|
|
90
90
|
}, mui5Theme, theme != null ? theme : {});
|
|
91
91
|
}, [muiTheme, theme]);
|
|
92
|
-
return jsx(TableThemeContext.Provider, {
|
|
92
|
+
return /* @__PURE__ */ jsx(TableThemeContext.Provider, {
|
|
93
93
|
value: _theme,
|
|
94
94
|
children
|
|
95
95
|
});
|
package/dist/es/mui5Theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mui5Theme.js","sources":["../../src/theme/mui5Theme/index.tsx"],"sourcesContent":["import { Badge, Button, Checkbox, CircularProgress, IconButton, TextField, useTheme } from '@mui/material';\nimport { ReactNode, useMemo } from 'react';\nimport { PartialTableTheme } from '../../types';\nimport { Popover } from '../defaultTheme/popover';\nimport { mergeThemes, TableThemeContext } from '../tableTheme';\n\nexport const mui5Theme: PartialTableTheme = {\n components: {\n Button: (props) => (\n <Button\n {...props}\n size=\"small\"\n fullWidth\n css={{ justifyContent: 'start !important' }}\n color={props.variant === 'contained' ? 'primary' : 'inherit'}\n />\n ),\n IconButton: (props) => <IconButton {...props} size=\"small\" css={{ fontSize: '0.8em' }} color=\"inherit\" />,\n Checkbox: (props) => <Checkbox {...props} color=\"primary\" size=\"small\" />,\n Popover,\n Badge,\n TextField: ({ endIcon, ...props }) => <TextField {...props} InputProps={{ endAdornment: endIcon }} size=\"small\" />,\n Spinner: (props) => <CircularProgress {...props} size={20} />,\n },\n};\n\nexport function Mui5TableThemeProvider({ theme, children }: { theme?: PartialTableTheme; children: ReactNode }) {\n const muiTheme = useTheme();\n\n const _theme = useMemo(() => {\n return mergeThemes(\n {\n colors: {\n primary: muiTheme.palette.primary,\n secondary: muiTheme.palette.secondary,\n },\n },\n mui5Theme,\n theme ?? {},\n );\n }, [muiTheme, theme]);\n\n return <TableThemeContext.Provider value={_theme}>{children}</TableThemeContext.Provider>;\n}\n"],"names":["mui5Theme","components","Button","props","
|
|
1
|
+
{"version":3,"file":"mui5Theme.js","sources":["../../src/theme/mui5Theme/index.tsx"],"sourcesContent":["import { Badge, Button, Checkbox, CircularProgress, IconButton, TextField, useTheme } from '@mui/material';\nimport { ReactNode, useMemo } from 'react';\nimport { PartialTableTheme } from '../../types';\nimport { Popover } from '../defaultTheme/popover';\nimport { mergeThemes, TableThemeContext } from '../tableTheme';\n\nexport const mui5Theme: PartialTableTheme = {\n components: {\n Button: (props) => (\n <Button\n {...props}\n size=\"small\"\n fullWidth\n css={{ justifyContent: 'start !important' }}\n color={props.variant === 'contained' ? 'primary' : 'inherit'}\n />\n ),\n IconButton: (props) => <IconButton {...props} size=\"small\" css={{ fontSize: '0.8em' }} color=\"inherit\" />,\n Checkbox: (props) => <Checkbox {...props} color=\"primary\" size=\"small\" />,\n Popover,\n Badge,\n TextField: ({ endIcon, ...props }) => <TextField {...props} InputProps={{ endAdornment: endIcon }} size=\"small\" />,\n Spinner: (props) => <CircularProgress {...props} size={20} />,\n },\n};\n\nexport function Mui5TableThemeProvider({ theme, children }: { theme?: PartialTableTheme; children: ReactNode }) {\n const muiTheme = useTheme();\n\n const _theme = useMemo(() => {\n return mergeThemes(\n {\n colors: {\n primary: muiTheme.palette.primary,\n secondary: muiTheme.palette.secondary,\n },\n },\n mui5Theme,\n theme ?? {},\n );\n }, [muiTheme, theme]);\n\n return <TableThemeContext.Provider value={_theme}>{children}</TableThemeContext.Provider>;\n}\n"],"names":["mui5Theme","components","Button","props","justifyContent","variant","IconButton","fontSize","Checkbox","Popover","Badge","TextField","endIcon","endAdornment","Spinner","theme","children","muiTheme","useTheme","_theme","useMemo","mergeThemes","colors","primary","palette","secondary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMaA,YAA+B;AAAA,EAC1CC,YAAY;AAAA,IACVC,QAASC,+BACN,yCACKA;MACJ,MAAK;AAAA,MACL;MACA,KAAK;AAAA,QAAEC,gBAAgB;AAAA;MACvB,OAAOD,MAAME,YAAY,cAAc,YAAY;AAAA;IAGvDC,YAAaH,+BAAW,6CAAeA;MAAO,MAAK;AAAA,MAAQ,KAAK;AAAA,QAAEI,UAAU;AAAA;MAAW,OAAM;AAAA;IAC7FC,UAAWL,+BAAW,2CAAaA;MAAO,OAAM;AAAA,MAAU,MAAK;AAAA;IAC/DM;AAAAA,IACAC;AAAAA,IACAC,WAAW,CAAC;AAAA,mBAAEC;AAAAA;AAAAA,UAAF,IAAcT,kBAAd,IAAcA;AAAAA,QAAZS;AAAAA;iCAAyB,4CAAcT;QAAO,YAAY;AAAA,UAAEU,cAAcD;AAAAA;QAAW,MAAK;AAAA;;IACxGE,SAAUX,+BAAW,mDAAqBA;MAAO,MAAM;AAAA;;AAhBf;gCAoBL;AAAA,EAAEY;AAAAA,EAAOC;AAAAA,GAAgE;QACxGC,WAAWC;QAEXC,SAASC,QAAQ,MAAM;WACpBC,YACL;AAAA,MACEC,QAAQ;AAAA,QACNC,SAASN,SAASO,QAAQD;AAAAA,QAC1BE,WAAWR,SAASO,QAAQC;AAAAA;OAGhCzB,WACAe,wBAAS,EARO;AAAA,KAUjB,CAACE,UAAUF,KAAX,CAXmB;6BAad,kBAAkB;IAAS,OAAOI;AAAAA;;AAC3C;;"}
|
package/dist/es/tableTheme.js
CHANGED
|
@@ -45,8 +45,12 @@ const defaultClasses = {
|
|
|
45
45
|
}),
|
|
46
46
|
headerCell: css(cell, {
|
|
47
47
|
padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`,
|
|
48
|
-
borderBottom: `1px solid #c9cfda
|
|
49
|
-
|
|
48
|
+
borderBottom: `1px solid #c9cfda`
|
|
49
|
+
}),
|
|
50
|
+
footerCell: css(cell, {
|
|
51
|
+
padding: `var(--spacing) calc(2 * var(--spacing))`,
|
|
52
|
+
borderTop: `1px solid #c9cfda`,
|
|
53
|
+
borderBottom: "none"
|
|
50
54
|
}),
|
|
51
55
|
firstCell: css({
|
|
52
56
|
justifyContent: "start"
|
|
@@ -56,10 +60,19 @@ const defaultClasses = {
|
|
|
56
60
|
top: 0,
|
|
57
61
|
zIndex: 2
|
|
58
62
|
}),
|
|
63
|
+
stickyBottom: css({
|
|
64
|
+
position: "sticky",
|
|
65
|
+
bottom: 0,
|
|
66
|
+
zIndex: 2
|
|
67
|
+
}),
|
|
59
68
|
headerFill: css({
|
|
60
69
|
borderBottom: `1px solid #c9cfda`,
|
|
61
70
|
background: white
|
|
62
71
|
}),
|
|
72
|
+
footerFill: css({
|
|
73
|
+
borderTop: `1px solid #c9cfda`,
|
|
74
|
+
background: white
|
|
75
|
+
}),
|
|
63
76
|
text: css({
|
|
64
77
|
minWidth: 0,
|
|
65
78
|
overflow: "hidden",
|
|
@@ -140,10 +153,10 @@ const Popover = ({
|
|
|
140
153
|
}), [depth, visible]);
|
|
141
154
|
if (!open)
|
|
142
155
|
return null;
|
|
143
|
-
return jsx(PopoverContext.Provider, {
|
|
156
|
+
return /* @__PURE__ */ jsx(PopoverContext.Provider, {
|
|
144
157
|
value: context,
|
|
145
|
-
children: createPortal(jsxs(Fragment, {
|
|
146
|
-
children: [jsx("div", {
|
|
158
|
+
children: createPortal(/* @__PURE__ */ jsxs(Fragment, {
|
|
159
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
147
160
|
css: [{
|
|
148
161
|
position: "fixed",
|
|
149
162
|
left: 0,
|
|
@@ -155,7 +168,7 @@ const Popover = ({
|
|
|
155
168
|
display: "none"
|
|
156
169
|
}],
|
|
157
170
|
onClick: () => onClose()
|
|
158
|
-
}), jsx("div", {
|
|
171
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
159
172
|
ref: popper,
|
|
160
173
|
className,
|
|
161
174
|
css: [defaultClasses.card, __spreadProps(__spreadValues({
|
|
@@ -183,7 +196,7 @@ function TableThemeProvider({
|
|
|
183
196
|
theme,
|
|
184
197
|
children
|
|
185
198
|
}) {
|
|
186
|
-
return jsx(TableThemeContext.Provider, {
|
|
199
|
+
return /* @__PURE__ */ jsx(TableThemeContext.Provider, {
|
|
187
200
|
value: theme,
|
|
188
201
|
children
|
|
189
202
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableTheme.js","sources":["../../src/theme/defaultTheme/defaultClasses.ts","../../src/theme/defaultTheme/popover.tsx","../../src/theme/tableTheme.tsx"],"sourcesContent":["import { css } from '@emotion/react';\n\nexport const white = '#ffffff';\nexport const lightGray = '#eeeeee';\nexport const gray = '#bdbdbd';\nexport const darkGray = '#777';\n\nconst cell = css({\n padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,\n display: 'flex',\n alignItems: 'center',\n borderBottom: `1px solid #dfe2e9`,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n background: 'white',\n});\n\nexport const defaultClasses = {\n table: css({\n position: 'relative',\n display: 'grid',\n }),\n\n cell,\n\n cellFill: css({\n borderBottom: `1px solid ${lightGray}`,\n }),\n\n headerCell: css(cell, {\n padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`,\n borderBottom: `1px solid #c9cfda`,\n background: white,\n }),\n\n firstCell: css({\n justifyContent: 'start',\n }),\n\n sticky: css({\n position: 'sticky',\n top: 0,\n zIndex: 2,\n }),\n\n headerFill: css({\n borderBottom: `1px solid #c9cfda`,\n background: white,\n }),\n\n text: css({\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }),\n\n card: css({\n borderRadius: 4,\n boxShadow: '0px 3px 14px 2px rgb(0 0 0 / 12%)',\n background: 'white',\n }),\n};\n","import React, { createContext, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { TableTheme } from '../../types';\nimport { defaultClasses } from './defaultClasses';\n\nconst MARGIN = 10;\nconst MAX_OFFSET = 20;\n\nexport const PopoverContext = createContext({ depth: 0, visible: false });\n\nexport const Popover: TableTheme['components']['Popover'] = ({ anchorEl, open, hidden, onClose, children, className, align }) => {\n const popper = useRef<HTMLDivElement>(null);\n const [position, setPosition] = useState<{ left: number; top: number }>();\n\n useLayoutEffect(() => {\n if (!anchorEl || !open) {\n setPosition(undefined);\n return;\n }\n\n let last: { left: number; top: number } | undefined;\n\n function check() {\n if (!anchorEl) return;\n const { left: anchorLeft, bottom: anchorBottom, width: anchorWidth } = anchorEl.getBoundingClientRect();\n const { width: popperWidth = 0, height: popperHeight = 0 } = popper.current?.getBoundingClientRect() ?? {};\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n\n const next = {\n left:\n align === 'center'\n ? anchorLeft + anchorWidth / 2 - popperWidth / 2\n : anchorLeft - Math.min(popperWidth ? popperWidth / 2 : Infinity, MAX_OFFSET),\n top: anchorBottom,\n };\n\n if (next.left + popperWidth + MARGIN > viewportWidth) {\n next.left = viewportWidth - popperWidth - MARGIN;\n }\n if (next.top + popperHeight + MARGIN > viewportHeight) {\n next.top = viewportHeight - popperHeight - MARGIN;\n }\n\n if (next.left !== last?.left || next.top !== last?.top) {\n setPosition(next);\n }\n\n last = next;\n }\n check();\n\n const handle = setInterval(check, 16);\n return () => {\n clearInterval(handle);\n };\n }, [anchorEl, open]);\n\n const { depth } = useContext(PopoverContext);\n const visible = !hidden && !!position;\n const context = useMemo(() => ({ depth: depth + 1, visible }), [depth, visible]);\n\n if (!open) return null;\n\n return (\n <PopoverContext.Provider value={context}>\n {createPortal(\n <>\n <div\n css={[\n {\n position: 'fixed',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n zIndex: 1000 + depth * 2,\n },\n hidden && { display: 'none' },\n ]}\n onClick={() => onClose()}\n />\n\n <div\n ref={popper}\n className={className}\n css={[\n defaultClasses.card,\n {\n position: 'fixed',\n maxWidth: document.documentElement.clientWidth,\n maxHeight: document.documentElement.clientHeight,\n ...position,\n zIndex: 1001 + depth * 2,\n },\n hidden && { display: 'none' },\n !position && { visibility: 'hidden' },\n ]}\n >\n {children}\n </div>\n </>,\n document.body,\n )}\n </PopoverContext.Provider>\n );\n};\n","import { createContext, ReactNode } from 'react';\nimport { PartialTableTheme } from '../types';\n\nexport let globalTableTheme: PartialTableTheme = {};\nexport function configureTableTheme(tableTheme: PartialTableTheme) {\n globalTableTheme = tableTheme;\n}\n\nexport const TableThemeContext = createContext<PartialTableTheme>({});\n\nexport function TableThemeProvider({ theme, children }: { theme: PartialTableTheme; children: ReactNode }) {\n return <TableThemeContext.Provider value={theme}>{children}</TableThemeContext.Provider>;\n}\n\nexport function mergeThemes<T>(...themes: PartialTableTheme<T>[]): PartialTableTheme<T> {\n return {\n text: Object.assign({}, ...themes.map((theme) => theme.text)),\n classes: Object.assign({}, ...themes.map((theme) => theme.classes)),\n components: Object.assign({}, ...themes.map((theme) => theme.components)),\n icons: Object.assign({}, ...themes.map((theme) => theme.icons)),\n colors: {\n primary: Object.assign({}, ...themes.map((theme) => theme.colors?.primary)),\n secondary: Object.assign({}, ...themes.map((theme) => theme.colors?.secondary)),\n },\n spacing: themes\n .map((theme) => theme.spacing)\n .reverse()\n .find((x) => x !== undefined),\n };\n}\n"],"names":["MARGIN","MAX_OFFSET","PopoverContext","createContext","depth","visible","Popover","anchorEl","open","hidden","onClose","children","className","align","popper","useRef","position","setPosition","useState","undefined","last","left","anchorLeft","bottom","anchorBottom","width","anchorWidth","getBoundingClientRect","popperWidth","height","popperHeight","current","viewportWidth","document","documentElement","clientWidth","viewportHeight","clientHeight","next","Math","min","Infinity","top","handle","setInterval","check","useContext","context","useMemo","_jsx","createPortal","_jsxs","right","zIndex","display","defaultClasses","card","maxWidth","maxHeight","visibility","body","globalTableTheme","tableTheme","TableThemeContext","theme","themes","text","Object","assign","map","classes","components","icons","colors","primary","secondary","spacing","reverse","find","x"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAEa,QAAQ;MACR,YAAY;MACZ,OAAO;MACP,WAAW;AAExB,MAAM,OAA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C,UAAU;AAAA,UACVyC,UAAUxB,SAASC,gBAAgBC;AAAAA,UACnCuB,WAAWzB,SAASC,gBAAgBG;AAAAA,WACjCrB,WAJL;AAAA,UAKEqC,QAAQ,OAAOjD,QAAQ;AAAA,YAEzBK,UAAU;AAAA,UAAE6C,SAAS;AAAA,WACrB,CAACtC,YAAY;AAAA,UAAE2C,YAAY;AAAA;AAAA;;QAMjC1B,SAAS2B;AAAAA;AAAAA;ICnGNC,mBAAsC;6BACbC,YAA+B;qBAC9CA;AAAAA;MAGRC,oBAAoB5D,cAAiC;4BAE/B;AAAA,EAAE6D;AAAAA,EAAOrD;AAAAA,GAA+D;SAClGsC,IAAC,kBAAkB;IAAS,OAAOe;AAAAA;;;wBAGVC,QAAsD;SAC/E;AAAA,IACLC,MAAMC,OAAOC,OAAO,IAAI,GAAGH,OAAOI,IAAKL,WAAUA,MAAME;AAAAA,IACvDI,SAASH,OAAOC,OAAO,IAAI,GAAGH,OAAOI,IAAKL,WAAUA,MAAMM;AAAAA,IAC1DC,YAAYJ,OAAOC,OAAO,IAAI,GAAGH,OAAOI,IAAKL,WAAUA,MAAMO;AAAAA,IAC7DC,OAAOL,OAAOC,OAAO,IAAI,GAAGH,OAAOI,IAAKL,WAAUA,MAAMQ;AAAAA,IACxDC,QAAQ;AAAA,MACNC,SAASP,OAAOC,OAAO,IAAI,GAAGH,OAAOI,IAAKL;;AAAUA,2BAAMS,WAANT,mBAAcU;AAAAA;AAAAA,MAClEC,WAAWR,OAAOC,OAAO,IAAI,GAAGH,OAAOI,IAAKL;;AAAUA,2BAAMS,WAANT,mBAAcW;AAAAA;AAAAA;AAAAA,IAEtEC,SAASX,OACNI,IAAKL,WAAUA,MAAMY,SACrBC,UACAC,KAAMC,OAAMA,MAAM5D;AAAAA;AAAAA;;"}
|
|
1
|
+
{"version":3,"file":"tableTheme.js","sources":["../../src/theme/defaultTheme/defaultClasses.ts","../../src/theme/defaultTheme/popover.tsx","../../src/theme/tableTheme.tsx"],"sourcesContent":["import { css } from '@emotion/react';\n\nexport const white = '#ffffff';\nexport const lightGray = '#eeeeee';\nexport const gray = '#bdbdbd';\nexport const darkGray = '#777';\n\nconst cell = css({\n padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,\n display: 'flex',\n alignItems: 'center',\n borderBottom: `1px solid #dfe2e9`,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n background: 'white',\n});\n\nexport const defaultClasses = {\n table: css({\n position: 'relative',\n display: 'grid',\n }),\n\n cell,\n\n cellFill: css({\n borderBottom: `1px solid ${lightGray}`,\n }),\n\n headerCell: css(cell, {\n padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`,\n borderBottom: `1px solid #c9cfda`,\n }),\n\n footerCell: css(cell, {\n padding: `var(--spacing) calc(2 * var(--spacing))`,\n borderTop: `1px solid #c9cfda`,\n borderBottom: 'none',\n }),\n\n firstCell: css({\n justifyContent: 'start',\n }),\n\n sticky: css({\n position: 'sticky',\n top: 0,\n zIndex: 2,\n }),\n\n stickyBottom: css({\n position: 'sticky',\n bottom: 0,\n zIndex: 2,\n }),\n\n headerFill: css({\n borderBottom: `1px solid #c9cfda`,\n background: white,\n }),\n\n footerFill: css({\n borderTop: `1px solid #c9cfda`,\n background: white,\n }),\n\n text: css({\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }),\n\n card: css({\n borderRadius: 4,\n boxShadow: '0px 3px 14px 2px rgb(0 0 0 / 12%)',\n background: 'white',\n }),\n};\n","import React, { createContext, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { TableTheme } from '../../types';\nimport { defaultClasses } from './defaultClasses';\n\nconst MARGIN = 10;\nconst MAX_OFFSET = 20;\n\nexport const PopoverContext = createContext({ depth: 0, visible: false });\n\nexport const Popover: TableTheme['components']['Popover'] = ({ anchorEl, open, hidden, onClose, children, className, align }) => {\n const popper = useRef<HTMLDivElement>(null);\n const [position, setPosition] = useState<{ left: number; top: number }>();\n\n useLayoutEffect(() => {\n if (!anchorEl || !open) {\n setPosition(undefined);\n return;\n }\n\n let last: { left: number; top: number } | undefined;\n\n function check() {\n if (!anchorEl) return;\n const { left: anchorLeft, bottom: anchorBottom, width: anchorWidth } = anchorEl.getBoundingClientRect();\n const { width: popperWidth = 0, height: popperHeight = 0 } = popper.current?.getBoundingClientRect() ?? {};\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n\n const next = {\n left:\n align === 'center'\n ? anchorLeft + anchorWidth / 2 - popperWidth / 2\n : anchorLeft - Math.min(popperWidth ? popperWidth / 2 : Infinity, MAX_OFFSET),\n top: anchorBottom,\n };\n\n if (next.left + popperWidth + MARGIN > viewportWidth) {\n next.left = viewportWidth - popperWidth - MARGIN;\n }\n if (next.top + popperHeight + MARGIN > viewportHeight) {\n next.top = viewportHeight - popperHeight - MARGIN;\n }\n\n if (next.left !== last?.left || next.top !== last?.top) {\n setPosition(next);\n }\n\n last = next;\n }\n check();\n\n const handle = setInterval(check, 16);\n return () => {\n clearInterval(handle);\n };\n }, [anchorEl, open]);\n\n const { depth } = useContext(PopoverContext);\n const visible = !hidden && !!position;\n const context = useMemo(() => ({ depth: depth + 1, visible }), [depth, visible]);\n\n if (!open) return null;\n\n return (\n <PopoverContext.Provider value={context}>\n {createPortal(\n <>\n <div\n css={[\n {\n position: 'fixed',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n zIndex: 1000 + depth * 2,\n },\n hidden && { display: 'none' },\n ]}\n onClick={() => onClose()}\n />\n\n <div\n ref={popper}\n className={className}\n css={[\n defaultClasses.card,\n {\n position: 'fixed',\n maxWidth: document.documentElement.clientWidth,\n maxHeight: document.documentElement.clientHeight,\n ...position,\n zIndex: 1001 + depth * 2,\n },\n hidden && { display: 'none' },\n !position && { visibility: 'hidden' },\n ]}\n >\n {children}\n </div>\n </>,\n document.body,\n )}\n </PopoverContext.Provider>\n );\n};\n","import { createContext, ReactNode } from 'react';\nimport { PartialTableTheme } from '../types';\n\nexport let globalTableTheme: PartialTableTheme = {};\nexport function configureTableTheme(tableTheme: PartialTableTheme) {\n globalTableTheme = tableTheme;\n}\n\nexport const TableThemeContext = createContext<PartialTableTheme>({});\n\nexport function TableThemeProvider({ theme, children }: { theme: PartialTableTheme; children: ReactNode }) {\n return <TableThemeContext.Provider value={theme}>{children}</TableThemeContext.Provider>;\n}\n\nexport function mergeThemes<T>(...themes: PartialTableTheme<T>[]): PartialTableTheme<T> {\n return {\n text: Object.assign({}, ...themes.map((theme) => theme.text)),\n classes: Object.assign({}, ...themes.map((theme) => theme.classes)),\n components: Object.assign({}, ...themes.map((theme) => theme.components)),\n icons: Object.assign({}, ...themes.map((theme) => theme.icons)),\n colors: {\n primary: Object.assign({}, ...themes.map((theme) => theme.colors?.primary)),\n secondary: Object.assign({}, ...themes.map((theme) => theme.colors?.secondary)),\n },\n spacing: themes\n .map((theme) => theme.spacing)\n .reverse()\n .find((x) => x !== undefined),\n };\n}\n"],"names":["MARGIN","MAX_OFFSET","PopoverContext","createContext","depth","visible","Popover","anchorEl","open","hidden","onClose","children","className","align","popper","useRef","position","setPosition","useState","undefined","last","left","anchorLeft","bottom","anchorBottom","width","anchorWidth","getBoundingClientRect","popperWidth","height","popperHeight","current","viewportWidth","document","documentElement","clientWidth","viewportHeight","clientHeight","next","Math","min","Infinity","top","handle","setInterval","check","useContext","context","useMemo","createPortal","right","zIndex","display","defaultClasses","card","maxWidth","maxHeight","visibility","body","globalTableTheme","tableTheme","TableThemeContext","theme","themes","text","Object","assign","map","classes","components","icons","colors","primary","secondary","spacing","reverse","find","x"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAEa,QAAQ;MACR,YAAY;MACZ,OAAO;MACP,WAAW;AAExB,MAAM,OAAO,IAAI;AAAA,EACf,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,YA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AANT,mBAAcW;AAAAA,OAApC,CAArB;AAAA;IAEbC,SAASX,OACNI,IAAKL,WAAUA,MAAMY,OADf,EAENC,UACAC,KAAMC,OAAMA,MAAM1D,MAHZ;AAAA;AAKZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ColumnFooter(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { HTMLProps } from 'react';
|
|
2
1
|
import { StoreScope } from 'schummar-state/react';
|
|
3
2
|
import { Id } from '..';
|
|
4
3
|
export declare const ColumnHeaderContext: StoreScope<{
|
|
5
4
|
items: Map<Id, HTMLDivElement>;
|
|
6
5
|
}>;
|
|
7
|
-
export declare function ColumnHeader(
|
|
6
|
+
export declare function ColumnHeader(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import { Id } from '../types';
|
|
3
|
-
export declare function Virtualized<T>({ header, children, ...props }: {
|
|
3
|
+
export declare function Virtualized<T>({ header, footer, children, ...props }: {
|
|
4
4
|
header: ReactNode;
|
|
5
|
+
footer: ReactNode;
|
|
5
6
|
children: (itemIds: Id[], startIndex: number) => ReactNode;
|
|
6
7
|
} & HTMLProps<HTMLDivElement>): JSX.Element;
|
|
@@ -7,9 +7,12 @@ export declare const defaultClasses: {
|
|
|
7
7
|
cell: import("@emotion/utils").SerializedStyles;
|
|
8
8
|
cellFill: import("@emotion/utils").SerializedStyles;
|
|
9
9
|
headerCell: import("@emotion/utils").SerializedStyles;
|
|
10
|
+
footerCell: import("@emotion/utils").SerializedStyles;
|
|
10
11
|
firstCell: import("@emotion/utils").SerializedStyles;
|
|
11
12
|
sticky: import("@emotion/utils").SerializedStyles;
|
|
13
|
+
stickyBottom: import("@emotion/utils").SerializedStyles;
|
|
12
14
|
headerFill: import("@emotion/utils").SerializedStyles;
|
|
15
|
+
footerFill: import("@emotion/utils").SerializedStyles;
|
|
13
16
|
text: import("@emotion/utils").SerializedStyles;
|
|
14
17
|
card: import("@emotion/utils").SerializedStyles;
|
|
15
18
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -33,11 +33,12 @@ export interface TableTheme<T = unknown> {
|
|
|
33
33
|
classes?: {
|
|
34
34
|
table?: string;
|
|
35
35
|
headerCell?: string;
|
|
36
|
+
footerCell?: string;
|
|
36
37
|
cell?: string | FunctionWithDeps<(item: T, index: number) => string | undefined>;
|
|
37
38
|
evenCell?: string;
|
|
38
39
|
oddCell?: string;
|
|
39
40
|
};
|
|
40
|
-
/**
|
|
41
|
+
/** Define components to be used in the table. */
|
|
41
42
|
components: {
|
|
42
43
|
IconButton: ComponentType<{
|
|
43
44
|
children: ReactNode;
|
|
@@ -170,11 +171,17 @@ export interface TableProps<T> extends PartialTableTheme<T> {
|
|
|
170
171
|
/** Whether to stretch the table component over the available space. If value is "left" or "right", align accordingly. */
|
|
171
172
|
fullWidth?: boolean | 'left' | 'right';
|
|
172
173
|
/** Whether the table header should be sticky.
|
|
173
|
-
* @default
|
|
174
|
+
* @default true
|
|
174
175
|
*/
|
|
175
176
|
stickyHeader?: boolean | {
|
|
176
177
|
top: number;
|
|
177
178
|
};
|
|
179
|
+
/** Whether the table footer should be sticky.
|
|
180
|
+
* @default true
|
|
181
|
+
*/
|
|
182
|
+
stickyFooter?: boolean | {
|
|
183
|
+
bottom: number;
|
|
184
|
+
};
|
|
178
185
|
/** Whether the table cells should only be rendered when in viewport.
|
|
179
186
|
* @default true
|
|
180
187
|
*/
|
|
@@ -236,7 +243,9 @@ export declare type Column<T, V> = {
|
|
|
236
243
|
*/
|
|
237
244
|
id?: string;
|
|
238
245
|
/** Render table header for this column. */
|
|
239
|
-
header?: ReactNode
|
|
246
|
+
header?: ReactNode | FunctionWithDeps<(values: V[], items: T[]) => ReactNode>;
|
|
247
|
+
/** Render table header for this column. */
|
|
248
|
+
footer?: ReactNode | FunctionWithDeps<(values: V[], items: T[]) => ReactNode>;
|
|
240
249
|
/** Extract value for this column */
|
|
241
250
|
value: FunctionWithDeps<(item: T) => V>;
|
|
242
251
|
/** Render table cell. If not provided, a string representation of the value will be rendered. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "schummar-table",
|
|
3
3
|
"repository": "schummar/schummar-table",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.2",
|
|
5
5
|
"description": "",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"docs:build": "npm -w docs run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@emotion/react": "^11.
|
|
61
|
+
"@emotion/react": "^11.9.0",
|
|
62
62
|
"dayzed": "^3.2.2",
|
|
63
63
|
"immer": "^9.0.12",
|
|
64
64
|
"schummar-state": "0.2.1-experimental-13"
|
|
@@ -84,21 +84,21 @@
|
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@emotion/styled": "^11.8.1",
|
|
87
|
-
"@material-ui/core": "^4.12.
|
|
88
|
-
"@mui/material": "^5.
|
|
87
|
+
"@material-ui/core": "^4.12.4",
|
|
88
|
+
"@mui/material": "^5.6.3",
|
|
89
89
|
"@types/react": "17",
|
|
90
90
|
"@types/react-dom": "^17.0.13",
|
|
91
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
92
|
-
"@typescript-eslint/parser": "^5.
|
|
93
|
-
"@vitejs/plugin-react": "^1.
|
|
94
|
-
"eslint": "^8.
|
|
91
|
+
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
92
|
+
"@typescript-eslint/parser": "^5.21.0",
|
|
93
|
+
"@vitejs/plugin-react": "^1.3.1",
|
|
94
|
+
"eslint": "^8.14.0",
|
|
95
95
|
"npm-run-all": "^4.1.5",
|
|
96
|
-
"prettier": "^2.
|
|
96
|
+
"prettier": "^2.6.2",
|
|
97
97
|
"react": "17",
|
|
98
98
|
"react-dom": "17",
|
|
99
99
|
"rimraf": "^3.0.2",
|
|
100
|
-
"typescript": "^4.6.
|
|
101
|
-
"vite": "^2.
|
|
100
|
+
"typescript": "^4.6.3",
|
|
101
|
+
"vite": "^2.9.5"
|
|
102
102
|
},
|
|
103
103
|
"files": [
|
|
104
104
|
"dist"
|