Socket
Socket
Sign inDemoInstall

@openscd/oscd-tree-grid

Package Overview
Dependencies
4
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @openscd/oscd-tree-grid

An mwc-list based grid component for selecting subtrees from tree shaped data structures


Version published
Maintainers
4
Install size
11.0 MB
Created

Readme

Source

<oscd-tree-grid>

Installation

npm i oscd-tree-grid

Usage

<script type="module">
  import 'oscd-tree-grid';
</script>

<oscd-tree-grid filterLabel="Regular Expression"></oscd-tree-grid>

<script type="module">
  const oscdTree = document.querySelector('oscd-tree-grid');
  await oscdTree.updateComplete;

  const tree = await fetch('/tree.json').then(r => r.json());

  oscdTree.tree = tree;
</script>

TypeScript types

For use with TypeScript, oscd-tree-grid exports the following types:

export type TreeSelection = { [name: string]: TreeSelection };

export type Path = string[];

export type TreeNode = {
  children?: Tree;
  text?: string;
  mandatory?: boolean;
};

export type Tree = Partial<Record<string, TreeNode>>;

This webcomponent follows the open-wc recommendation.

oscd-tree-grid.ts:

class: TreeGrid

Superclass
NameModulePackage
LitElementlit
Fields
NamePrivacyTypeDefaultDescriptionInherited From
treeTree{}The `Tree` to be selected from
selectionTreeSelection{}Selected rows as `TreeSelection`
pathsPath[]Selected rows as `Path[]`
filterstringRegular expression by which to filter rows
filterLabelstring''Filter `TextField` label
Private API
Fields
NamePrivacyTypeDefaultDescriptionInherited From
depthprivatenumber
filterUIprivateTextField | undefined
filterRegexprivateRegExp
containerprivateElement | undefined
collapsedprivatenew Set<string>()
Methods
NamePrivacyDescriptionParametersReturnInherited From
getPathsprivatemaxLength: numberPath[]
treeNodeprivatepath: PathTreeNode
rowsprivatePath[]
renderCellprivatepath: Path, previousPath: PathTemplateResult
selectprivateparentPath: Path, clicked: stringvoid
selectAllprivateclicked: ListItemvoid
handleSelectedprivateevent: SingleSelectedEventPromise<void>
scrollRightprivatePromise<void>
renderColumnprivatecolumn: (Path | undefined)[]TemplateResult
renderExpandCellprivatepath: PathTemplateResult
toggleCollapseprivateserializedPath: string
renderExpandColumnprivaterows: Path[]TemplateResult
renderCollapseColumnprivaterows: Path[]TemplateResult
renderColumnsprivateTemplateResult
renderFilterFieldprivate

Exports

KindNameDeclarationModulePackage
jsTreeGridTreeGridoscd-tree-grid.ts

© 2023 OMICRON electronics GmbH

FAQs

Last updated on 27 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc