Comments (9)
I'll think about it
from svelte-grid.
@frantic0 Maybe it's something similar to what you're looking for, https://layout-master.now.sh/ ?
This is the only thing I wrote on svelte and svelte-grid
https://github.com/vaheqelyan/layout-master
from svelte-grid.
I did this little demo repl
Check it out, too
from svelte-grid.
Tagging this because I may want to do something similar: persistence of layouts and some degree of hierarchy.
from svelte-grid.
thanks @vaheqelyan! I'll have a look
from svelte-grid.
Hi @vaheqelyan,
thanks, your demo repl made me understand better how to use 'svelte:component' for the subcomponent hierarchies.
However, I still think it doesn't show to use of subcomponent hierarchies with hierarchical state stores. Especially with dynamic components such as the grid-items of svelte-grid...
I forked your repl and tried to evolved it to try to show the problem better... Have a look at this fork:
I tweaked a new component from the svelte:self example that builds a component tree from a JSON with a hierarchical a filesystem-like tree and editable elements.
One thing to notice is if you collapse a folder and increment a counter, the tree is re-rendered.
Some questions:
How would you implement the update method for the items store in such a way that would support the renaming of each "folder" in the tree?
How would you structure the store differently to prevent the re-rendering of the whole svelte-grid?
How would you structure the store differently, if you didn't care about the total re-rendering?
Thanks!
from svelte-grid.
Just noticed something else, @vaheqelyan ...
In the repl, the Random component is getting updated but not triggering a total re-rendering... How come?
from svelte-grid.
repl. Simple recursion is used. every time you rename a folder name, you update all the items. The update occurs when the input is blurred. I know the interface isn't the best. (It is for quick work.)
I assign the _type
property and creating another store.
export let xxx = writable({
'tree': {} || [] // data
})
all your reading and writing takes place here
import { xxx } from './stores.js'
$xxx['tree'].property
file tree -> $xxx['tree']
counter -> $xxx['counter']
something unique -> $xxx[_type] || $xxx[id]
from svelte-grid.
Hi @vaheqelyan,
thanks for this, and apologies for letting all this time go by without following up...
I understand your solution, you extracted a new store to recursively update the tree state of the Folder component. It works well for reading and writing with one fixed Folder component.
However, how would you go at implementing a store the Folder components dynamically?
from svelte-grid.
Related Issues (20)
- how to change svlt-grid-resizer? HOT 3
- Docu Bug? HOT 1
- Add ability to limit rows
- Uncaught TypeError: columns.slice is not a function HOT 1
- Items slow to reposition on resize HOT 2
- Excellent lib but is it being maintained ? HOT 6
- Inicial value of 'lastTime' in throttle function is correct?
- min height based on width. Fixed ratio HOT 1
- min, max position on x, y
- Add background grid borders
- Why there are two backgrounds HOT 2
- Prompt error in the latest svelte
- Documentation for cols property HOT 2
- Intersection event & prevent grid from repositioning it's blocks
- Freeze and unfreeze grid HOT 1
- Drag only when clicked on hot-corner HOT 1
- Items overlapping issue HOT 8
- rowHeight HOT 1
- "Unable to Limit Grid Element Resizing Beyond Parent Div"
- Height based on content
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 svelte-grid.