leaflet-panel-layers icon indicating copy to clipboard operation
leaflet-panel-layers copied to clipboard

checkboxes for groups to (de)select all layers at once

Open Istador opened this issue 2 years ago • 0 comments

This will add an optional new feature, that can be activated with the groupCheckboxes option.

When activated it will add checkboxes to the groups. These checkboxes allow to select or unselect all layers in a group with one click.

If there are layers in a group that are selected and others that are not selected, then the new checkbox will be shown as indeterminate.

The action performed in the indeterminate state (select all or unselect all) will be determined by majority. Meaning that if there are more layers checked than unchecked it will unselect all, whereas if there are more layers unchecked than checked, it will select all.


I also updated all npm dependencies. Instead of 5 warnings and 68 vulnerabilities, npm install now outputs 0 warnings and 0 vulnerabilities (for now).

Before:

$ npm install
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm notice created a lockfile as package-lock.json. You should commit this file.
added 74 packages from 134 contributors and audited 74 packages in 7.581s
found 68 vulnerabilities (9 low, 19 moderate, 32 high, 8 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

I originally developed this two years ago in my fork https://github.com/Istador/leaflet-panel-layers/commit/5477189e36679b603eaca137e72862dfe9c84b65 and used it since then at my Pine Interactive Map. I couldn't create a PR for it back then directly, because I also changed all the whitespace before implementing it. And now I want to get rid of my fork, so I reapplied the changes for this feature while sticking to the coding style. (I already mentioned it here: https://github.com/stefanocudini/leaflet-panel-layers/pull/52#issuecomment-568610720.)

I've took the base code from another fork https://github.com/syonfox/leaflet-panel-layers/commit/634e4ec0fec8e1cb37c703a7f27236918c00c280 and https://github.com/syonfox/leaflet-panel-layers/commit/b2ca82965b552593c2722dba1e291084e22e36eb and refined it a bit.

Istador avatar Mar 03 '22 21:03 Istador