@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
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -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 events = {exports: {}};
3
3
 
4
4
  var R = typeof Reflect === 'object' ? Reflect : null;
@@ -4979,8 +4979,9 @@ class NgwConnector$1 {
4979
4979
  * ```
4980
4980
  */
4981
4981
  apiRequest(name, params_ = {}, requestOptions = {}) {
4982
- var _a;
4982
+ var _a, _b;
4983
4983
  const { method, headers, withCredentials, responseType } = requestOptions;
4984
+ params_ = (_a = requestOptions.params) !== null && _a !== void 0 ? _a : params_;
4984
4985
  const params = objectRemoveEmpty(params_);
4985
4986
  const makeApiRequest = () => apiRequest({ name, params, requestOptions, connector: this });
4986
4987
  if (requestOptions.cache && method === 'GET') {
@@ -4992,7 +4993,7 @@ class NgwConnector$1 {
4992
4993
  withCredentials,
4993
4994
  responseType,
4994
4995
  baseUrl: this.options.baseUrl,
4995
- userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
4996
+ userId: (_b = this.user) === null || _b === void 0 ? void 0 : _b.id,
4996
4997
  }),
4997
4998
  });
4998
4999
  }
@@ -5431,8 +5432,10 @@ function createGeoJsonFeature(item) {
5431
5432
  return feature;
5432
5433
  }
5433
5434
  function updateItemRequestParam(params, options) {
5434
- const { extensions, geom, fields, srs } = options;
5435
- params.extensions = extensions ? extensions.join(',') : '';
5435
+ const { extensions, geom, fields, srs, ilike, like } = options;
5436
+ if (extensions) {
5437
+ params.extensions = extensions.join(',');
5438
+ }
5436
5439
  if (fields !== undefined) {
5437
5440
  params.fields = Array.isArray(fields) ? fields.join(',') : '';
5438
5441
  }
@@ -5443,6 +5446,12 @@ function updateItemRequestParam(params, options) {
5443
5446
  delete params.geom_format;
5444
5447
  }
5445
5448
  }
5449
+ if (defined(ilike)) {
5450
+ params.ilike = ilike;
5451
+ }
5452
+ else if (defined(like)) {
5453
+ params.like = like;
5454
+ }
5446
5455
  if (defined(srs)) {
5447
5456
  params.srs = srs;
5448
5457
  }
@@ -8043,15 +8052,16 @@ const svgPath = {
8043
8052
  minus: '<path d="m12 7.5v-3h-12v3z"/>',
8044
8053
  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"/>',
8045
8054
  };
8055
+ const VIEW_BOX = 12;
8046
8056
  const STROKE = 0.8;
8047
- function generateSvg(width, height, stroke = 0, content) {
8057
+ function generateSvg({ width, height, stroke = 0, content, }) {
8048
8058
  const s = stroke / 2;
8049
8059
  const svg = `<svg
8050
8060
  version="1.1"
8051
8061
  xmlns="http://www.w3.org/2000/svg"
8052
8062
  width="${width}"
8053
8063
  height="${height}"
8054
- viewBox="-${s} -${s} ${width + stroke} ${height + stroke}"
8064
+ viewBox="-${s} -${s} ${VIEW_BOX + stroke} ${VIEW_BOX + stroke}"
8055
8065
  >${content}</svg>`;
8056
8066
  return svg;
8057
8067
  }
@@ -8060,36 +8070,45 @@ function insertSvg(svg) {
8060
8070
  const oDOM = oParser.parseFromString(svg, 'image/svg+xml');
8061
8071
  return oDOM.documentElement;
8062
8072
  }
8073
+ /**
8074
+ * Retrieves an icon with the provided options.
8075
+ * @function
8076
+ * @param {IconOptions} [opt={}] - Options for the icon.
8077
+ * @returns {IconPaint} Icon paint object.
8078
+ */
8063
8079
  function getIcon(opt = {}) {
8064
- var _a, _b, _c, _d, _e;
8065
- // default values
8080
+ var _a, _b, _c, _d, _e, _f;
8081
+ // Default values
8066
8082
  const shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
8067
8083
  const color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
8068
8084
  const strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
8069
- const size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
8085
+ const size = (_d = opt.size) !== null && _d !== void 0 ? _d : VIEW_BOX;
8070
8086
  const rotate = (_e = opt.rotate) !== null && _e !== void 0 ? _e : 0;
8071
- const anchor = size / 2;
8072
- const defSize = 12;
8087
+ const anchor = (_f = opt.anchor) !== null && _f !== void 0 ? _f : [size / 2, size / 2];
8073
8088
  const stroke = opt.stroke !== undefined ? Number(opt.stroke) : STROKE;
8074
- const scale = size / defSize;
8075
8089
  const pathAlias = opt.p || svgPath[shape] || 'circle';
8076
8090
  const path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
8077
- const svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
8078
- const fistChild = svg.firstChild;
8079
- const scaledAnchor = defSize / 2;
8080
- const transform = `scale(${scale}) rotate(${rotate}, ${scaledAnchor}, ${scaledAnchor})`;
8081
- fistChild.setAttribute('fill', color);
8091
+ const svg = insertSvg(opt.svg ||
8092
+ generateSvg({
8093
+ width: size,
8094
+ height: size,
8095
+ stroke,
8096
+ content: path,
8097
+ }));
8098
+ svg.setAttribute('width', String(size));
8099
+ svg.setAttribute('height', String(size));
8100
+ svg.setAttribute('fill', color);
8082
8101
  if (stroke) {
8083
- fistChild.setAttribute('stroke', strokeColor);
8084
- fistChild.setAttribute('stroke-width', String(stroke));
8102
+ svg.setAttribute('stroke', strokeColor);
8103
+ svg.setAttribute('stroke-width', String(stroke));
8085
8104
  }
8086
- fistChild.setAttribute('transform', transform);
8087
8105
  const s = new XMLSerializer();
8088
8106
  return {
8089
8107
  type: 'icon',
8090
8108
  iconSize: [size, size],
8091
- iconAnchor: [anchor, anchor],
8109
+ iconAnchor: anchor,
8092
8110
  html: s.serializeToString(svg),
8111
+ rotate,
8093
8112
  svg,
8094
8113
  };
8095
8114
  }