@nextgis/ngw-leaflet 1.16.1 → 1.16.2
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/lib/ngw-leaflet.esm-browser.js +92 -83
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +2 -2
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +92 -83
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +2 -2
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 1.16.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 1.16.2; author: NextGIS */
|
|
2
2
|
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -15404,6 +15404,11 @@ function objectRemoveEmpty(obj) {
|
|
|
15404
15404
|
return newObj;
|
|
15405
15405
|
}
|
|
15406
15406
|
|
|
15407
|
+
function round(val, toFixed) {
|
|
15408
|
+
var n = toFixed ? Number('1e+' + toFixed) : 1;
|
|
15409
|
+
return Math.round((val + Number.EPSILON) * n) / n;
|
|
15410
|
+
}
|
|
15411
|
+
|
|
15407
15412
|
function isObject$1(val) {
|
|
15408
15413
|
return Object.prototype.toString.call(val) === '[object Object]';
|
|
15409
15414
|
}
|
|
@@ -18292,6 +18297,65 @@ function template(str, data) {
|
|
|
18292
18297
|
});
|
|
18293
18298
|
}
|
|
18294
18299
|
|
|
18300
|
+
function apiRequest(opt) {
|
|
18301
|
+
var params = opt.params;
|
|
18302
|
+
return new CancelablePromise(function (resolve, reject) {
|
|
18303
|
+
opt.connector
|
|
18304
|
+
.connect()
|
|
18305
|
+
.then(function (apiItems) {
|
|
18306
|
+
var apiItem = apiItems && apiItems[opt.name];
|
|
18307
|
+
if (apiItem) {
|
|
18308
|
+
apiItem = __spreadArray([], apiItem, true);
|
|
18309
|
+
var url = apiItem.shift();
|
|
18310
|
+
if (apiItem.length) {
|
|
18311
|
+
var replaceParams = {};
|
|
18312
|
+
for (var fry = 0; fry < apiItem.length; fry++) {
|
|
18313
|
+
var arg = apiItem[fry];
|
|
18314
|
+
replaceParams[fry] = '{' + arg + '}';
|
|
18315
|
+
if (params[arg] === undefined) {
|
|
18316
|
+
throw new Error('`' + arg + '`' + ' url api argument is not specified');
|
|
18317
|
+
}
|
|
18318
|
+
}
|
|
18319
|
+
if (url) {
|
|
18320
|
+
url = template(url, replaceParams);
|
|
18321
|
+
}
|
|
18322
|
+
}
|
|
18323
|
+
// Transfer part of the parameters from `params` to the URL string
|
|
18324
|
+
if (params) {
|
|
18325
|
+
var paramArray_1 = [];
|
|
18326
|
+
var paramList = params.paramList;
|
|
18327
|
+
if (Array.isArray(paramList)) {
|
|
18328
|
+
delete params.paramList;
|
|
18329
|
+
paramList.forEach(function (x) {
|
|
18330
|
+
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
18331
|
+
});
|
|
18332
|
+
}
|
|
18333
|
+
for (var p in params) {
|
|
18334
|
+
if (apiItem.indexOf(p) === -1) {
|
|
18335
|
+
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
18336
|
+
}
|
|
18337
|
+
}
|
|
18338
|
+
if (paramArray_1.length) {
|
|
18339
|
+
url = url + '?' + paramArray_1.join('&');
|
|
18340
|
+
}
|
|
18341
|
+
}
|
|
18342
|
+
if (url) {
|
|
18343
|
+
resolve(opt.connector.makeQuery(url, params, opt.requestOptions));
|
|
18344
|
+
}
|
|
18345
|
+
else {
|
|
18346
|
+
reject(new Error('request url is not set'));
|
|
18347
|
+
}
|
|
18348
|
+
}
|
|
18349
|
+
else {
|
|
18350
|
+
resolve(undefined);
|
|
18351
|
+
}
|
|
18352
|
+
})
|
|
18353
|
+
.catch(function (er) {
|
|
18354
|
+
reject(er);
|
|
18355
|
+
});
|
|
18356
|
+
});
|
|
18357
|
+
}
|
|
18358
|
+
|
|
18295
18359
|
/**
|
|
18296
18360
|
* Thrown when ...
|
|
18297
18361
|
*/
|
|
@@ -18657,65 +18721,6 @@ var ResourcesControl = /** @class */ (function () {
|
|
|
18657
18721
|
return ResourcesControl;
|
|
18658
18722
|
}());
|
|
18659
18723
|
|
|
18660
|
-
function apiRequest(opt) {
|
|
18661
|
-
var params = opt.params;
|
|
18662
|
-
return new CancelablePromise(function (resolve, reject) {
|
|
18663
|
-
opt.connector
|
|
18664
|
-
.connect()
|
|
18665
|
-
.then(function (apiItems) {
|
|
18666
|
-
var apiItem = apiItems && apiItems[opt.name];
|
|
18667
|
-
if (apiItem) {
|
|
18668
|
-
apiItem = __spreadArray([], apiItem, true);
|
|
18669
|
-
var url = apiItem.shift();
|
|
18670
|
-
if (apiItem.length) {
|
|
18671
|
-
var replaceParams = {};
|
|
18672
|
-
for (var fry = 0; fry < apiItem.length; fry++) {
|
|
18673
|
-
var arg = apiItem[fry];
|
|
18674
|
-
replaceParams[fry] = '{' + arg + '}';
|
|
18675
|
-
if (params[arg] === undefined) {
|
|
18676
|
-
throw new Error('`' + arg + '`' + ' url api argument is not specified');
|
|
18677
|
-
}
|
|
18678
|
-
}
|
|
18679
|
-
if (url) {
|
|
18680
|
-
url = template(url, replaceParams);
|
|
18681
|
-
}
|
|
18682
|
-
}
|
|
18683
|
-
// Transfer part of the parameters from `params` to the URL string
|
|
18684
|
-
if (params) {
|
|
18685
|
-
var paramArray_1 = [];
|
|
18686
|
-
var paramList = params.paramList;
|
|
18687
|
-
if (Array.isArray(paramList)) {
|
|
18688
|
-
delete params.paramList;
|
|
18689
|
-
paramList.forEach(function (x) {
|
|
18690
|
-
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
18691
|
-
});
|
|
18692
|
-
}
|
|
18693
|
-
for (var p in params) {
|
|
18694
|
-
if (apiItem.indexOf(p) === -1) {
|
|
18695
|
-
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
18696
|
-
}
|
|
18697
|
-
}
|
|
18698
|
-
if (paramArray_1.length) {
|
|
18699
|
-
url = url + '?' + paramArray_1.join('&');
|
|
18700
|
-
}
|
|
18701
|
-
}
|
|
18702
|
-
if (url) {
|
|
18703
|
-
resolve(opt.connector.makeQuery(url, params, opt.requestOptions));
|
|
18704
|
-
}
|
|
18705
|
-
else {
|
|
18706
|
-
reject(new Error('request url is not set'));
|
|
18707
|
-
}
|
|
18708
|
-
}
|
|
18709
|
-
else {
|
|
18710
|
-
resolve(undefined);
|
|
18711
|
-
}
|
|
18712
|
-
})
|
|
18713
|
-
.catch(function (er) {
|
|
18714
|
-
reject(er);
|
|
18715
|
-
});
|
|
18716
|
-
});
|
|
18717
|
-
}
|
|
18718
|
-
|
|
18719
18724
|
var ID$1 = 0;
|
|
18720
18725
|
var NgwConnector = /** @class */ (function () {
|
|
18721
18726
|
function NgwConnector(options) {
|
|
@@ -18786,9 +18791,9 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18786
18791
|
if (auth) {
|
|
18787
18792
|
var login = auth.login, password = auth.password;
|
|
18788
18793
|
if (login && password) {
|
|
18789
|
-
return _this.
|
|
18794
|
+
return _this._login({ login: login, password: password })
|
|
18790
18795
|
.then(function () {
|
|
18791
|
-
makeQuery();
|
|
18796
|
+
return makeQuery();
|
|
18792
18797
|
})
|
|
18793
18798
|
.catch(function (er) { return reject(er); });
|
|
18794
18799
|
}
|
|
@@ -18806,10 +18811,10 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18806
18811
|
* Quick way to change NextGIS Web user.
|
|
18807
18812
|
* @param credentials - New user credentials
|
|
18808
18813
|
*/
|
|
18809
|
-
NgwConnector.prototype.login = function (credentials) {
|
|
18814
|
+
NgwConnector.prototype.login = function (credentials, options) {
|
|
18810
18815
|
this.logout();
|
|
18811
18816
|
addConnector(this);
|
|
18812
|
-
return this.
|
|
18817
|
+
return this._login(credentials, options);
|
|
18813
18818
|
};
|
|
18814
18819
|
/**
|
|
18815
18820
|
* Disconnecting a user. Aborting all current requests
|
|
@@ -18822,29 +18827,16 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18822
18827
|
this.emitter.emit('logout');
|
|
18823
18828
|
this.resources.cache.clean();
|
|
18824
18829
|
};
|
|
18825
|
-
NgwConnector.prototype.getUserInfo = function (credentials) {
|
|
18826
|
-
var _this = this;
|
|
18830
|
+
NgwConnector.prototype.getUserInfo = function (credentials, options) {
|
|
18827
18831
|
if (this.user && this.user.id) {
|
|
18828
18832
|
return CancelablePromise.resolve(this.user);
|
|
18829
18833
|
}
|
|
18830
18834
|
if (credentials) {
|
|
18831
18835
|
this.options.auth = credentials;
|
|
18832
18836
|
}
|
|
18833
|
-
var
|
|
18834
|
-
headers: this.getAuthorizationHeaders(credentials),
|
|
18835
|
-
// withCredentials: true
|
|
18836
|
-
};
|
|
18837
|
+
var options_ = __assign({ headers: this.getAuthorizationHeaders(credentials) }, options);
|
|
18837
18838
|
// Do not use apiRequest('auth.current_user') to avoid circular-references
|
|
18838
|
-
return this.makeQuery('/api/component/auth/current_user', {},
|
|
18839
|
-
.then(function (data) {
|
|
18840
|
-
_this.user = data;
|
|
18841
|
-
_this.emitter.emit('login', data);
|
|
18842
|
-
return data;
|
|
18843
|
-
})
|
|
18844
|
-
.catch(function (er) {
|
|
18845
|
-
_this.emitter.emit('login:error', er);
|
|
18846
|
-
throw er;
|
|
18847
|
-
});
|
|
18839
|
+
return this.makeQuery('/api/component/auth/current_user', {}, options_);
|
|
18848
18840
|
};
|
|
18849
18841
|
/**
|
|
18850
18842
|
* Obtaining the required Headers for authentication of requests in the NGW.
|
|
@@ -18910,6 +18902,7 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18910
18902
|
*/
|
|
18911
18903
|
NgwConnector.prototype.apiRequest = function (name, params_, requestOptions) {
|
|
18912
18904
|
var _this = this;
|
|
18905
|
+
var _a;
|
|
18913
18906
|
if (params_ === void 0) { params_ = {}; }
|
|
18914
18907
|
if (requestOptions === void 0) { requestOptions = {}; }
|
|
18915
18908
|
var method = requestOptions.method, headers = requestOptions.headers, withCredentials = requestOptions.withCredentials, responseType = requestOptions.responseType;
|
|
@@ -18924,7 +18917,7 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18924
18917
|
withCredentials: withCredentials,
|
|
18925
18918
|
responseType: responseType,
|
|
18926
18919
|
baseUrl: this.options.baseUrl,
|
|
18927
|
-
|
|
18920
|
+
userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
|
|
18928
18921
|
})));
|
|
18929
18922
|
}
|
|
18930
18923
|
return makeApiRequest();
|
|
@@ -19133,6 +19126,19 @@ var NgwConnector = /** @class */ (function () {
|
|
|
19133
19126
|
this.activeRequests.push(request);
|
|
19134
19127
|
return request;
|
|
19135
19128
|
};
|
|
19129
|
+
NgwConnector.prototype._login = function (credentials, options) {
|
|
19130
|
+
var _this = this;
|
|
19131
|
+
return this.getUserInfo(credentials, options)
|
|
19132
|
+
.then(function (data) {
|
|
19133
|
+
_this.user = data;
|
|
19134
|
+
_this.emitter.emit('login', data);
|
|
19135
|
+
return data;
|
|
19136
|
+
})
|
|
19137
|
+
.catch(function (er) {
|
|
19138
|
+
_this.emitter.emit('login:error', er);
|
|
19139
|
+
throw er;
|
|
19140
|
+
});
|
|
19141
|
+
};
|
|
19136
19142
|
NgwConnector.prototype._cleanActiveRequests = function (request) {
|
|
19137
19143
|
var activeRequestIndex = this.activeRequests.indexOf(request);
|
|
19138
19144
|
if (activeRequestIndex !== -1) {
|
|
@@ -19464,14 +19470,14 @@ function getQueries(opt, _queries, _parentAllParams) {
|
|
|
19464
19470
|
function createWktFromCoordArray(coord) {
|
|
19465
19471
|
var polygon = coord.map(function (_a) {
|
|
19466
19472
|
var lng = _a[0], lat = _a[1];
|
|
19467
|
-
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
19473
|
+
var _b = degrees2meters(lng, lat).map(function (c) { return round(c); }), x = _b[0], y = _b[1];
|
|
19468
19474
|
return x + ' ' + y;
|
|
19469
19475
|
});
|
|
19470
19476
|
return "POLYGON((".concat(polygon.join(', '), "))");
|
|
19471
19477
|
}
|
|
19472
19478
|
function fetchNgwLayerItemsRequest(options) {
|
|
19473
19479
|
var params = __assign({}, FEATURE_REQUEST_PARAMS);
|
|
19474
|
-
var limit = options.limit, cache = options.cache, signal = options.signal, offset = options.offset, orderBy = options.orderBy, paramList = options.paramList, connector = options.connector, intersects = options.intersects, resourceId = options.resourceId;
|
|
19480
|
+
var limit = options.limit, cache = options.cache, signal = options.signal, offset = options.offset, orderBy = options.orderBy, paramList = options.paramList, connector = options.connector, geomFormat = options.geomFormat, intersects = options.intersects, resourceId = options.resourceId;
|
|
19475
19481
|
if (limit) {
|
|
19476
19482
|
if (limit !== Number.POSITIVE_INFINITY) {
|
|
19477
19483
|
params.limit = limit;
|
|
@@ -19484,6 +19490,9 @@ function fetchNgwLayerItemsRequest(options) {
|
|
|
19484
19490
|
if (offset) {
|
|
19485
19491
|
params.offset = offset;
|
|
19486
19492
|
}
|
|
19493
|
+
if (geomFormat) {
|
|
19494
|
+
params.geom_format = geomFormat;
|
|
19495
|
+
}
|
|
19487
19496
|
updateItemRequestParam(params, options);
|
|
19488
19497
|
if (orderBy) {
|
|
19489
19498
|
params.order_by = orderBy.join(',');
|