Closed infalmo closed 2 years ago
I did go through this, but it doesn't work in NextJS.
./node_modules/@toast-ui/editor/dist/toastui-editor.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/@glideapps/glide-data-grid-cells/dist/js/cells/article-cell-editor.js
Would it be possible to create a plugin system, where only the necessary custom cells are loaded and registered? Similar to how handsontable does it.
Look into how this is done here for dynamic loading in next. https://github.com/glideapps/glide-data-grid/tree/main/test-projects/next-gdg
Yep, I used next/dynamic
to load the grid, which works well until useExtraCells
is imported.
is your usage of useExtraCells
inside of the dynamic or outside of it? I don't think next should be loading it unless its outside the dynamic?
Yep, I'm using it within the component file loaded using next/dynamic
.
Of all data-grids I've used, this one has the most modular API and a clean UI. Extensibility of custom cells is a major lacking feature, that I'm willing to help contribute to.
wtf is going on with next loading the dep server side if its inside a dynamic. I thought the entire point of the dynamic was to prevent that...
As far as cell extensibility I am more than happy to have help here. What did you have in mind?
Here's my take on it:
useCustomCells(cells)
similar to this in the glide-data-grid
package, where the user passes an array of custom cells they want to use (instead of hardcoding it).glide-data-grid-cells
can then only contain implementations for common cell types, which can be individually imported by the user (allowing for tree shaking).I like it, glide-data-grid-cells
should keep its current super export but it can grow individual exports as well. This way we can maintain back compat.
Any way I can test the update? Maybe a beta release?
4.0.3-alpha2 should be out in 2 to 3 minutes
Can confirm (from limited testing) that useCustomCells
works as intended.
However, importing just DropdownCell
from glide-data-grid-cells
causes NextJS to throw the above mentioned error, so I suppose article cell editor is still being imported in some way or the other.
Would making each cell type a dedicated package (glide-data-grid-cells-dropdown
, glide-data-grid-cells-star
etc) be ideal? I can think of several advantages, including isolation of components and reduction of dependencies.
Can't think of any real downsides apart from having to publish several packages than one unified module.
how are you importing DropdownCell? you should be able to do import DropdownCell from "@glideapps/glide-data-grid/cells/dropdown-cell"
Oh, I did import { DropdownCell }
from @glideapps/glide-data-grid
. Will give that a spin, thanks!
Looking forward to hear if it works. I can't see why next wouldn't tree-shake that correctly.
./components/glideGrid/resources.js:2:0
Module not found: Package path ./dist/js/cells/star-cell is not exported from package /home/ubuntu/dev/et-app/node_modules/@glideapps/glide-data-grid-cells (see exports field in /home/ubuntu/dev/et-app/node_modules/@glideapps/glide-data-grid-cells/package.json)
1 | import DropdownCell from "@/components/glideGrid/customCells/dropdown"
> 2 | import StarCell from "@glideapps/glide-data-grid-cells/dist/js/cells/star-cell"
3 |
4 | import DataEditor, {
5 | GridCellKind,
This is however not related to the current issue, and is thus being closed.
Yes of course it is possible, when using with Next however it is
recommended to wrap the data grid in a component which is then imported as
a dynamic
. Canvas doesn't really render on the server correctly anyway.
On Wed, Apr 13, 2022 at 9:50 AM Adithya Dsilva @.***> wrote:
Would it be possible to create a plugin system, where only the necessary custom cells are loaded and registered? Similar to how handsontable https://handsontable.com does it.
— Reply to this email directly, view it on GitHub https://github.com/glideapps/glide-data-grid/issues/260#issuecomment-1098272649, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAHN225AWL733N5T6Y2HWDVE33L5ANCNFSM5TJT4LWQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Can you please provide an example on how to use the custom cells from
glide-data-grid-cells
? Also, how would I implement my own cell in my project?