@artstesh/maps 1.0.3 → 1.0.5
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/bundles/maps-components-src-map.umd.js +151 -7
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +151 -7
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/map-plate/layers/feature-layer/feature-layer.component.js +1 -1
- package/dist/esm2015/map/map-plate/map-plate.component.js +5 -1
- package/dist/esm2015/map/map-plate/tooltips/index.js +3 -0
- package/dist/esm2015/map/map-plate/tooltips/tooltip/tooltip.component.js +84 -0
- package/dist/esm2015/map/map-plate/tooltips/tooltip/tooltip.settings.js +30 -0
- package/dist/esm2015/map/map.module.js +6 -3
- package/dist/esm2015/map/messages/commands/close-tooltip.command.js +12 -0
- package/dist/esm2015/map/messages/index.js +2 -1
- package/dist/esm2015/map/public-api.js +2 -1
- package/dist/esm2015/map/services/map-click.service.js +2 -2
- package/dist/esm2015/map/services/message-registrator.service.js +3 -1
- package/dist/esm2015/src/map/map-plate/layers/feature-layer/feature-layer.component.js +1 -1
- package/dist/esm2015/src/map/map-plate/map-plate.component.js +5 -1
- package/dist/esm2015/src/map/map-plate/tooltips/index.js +3 -0
- package/dist/esm2015/src/map/map-plate/tooltips/tooltip/tooltip.component.js +84 -0
- package/dist/esm2015/src/map/map-plate/tooltips/tooltip/tooltip.settings.js +30 -0
- package/dist/esm2015/src/map/map.module.js +6 -3
- package/dist/esm2015/src/map/messages/commands/close-tooltip.command.js +12 -0
- package/dist/esm2015/src/map/messages/index.js +2 -1
- package/dist/esm2015/src/map/public-api.js +2 -1
- package/dist/esm2015/src/map/services/map-click.service.js +2 -2
- package/dist/esm2015/src/map/services/message-registrator.service.js +3 -1
- package/dist/fesm2015/maps-components-src-map.js +128 -5
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +128 -5
- package/dist/fesm2015/maps-components.js.map +1 -1
- package/dist/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +1 -1
- package/dist/map/map-plate/map-plate.component.d.ts +2 -0
- package/dist/map/map-plate/tooltips/index.d.ts +2 -0
- package/dist/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +26 -0
- package/dist/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +11 -0
- package/dist/map/map.module.d.ts +3 -2
- package/dist/map/messages/commands/close-tooltip.command.d.ts +7 -0
- package/dist/map/messages/index.d.ts +1 -0
- package/dist/map/public-api.d.ts +1 -0
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +1 -1
- package/dist/src/map/map-plate/map-plate.component.d.ts +2 -0
- package/dist/src/map/map-plate/tooltips/index.d.ts +2 -0
- package/dist/src/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +26 -0
- package/dist/src/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +11 -0
- package/dist/src/map/map.module.d.ts +3 -2
- package/dist/src/map/messages/commands/close-tooltip.command.d.ts +7 -0
- package/dist/src/map/messages/index.d.ts +1 -0
- package/dist/src/map/public-api.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/proj'), require('rxjs'), require('@artstesh/postboy'), require('ol/Map'), require('ol/View'), require('ol/layer/Tile'), require('ol/source/OSM'), require('rxjs/operators'), require('ol/source'), require('ol/layer'), require('ol/style/Style'), require('ol/style')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('maps-components', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/proj', 'rxjs', '@artstesh/postboy', 'ol/Map', 'ol/View', 'ol/layer/Tile', 'ol/source/OSM', 'rxjs/operators', 'ol/source', 'ol/layer', 'ol/style/Style', 'ol/style'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["maps-components"] = {}, global.ng.core, global.ng.common, global.ol, global.geom, global.proj, global.rxjs, global.postboy, global.Map, global.View, global.TileLayer, global.OSM, global.rxjs.operators, global.source, global.layer, global.Style, global.style));
|
|
5
|
-
})(this, (function (exports, i0, i5, ol, geom, proj, rxjs, postboy, Map, View, TileLayer, OSM, operators, source, layer, Style, style) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/proj'), require('rxjs'), require('@artstesh/postboy'), require('ol/Map'), require('ol/View'), require('ol/layer/Tile'), require('ol/source/OSM'), require('rxjs/operators'), require('ol/source'), require('ol/layer'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('maps-components', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/proj', 'rxjs', '@artstesh/postboy', 'ol/Map', 'ol/View', 'ol/layer/Tile', 'ol/source/OSM', 'rxjs/operators', 'ol/source', 'ol/layer', 'ol/Overlay', 'ol/style/Style', 'ol/style'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["maps-components"] = {}, global.ng.core, global.ng.common, global.ol, global.geom, global.proj, global.rxjs, global.postboy, global.Map, global.View, global.TileLayer, global.OSM, global.rxjs.operators, global.source, global.layer, global.Overlay, global.Style, global.style));
|
|
5
|
+
})(this, (function (exports, i0, i5, ol, geom, proj, rxjs, postboy, Map, View, TileLayer, OSM, operators, source, layer, Overlay, Style, style) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
var View__default = /*#__PURE__*/_interopDefaultLegacy(View);
|
|
31
31
|
var TileLayer__default = /*#__PURE__*/_interopDefaultLegacy(TileLayer);
|
|
32
32
|
var OSM__default = /*#__PURE__*/_interopDefaultLegacy(OSM);
|
|
33
|
+
var Overlay__default = /*#__PURE__*/_interopDefaultLegacy(Overlay);
|
|
33
34
|
var Style__default = /*#__PURE__*/_interopDefaultLegacy(Style);
|
|
34
35
|
|
|
35
36
|
var DestructibleComponent = /** @class */ (function () {
|
|
@@ -689,6 +690,24 @@
|
|
|
689
690
|
}(GenericMessage));
|
|
690
691
|
MapClickEvent.ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
|
|
691
692
|
|
|
693
|
+
var CloseTooltipCommand = /** @class */ (function (_super) {
|
|
694
|
+
__extends(CloseTooltipCommand, _super);
|
|
695
|
+
function CloseTooltipCommand(tooltipId) {
|
|
696
|
+
var _this = _super.call(this) || this;
|
|
697
|
+
_this.tooltipId = tooltipId;
|
|
698
|
+
return _this;
|
|
699
|
+
}
|
|
700
|
+
Object.defineProperty(CloseTooltipCommand.prototype, "id", {
|
|
701
|
+
get: function () {
|
|
702
|
+
return CloseTooltipCommand.ID;
|
|
703
|
+
},
|
|
704
|
+
enumerable: false,
|
|
705
|
+
configurable: true
|
|
706
|
+
});
|
|
707
|
+
return CloseTooltipCommand;
|
|
708
|
+
}(GenericMessage));
|
|
709
|
+
CloseTooltipCommand.ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
710
|
+
|
|
692
711
|
var AddLayerCommand = /** @class */ (function (_super) {
|
|
693
712
|
__extends(AddLayerCommand, _super);
|
|
694
713
|
function AddLayerCommand(layer) {
|
|
@@ -905,7 +924,7 @@
|
|
|
905
924
|
var model = new MapClickEvent(ev.coordinate, {});
|
|
906
925
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.forEachFeatureAtPixel(ev.pixel, function (f, l) {
|
|
907
926
|
_this.getFeatureCollectionWithInner([f])
|
|
908
|
-
.filter(function (f) { return
|
|
927
|
+
.filter(function (f) { return f.getId() != null; })
|
|
909
928
|
.forEach(function (fs) {
|
|
910
929
|
var layerName = l.get('name');
|
|
911
930
|
if (!model.entities[layerName])
|
|
@@ -946,6 +965,7 @@
|
|
|
946
965
|
this.registerSubject(AddTileCommand.ID);
|
|
947
966
|
this.registerSubject(RemoveTileCommand.ID);
|
|
948
967
|
this.registerSubject(MapClickEvent.ID);
|
|
968
|
+
this.registerSubject(CloseTooltipCommand.ID);
|
|
949
969
|
};
|
|
950
970
|
return MessageRegistratorService;
|
|
951
971
|
}(postboy.PostboyAbstractRegistrator));
|
|
@@ -1055,9 +1075,13 @@
|
|
|
1055
1075
|
_this.elementRef = elementRef;
|
|
1056
1076
|
_this.postboy = postboy;
|
|
1057
1077
|
_this.mapFactory = mapFactory;
|
|
1078
|
+
_this.registrator = registrator;
|
|
1058
1079
|
_this.detector = detector;
|
|
1059
1080
|
_this.osmUrl = '';
|
|
1060
1081
|
_this._settings = new MapSettings();
|
|
1082
|
+
_this.onDestroy = function () {
|
|
1083
|
+
_this.registrator.down();
|
|
1084
|
+
};
|
|
1061
1085
|
registrator.up();
|
|
1062
1086
|
return _this;
|
|
1063
1087
|
}
|
|
@@ -1431,6 +1455,121 @@
|
|
|
1431
1455
|
type: i0.Input
|
|
1432
1456
|
}] } });
|
|
1433
1457
|
|
|
1458
|
+
var TooltipSettings = /** @class */ (function () {
|
|
1459
|
+
function TooltipSettings(id) {
|
|
1460
|
+
this.containerClass = 'custom-tooltip-class';
|
|
1461
|
+
this.show = function (e) { return true; };
|
|
1462
|
+
this.id = id !== null && id !== void 0 ? id : IdGenerator.get();
|
|
1463
|
+
}
|
|
1464
|
+
TooltipSettings.copy = function (model) {
|
|
1465
|
+
var result = new TooltipSettings(model.id);
|
|
1466
|
+
result.show = model.show;
|
|
1467
|
+
result.containerClass = model.containerClass;
|
|
1468
|
+
return result;
|
|
1469
|
+
};
|
|
1470
|
+
TooltipSettings.prototype.setShow = function (show) {
|
|
1471
|
+
return TooltipSettings.copy(Object.assign(Object.assign({}, this), { show: show }));
|
|
1472
|
+
};
|
|
1473
|
+
TooltipSettings.prototype.setClass = function (containerClass) {
|
|
1474
|
+
return TooltipSettings.copy(Object.assign(Object.assign({}, this), { containerClass: containerClass }));
|
|
1475
|
+
};
|
|
1476
|
+
TooltipSettings.prototype.isSame = function (model) {
|
|
1477
|
+
if (this.show !== model.show)
|
|
1478
|
+
return false;
|
|
1479
|
+
if (this.containerClass !== model.containerClass)
|
|
1480
|
+
return false;
|
|
1481
|
+
if (this.id !== model.id)
|
|
1482
|
+
return false;
|
|
1483
|
+
return true;
|
|
1484
|
+
};
|
|
1485
|
+
return TooltipSettings;
|
|
1486
|
+
}());
|
|
1487
|
+
|
|
1488
|
+
var TooltipComponent = /** @class */ (function (_super) {
|
|
1489
|
+
__extends(TooltipComponent, _super);
|
|
1490
|
+
function TooltipComponent(postboy, detector) {
|
|
1491
|
+
var _this = _super.call(this) || this;
|
|
1492
|
+
_this.postboy = postboy;
|
|
1493
|
+
_this.detector = detector;
|
|
1494
|
+
_this._settings = new TooltipSettings();
|
|
1495
|
+
_this.show = false;
|
|
1496
|
+
_this.removeOverlay = function () {
|
|
1497
|
+
var _a;
|
|
1498
|
+
!!_this.overlay && ((_a = _this.map) === null || _a === void 0 ? void 0 : _a.removeOverlay(_this.overlay));
|
|
1499
|
+
_this.show = false;
|
|
1500
|
+
};
|
|
1501
|
+
_this.options = function (coordinates) {
|
|
1502
|
+
var _a;
|
|
1503
|
+
return {
|
|
1504
|
+
element: (_a = _this.container) === null || _a === void 0 ? void 0 : _a.nativeElement,
|
|
1505
|
+
autoPan: false,
|
|
1506
|
+
autoPanAnimation: { duration: 0 },
|
|
1507
|
+
position: coordinates,
|
|
1508
|
+
};
|
|
1509
|
+
};
|
|
1510
|
+
return _this;
|
|
1511
|
+
}
|
|
1512
|
+
Object.defineProperty(TooltipComponent.prototype, "settings", {
|
|
1513
|
+
set: function (value) {
|
|
1514
|
+
if (!value || this._settings.isSame(value))
|
|
1515
|
+
return;
|
|
1516
|
+
this._settings = value;
|
|
1517
|
+
this.detector.detectChanges();
|
|
1518
|
+
},
|
|
1519
|
+
enumerable: false,
|
|
1520
|
+
configurable: true
|
|
1521
|
+
});
|
|
1522
|
+
TooltipComponent.prototype.ngOnInit = function () {
|
|
1523
|
+
this.subs.push(this.observeMapRender());
|
|
1524
|
+
this.subs.push(this.observeMapClick());
|
|
1525
|
+
this.subs.push(this.observeClose());
|
|
1526
|
+
};
|
|
1527
|
+
TooltipComponent.prototype.observeMapClick = function () {
|
|
1528
|
+
var _this = this;
|
|
1529
|
+
return this.postboy.subscribe(MapClickEvent.ID).subscribe(function (ev) {
|
|
1530
|
+
_this._settings.show(ev) ? _this.addOverlay(ev.coordinates) : _this.removeOverlay();
|
|
1531
|
+
});
|
|
1532
|
+
};
|
|
1533
|
+
TooltipComponent.prototype.observeClose = function () {
|
|
1534
|
+
var _this = this;
|
|
1535
|
+
return this.postboy
|
|
1536
|
+
.subscribe(CloseTooltipCommand.ID)
|
|
1537
|
+
.pipe(operators.filter(function (ev) { return ev.tooltipId === _this._settings.id; }))
|
|
1538
|
+
.subscribe(function () { return _this.removeOverlay(); });
|
|
1539
|
+
};
|
|
1540
|
+
TooltipComponent.prototype.observeMapRender = function () {
|
|
1541
|
+
var _this = this;
|
|
1542
|
+
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe(function (m) {
|
|
1543
|
+
_this.map = m.map;
|
|
1544
|
+
});
|
|
1545
|
+
};
|
|
1546
|
+
TooltipComponent.prototype.addOverlay = function (coordinates) {
|
|
1547
|
+
var _a;
|
|
1548
|
+
this.removeOverlay();
|
|
1549
|
+
this.overlay = new Overlay__default["default"](this.options(coordinates));
|
|
1550
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.addOverlay(this.overlay);
|
|
1551
|
+
this.show = true;
|
|
1552
|
+
this.detector.detectChanges();
|
|
1553
|
+
};
|
|
1554
|
+
return TooltipComponent;
|
|
1555
|
+
}(DestructibleComponent));
|
|
1556
|
+
TooltipComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1557
|
+
TooltipComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TooltipComponent, selector: "lib-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0__namespace, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1558
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TooltipComponent, decorators: [{
|
|
1559
|
+
type: i0.Component,
|
|
1560
|
+
args: [{
|
|
1561
|
+
selector: 'lib-tooltip',
|
|
1562
|
+
templateUrl: './tooltip.component.html',
|
|
1563
|
+
styleUrls: ['./tooltip.component.scss'],
|
|
1564
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1565
|
+
}]
|
|
1566
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
1567
|
+
type: i0.ViewChild,
|
|
1568
|
+
args: ['tip']
|
|
1569
|
+
}], settings: [{
|
|
1570
|
+
type: i0.Input
|
|
1571
|
+
}] } });
|
|
1572
|
+
|
|
1434
1573
|
var MapModule = /** @class */ (function () {
|
|
1435
1574
|
function MapModule() {
|
|
1436
1575
|
}
|
|
@@ -1442,7 +1581,8 @@
|
|
|
1442
1581
|
TileLayerComponent,
|
|
1443
1582
|
OsmTileLayerComponent,
|
|
1444
1583
|
FeatureLayerComponent,
|
|
1445
|
-
MarkersComponent
|
|
1584
|
+
MarkersComponent,
|
|
1585
|
+
TooltipComponent], imports: [i5.CommonModule], exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent, TooltipComponent] });
|
|
1446
1586
|
MapModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, imports: [[i5.CommonModule]] });
|
|
1447
1587
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, decorators: [{
|
|
1448
1588
|
type: i0.NgModule,
|
|
@@ -1455,8 +1595,9 @@
|
|
|
1455
1595
|
OsmTileLayerComponent,
|
|
1456
1596
|
FeatureLayerComponent,
|
|
1457
1597
|
MarkersComponent,
|
|
1598
|
+
TooltipComponent,
|
|
1458
1599
|
],
|
|
1459
|
-
exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent],
|
|
1600
|
+
exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent, TooltipComponent],
|
|
1460
1601
|
}]
|
|
1461
1602
|
}] });
|
|
1462
1603
|
|
|
@@ -1502,6 +1643,7 @@
|
|
|
1502
1643
|
*/
|
|
1503
1644
|
|
|
1504
1645
|
exports.CallbackMessage = CallbackMessage;
|
|
1646
|
+
exports.CloseTooltipCommand = CloseTooltipCommand;
|
|
1505
1647
|
exports.FeatureLayerComponent = FeatureLayerComponent;
|
|
1506
1648
|
exports.FeatureLayerSettings = FeatureLayerSettings;
|
|
1507
1649
|
exports.GenericMessage = GenericMessage;
|
|
@@ -1519,6 +1661,8 @@
|
|
|
1519
1661
|
exports.OsmTileLayerComponent = OsmTileLayerComponent;
|
|
1520
1662
|
exports.TileLayerComponent = TileLayerComponent;
|
|
1521
1663
|
exports.TileLayerSettings = TileLayerSettings;
|
|
1664
|
+
exports.TooltipComponent = TooltipComponent;
|
|
1665
|
+
exports.TooltipSettings = TooltipSettings;
|
|
1522
1666
|
|
|
1523
1667
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1524
1668
|
|