Code Monkey home page Code Monkey logo

cosmoz-treenode-navigator's Introduction

cosmoz-treenode-navigator

Build Status semantic-release

cosmoz-treenode-navigator is a Polymer component that lets you navigate and search through hierarchically structured data-nodes and select one of them.

It needs an object structure which looks for example like this in JSON:

{
	"1": {
		"name": "Root",
		"children": {
			"7": {
				"name": "child seven",
				"children": {

				}
			},
			"8": {
				"name": "child eight",
				"children": {
					"9": {
						"name": "child nine",
						"children": {

						}
					}
				}
			}
		}
	}
}

The property names "name" and "children" are configurable in the component through the setting of "childProperty" and "comparisonProperty".

cosmoz-treenode-navigator's People

Contributors

angrynerds-weronika avatar cristinecula avatar dependabot[bot] avatar depfu[bot] avatar dotpointer avatar jaysunsyn avatar jockeck avatar megheaiulian avatar nomego avatar plequang avatar programmer4web avatar semantic-release-bot avatar wurper avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cosmoz-treenode-navigator's Issues

Restore reset/no-reset functionality

By default, cosmoz-treenode-navigator-button should have an "X" to allow the user to clear the selection.
Unless noReset is set.

This feature does not seem to work any more and should be restored.
Also a demo should be added.

List goes below viewport height when filled

The list of the cosmoz-treenode-navigator goes down beyond the screen height if the list is filled with more items than could be viewed on the screen. User cannot reach the bottom nor buttons in the dialog. A workaround is to select something, then use the Tab key and then Enter to get through it.

The failing line is 35 in cosmoz-treenode-navigator.html:
max-height: var(--cosmoz-treenode-navigator-max-height, 70vh);

Lowering the viewport height value makes it work as expected:
max-height: var(--cosmoz-treenode-navigator-max-height, 40vh);

Upgrade to 2.x

