ar-poncho 2.1.80 → 2.1.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/poncho.css +29 -22
- package/dist/css/poncho.min.css +29 -22
- package/dist/js/poncho.js +254 -1
- package/dist/js/poncho.min.js +1 -1
- package/gulpfile.js +2 -3
- package/package.json +1 -1
package/dist/css/poncho.css
CHANGED
|
@@ -12835,33 +12835,33 @@ input[type=search].js-poncho-map-search__input::-webkit-search-cancel-button {
|
|
|
12835
12835
|
}
|
|
12836
12836
|
|
|
12837
12837
|
.border {
|
|
12838
|
-
border-style: solid;
|
|
12839
|
-
border-width: 1px;
|
|
12840
|
-
border-color: var(--arg-gray-light);
|
|
12838
|
+
border-style: solid !important;
|
|
12839
|
+
border-width: 1px !important;
|
|
12840
|
+
border-color: var(--arg-gray-light) !important;
|
|
12841
12841
|
}
|
|
12842
12842
|
|
|
12843
12843
|
.border-top {
|
|
12844
|
-
border-top-style: solid;
|
|
12845
|
-
border-top-width: 1px;
|
|
12846
|
-
border-top-color: var(--arg-gray-light);
|
|
12844
|
+
border-top-style: solid !important;
|
|
12845
|
+
border-top-width: 1px !important;
|
|
12846
|
+
border-top-color: var(--arg-gray-light) !important;
|
|
12847
12847
|
}
|
|
12848
12848
|
|
|
12849
12849
|
.border-bottom {
|
|
12850
|
-
border-bottom-style: solid;
|
|
12851
|
-
border-bottom-width: 1px;
|
|
12852
|
-
border-bottom-color: var(--arg-gray-light);
|
|
12850
|
+
border-bottom-style: solid !important;
|
|
12851
|
+
border-bottom-width: 1px !important;
|
|
12852
|
+
border-bottom-color: var(--arg-gray-light) !important;
|
|
12853
12853
|
}
|
|
12854
12854
|
|
|
12855
12855
|
.border-right {
|
|
12856
|
-
border-right-style: solid;
|
|
12857
|
-
border-right-width: 1px;
|
|
12858
|
-
border-right-color: var(--arg-gray-light);
|
|
12856
|
+
border-right-style: solid !important;
|
|
12857
|
+
border-right-width: 1px !important;
|
|
12858
|
+
border-right-color: var(--arg-gray-light) !important;
|
|
12859
12859
|
}
|
|
12860
12860
|
|
|
12861
12861
|
.border-left {
|
|
12862
|
-
border-left-style: solid;
|
|
12863
|
-
border-left-width: 1px;
|
|
12864
|
-
border-left-color: var(--arg-gray-light);
|
|
12862
|
+
border-left-style: solid !important;
|
|
12863
|
+
border-left-width: 1px !important;
|
|
12864
|
+
border-left-color: var(--arg-gray-light) !important;
|
|
12865
12865
|
}
|
|
12866
12866
|
|
|
12867
12867
|
.border-0 {
|
|
@@ -12885,15 +12885,15 @@ input[type=search].js-poncho-map-search__input::-webkit-search-cancel-button {
|
|
|
12885
12885
|
}
|
|
12886
12886
|
|
|
12887
12887
|
.border-medium {
|
|
12888
|
-
border-width: 2px;
|
|
12888
|
+
border-width: 2px !important;
|
|
12889
12889
|
}
|
|
12890
12890
|
|
|
12891
12891
|
.border-thick {
|
|
12892
|
-
border-width: 3px;
|
|
12892
|
+
border-width: 3px !important;
|
|
12893
12893
|
}
|
|
12894
12894
|
|
|
12895
12895
|
.border-heavy {
|
|
12896
|
-
border-width: 6px;
|
|
12896
|
+
border-width: 6px !important;
|
|
12897
12897
|
}
|
|
12898
12898
|
|
|
12899
12899
|
.border-arg-default {
|
|
@@ -12917,7 +12917,7 @@ input[type=search].js-poncho-map-search__input::-webkit-search-cancel-button {
|
|
|
12917
12917
|
}
|
|
12918
12918
|
|
|
12919
12919
|
.border-arg-arena {
|
|
12920
|
-
border-color: var(--arg-arena);
|
|
12920
|
+
border-color: var(--arg-arena) !important;
|
|
12921
12921
|
}
|
|
12922
12922
|
|
|
12923
12923
|
.border-arg-rojo {
|
|
@@ -16398,7 +16398,7 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16398
16398
|
.details-display details {
|
|
16399
16399
|
--figure-width: 1.15rem;
|
|
16400
16400
|
--figure-text-gap: 10px;
|
|
16401
|
-
--figure-color:
|
|
16401
|
+
--figure-color: var(--arg-secundario);
|
|
16402
16402
|
--figure-font-size: 1.5em;
|
|
16403
16403
|
--summary-font-size: 1em;
|
|
16404
16404
|
}
|
|
@@ -16420,7 +16420,6 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16420
16420
|
.details-display summary:has(.figure) {
|
|
16421
16421
|
font-size: var(--summary-font-size);
|
|
16422
16422
|
gap: var(--figure-text-gap);
|
|
16423
|
-
color: var(--arg-secundario);
|
|
16424
16423
|
}
|
|
16425
16424
|
.details-display summary:has(i.fa-2x) i,
|
|
16426
16425
|
.details-display summary .figure {
|
|
@@ -16444,7 +16443,7 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16444
16443
|
.details-display.details-display-md > details, .details-display.details-display-lg > details {
|
|
16445
16444
|
--figure-width: 1.15rem;
|
|
16446
16445
|
--figure-text-gap: 10px;
|
|
16447
|
-
--figure-color:
|
|
16446
|
+
--figure-color: var(--arg-secundario);
|
|
16448
16447
|
--figure-font-size: 1.5em;
|
|
16449
16448
|
--summary-font-size: 1em;
|
|
16450
16449
|
/* Global componente */
|
|
@@ -16455,6 +16454,14 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16455
16454
|
align-self: start;
|
|
16456
16455
|
}
|
|
16457
16456
|
}
|
|
16457
|
+
/*
|
|
16458
|
+
Ajusta el icono cuando se utiliza details-display con un icono dentro
|
|
16459
|
+
de un container
|
|
16460
|
+
*/
|
|
16461
|
+
.details-container.details-display:has(i) summary {
|
|
16462
|
+
padding-left: 9px;
|
|
16463
|
+
}
|
|
16464
|
+
|
|
16458
16465
|
/* FORMULARIOS Y SELECT2 */
|
|
16459
16466
|
/* Oculta selección previa de meses */
|
|
16460
16467
|
#filter-cuando + .select2-container .select2-selection__choice {
|
package/dist/css/poncho.min.css
CHANGED
|
@@ -12835,33 +12835,33 @@ input[type=search].js-poncho-map-search__input::-webkit-search-cancel-button {
|
|
|
12835
12835
|
}
|
|
12836
12836
|
|
|
12837
12837
|
.border {
|
|
12838
|
-
border-style: solid;
|
|
12839
|
-
border-width: 1px;
|
|
12840
|
-
border-color: var(--arg-gray-light);
|
|
12838
|
+
border-style: solid !important;
|
|
12839
|
+
border-width: 1px !important;
|
|
12840
|
+
border-color: var(--arg-gray-light) !important;
|
|
12841
12841
|
}
|
|
12842
12842
|
|
|
12843
12843
|
.border-top {
|
|
12844
|
-
border-top-style: solid;
|
|
12845
|
-
border-top-width: 1px;
|
|
12846
|
-
border-top-color: var(--arg-gray-light);
|
|
12844
|
+
border-top-style: solid !important;
|
|
12845
|
+
border-top-width: 1px !important;
|
|
12846
|
+
border-top-color: var(--arg-gray-light) !important;
|
|
12847
12847
|
}
|
|
12848
12848
|
|
|
12849
12849
|
.border-bottom {
|
|
12850
|
-
border-bottom-style: solid;
|
|
12851
|
-
border-bottom-width: 1px;
|
|
12852
|
-
border-bottom-color: var(--arg-gray-light);
|
|
12850
|
+
border-bottom-style: solid !important;
|
|
12851
|
+
border-bottom-width: 1px !important;
|
|
12852
|
+
border-bottom-color: var(--arg-gray-light) !important;
|
|
12853
12853
|
}
|
|
12854
12854
|
|
|
12855
12855
|
.border-right {
|
|
12856
|
-
border-right-style: solid;
|
|
12857
|
-
border-right-width: 1px;
|
|
12858
|
-
border-right-color: var(--arg-gray-light);
|
|
12856
|
+
border-right-style: solid !important;
|
|
12857
|
+
border-right-width: 1px !important;
|
|
12858
|
+
border-right-color: var(--arg-gray-light) !important;
|
|
12859
12859
|
}
|
|
12860
12860
|
|
|
12861
12861
|
.border-left {
|
|
12862
|
-
border-left-style: solid;
|
|
12863
|
-
border-left-width: 1px;
|
|
12864
|
-
border-left-color: var(--arg-gray-light);
|
|
12862
|
+
border-left-style: solid !important;
|
|
12863
|
+
border-left-width: 1px !important;
|
|
12864
|
+
border-left-color: var(--arg-gray-light) !important;
|
|
12865
12865
|
}
|
|
12866
12866
|
|
|
12867
12867
|
.border-0 {
|
|
@@ -12885,15 +12885,15 @@ input[type=search].js-poncho-map-search__input::-webkit-search-cancel-button {
|
|
|
12885
12885
|
}
|
|
12886
12886
|
|
|
12887
12887
|
.border-medium {
|
|
12888
|
-
border-width: 2px;
|
|
12888
|
+
border-width: 2px !important;
|
|
12889
12889
|
}
|
|
12890
12890
|
|
|
12891
12891
|
.border-thick {
|
|
12892
|
-
border-width: 3px;
|
|
12892
|
+
border-width: 3px !important;
|
|
12893
12893
|
}
|
|
12894
12894
|
|
|
12895
12895
|
.border-heavy {
|
|
12896
|
-
border-width: 6px;
|
|
12896
|
+
border-width: 6px !important;
|
|
12897
12897
|
}
|
|
12898
12898
|
|
|
12899
12899
|
.border-arg-default {
|
|
@@ -12917,7 +12917,7 @@ input[type=search].js-poncho-map-search__input::-webkit-search-cancel-button {
|
|
|
12917
12917
|
}
|
|
12918
12918
|
|
|
12919
12919
|
.border-arg-arena {
|
|
12920
|
-
border-color: var(--arg-arena);
|
|
12920
|
+
border-color: var(--arg-arena) !important;
|
|
12921
12921
|
}
|
|
12922
12922
|
|
|
12923
12923
|
.border-arg-rojo {
|
|
@@ -16398,7 +16398,7 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16398
16398
|
.details-display details {
|
|
16399
16399
|
--figure-width: 1.15rem;
|
|
16400
16400
|
--figure-text-gap: 10px;
|
|
16401
|
-
--figure-color:
|
|
16401
|
+
--figure-color: var(--arg-secundario);
|
|
16402
16402
|
--figure-font-size: 1.5em;
|
|
16403
16403
|
--summary-font-size: 1em;
|
|
16404
16404
|
}
|
|
@@ -16420,7 +16420,6 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16420
16420
|
.details-display summary:has(.figure) {
|
|
16421
16421
|
font-size: var(--summary-font-size);
|
|
16422
16422
|
gap: var(--figure-text-gap);
|
|
16423
|
-
color: var(--arg-secundario);
|
|
16424
16423
|
}
|
|
16425
16424
|
.details-display summary:has(i.fa-2x) i,
|
|
16426
16425
|
.details-display summary .figure {
|
|
@@ -16444,7 +16443,7 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16444
16443
|
.details-display.details-display-md > details, .details-display.details-display-lg > details {
|
|
16445
16444
|
--figure-width: 1.15rem;
|
|
16446
16445
|
--figure-text-gap: 10px;
|
|
16447
|
-
--figure-color:
|
|
16446
|
+
--figure-color: var(--arg-secundario);
|
|
16448
16447
|
--figure-font-size: 1.5em;
|
|
16449
16448
|
--summary-font-size: 1em;
|
|
16450
16449
|
/* Global componente */
|
|
@@ -16455,6 +16454,14 @@ Cuando un elemento en inferior al breakpoint los caret cambian el tamaño
|
|
|
16455
16454
|
align-self: start;
|
|
16456
16455
|
}
|
|
16457
16456
|
}
|
|
16457
|
+
/*
|
|
16458
|
+
Ajusta el icono cuando se utiliza details-display con un icono dentro
|
|
16459
|
+
de un container
|
|
16460
|
+
*/
|
|
16461
|
+
.details-container.details-display:has(i) summary {
|
|
16462
|
+
padding-left: 9px;
|
|
16463
|
+
}
|
|
16464
|
+
|
|
16458
16465
|
/* FORMULARIOS Y SELECT2 */
|
|
16459
16466
|
/* Oculta selección previa de meses */
|
|
16460
16467
|
#filter-cuando + .select2-container .select2-selection__choice {
|
package/dist/js/poncho.js
CHANGED
|
@@ -5434,6 +5434,7 @@ class PonchoMap {
|
|
|
5434
5434
|
constructor(data, options){
|
|
5435
5435
|
const defaults = {
|
|
5436
5436
|
pan_by: true,
|
|
5437
|
+
render_schema: true,
|
|
5437
5438
|
accesible_menu_extras: [
|
|
5438
5439
|
{
|
|
5439
5440
|
label: "map_help_us",
|
|
@@ -5685,6 +5686,7 @@ class PonchoMap {
|
|
|
5685
5686
|
...options.template_structure
|
|
5686
5687
|
};
|
|
5687
5688
|
this.debug = opts.debug;
|
|
5689
|
+
this.render_schema = Boolean(opts.render_schema);
|
|
5688
5690
|
this.template_innerhtml = opts.template_innerhtml;
|
|
5689
5691
|
this.template_markdown = opts.template_markdown;
|
|
5690
5692
|
this.markdown_options = opts.markdown_options;
|
|
@@ -5893,6 +5895,8 @@ class PonchoMap {
|
|
|
5893
5895
|
}
|
|
5894
5896
|
|
|
5895
5897
|
this.ponchoLoaderTimeout;
|
|
5898
|
+
|
|
5899
|
+
|
|
5896
5900
|
}
|
|
5897
5901
|
|
|
5898
5902
|
|
|
@@ -5900,7 +5904,7 @@ class PonchoMap {
|
|
|
5900
5904
|
* Versión poncho
|
|
5901
5905
|
*/
|
|
5902
5906
|
get version(){
|
|
5903
|
-
return "2.2.
|
|
5907
|
+
return "2.2.3";
|
|
5904
5908
|
}
|
|
5905
5909
|
|
|
5906
5910
|
|
|
@@ -9472,6 +9476,29 @@ class PonchoMap {
|
|
|
9472
9476
|
}
|
|
9473
9477
|
|
|
9474
9478
|
|
|
9479
|
+
/**
|
|
9480
|
+
* Retorna el texto del summary
|
|
9481
|
+
*
|
|
9482
|
+
* @returns {string}
|
|
9483
|
+
* @todo Unificar la condición con _addSummary
|
|
9484
|
+
*/
|
|
9485
|
+
_summaryText = () => {
|
|
9486
|
+
if(typeof this.summary === "boolean"){
|
|
9487
|
+
return "";
|
|
9488
|
+
}
|
|
9489
|
+
if(this.isEmptyObject(this.summary) || this.isEmptyString(this.summary)){
|
|
9490
|
+
return "";
|
|
9491
|
+
}
|
|
9492
|
+
if(this.isString(this.summary)){
|
|
9493
|
+
return this.summary;
|
|
9494
|
+
}
|
|
9495
|
+
if(this.isObject(this.summary) && Object.hasOwn(this.summary, "title")){
|
|
9496
|
+
return this.summary.title;
|
|
9497
|
+
}
|
|
9498
|
+
return "";
|
|
9499
|
+
}
|
|
9500
|
+
|
|
9501
|
+
|
|
9475
9502
|
/**
|
|
9476
9503
|
* Agrega un summary para identificar el propósito del mapa
|
|
9477
9504
|
*
|
|
@@ -9600,6 +9627,31 @@ class PonchoMap {
|
|
|
9600
9627
|
};
|
|
9601
9628
|
|
|
9602
9629
|
|
|
9630
|
+
/**
|
|
9631
|
+
* Genera e inserta el schema JSON-LD en el `<head>` del documento.
|
|
9632
|
+
*
|
|
9633
|
+
* @returns {undefined}
|
|
9634
|
+
*/
|
|
9635
|
+
_renderSchema = () => {
|
|
9636
|
+
if(!this.render_schema){
|
|
9637
|
+
return;
|
|
9638
|
+
}
|
|
9639
|
+
try {
|
|
9640
|
+
const sch = new PonchoMapSchema(
|
|
9641
|
+
this.entries,
|
|
9642
|
+
{
|
|
9643
|
+
scope: this.scope,
|
|
9644
|
+
summary: this._summaryText(),
|
|
9645
|
+
id_key: this.id
|
|
9646
|
+
}
|
|
9647
|
+
);
|
|
9648
|
+
sch.render();
|
|
9649
|
+
} catch (error) {
|
|
9650
|
+
this.logger.warn("No se puede crear Schema/JSON-LD");
|
|
9651
|
+
}
|
|
9652
|
+
};
|
|
9653
|
+
|
|
9654
|
+
|
|
9603
9655
|
/**
|
|
9604
9656
|
* Hace el render del mapa.
|
|
9605
9657
|
*/
|
|
@@ -9642,6 +9694,8 @@ class PonchoMap {
|
|
|
9642
9694
|
this._listeners();
|
|
9643
9695
|
this.layerViewConf.setVisuals();
|
|
9644
9696
|
this.setMapAlignment(this.map_align);
|
|
9697
|
+
|
|
9698
|
+
this._renderSchema();
|
|
9645
9699
|
};
|
|
9646
9700
|
};
|
|
9647
9701
|
// end class
|
|
@@ -11329,7 +11383,10 @@ class PonchoMapFilter extends PonchoMap {
|
|
|
11329
11383
|
this.setMapAlignment(this.map_align);
|
|
11330
11384
|
this._resetSearch();
|
|
11331
11385
|
this._clickToggleFilter();
|
|
11386
|
+
|
|
11387
|
+
this._renderSchema();
|
|
11332
11388
|
};
|
|
11389
|
+
|
|
11333
11390
|
};
|
|
11334
11391
|
// end of class
|
|
11335
11392
|
|
|
@@ -12168,6 +12225,202 @@ function ponchoMapTplSearch(data){
|
|
|
12168
12225
|
return container.outerHTML;
|
|
12169
12226
|
}
|
|
12170
12227
|
|
|
12228
|
+
/**
|
|
12229
|
+
* PONCHO MAP SCHEMA
|
|
12230
|
+
*
|
|
12231
|
+
* @summary Genera un schema JSON-LD (schema.org/ItemList) con los
|
|
12232
|
+
* marcadores del mapa para mejorar el SEO.
|
|
12233
|
+
*
|
|
12234
|
+
* @author Agustín Bouillet <abouillet@sicyt.gob.ar>
|
|
12235
|
+
* @requires leaflet.js, leaflet.markercluster.js, leaflet.css,
|
|
12236
|
+
* MarkerCluster.Default.css, MarkerCluster.css, PonchoMap,
|
|
12237
|
+
* PonchoMapFilter
|
|
12238
|
+
* @see https://github.com/argob/poncho/blob/master/src/demo/poncho-maps/readme-poncho-maps.md
|
|
12239
|
+
*
|
|
12240
|
+
*
|
|
12241
|
+
* MIT License
|
|
12242
|
+
*
|
|
12243
|
+
* Copyright (c) 2026 Argentina.gob.ar
|
|
12244
|
+
*
|
|
12245
|
+
* Permission is hereby granted, free of charge, to any person
|
|
12246
|
+
* obtaining a copy of this software and associated documentation
|
|
12247
|
+
* files (the "Software"), to deal in the Software without
|
|
12248
|
+
* restriction, including without limitation the rights to use,
|
|
12249
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or
|
|
12250
|
+
* sell copies of the Software, and to permit persons to whom the
|
|
12251
|
+
* Software is furnished to do so, subject to the following
|
|
12252
|
+
* conditions:
|
|
12253
|
+
*
|
|
12254
|
+
* The above copyright notice and this permission notice shall be
|
|
12255
|
+
* included in all copies or substantial portions of the Software.
|
|
12256
|
+
*
|
|
12257
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
12258
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
12259
|
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
12260
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
12261
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
12262
|
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
12263
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
12264
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
|
12265
|
+
*/
|
|
12266
|
+
class PonchoMapSchema {
|
|
12267
|
+
/**
|
|
12268
|
+
* @param {Array} data - Array de features GeoJSON tipo Point.
|
|
12269
|
+
* @param {Object} [options={}] - Opciones de configuración.
|
|
12270
|
+
* @param {string} [options.summary="Mapa de ubicaciones"] -
|
|
12271
|
+
* Nombre descriptivo del listado para el schema.
|
|
12272
|
+
*/
|
|
12273
|
+
constructor(data, options = {}) {
|
|
12274
|
+
const { origin = "", pathname = "" } = location ?? {};
|
|
12275
|
+
this.location = `${origin}${pathname}`;
|
|
12276
|
+
|
|
12277
|
+
const defaults = {
|
|
12278
|
+
summary: "Mapa de ubicaciones",
|
|
12279
|
+
scope: "pmSchema",
|
|
12280
|
+
id_key: "id"
|
|
12281
|
+
};
|
|
12282
|
+
const opts = Object.assign({}, defaults, options);
|
|
12283
|
+
this.summary = String(opts.summary || defaults.summary);
|
|
12284
|
+
this.scope = String(opts.scope);
|
|
12285
|
+
this.id_key = opts.id_key;
|
|
12286
|
+
this.data = data;
|
|
12287
|
+
}
|
|
12288
|
+
|
|
12289
|
+
/**
|
|
12290
|
+
* Genera el objeto raíz del schema JSON-LD (ItemList).
|
|
12291
|
+
*
|
|
12292
|
+
* @param {Array} [items=[]] - Lista de elementos ListItem.
|
|
12293
|
+
* @returns {Object} Objeto schema.org/ItemList.
|
|
12294
|
+
*/
|
|
12295
|
+
header = (items = []) => {
|
|
12296
|
+
if(items.length < 1){
|
|
12297
|
+
return false;
|
|
12298
|
+
}
|
|
12299
|
+
return {
|
|
12300
|
+
"@context": "https://schema.org",
|
|
12301
|
+
"@type": "ItemList",
|
|
12302
|
+
"name": this.summary,
|
|
12303
|
+
"itemListElement": items
|
|
12304
|
+
}
|
|
12305
|
+
};
|
|
12306
|
+
|
|
12307
|
+
|
|
12308
|
+
/**
|
|
12309
|
+
* Crea un elemento ListItem a partir de un feature GeoJSON.
|
|
12310
|
+
*
|
|
12311
|
+
* Valida que el feature tenga geometría de tipo Point y que
|
|
12312
|
+
* sus propiedades incluyan `name` e `id`.
|
|
12313
|
+
*
|
|
12314
|
+
* @param {number} position - Posición del elemento en la lista.
|
|
12315
|
+
* @param {Object} entry - Feature GeoJSON.
|
|
12316
|
+
* @returns {Object|undefined} Objeto schema.org/ListItem, o
|
|
12317
|
+
* undefined si el feature no es válido.
|
|
12318
|
+
*/
|
|
12319
|
+
item = (position, entry) => {
|
|
12320
|
+
if (!entry?.geometry || !entry?.properties) {
|
|
12321
|
+
return;
|
|
12322
|
+
}
|
|
12323
|
+
if (entry.geometry.type !== "Point") {
|
|
12324
|
+
return;
|
|
12325
|
+
}
|
|
12326
|
+
const [latitude, longitude] = entry.geometry.coordinates;
|
|
12327
|
+
const { name } = entry.properties;
|
|
12328
|
+
const id = entry.properties[this.id_key];
|
|
12329
|
+
|
|
12330
|
+
if (!name || !id) {
|
|
12331
|
+
console.warn(
|
|
12332
|
+
"La entrada no tiene 'name' o 'id' en properties.",
|
|
12333
|
+
entry
|
|
12334
|
+
);
|
|
12335
|
+
return;
|
|
12336
|
+
}
|
|
12337
|
+
|
|
12338
|
+
const safeId = encodeURIComponent(id);
|
|
12339
|
+
return {
|
|
12340
|
+
"@type": "ListItem",
|
|
12341
|
+
position,
|
|
12342
|
+
"item": {
|
|
12343
|
+
"@type": "Place",
|
|
12344
|
+
name,
|
|
12345
|
+
"geo": {
|
|
12346
|
+
"@type": "GeoCoordinates",
|
|
12347
|
+
latitude,
|
|
12348
|
+
longitude
|
|
12349
|
+
},
|
|
12350
|
+
"url": `${this.location}#${safeId}`
|
|
12351
|
+
}
|
|
12352
|
+
};
|
|
12353
|
+
};
|
|
12354
|
+
|
|
12355
|
+
|
|
12356
|
+
/**
|
|
12357
|
+
* Construye el schema completo como objeto JSON-LD.
|
|
12358
|
+
*
|
|
12359
|
+
* @returns {Object} Schema JSON-LD listo para serializar.
|
|
12360
|
+
*/
|
|
12361
|
+
schema = () => this.header(this.createItems(this.data));
|
|
12362
|
+
|
|
12363
|
+
|
|
12364
|
+
/**
|
|
12365
|
+
* Recorre el array de datos y genera los ListItem válidos.
|
|
12366
|
+
*
|
|
12367
|
+
* @param {Array} data - Array de features GeoJSON.
|
|
12368
|
+
* @returns {Array} Array de objetos ListItem.
|
|
12369
|
+
*/
|
|
12370
|
+
createItems = (data) =>
|
|
12371
|
+
data.reduce((collector, entry, index) => {
|
|
12372
|
+
const schemaItem = this.item(index + 1, entry);
|
|
12373
|
+
if (schemaItem) {
|
|
12374
|
+
collector.push(schemaItem);
|
|
12375
|
+
}
|
|
12376
|
+
return collector;
|
|
12377
|
+
}, []);
|
|
12378
|
+
|
|
12379
|
+
|
|
12380
|
+
/**
|
|
12381
|
+
* Inserta o actualiza el elemento
|
|
12382
|
+
* `<script type="application/ld+json">` en el `<head>`.
|
|
12383
|
+
*
|
|
12384
|
+
* Si ya existe un elemento con id `pmSchema`, actualiza su
|
|
12385
|
+
* contenido en lugar de crear uno nuevo.
|
|
12386
|
+
*
|
|
12387
|
+
* No se ejecuta si la cantidad de features supera
|
|
12388
|
+
* `PonchoMapSchema.MAX_FEATURES` (500).
|
|
12389
|
+
*/
|
|
12390
|
+
render = () => {
|
|
12391
|
+
if (this.data.length > PonchoMapSchema.MAX_FEATURES) {
|
|
12392
|
+
console.warn(
|
|
12393
|
+
`PonchoMapSchema: se omite el schema porque el ` +
|
|
12394
|
+
`número de features (${this.data.length}) supera ` +
|
|
12395
|
+
`el límite de ${PonchoMapSchema.MAX_FEATURES}.`
|
|
12396
|
+
);
|
|
12397
|
+
return;
|
|
12398
|
+
}
|
|
12399
|
+
|
|
12400
|
+
const schema = this.schema();
|
|
12401
|
+
if (!schema) {
|
|
12402
|
+
return;
|
|
12403
|
+
}
|
|
12404
|
+
|
|
12405
|
+
const json = JSON.stringify(schema);
|
|
12406
|
+
const existing = document.getElementById("pmSchema");
|
|
12407
|
+
if (existing) {
|
|
12408
|
+
existing.text = json;
|
|
12409
|
+
return;
|
|
12410
|
+
}
|
|
12411
|
+
|
|
12412
|
+
const script = document.createElement("script");
|
|
12413
|
+
script.type = "application/ld+json";
|
|
12414
|
+
script.id = `pmschema__${this.scope}`;
|
|
12415
|
+
script.text = json;
|
|
12416
|
+
document.head.appendChild(script);
|
|
12417
|
+
};
|
|
12418
|
+
}
|
|
12419
|
+
|
|
12420
|
+
/** Máximo de features permitidos para generar el schema. */
|
|
12421
|
+
PonchoMapSchema.MAX_FEATURES = 1000;
|
|
12422
|
+
|
|
12423
|
+
|
|
12171
12424
|
/**
|
|
12172
12425
|
* PONCHO MAP FILTRO POR PROVINCIAS
|
|
12173
12426
|
*
|