Comments (11)
Actually, combining it with this makes it actually work, but with the caveat that the table now renders with a stutter at first as the icons get imported at runtime instead of compile time
const [defaultIcons, setDefaultIcons] = useState<MRT_Icons>();
useEffect(() => {
const _loadIcons = async () => {
const icons = await loadIcons();
setDefaultIcons(icons);
};
_loadIcons();
}, []);
const _icons = useMemo(() => ({ ...defaultIcons, ...icons }), [defaultIcons, icons]);
This has been fun, and maybe I'll publish an experimental alpha for you to try @BennyAlex . I'm not sure if I should ship it though
from material-react-table.
Follow the full install instructions and you should be good https://www.material-react-table.com/docs/getting-started/install#install-with-required-peer-dependencies-(recommended)
If you are replacing all icons with your custom ones, I think they should get code splitted out
from material-react-table.
Actually after some testing, it looks like they don't get code splitted out. This could probably be improved.
from material-react-table.
@KevinVandy
Hello,
I also get this error, i only use the tabbler icons.
Can you maybe fix this error?
Thanks in advance :D
from material-react-table.
@KevinVandy
Hello,
I also get this error, i only use the tabbler icons.Can you maybe fix this error?
Thanks in advance :D
Even if you use other icons, you still have to install all of the peer dependencies
from material-react-table.
Yeah but the icons could be defined as optional peer dep
from material-react-table.
Yeah but the icons could be defined as optional peer dep
How would the imports work internally? I didn't know this was possible.
from material-react-table.
https://stackoverflow.com/questions/62047806/how-do-i-set-a-peer-dependency-optional
Maybe you can import icons dynamcially with import() only if its not set by the icons property?
from material-react-table.
@BennyAlex I've known that can be done in a normal app using webpack, but didn't know about rollup. Guess I'll try. Feel free to make a PR yourself too though if you want credit or know exactly what needs to be done
from material-react-table.
@BennyAlex I tried for 30 minutes and came up with this for icons.ts
, but still get errors. I'll see if anyone can build on this.
export interface MRT_Icons {
ArrowDownwardIcon: any;
ArrowRightIcon: any;
CancelIcon: any;
ClearAllIcon: any;
CloseIcon: any;
DensityLargeIcon: any;
DensityMediumIcon: any;
DensitySmallIcon: any;
KeyboardDoubleArrowDownIcon: any;
DragHandleIcon: any;
DynamicFeedIcon: any;
EditIcon: any;
ExpandMoreIcon: any;
FilterAltIcon: any;
FilterListIcon: any;
FilterListOffIcon: any;
FullscreenExitIcon: any;
FullscreenIcon: any;
MoreHorizIcon: any;
MoreVertIcon: any;
PushPinIcon: any;
RestartAltIcon: any;
SaveIcon: any;
SearchIcon: any;
SearchOffIcon: any;
SortIcon: any;
ViewColumnIcon: any;
VisibilityOffIcon: any;
}
export async function loadIcons() {
try {
const [
ArrowDownwardIcon,
ArrowRightIcon,
CancelIcon,
ClearAllIcon,
CloseIcon,
DensityLargeIcon,
DensityMediumIcon,
DensitySmallIcon,
DragHandleIcon,
DynamicFeedIcon,
EditIcon,
ExpandMoreIcon,
FilterAltIcon,
FilterListIcon,
FilterListOffIcon,
FullscreenExitIcon,
FullscreenIcon,
KeyboardDoubleArrowDownIcon,
MoreHorizIcon,
MoreVertIcon,
PushPinIcon,
RestartAltIcon,
SaveIcon,
SearchIcon,
SearchOffIcon,
SortIcon,
ViewColumnIcon,
VisibilityOffIcon,
] = await Promise.all([
import('@mui/icons-material/ArrowDownward')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/ArrowRight')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/Cancel')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/ClearAll')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/Close')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/DensityLarge')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/DensityMedium')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/DensitySmall')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/DragHandle')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/DynamicFeed')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/Edit')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/ExpandMore')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/FilterAlt')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/FilterList')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/FilterListOff')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/FullscreenExit')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/Fullscreen')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/KeyboardDoubleArrowDown')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/MoreHoriz')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/MoreVert')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/PushPin')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/RestartAlt')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/Save')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/Search')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/SearchOff')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/Sort')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/ViewColumn')
.then((module) => module.default)
.catch(() => null),
import('@mui/icons-material/VisibilityOff')
.then((module) => module.default)
.catch(() => null),
]);
return {
ArrowDownwardIcon,
ArrowRightIcon,
CancelIcon,
ClearAllIcon,
CloseIcon,
DensityLargeIcon,
DensityMediumIcon,
DensitySmallIcon,
DragHandleIcon,
DynamicFeedIcon,
EditIcon,
ExpandMoreIcon,
FilterAltIcon,
FilterListIcon,
FilterListOffIcon,
FullscreenExitIcon,
FullscreenIcon,
KeyboardDoubleArrowDownIcon,
MoreHorizIcon,
MoreVertIcon,
PushPinIcon,
RestartAltIcon,
SaveIcon,
SearchIcon,
SearchOffIcon,
SortIcon,
ViewColumnIcon,
VisibilityOffIcon,
};
} catch (error) {
return undefined;
}
}
from material-react-table.
Nice work.
Is the table currently that fast, that you dont have to show a loading indicator at first render (when working with large datasets)?
from material-react-table.
Related Issues (20)
- Pinning hidden columns with column virtualization causes error
- Show / hide all buttons don't update header group visibility state
- When using `enableRowVirtualization`, the layout of `filterVariant: 'datetime-range',` behaves improperly
- [UX] Pinning columns to the right pushes item to the bottom of menu
- Table Footer gets cut off in narrow scenarios
- Really strange issue HOT 7
- Localisation of filters does not apply to the filter menu HOT 1
- Show/hide filter triggers onColumnFiltersChange for backend pagination HOT 4
- "Show filter" triggers onColumnFiltersChange for backend pagination
- Mantine Filter Search Does Not Work Correctly and Highlight Words When Turkish Characters Are Used with Capslock On. HOT 2
- Virtualization is not working properly even on the documentation page! HOT 5
- Sticky Pinned Columns Misplacement in Material React Table for RTL Language
- MRT_TablePaper zIndex is lower than Appbar in Fullscreen
- Pinned columns collapsing even with layoutMode: 'grid-no-grow'
- Drag row exception when row virtualization is true HOT 1
- Header title has been dissapear from v10 to v11 HOT 1
- Pagination Container Box gets cut off when default font size is not 16px HOT 1
- [BUG] - Sub Row Selection not working correctly
- Mui palette theme problem HOT 1
- react-query/sandbox does not work properly in codesandbox.io
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-react-table.