openscd / oscd-filtered-list Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Npm publish command wants to publish this package as a private package. This should be a public package
Currently in the OscdFilteredList there are no types exported for the elements it encapsulates.
For instance I might want to type in my code:
Should this component be exporting some types to assist users with this?
Normally when we didn't fully encapsulate I would do something like:
import type { ListItemBase } from '@material/mwc-list/mwc-list-item-base.js';
I am not very proficient with types so please let me know if this is not the correct way this should be done.
To improve performance with a large number of list items, I suggest using a debounce on the @input
for the search box, something like:
function debounce(callback: any, delay = 250) {
let timeout: any;
return (...args: any) => {
clearTimeout(timeout);
timeout = setTimeout(() => {
callback(...args);
}, delay);
};
}
onFilterInput = debounce(() => {
Array.from(
this.querySelectorAll(
'mwc-list-item, mwc-check-list-item, mwc-radio-list-item'
)
).forEach(item =>
hideFiltered(item as ListItemBase, this.searchField.value)
);
}, 500);
My use case is that the filtered list becomes unresponsive in a large (or even not so large file) when the full scd file's ExtRefs are shown in a single filtered list in the oscd-subscriber-later-binding plugin (in the subscriber view)
I found this article on debouncing/throttling helpful: https://blog.webdevsimplified.com/2022-03/debounce-vs-throttle/
This helps for moderate sized lists but not adequately for large lists but is probably worth doing any way. It is very likely that we should choose a number slightly lower than 500 ms (250? 300? 350? 400?)
This is for a file which has about 3620 ExtRef elements. Quite a few of these are "empty" but many relays fully expose their maximum capability in the quantity of ExtRefs they export.
IEC61850_GOOSE_2-section.scd.zip
I think this is a realistic scenario - we use schemes like this in production now.
Documentation still needs to be added and a deploy is also needed in the package.json
Acceptance criteria:
Use the ADR format;
Discuss with the community
We now have a component guide (https://github.com/openscd/.github/blob/23491bd2408f3b7edaa8b0149a3d57aca1adaf40/docs/component_guide.md) where an explaination can be found on what a component should have. Some changes need to be made to the filtered-list to follow these rules.
Definition of Done:
As a plugin author and maintainer of already existing plugins, I need to have open-scd
s filtered-list
available through nmp.
Requirements:
filtered-list
to oscd-filtered-list
repooscd-filtered-list
mwc-list
but use it in the render
methodname | type | description |
---|---|---|
searchFieldLabel | string | text on the filter textbox |
disableCheckAll | boolean | disable the "check all" button |
filter | string | the current value of the filter textbox |
wrapFocus | boolean | whether focus wraps around the end and beginning of the list |
multi | boolean | multi-select |
activatable | boolean | color icons permanently on clicking |
@action | event | fired before selection is made (find out: is this actually needed?) |
@selected | event | fired after selection is made |
TODO: search codebase for instances of filtered-list
usage and add any properties/events/methods used that are not listed here.
selected
event for any changes on maybeValue
...
event for any changes on ...
Additional Information
This web-component is used pretty much everywhere in the software
As a user of the oscd-filtered-list I would like to avoid having browser performance issues with the "Select All" button when the list is too large.
Because the types aren't in the packages.json it isnt possible to import types from the module. This can be fixed by adding the types to the packages.json
Similar to #8, SCD files can have very large numbers of ExtRefs and a debounce is insufficient to provide adequate performance.
I would like to see the oscd-filtered-list carry out lazy indexing and perhaps show a light coloured "progress of index" background in the search field.
I'm not sure from a technology point of view how to implement this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.