Refresh this repo to go 2.x:

  • Upgrade to Polymer CLI 1.8 (Fixes build error on node 10)
  • Delete and regenerate yarn.lock, package-lock.json (Might fix one or more security alerts)
  • Switch to .nvmrc (Copy from cosmoz-behaviors)
  • Switch to headless browsers on Travis, drop sudo requirement, drop dist: trusty configuration to run on default
  • Drop 1.x testing (bower_components-1.x/, bower-1.x.json, --variants install, bower.json variants, #1 - 2 version mask -> #^2.x.x semver
  • Add Sauce Labs configuration
  • Switch from local Firefox test to Sauce Labs (Fixes current geckodriver issue with FF63)
  • Switch to polymer-2 linting ruleset (polymer.json)
  • Upgrade to Polymer 2.x native guidelines (class-based elements, drop this.fire(), etc, etc, see https://www.polymer-project.org/2.0/docs/upgrade)

Focus search field

When the cosmoz-treenode-button-view is used, the resulting cosmoz-treenode-selector should focus the search-field so the user can search immediately.

Setting a node by property does not select the node in list

It does not work to pre-select a node. The button shows that the node is selected, but when the button is clicked then the node is not selected in the list and it defaults to the root node.

To test on alpha go to a path locator beneath 1 using the URL (important), note that the button shows the path, then click on the button and note that the list is on the root node and the item on the button is not selected.

Not sure if the problem is in the component or in the front-end, but I found no way the data could flow from selectedNode to highlightedNode, only the opposite, and the format of the object coming in on selectedNode differs from what the iron-list sets on highlightedNode, where the first has a pathLocator propety but the second seems to use path for the same thing.

Depfu Error: No dependency files found

Hello,

We've tried to activate or update your repository on Depfu and couldn't find any supported dependency files. If we were to guess, we would say that this is not actually a project Depfu supports and has probably been activated by error.

Monorepos

Please note that Depfu currently only searches for your dependency files in the root folder. We do support monorepos and non-root files, but don't auto-detect them. If that's the case with this repo, please send us a quick email with the folder you want Depfu to work on and we'll set it up right away!

How to deactivate the project

  • Go to the Settings page of either your own account or the organization you've used
  • Go to "Installed Integrations"
  • Click the "Configure" button on the Depfu integration
  • Remove this repo (Neovici/cosmoz-treenode-navigator) from the list of accessible repos.

Please note that using the "All Repositories" setting doesn't make a lot of sense with Depfu.

If you think that this is a mistake

Please let us know by sending an email to [email protected].


This is an automated issue by Depfu. You're getting it because someone configured Depfu to automatically update dependencies on this project.

Transition on navigating

When navigating between levels in the tree, we should slide the new level in, much like the "Gmail Drive organizer" widget.

cosmoz-treenode-button-view displays incorrect labels for certain node names because of rtl

Description

When node names contains only numbers, <cosmoz-treenode-button-view> display the selected path reverted.
For example, assuming a tree with 3 nodes named "1" > "2" > "3", when selecting node "3", the button should display "1 / 2 / 3" but displays "3 / 2/ 1".

This is because the button text uses direction: rtl, in order to be able to make "left ellipsis" on the button text when it's too big. Even though this is a common workaround, we should not used that as this it not reliable.
It is probably better to use standard left ellipsis, and having a title with the complete text.

Selection:
image

Result:
image

I tried to write a unit test in test/cosmoz-treenode-button-view_test.html, but I don't know how I could get the text really displayed.

I've created a demo page that demonstrate the issue, available at http://127.0.0.1:8081/components/cosmoz-treenode-navigator/demo/rtl.html

Clicking on the house icon or a node of the current location change the hash part of the URL

Description

When clicking on the "house" icon, or if present any node in the current location at the top of the component, it sets the hash part of the URL to #.

To reproduce, run polymer serve in the repository, then open demo page with the following url:
http://127.0.0.1:8081/components/cosmoz-treenode-navigator/demo/#some/hash/parameter

Then click on the "no selection made", and click on the "House" icon => the hash part is cleared.

Expected behavior

It should not change the hash part, as it might be used by other components in the page (like a router component that use the hash part of the url to decide which view to display).

Tree node keyboard navigation

Enable the user to navigate the cosmoz tree node selector by using keyboard only.

Node list

Arrow navigation:

  • Up/down (already works)
  • Right (further down the tree)
  • Left : backwards

Click enter to select node.

Free text search navigation

  • Search for a node in the search field (inside the tree node navigator)
  • Auto focus on the first seach item in the results (ATM the user needs to manually click the search result before enabling browsing using arrow keys)
  • Use arrow down/up keys to browse the nodes in the search
  • Click enter to select node

Uncaught error when selecting a root node that lacks ancestor(s).

Description

When selecting either "John" or "Public" in the second example of the demo page, an uncaught error is thrown in cosmoz-treenode-navigator.

The example uses a tree sample (in demo/data/johnFiles.json) where the nodes "John" and "Public" are lacking their root node in the tree data.

hidden select a node button

See end of discussion #25

  • Hiding the button makes buttonTextPlaceholder = "Select a node" useless.
  • It breakes the demo as the button to open the dialog gets hidden.
    image
  • _getButtonLabel(nodesOnNodePath, buttonTextPlaceholder) returns the placeholder if nodesOnNodePath is undefined as buttonTextPlaceholder is defined.

I think the actual problem arises if nodesOnNodePath has undefined values as nodes.

e.g. [{name: 'Node 1'}, undefined, {name: 'Node 3'}]

_getButtonLabel doesn't do any undefined checks.

return pathParts.map(part => part[this.tree.searchProperty]).join(' / ');

We might want to:

  • even filter out undefined nodes in cosmoz-treenode-navigator's _normalizeNodes
  • or handle undefined nodes in cosmoz-treenode-button-view's _getButtonLabel

instead of hiding it. What do you think?

Also regarding https://github.com/Neovici/cosmoz-frontend/issues/67

Ref: #26

Convert cosmoz-treenode-navigator to haunted/lit.

Convert the cosmoz-treenode-navigator component to haunted.

cosmoz-treenode-navigator has the following structural components/parts:

  • path - the node/tree path
  • input - used as query text to search for nodes -> use cosmoz-input instead
  • list - a iron-list elemenet to show a virtualized list of nodes -> just render them all / not virtualized
  • a retry button - to search globally -> use a simple html button element.

Conversion approach:

  1. Extract as much code as possible in pure functions (e.g. _normalizeNodes, _getNode)
  2. create a TreeNodeNavigator function/component and convert the template
  3. write a useTreeNodeNavigator() function linking all the pure functions and render related code

It shouldn't be possible to select a non-value

Right now it is possible to select a node in one level, navigate to another level, and then press "Choose" (Select?) button and get a non-value selected.

This should not be possible.

  • "Choose"-button should be disabled when no value is selected

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.