naver / egjs-grid Goto Github PK
View Code? Open in Web Editor NEWA component that can arrange items according to the type of grids
Home Page: https://naver.github.io/egjs-grid/
License: Other
A component that can arrange items according to the type of grids
Home Page: https://naver.github.io/egjs-grid/
License: Other
TypeError when run 'type check' command
error TS2322: Type '{ gap: number; defaultDirection: string; columnRange: number[]; rowRange: number; sizeRange: number[]; isCroppedSize: boolean; displayedRow: number; autoResize: true; class: string; }' is not assignable to type 'ComponentProps<VueGridInterface<typeof JustifiedGrid>>'.
Type '{ gap: number; defaultDirection: string; columnRange: number[]; rowRange: number; sizeRange: number[]; isCroppedSize: boolean; displayedRow: number; autoResize: true; class: string; }' is missing the following properties from type 'VueGridInterface<typeof JustifiedGrid>': $el, $_grid, $props, syncElements, and 6 more.
76 <JustifiedGrid
"@egjs/vue-grid": "^1.11.2",
"vue": "^3.2.45"
"typescript": "^4.9.4",
"vite": "^4.0.4",
"vue-tsc": "^1.0.24"
I want to keep the size even if the ratio is broken.
Trying to work this out through playing with it.
https://naver.github.io/egjs-grid/storybook/?path=/story/examples-framegrid--frame-grid-template
1,1,2,2,3,3,2,2,4,4,4,5
but when i put that in, there's a storybook form validation error (the input field is red) and nothing is rendered[[1,1,2,2,3,3],[2,2,4,4,4,5]]
then it rendersLooking at the resulting output
edit it just dawned on my that you're using frame to define named grid slots:
https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template
const grid = new FrameGrid();
grid.renderItems({
outline: [100, 100],
});
The priority that determines the weight of the item.
item.style.height = "100px";
(render)
=> item.style.height = "0px";
(render)
=> item.style.height = "100px";
(not rendered)
I want to detect resize by applying ResizeObserver to items(children).
No event occurs in react.
<MasonryGrid onRenderComplete={e => {
console.log(e);
}} />
<!--item1 has the same size.-->
<div class="item item1" data-grid-size-group="1"></div>
<div class="item item1" data-grid-size-group="1"></div>
<!--item2 has the same size.-->
<div class="item item2" data-grid-size-group="2"></div>
<div class="item item2" data-grid-size-group="2"></div>
safari 15.3. Below, borderBoxSize and contentBoxSize do not exist.
<div class="container" style="border: 3px solid black; box-sizing: border-box">
<div></div>
<div></div>
<div></div>
</div>
gridRef.current!.getContainerElement();
<JustifiedGrid tag="ul" ref={gridRef}>
<li class="item"></li>
</JustifiedGrid>
and I want to know the container element of the corresponding Grid.
<div class="container" style="overflow: hidden;">
<!-- row 1 -->
<div class="item"></div>
<div class="item"></div>
<!-- row 2 -->
<div class="item"></div>
<!-- row 3 -->
<div class="item"></div>
</div>
I want to display only row 2 on the screen.
Running a toy example of egjs-grid for svelte, and I'm getting the error in the title.
import { JustifiedGrid } from "@egjs/svelte-grid";
const gap = 5;
const defaultDirection = "end";
const rowRange = 0;
const columnRange = [1,8];
const sizeRange = [200,1000];
const isCroppedSize = false;
const displayedRow = -1;
</script>
<JustifiedGrid
class="container"
{defaultDirection}
{gap}
{rowRange}
{columnRange}
{sizeRange}
{isCroppedSize}
{displayedRow}
>
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
<div class="item">8</div>
<div class="item">9</div>
<div class="item">10</div>
</JustifiedGrid>```
When using egjs/react-grid, the container of MasonryGrid is set to div
by default. Can I change this to ul
?
If it is unmounted and then mounted, it does not appear properly.
Hey y'all. The issue I'm experiencing is that on first render MasonryGrid comes through undefined causing my app to crash. I've fixed the issue by adding a {Boolean(MasonryGrid) && ...(<MasonryGrid>....
where I'm using the library but that seems odd. I'm putting this here to see if anyone else is experiencing the issue or if this is a known problem.
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
I'm just importing MasonryGrid into my react component and using it with "gap" and "column" props.
When using native lazy loading, the width and height are rendered abnormally.
<img src="..." loading="lazy" />
grid.on("renderComplete", e => {
console.log(e.direction);
});
The mountState of an item that is not actually inserted is incorrect.
<div class="item" style="width: 50%"></div>
<div class="item" style="width: 50%"></div>
I am trying to implement a masonry layout using the svelte package but it doesn't align anything, it doesn't even modify the children
<MasonryGrid column={4} columnSize={200} align={'end'}>
{#each category.posters as card}
<Card {card} />
{/each}
</MasonryGrid>
Images are rendered but as a list instead of a grid. Also, console gives some errors:
[HMR][Svelte] Unrecoverable HMR error in <App>: next update will trigger a full reload proxy.js:15:11
logError http://localhost:5173/node_modules/svelte-hmr/runtime/proxy.js?v=1b726137:15
Proxy<App> http://localhost:5173/node_modules/svelte-hmr/runtime/proxy.js?v=1b726137:380
<anonymous> http://localhost:5173/src/main.js:4
Uncaught TypeError: options.props is undefined
JustifiedGrid JustifiedGrid.js:11
instance Grid.svelte:51
run index.mjs:20
mount_component index.mjs:1953
flush index.mjs:1191
init index.mjs:2048
App App.svelte:426
createProxiedComponent svelte-hooks.js:341
ProxyComponent proxy.js:242
Proxy<App> proxy.js:349
<anonymous> main.js:4
Uncaught (in promise) TypeError: grid is undefined
Using a clean svelte + vite project (no sveltekit)
1.- Create new svelte project with vite
npm create vite@latest
select vanilla svelte and javascript
2.- Replace App.svelte contents file with storybook example
Node: v18.12.1
Svelte: 3.54.0
egjs-grid: 1.11.2
The ratio of invisible items in InfiniteGrid is strange.
Some of the APIs are Vue3.
function render(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createBlock("div", _hoisted_1, [vue.renderSlot(_ctx.$slots, "default")], 512
/* NEED_PATCH */
);
}
I want to keep the ratio as an element rather than an offset in JustifiedGrid
<div class="item" data-grid-content-offset="40">
<img />
</div>
<div class="item">
<img data-grid-maintained-target=""/>
</div>
grid.renderItems({
outline: [100]
});
// prevent moving to the top 0
ColumnSize of MasonryGrid changes css style.
naver/egjs-infinitegrid#458
It seems to be similar with naver/egjs-infinitegrid#505 (comment)
this is error log
/* empty css */import { MasonryGrid as MasonryGrid$1 } from "@egjs/grid";
^^^^^^^^^^^
SyntaxError: Named export 'MasonryGrid' not found. The requested module '@egjs/grid' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@egjs/grid';
const { MasonryGrid: MasonryGrid$1 } = pkg;
update to svelte-kit latest version
and npm run build
0 is recognized as false and sizeGroup does not operate.
HI? when i upload my component it has height: 34px;
How to updated, and were i have get found the doxs for vue 3 ?
Support re-render for align stretch
ig.on("contentError", e => {
console.log(e.item.element, e.target);
});
Justified grid doesn't re-render items if their sizes change.
I fetch multiple images but the initial grid stays, how do I re-render the grid to dynamically resize every item if they change?
My code:
...
const [images, setImages] = useState<any[]>([])
...
<JustifiedGrid
gap={5}
defaultDirection={"end"}
align={'justify'}
columnRange={[1,4]}
rowRange={0}
sizeRange={[100,500]}
isCroppedSize={false}
displayedRow={-1}
useResizeObserver={true}
observeChildren={true}
autoResize={true}
>
{images.map((x: any, index: number) => (
<div key={index} className='w-full overflow-hidden'>
<Image src={x?.url} alt='' className='' />
</div>
))}
</JustifiedGrid>
Here's the result:
<div class="item">
<img />
<div class="title">Item 1</div>
</div>
I want to calculate ratio excluding the title area.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.