Giter Site home page Giter Site logo

tree3's Introduction

Tree3 tag

A simple tree tag

Initial ideas

If you can express it in HTML then you can express it in JS

By default, any HTML code defacto is a tree. The main key is the CSS set of rules we want to apply in order to represent a tree following the Material Design's principles.

Docs

Tests

How to use

If you're planning to use this tree then don't forget to add the following polyfills:

<script src="/bower_components/array-includes/array-includes.js"></script>
<script src="/bower_components/element-matches/closest.js"></script>
<script src="/bower_components/customevent-polyfill/customevent-polyfill.min.js"></script>

In order to initiate the tree, add to any mdl-list component the class mdl-tree3

tree3's People

Contributors

rianby64 avatar elmario89 avatar azizmuradovar avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

elmario89

tree3's Issues

TypeError: Unable to get property 'contextItems' of undefined or null reference

https://sentry.io/3-constructora-sas/tree3/issues/202153068/

TypeError: Unable to get property 'contextItems' of undefined or null reference
  at l (/docs/scripts/docstrap.lib.js:3:26419)
  at o (/docs/scripts/docstrap.lib.js:3:28106)
  at a (/docs/scripts/docstrap.lib.js:3:31267)
  at a.Sunlight.highlightAll (/docs/scripts/docstrap.lib.js:4:320)
  at Anonymous function (/docs/tutorial-simpleTree.html:268:2)
...
(5 additional frame(s) were not displayed)

Define two type of leafs

Leafs can be

  • Normal leaf with keyboard_arrow_down as expanded or keyboard_arrow_up as collapsed, and
  • Link leaf with keyboard_arrow_left as link to an upper level.

Let's try the following simple idea:
If user expands the tree from the root, then the expanded leaf will show its children-leafs, and let's call this list - level 1.

If user expands the tree from any level 1 leaf, then

  1. Let's call the expanded leaf list - level 2
  2. The level 1's parent become a Link leaf and all siblings hide in favour of showing the level 2 as the main list
  3. If user expands the tree from any level 2 leaf, then - repeat this list from 1.
  4. Any new Link leaf will be added via appendChild

If the user clicks on any Link leaf then its tree will be rendered and any child expanded leaf will collapse back...

Add some necessary features

HTML, JS Linter, Live Reload and Babel JS are minimal required features that must be present in this development.

Show /doc as main page

I don't know how to "link" /docs/index.html with ./index.html

The motivation to do this "link" is because I want to show

  • README.md
  • /demo
  • /doc
  • /test

Desired behavior when creating a new leaf

A simple case at demo3

Current case:

  1. Add a new item from the splash
  2. Click on the three dots
  3. The leaf disappears

Desired case:

  1. Add a new item
  2. If no label - set the three dots disabled
  3. If click on any place of the current leaf return the focus to the input
  4. If click on any other place - remove the leaf

Add any doc generator

I want to expose the documentation for this repo. And I want to see it via /docs URL.

Define the parentLeaf property

If the leaf is a root leaf then leaf.parentLeaf == null;
If the leaf is not a root leaf then leaf.parentLeaf == parent where parent is the parent leaf.

Tree3 rename to MaterialTree3

const classAsString = 'Tree3'; change to has the correct value and check tests... If this requires a big effort, then leave it as is.

Allow the tree to appendLeaf without dispatching addleaf event

The tree can appendLeaf()

  1. when clicking on "Add" item in the context menu
  2. when authors desire to appendLeaf() via script in order to add a full-described leaf.

The second case shouldn't

  • dispatch the addleaf event
  • open the input, focus and set its cursor

The second case should just create an empty leaf that will be filled with some information.

Add the textContent getter/setter to leafs

The desired behavior is

var leaf = tree3.createLeaf();
leaf.textContent = "a label";

Then, internally should happen...

leaf.querySelector('.mdl-tree3__leaf-text').textContent = "a label";

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.