@nextgis/ngw-leaflet 1.18.2 → 1.18.6

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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.18.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.6; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import { Icon } from 'leaflet';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.18.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.6; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -19584,10 +19584,11 @@ var NgwLeaflet = (function () {
19584
19584
  */
19585
19585
  NgwConnector.prototype.apiRequest = function (name, params_, requestOptions) {
19586
19586
  var _this = this;
19587
- var _a;
19587
+ var _a, _b;
19588
19588
  if (params_ === void 0) { params_ = {}; }
19589
19589
  if (requestOptions === void 0) { requestOptions = {}; }
19590
19590
  var method = requestOptions.method, headers = requestOptions.headers, withCredentials = requestOptions.withCredentials, responseType = requestOptions.responseType;
19591
+ params_ = (_a = requestOptions.params) !== null && _a !== void 0 ? _a : params_;
19591
19592
  var params = objectRemoveEmpty(params_);
19592
19593
  var makeApiRequest = function () {
19593
19594
  return apiRequest({ name: name, params: params, requestOptions: requestOptions, connector: _this });
@@ -19599,7 +19600,7 @@ var NgwLeaflet = (function () {
19599
19600
  withCredentials: withCredentials,
19600
19601
  responseType: responseType,
19601
19602
  baseUrl: this.options.baseUrl,
19602
- userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
19603
+ userId: (_b = this.user) === null || _b === void 0 ? void 0 : _b.id,
19603
19604
  })));
19604
19605
  }
19605
19606
  return makeApiRequest();
@@ -20051,8 +20052,10 @@ var NgwLeaflet = (function () {
20051
20052
  return feature;
20052
20053
  }
20053
20054
  function updateItemRequestParam(params, options) {
20054
- var extensions = options.extensions, geom = options.geom, fields = options.fields, srs = options.srs;
20055
- params.extensions = extensions ? extensions.join(',') : '';
20055
+ var extensions = options.extensions, geom = options.geom, fields = options.fields, srs = options.srs, ilike = options.ilike, like = options.like;
20056
+ if (extensions) {
20057
+ params.extensions = extensions.join(',');
20058
+ }
20056
20059
  if (fields !== undefined) {
20057
20060
  params.fields = Array.isArray(fields) ? fields.join(',') : '';
20058
20061
  }
@@ -20063,6 +20066,12 @@ var NgwLeaflet = (function () {
20063
20066
  delete params.geom_format;
20064
20067
  }
20065
20068
  }
20069
+ if (defined(ilike)) {
20070
+ params.ilike = ilike;
20071
+ }
20072
+ else if (defined(like)) {
20073
+ params.like = like;
20074
+ }
20066
20075
  if (defined(srs)) {
20067
20076
  params.srs = srs;
20068
20077
  }
@@ -22984,11 +22993,12 @@ var NgwLeaflet = (function () {
22984
22993
  minus: '<path d="m12 7.5v-3h-12v3z"/>',
22985
22994
  asterisk: '<path d="m7.59 12v-3.27l2.83 1.64 1.58-2.74-2.85-1.64 2.83-1.64-1.56-2.74-2.83 1.64v-3.24h-3.17v3.24l-2.85-1.64-1.57 2.74 2.84 1.64-2.84 1.64 1.57 2.74 2.85-1.64v3.27z"/>',
22986
22995
  };
22996
+ var VIEW_BOX = 12;
22987
22997
  var STROKE = 0.8;
22988
- function generateSvg(width, height, stroke, content) {
22989
- if (stroke === void 0) { stroke = 0; }
22998
+ function generateSvg(_a) {
22999
+ var width = _a.width, height = _a.height, _b = _a.stroke, stroke = _b === void 0 ? 0 : _b, content = _a.content;
22990
23000
  var s = stroke / 2;
22991
- var svg = "<svg\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(width, "\"\n height=\"").concat(height, "\"\n viewBox=\"-").concat(s, " -").concat(s, " ").concat(width + stroke, " ").concat(height + stroke, "\"\n >").concat(content, "</svg>");
23001
+ var svg = "<svg\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(width, "\"\n height=\"").concat(height, "\"\n viewBox=\"-").concat(s, " -").concat(s, " ").concat(VIEW_BOX + stroke, " ").concat(VIEW_BOX + stroke, "\"\n >").concat(content, "</svg>");
22992
23002
  return svg;
22993
23003
  }
22994
23004
  function insertSvg(svg) {
@@ -22996,37 +23006,46 @@ var NgwLeaflet = (function () {
22996
23006
  var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
22997
23007
  return oDOM.documentElement;
22998
23008
  }
23009
+ /**
23010
+ * Retrieves an icon with the provided options.
23011
+ * @function
23012
+ * @param {IconOptions} [opt={}] - Options for the icon.
23013
+ * @returns {IconPaint} Icon paint object.
23014
+ */
22999
23015
  function getIcon(opt) {
23000
- var _a, _b, _c, _d, _e;
23016
+ var _a, _b, _c, _d, _e, _f;
23001
23017
  if (opt === void 0) { opt = {}; }
23002
- // default values
23018
+ // Default values
23003
23019
  var shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
23004
23020
  var color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
23005
23021
  var strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
23006
- var size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
23022
+ var size = (_d = opt.size) !== null && _d !== void 0 ? _d : VIEW_BOX;
23007
23023
  var rotate = (_e = opt.rotate) !== null && _e !== void 0 ? _e : 0;
23008
- var anchor = size / 2;
23009
- var defSize = 12;
23024
+ var anchor = (_f = opt.anchor) !== null && _f !== void 0 ? _f : [size / 2, size / 2];
23010
23025
  var stroke = opt.stroke !== undefined ? Number(opt.stroke) : STROKE;
23011
- var scale = size / defSize;
23012
23026
  var pathAlias = opt.p || svgPath[shape] || 'circle';
23013
23027
  var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
23014
- var svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
23015
- var fistChild = svg.firstChild;
23016
- var scaledAnchor = defSize / 2;
23017
- var transform = "scale(".concat(scale, ") rotate(").concat(rotate, ", ").concat(scaledAnchor, ", ").concat(scaledAnchor, ")");
23018
- fistChild.setAttribute('fill', color);
23028
+ var svg = insertSvg(opt.svg ||
23029
+ generateSvg({
23030
+ width: size,
23031
+ height: size,
23032
+ stroke: stroke,
23033
+ content: path,
23034
+ }));
23035
+ svg.setAttribute('width', String(size));
23036
+ svg.setAttribute('height', String(size));
23037
+ svg.setAttribute('fill', color);
23019
23038
  if (stroke) {
23020
- fistChild.setAttribute('stroke', strokeColor);
23021
- fistChild.setAttribute('stroke-width', String(stroke));
23039
+ svg.setAttribute('stroke', strokeColor);
23040
+ svg.setAttribute('stroke-width', String(stroke));
23022
23041
  }
23023
- fistChild.setAttribute('transform', transform);
23024
23042
  var s = new XMLSerializer();
23025
23043
  return {
23026
23044
  type: 'icon',
23027
23045
  iconSize: [size, size],
23028
- iconAnchor: [anchor, anchor],
23046
+ iconAnchor: anchor,
23029
23047
  html: s.serializeToString(svg),
23048
+ rotate: rotate,
23030
23049
  svg: svg,
23031
23050
  };
23032
23051
  }
@@ -23936,14 +23955,6 @@ var NgwLeaflet = (function () {
23936
23955
  };
23937
23956
  }
23938
23957
 
23939
- function createMouseEvent(_a) {
23940
- var layer = _a.layer, source = _a.source;
23941
- var layer_ = source.target;
23942
- var feature = layer_.feature;
23943
- var opt = __assign({ layer: layer, feature: feature, event: convertMapClickEvent(source), source: source }, createFeaturePositionOptions(feature));
23944
- return opt;
23945
- }
23946
-
23947
23958
  function findMostFrequentGeomType(arr) {
23948
23959
  var counts = {};
23949
23960
  for (var fry = 0; fry < arr.length; fry++) {
@@ -23999,6 +24010,195 @@ var NgwLeaflet = (function () {
23999
24010
  return BaseAdapter;
24000
24011
  }());
24001
24012
 
24013
+ function createMouseEvent(_a) {
24014
+ var layer = _a.layer, source = _a.source;
24015
+ var layer_ = source.target;
24016
+ var feature = layer_.feature;
24017
+ var opt = __assign({ layer: layer, feature: feature, event: convertMapClickEvent(source), source: source }, createFeaturePositionOptions(feature));
24018
+ return opt;
24019
+ }
24020
+
24021
+ var GeoJsonEvents = /** @class */ (function () {
24022
+ function GeoJsonEvents(layer) {
24023
+ this.layer = layer;
24024
+ }
24025
+ GeoJsonEvents.prototype.handleMouseEvents = function (layer) {
24026
+ var _this = this;
24027
+ var _a = this.layer.options, onClick = _a.onClick, onLayerClick = _a.onLayerClick, onMouseOut = _a.onMouseOut, onMouseOver = _a.onMouseOver;
24028
+ // TODO: remove backward compatibility for onLayerClick
24029
+ var onClick_ = onClick || onLayerClick;
24030
+ if (onClick_) {
24031
+ this._onclick = function (e) {
24032
+ var selected = !!_this.layer._getSelected(layer);
24033
+ onClick_(__assign({ selected: selected }, _this._createMouseEvent(e)));
24034
+ };
24035
+ layer.on('click', this._onclick, this);
24036
+ }
24037
+ if (onMouseOut) {
24038
+ this._mouseout = function (e) {
24039
+ onMouseOut(_this._createMouseEvent(e));
24040
+ };
24041
+ layer.on('mouseout', this._mouseout, this);
24042
+ }
24043
+ if (onMouseOver) {
24044
+ this._mouseover = function (e) {
24045
+ onMouseOver(_this._createMouseEvent(e));
24046
+ };
24047
+ layer.on('mouseover', this._mouseover, this);
24048
+ }
24049
+ };
24050
+ GeoJsonEvents.prototype.stopMouseEvents = function (layer) {
24051
+ if (this._mouseover) {
24052
+ layer.off('mouseover', this._mouseover, this);
24053
+ }
24054
+ if (this._mouseout) {
24055
+ layer.off('mouseout', this._mouseout, this);
24056
+ }
24057
+ if (this._onclick) {
24058
+ layer.off('click', this._onclick, this);
24059
+ }
24060
+ };
24061
+ GeoJsonEvents.prototype._createMouseEvent = function (source) {
24062
+ return createMouseEvent({
24063
+ layer: this.layer,
24064
+ source: source,
24065
+ });
24066
+ };
24067
+ return GeoJsonEvents;
24068
+ }());
24069
+
24070
+ var GeoJsonPaint = /** @class */ (function () {
24071
+ function GeoJsonPaint(layer) {
24072
+ this.layer = layer;
24073
+ }
24074
+ GeoJsonPaint.prototype.setPaintEachLayer = function (paint) {
24075
+ var _this = this;
24076
+ this.layer._layers.forEach(function (layerDef) {
24077
+ _this.setPaint(layerDef, paint);
24078
+ });
24079
+ };
24080
+ GeoJsonPaint.prototype.setPaint = function (layerDef, paint) {
24081
+ var style = undefined;
24082
+ var layer = layerDef.layer, feature = layerDef.feature;
24083
+ if (layer && feature) {
24084
+ if (isPaintCallback(paint)) {
24085
+ style = paint(feature);
24086
+ }
24087
+ else if (isPaint(paint)) {
24088
+ style = paint;
24089
+ }
24090
+ if (style) {
24091
+ if (this.layer.type === 'point' && style.type === 'icon') {
24092
+ var marker_1 = layer;
24093
+ var divIcon_1 = this._createDivIcon(style);
24094
+ setTimeout(function () {
24095
+ marker_1.setIcon(divIcon_1);
24096
+ }, 10);
24097
+ }
24098
+ else if ('setStyle' in layer) {
24099
+ layer.setStyle(this.preparePaint(style));
24100
+ }
24101
+ }
24102
+ }
24103
+ };
24104
+ GeoJsonPaint.prototype.preparePaint = function (paint) {
24105
+ if (paint.type !== 'get-paint') {
24106
+ var paintAliases = [
24107
+ ['color', 'strokeColor'],
24108
+ ['opacity', 'strokeOpacity'],
24109
+ ['stroke', 'stroke'],
24110
+ ['fillColor', 'fillColor'],
24111
+ ['fillOpacity', 'fillOpacity'],
24112
+ ['fill', 'fill'],
24113
+ ['weight', 'weight'],
24114
+ ];
24115
+ var aliases = this.layer.type === 'line'
24116
+ ? [
24117
+ ['color', 'strokeColor'],
24118
+ ['opacity', 'strokeOpacity'],
24119
+ ['weight', 'weight'],
24120
+ ]
24121
+ : paintAliases;
24122
+ var readyPaint = {};
24123
+ if ('radius' in paint && typeof paint.radius === 'number') {
24124
+ readyPaint.radius = paint.radius;
24125
+ }
24126
+ for (var _i = 0, aliases_1 = aliases; _i < aliases_1.length; _i++) {
24127
+ var _a = aliases_1[_i], to = _a[0], from = _a[1];
24128
+ var opacity = this.layer.options.opacity;
24129
+ var paintProp = paint[from];
24130
+ if (defined(opacity) && from.toLowerCase().indexOf('opacity') !== -1) {
24131
+ paintProp = Number(paintProp) * opacity;
24132
+ }
24133
+ if (paintProp !== undefined) {
24134
+ Object.defineProperty(readyPaint, to, {
24135
+ enumerable: true,
24136
+ value: paintProp,
24137
+ });
24138
+ }
24139
+ }
24140
+ return readyPaint;
24141
+ }
24142
+ return PAINT;
24143
+ };
24144
+ GeoJsonPaint.prototype._createDivIcon = function (icon) {
24145
+ var html = icon.html, rotate = icon.rotate, className = icon.className, toLIconOpt = __rest(icon, ["html", "rotate", "className"]);
24146
+ var element = document.createElement('div');
24147
+ if (className) {
24148
+ element.className = className;
24149
+ }
24150
+ if (rotate) {
24151
+ element.style.transform = "rotateZ(".concat(rotate, "deg)");
24152
+ }
24153
+ if (html) {
24154
+ element.innerHTML = html;
24155
+ }
24156
+ var divIcon = new leafletSrc.exports.DivIcon(__assign(__assign({ className: '' }, toLIconOpt), { html: element }));
24157
+ return divIcon;
24158
+ };
24159
+ GeoJsonPaint.prototype.createPaintToLayer = function (icon) {
24160
+ var _this = this;
24161
+ if (icon && icon.type) {
24162
+ if (icon.type === 'icon') {
24163
+ var iconClassName = icon.className;
24164
+ var html = icon.html;
24165
+ if (iconClassName || html) {
24166
+ return function (_, latlng) {
24167
+ var divIcon = _this._createDivIcon(icon);
24168
+ return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
24169
+ };
24170
+ }
24171
+ }
24172
+ else if (icon.type === 'pin') {
24173
+ return function (_, latlng) {
24174
+ return new leafletSrc.exports.Marker(latlng);
24175
+ };
24176
+ }
24177
+ }
24178
+ return function (_, latlng) {
24179
+ var p = PAINT;
24180
+ return new leafletSrc.exports.CircleMarker(latlng, _this.preparePaint(__assign(__assign({}, p), icon)));
24181
+ };
24182
+ };
24183
+ GeoJsonPaint.prototype.createPaintOptions = function (paint) {
24184
+ var geoJsonOptions = {};
24185
+ var newPaint = this.preparePaint(paint);
24186
+ if (paint) {
24187
+ geoJsonOptions.style = function () {
24188
+ return newPaint;
24189
+ };
24190
+ }
24191
+ if (this.layer.type === 'point') {
24192
+ geoJsonOptions.pointToLayer = this.createPaintToLayer(paint);
24193
+ }
24194
+ else if (this.layer.type === 'line') {
24195
+ newPaint.stroke = true;
24196
+ }
24197
+ return geoJsonOptions;
24198
+ };
24199
+ return GeoJsonPaint;
24200
+ }());
24201
+
24002
24202
  var GeoJsonAdapter = /** @class */ (function (_super) {
24003
24203
  __extends(GeoJsonAdapter, _super);
24004
24204
  function GeoJsonAdapter(map, options) {
@@ -24014,6 +24214,8 @@ var NgwLeaflet = (function () {
24014
24214
  _this.$unselect = function () {
24015
24215
  _this.unselect();
24016
24216
  };
24217
+ _this._events = new GeoJsonEvents(_this);
24218
+ _this._paint = new GeoJsonPaint(_this);
24017
24219
  return _this;
24018
24220
  }
24019
24221
  GeoJsonAdapter.prototype.addLayer = function (options) {
@@ -24043,7 +24245,7 @@ var NgwLeaflet = (function () {
24043
24245
  else if (!this.selected) {
24044
24246
  this.selected = true;
24045
24247
  if (this.selectedPaint) {
24046
- this._setPaintEachLayer(this.selectedPaint);
24248
+ this._paint.setPaintEachLayer(this.selectedPaint);
24047
24249
  }
24048
24250
  }
24049
24251
  };
@@ -24061,7 +24263,7 @@ var NgwLeaflet = (function () {
24061
24263
  this._removePopup(p[0]);
24062
24264
  }
24063
24265
  if (this.paint) {
24064
- this._setPaintEachLayer(this.paint);
24266
+ this._paint.setPaintEachLayer(this.paint);
24065
24267
  }
24066
24268
  this._selectedLayers.length = 0;
24067
24269
  this.selected = false;
@@ -24222,7 +24424,7 @@ var NgwLeaflet = (function () {
24222
24424
  this.paint = paint;
24223
24425
  for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
24224
24426
  var l = _a[_i];
24225
- this._setPaint(l, paint);
24427
+ this._paint.setPaint(l, paint);
24226
24428
  }
24227
24429
  }
24228
24430
  };
@@ -24231,7 +24433,7 @@ var NgwLeaflet = (function () {
24231
24433
  this.selectedPaint = paint;
24232
24434
  for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
24233
24435
  var l = _a[_i];
24234
- this._setPaint(l, paint);
24436
+ this._paint.setPaint(l, paint);
24235
24437
  }
24236
24438
  }
24237
24439
  };
@@ -24239,16 +24441,19 @@ var NgwLeaflet = (function () {
24239
24441
  this.paint = __assign(__assign({}, this.paint), paint);
24240
24442
  for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
24241
24443
  var l = _a[_i];
24242
- this._setPaint(l, this.paint);
24444
+ this._paint.setPaint(l, this.paint);
24243
24445
  }
24244
24446
  };
24245
24447
  GeoJsonAdapter.prototype.updateSelectedPaint = function (paint) {
24246
24448
  this.selectedPaint = __assign(__assign({}, this.selectedPaint), paint);
24247
24449
  for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
24248
24450
  var l = _a[_i];
24249
- this._setPaint(l, this.selectedPaint);
24451
+ this._paint.setPaint(l, this.selectedPaint);
24250
24452
  }
24251
24453
  };
24454
+ GeoJsonAdapter.prototype._getSelected = function (layer) {
24455
+ return this._selectedLayers.find(function (x) { return x.layer === layer; });
24456
+ };
24252
24457
  GeoJsonAdapter.prototype._updateTooltip = function (layerDef) {
24253
24458
  var feature = layerDef.feature, layer = layerDef.layer;
24254
24459
  if (feature && layer && feature.properties && this.options.labelField) {
@@ -24340,79 +24545,6 @@ var NgwLeaflet = (function () {
24340
24545
  }
24341
24546
  }
24342
24547
  };
24343
- GeoJsonAdapter.prototype._setPaintEachLayer = function (paint) {
24344
- var _this = this;
24345
- this._layers.forEach(function (l) {
24346
- _this._setPaint(l, paint);
24347
- });
24348
- };
24349
- GeoJsonAdapter.prototype._setPaint = function (def, paint) {
24350
- var style = undefined;
24351
- var layer = def.layer, feature = def.feature;
24352
- if (layer && feature) {
24353
- if (isPaintCallback(paint)) {
24354
- style = paint(feature);
24355
- }
24356
- else if (isPaint(paint)) {
24357
- style = paint;
24358
- }
24359
- if (style) {
24360
- if (this.type === 'point' && style.type === 'icon') {
24361
- var marker = layer;
24362
- var divIcon = this._createDivIcon(style);
24363
- marker.setIcon(divIcon);
24364
- }
24365
- else if ('setStyle' in layer) {
24366
- layer.setStyle(this._preparePaint(style));
24367
- }
24368
- }
24369
- }
24370
- };
24371
- GeoJsonAdapter.prototype._preparePaint = function (paint) {
24372
- if (paint.type !== 'get-paint') {
24373
- // const path: CircleMarkerOptions | PathOptions = paint as CircleMarkerOptions | PathOptions;
24374
- // if (path.opacity) {
24375
- // path.fillOpacity = path.opacity;
24376
- // }
24377
- var paintAliases = [
24378
- // ['color', 'color'],
24379
- ['color', 'strokeColor'],
24380
- ['opacity', 'strokeOpacity'],
24381
- ['stroke', 'stroke'],
24382
- ['fillColor', 'fillColor'],
24383
- ['fillOpacity', 'fillOpacity'],
24384
- ['fill', 'fill'],
24385
- ['weight', 'weight'],
24386
- ];
24387
- var aliases = this.type === 'line'
24388
- ? [
24389
- ['color', 'strokeColor'],
24390
- ['opacity', 'strokeOpacity'],
24391
- ['weight', 'weight'],
24392
- ]
24393
- : paintAliases;
24394
- var readyPaint = {};
24395
- if ('radius' in paint && typeof paint.radius === 'number') {
24396
- readyPaint.radius = paint.radius;
24397
- }
24398
- for (var _i = 0, aliases_1 = aliases; _i < aliases_1.length; _i++) {
24399
- var _a = aliases_1[_i], to = _a[0], from = _a[1];
24400
- var paintProp = paint[from];
24401
- if (defined(this.options.opacity) &&
24402
- from.toLowerCase().indexOf('opacity') !== -1) {
24403
- paintProp = Number(paintProp) * this.options.opacity;
24404
- }
24405
- if (paintProp !== undefined) {
24406
- Object.defineProperty(readyPaint, to, {
24407
- enumerable: true,
24408
- value: paintProp,
24409
- });
24410
- }
24411
- }
24412
- return readyPaint;
24413
- }
24414
- return PAINT;
24415
- };
24416
24548
  GeoJsonAdapter.prototype._getGeoJsonOptions = function (options, type) {
24417
24549
  var _this = this;
24418
24550
  var paint = options.paint;
@@ -24422,7 +24554,7 @@ var NgwLeaflet = (function () {
24422
24554
  // TODO: fix types (@geoman-io/leaflet-geoman-free)
24423
24555
  lopt.pointToLayer = function (feature, latLng) {
24424
24556
  var iconOpt = paint(feature);
24425
- var pointToLayer = _this._createPaintToLayer(iconOpt);
24557
+ var pointToLayer = _this._paint.createPaintToLayer(iconOpt);
24426
24558
  return pointToLayer(feature, latLng);
24427
24559
  };
24428
24560
  }
@@ -24430,17 +24562,17 @@ var NgwLeaflet = (function () {
24430
24562
  lopt = {
24431
24563
  style: function (feature) {
24432
24564
  if (feature) {
24433
- return _this._preparePaint(__assign(__assign({}, PAINT), paint(feature)));
24565
+ return _this._paint.preparePaint(__assign(__assign({}, PAINT), paint(feature)));
24434
24566
  }
24435
24567
  else {
24436
- return _this._preparePaint(__assign(__assign({}, PAINT), { type: 'path' }));
24568
+ return _this._paint.preparePaint(__assign(__assign({}, PAINT), { type: 'path' }));
24437
24569
  }
24438
24570
  },
24439
24571
  };
24440
24572
  }
24441
24573
  }
24442
24574
  else {
24443
- lopt = this._createPaintOptions(paint, type);
24575
+ lopt = this._paint.createPaintOptions(paint);
24444
24576
  }
24445
24577
  lopt.onEachFeature = function (feature, layer) {
24446
24578
  _this._onEachFeature(feature, layer);
@@ -24452,7 +24584,6 @@ var NgwLeaflet = (function () {
24452
24584
  var layer_ = this.layer;
24453
24585
  if (layer_) {
24454
24586
  var def_2 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
24455
- // @ts-ignore
24456
24587
  layer.options.pane = this.pane;
24457
24588
  this._layers.push(def_2);
24458
24589
  var ok = true;
@@ -24477,7 +24608,7 @@ var NgwLeaflet = (function () {
24477
24608
  layer.on('click', function (e) { return _this._selectOnLayerClick(e); }, this);
24478
24609
  }
24479
24610
  }
24480
- this._handleMouseEvents(layer);
24611
+ this._events.handleMouseEvents(layer);
24481
24612
  // The timeout is needed to display the popup immediately when adding a layer to the map.
24482
24613
  // Without a timeout, the layer may not yet have a _map object
24483
24614
  setTimeout(function () {
@@ -24489,37 +24620,6 @@ var NgwLeaflet = (function () {
24489
24620
  }
24490
24621
  }
24491
24622
  };
24492
- GeoJsonAdapter.prototype._handleMouseEvents = function (layer) {
24493
- var _this = this;
24494
- var _a = this.options, onClick = _a.onClick, onLayerClick = _a.onLayerClick, onMouseOut = _a.onMouseOut, onMouseOver = _a.onMouseOver;
24495
- // TODO: remove backward compatibility for onLayerClick
24496
- var onClick_ = onClick || onLayerClick;
24497
- if (onClick_) {
24498
- layer.on('click', function (e) {
24499
- var selected = !!_this._getSelected(layer);
24500
- onClick_(__assign({ selected: selected }, _this._createMouseEvent(e)));
24501
- }, this);
24502
- }
24503
- if (onMouseOut) {
24504
- layer.on('mouseout', function (e) {
24505
- onMouseOut(_this._createMouseEvent(e));
24506
- }, this);
24507
- }
24508
- if (onMouseOver) {
24509
- layer.on('mouseover', function (e) {
24510
- onMouseOver(_this._createMouseEvent(e));
24511
- }, this);
24512
- }
24513
- };
24514
- GeoJsonAdapter.prototype._createMouseEvent = function (source) {
24515
- return createMouseEvent({
24516
- layer: this,
24517
- source: source,
24518
- });
24519
- };
24520
- GeoJsonAdapter.prototype._getSelected = function (layer) {
24521
- return this._selectedLayers.find(function (x) { return x.layer === layer; });
24522
- };
24523
24623
  GeoJsonAdapter.prototype._selectOnLayerClick = function (e) {
24524
24624
  leafletSrc.exports.DomEvent.stopPropagation(e);
24525
24625
  var layer = e.target;
@@ -24549,7 +24649,7 @@ var NgwLeaflet = (function () {
24549
24649
  this.selected = true;
24550
24650
  var _a = this.options, selectedPaint = _a.selectedPaint, popupOnSelect = _a.popupOnSelect, popupOptions = _a.popupOptions;
24551
24651
  if (selectedPaint && def.layer) {
24552
- this._setPaint(def, selectedPaint);
24652
+ this._paint.setPaint(def, selectedPaint);
24553
24653
  }
24554
24654
  if (popupOnSelect) {
24555
24655
  this._openPopup(def, popupOptions, type, latlng);
@@ -24565,7 +24665,7 @@ var NgwLeaflet = (function () {
24565
24665
  this._selectedLayers.splice(index, 1);
24566
24666
  if (this.options) {
24567
24667
  if (this.options.paint) {
24568
- this._setPaint(def, this.options.paint);
24668
+ this._paint.setPaint(def, this.options.paint);
24569
24669
  }
24570
24670
  if (this.options.popupOnSelect && def.layer) {
24571
24671
  this._removePopup(def.layer);
@@ -24574,51 +24674,6 @@ var NgwLeaflet = (function () {
24574
24674
  }
24575
24675
  this.selected = this._selectedLayers.length > 0;
24576
24676
  };
24577
- GeoJsonAdapter.prototype._createDivIcon = function (icon) {
24578
- var toLIconOpt = __rest(icon, []);
24579
- return new leafletSrc.exports.DivIcon(__assign({ className: '' }, toLIconOpt));
24580
- };
24581
- GeoJsonAdapter.prototype._createPaintToLayer = function (icon) {
24582
- var _this = this;
24583
- if (icon && icon.type) {
24584
- if (icon.type === 'icon') {
24585
- var iconClassName = icon.className;
24586
- var html = icon.html;
24587
- if (iconClassName || html) {
24588
- return function (geoJsonPoint, latlng) {
24589
- var divIcon = _this._createDivIcon(icon);
24590
- return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
24591
- };
24592
- }
24593
- }
24594
- else if (icon.type === 'pin') {
24595
- return function (geoJsonPoint, latlng) {
24596
- // const divIcon = this.createDivIcon(icon);
24597
- return new leafletSrc.exports.Marker(latlng);
24598
- };
24599
- }
24600
- }
24601
- return function (geoJsonPoint, latlng) {
24602
- var p = PAINT;
24603
- return new leafletSrc.exports.CircleMarker(latlng, _this._preparePaint(__assign(__assign({}, p), icon)));
24604
- };
24605
- };
24606
- GeoJsonAdapter.prototype._createPaintOptions = function (paintOptions, type) {
24607
- var geoJsonOptions = {};
24608
- var paint = (paintOptions && this._preparePaint(paintOptions)) || {};
24609
- if (paintOptions) {
24610
- geoJsonOptions.style = function () {
24611
- return paint;
24612
- };
24613
- }
24614
- if (type === 'point') {
24615
- geoJsonOptions.pointToLayer = this._createPaintToLayer(paintOptions);
24616
- }
24617
- else if (type === 'line') {
24618
- paint.stroke = true;
24619
- }
24620
- return geoJsonOptions;
24621
- };
24622
24677
  GeoJsonAdapter.prototype._addMapClickListener = function () {
24623
24678
  var map = this.map;
24624
24679
  if (map) {