Comments (3)
If you don't need renaming and file creation capabilities, you can create a basic "filesystem" adapter. TreeModel
requires a host with function getItems
which will be called initially for the root path, and then later as the user expands directories. The path will be formatted depending on what you specify for pathStyle
i.e win32
or unix
, latter recommended.
Then you need to rig your getItems
callback to translate requested path to actual location of entity in your "object". Probably by traversing recursively and drilling down by each "path segment" until you hit the thing. You can use splitPath
from path-fx
library to split a path like "/root/Child - 3/Child - 4"
to an array of keys like ["root", "Child - 3", "Child - 4"]
.
Then just walk the keys recursively.
See also:
https://github.com/NeekSandhu/react-aspen-demo/blob/master/demo/index.tsx#L25-L38
https://github.com/NeekSandhu/react-aspen-demo/blob/master/demo/index.tsx#L40
https://github.com/NeekSandhu/react-aspen-demo/blob/master/demo/index.tsx#L70
Basically you should just fork the react-aspen-demo
repo to get a boost
from aspen.
Did this solve your problem?
from aspen.
Closing due to inactivity
from aspen.
Related Issues (16)
- Covert this repo to a monorepo HOT 4
- Expand all initially? HOT 4
- Large data hangs the page and it crashes HOT 3
- is alive? HOT 2
- ensureVisible inside useEffect and "two children with the same key" HOT 9
- Supporting windowing back to server-side HOT 3
- Improve NPM searchability HOT 2
- Getting a FileEntry by path HOT 7
- Find another filesystem watcher to recommend
- Uncaught Error: orphaned/detached FileEntries don't have path (except Root) HOT 6
- Allow getting current scroll HOT 8
- Ability to set scroll offset without using the DOM directly
- PromptHandle.ProxiedInput only supports className, style, and id props HOT 2
- Aspen 2 release discussion HOT 14
- Looking for project maintainers/contributors HOT 6
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 aspen.