@eeacms/volto-arcgis-block
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -7,4 +7,24 @@ ### Changelog | ||
#### [0.1.7](https://github.com/eea/volto-arcgis-block/compare/0.1.6...0.1.7) | ||
- Bugs n improvements [`#17`](https://github.com/eea/volto-arcgis-block/pull/17) | ||
- Merge pull request #20 from eea/bugs_n_improvements [`c59b800`](https://github.com/eea/volto-arcgis-block/commit/c59b800832a7d566585f9fd4b8a9208f566bd4da) | ||
- Merge pull request #19 from eea/active_by_default [`1737a36`](https://github.com/eea/volto-arcgis-block/commit/1737a3655ec94f0e6fd5e6900fdfb5ad0208e9c0) | ||
- eslint fixed [`df9dad5`](https://github.com/eea/volto-arcgis-block/commit/df9dad54d9dd658468deeaa5cf85945721d08ff1) | ||
- Print bug [`7644990`](https://github.com/eea/volto-arcgis-block/commit/7644990717c0192d4fb78f0cca411682af44833b) | ||
- version working [`fe5eb7c`](https://github.com/eea/volto-arcgis-block/commit/fe5eb7cdab05b85dabdd055c88133221e30208f5) | ||
- Print bug [`6ec6434`](https://github.com/eea/volto-arcgis-block/commit/6ec643442c6420841c97ca3b3db3338e7a825182) | ||
- toggleProduct [`948d750`](https://github.com/eea/volto-arcgis-block/commit/948d750e67ffff893254f855ac4671ff82ce2f86) | ||
- Print bug [`5590343`](https://github.com/eea/volto-arcgis-block/commit/5590343e061f28cbf4e7718d32a0e135c16e397f) | ||
- Print bug [`daafb78`](https://github.com/eea/volto-arcgis-block/commit/daafb787aa025a39dd940087f84d4255e603fc9c) | ||
- arrays for checkbox ok [`48b34cb`](https://github.com/eea/volto-arcgis-block/commit/48b34cba5ac6f1b1bb309386c7e6e1ea197b52d7) | ||
- fixed array dataset in products [`7c42783`](https://github.com/eea/volto-arcgis-block/commit/7c427835794c31530ea0f878319ee19d5b4dd5fc) | ||
- arrays to define check default [`88cbdbc`](https://github.com/eea/volto-arcgis-block/commit/88cbdbc23d524694a390d8646355795b1ad327b4) | ||
- Change config.js for test [`efb0c21`](https://github.com/eea/volto-arcgis-block/commit/efb0c21cdbc0028076348f5484e329a1fec59b4a) | ||
#### [0.1.6](https://github.com/eea/volto-arcgis-block/compare/0.1.5...0.1.6) | ||
> 8 October 2021 | ||
- Use cases map [`#16`](https://github.com/eea/volto-arcgis-block/pull/16) | ||
- Configured zoom out label and added to config file and set color for point-markers [`#15`](https://github.com/eea/volto-arcgis-block/pull/15) | ||
@@ -11,0 +31,0 @@ - Remove unused variables [`f4833ee`](https://github.com/eea/volto-arcgis-block/commit/f4833ee95782fdf0252db333eb5c8a1eb1d3cbe6) |
{ | ||
"name": "@eeacms/volto-arcgis-block", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "volto-arcgis-block: Volto add-on", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -25,2 +25,3 @@ const config = { | ||
'https://image.discomap.eea.europa.eu/arcgis/services/CoastalZones/CZ_CoastalZones_2012/MapServer/WmsServer?', | ||
Default_active: true, | ||
Layer: [ | ||
@@ -30,2 +31,3 @@ { | ||
Title: 'Coastal Zones 2012 vector', | ||
Default_active: false, | ||
}, | ||
@@ -35,2 +37,3 @@ { | ||
Title: 'Coastal Zones 2012 raster', | ||
Default_active: false, | ||
}, | ||
@@ -50,2 +53,3 @@ ], | ||
'https://image.discomap.eea.europa.eu/arcgis/services/CoastalZones/CZ_CoastalZones_2018/MapServer/WmsServer?', | ||
Default_active: true, | ||
Layer: [ | ||
@@ -55,2 +59,3 @@ { | ||
Title: 'Coastal Zones 2018 vector', | ||
Default_active: false, | ||
}, | ||
@@ -60,2 +65,3 @@ { | ||
Title: 'Coastal Zones 2018 raster', | ||
Default_active: false, | ||
}, | ||
@@ -76,2 +82,3 @@ ], | ||
'https://image.discomap.eea.europa.eu/arcgis/services/CoastalZones/CZ_CoastalZonesChange_2012_2018/MapServer/WmsServer?', | ||
Default_active: false, | ||
Layer: [ | ||
@@ -81,2 +88,3 @@ { | ||
Title: 'Coastal Zones Change 2012-2018 vector', | ||
Default_active: false, | ||
}, | ||
@@ -86,2 +94,3 @@ { | ||
Title: 'Coastal Zones Change 2012-2018 raster', | ||
Default_active: false, | ||
}, | ||
@@ -112,2 +121,3 @@ ], | ||
ViewService: 'https://cryo.land.copernicus.eu/wms/FSC/?', | ||
Default_active: false, | ||
Layer: [ | ||
@@ -117,2 +127,3 @@ { | ||
Title: 'FSC_TOC', | ||
Default_active: false, | ||
}, | ||
@@ -122,2 +133,3 @@ { | ||
Title: 'FSC_QC_TOC', | ||
Default_active: false, | ||
}, | ||
@@ -127,2 +139,3 @@ { | ||
Title: 'FSC_OG', | ||
Default_active: false, | ||
}, | ||
@@ -132,2 +145,3 @@ { | ||
Title: 'FSC_QC_OG', | ||
Default_active: false, | ||
}, | ||
@@ -137,2 +151,3 @@ { | ||
Title: 'FSC_NDSI', | ||
Default_active: false, | ||
}, | ||
@@ -142,2 +157,3 @@ { | ||
Title: 'FSC_CLD', | ||
Default_active: false, | ||
}, | ||
@@ -147,2 +163,3 @@ { | ||
Title: 'FSC_QC_FLAGS', | ||
Default_active: false, | ||
}, | ||
@@ -163,2 +180,3 @@ ], | ||
ViewService: 'https://cryo.land.copernicus.eu/wms/RLIE/?', | ||
Default_active: false, | ||
Layer: [ | ||
@@ -168,2 +186,3 @@ { | ||
Title: 'RLIE', | ||
Default_active: false, | ||
}, | ||
@@ -173,2 +192,3 @@ { | ||
Title: 'RLIE_QC', | ||
Default_active: false, | ||
}, | ||
@@ -178,2 +198,3 @@ { | ||
Title: 'RLIE_QC_FLAGS', | ||
Default_active: false, | ||
}, | ||
@@ -180,0 +201,0 @@ ], |
import React, { createRef } from 'react'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { loadModules, loadCss } from 'esri-loader'; | ||
// import { layer } from '@fortawesome/fontawesome-svg-core'; | ||
var WMSLayer; | ||
@@ -141,2 +142,3 @@ | ||
metodProcessProduct(product, prodIndex, inheritedIndex) { | ||
var dataset_def = []; | ||
var datasets = []; | ||
@@ -146,3 +148,10 @@ var index = 0; | ||
var checkProduct = 'map_product_' + inheritedIndexProduct; | ||
//Add only default datasets | ||
for (var i in product.Datasets) { | ||
if (product.Datasets[i].Default_active === true) { | ||
var idDataset = 'map_dataset_' + inheritedIndexProduct + '_' + index; | ||
dataset_def.push(idDataset); | ||
} | ||
datasets.push( | ||
@@ -159,2 +168,8 @@ this.metodProcessDataset( | ||
// Empty vector, add the first dataset | ||
if (!dataset_def.length) { | ||
var idDatasetB = 'map_dataset_' + inheritedIndexProduct + '_0'; | ||
dataset_def.push(idDatasetB); | ||
} | ||
return ( | ||
@@ -188,4 +203,5 @@ <div | ||
key={'h' + prodIndex} | ||
defcheck={dataset_def} | ||
onChange={(e) => | ||
this.toggleProduct(e.target.checked, checkProduct) | ||
this.toggleProduct(e.target.checked, checkProduct, e) | ||
} | ||
@@ -226,3 +242,4 @@ ></input> | ||
let trueCheck = datasetChecks.filter((elem) => elem.checked).length; | ||
productCheck.checked = datasetChecks.length === trueCheck; | ||
productCheck.checked = trueCheck > 0; | ||
} | ||
@@ -239,2 +256,3 @@ | ||
metodProcessDataset(dataset, datIndex, inheritedIndex, checkProduct) { | ||
var layer_default = []; | ||
var layers = []; | ||
@@ -246,2 +264,6 @@ var index = 0; | ||
for (var i in dataset.Layer) { | ||
if (dataset.Layer[i].Default_active === true) { | ||
layer_default.push(dataset.Layer[i].LayerId); | ||
} | ||
layers.push( | ||
@@ -254,2 +276,3 @@ this.metodProcessLayer( | ||
checkIndex, | ||
layer_default, | ||
), | ||
@@ -260,2 +283,5 @@ ); | ||
if (!layer_default.length) { | ||
layer_default.push(dataset.Layer[0].LayerId); | ||
} | ||
// ./dataset-catalogue/dataset-info.html | ||
@@ -277,6 +303,7 @@ // ./dataset-catalogue/dataset-download.html | ||
value="name" | ||
defcheck={layer_default} | ||
className="ccl-checkbox ccl-required ccl-form-check-input" | ||
key={'c' + datIndex} | ||
onChange={(e) => { | ||
this.toggleDataset(e.target.checked, checkIndex); | ||
this.toggleDataset(e.target.checked, checkIndex, e.target); | ||
}} | ||
@@ -318,3 +345,3 @@ ></input> | ||
* Method to uncheck dataset checkbox if not all layers are checked | ||
* @param {*} id | ||
* @param {*} id parentId (id del dataset) | ||
*/ | ||
@@ -327,4 +354,7 @@ | ||
); | ||
let trueChecks = layerChecks.filter((elem) => elem.checked).length; | ||
datasetCheck.checked = layerChecks.length === trueChecks; | ||
//solo tiene que tener alguno length >0 | ||
datasetCheck.checked = trueChecks > 0; | ||
this.updateCheckProduct(datasetCheck.getAttribute('parentid')); | ||
@@ -447,5 +477,8 @@ } | ||
* @param {*} id | ||
* @param {*} element | ||
*/ | ||
toggleDataset(value, id) { | ||
var layerChecks = document.querySelectorAll('[parentid=' + id + ']'); | ||
toggleDataset(value, id, e) { | ||
var layerdef = e.getAttribute('defcheck'); | ||
var layerChecks = document.querySelectorAll('[id=' + layerdef + ']'); | ||
layerChecks.forEach((element) => { | ||
@@ -459,10 +492,20 @@ element.checked = value; | ||
* Method to show/hide all the datasets of a product | ||
* @param {*} value | ||
* @param {*} value (e.target.checked) | ||
* @param {*} id | ||
* @param {*} element (checkbox) | ||
*/ | ||
toggleProduct(value, id) { | ||
var datasetChecks = document.querySelectorAll('[parentid=' + id + ']'); | ||
toggleProduct(value, id, element) { | ||
var productDefCheck = element.target.getAttribute('defcheck'); | ||
var splitdefCheck = productDefCheck.split(','); | ||
var datasetChecks = []; | ||
var selector = []; | ||
for (var i = 0; i < splitdefCheck.length; i++) { | ||
selector = document.querySelector('[id=' + splitdefCheck[i] + ']'); | ||
datasetChecks.push(selector); | ||
} | ||
datasetChecks.forEach((element) => { | ||
element.checked = value; | ||
this.toggleDataset(value, element.id); | ||
this.toggleDataset(value, element.id, element); | ||
}); | ||
@@ -469,0 +512,0 @@ } |
@@ -24,3 +24,3 @@ import React, { createRef } from 'react'; | ||
this.textMaxLength = 180; | ||
this.sizeMax = 6000; | ||
this.sizeMax = 15000; | ||
this.dpiMax = 1200; | ||
@@ -94,2 +94,6 @@ this.scaleMax = 600000000; | ||
optSVGZ && optSVGZ.parentElement.removeChild(optSVGZ); | ||
let advanceOptions = document.querySelector( | ||
'.esri-print__advanced-options-button', | ||
); | ||
observer2.observe(advanceOptions, { attributes: true }); | ||
} else { | ||
@@ -102,2 +106,15 @@ this.setLayoutConstraints(); | ||
observer.observe(mapOnly, { attributes: true }); | ||
var observer2 = new MutationObserver((mutations) => { | ||
mutations.forEach((mutation) => { | ||
if (mutation.attributeName === 'aria-expanded') { | ||
let currentExpand = mutation.target.getAttribute('aria-expanded'); | ||
if (currentExpand === 'true') { | ||
this.setTextFilters(); | ||
} else { | ||
this.setLayoutConstraints(); | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -141,13 +158,22 @@ | ||
imposeMax(el) { | ||
if (el.value !== '') { | ||
if (parseInt(el.value) < parseInt(el.min)) { | ||
el.value = el.min; | ||
imposeMax(elem) { | ||
if (elem.value !== '') { | ||
if (parseInt(elem.value) < parseInt(elem.min)) { | ||
elem.value = elem.min; | ||
} | ||
if (parseInt(el.value) > parseInt(el.max)) { | ||
el.value = el.max; | ||
if (parseInt(elem.value) > parseInt(elem.max)) { | ||
elem.value = elem.max; | ||
} | ||
} else { | ||
elem.value = elem.value.replace(/[^e+-,.]/gi, ''); | ||
} | ||
} | ||
noSpecialNumbs(e) { | ||
var invalidChars = ['-', '+', 'e', ',', '.']; | ||
if (invalidChars.includes(e.key)) { | ||
e.preventDefault(); | ||
} | ||
} | ||
setTextFilters() { | ||
@@ -184,2 +210,5 @@ let inputs = document.querySelectorAll('input.esri-print__input-text'); | ||
}; | ||
input.onkeydown = (e) => { | ||
this.noSpecialNumbs(e); | ||
}; | ||
} | ||
@@ -186,0 +215,0 @@ }); |
Sorry, the diff of this file is not supported yet
10492925
4695