@teipublisher/pb-components 1.36.2 → 1.38.0
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/CHANGELOG.md +29 -0
- package/Dockerfile +1 -1
- package/css/tom-select/tom-select.bootstrap4.min.css +2 -0
- package/css/tom-select/tom-select.bootstrap5.min.css +2 -0
- package/css/tom-select/tom-select.default.min.css +2 -0
- package/css/tom-select/tom-select.min.css +2 -0
- package/dist/demo/demos.json +3 -0
- package/dist/demo/pb-combo-box.html +102 -0
- package/dist/demo/pb-leaflet-map.html +4 -0
- package/dist/demo/select.json +22 -16
- package/dist/pb-components-bundle.js +182 -182
- package/dist/pb-elements.json +283 -9
- package/dist/pb-leaflet-map.js +3 -3
- package/package.json +2 -1
- package/pb-elements.json +283 -9
- package/src/pb-combo-box.js +154 -0
- package/src/pb-components.js +1 -0
- package/src/pb-geolocation.js +3 -2
- package/src/pb-leaflet-map.js +40 -4
- package/src/pb-map-icon.js +101 -0
- package/src/pb-page.js +9 -0
- package/src/pb-popover.js +1 -1
- package/src/pb-timeline.js +22 -11
package/dist/pb-elements.json
CHANGED
|
@@ -2285,6 +2285,161 @@
|
|
|
2285
2285
|
}
|
|
2286
2286
|
]
|
|
2287
2287
|
},
|
|
2288
|
+
{
|
|
2289
|
+
"name": "pb-combo-box",
|
|
2290
|
+
"path": "./src/pb-combo-box.js",
|
|
2291
|
+
"description": "Provides a combo box, i.e. a combination of an input with a dropdown.\nItems to select from may be obtained from a remote data source.\n\nThe form control to be used (either a select or input) should be passed \nin the content of the element. If no control is provided, a simple `<input>`\nwill be created.",
|
|
2292
|
+
"attributes": [
|
|
2293
|
+
{
|
|
2294
|
+
"name": "source",
|
|
2295
|
+
"description": "A remote data source to use. The component will pass the text entered by the user\nin parameter `query`. It expects a JSON array of objects with each object describing\none item:\n\n```json\n{\n \"text\": \"Text to show as label\",\n \"value\": \"value-to-use\"\n}\n```",
|
|
2296
|
+
"type": "string"
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
"name": "close-after-select",
|
|
2300
|
+
"description": "Automatically close the dropdown once the user made a selection",
|
|
2301
|
+
"type": "boolean",
|
|
2302
|
+
"default": "false"
|
|
2303
|
+
},
|
|
2304
|
+
{
|
|
2305
|
+
"name": "preload",
|
|
2306
|
+
"description": "Preload all items from the remote data source at startup",
|
|
2307
|
+
"type": "boolean",
|
|
2308
|
+
"default": "false"
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
"name": "on-blur",
|
|
2312
|
+
"description": "Name of the event to be emitted when the user leaves the form control",
|
|
2313
|
+
"type": "string",
|
|
2314
|
+
"default": "\"pb-combo-box-blur\""
|
|
2315
|
+
},
|
|
2316
|
+
{
|
|
2317
|
+
"name": "on-change",
|
|
2318
|
+
"description": "Name of the event to be emitted when the value of the form control has changed",
|
|
2319
|
+
"type": "string",
|
|
2320
|
+
"default": "\"pb-combo-box-change\""
|
|
2321
|
+
},
|
|
2322
|
+
{
|
|
2323
|
+
"name": "subscribe",
|
|
2324
|
+
"description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
|
|
2325
|
+
"type": "string"
|
|
2326
|
+
},
|
|
2327
|
+
{
|
|
2328
|
+
"name": "subscribe-config",
|
|
2329
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
|
|
2330
|
+
"type": "object"
|
|
2331
|
+
},
|
|
2332
|
+
{
|
|
2333
|
+
"name": "emit",
|
|
2334
|
+
"description": "The name of the channel to send events to.",
|
|
2335
|
+
"type": "string"
|
|
2336
|
+
},
|
|
2337
|
+
{
|
|
2338
|
+
"name": "emit-config",
|
|
2339
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
|
|
2340
|
+
"type": "object"
|
|
2341
|
+
},
|
|
2342
|
+
{
|
|
2343
|
+
"name": "wait-for",
|
|
2344
|
+
"description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
|
|
2345
|
+
"type": "string"
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
"name": "disabled",
|
|
2349
|
+
"description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
|
|
2350
|
+
"type": "boolean",
|
|
2351
|
+
"default": "false"
|
|
2352
|
+
}
|
|
2353
|
+
],
|
|
2354
|
+
"properties": [
|
|
2355
|
+
{
|
|
2356
|
+
"name": "renderItem",
|
|
2357
|
+
"description": "Set a javascript function to be called whenever an item\nneeds to be rendered. The function will be passed the data\nobject of the current item as argument.",
|
|
2358
|
+
"type": "Function"
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
"name": "theme",
|
|
2362
|
+
"type": "string",
|
|
2363
|
+
"default": "\"default\""
|
|
2364
|
+
},
|
|
2365
|
+
{
|
|
2366
|
+
"name": "source",
|
|
2367
|
+
"attribute": "source",
|
|
2368
|
+
"description": "A remote data source to use. The component will pass the text entered by the user\nin parameter `query`. It expects a JSON array of objects with each object describing\none item:\n\n```json\n{\n \"text\": \"Text to show as label\",\n \"value\": \"value-to-use\"\n}\n```",
|
|
2369
|
+
"type": "string"
|
|
2370
|
+
},
|
|
2371
|
+
{
|
|
2372
|
+
"name": "closeAfterSelect",
|
|
2373
|
+
"attribute": "close-after-select",
|
|
2374
|
+
"description": "Automatically close the dropdown once the user made a selection",
|
|
2375
|
+
"type": "boolean",
|
|
2376
|
+
"default": "false"
|
|
2377
|
+
},
|
|
2378
|
+
{
|
|
2379
|
+
"name": "preload",
|
|
2380
|
+
"attribute": "preload",
|
|
2381
|
+
"description": "Preload all items from the remote data source at startup",
|
|
2382
|
+
"type": "boolean",
|
|
2383
|
+
"default": "false"
|
|
2384
|
+
},
|
|
2385
|
+
{
|
|
2386
|
+
"name": "renderFunction",
|
|
2387
|
+
"type": "object",
|
|
2388
|
+
"default": "\"renderDefault\""
|
|
2389
|
+
},
|
|
2390
|
+
{
|
|
2391
|
+
"name": "onBlur",
|
|
2392
|
+
"attribute": "on-blur",
|
|
2393
|
+
"description": "Name of the event to be emitted when the user leaves the form control",
|
|
2394
|
+
"type": "string",
|
|
2395
|
+
"default": "\"pb-combo-box-blur\""
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
"name": "onChange",
|
|
2399
|
+
"attribute": "on-change",
|
|
2400
|
+
"description": "Name of the event to be emitted when the value of the form control has changed",
|
|
2401
|
+
"type": "string",
|
|
2402
|
+
"default": "\"pb-combo-box-change\""
|
|
2403
|
+
},
|
|
2404
|
+
{
|
|
2405
|
+
"name": "subscribe",
|
|
2406
|
+
"attribute": "subscribe",
|
|
2407
|
+
"description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
|
|
2408
|
+
"type": "string"
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
"name": "subscribeConfig",
|
|
2412
|
+
"attribute": "subscribe-config",
|
|
2413
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
|
|
2414
|
+
"type": "object"
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
"name": "emit",
|
|
2418
|
+
"attribute": "emit",
|
|
2419
|
+
"description": "The name of the channel to send events to.",
|
|
2420
|
+
"type": "string"
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
"name": "emitConfig",
|
|
2424
|
+
"attribute": "emit-config",
|
|
2425
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
|
|
2426
|
+
"type": "object"
|
|
2427
|
+
},
|
|
2428
|
+
{
|
|
2429
|
+
"name": "waitFor",
|
|
2430
|
+
"attribute": "wait-for",
|
|
2431
|
+
"description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
|
|
2432
|
+
"type": "string"
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
"name": "disabled",
|
|
2436
|
+
"attribute": "disabled",
|
|
2437
|
+
"description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
|
|
2438
|
+
"type": "boolean",
|
|
2439
|
+
"default": "false"
|
|
2440
|
+
}
|
|
2441
|
+
]
|
|
2442
|
+
},
|
|
2288
2443
|
{
|
|
2289
2444
|
"name": "pb-custom-form",
|
|
2290
2445
|
"path": "./src/pb-custom-form.js",
|
|
@@ -3803,7 +3958,7 @@
|
|
|
3803
3958
|
{
|
|
3804
3959
|
"name": "pb-geolocation",
|
|
3805
3960
|
"path": "./src/pb-geolocation.js",
|
|
3806
|
-
"description": "Represents a geo location. Extends `pb-highlight`, but sends an additional `pb-geolocation` event\non mouseover.\n\nFor `pb-leaflet-map` to show markers for `pb-geolocation` elements, make sure that map subscribes to the channel\ninto which `pb-geolocation`s emit and that map is loaded before the emitting component, e.g. `pb-view`, by specifying \n`wait-for` property",
|
|
3961
|
+
"description": "Represents a geo location. Extends `pb-highlight`, but sends an additional `pb-geolocation` event\non mouseover.\n\nFor `pb-leaflet-map` to show markers for `pb-geolocation` elements, make sure that map subscribes to the channel\ninto which `pb-geolocation`s emit and that map is loaded before the emitting component, e.g. `pb-view`, by specifying \n`wait-for` property.",
|
|
3807
3962
|
"attributes": [
|
|
3808
3963
|
{
|
|
3809
3964
|
"name": "longitude",
|
|
@@ -4609,7 +4764,7 @@
|
|
|
4609
4764
|
{
|
|
4610
4765
|
"name": "pb-leaflet-map",
|
|
4611
4766
|
"path": "./src/pb-leaflet-map.js",
|
|
4612
|
-
"description": "A wrapper component for [leaflet](https://leafletjs.com/) displaying a map
|
|
4767
|
+
"description": "A wrapper component for [leaflet](https://leafletjs.com/) displaying a map.\n\nThe map layers displayed can be configured via nested `pb-map-layer` (see docs) elements,\nicons via `pb-map-icon`.",
|
|
4613
4768
|
"attributes": [
|
|
4614
4769
|
{
|
|
4615
4770
|
"name": "latitude",
|
|
@@ -5582,6 +5737,114 @@
|
|
|
5582
5737
|
}
|
|
5583
5738
|
]
|
|
5584
5739
|
},
|
|
5740
|
+
{
|
|
5741
|
+
"name": "pb-map-icon",
|
|
5742
|
+
"path": "./src/pb-map-icon.js",
|
|
5743
|
+
"description": "Configure a map icon type to be used for markers. \nShould be nested inside `pb-leaflet-map`.",
|
|
5744
|
+
"attributes": [
|
|
5745
|
+
{
|
|
5746
|
+
"name": "icon-size",
|
|
5747
|
+
"description": "Size of the icon as comma-separated string, i.e. 'height, width'.",
|
|
5748
|
+
"type": "array"
|
|
5749
|
+
},
|
|
5750
|
+
{
|
|
5751
|
+
"name": "icon-anchor",
|
|
5752
|
+
"description": "Anchor position of the icon as comma-separated string, i.e. 'height, width'.",
|
|
5753
|
+
"type": "array"
|
|
5754
|
+
},
|
|
5755
|
+
{
|
|
5756
|
+
"name": "shadow-url",
|
|
5757
|
+
"description": "The URL to load the shadow icon from. Should be relative to the path set via the `imagesPath` property on `pb-leaflet-map`.",
|
|
5758
|
+
"type": "string"
|
|
5759
|
+
},
|
|
5760
|
+
{
|
|
5761
|
+
"name": "shadow-size",
|
|
5762
|
+
"description": "Size of the shadow icon as comma-separated string, i.e. 'height, width'.",
|
|
5763
|
+
"type": "array"
|
|
5764
|
+
},
|
|
5765
|
+
{
|
|
5766
|
+
"name": "shadow-anchor",
|
|
5767
|
+
"description": "Anchor position of the shadow icon as comma-separated string, i.e. 'height, width'.",
|
|
5768
|
+
"type": "array"
|
|
5769
|
+
},
|
|
5770
|
+
{
|
|
5771
|
+
"name": "popup-anchor",
|
|
5772
|
+
"description": "Anchor position of the popup as comma-separated string, i.e. 'height, width'.",
|
|
5773
|
+
"type": "array"
|
|
5774
|
+
},
|
|
5775
|
+
{
|
|
5776
|
+
"name": "name",
|
|
5777
|
+
"description": "Name of the icon. Set to 'active' to configure the icon used for\nplaces which were target of a previous `pb-geolocation` event (i.e. are currently 'active').",
|
|
5778
|
+
"type": "string",
|
|
5779
|
+
"default": "\"default\""
|
|
5780
|
+
},
|
|
5781
|
+
{
|
|
5782
|
+
"name": "icon-url",
|
|
5783
|
+
"description": "The URL to load the icon from. Should be relative to the path set via the `imagesPath` property on `pb-leaflet-map`.",
|
|
5784
|
+
"type": "string"
|
|
5785
|
+
}
|
|
5786
|
+
],
|
|
5787
|
+
"properties": [
|
|
5788
|
+
{
|
|
5789
|
+
"name": "iconSize",
|
|
5790
|
+
"attribute": "icon-size",
|
|
5791
|
+
"description": "Size of the icon as comma-separated string, i.e. 'height, width'.",
|
|
5792
|
+
"type": "array"
|
|
5793
|
+
},
|
|
5794
|
+
{
|
|
5795
|
+
"name": "iconAnchor",
|
|
5796
|
+
"attribute": "icon-anchor",
|
|
5797
|
+
"description": "Anchor position of the icon as comma-separated string, i.e. 'height, width'.",
|
|
5798
|
+
"type": "array"
|
|
5799
|
+
},
|
|
5800
|
+
{
|
|
5801
|
+
"name": "shadowUrl",
|
|
5802
|
+
"attribute": "shadow-url",
|
|
5803
|
+
"description": "The URL to load the shadow icon from. Should be relative to the path set via the `imagesPath` property on `pb-leaflet-map`.",
|
|
5804
|
+
"type": "string"
|
|
5805
|
+
},
|
|
5806
|
+
{
|
|
5807
|
+
"name": "shadowSize",
|
|
5808
|
+
"attribute": "shadow-size",
|
|
5809
|
+
"description": "Size of the shadow icon as comma-separated string, i.e. 'height, width'.",
|
|
5810
|
+
"type": "array"
|
|
5811
|
+
},
|
|
5812
|
+
{
|
|
5813
|
+
"name": "shadowAnchor",
|
|
5814
|
+
"attribute": "shadow-anchor",
|
|
5815
|
+
"description": "Anchor position of the shadow icon as comma-separated string, i.e. 'height, width'.",
|
|
5816
|
+
"type": "array"
|
|
5817
|
+
},
|
|
5818
|
+
{
|
|
5819
|
+
"name": "popupAncor",
|
|
5820
|
+
"attribute": "popup-anchor",
|
|
5821
|
+
"description": "Anchor position of the popup as comma-separated string, i.e. 'height, width'.",
|
|
5822
|
+
"type": "array"
|
|
5823
|
+
},
|
|
5824
|
+
{
|
|
5825
|
+
"name": "options",
|
|
5826
|
+
"type": "object"
|
|
5827
|
+
},
|
|
5828
|
+
{
|
|
5829
|
+
"name": "name",
|
|
5830
|
+
"attribute": "name",
|
|
5831
|
+
"description": "Name of the icon. Set to 'active' to configure the icon used for\nplaces which were target of a previous `pb-geolocation` event (i.e. are currently 'active').",
|
|
5832
|
+
"type": "string",
|
|
5833
|
+
"default": "\"default\""
|
|
5834
|
+
},
|
|
5835
|
+
{
|
|
5836
|
+
"name": "type",
|
|
5837
|
+
"type": "string",
|
|
5838
|
+
"default": "\"image\""
|
|
5839
|
+
},
|
|
5840
|
+
{
|
|
5841
|
+
"name": "iconUrl",
|
|
5842
|
+
"attribute": "icon-url",
|
|
5843
|
+
"description": "The URL to load the icon from. Should be relative to the path set via the `imagesPath` property on `pb-leaflet-map`.",
|
|
5844
|
+
"type": "string"
|
|
5845
|
+
}
|
|
5846
|
+
]
|
|
5847
|
+
},
|
|
5585
5848
|
{
|
|
5586
5849
|
"name": "pb-map-layer",
|
|
5587
5850
|
"path": "./src/pb-map-layer.js",
|
|
@@ -7390,6 +7653,9 @@
|
|
|
7390
7653
|
{
|
|
7391
7654
|
"name": "pb-toggle",
|
|
7392
7655
|
"description": "when received, dispatch state changes to the elements on the page (see `pb-toggle-feature`, `pb-select-feature`)"
|
|
7656
|
+
},
|
|
7657
|
+
{
|
|
7658
|
+
"name": "pb-page-loaded"
|
|
7393
7659
|
}
|
|
7394
7660
|
],
|
|
7395
7661
|
"slots": [
|
|
@@ -7773,7 +8039,8 @@
|
|
|
7773
8039
|
},
|
|
7774
8040
|
{
|
|
7775
8041
|
"name": "popup-class",
|
|
7776
|
-
"
|
|
8042
|
+
"description": "Additional class names which will be added to the popup element.\nUse this to apply a specific style to certain popovers, but not others.",
|
|
8043
|
+
"type": "String"
|
|
7777
8044
|
},
|
|
7778
8045
|
{
|
|
7779
8046
|
"name": "subscribe",
|
|
@@ -7808,11 +8075,6 @@
|
|
|
7808
8075
|
}
|
|
7809
8076
|
],
|
|
7810
8077
|
"properties": [
|
|
7811
|
-
{
|
|
7812
|
-
"name": "poupClass",
|
|
7813
|
-
"description": "Additional class names which will be added to the popup element.\nUse this to apply a specific style to certain popovers, but not others.",
|
|
7814
|
-
"type": "String"
|
|
7815
|
-
},
|
|
7816
8078
|
{
|
|
7817
8079
|
"name": "remote",
|
|
7818
8080
|
"attribute": "remote",
|
|
@@ -7863,7 +8125,8 @@
|
|
|
7863
8125
|
{
|
|
7864
8126
|
"name": "popupClass",
|
|
7865
8127
|
"attribute": "popup-class",
|
|
7866
|
-
"
|
|
8128
|
+
"description": "Additional class names which will be added to the popup element.\nUse this to apply a specific style to certain popovers, but not others.",
|
|
8129
|
+
"type": "String"
|
|
7867
8130
|
},
|
|
7868
8131
|
{
|
|
7869
8132
|
"name": "subscribe",
|
|
@@ -9576,6 +9839,11 @@
|
|
|
9576
9839
|
"type": "array",
|
|
9577
9840
|
"default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
|
|
9578
9841
|
},
|
|
9842
|
+
{
|
|
9843
|
+
"name": "max-interval",
|
|
9844
|
+
"type": "number",
|
|
9845
|
+
"default": "60"
|
|
9846
|
+
},
|
|
9579
9847
|
{
|
|
9580
9848
|
"name": "url",
|
|
9581
9849
|
"description": "Endpoint to load timeline data from. Expects response to be an\nobject with key value pairs for (date, hits).\n\nWill be reloaded whenever 'start-date' or 'end-date' attributes change.",
|
|
@@ -9672,6 +9940,12 @@
|
|
|
9672
9940
|
"type": "array",
|
|
9673
9941
|
"default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
|
|
9674
9942
|
},
|
|
9943
|
+
{
|
|
9944
|
+
"name": "maxInterval",
|
|
9945
|
+
"attribute": "max-interval",
|
|
9946
|
+
"type": "number",
|
|
9947
|
+
"default": "60"
|
|
9948
|
+
},
|
|
9675
9949
|
{
|
|
9676
9950
|
"name": "url",
|
|
9677
9951
|
"attribute": "url",
|
package/dist/pb-leaflet-map.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{L as t,p as e,r as i,h as
|
|
1
|
+
import{L as t,p as e,r as i,h as s,c as a}from"./pb-mixin-ae9e2885.js";import"./es-global-bridge-6abe3a88.js";const o=["type","url","label","base","show"];class r extends t{static get properties(){return{type:{type:String},url:{type:String},base:{type:Boolean},show:{type:Boolean},label:{type:String},attribution:{type:String},minZoom:{type:Number,attribute:"min-zoom"},maxZoom:{type:Number,attribute:"max-zoom"},zoomOffset:{type:Number,attribute:"zoom-offset"},opacity:{type:Number},tileSize:{type:Number},id:{type:String},accessToken:{type:String,attribute:"access-token"}}}constructor(){super(),this.type="tile",this.url=null}get options(){const t={};return Object.keys(r.properties).forEach(e=>{o.indexOf(e)<0&&this[e]&&(t[e]=this[e])}),console.log("<pb-leaflet-map-layer> Options: %o",t),t}async data(){return new Promise(t=>{fetch(this.url).then(t=>t.json()).then(e=>t(e))})}}function l(t,e){try{return t.split(/\s*,\s*/).map(t=>parseInt(t,10))}catch(e){return console.error("<pb-map-icon> Invalid size specified: "+t),null}}customElements.define("pb-map-layer",r);class n extends t{static get properties(){return{name:{type:String},iconUrl:{type:String,attribute:"icon-url"},iconSize:{type:Array,converter:l,attribute:"icon-size"},iconAnchor:{type:Array,converter:l,attribute:"icon-anchor"},shadowUrl:{type:String,attribute:"shadow-url"},shadowSize:{type:Array,converter:l,attribute:"shadow-size"},shadowAnchor:{type:Array,converter:l,attribute:"shadow-anchor"},popupAncor:{type:Array,converter:l,attribute:"popup-anchor"}}}constructor(){super(),this.name="default",this.type="image",this.iconUrl=null}get options(){const t={};return Object.keys(n.properties).forEach(e=>{this[e]&&(t[e]=this[e])}),console.log("<pb-map-icon> Options: %o",t),t}}customElements.define("pb-map-icon",n);class c extends(e(t)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{latitude:{type:Number},longitude:{type:Number},zoom:{type:Number},crs:{type:String},fitMarkers:{type:Boolean,attribute:"fit-markers"},cluster:{type:Boolean},disableClusteringAt:{type:Number,attribute:"disable-clustering-at"},noScroll:{type:Boolean,attribute:"no-scroll"},accessToken:{type:String,attribute:"access-token"},toggle:{type:Boolean},imagesPath:{type:String,attribute:"images-path"},cssPath:{type:String,attribute:"css-path"},_map:{type:Object}})}constructor(){super(),this.latitude=51.505,this.longitude=-.09,this.zoom=15,this.crs="EPSG3857",this.accessToken="",this.imagesPath="../images/leaflet/",this.cssPath="../css/leaflet/",this.toggle=!1,this.noScroll=!1,this.disabled=!0,this.cluster=!1,this.fitMarkers=!1,this.disableClusteringAt=null,this._icons={}}connectedCallback(){super.connectedCallback(),this._layers=this.querySelectorAll("pb-map-layer"),this._markers=this.querySelectorAll("pb-map-icon"),this.subscribeTo("pb-update-map",t=>{this._markerLayer.clearLayers(),t.detail.forEach(t=>{const e=L.marker([t.latitude,t.longitude]);t.label&&e.bindTooltip(t.label),e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),e.bindTooltip(t.label),this.setMarkerIcon(e),this._markerLayer.addLayer(e)}),this._fitBounds()}),this.subscribeTo("pb-update",t=>{this._markerLayer.clearLayers();t.detail.root.querySelectorAll("pb-geolocation").forEach(t=>{const e=L.latLng(t.latitude,t.longitude),i=L.marker(e).addTo(this._markerLayer);t.label&&i.bindTooltip(t.label),t.popup&&i.bindPopup(t.popup),i.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),this.setMarkerIcon(i)}),this._fitBounds()}),this.subscribeTo("pb-geolocation",t=>{if(t.detail.coordinates){if(this.latitude=t.detail.coordinates.latitude,this.longitude=t.detail.coordinates.longitude,this._hasMarker(this.latitude,this.longitude))console.log("<pb-leaflet-map> Marker already added to map");else{const e=L.marker([this.latitude,this.longitude]);e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t.detail.element)}),t.detail.label&&e.bindTooltip(t.detail.label),t.detail.popup&&e.bindPopup(t.detail.popup),this.setMarkerIcon(e),e.addTo(this._markerLayer),t.detail.fitBounds&&this._fitBounds(),console.log("<pb-leaflet-map> added marker")}this.toggle&&(this.disabled=!1);const e=t.detail.event;this._locationChanged(this.latitude,this.longitude,t.detail.zoom,e)}})}setMarkerIcon(t){this._icons&&this._icons.default&&t.setIcon(this._icons.default)}firstUpdated(){this.toggle||(this.disabled=!1),window.ESGlobalBridge.requestAvailability();const t=i("../lib/leaflet-src.js"),e=i("../lib/leaflet.markercluster-src.js");window.ESGlobalBridge.instance.load("leaflet",t).then(()=>window.ESGlobalBridge.instance.load("plugin",e)),window.addEventListener("es-bridge-plugin-loaded",this._initMap.bind(this),{once:!0})}render(){const t=i(this.cssPath);return s`
|
|
2
2
|
<link rel="Stylesheet" href="${t}/leaflet.css">
|
|
3
3
|
<link rel="Stylesheet" href="${t}/MarkerCluster.Default.css">
|
|
4
4
|
<div id="map" style="height: 100%; width: 100%"></div>
|
|
5
|
-
`}static get styles(){return
|
|
5
|
+
`}static get styles(){return a`
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
8
|
}
|
|
@@ -21,4 +21,4 @@ import{L as t,p as e,r as i,h as a,c as s}from"./pb-mixin-ae9e2885.js";import"./
|
|
|
21
21
|
text-decoration: none;
|
|
22
22
|
cursor: pointer;
|
|
23
23
|
}
|
|
24
|
-
`}_initMap(){if(this._map)return;L.Icon.Default.imagePath=i(this.imagesPath);const t=L.CRS[this.crs]||L.CRS.EPSG3857;if(this._map=L.map(this.shadowRoot.getElementById("map"),{zoom:this.zoom,center:L.latLng(this.latitude,this.longitude),crs:t}),this._configureLayers(),this.cluster){const t={};this.disableClusteringAt&&(t.disableClusteringAtZoom=this.disableClusteringAt),this._markerLayer=L.markerClusterGroup(t)}else this._markerLayer=L.layerGroup();if(this._markerLayer.addTo(this._map),this.signalReady(),L.control.scale().addTo(this._map),this.toggle){let t;L.Control.CloseButton=L.Control.extend({options:{position:"topright"},onAdd:e=>(t=L.DomUtil.create("div"),t.className="close",t.innerHTML="X",L.DomEvent.on(t,"click",this._hide.bind(this)),t),onRemove:e=>{L.DomEvent.off(t,"click",this._hide.bind(this))}}),L.control.closeButton=t=>new L.Control.CloseButton(t),L.control.closeButton({position:"topright"}).addTo(this._map)}}_configureLayers(){if(0===this._layers.length)return void L.tileLayer("https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token={accessToken}",{attribution:'© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',maxZoom:18,zoomOffset:-1,tileSize:512,accessToken:this.accessToken}).addTo(this._map);const t=L.control.layers(null,null,{collapsed:!1});this._layers.forEach(e=>{let i;switch(e.type){case"geojson":e.data().then(
|
|
24
|
+
`}_initMap(){if(this._map)return;L.Icon.Default.imagePath=i(this.imagesPath);const t=L.CRS[this.crs]||L.CRS.EPSG3857;if(this._map=L.map(this.shadowRoot.getElementById("map"),{zoom:this.zoom,center:L.latLng(this.latitude,this.longitude),crs:t}),this._configureLayers(),this._configureMarkers(),this.cluster){const t={};this.disableClusteringAt&&(t.disableClusteringAtZoom=this.disableClusteringAt),this._markerLayer=L.markerClusterGroup(t)}else this._markerLayer=L.layerGroup();if(this._markerLayer.addTo(this._map),this.signalReady(),L.control.scale().addTo(this._map),this.toggle){let t;L.Control.CloseButton=L.Control.extend({options:{position:"topright"},onAdd:e=>(t=L.DomUtil.create("div"),t.className="close",t.innerHTML="X",L.DomEvent.on(t,"click",this._hide.bind(this)),t),onRemove:e=>{L.DomEvent.off(t,"click",this._hide.bind(this))}}),L.control.closeButton=t=>new L.Control.CloseButton(t),L.control.closeButton({position:"topright"}).addTo(this._map)}}_configureMarkers(){0!==this._markers.length&&(this._icons={},this._markers.forEach(t=>{t.iconUrl&&(this._icons[t.name]=L.icon(t.options))}))}_configureLayers(){if(0===this._layers.length)return void L.tileLayer("https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token={accessToken}",{attribution:'© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',maxZoom:18,zoomOffset:-1,tileSize:512,accessToken:this.accessToken}).addTo(this._map);const t=L.control.layers(null,null,{collapsed:!1});this._layers.forEach(e=>{let i;switch(e.type){case"geojson":e.data().then(s=>{i=L.geoJSON([s]),this._addLayer(e,i,t)});break;default:i=L.tileLayer(e.url,e.options),this._addLayer(e,i,t)}}),this._layers.length>1&&t.addTo(this._map),this._layers=null}_addLayer(t,e,i){t.show&&e.addTo(this._map),t.label&&(t.base?i.addBaseLayer(e,t.label):i.addOverlay(e,t.label))}_fitBounds(){if(!this.fitMarkers)return;const t=L.latLngBounds();let e=0;this._markerLayer.eachLayer(i=>{t.extend(i.getLatLng()),e+=1}),0===e?this._map.fitWorld():1===e?this._map.fitBounds(t,{maxZoom:this.zoom}):this._map.fitBounds(t)}_locationChanged(t,e,i,s){if(this._map){const a=L.latLng([t,e]);this._markerLayer.eachLayer(t=>{t.getLatLng().equals(a)?(i&&!this.noScroll?(t.openTooltip(),this._map.setView(a,i)):this.cluster?this._markerLayer.zoomToShowLayer(t,()=>t.openTooltip()):(t.openTooltip(),this._map.setView(a,this.zoom)),s&&this._icons&&this._icons.active&&t.setIcon(this._icons.active)):this._icons&&this._icons.default&&t.getIcon()!==this._icons.default&&t.setIcon(this._icons.default)})}}_hasMarker(t,e){const i=L.latLng([t,e]);let s=null;return this._markerLayer.eachLayer(t=>{t instanceof L.Marker&&t.getLatLng().equals(i)&&(s=t)}),s}_hide(){this.disabled=!0}}customElements.define("pb-leaflet-map",c);export{c as PbLeafletMap};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teipublisher/pb-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.0",
|
|
4
4
|
"description": "Collection of webcomponents underlying TEI Publisher",
|
|
5
5
|
"repository": "https://github.com/eeditiones/tei-publisher-components.git",
|
|
6
6
|
"main": "index.html",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"openseadragon": "^2.4.2",
|
|
84
84
|
"prismjs": "^1.21.0",
|
|
85
85
|
"tippy.js": "^6.2.7",
|
|
86
|
+
"tom-select": "^2.0.2",
|
|
86
87
|
"uniqolor": "^1.0.1",
|
|
87
88
|
"web-animations-js": "^2.3.2"
|
|
88
89
|
},
|