@nextgis/ngw-map 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-map; version: 1.18.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.18.6; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import CancelablePromise from '@nextgis/cancelable-promise';
4
4
  import { deepmerge, deprecatedWarn, defined, isObject, getIdentifyRadius } from '@nextgis/utils';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.18.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.18.6; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -5511,10 +5511,11 @@ var NgwMap = (function (exports) {
5511
5511
  */
5512
5512
  NgwConnector.prototype.apiRequest = function (name, params_, requestOptions) {
5513
5513
  var _this = this;
5514
- var _a;
5514
+ var _a, _b;
5515
5515
  if (params_ === void 0) { params_ = {}; }
5516
5516
  if (requestOptions === void 0) { requestOptions = {}; }
5517
5517
  var method = requestOptions.method, headers = requestOptions.headers, withCredentials = requestOptions.withCredentials, responseType = requestOptions.responseType;
5518
+ params_ = (_a = requestOptions.params) !== null && _a !== void 0 ? _a : params_;
5518
5519
  var params = objectRemoveEmpty(params_);
5519
5520
  var makeApiRequest = function () {
5520
5521
  return apiRequest({ name: name, params: params, requestOptions: requestOptions, connector: _this });
@@ -5526,7 +5527,7 @@ var NgwMap = (function (exports) {
5526
5527
  withCredentials: withCredentials,
5527
5528
  responseType: responseType,
5528
5529
  baseUrl: this.options.baseUrl,
5529
- userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
5530
+ userId: (_b = this.user) === null || _b === void 0 ? void 0 : _b.id,
5530
5531
  })));
5531
5532
  }
5532
5533
  return makeApiRequest();
@@ -5989,8 +5990,10 @@ var NgwMap = (function (exports) {
5989
5990
  return feature;
5990
5991
  }
5991
5992
  function updateItemRequestParam(params, options) {
5992
- var extensions = options.extensions, geom = options.geom, fields = options.fields, srs = options.srs;
5993
- params.extensions = extensions ? extensions.join(',') : '';
5993
+ var extensions = options.extensions, geom = options.geom, fields = options.fields, srs = options.srs, ilike = options.ilike, like = options.like;
5994
+ if (extensions) {
5995
+ params.extensions = extensions.join(',');
5996
+ }
5994
5997
  if (fields !== undefined) {
5995
5998
  params.fields = Array.isArray(fields) ? fields.join(',') : '';
5996
5999
  }
@@ -6001,6 +6004,12 @@ var NgwMap = (function (exports) {
6001
6004
  delete params.geom_format;
6002
6005
  }
6003
6006
  }
6007
+ if (defined(ilike)) {
6008
+ params.ilike = ilike;
6009
+ }
6010
+ else if (defined(like)) {
6011
+ params.like = like;
6012
+ }
6004
6013
  if (defined(srs)) {
6005
6014
  params.srs = srs;
6006
6015
  }
@@ -8922,11 +8931,12 @@ var NgwMap = (function (exports) {
8922
8931
  minus: '<path d="m12 7.5v-3h-12v3z"/>',
8923
8932
  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"/>',
8924
8933
  };
8934
+ var VIEW_BOX = 12;
8925
8935
  var STROKE = 0.8;
8926
- function generateSvg(width, height, stroke, content) {
8927
- if (stroke === void 0) { stroke = 0; }
8936
+ function generateSvg(_a) {
8937
+ var width = _a.width, height = _a.height, _b = _a.stroke, stroke = _b === void 0 ? 0 : _b, content = _a.content;
8928
8938
  var s = stroke / 2;
8929
- 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>");
8939
+ 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>");
8930
8940
  return svg;
8931
8941
  }
8932
8942
  function insertSvg(svg) {
@@ -8934,37 +8944,46 @@ var NgwMap = (function (exports) {
8934
8944
  var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
8935
8945
  return oDOM.documentElement;
8936
8946
  }
8947
+ /**
8948
+ * Retrieves an icon with the provided options.
8949
+ * @function
8950
+ * @param {IconOptions} [opt={}] - Options for the icon.
8951
+ * @returns {IconPaint} Icon paint object.
8952
+ */
8937
8953
  function getIcon(opt) {
8938
- var _a, _b, _c, _d, _e;
8954
+ var _a, _b, _c, _d, _e, _f;
8939
8955
  if (opt === void 0) { opt = {}; }
8940
- // default values
8956
+ // Default values
8941
8957
  var shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
8942
8958
  var color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
8943
8959
  var strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
8944
- var size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
8960
+ var size = (_d = opt.size) !== null && _d !== void 0 ? _d : VIEW_BOX;
8945
8961
  var rotate = (_e = opt.rotate) !== null && _e !== void 0 ? _e : 0;
8946
- var anchor = size / 2;
8947
- var defSize = 12;
8962
+ var anchor = (_f = opt.anchor) !== null && _f !== void 0 ? _f : [size / 2, size / 2];
8948
8963
  var stroke = opt.stroke !== undefined ? Number(opt.stroke) : STROKE;
8949
- var scale = size / defSize;
8950
8964
  var pathAlias = opt.p || svgPath[shape] || 'circle';
8951
8965
  var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
8952
- var svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
8953
- var fistChild = svg.firstChild;
8954
- var scaledAnchor = defSize / 2;
8955
- var transform = "scale(".concat(scale, ") rotate(").concat(rotate, ", ").concat(scaledAnchor, ", ").concat(scaledAnchor, ")");
8956
- fistChild.setAttribute('fill', color);
8966
+ var svg = insertSvg(opt.svg ||
8967
+ generateSvg({
8968
+ width: size,
8969
+ height: size,
8970
+ stroke: stroke,
8971
+ content: path,
8972
+ }));
8973
+ svg.setAttribute('width', String(size));
8974
+ svg.setAttribute('height', String(size));
8975
+ svg.setAttribute('fill', color);
8957
8976
  if (stroke) {
8958
- fistChild.setAttribute('stroke', strokeColor);
8959
- fistChild.setAttribute('stroke-width', String(stroke));
8977
+ svg.setAttribute('stroke', strokeColor);
8978
+ svg.setAttribute('stroke-width', String(stroke));
8960
8979
  }
8961
- fistChild.setAttribute('transform', transform);
8962
8980
  var s = new XMLSerializer();
8963
8981
  return {
8964
8982
  type: 'icon',
8965
8983
  iconSize: [size, size],
8966
- iconAnchor: [anchor, anchor],
8984
+ iconAnchor: anchor,
8967
8985
  html: s.serializeToString(svg),
8986
+ rotate: rotate,
8968
8987
  svg: svg,
8969
8988
  };
8970
8989
  }