1.1.1 • Published 8 months ago

@openscd/oscd-filtered-list v1.1.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
8 months ago

\

This webcomponent follows the open-wc recommendation.

Installation

npm i @openscd/oscd-filtered-list

Usage

<script type="module">
  import 'oscd-filtered-list';
</script>

<oscd-filtered-list></oscd-filtered-list>

Linting and formatting

To scan the project for linting and formatting errors, run

npm run lint

To automatically fix linting and formatting errors, run

npm run format

Testing with Web Test Runner

To execute a single test run:

npm run test

To run the tests in interactive watch mode run:

npm run test:watch

Demoing with Storybook

To run a local instance of Storybook for your component, run

npm run storybook

To build a production version of Storybook, run

npm run storybook:build

Tooling configs

For most of the tools, the configuration is in the package.json to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

Icon font

Material Icons are being used for the icons. This font needs to be added in the html first. You can add it like so:

<link
  href="https://fonts.googleapis.com/css?family=Material+Icons&display=block"
  rel="stylesheet"
/>

Local Demo with web-dev-server

npm start

To run a local development server that serves the basic demo located in demo/index.html

src/OscdFilteredList.ts:

Exports

KindNameDeclarationModulePackage
custom-element-definitionoscd-filtered-listOscdFilteredList/src/oscd-filtered-list.js
jsOscdFilteredListOscdFilteredListsrc/OscdFilteredList.ts

src/oscd-filtered-list.ts:

class: OscdFilteredList, oscd-filtered-list

Superclass

NameModulePackage
LitElementlit-element

Fields

NamePrivacyTypeDefaultDescriptionInherited From
searchFieldLabelstring \| undefinedsearch mwc-textfield label property
disableCheckAllbooleanfalseWhether the check all option (checkbox next to search text field) is activated
filterstring \| undefinedThe current input value of the filter textbox
wrapFocusbooleanfalseWhen `true`, pressing `up` on the keyboard when focused on the first item will focus the last item and `down` when focused on the last item will focus the first item.
multibooleanfalseWhen `true`, enables selection of multiple items. This will result in `index` being of type `Set\` and selected returning `ListItemBase[]`.
activatablebooleanfalseSets activated attribute on selected items which provides a focus-persistent highlight.
listList
selectedCurrently-selected list item(s). When `multi` is `true`, `selected` is of type `ListItemBase[]` and when `false`, `selected` is of type `ListItemBase`. `selected` is `null` when no item is selected.
indexIndex / indices of selected item(s). When `multi` is `true`, `index` is of type `number` and when `false`, `index` is of type `Set\`. Unset indicies are `-1` and empty `Set\` for single and multi selection respectively.
itemsArray<ListItem>[]All list items that are available for selection. Eligible items have the `[mwc-list-item]` attribute which `ListItemBase` applies automatically.
searchFieldTextField

Methods

NamePrivacyDescriptionParametersReturnInherited From
onFilterInputvoid

Events

NameTypeDescriptionInherited From
actionActionEventFired when a selection has been made via click or keyboard action.
selectedSelectedEventFired when a selection has been made. `index` is the selected index (will be of type `Set\` if multi and `number` if single), and `diff` (of type `IndexDiff`\*\*) represents the diff of added and removed indices from previous selection.

Functions

NameDescriptionParametersReturn
redispatchEventelement: LitElement, event: Event

Exports

KindNameDeclarationModulePackage
jsredispatchEventredispatchEventsrc/oscd-filtered-list.ts
jsOscdFilteredListOscdFilteredListsrc/oscd-filtered-list.ts

© 2023 Alliander N.V.