@nextgis/ngw-map 3.0.0-alpha.3 → 3.0.0-alpha.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/lib/ngw-map.cjs.js +2 -2
- package/lib/ngw-map.cjs.js.map +1 -1
- package/lib/ngw-map.cjs.prod.js +1 -1
- package/lib/ngw-map.cjs.prod.js.map +1 -1
- package/lib/ngw-map.esm-browser.js +1635 -1061
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +2 -2
- package/lib/ngw-map.esm-bundler.js.map +1 -1
- package/lib/ngw-map.esm-bundler.prod.js +1 -1
- package/lib/ngw-map.esm-bundler.prod.js.map +1 -1
- package/lib/ngw-map.global.js +1635 -1061
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +9 -9
package/lib/ngw-map.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.5; author: NextGIS */
|
|
2
2
|
var NgwMap = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -32,7 +32,7 @@ var NgwMap = (function (exports) {
|
|
|
32
32
|
this.domain = null;
|
|
33
33
|
if (EventEmitter.usingDomains) {
|
|
34
34
|
// if there is an active domain, then attach to it.
|
|
35
|
-
if (domain.active
|
|
35
|
+
if (domain.active) ;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
|
@@ -827,12 +827,12 @@ var NgwMap = (function (exports) {
|
|
|
827
827
|
return url.replace(/([^:]\/)\/+/g, "$1");
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
-
var __defProp$
|
|
831
|
-
var __defNormalProp$
|
|
832
|
-
var __publicField$
|
|
830
|
+
var __defProp$P = Object.defineProperty;
|
|
831
|
+
var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
832
|
+
var __publicField$y = (obj, key, value) => __defNormalProp$P(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
833
833
|
const _Cache = class _Cache {
|
|
834
834
|
constructor(options = {}) {
|
|
835
|
-
__publicField$
|
|
835
|
+
__publicField$y(this, "cache", []);
|
|
836
836
|
var _a;
|
|
837
837
|
const namespace = (_a = options.namespace) != null ? _a : "default";
|
|
838
838
|
if (_Cache.instance[namespace]) {
|
|
@@ -938,12 +938,12 @@ var NgwMap = (function (exports) {
|
|
|
938
938
|
return objectDeepEqual(itemProps || {}, objectRemoveEmpty(props));
|
|
939
939
|
}
|
|
940
940
|
};
|
|
941
|
-
__publicField$
|
|
941
|
+
__publicField$y(_Cache, "instance", {});
|
|
942
942
|
let Cache = _Cache;
|
|
943
943
|
|
|
944
944
|
var pkg = {
|
|
945
945
|
name: "@nextgis/ngw-connector",
|
|
946
|
-
version: "3.0.0-alpha.
|
|
946
|
+
version: "3.0.0-alpha.5",
|
|
947
947
|
_priority: 12,
|
|
948
948
|
description: "A lightweight HTTP client optimized for use with NextGIS Web API",
|
|
949
949
|
main: "index.js",
|
|
@@ -952,15 +952,15 @@ var NgwMap = (function (exports) {
|
|
|
952
952
|
jsdelivr: "lib/ngw-connector.global.prod.js",
|
|
953
953
|
types: "lib/index.d.ts",
|
|
954
954
|
dependencies: {
|
|
955
|
-
"@nextgis/cache": "^3.0.0-alpha.
|
|
956
|
-
"@nextgis/cancelable-promise": "^3.0.0-alpha.
|
|
957
|
-
"@nextgis/utils": "^3.0.0-alpha.
|
|
955
|
+
"@nextgis/cache": "^3.0.0-alpha.5",
|
|
956
|
+
"@nextgis/cancelable-promise": "^3.0.0-alpha.5",
|
|
957
|
+
"@nextgis/utils": "^3.0.0-alpha.5",
|
|
958
958
|
"@types/events": "^3.0.0",
|
|
959
959
|
events: "*",
|
|
960
960
|
"form-data": "^4.0.0"
|
|
961
961
|
},
|
|
962
962
|
devDependencies: {
|
|
963
|
-
"@nextgis/build-tools": "^3.0.0-alpha.
|
|
963
|
+
"@nextgis/build-tools": "^3.0.0-alpha.5"
|
|
964
964
|
},
|
|
965
965
|
scripts: {
|
|
966
966
|
clean: "rimraf ./lib",
|
|
@@ -994,87 +994,179 @@ var NgwMap = (function (exports) {
|
|
|
994
994
|
type: "git",
|
|
995
995
|
url: "git://github.com/nextgis/nextgis_frontend.git"
|
|
996
996
|
},
|
|
997
|
+
engines: {
|
|
998
|
+
node: ">=18.20.4"
|
|
999
|
+
},
|
|
997
1000
|
gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
|
|
998
1001
|
};
|
|
999
1002
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
+
const CONNECTORS = [];
|
|
1004
|
+
function addConnector(connector) {
|
|
1005
|
+
CONNECTORS.push(connector);
|
|
1006
|
+
}
|
|
1007
|
+
function findConnector(options) {
|
|
1008
|
+
return CONNECTORS.find((x) => {
|
|
1009
|
+
if (x.options.baseUrl === options.baseUrl) {
|
|
1010
|
+
if (options.auth) {
|
|
1011
|
+
if (x.options.auth) {
|
|
1012
|
+
return objectDeepEqual(x.options.auth, options.auth);
|
|
1013
|
+
}
|
|
1014
|
+
} else {
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
function removeConnector(connector) {
|
|
1021
|
+
const index = CONNECTORS.indexOf(connector);
|
|
1022
|
+
if (index !== -1) {
|
|
1023
|
+
CONNECTORS.splice(index, 1);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
class AbortError extends Error {
|
|
1028
|
+
constructor(message = "AbortError") {
|
|
1029
|
+
super(message);
|
|
1030
|
+
this.name = "AbortError";
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
var __defProp$O = Object.defineProperty;
|
|
1035
|
+
var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1036
|
+
var __publicField$x = (obj, key, value) => __defNormalProp$O(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1003
1037
|
class NgwError extends Error {
|
|
1004
1038
|
constructor(er) {
|
|
1005
1039
|
super();
|
|
1006
|
-
__publicField$
|
|
1007
|
-
__publicField$
|
|
1008
|
-
__publicField$
|
|
1009
|
-
__publicField$
|
|
1010
|
-
__publicField$
|
|
1011
|
-
__publicField$
|
|
1012
|
-
__publicField$
|
|
1013
|
-
__publicField$
|
|
1040
|
+
__publicField$x(this, "name", "NgwError");
|
|
1041
|
+
__publicField$x(this, "title");
|
|
1042
|
+
__publicField$x(this, "message");
|
|
1043
|
+
__publicField$x(this, "detail");
|
|
1044
|
+
__publicField$x(this, "exception");
|
|
1045
|
+
__publicField$x(this, "status_code");
|
|
1046
|
+
__publicField$x(this, "data");
|
|
1047
|
+
__publicField$x(this, "guru_meditation");
|
|
1014
1048
|
Object.assign(this, er);
|
|
1015
1049
|
Object.setPrototypeOf(this, NgwError.prototype);
|
|
1016
1050
|
}
|
|
1017
1051
|
}
|
|
1018
1052
|
|
|
1019
|
-
var __defProp$
|
|
1020
|
-
var __defNormalProp$
|
|
1021
|
-
var __publicField$
|
|
1053
|
+
var __defProp$N = Object.defineProperty;
|
|
1054
|
+
var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1055
|
+
var __publicField$w = (obj, key, value) => __defNormalProp$N(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1056
|
+
class InsufficientPermissionsError extends NgwError {
|
|
1057
|
+
constructor(obj) {
|
|
1058
|
+
super(obj);
|
|
1059
|
+
__publicField$w(this, "name", "InsufficientPermissionsError");
|
|
1060
|
+
__publicField$w(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
|
|
1061
|
+
Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
var __defProp$M = Object.defineProperty;
|
|
1066
|
+
var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1067
|
+
var __publicField$v = (obj, key, value) => __defNormalProp$M(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1022
1068
|
class ResourceNotFoundError extends NgwError {
|
|
1023
1069
|
constructor(obj) {
|
|
1024
1070
|
super(obj);
|
|
1025
|
-
__publicField$
|
|
1026
|
-
__publicField$
|
|
1071
|
+
__publicField$v(this, "name", "ResourceNotFoundError");
|
|
1072
|
+
__publicField$v(this, "exception", "nextgisweb.resource.exception.ResourceNotFound");
|
|
1027
1073
|
Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
|
|
1028
1074
|
}
|
|
1029
1075
|
}
|
|
1030
1076
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1077
|
+
var __defProp$L = Object.defineProperty;
|
|
1078
|
+
var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1079
|
+
var __publicField$u = (obj, key, value) => __defNormalProp$L(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1080
|
+
class BaseAPIError extends Error {
|
|
1081
|
+
constructor(message) {
|
|
1082
|
+
super(message || "Something went wrong.");
|
|
1083
|
+
__publicField$u(this, "title");
|
|
1084
|
+
this.name = "BaseAPIError";
|
|
1085
|
+
this.title = "Unknown API error";
|
|
1086
|
+
if (Error.captureStackTrace) {
|
|
1087
|
+
Error.captureStackTrace(this, BaseAPIError);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1033
1090
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1091
|
+
class NetworksResponseError extends BaseAPIError {
|
|
1092
|
+
// prettier-ignore
|
|
1093
|
+
constructor(message) {
|
|
1094
|
+
super(message || "There is no response from the server or problem connecting to server.");
|
|
1095
|
+
__publicField$u(this, "detail");
|
|
1096
|
+
this.title = "Network error";
|
|
1097
|
+
this.detail = "Check network connectivity and try again later.";
|
|
1098
|
+
}
|
|
1037
1099
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1100
|
+
class InvalidResponseError extends BaseAPIError {
|
|
1101
|
+
constructor(message) {
|
|
1102
|
+
super(message || "Something went wrong.");
|
|
1103
|
+
this.title = "Unexpected server response";
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
class ServerResponseError extends BaseAPIError {
|
|
1107
|
+
constructor(data) {
|
|
1108
|
+
super(data.message);
|
|
1109
|
+
__publicField$u(this, "detail");
|
|
1110
|
+
__publicField$u(this, "data");
|
|
1111
|
+
this.title = data.title || this.title;
|
|
1112
|
+
this.detail = data.detail || null;
|
|
1113
|
+
this.data = data;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
class LunkwillError extends Error {
|
|
1117
|
+
// prettier-ignore
|
|
1118
|
+
constructor(message, data = {}) {
|
|
1119
|
+
super(message || "Unexpected error while processing long-running request.");
|
|
1120
|
+
__publicField$u(this, "title");
|
|
1121
|
+
__publicField$u(this, "data");
|
|
1122
|
+
this.name = "LunkwillError";
|
|
1123
|
+
this.title = "Long-running request error";
|
|
1124
|
+
this.data = data;
|
|
1125
|
+
if (Error.captureStackTrace) {
|
|
1126
|
+
Error.captureStackTrace(this, LunkwillError);
|
|
1055
1127
|
}
|
|
1056
1128
|
}
|
|
1057
|
-
|
|
1129
|
+
}
|
|
1130
|
+
class LunkwillRequestCancelled extends LunkwillError {
|
|
1131
|
+
constructor(data) {
|
|
1132
|
+
super("Long-running request was cancelled.", data);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
class LunkwillRequestFailed extends LunkwillError {
|
|
1136
|
+
constructor(data) {
|
|
1137
|
+
super(void 0, data);
|
|
1138
|
+
}
|
|
1058
1139
|
}
|
|
1059
1140
|
|
|
1060
|
-
var __defProp$
|
|
1061
|
-
var __getOwnPropSymbols$
|
|
1062
|
-
var __hasOwnProp$
|
|
1063
|
-
var __propIsEnum$
|
|
1064
|
-
var __defNormalProp$
|
|
1065
|
-
var __spreadValues$
|
|
1141
|
+
var __defProp$K = Object.defineProperty;
|
|
1142
|
+
var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
|
|
1143
|
+
var __hasOwnProp$y = Object.prototype.hasOwnProperty;
|
|
1144
|
+
var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
|
|
1145
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1146
|
+
var __spreadValues$x = (a, b) => {
|
|
1066
1147
|
for (var prop in b || (b = {}))
|
|
1067
|
-
if (__hasOwnProp$
|
|
1068
|
-
__defNormalProp$
|
|
1069
|
-
if (__getOwnPropSymbols$
|
|
1070
|
-
for (var prop of __getOwnPropSymbols$
|
|
1071
|
-
if (__propIsEnum$
|
|
1072
|
-
__defNormalProp$
|
|
1148
|
+
if (__hasOwnProp$y.call(b, prop))
|
|
1149
|
+
__defNormalProp$K(a, prop, b[prop]);
|
|
1150
|
+
if (__getOwnPropSymbols$y)
|
|
1151
|
+
for (var prop of __getOwnPropSymbols$y(b)) {
|
|
1152
|
+
if (__propIsEnum$y.call(b, prop))
|
|
1153
|
+
__defNormalProp$K(a, prop, b[prop]);
|
|
1073
1154
|
}
|
|
1074
1155
|
return a;
|
|
1075
1156
|
};
|
|
1076
|
-
var
|
|
1077
|
-
|
|
1157
|
+
var __objRest$5 = (source, exclude) => {
|
|
1158
|
+
var target = {};
|
|
1159
|
+
for (var prop in source)
|
|
1160
|
+
if (__hasOwnProp$y.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1161
|
+
target[prop] = source[prop];
|
|
1162
|
+
if (source != null && __getOwnPropSymbols$y)
|
|
1163
|
+
for (var prop of __getOwnPropSymbols$y(source)) {
|
|
1164
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$y.call(source, prop))
|
|
1165
|
+
target[prop] = source[prop];
|
|
1166
|
+
}
|
|
1167
|
+
return target;
|
|
1168
|
+
};
|
|
1169
|
+
var __async$u = (__this, __arguments, generator) => {
|
|
1078
1170
|
return new Promise((resolve, reject) => {
|
|
1079
1171
|
var fulfilled = (value) => {
|
|
1080
1172
|
try {
|
|
@@ -1094,307 +1186,238 @@ var NgwMap = (function (exports) {
|
|
|
1094
1186
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
1095
1187
|
});
|
|
1096
1188
|
};
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1189
|
+
function lunkwillCheckResponse(lwResp) {
|
|
1190
|
+
const ct = lwResp.headers.get("content-type");
|
|
1191
|
+
return ct !== void 0 && ct !== null && ct.includes("application/vnd.lunkwill.request-summary+json");
|
|
1192
|
+
}
|
|
1193
|
+
function responseJson(response) {
|
|
1194
|
+
return __async$u(this, null, function* () {
|
|
1195
|
+
try {
|
|
1196
|
+
return response.json();
|
|
1197
|
+
} catch (e) {
|
|
1198
|
+
throw new Error();
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
function lunkwillResponseUrl(lwResp) {
|
|
1203
|
+
return __async$u(this, null, function* () {
|
|
1204
|
+
const lwData = yield responseJson(lwResp);
|
|
1205
|
+
let delay = lwData.delay_ms;
|
|
1206
|
+
const retry = lwData.retry_ms !== void 0 ? lwData.retry_ms : 2e3;
|
|
1207
|
+
const sum = `/api/lunkwill/${lwData.id}/summary`;
|
|
1208
|
+
const res = `/api/lunkwill/${lwData.id}/response`;
|
|
1209
|
+
const sleep = (msec) => new Promise((resolve) => setTimeout(resolve, msec));
|
|
1210
|
+
let failed = false;
|
|
1211
|
+
let ready = false;
|
|
1212
|
+
while (!ready) {
|
|
1213
|
+
yield sleep(failed ? retry : delay);
|
|
1214
|
+
failed = false;
|
|
1215
|
+
let lwResp2;
|
|
1216
|
+
let lwData2;
|
|
1217
|
+
try {
|
|
1218
|
+
lwResp2 = yield fetch(sum, { credentials: "same-origin" });
|
|
1219
|
+
lwData2 = yield lwResp2.json();
|
|
1220
|
+
} catch (e) {
|
|
1221
|
+
failed = true;
|
|
1222
|
+
continue;
|
|
1223
|
+
}
|
|
1224
|
+
switch (lwData2.status) {
|
|
1225
|
+
case void 0:
|
|
1226
|
+
throw new LunkwillError(void 0, lwData2);
|
|
1227
|
+
case "ready":
|
|
1228
|
+
ready = true;
|
|
1229
|
+
break;
|
|
1230
|
+
case "cancelled":
|
|
1231
|
+
throw new LunkwillRequestCancelled(lwData2);
|
|
1232
|
+
case "failed":
|
|
1233
|
+
throw new LunkwillRequestFailed(lwData2);
|
|
1234
|
+
case "spooled":
|
|
1235
|
+
case "processing":
|
|
1236
|
+
case "buffering":
|
|
1237
|
+
delay = lwData2.delay_ms;
|
|
1238
|
+
break;
|
|
1239
|
+
default:
|
|
1240
|
+
throw new LunkwillError(void 0, lwData2);
|
|
1129
1241
|
}
|
|
1130
1242
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1243
|
+
return res;
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
function lunkwillFetch(lwRespUrl) {
|
|
1247
|
+
return __async$u(this, null, function* () {
|
|
1248
|
+
try {
|
|
1249
|
+
return yield window.fetch(lwRespUrl, { credentials: "same-origin" });
|
|
1250
|
+
} catch (e) {
|
|
1251
|
+
throw new NetworksResponseError();
|
|
1137
1252
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
if (
|
|
1164
|
-
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
const mediaContentTypes = [
|
|
1256
|
+
"application/pdf",
|
|
1257
|
+
"image/png",
|
|
1258
|
+
"image/jpeg",
|
|
1259
|
+
"image/tiff",
|
|
1260
|
+
"text/csv"
|
|
1261
|
+
];
|
|
1262
|
+
const mediaContentTypesRegex = new RegExp(mediaContentTypes.join("|"));
|
|
1263
|
+
function isMediaContentType(contentType) {
|
|
1264
|
+
return mediaContentTypesRegex.test(contentType);
|
|
1265
|
+
}
|
|
1266
|
+
function encodeQueryParams(value) {
|
|
1267
|
+
const result = [];
|
|
1268
|
+
for (const [k, v] of Object.entries(value)) {
|
|
1269
|
+
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
|
|
1270
|
+
result.push(`${k}=${encodeURIComponent(v)}`);
|
|
1271
|
+
} else if (Array.isArray(v)) {
|
|
1272
|
+
result.push(`${k}=${v.map(encodeURIComponent).join(",")}`);
|
|
1273
|
+
} else {
|
|
1274
|
+
for (const [sk, sv] of Object.entries(v)) {
|
|
1275
|
+
const ske = `${k}[${encodeURIComponent(sk)}]`;
|
|
1276
|
+
if (typeof sv === "string" || typeof sv === "number" || typeof sv === "boolean") {
|
|
1277
|
+
result.push(`${ske}=${encodeURIComponent(sv)}`);
|
|
1278
|
+
} else if (Array.isArray(sv)) {
|
|
1279
|
+
const sve = sv.map(encodeURIComponent);
|
|
1280
|
+
result.push(`${ske}=${sve.join(",")}`);
|
|
1165
1281
|
}
|
|
1166
|
-
}
|
|
1282
|
+
}
|
|
1167
1283
|
}
|
|
1168
|
-
return Promise.resolve(void 0);
|
|
1169
1284
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
* To not make one more checks if the resource is definitely exists
|
|
1177
|
-
*/
|
|
1178
|
-
getIdOrFail(resource, requestOptions) {
|
|
1179
|
-
return this.getId(resource, requestOptions).then((resp) => {
|
|
1180
|
-
if (resp === void 0) {
|
|
1181
|
-
throw new Error();
|
|
1182
|
-
}
|
|
1183
|
-
return resp;
|
|
1184
|
-
});
|
|
1285
|
+
return result.join("&");
|
|
1286
|
+
}
|
|
1287
|
+
function generateUrl(path, query) {
|
|
1288
|
+
let urlParams = "";
|
|
1289
|
+
if (query !== void 0) {
|
|
1290
|
+
urlParams = "?" + encodeQueryParams(query);
|
|
1185
1291
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1292
|
+
return path + urlParams;
|
|
1293
|
+
}
|
|
1294
|
+
function request(path, options, cacheEngine) {
|
|
1295
|
+
return __async$u(this, null, function* () {
|
|
1296
|
+
var _b;
|
|
1297
|
+
const defaults = {
|
|
1298
|
+
method: "GET",
|
|
1299
|
+
credentials: "same-origin",
|
|
1300
|
+
headers: {}
|
|
1301
|
+
};
|
|
1302
|
+
const _a = __spreadValues$x(__spreadValues$x({}, defaults), options), {
|
|
1303
|
+
withCredentials,
|
|
1304
|
+
responseType,
|
|
1305
|
+
cacheProps,
|
|
1306
|
+
cacheName,
|
|
1307
|
+
lunkwill,
|
|
1308
|
+
cache,
|
|
1309
|
+
query,
|
|
1310
|
+
json
|
|
1311
|
+
} = _a, opt = __objRest$5(_a, [
|
|
1312
|
+
"withCredentials",
|
|
1313
|
+
"responseType",
|
|
1314
|
+
"cacheProps",
|
|
1315
|
+
"cacheName",
|
|
1316
|
+
"lunkwill",
|
|
1317
|
+
"cache",
|
|
1318
|
+
"query",
|
|
1319
|
+
"json"
|
|
1320
|
+
]);
|
|
1321
|
+
if (withCredentials) {
|
|
1322
|
+
opt.credentials = "include";
|
|
1323
|
+
}
|
|
1324
|
+
let useLunkwill = false;
|
|
1325
|
+
if (lunkwill !== void 0) {
|
|
1326
|
+
lunkwill.toHeaders(opt.headers || {});
|
|
1327
|
+
useLunkwill = true;
|
|
1328
|
+
}
|
|
1329
|
+
const lunkwillReturnUrl = !!opt.lunkwillReturnUrl;
|
|
1330
|
+
delete opt.lunkwillReturnUrl;
|
|
1331
|
+
if (json !== void 0) {
|
|
1332
|
+
opt.body = JSON.stringify(json);
|
|
1333
|
+
const headers = opt.headers || {};
|
|
1334
|
+
headers["Content-Type"] = "application/json";
|
|
1335
|
+
opt.headers = headers;
|
|
1336
|
+
}
|
|
1337
|
+
const url = generateUrl(path, query);
|
|
1338
|
+
const makeRequest = () => __async$u(this, null, function* () {
|
|
1339
|
+
let response;
|
|
1340
|
+
try {
|
|
1341
|
+
response = yield fetch(url, opt);
|
|
1342
|
+
} catch (e) {
|
|
1343
|
+
if (e.name === "AbortError") {
|
|
1344
|
+
throw e;
|
|
1345
|
+
}
|
|
1346
|
+
throw new NetworksResponseError();
|
|
1347
|
+
}
|
|
1348
|
+
if (useLunkwill && lunkwillCheckResponse(response)) {
|
|
1349
|
+
const lwRespUrl = yield lunkwillResponseUrl(response);
|
|
1350
|
+
if (lunkwillReturnUrl) {
|
|
1351
|
+
return lwRespUrl;
|
|
1352
|
+
}
|
|
1353
|
+
response = yield lunkwillFetch(lwRespUrl);
|
|
1354
|
+
}
|
|
1355
|
+
const respCType = response.headers.get("content-type");
|
|
1356
|
+
const respJSON = respCType && (respCType.includes("application/json") || respCType.includes("application/vnd.lunkwill.request-summary+json"));
|
|
1357
|
+
let body;
|
|
1358
|
+
try {
|
|
1359
|
+
const respMedia = respCType && isMediaContentType(respCType);
|
|
1360
|
+
if (responseType === "blob" || respMedia) {
|
|
1361
|
+
body = yield response.blob();
|
|
1362
|
+
} else if (respJSON) {
|
|
1363
|
+
body = yield response.json();
|
|
1192
1364
|
} else {
|
|
1193
|
-
|
|
1365
|
+
throw new InvalidResponseError();
|
|
1194
1366
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
this.cache.add("resource.item", Promise.resolve(x), {
|
|
1201
|
-
id: x.resource.id
|
|
1202
|
-
});
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
return resources;
|
|
1206
|
-
});
|
|
1367
|
+
} catch (e) {
|
|
1368
|
+
if (e.name === "AbortError" || e instanceof InvalidResponseError) {
|
|
1369
|
+
throw e;
|
|
1370
|
+
}
|
|
1371
|
+
throw new InvalidResponseError();
|
|
1207
1372
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
}
|
|
1211
|
-
getParent(resource, requestOptions) {
|
|
1212
|
-
return this.getOne(resource, requestOptions).then((child) => {
|
|
1213
|
-
if (child) {
|
|
1214
|
-
return this.getOne(child.resource.parent.id, requestOptions);
|
|
1373
|
+
if (400 <= response.status && response.status <= 599) {
|
|
1374
|
+
throw new ServerResponseError(body);
|
|
1215
1375
|
}
|
|
1216
|
-
return
|
|
1376
|
+
return body;
|
|
1217
1377
|
});
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
update(resource, data) {
|
|
1225
|
-
return this.getId(resource).then((id) => {
|
|
1226
|
-
if (id !== void 0) {
|
|
1227
|
-
return this.connector.put("resource.item", { data }, { id });
|
|
1228
|
-
}
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
/**
|
|
1232
|
-
* Fast way to delete resource from NGW and clean cache.
|
|
1233
|
-
* @param resource - Resource definition
|
|
1234
|
-
*/
|
|
1235
|
-
delete(resource) {
|
|
1236
|
-
return this.getId(resource).then((id) => {
|
|
1237
|
-
if (id !== void 0) {
|
|
1238
|
-
return this.connector.delete("resource.item", null, { id }).then(() => {
|
|
1239
|
-
this._cleanResourceItemCache(id);
|
|
1240
|
-
return void 0;
|
|
1241
|
-
});
|
|
1242
|
-
}
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
_getChildrenOf(parent, requestOptions, _items = []) {
|
|
1246
|
-
return this.connector.get("resource.collection", requestOptions, {
|
|
1247
|
-
parent
|
|
1248
|
-
}).then((items) => {
|
|
1249
|
-
const recursivePromises = [];
|
|
1250
|
-
for (const item of items) {
|
|
1251
|
-
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1252
|
-
this.cache.add("resource.item", Promise.resolve(item), {
|
|
1253
|
-
id: item.resource.id
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
_items.push(item);
|
|
1257
|
-
if ((requestOptions == null ? void 0 : requestOptions.recursive) && item.resource.children) {
|
|
1258
|
-
recursivePromises.push(
|
|
1259
|
-
this._getChildrenOf(item.resource.id, requestOptions, _items)
|
|
1260
|
-
);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
if (recursivePromises.length) {
|
|
1264
|
-
return Promise.all(recursivePromises).then(() => {
|
|
1265
|
-
return _items;
|
|
1266
|
-
});
|
|
1267
|
-
}
|
|
1268
|
-
return _items;
|
|
1269
|
-
});
|
|
1270
|
-
}
|
|
1271
|
-
_cleanResourceItemCache(id) {
|
|
1272
|
-
return __async$s(this, null, function* () {
|
|
1273
|
-
var _a;
|
|
1274
|
-
const all = this.cache.all();
|
|
1275
|
-
const toDelete = [];
|
|
1276
|
-
for (const c of all) {
|
|
1277
|
-
const cid = (_a = c.props) == null ? void 0 : _a.id;
|
|
1278
|
-
if (["resource.item", "resource"].includes(c.key) && cid !== void 0) {
|
|
1279
|
-
if (typeof cid === "number") {
|
|
1280
|
-
if (cid === id) {
|
|
1281
|
-
toDelete.push(c);
|
|
1282
|
-
}
|
|
1283
|
-
} else {
|
|
1284
|
-
const rid = yield this.getId(cid);
|
|
1285
|
-
if (rid === id) {
|
|
1286
|
-
toDelete.push(c);
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
for (const d of toDelete) {
|
|
1292
|
-
this.cache.delete(d);
|
|
1293
|
-
}
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
_fetchResourceById(id, requestOptions) {
|
|
1297
|
-
return this.connector.get("resource.item", requestOptions, { id });
|
|
1298
|
-
}
|
|
1299
|
-
_fetchResourceBy(resource, requestOptions) {
|
|
1300
|
-
return this.getMany(resource, requestOptions).then((resources) => {
|
|
1301
|
-
return resources[0];
|
|
1302
|
-
});
|
|
1303
|
-
}
|
|
1304
|
-
_resourceCacheFilter(resource) {
|
|
1305
|
-
return Promise.all(this.cache.matchAll("resource.item")).then(
|
|
1306
|
-
(resources) => {
|
|
1307
|
-
const items = [];
|
|
1308
|
-
resources.filter((x) => {
|
|
1309
|
-
if (x) {
|
|
1310
|
-
if (resource.keyname && x.resource.keyname) {
|
|
1311
|
-
return resource.keyname === x.resource.keyname;
|
|
1312
|
-
}
|
|
1313
|
-
if (defined(resource.id) && defined(x.resource.id)) {
|
|
1314
|
-
return resource.id === x.resource.id;
|
|
1315
|
-
}
|
|
1316
|
-
return resourceCompare(resource, x.resource);
|
|
1317
|
-
}
|
|
1318
|
-
});
|
|
1319
|
-
return items;
|
|
1320
|
-
}
|
|
1321
|
-
);
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
const CONNECTORS = [];
|
|
1326
|
-
function addConnector(connector) {
|
|
1327
|
-
CONNECTORS.push(connector);
|
|
1328
|
-
}
|
|
1329
|
-
function findConnector(options) {
|
|
1330
|
-
return CONNECTORS.find((x) => {
|
|
1331
|
-
if (x.options.baseUrl === options.baseUrl) {
|
|
1332
|
-
if (options.auth) {
|
|
1333
|
-
if (x.options.auth) {
|
|
1334
|
-
return objectDeepEqual(x.options.auth, options.auth);
|
|
1335
|
-
}
|
|
1336
|
-
} else {
|
|
1337
|
-
return true;
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
});
|
|
1341
|
-
}
|
|
1342
|
-
function removeConnector(connector) {
|
|
1343
|
-
const index = CONNECTORS.indexOf(connector);
|
|
1344
|
-
if (index !== -1) {
|
|
1345
|
-
CONNECTORS.splice(index, 1);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
class AbortError extends Error {
|
|
1350
|
-
constructor(message = "AbortError") {
|
|
1351
|
-
super(message);
|
|
1352
|
-
this.name = "AbortError";
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
var __defProp$G = Object.defineProperty;
|
|
1357
|
-
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1358
|
-
var __publicField$r = (obj, key, value) => __defNormalProp$G(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1359
|
-
class InsufficientPermissionsError extends NgwError {
|
|
1360
|
-
constructor(obj) {
|
|
1361
|
-
super(obj);
|
|
1362
|
-
__publicField$r(this, "name", "InsufficientPermissionsError");
|
|
1363
|
-
__publicField$r(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
|
|
1364
|
-
Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
1369
|
-
function template(str, data) {
|
|
1370
|
-
return str.replace(templateRe, (s, key) => {
|
|
1371
|
-
let value = data[key];
|
|
1372
|
-
if (value === void 0) {
|
|
1373
|
-
throw new Error("No value provided for letiable " + s);
|
|
1374
|
-
} else if (typeof value === "function") {
|
|
1375
|
-
value = value(data);
|
|
1378
|
+
if (cacheEngine && cache && ((_b = opt.method) == null ? void 0 : _b.toUpperCase()) === "GET") {
|
|
1379
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadValues$x({}, objectRemoveEmpty({
|
|
1380
|
+
withCredentials,
|
|
1381
|
+
responseType
|
|
1382
|
+
}));
|
|
1383
|
+
return cacheEngine.add(cacheName || url, makeRequest, cacheOptions, false);
|
|
1376
1384
|
}
|
|
1377
|
-
return
|
|
1385
|
+
return makeRequest();
|
|
1378
1386
|
});
|
|
1379
1387
|
}
|
|
1380
1388
|
|
|
1381
|
-
var __defProp$
|
|
1382
|
-
var
|
|
1383
|
-
var
|
|
1384
|
-
var
|
|
1385
|
-
var
|
|
1386
|
-
var
|
|
1389
|
+
var __defProp$J = Object.defineProperty;
|
|
1390
|
+
var __defProps$h = Object.defineProperties;
|
|
1391
|
+
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
1392
|
+
var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
|
|
1393
|
+
var __hasOwnProp$x = Object.prototype.hasOwnProperty;
|
|
1394
|
+
var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
|
|
1395
|
+
var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1396
|
+
var __spreadValues$w = (a, b) => {
|
|
1387
1397
|
for (var prop in b || (b = {}))
|
|
1388
|
-
if (__hasOwnProp$
|
|
1389
|
-
__defNormalProp$
|
|
1390
|
-
if (__getOwnPropSymbols$
|
|
1391
|
-
for (var prop of __getOwnPropSymbols$
|
|
1392
|
-
if (__propIsEnum$
|
|
1393
|
-
__defNormalProp$
|
|
1398
|
+
if (__hasOwnProp$x.call(b, prop))
|
|
1399
|
+
__defNormalProp$J(a, prop, b[prop]);
|
|
1400
|
+
if (__getOwnPropSymbols$x)
|
|
1401
|
+
for (var prop of __getOwnPropSymbols$x(b)) {
|
|
1402
|
+
if (__propIsEnum$x.call(b, prop))
|
|
1403
|
+
__defNormalProp$J(a, prop, b[prop]);
|
|
1394
1404
|
}
|
|
1395
1405
|
return a;
|
|
1396
1406
|
};
|
|
1397
|
-
var
|
|
1407
|
+
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
1408
|
+
var __objRest$4 = (source, exclude) => {
|
|
1409
|
+
var target = {};
|
|
1410
|
+
for (var prop in source)
|
|
1411
|
+
if (__hasOwnProp$x.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1412
|
+
target[prop] = source[prop];
|
|
1413
|
+
if (source != null && __getOwnPropSymbols$x)
|
|
1414
|
+
for (var prop of __getOwnPropSymbols$x(source)) {
|
|
1415
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$x.call(source, prop))
|
|
1416
|
+
target[prop] = source[prop];
|
|
1417
|
+
}
|
|
1418
|
+
return target;
|
|
1419
|
+
};
|
|
1420
|
+
var __async$t = (__this, __arguments, generator) => {
|
|
1398
1421
|
return new Promise((resolve, reject) => {
|
|
1399
1422
|
var fulfilled = (value) => {
|
|
1400
1423
|
try {
|
|
@@ -1414,70 +1437,94 @@ var NgwMap = (function (exports) {
|
|
|
1414
1437
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
1415
1438
|
});
|
|
1416
1439
|
};
|
|
1417
|
-
function
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
if (params[arg] === void 0) {
|
|
1431
|
-
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
if (url) {
|
|
1435
|
-
url = template(url, replaceParams);
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
if (params) {
|
|
1439
|
-
const paramArray = [];
|
|
1440
|
-
const paramList = params.paramList;
|
|
1441
|
-
if (Array.isArray(paramList)) {
|
|
1442
|
-
paramList.forEach(([key, value]) => {
|
|
1443
|
-
paramArray.push(`${key}=${value}`);
|
|
1444
|
-
});
|
|
1445
|
-
}
|
|
1446
|
-
for (const p in params) {
|
|
1447
|
-
if (apiItem.indexOf(p) === -1) {
|
|
1448
|
-
paramArray.push(`${p}=${params[p]}`);
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
if (paramArray.length) {
|
|
1452
|
-
url = `${url}?${paramArray.join("&")}`;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
if (url) {
|
|
1456
|
-
return connector.makeQuery(url, params, __spreadValues$u({
|
|
1457
|
-
cacheName: name
|
|
1458
|
-
}, requestOptions));
|
|
1459
|
-
} else {
|
|
1460
|
-
throw new Error("Request URL is not set");
|
|
1461
|
-
}
|
|
1462
|
-
} else {
|
|
1463
|
-
return void 0;
|
|
1440
|
+
function routeURL(name, baseUrl, routeData, ...rest) {
|
|
1441
|
+
const [template, ...params] = routeData[name];
|
|
1442
|
+
const first = rest[0];
|
|
1443
|
+
let sub;
|
|
1444
|
+
if (first === void 0) {
|
|
1445
|
+
sub = [];
|
|
1446
|
+
} else if (typeof first === "object" && first !== null) {
|
|
1447
|
+
if (rest.length > 1) {
|
|
1448
|
+
throw new Error("Too many arguments for route(name, object)!");
|
|
1449
|
+
}
|
|
1450
|
+
sub = [];
|
|
1451
|
+
for (const [p, v] of Object.entries(first)) {
|
|
1452
|
+
sub[params.indexOf(p)] = String(v);
|
|
1464
1453
|
}
|
|
1465
|
-
}
|
|
1454
|
+
} else {
|
|
1455
|
+
sub = rest.map((v) => String(v));
|
|
1456
|
+
}
|
|
1457
|
+
return fixUrlStr(
|
|
1458
|
+
baseUrl + template.replace(/\{(\w+)\}/g, function(m, a) {
|
|
1459
|
+
const idx = parseInt(a);
|
|
1460
|
+
const value = sub[idx];
|
|
1461
|
+
if (value === void 0) {
|
|
1462
|
+
const msg = `Undefined parameter ${idx} in "${template}".`;
|
|
1463
|
+
throw new Error(msg);
|
|
1464
|
+
}
|
|
1465
|
+
return String(value);
|
|
1466
|
+
})
|
|
1467
|
+
);
|
|
1468
|
+
}
|
|
1469
|
+
function route(name, connector, ...rest) {
|
|
1470
|
+
const result = {
|
|
1471
|
+
url: (opt) => __async$t(this, null, function* () {
|
|
1472
|
+
var _a;
|
|
1473
|
+
const routeData = yield connector.connect();
|
|
1474
|
+
const template = routeURL(
|
|
1475
|
+
name,
|
|
1476
|
+
(_a = connector.options.baseUrl) != null ? _a : "",
|
|
1477
|
+
routeData,
|
|
1478
|
+
...rest
|
|
1479
|
+
);
|
|
1480
|
+
return generateUrl(template, opt == null ? void 0 : opt.query);
|
|
1481
|
+
})
|
|
1482
|
+
};
|
|
1483
|
+
const methods = ["get", "post", "put", "delete", "patch"];
|
|
1484
|
+
for (const method of methods) {
|
|
1485
|
+
const methodResp = (requestOptions) => __async$t(this, null, function* () {
|
|
1486
|
+
var _b;
|
|
1487
|
+
const _a = requestOptions || {}, { headers: optHeaders } = _a, restOpt = __objRest$4(_a, ["headers"]);
|
|
1488
|
+
const routeData = yield connector.connect();
|
|
1489
|
+
const template = routeURL(
|
|
1490
|
+
name,
|
|
1491
|
+
(_b = connector.options.baseUrl) != null ? _b : "",
|
|
1492
|
+
routeData,
|
|
1493
|
+
...rest
|
|
1494
|
+
);
|
|
1495
|
+
const headers = objectRemoveEmpty(__spreadValues$w(__spreadValues$w({}, connector.getAuthorizationHeaders()), optHeaders != null ? optHeaders : {}));
|
|
1496
|
+
return request(
|
|
1497
|
+
template,
|
|
1498
|
+
__spreadProps$h(__spreadValues$w({
|
|
1499
|
+
headers
|
|
1500
|
+
}, restOpt), {
|
|
1501
|
+
method
|
|
1502
|
+
}),
|
|
1503
|
+
connector.cache
|
|
1504
|
+
);
|
|
1505
|
+
});
|
|
1506
|
+
result[method] = methodResp;
|
|
1507
|
+
}
|
|
1508
|
+
return result;
|
|
1466
1509
|
}
|
|
1467
1510
|
|
|
1468
|
-
var __defProp$
|
|
1469
|
-
var __defNormalProp$
|
|
1470
|
-
var __publicField$
|
|
1511
|
+
var __defProp$I = Object.defineProperty;
|
|
1512
|
+
var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1513
|
+
var __publicField$t = (obj, key, value) => __defNormalProp$I(obj, key + "" , value);
|
|
1471
1514
|
class NetworkError extends Error {
|
|
1472
1515
|
constructor(url) {
|
|
1473
1516
|
super();
|
|
1474
|
-
__publicField$
|
|
1517
|
+
__publicField$t(this, "name", "NetworkError");
|
|
1475
1518
|
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
1476
1519
|
this.message = `Unable to request ${url}.
|
|
1477
1520
|
Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
|
|
1478
1521
|
}
|
|
1479
1522
|
}
|
|
1480
1523
|
|
|
1524
|
+
function isObject(val) {
|
|
1525
|
+
return Object.prototype.toString.call(val) === "[object Object]";
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1481
1528
|
let loadData;
|
|
1482
1529
|
{
|
|
1483
1530
|
loadData = (url, callback, options = {}, error, onCancel) => {
|
|
@@ -1560,39 +1607,52 @@ var NgwMap = (function (exports) {
|
|
|
1560
1607
|
};
|
|
1561
1608
|
}
|
|
1562
1609
|
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1610
|
+
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
1611
|
+
function template(str, data) {
|
|
1612
|
+
return str.replace(templateRe, (s, key) => {
|
|
1613
|
+
let value = data[key];
|
|
1614
|
+
if (value === void 0) {
|
|
1615
|
+
throw new Error("No value provided for letiable " + s);
|
|
1616
|
+
} else if (typeof value === "function") {
|
|
1617
|
+
value = value(data);
|
|
1618
|
+
}
|
|
1619
|
+
return value;
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
var __defProp$H = Object.defineProperty;
|
|
1624
|
+
var __defProps$g = Object.defineProperties;
|
|
1625
|
+
var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
|
|
1626
|
+
var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
|
|
1627
|
+
var __hasOwnProp$w = Object.prototype.hasOwnProperty;
|
|
1628
|
+
var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
|
|
1629
|
+
var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1630
|
+
var __spreadValues$v = (a, b) => {
|
|
1631
|
+
for (var prop in b || (b = {}))
|
|
1632
|
+
if (__hasOwnProp$w.call(b, prop))
|
|
1633
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
1634
|
+
if (__getOwnPropSymbols$w)
|
|
1635
|
+
for (var prop of __getOwnPropSymbols$w(b)) {
|
|
1636
|
+
if (__propIsEnum$w.call(b, prop))
|
|
1637
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
1578
1638
|
}
|
|
1579
1639
|
return a;
|
|
1580
1640
|
};
|
|
1581
|
-
var __spreadProps$
|
|
1582
|
-
var __objRest$
|
|
1641
|
+
var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
|
|
1642
|
+
var __objRest$3 = (source, exclude) => {
|
|
1583
1643
|
var target = {};
|
|
1584
1644
|
for (var prop in source)
|
|
1585
|
-
if (__hasOwnProp$
|
|
1645
|
+
if (__hasOwnProp$w.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1586
1646
|
target[prop] = source[prop];
|
|
1587
|
-
if (source != null && __getOwnPropSymbols$
|
|
1588
|
-
for (var prop of __getOwnPropSymbols$
|
|
1589
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1647
|
+
if (source != null && __getOwnPropSymbols$w)
|
|
1648
|
+
for (var prop of __getOwnPropSymbols$w(source)) {
|
|
1649
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$w.call(source, prop))
|
|
1590
1650
|
target[prop] = source[prop];
|
|
1591
1651
|
}
|
|
1592
1652
|
return target;
|
|
1593
1653
|
};
|
|
1594
|
-
var __publicField$
|
|
1595
|
-
var __async$
|
|
1654
|
+
var __publicField$s = (obj, key, value) => __defNormalProp$H(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1655
|
+
var __async$s = (__this, __arguments, generator) => {
|
|
1596
1656
|
return new Promise((resolve, reject) => {
|
|
1597
1657
|
var fulfilled = (value) => {
|
|
1598
1658
|
try {
|
|
@@ -1617,24 +1677,23 @@ var NgwMap = (function (exports) {
|
|
|
1617
1677
|
class NgwConnector {
|
|
1618
1678
|
constructor(options) {
|
|
1619
1679
|
this.options = options;
|
|
1620
|
-
__publicField$
|
|
1621
|
-
__publicField$
|
|
1622
|
-
__publicField$
|
|
1623
|
-
__publicField$
|
|
1624
|
-
__publicField$
|
|
1625
|
-
__publicField$
|
|
1626
|
-
__publicField$
|
|
1627
|
-
__publicField$
|
|
1628
|
-
__publicField$
|
|
1629
|
-
__publicField$p(this, "requestTransform");
|
|
1680
|
+
__publicField$s(this, "id", ID$2++);
|
|
1681
|
+
__publicField$s(this, "emitter", new EventEmitter());
|
|
1682
|
+
__publicField$s(this, "user");
|
|
1683
|
+
__publicField$s(this, "cache");
|
|
1684
|
+
__publicField$s(this, "withCredentials");
|
|
1685
|
+
__publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
|
|
1686
|
+
__publicField$s(this, "routeStr", "/api/component/pyramid/route");
|
|
1687
|
+
__publicField$s(this, "activeRequests", {});
|
|
1688
|
+
__publicField$s(this, "requestTransform");
|
|
1630
1689
|
const exist = findConnector(options);
|
|
1631
1690
|
this.cache = new Cache({ namespace: options.cacheId });
|
|
1632
1691
|
if (exist) {
|
|
1633
1692
|
return exist;
|
|
1634
1693
|
} else {
|
|
1635
|
-
const { route, requestTransform, withCredentials } = this.options;
|
|
1636
|
-
if (
|
|
1637
|
-
this.routeStr =
|
|
1694
|
+
const { route: route2, requestTransform, withCredentials } = this.options;
|
|
1695
|
+
if (route2) {
|
|
1696
|
+
this.routeStr = route2;
|
|
1638
1697
|
}
|
|
1639
1698
|
if (requestTransform) {
|
|
1640
1699
|
this.requestTransform = requestTransform;
|
|
@@ -1642,10 +1701,6 @@ var NgwMap = (function (exports) {
|
|
|
1642
1701
|
if (withCredentials !== void 0) {
|
|
1643
1702
|
this.withCredentials = withCredentials;
|
|
1644
1703
|
}
|
|
1645
|
-
this.resources = new ResourcesControl({
|
|
1646
|
-
connector: this,
|
|
1647
|
-
cacheId: options.cacheId
|
|
1648
|
-
});
|
|
1649
1704
|
addConnector(this);
|
|
1650
1705
|
}
|
|
1651
1706
|
}
|
|
@@ -1657,7 +1712,6 @@ var NgwMap = (function (exports) {
|
|
|
1657
1712
|
*/
|
|
1658
1713
|
clearCache() {
|
|
1659
1714
|
this.cache.clean();
|
|
1660
|
-
this.resources.cache.clean();
|
|
1661
1715
|
}
|
|
1662
1716
|
setRequestTransform(requestTransform) {
|
|
1663
1717
|
this.requestTransform = requestTransform;
|
|
@@ -1679,14 +1733,14 @@ var NgwMap = (function (exports) {
|
|
|
1679
1733
|
* Can be used to check connection.
|
|
1680
1734
|
* @example
|
|
1681
1735
|
* ```javascript
|
|
1682
|
-
* const connector = new NgwConnector({baseUrl: 'https://demo.nextgis.com'});
|
|
1736
|
+
* const connector = new NgwConnector({ baseUrl: 'https://demo.nextgis.com' });
|
|
1683
1737
|
* connector.connect()
|
|
1684
1738
|
* .then(() => console.log('Ok'))
|
|
1685
1739
|
* .catch((er) => console.log('Connection problem', er));
|
|
1686
1740
|
* ```
|
|
1687
1741
|
*/
|
|
1688
1742
|
connect() {
|
|
1689
|
-
return __async$
|
|
1743
|
+
return __async$s(this, null, function* () {
|
|
1690
1744
|
const auth = this.options.auth;
|
|
1691
1745
|
if (auth) {
|
|
1692
1746
|
const { login, password } = auth;
|
|
@@ -1731,15 +1785,16 @@ var NgwMap = (function (exports) {
|
|
|
1731
1785
|
this.emitter.emit("logout");
|
|
1732
1786
|
}
|
|
1733
1787
|
getUserInfo(credentials, options) {
|
|
1734
|
-
return __async$
|
|
1788
|
+
return __async$s(this, null, function* () {
|
|
1735
1789
|
if (this.user && this.user.id) {
|
|
1736
1790
|
return this.user;
|
|
1737
1791
|
}
|
|
1738
1792
|
if (credentials) {
|
|
1739
1793
|
this.options.auth = credentials;
|
|
1740
1794
|
}
|
|
1741
|
-
const options_ = __spreadValues$
|
|
1742
|
-
headers: this.getAuthorizationHeaders(credentials)
|
|
1795
|
+
const options_ = __spreadValues$v({
|
|
1796
|
+
headers: this.getAuthorizationHeaders(credentials),
|
|
1797
|
+
cache: true
|
|
1743
1798
|
}, options);
|
|
1744
1799
|
return this.makeQuery(
|
|
1745
1800
|
"/api/component/auth/current_user",
|
|
@@ -1758,6 +1813,7 @@ var NgwMap = (function (exports) {
|
|
|
1758
1813
|
Authorization: `Basic ${client}`
|
|
1759
1814
|
};
|
|
1760
1815
|
}
|
|
1816
|
+
return {};
|
|
1761
1817
|
}
|
|
1762
1818
|
makeClientId(credentials) {
|
|
1763
1819
|
credentials = credentials || this.options.auth;
|
|
@@ -1777,124 +1833,10 @@ var NgwMap = (function (exports) {
|
|
|
1777
1833
|
this.activeRequests = {};
|
|
1778
1834
|
}
|
|
1779
1835
|
getActiveApiRequests() {
|
|
1780
|
-
return __spreadValues$
|
|
1781
|
-
}
|
|
1782
|
-
/**
|
|
1783
|
-
* Send request to NGW api router.
|
|
1784
|
-
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
1785
|
-
* @param params - Request item params or query params
|
|
1786
|
-
* @param requestOptions - Request options
|
|
1787
|
-
*
|
|
1788
|
-
* @example
|
|
1789
|
-
* ```javascript
|
|
1790
|
-
*
|
|
1791
|
-
* // there is such an NGW route item
|
|
1792
|
-
* // "feature_layer.feature.item": [
|
|
1793
|
-
* // "/api/resource/{0}/feature/{1}",
|
|
1794
|
-
* // "id",
|
|
1795
|
-
* // "fid"
|
|
1796
|
-
* // ],
|
|
1797
|
-
*
|
|
1798
|
-
* const connector = new NgwConnector({ baseUrl: 'https://example.nextgis.com' });
|
|
1799
|
-
* connector.apiRequest('feature_layer.feature.item', {
|
|
1800
|
-
* // request params for {0} and {1}
|
|
1801
|
-
* 'id': 2011,
|
|
1802
|
-
* 'fid': 101,
|
|
1803
|
-
* // query params
|
|
1804
|
-
* 'srs': 4326,
|
|
1805
|
-
* 'geom_format': 'geojson',
|
|
1806
|
-
* }, { method: 'GET' });
|
|
1807
|
-
* // send get-request to 'https://example.nextgis.com/api/resource/2011/feature/101?srs=4326&geom_format=geojson'
|
|
1808
|
-
*
|
|
1809
|
-
* ```
|
|
1810
|
-
*/
|
|
1811
|
-
apiRequest(name, params_ = {}, requestOptions = {}) {
|
|
1812
|
-
var _a;
|
|
1813
|
-
params_ = (_a = requestOptions.params) != null ? _a : params_;
|
|
1814
|
-
const params = objectRemoveEmpty(params_);
|
|
1815
|
-
return apiRequest({ name, params, requestOptions, connector: this });
|
|
1816
|
-
}
|
|
1817
|
-
/**
|
|
1818
|
-
* Shortcut method for send POST request to NGW.
|
|
1819
|
-
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
1820
|
-
* @param options - Request options
|
|
1821
|
-
* @param params - Request item params or query params
|
|
1822
|
-
*
|
|
1823
|
-
* @example
|
|
1824
|
-
* ```javascript
|
|
1825
|
-
* connector.post('resource.collection', { data: POST_PAYLOAD })
|
|
1826
|
-
* .then((newResource) => console.log(newResource))
|
|
1827
|
-
* .catch((error) => console.warn(error));
|
|
1828
|
-
* ```
|
|
1829
|
-
*/
|
|
1830
|
-
post(name, options, params) {
|
|
1831
|
-
options = options || {};
|
|
1832
|
-
options.method = "POST";
|
|
1833
|
-
return this.apiRequest(
|
|
1834
|
-
name,
|
|
1835
|
-
params,
|
|
1836
|
-
options
|
|
1837
|
-
);
|
|
1838
|
-
}
|
|
1839
|
-
/**
|
|
1840
|
-
* Shortcut method for send GET request to NGW.
|
|
1841
|
-
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
1842
|
-
* @param options - Request options
|
|
1843
|
-
* @param params - Request item params or query params
|
|
1844
|
-
*/
|
|
1845
|
-
get(name, options, params) {
|
|
1846
|
-
options = options || {};
|
|
1847
|
-
options.method = "GET";
|
|
1848
|
-
return this.apiRequest(
|
|
1849
|
-
name,
|
|
1850
|
-
params,
|
|
1851
|
-
options
|
|
1852
|
-
);
|
|
1853
|
-
}
|
|
1854
|
-
/**
|
|
1855
|
-
* Shortcut method for send PATCH request to NGW.
|
|
1856
|
-
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
1857
|
-
* @param options - Request options
|
|
1858
|
-
* @param params - Request item params or query params
|
|
1859
|
-
*/
|
|
1860
|
-
patch(name, options, params) {
|
|
1861
|
-
options = options || {};
|
|
1862
|
-
options.method = "PATCH";
|
|
1863
|
-
return this.apiRequest(
|
|
1864
|
-
name,
|
|
1865
|
-
params,
|
|
1866
|
-
options
|
|
1867
|
-
);
|
|
1868
|
-
}
|
|
1869
|
-
/**
|
|
1870
|
-
* Shortcut method for send PUT request to NGW.
|
|
1871
|
-
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
1872
|
-
* @param options - Request options
|
|
1873
|
-
* @param params - Request item params or query params
|
|
1874
|
-
*/
|
|
1875
|
-
put(name, options, params) {
|
|
1876
|
-
options = options || {};
|
|
1877
|
-
options.method = "PUT";
|
|
1878
|
-
return this.apiRequest(
|
|
1879
|
-
name,
|
|
1880
|
-
params,
|
|
1881
|
-
options
|
|
1882
|
-
);
|
|
1836
|
+
return __spreadValues$v({}, this.activeRequests);
|
|
1883
1837
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
1887
|
-
* @param options - Request options
|
|
1888
|
-
* @param params - Request item params or query params
|
|
1889
|
-
*/
|
|
1890
|
-
delete(name, options, params) {
|
|
1891
|
-
options = options || {};
|
|
1892
|
-
options.method = "DELETE";
|
|
1893
|
-
return this.apiRequest(
|
|
1894
|
-
name,
|
|
1895
|
-
params,
|
|
1896
|
-
options
|
|
1897
|
-
);
|
|
1838
|
+
route(name, ...rest) {
|
|
1839
|
+
return route(name, this, ...rest);
|
|
1898
1840
|
}
|
|
1899
1841
|
/**
|
|
1900
1842
|
* Send request to NGW.
|
|
@@ -1903,18 +1845,18 @@ var NgwMap = (function (exports) {
|
|
|
1903
1845
|
* @param options - Request options
|
|
1904
1846
|
*/
|
|
1905
1847
|
makeQuery(_0, _1) {
|
|
1906
|
-
return __async$
|
|
1848
|
+
return __async$s(this, arguments, function* (url, params, options = {}) {
|
|
1907
1849
|
var _b;
|
|
1908
1850
|
url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
|
|
1909
1851
|
if (!url) {
|
|
1910
1852
|
throw new Error("Empty `url` not allowed");
|
|
1911
1853
|
}
|
|
1912
1854
|
if (params) {
|
|
1913
|
-
const _a = params, restParams = __objRest$
|
|
1855
|
+
const _a = params, restParams = __objRest$3(_a, ["paramList"]);
|
|
1914
1856
|
url = template(url, restParams);
|
|
1915
1857
|
}
|
|
1916
1858
|
url = encodeURI(fixUrlStr(url));
|
|
1917
|
-
options = __spreadValues$
|
|
1859
|
+
options = __spreadValues$v({ withCredentials: this.withCredentials }, options);
|
|
1918
1860
|
const {
|
|
1919
1861
|
cache,
|
|
1920
1862
|
signal: externalSignal,
|
|
@@ -1936,7 +1878,7 @@ var NgwMap = (function (exports) {
|
|
|
1936
1878
|
});
|
|
1937
1879
|
}
|
|
1938
1880
|
options.signal = internalSignal;
|
|
1939
|
-
const createPromise = () => __async$
|
|
1881
|
+
const createPromise = () => __async$s(this, null, function* () {
|
|
1940
1882
|
const id = REQUEST_ID++;
|
|
1941
1883
|
this.activeRequests[id] = internalAbortController;
|
|
1942
1884
|
try {
|
|
@@ -1946,7 +1888,7 @@ var NgwMap = (function (exports) {
|
|
|
1946
1888
|
}
|
|
1947
1889
|
});
|
|
1948
1890
|
if (cache && method === "GET") {
|
|
1949
|
-
const cacheOptions = cacheProps ? cacheProps : __spreadProps$
|
|
1891
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadProps$g(__spreadValues$v({}, objectRemoveEmpty({
|
|
1950
1892
|
headers,
|
|
1951
1893
|
withCredentials,
|
|
1952
1894
|
responseType,
|
|
@@ -1965,6 +1907,590 @@ var NgwMap = (function (exports) {
|
|
|
1965
1907
|
return createPromise();
|
|
1966
1908
|
});
|
|
1967
1909
|
}
|
|
1910
|
+
_loadData(url, options) {
|
|
1911
|
+
options.responseType = options.responseType || "json";
|
|
1912
|
+
return new Promise((resolve, reject) => {
|
|
1913
|
+
var _a;
|
|
1914
|
+
if (this.user) {
|
|
1915
|
+
options = options || {};
|
|
1916
|
+
options.headers = __spreadValues$v(__spreadValues$v({}, this.getAuthorizationHeaders()), options.headers);
|
|
1917
|
+
}
|
|
1918
|
+
if (this.requestTransform) {
|
|
1919
|
+
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
1920
|
+
url = transUrl;
|
|
1921
|
+
options = transOptions;
|
|
1922
|
+
}
|
|
1923
|
+
let runOnAbort = void 0;
|
|
1924
|
+
loadData(url, resolve, options, reject, (handler) => {
|
|
1925
|
+
runOnAbort = handler;
|
|
1926
|
+
});
|
|
1927
|
+
(_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
|
|
1928
|
+
if (runOnAbort !== void 0) {
|
|
1929
|
+
runOnAbort();
|
|
1930
|
+
}
|
|
1931
|
+
reject(new AbortError());
|
|
1932
|
+
});
|
|
1933
|
+
}).catch((httpError) => {
|
|
1934
|
+
if (httpError.name !== "AbortError") {
|
|
1935
|
+
{
|
|
1936
|
+
console.warn("DEV WARN", httpError);
|
|
1937
|
+
}
|
|
1938
|
+
const er = this._handleHttpError(httpError);
|
|
1939
|
+
if (er) {
|
|
1940
|
+
throw er;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
throw httpError;
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
_login(credentials, options) {
|
|
1947
|
+
return __async$s(this, null, function* () {
|
|
1948
|
+
try {
|
|
1949
|
+
const data = yield this.getUserInfo(credentials, options);
|
|
1950
|
+
this.user = data;
|
|
1951
|
+
this.emitter.emit("login", data);
|
|
1952
|
+
return data;
|
|
1953
|
+
} catch (er) {
|
|
1954
|
+
this.emitter.emit("login:error", er);
|
|
1955
|
+
throw er;
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
_cleanActiveRequest(requestId) {
|
|
1960
|
+
delete this.activeRequests[requestId];
|
|
1961
|
+
}
|
|
1962
|
+
_handleHttpError(er) {
|
|
1963
|
+
if (er) {
|
|
1964
|
+
if (er instanceof NgwError) {
|
|
1965
|
+
if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
|
|
1966
|
+
throw new ResourceNotFoundError(er);
|
|
1967
|
+
} else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
|
|
1968
|
+
throw new InsufficientPermissionsError(er);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
return er;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
__publicField$s(NgwConnector, "errors", {
|
|
1976
|
+
NgwError,
|
|
1977
|
+
ResourceNotFoundError
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1980
|
+
function resourceCompare(res1, res2) {
|
|
1981
|
+
return objectDeepEqual(res1, res2);
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
const exclude = ["description"];
|
|
1985
|
+
function resourceToQuery(resource, prefix = "") {
|
|
1986
|
+
prefix = prefix ? prefix + "__" : "";
|
|
1987
|
+
const query = {};
|
|
1988
|
+
for (const [key, value] of Object.entries(resource)) {
|
|
1989
|
+
if (exclude.indexOf(key) === -1) {
|
|
1990
|
+
if (isObject(value)) {
|
|
1991
|
+
if (key === "owner_user") {
|
|
1992
|
+
const children = resourceToQuery(value, key);
|
|
1993
|
+
Object.assign(query, children);
|
|
1994
|
+
} else if (key === "parent" && "id" in value) {
|
|
1995
|
+
query.parent_id = value.id;
|
|
1996
|
+
}
|
|
1997
|
+
} else if (defined(value)) {
|
|
1998
|
+
query[prefix + key] = value;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
return query;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
var __defProp$G = Object.defineProperty;
|
|
2006
|
+
var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
|
|
2007
|
+
var __hasOwnProp$v = Object.prototype.hasOwnProperty;
|
|
2008
|
+
var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
|
|
2009
|
+
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2010
|
+
var __spreadValues$u = (a, b) => {
|
|
2011
|
+
for (var prop in b || (b = {}))
|
|
2012
|
+
if (__hasOwnProp$v.call(b, prop))
|
|
2013
|
+
__defNormalProp$G(a, prop, b[prop]);
|
|
2014
|
+
if (__getOwnPropSymbols$v)
|
|
2015
|
+
for (var prop of __getOwnPropSymbols$v(b)) {
|
|
2016
|
+
if (__propIsEnum$v.call(b, prop))
|
|
2017
|
+
__defNormalProp$G(a, prop, b[prop]);
|
|
2018
|
+
}
|
|
2019
|
+
return a;
|
|
2020
|
+
};
|
|
2021
|
+
var __publicField$r = (obj, key, value) => __defNormalProp$G(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2022
|
+
var __async$r = (__this, __arguments, generator) => {
|
|
2023
|
+
return new Promise((resolve, reject) => {
|
|
2024
|
+
var fulfilled = (value) => {
|
|
2025
|
+
try {
|
|
2026
|
+
step(generator.next(value));
|
|
2027
|
+
} catch (e) {
|
|
2028
|
+
reject(e);
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
var rejected = (value) => {
|
|
2032
|
+
try {
|
|
2033
|
+
step(generator.throw(value));
|
|
2034
|
+
} catch (e) {
|
|
2035
|
+
reject(e);
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2039
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
2040
|
+
});
|
|
2041
|
+
};
|
|
2042
|
+
class ResourcesControl {
|
|
2043
|
+
constructor({
|
|
2044
|
+
connector,
|
|
2045
|
+
cacheId
|
|
2046
|
+
}) {
|
|
2047
|
+
__publicField$r(this, "cache");
|
|
2048
|
+
__publicField$r(this, "connector");
|
|
2049
|
+
this.connector = connector;
|
|
2050
|
+
this.cache = new Cache({ namespace: cacheId });
|
|
2051
|
+
}
|
|
2052
|
+
// -------------------------------------------------------------------------
|
|
2053
|
+
// Resource Methods
|
|
2054
|
+
// -------------------------------------------------------------------------
|
|
2055
|
+
/**
|
|
2056
|
+
* Receive resource from NGW by id, keyname or search-object parameter.
|
|
2057
|
+
* @param resource - Resource id, keyname or search-object
|
|
2058
|
+
*
|
|
2059
|
+
* @remarks
|
|
2060
|
+
* Fetching resource would be cached to speed up next call
|
|
2061
|
+
*/
|
|
2062
|
+
getOne(resource, requestOptions) {
|
|
2063
|
+
const opt = __spreadValues$u({}, requestOptions);
|
|
2064
|
+
if (typeof resource === "string") ; else if (typeof resource === "number") ; else if (isObject(resource)) {
|
|
2065
|
+
if (resource.id !== void 0) {
|
|
2066
|
+
resource.id;
|
|
2067
|
+
} else {
|
|
2068
|
+
if (resource.keyname) {
|
|
2069
|
+
resource.keyname;
|
|
2070
|
+
}
|
|
2071
|
+
if (resource.display_name) {
|
|
2072
|
+
resource.display_name;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
if (typeof resource === "string") {
|
|
2077
|
+
return this._fetchResourceBy({ keyname: resource }, opt);
|
|
2078
|
+
} else if (typeof resource === "number") {
|
|
2079
|
+
return this._fetchResourceById(resource, opt);
|
|
2080
|
+
} else if (isObject(resource)) {
|
|
2081
|
+
return this._fetchResourceBy(resource, opt);
|
|
2082
|
+
}
|
|
2083
|
+
return Promise.resolve(void 0);
|
|
2084
|
+
}
|
|
2085
|
+
getOneOrFail(resource, requestOptions) {
|
|
2086
|
+
return this.getOne(resource, requestOptions).then((res) => {
|
|
2087
|
+
if (res) {
|
|
2088
|
+
return res;
|
|
2089
|
+
}
|
|
2090
|
+
throw new ResourceNotFoundError();
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* A fast way to retrieve resource ID for any resource definition.
|
|
2095
|
+
* @param resource - Any available resource definition
|
|
2096
|
+
*
|
|
2097
|
+
* @remarks
|
|
2098
|
+
* There are situations when exactly the resource id is needed
|
|
2099
|
+
* (for example, to compose the correct request to the api)
|
|
2100
|
+
* then this method will come in handy to facilitate the extraction of the identifier
|
|
2101
|
+
* if the resource is specified through a keyname or other parameters.
|
|
2102
|
+
*/
|
|
2103
|
+
getId(resource, requestOptions) {
|
|
2104
|
+
if (typeof resource === "number") {
|
|
2105
|
+
return Promise.resolve(resource);
|
|
2106
|
+
} else if (typeof resource === "string" || isObject(resource)) {
|
|
2107
|
+
return this.getOne(resource, requestOptions).then((res) => {
|
|
2108
|
+
if (res) {
|
|
2109
|
+
return res.resource.id;
|
|
2110
|
+
}
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
return Promise.resolve(void 0);
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* A fast way to retrieve resource ID for any resource definition.
|
|
2117
|
+
* @param resource - Any available resource definition
|
|
2118
|
+
*
|
|
2119
|
+
* @remarks
|
|
2120
|
+
* Similar with {@link NgwConnector.getResourceId | getResourceId} but rise error if resource is not exist.
|
|
2121
|
+
* To not make one more checks if the resource is definitely exists
|
|
2122
|
+
*/
|
|
2123
|
+
getIdOrFail(resource, requestOptions) {
|
|
2124
|
+
return this.getId(resource, requestOptions).then((resp) => {
|
|
2125
|
+
if (resp === void 0) {
|
|
2126
|
+
throw new Error();
|
|
2127
|
+
}
|
|
2128
|
+
return resp;
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
getMany(resource, requestOptions) {
|
|
2132
|
+
return this._resourceCacheFilter(resource).then((items) => {
|
|
2133
|
+
if (!items.length) {
|
|
2134
|
+
const query = {};
|
|
2135
|
+
if (resource.keyname) {
|
|
2136
|
+
query.keyname = resource.keyname;
|
|
2137
|
+
} else {
|
|
2138
|
+
Object.assign(query, resourceToQuery(resource));
|
|
2139
|
+
}
|
|
2140
|
+
return this.connector.get("resource.search", requestOptions, __spreadValues$u({
|
|
2141
|
+
serialization: "full"
|
|
2142
|
+
}, query)).then((resources) => {
|
|
2143
|
+
if ((requestOptions == null ? void 0 : requestOptions.cache) && resources) {
|
|
2144
|
+
for (const x of resources) {
|
|
2145
|
+
this.cache.add("resource.item", Promise.resolve(x), {
|
|
2146
|
+
id: x.resource.id
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
return resources;
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
return items;
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
getParent(resource, requestOptions) {
|
|
2157
|
+
return this.getOne(resource, requestOptions).then((child) => {
|
|
2158
|
+
if (child) {
|
|
2159
|
+
return this.getOne(child.resource.parent.id, requestOptions);
|
|
2160
|
+
}
|
|
2161
|
+
return Promise.resolve(void 0);
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
getChildrenOf(resource, requestOptions) {
|
|
2165
|
+
return this.getIdOrFail(resource).then(
|
|
2166
|
+
(parent) => this._getChildrenOf(parent, requestOptions)
|
|
2167
|
+
);
|
|
2168
|
+
}
|
|
2169
|
+
update(resource, data) {
|
|
2170
|
+
return this.getId(resource).then((id) => {
|
|
2171
|
+
if (id !== void 0) {
|
|
2172
|
+
return this.connector.put("resource.item", { data }, { id });
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Fast way to delete resource from NGW and clean cache.
|
|
2178
|
+
* @param resource - Resource definition
|
|
2179
|
+
*/
|
|
2180
|
+
delete(resource) {
|
|
2181
|
+
return this.getId(resource).then((id) => {
|
|
2182
|
+
if (id !== void 0) {
|
|
2183
|
+
return this.connector.delete("resource.item", null, { id }).then(() => {
|
|
2184
|
+
this._cleanResourceItemCache(id);
|
|
2185
|
+
return void 0;
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
_getChildrenOf(parent, requestOptions, _items = []) {
|
|
2191
|
+
return this.connector.get("resource.collection", requestOptions, {
|
|
2192
|
+
parent
|
|
2193
|
+
}).then((items) => {
|
|
2194
|
+
const recursivePromises = [];
|
|
2195
|
+
for (const item of items) {
|
|
2196
|
+
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
2197
|
+
this.cache.add("resource.item", Promise.resolve(item), {
|
|
2198
|
+
id: item.resource.id
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2201
|
+
_items.push(item);
|
|
2202
|
+
if ((requestOptions == null ? void 0 : requestOptions.recursive) && item.resource.children) {
|
|
2203
|
+
recursivePromises.push(
|
|
2204
|
+
this._getChildrenOf(item.resource.id, requestOptions, _items)
|
|
2205
|
+
);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
if (recursivePromises.length) {
|
|
2209
|
+
return Promise.all(recursivePromises).then(() => {
|
|
2210
|
+
return _items;
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
return _items;
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
_cleanResourceItemCache(id) {
|
|
2217
|
+
return __async$r(this, null, function* () {
|
|
2218
|
+
var _a;
|
|
2219
|
+
const all = this.cache.all();
|
|
2220
|
+
const toDelete = [];
|
|
2221
|
+
for (const c of all) {
|
|
2222
|
+
const cid = (_a = c.props) == null ? void 0 : _a.id;
|
|
2223
|
+
if (["resource.item", "resource"].includes(c.key) && cid !== void 0) {
|
|
2224
|
+
if (typeof cid === "number") {
|
|
2225
|
+
if (cid === id) {
|
|
2226
|
+
toDelete.push(c);
|
|
2227
|
+
}
|
|
2228
|
+
} else {
|
|
2229
|
+
const rid = yield this.getId(cid);
|
|
2230
|
+
if (rid === id) {
|
|
2231
|
+
toDelete.push(c);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
for (const d of toDelete) {
|
|
2237
|
+
this.cache.delete(d);
|
|
2238
|
+
}
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
_fetchResourceById(id, requestOptions) {
|
|
2242
|
+
return this.connector.get("resource.item", requestOptions, { id });
|
|
2243
|
+
}
|
|
2244
|
+
_fetchResourceBy(resource, requestOptions) {
|
|
2245
|
+
return this.getMany(resource, requestOptions).then((resources) => {
|
|
2246
|
+
return resources[0];
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
_resourceCacheFilter(resource) {
|
|
2250
|
+
return Promise.all(this.cache.matchAll("resource.item")).then(
|
|
2251
|
+
(resources) => {
|
|
2252
|
+
const items = [];
|
|
2253
|
+
resources.filter((x) => {
|
|
2254
|
+
if (x) {
|
|
2255
|
+
if (resource.keyname && x.resource.keyname) {
|
|
2256
|
+
return resource.keyname === x.resource.keyname;
|
|
2257
|
+
}
|
|
2258
|
+
if (defined(resource.id) && defined(x.resource.id)) {
|
|
2259
|
+
return resource.id === x.resource.id;
|
|
2260
|
+
}
|
|
2261
|
+
return resourceCompare(resource, x.resource);
|
|
2262
|
+
}
|
|
2263
|
+
});
|
|
2264
|
+
return items;
|
|
2265
|
+
}
|
|
2266
|
+
);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
var __defProp$F = Object.defineProperty;
|
|
2271
|
+
var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
|
|
2272
|
+
var __hasOwnProp$u = Object.prototype.hasOwnProperty;
|
|
2273
|
+
var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
|
|
2274
|
+
var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2275
|
+
var __spreadValues$t = (a, b) => {
|
|
2276
|
+
for (var prop in b || (b = {}))
|
|
2277
|
+
if (__hasOwnProp$u.call(b, prop))
|
|
2278
|
+
__defNormalProp$F(a, prop, b[prop]);
|
|
2279
|
+
if (__getOwnPropSymbols$u)
|
|
2280
|
+
for (var prop of __getOwnPropSymbols$u(b)) {
|
|
2281
|
+
if (__propIsEnum$u.call(b, prop))
|
|
2282
|
+
__defNormalProp$F(a, prop, b[prop]);
|
|
2283
|
+
}
|
|
2284
|
+
return a;
|
|
2285
|
+
};
|
|
2286
|
+
var __async$q = (__this, __arguments, generator) => {
|
|
2287
|
+
return new Promise((resolve, reject) => {
|
|
2288
|
+
var fulfilled = (value) => {
|
|
2289
|
+
try {
|
|
2290
|
+
step(generator.next(value));
|
|
2291
|
+
} catch (e) {
|
|
2292
|
+
reject(e);
|
|
2293
|
+
}
|
|
2294
|
+
};
|
|
2295
|
+
var rejected = (value) => {
|
|
2296
|
+
try {
|
|
2297
|
+
step(generator.throw(value));
|
|
2298
|
+
} catch (e) {
|
|
2299
|
+
reject(e);
|
|
2300
|
+
}
|
|
2301
|
+
};
|
|
2302
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2303
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
2304
|
+
});
|
|
2305
|
+
};
|
|
2306
|
+
function apiRequest(opt) {
|
|
2307
|
+
return __async$q(this, null, function* () {
|
|
2308
|
+
const { params, name, connector, requestOptions } = opt;
|
|
2309
|
+
const apiItems = yield connector.connect();
|
|
2310
|
+
let apiItem = apiItems && apiItems[name];
|
|
2311
|
+
if (apiItem) {
|
|
2312
|
+
apiItem = [...apiItem];
|
|
2313
|
+
let url = apiItem.shift();
|
|
2314
|
+
if (apiItem.length) {
|
|
2315
|
+
const replaceParams = {};
|
|
2316
|
+
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
2317
|
+
const arg = apiItem[fry];
|
|
2318
|
+
replaceParams[fry] = `{${arg}}`;
|
|
2319
|
+
if (params[arg] === void 0) {
|
|
2320
|
+
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
if (url) {
|
|
2324
|
+
url = template(url, replaceParams);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
if (params) {
|
|
2328
|
+
const paramArray = [];
|
|
2329
|
+
const paramList = params.paramList;
|
|
2330
|
+
if (Array.isArray(paramList)) {
|
|
2331
|
+
paramList.forEach(([key, value]) => {
|
|
2332
|
+
paramArray.push(`${key}=${value}`);
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
for (const p in params) {
|
|
2336
|
+
if (apiItem.indexOf(p) === -1) {
|
|
2337
|
+
paramArray.push(`${p}=${params[p]}`);
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
if (paramArray.length) {
|
|
2341
|
+
url = `${url}?${paramArray.join("&")}`;
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
if (url) {
|
|
2345
|
+
return connector.makeQuery(url, params, __spreadValues$t({
|
|
2346
|
+
cacheName: name
|
|
2347
|
+
}, requestOptions));
|
|
2348
|
+
} else {
|
|
2349
|
+
throw new Error("Request URL is not set");
|
|
2350
|
+
}
|
|
2351
|
+
} else {
|
|
2352
|
+
return void 0;
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
var __defProp$E = Object.defineProperty;
|
|
2358
|
+
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2359
|
+
var __publicField$q = (obj, key, value) => __defNormalProp$E(obj, key + "" , value);
|
|
2360
|
+
class NgwConnectorExtended extends NgwConnector {
|
|
2361
|
+
constructor(options) {
|
|
2362
|
+
super(options);
|
|
2363
|
+
this.options = options;
|
|
2364
|
+
__publicField$q(this, "resources");
|
|
2365
|
+
this.resources = new ResourcesControl({
|
|
2366
|
+
connector: this,
|
|
2367
|
+
cacheId: options.cacheId
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
/**
|
|
2371
|
+
* Clear the cache.
|
|
2372
|
+
*/
|
|
2373
|
+
clearCache() {
|
|
2374
|
+
super.clearCache();
|
|
2375
|
+
this.resources.cache.clean();
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* Send request to NGW api router.
|
|
2379
|
+
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
2380
|
+
* @param params - Request item params or query params
|
|
2381
|
+
* @param requestOptions - Request options
|
|
2382
|
+
*
|
|
2383
|
+
* @example
|
|
2384
|
+
* ```javascript
|
|
2385
|
+
*
|
|
2386
|
+
* // there is such an NGW route item
|
|
2387
|
+
* // "feature_layer.feature.item": [
|
|
2388
|
+
* // "/api/resource/{0}/feature/{1}",
|
|
2389
|
+
* // "id",
|
|
2390
|
+
* // "fid"
|
|
2391
|
+
* // ],
|
|
2392
|
+
*
|
|
2393
|
+
* const connector = new NgwConnector({ baseUrl: 'https://example.nextgis.com' });
|
|
2394
|
+
* connector.apiRequest('feature_layer.feature.item', {
|
|
2395
|
+
* // request params for {0} and {1}
|
|
2396
|
+
* 'id': 2011,
|
|
2397
|
+
* 'fid': 101,
|
|
2398
|
+
* // query params
|
|
2399
|
+
* 'srs': 4326,
|
|
2400
|
+
* 'geom_format': 'geojson',
|
|
2401
|
+
* }, { method: 'GET' });
|
|
2402
|
+
* // send get-request to 'https://example.nextgis.com/api/resource/2011/feature/101?srs=4326&geom_format=geojson'
|
|
2403
|
+
*
|
|
2404
|
+
* ```
|
|
2405
|
+
*/
|
|
2406
|
+
apiRequest(name, params_ = {}, requestOptions = {}) {
|
|
2407
|
+
var _a;
|
|
2408
|
+
params_ = (_a = requestOptions.params) != null ? _a : params_;
|
|
2409
|
+
const params = objectRemoveEmpty(params_);
|
|
2410
|
+
return apiRequest({ name, params, requestOptions, connector: this });
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* Shortcut method for send POST request to NGW.
|
|
2414
|
+
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
2415
|
+
* @param options - Request options
|
|
2416
|
+
* @param params - Request item params or query params
|
|
2417
|
+
*
|
|
2418
|
+
* @example
|
|
2419
|
+
* ```javascript
|
|
2420
|
+
* connector.post('resource.collection', { data: POST_PAYLOAD })
|
|
2421
|
+
* .then((newResource) => console.log(newResource))
|
|
2422
|
+
* .catch((error) => console.warn(error));
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
2425
|
+
post(name, options, params) {
|
|
2426
|
+
options = options || {};
|
|
2427
|
+
options.method = "POST";
|
|
2428
|
+
return this.apiRequest(
|
|
2429
|
+
name,
|
|
2430
|
+
params,
|
|
2431
|
+
options
|
|
2432
|
+
);
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Shortcut method for send GET request to NGW.
|
|
2436
|
+
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
2437
|
+
* @param options - Request options
|
|
2438
|
+
* @param params - Request item params or query params
|
|
2439
|
+
*/
|
|
2440
|
+
get(name, options, params) {
|
|
2441
|
+
options = options || {};
|
|
2442
|
+
options.method = "GET";
|
|
2443
|
+
return this.apiRequest(
|
|
2444
|
+
name,
|
|
2445
|
+
params,
|
|
2446
|
+
options
|
|
2447
|
+
);
|
|
2448
|
+
}
|
|
2449
|
+
/**
|
|
2450
|
+
* Shortcut method for send PATCH request to NGW.
|
|
2451
|
+
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
2452
|
+
* @param options - Request options
|
|
2453
|
+
* @param params - Request item params or query params
|
|
2454
|
+
*/
|
|
2455
|
+
patch(name, options, params) {
|
|
2456
|
+
options = options || {};
|
|
2457
|
+
options.method = "PATCH";
|
|
2458
|
+
return this.apiRequest(
|
|
2459
|
+
name,
|
|
2460
|
+
params,
|
|
2461
|
+
options
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Shortcut method for send PUT request to NGW.
|
|
2466
|
+
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
2467
|
+
* @param options - Request options
|
|
2468
|
+
* @param params - Request item params or query params
|
|
2469
|
+
*/
|
|
2470
|
+
put(name, options, params) {
|
|
2471
|
+
options = options || {};
|
|
2472
|
+
options.method = "PUT";
|
|
2473
|
+
return this.apiRequest(
|
|
2474
|
+
name,
|
|
2475
|
+
params,
|
|
2476
|
+
options
|
|
2477
|
+
);
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Shortcut method for send DELETE request to NGW.
|
|
2481
|
+
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
2482
|
+
* @param options - Request options
|
|
2483
|
+
* @param params - Request item params or query params
|
|
2484
|
+
*/
|
|
2485
|
+
delete(name, options, params) {
|
|
2486
|
+
options = options || {};
|
|
2487
|
+
options.method = "DELETE";
|
|
2488
|
+
return this.apiRequest(
|
|
2489
|
+
name,
|
|
2490
|
+
params,
|
|
2491
|
+
options
|
|
2492
|
+
);
|
|
2493
|
+
}
|
|
1968
2494
|
// -------------------------------------------------------------------------
|
|
1969
2495
|
// Resource Methods
|
|
1970
2496
|
// -------------------------------------------------------------------------
|
|
@@ -2040,92 +2566,21 @@ var NgwMap = (function (exports) {
|
|
|
2040
2566
|
deleteResource(resource) {
|
|
2041
2567
|
return this.resources.delete(resource);
|
|
2042
2568
|
}
|
|
2043
|
-
/**
|
|
2044
|
-
* @internal
|
|
2045
|
-
*/
|
|
2046
|
-
_loadData(url, options) {
|
|
2047
|
-
options.responseType = options.responseType || "json";
|
|
2048
|
-
return new Promise((resolve, reject) => {
|
|
2049
|
-
var _a;
|
|
2050
|
-
if (this.user) {
|
|
2051
|
-
options = options || {};
|
|
2052
|
-
options.headers = __spreadValues$t(__spreadValues$t({}, this.getAuthorizationHeaders()), options.headers);
|
|
2053
|
-
}
|
|
2054
|
-
if (this.requestTransform) {
|
|
2055
|
-
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
2056
|
-
url = transUrl;
|
|
2057
|
-
options = transOptions;
|
|
2058
|
-
}
|
|
2059
|
-
let runOnAbort = void 0;
|
|
2060
|
-
loadData(url, resolve, options, reject, (handler) => {
|
|
2061
|
-
runOnAbort = handler;
|
|
2062
|
-
});
|
|
2063
|
-
(_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
|
|
2064
|
-
if (runOnAbort !== void 0) {
|
|
2065
|
-
runOnAbort();
|
|
2066
|
-
}
|
|
2067
|
-
reject(new AbortError());
|
|
2068
|
-
});
|
|
2069
|
-
}).catch((httpError) => {
|
|
2070
|
-
if (httpError.name !== "AbortError") {
|
|
2071
|
-
{
|
|
2072
|
-
console.warn("DEV WARN", httpError);
|
|
2073
|
-
}
|
|
2074
|
-
const er = this._handleHttpError(httpError);
|
|
2075
|
-
if (er) {
|
|
2076
|
-
throw er;
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
throw httpError;
|
|
2080
|
-
});
|
|
2081
|
-
}
|
|
2082
|
-
_login(credentials, options) {
|
|
2083
|
-
return __async$q(this, null, function* () {
|
|
2084
|
-
try {
|
|
2085
|
-
const data = yield this.getUserInfo(credentials, options);
|
|
2086
|
-
this.user = data;
|
|
2087
|
-
this.emitter.emit("login", data);
|
|
2088
|
-
return data;
|
|
2089
|
-
} catch (er) {
|
|
2090
|
-
this.emitter.emit("login:error", er);
|
|
2091
|
-
throw er;
|
|
2092
|
-
}
|
|
2093
|
-
});
|
|
2094
|
-
}
|
|
2095
|
-
_cleanActiveRequest(requestId) {
|
|
2096
|
-
delete this.activeRequests[requestId];
|
|
2097
|
-
}
|
|
2098
|
-
_handleHttpError(er) {
|
|
2099
|
-
if (er) {
|
|
2100
|
-
if (er instanceof NgwError) {
|
|
2101
|
-
if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
|
|
2102
|
-
throw new ResourceNotFoundError(er);
|
|
2103
|
-
} else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
|
|
2104
|
-
throw new InsufficientPermissionsError(er);
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
return er;
|
|
2109
|
-
}
|
|
2110
2569
|
}
|
|
2111
|
-
__publicField$p(NgwConnector, "errors", {
|
|
2112
|
-
NgwError,
|
|
2113
|
-
ResourceNotFoundError
|
|
2114
|
-
});
|
|
2115
2570
|
|
|
2116
|
-
var __defProp$
|
|
2571
|
+
var __defProp$D = Object.defineProperty;
|
|
2117
2572
|
var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
|
|
2118
2573
|
var __hasOwnProp$t = Object.prototype.hasOwnProperty;
|
|
2119
2574
|
var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
|
|
2120
|
-
var __defNormalProp$
|
|
2575
|
+
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2121
2576
|
var __spreadValues$s = (a, b) => {
|
|
2122
2577
|
for (var prop in b || (b = {}))
|
|
2123
2578
|
if (__hasOwnProp$t.call(b, prop))
|
|
2124
|
-
__defNormalProp$
|
|
2579
|
+
__defNormalProp$D(a, prop, b[prop]);
|
|
2125
2580
|
if (__getOwnPropSymbols$t)
|
|
2126
2581
|
for (var prop of __getOwnPropSymbols$t(b)) {
|
|
2127
2582
|
if (__propIsEnum$t.call(b, prop))
|
|
2128
|
-
__defNormalProp$
|
|
2583
|
+
__defNormalProp$D(a, prop, b[prop]);
|
|
2129
2584
|
}
|
|
2130
2585
|
return a;
|
|
2131
2586
|
};
|
|
@@ -2207,25 +2662,25 @@ var NgwMap = (function (exports) {
|
|
|
2207
2662
|
return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
|
|
2208
2663
|
}
|
|
2209
2664
|
|
|
2210
|
-
var __defProp$
|
|
2211
|
-
var __defProps$
|
|
2212
|
-
var __getOwnPropDescs$
|
|
2665
|
+
var __defProp$C = Object.defineProperty;
|
|
2666
|
+
var __defProps$f = Object.defineProperties;
|
|
2667
|
+
var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
|
|
2213
2668
|
var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
|
|
2214
2669
|
var __hasOwnProp$s = Object.prototype.hasOwnProperty;
|
|
2215
2670
|
var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
|
|
2216
|
-
var __defNormalProp$
|
|
2671
|
+
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2217
2672
|
var __spreadValues$r = (a, b) => {
|
|
2218
2673
|
for (var prop in b || (b = {}))
|
|
2219
2674
|
if (__hasOwnProp$s.call(b, prop))
|
|
2220
|
-
__defNormalProp$
|
|
2675
|
+
__defNormalProp$C(a, prop, b[prop]);
|
|
2221
2676
|
if (__getOwnPropSymbols$s)
|
|
2222
2677
|
for (var prop of __getOwnPropSymbols$s(b)) {
|
|
2223
2678
|
if (__propIsEnum$s.call(b, prop))
|
|
2224
|
-
__defNormalProp$
|
|
2679
|
+
__defNormalProp$C(a, prop, b[prop]);
|
|
2225
2680
|
}
|
|
2226
2681
|
return a;
|
|
2227
2682
|
};
|
|
2228
|
-
var __spreadProps$
|
|
2683
|
+
var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
|
|
2229
2684
|
var __async$p = (__this, __arguments, generator) => {
|
|
2230
2685
|
return new Promise((resolve, reject) => {
|
|
2231
2686
|
var fulfilled = (value) => {
|
|
@@ -2330,13 +2785,13 @@ var NgwMap = (function (exports) {
|
|
|
2330
2785
|
for (const f of filters_) {
|
|
2331
2786
|
if (isPropertyFilter(f)) {
|
|
2332
2787
|
_queries.push(
|
|
2333
|
-
fetchNgwLayerItemsRequest(__spreadProps$
|
|
2788
|
+
fetchNgwLayerItemsRequest(__spreadProps$f(__spreadValues$r({}, opt), {
|
|
2334
2789
|
paramList: [..._parentAllParams, ...paramList, createParam(f)]
|
|
2335
2790
|
}))
|
|
2336
2791
|
);
|
|
2337
2792
|
} else {
|
|
2338
2793
|
getQueries(
|
|
2339
|
-
__spreadProps$
|
|
2794
|
+
__spreadProps$f(__spreadValues$r({}, opt), {
|
|
2340
2795
|
filters: f
|
|
2341
2796
|
}),
|
|
2342
2797
|
_queries,
|
|
@@ -2357,7 +2812,7 @@ var NgwMap = (function (exports) {
|
|
|
2357
2812
|
if (propertiesFilterList.length) {
|
|
2358
2813
|
for (const x of propertiesFilterList) {
|
|
2359
2814
|
getQueries(
|
|
2360
|
-
__spreadProps$
|
|
2815
|
+
__spreadProps$f(__spreadValues$r({}, opt), {
|
|
2361
2816
|
filters: x
|
|
2362
2817
|
}),
|
|
2363
2818
|
_queries,
|
|
@@ -2366,7 +2821,7 @@ var NgwMap = (function (exports) {
|
|
|
2366
2821
|
}
|
|
2367
2822
|
} else {
|
|
2368
2823
|
_queries.push(
|
|
2369
|
-
fetchNgwLayerItemsRequest(__spreadProps$
|
|
2824
|
+
fetchNgwLayerItemsRequest(__spreadProps$f(__spreadValues$r({}, opt), {
|
|
2370
2825
|
paramList: [..._parentAllParams, ...paramList, ...filters2]
|
|
2371
2826
|
}))
|
|
2372
2827
|
);
|
|
@@ -2431,25 +2886,25 @@ var NgwMap = (function (exports) {
|
|
|
2431
2886
|
);
|
|
2432
2887
|
}
|
|
2433
2888
|
|
|
2434
|
-
var __defProp$
|
|
2435
|
-
var __defProps$
|
|
2436
|
-
var __getOwnPropDescs$
|
|
2889
|
+
var __defProp$B = Object.defineProperty;
|
|
2890
|
+
var __defProps$e = Object.defineProperties;
|
|
2891
|
+
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
2437
2892
|
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
2438
2893
|
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
2439
2894
|
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
2440
|
-
var __defNormalProp$
|
|
2895
|
+
var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2441
2896
|
var __spreadValues$q = (a, b) => {
|
|
2442
2897
|
for (var prop in b || (b = {}))
|
|
2443
2898
|
if (__hasOwnProp$r.call(b, prop))
|
|
2444
|
-
__defNormalProp$
|
|
2899
|
+
__defNormalProp$B(a, prop, b[prop]);
|
|
2445
2900
|
if (__getOwnPropSymbols$r)
|
|
2446
2901
|
for (var prop of __getOwnPropSymbols$r(b)) {
|
|
2447
2902
|
if (__propIsEnum$r.call(b, prop))
|
|
2448
|
-
__defNormalProp$
|
|
2903
|
+
__defNormalProp$B(a, prop, b[prop]);
|
|
2449
2904
|
}
|
|
2450
2905
|
return a;
|
|
2451
2906
|
};
|
|
2452
|
-
var __spreadProps$
|
|
2907
|
+
var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
|
|
2453
2908
|
var __async$o = (__this, __arguments, generator) => {
|
|
2454
2909
|
return new Promise((resolve, reject) => {
|
|
2455
2910
|
var fulfilled = (value) => {
|
|
@@ -2487,45 +2942,45 @@ var NgwMap = (function (exports) {
|
|
|
2487
2942
|
if (resp.geom) {
|
|
2488
2943
|
return createGeoJsonFeature(resp);
|
|
2489
2944
|
} else {
|
|
2490
|
-
const onlyGeomItem = yield fetchNgwLayerItem(__spreadProps$
|
|
2945
|
+
const onlyGeomItem = yield fetchNgwLayerItem(__spreadProps$e(__spreadValues$q({}, options), {
|
|
2491
2946
|
geom: true,
|
|
2492
2947
|
fields: null,
|
|
2493
2948
|
extensions: null
|
|
2494
2949
|
}));
|
|
2495
2950
|
const geom = onlyGeomItem.geom;
|
|
2496
|
-
return createGeoJsonFeature(__spreadProps$
|
|
2951
|
+
return createGeoJsonFeature(__spreadProps$e(__spreadValues$q({}, resp), { geom }));
|
|
2497
2952
|
}
|
|
2498
2953
|
});
|
|
2499
|
-
return __spreadProps$
|
|
2954
|
+
return __spreadProps$e(__spreadValues$q({}, resp), {
|
|
2500
2955
|
toGeojson
|
|
2501
2956
|
});
|
|
2502
2957
|
});
|
|
2503
2958
|
}
|
|
2504
2959
|
|
|
2505
|
-
var __defProp$
|
|
2960
|
+
var __defProp$A = Object.defineProperty;
|
|
2506
2961
|
var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
|
|
2507
2962
|
var __hasOwnProp$q = Object.prototype.hasOwnProperty;
|
|
2508
2963
|
var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
|
|
2509
|
-
var __defNormalProp$
|
|
2964
|
+
var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2510
2965
|
var __spreadValues$p = (a, b) => {
|
|
2511
2966
|
for (var prop in b || (b = {}))
|
|
2512
2967
|
if (__hasOwnProp$q.call(b, prop))
|
|
2513
|
-
__defNormalProp$
|
|
2968
|
+
__defNormalProp$A(a, prop, b[prop]);
|
|
2514
2969
|
if (__getOwnPropSymbols$q)
|
|
2515
2970
|
for (var prop of __getOwnPropSymbols$q(b)) {
|
|
2516
2971
|
if (__propIsEnum$q.call(b, prop))
|
|
2517
|
-
__defNormalProp$
|
|
2972
|
+
__defNormalProp$A(a, prop, b[prop]);
|
|
2518
2973
|
}
|
|
2519
2974
|
return a;
|
|
2520
2975
|
};
|
|
2521
|
-
var __publicField$
|
|
2976
|
+
var __publicField$p = (obj, key, value) => __defNormalProp$A(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2522
2977
|
class BookmarkItem {
|
|
2523
2978
|
constructor(options) {
|
|
2524
2979
|
this.options = options;
|
|
2525
|
-
__publicField$
|
|
2526
|
-
__publicField$
|
|
2527
|
-
__publicField$
|
|
2528
|
-
__publicField$
|
|
2980
|
+
__publicField$p(this, "name");
|
|
2981
|
+
__publicField$p(this, "resourceId");
|
|
2982
|
+
__publicField$p(this, "item");
|
|
2983
|
+
__publicField$p(this, "_extent");
|
|
2529
2984
|
this.resourceId = options.resourceId;
|
|
2530
2985
|
const item = options.item;
|
|
2531
2986
|
this.item = item;
|
|
@@ -2671,14 +3126,14 @@ var NgwMap = (function (exports) {
|
|
|
2671
3126
|
return true;
|
|
2672
3127
|
}
|
|
2673
3128
|
|
|
2674
|
-
var __defProp$
|
|
2675
|
-
var __defNormalProp$
|
|
2676
|
-
var __publicField$
|
|
3129
|
+
var __defProp$z = Object.defineProperty;
|
|
3130
|
+
var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3131
|
+
var __publicField$o = (obj, key, value) => __defNormalProp$z(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2677
3132
|
class TreeHelper {
|
|
2678
3133
|
constructor(item) {
|
|
2679
|
-
__publicField$
|
|
2680
|
-
__publicField$
|
|
2681
|
-
__publicField$
|
|
3134
|
+
__publicField$o(this, "item");
|
|
3135
|
+
__publicField$o(this, "_children", []);
|
|
3136
|
+
__publicField$o(this, "_parent");
|
|
2682
3137
|
this.item = item;
|
|
2683
3138
|
}
|
|
2684
3139
|
setParent(parent) {
|
|
@@ -2741,19 +3196,19 @@ var NgwMap = (function (exports) {
|
|
|
2741
3196
|
}
|
|
2742
3197
|
}
|
|
2743
3198
|
|
|
2744
|
-
var __defProp$
|
|
2745
|
-
var __defNormalProp$
|
|
2746
|
-
var __publicField$
|
|
3199
|
+
var __defProp$y = Object.defineProperty;
|
|
3200
|
+
var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3201
|
+
var __publicField$n = (obj, key, value) => __defNormalProp$y(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2747
3202
|
class BaseProperty {
|
|
2748
3203
|
constructor(name, item, options) {
|
|
2749
|
-
__publicField$
|
|
2750
|
-
__publicField$
|
|
2751
|
-
__publicField$
|
|
2752
|
-
__publicField$
|
|
2753
|
-
__publicField$
|
|
2754
|
-
__publicField$
|
|
2755
|
-
__publicField$
|
|
2756
|
-
__publicField$
|
|
3204
|
+
__publicField$n(this, "options");
|
|
3205
|
+
__publicField$n(this, "emitter", new EventEmitter());
|
|
3206
|
+
__publicField$n(this, "name");
|
|
3207
|
+
__publicField$n(this, "item");
|
|
3208
|
+
__publicField$n(this, "_blocked", false);
|
|
3209
|
+
__publicField$n(this, "_container");
|
|
3210
|
+
__publicField$n(this, "_value");
|
|
3211
|
+
__publicField$n(this, "_removeEventsListener");
|
|
2757
3212
|
this.item = item;
|
|
2758
3213
|
this.options = Object.assign({}, options);
|
|
2759
3214
|
this.name = name;
|
|
@@ -2850,23 +3305,23 @@ var NgwMap = (function (exports) {
|
|
|
2850
3305
|
}
|
|
2851
3306
|
}
|
|
2852
3307
|
|
|
2853
|
-
var __defProp$
|
|
3308
|
+
var __defProp$x = Object.defineProperty;
|
|
2854
3309
|
var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
|
|
2855
3310
|
var __hasOwnProp$p = Object.prototype.hasOwnProperty;
|
|
2856
3311
|
var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
|
|
2857
|
-
var __defNormalProp$
|
|
3312
|
+
var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2858
3313
|
var __spreadValues$o = (a, b) => {
|
|
2859
3314
|
for (var prop in b || (b = {}))
|
|
2860
3315
|
if (__hasOwnProp$p.call(b, prop))
|
|
2861
|
-
__defNormalProp$
|
|
3316
|
+
__defNormalProp$x(a, prop, b[prop]);
|
|
2862
3317
|
if (__getOwnPropSymbols$p)
|
|
2863
3318
|
for (var prop of __getOwnPropSymbols$p(b)) {
|
|
2864
3319
|
if (__propIsEnum$p.call(b, prop))
|
|
2865
|
-
__defNormalProp$
|
|
3320
|
+
__defNormalProp$x(a, prop, b[prop]);
|
|
2866
3321
|
}
|
|
2867
3322
|
return a;
|
|
2868
3323
|
};
|
|
2869
|
-
var __publicField$
|
|
3324
|
+
var __publicField$m = (obj, key, value) => __defNormalProp$x(obj, key + "" , value);
|
|
2870
3325
|
const _CheckProperty = class _CheckProperty extends BaseProperty {
|
|
2871
3326
|
constructor(name, item, options) {
|
|
2872
3327
|
super(name, item, __spreadValues$o(__spreadValues$o({}, _CheckProperty.options), options));
|
|
@@ -2974,7 +3429,7 @@ var NgwMap = (function (exports) {
|
|
|
2974
3429
|
}
|
|
2975
3430
|
}
|
|
2976
3431
|
};
|
|
2977
|
-
__publicField$
|
|
3432
|
+
__publicField$m(_CheckProperty, "options", {
|
|
2978
3433
|
hierarchy: true,
|
|
2979
3434
|
bubble: false,
|
|
2980
3435
|
propagation: false,
|
|
@@ -2983,31 +3438,31 @@ var NgwMap = (function (exports) {
|
|
|
2983
3438
|
});
|
|
2984
3439
|
let CheckProperty = _CheckProperty;
|
|
2985
3440
|
|
|
2986
|
-
var __defProp$
|
|
3441
|
+
var __defProp$w = Object.defineProperty;
|
|
2987
3442
|
var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
|
|
2988
3443
|
var __hasOwnProp$o = Object.prototype.hasOwnProperty;
|
|
2989
3444
|
var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
|
|
2990
|
-
var __defNormalProp$
|
|
3445
|
+
var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2991
3446
|
var __spreadValues$n = (a, b) => {
|
|
2992
3447
|
for (var prop in b || (b = {}))
|
|
2993
3448
|
if (__hasOwnProp$o.call(b, prop))
|
|
2994
|
-
__defNormalProp$
|
|
3449
|
+
__defNormalProp$w(a, prop, b[prop]);
|
|
2995
3450
|
if (__getOwnPropSymbols$o)
|
|
2996
3451
|
for (var prop of __getOwnPropSymbols$o(b)) {
|
|
2997
3452
|
if (__propIsEnum$o.call(b, prop))
|
|
2998
|
-
__defNormalProp$
|
|
3453
|
+
__defNormalProp$w(a, prop, b[prop]);
|
|
2999
3454
|
}
|
|
3000
3455
|
return a;
|
|
3001
3456
|
};
|
|
3002
|
-
var __publicField$
|
|
3457
|
+
var __publicField$l = (obj, key, value) => __defNormalProp$w(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3003
3458
|
const BOOLEAN_TYPE = "boolean";
|
|
3004
3459
|
const STRING_TYPE = "string";
|
|
3005
3460
|
const _ItemProperties = class _ItemProperties {
|
|
3006
3461
|
constructor(item, propertiesList) {
|
|
3007
3462
|
this.item = item;
|
|
3008
|
-
__publicField$
|
|
3009
|
-
__publicField$
|
|
3010
|
-
__publicField$
|
|
3463
|
+
__publicField$l(this, "options", {});
|
|
3464
|
+
__publicField$l(this, "_properties", {});
|
|
3465
|
+
__publicField$l(this, "_propertiesList", []);
|
|
3011
3466
|
if (propertiesList) {
|
|
3012
3467
|
propertiesList.forEach(this._setPropertyHandler.bind(this));
|
|
3013
3468
|
}
|
|
@@ -3070,35 +3525,35 @@ var NgwMap = (function (exports) {
|
|
|
3070
3525
|
return Handler;
|
|
3071
3526
|
}
|
|
3072
3527
|
};
|
|
3073
|
-
__publicField$
|
|
3528
|
+
__publicField$l(_ItemProperties, "handlers", {
|
|
3074
3529
|
CheckProperty
|
|
3075
3530
|
});
|
|
3076
3531
|
let ItemProperties = _ItemProperties;
|
|
3077
3532
|
|
|
3078
|
-
var __defProp$
|
|
3533
|
+
var __defProp$v = Object.defineProperty;
|
|
3079
3534
|
var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
|
|
3080
3535
|
var __hasOwnProp$n = Object.prototype.hasOwnProperty;
|
|
3081
3536
|
var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
|
|
3082
|
-
var __defNormalProp$
|
|
3537
|
+
var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3083
3538
|
var __spreadValues$m = (a, b) => {
|
|
3084
3539
|
for (var prop in b || (b = {}))
|
|
3085
3540
|
if (__hasOwnProp$n.call(b, prop))
|
|
3086
|
-
__defNormalProp$
|
|
3541
|
+
__defNormalProp$v(a, prop, b[prop]);
|
|
3087
3542
|
if (__getOwnPropSymbols$n)
|
|
3088
3543
|
for (var prop of __getOwnPropSymbols$n(b)) {
|
|
3089
3544
|
if (__propIsEnum$n.call(b, prop))
|
|
3090
|
-
__defNormalProp$
|
|
3545
|
+
__defNormalProp$v(a, prop, b[prop]);
|
|
3091
3546
|
}
|
|
3092
3547
|
return a;
|
|
3093
3548
|
};
|
|
3094
|
-
var __publicField$
|
|
3549
|
+
var __publicField$k = (obj, key, value) => __defNormalProp$v(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3095
3550
|
let ID$1 = 0;
|
|
3096
3551
|
class Item {
|
|
3097
3552
|
constructor(options) {
|
|
3098
|
-
__publicField$
|
|
3099
|
-
__publicField$
|
|
3100
|
-
__publicField$
|
|
3101
|
-
__publicField$
|
|
3553
|
+
__publicField$k(this, "options", {});
|
|
3554
|
+
__publicField$k(this, "properties");
|
|
3555
|
+
__publicField$k(this, "tree");
|
|
3556
|
+
__publicField$k(this, "id", ID$1);
|
|
3102
3557
|
ID$1 += 1;
|
|
3103
3558
|
this.options = __spreadValues$m({}, options);
|
|
3104
3559
|
this.tree = new TreeHelper(this);
|
|
@@ -3152,25 +3607,25 @@ var NgwMap = (function (exports) {
|
|
|
3152
3607
|
}
|
|
3153
3608
|
}
|
|
3154
3609
|
|
|
3155
|
-
var __defProp$
|
|
3156
|
-
var __defProps$
|
|
3157
|
-
var __getOwnPropDescs$
|
|
3610
|
+
var __defProp$u = Object.defineProperty;
|
|
3611
|
+
var __defProps$d = Object.defineProperties;
|
|
3612
|
+
var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
|
|
3158
3613
|
var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
|
|
3159
3614
|
var __hasOwnProp$m = Object.prototype.hasOwnProperty;
|
|
3160
3615
|
var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
|
|
3161
|
-
var __defNormalProp$
|
|
3616
|
+
var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3162
3617
|
var __spreadValues$l = (a, b) => {
|
|
3163
3618
|
for (var prop in b || (b = {}))
|
|
3164
3619
|
if (__hasOwnProp$m.call(b, prop))
|
|
3165
|
-
__defNormalProp$
|
|
3620
|
+
__defNormalProp$u(a, prop, b[prop]);
|
|
3166
3621
|
if (__getOwnPropSymbols$m)
|
|
3167
3622
|
for (var prop of __getOwnPropSymbols$m(b)) {
|
|
3168
3623
|
if (__propIsEnum$m.call(b, prop))
|
|
3169
|
-
__defNormalProp$
|
|
3624
|
+
__defNormalProp$u(a, prop, b[prop]);
|
|
3170
3625
|
}
|
|
3171
3626
|
return a;
|
|
3172
3627
|
};
|
|
3173
|
-
var __spreadProps$
|
|
3628
|
+
var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
|
|
3174
3629
|
function getNgwWebmapExtent(webmap) {
|
|
3175
3630
|
const bottom = webmap["extent_bottom"];
|
|
3176
3631
|
const left = webmap["extent_left"];
|
|
@@ -3238,14 +3693,14 @@ var NgwMap = (function (exports) {
|
|
|
3238
3693
|
if (resource.cls && resource.cls.indexOf("style") !== -1) {
|
|
3239
3694
|
return connector.getResource(resource.parent.id, options).then((res) => {
|
|
3240
3695
|
if (res) {
|
|
3241
|
-
return fetchNgwLayerExtent(__spreadProps$
|
|
3696
|
+
return fetchNgwLayerExtent(__spreadProps$d(__spreadValues$l({}, options), {
|
|
3242
3697
|
resourceId: res.resource.id,
|
|
3243
3698
|
connector
|
|
3244
3699
|
}));
|
|
3245
3700
|
}
|
|
3246
3701
|
});
|
|
3247
3702
|
} else {
|
|
3248
|
-
return fetchNgwLayerExtent(__spreadProps$
|
|
3703
|
+
return fetchNgwLayerExtent(__spreadProps$d(__spreadValues$l({}, options), {
|
|
3249
3704
|
resourceId: resource.id,
|
|
3250
3705
|
connector
|
|
3251
3706
|
}));
|
|
@@ -3253,9 +3708,9 @@ var NgwMap = (function (exports) {
|
|
|
3253
3708
|
}
|
|
3254
3709
|
}
|
|
3255
3710
|
|
|
3256
|
-
var __defProp$
|
|
3257
|
-
var __defNormalProp$
|
|
3258
|
-
var __publicField$
|
|
3711
|
+
var __defProp$t = Object.defineProperty;
|
|
3712
|
+
var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3713
|
+
var __publicField$j = (obj, key, value) => __defNormalProp$t(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3259
3714
|
var __async$n = (__this, __arguments, generator) => {
|
|
3260
3715
|
return new Promise((resolve, reject) => {
|
|
3261
3716
|
var fulfilled = (value) => {
|
|
@@ -3278,9 +3733,9 @@ var NgwMap = (function (exports) {
|
|
|
3278
3733
|
};
|
|
3279
3734
|
class NgwResource {
|
|
3280
3735
|
constructor() {
|
|
3281
|
-
__publicField$
|
|
3282
|
-
__publicField$
|
|
3283
|
-
__publicField$
|
|
3736
|
+
__publicField$j(this, "item");
|
|
3737
|
+
__publicField$j(this, "connector");
|
|
3738
|
+
__publicField$j(this, "_extent");
|
|
3284
3739
|
}
|
|
3285
3740
|
/** @deprecated use {@link NgwResource.getBounds} instead */
|
|
3286
3741
|
getExtent() {
|
|
@@ -3399,23 +3854,23 @@ var NgwMap = (function (exports) {
|
|
|
3399
3854
|
};
|
|
3400
3855
|
}
|
|
3401
3856
|
|
|
3402
|
-
var __defProp$
|
|
3857
|
+
var __defProp$s = Object.defineProperty;
|
|
3403
3858
|
var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
|
|
3404
3859
|
var __hasOwnProp$l = Object.prototype.hasOwnProperty;
|
|
3405
3860
|
var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
|
|
3406
|
-
var __defNormalProp$
|
|
3861
|
+
var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3407
3862
|
var __spreadValues$k = (a, b) => {
|
|
3408
3863
|
for (var prop in b || (b = {}))
|
|
3409
3864
|
if (__hasOwnProp$l.call(b, prop))
|
|
3410
|
-
__defNormalProp$
|
|
3865
|
+
__defNormalProp$s(a, prop, b[prop]);
|
|
3411
3866
|
if (__getOwnPropSymbols$l)
|
|
3412
3867
|
for (var prop of __getOwnPropSymbols$l(b)) {
|
|
3413
3868
|
if (__propIsEnum$l.call(b, prop))
|
|
3414
|
-
__defNormalProp$
|
|
3869
|
+
__defNormalProp$s(a, prop, b[prop]);
|
|
3415
3870
|
}
|
|
3416
3871
|
return a;
|
|
3417
3872
|
};
|
|
3418
|
-
var __objRest$
|
|
3873
|
+
var __objRest$2 = (source, exclude) => {
|
|
3419
3874
|
var target = {};
|
|
3420
3875
|
for (var prop in source)
|
|
3421
3876
|
if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
@@ -3427,7 +3882,7 @@ var NgwMap = (function (exports) {
|
|
|
3427
3882
|
}
|
|
3428
3883
|
return target;
|
|
3429
3884
|
};
|
|
3430
|
-
var __publicField$
|
|
3885
|
+
var __publicField$i = (obj, key, value) => __defNormalProp$s(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3431
3886
|
var __async$l = (__this, __arguments, generator) => {
|
|
3432
3887
|
return new Promise((resolve, reject) => {
|
|
3433
3888
|
var fulfilled = (value) => {
|
|
@@ -3452,7 +3907,7 @@ var NgwMap = (function (exports) {
|
|
|
3452
3907
|
function createQmsAdapter(webMapOrOptions, url = URL, createOpt = {}) {
|
|
3453
3908
|
let webMap;
|
|
3454
3909
|
if ("webMap" in webMapOrOptions) {
|
|
3455
|
-
const _a = webMapOrOptions, { webMap: webMap_, url: url_ } = _a, adapterOptions = __objRest$
|
|
3910
|
+
const _a = webMapOrOptions, { webMap: webMap_, url: url_ } = _a, adapterOptions = __objRest$2(_a, ["webMap", "url"]);
|
|
3456
3911
|
webMap = webMap_;
|
|
3457
3912
|
if (url_) {
|
|
3458
3913
|
url = url_;
|
|
@@ -3468,9 +3923,9 @@ var NgwMap = (function (exports) {
|
|
|
3468
3923
|
}
|
|
3469
3924
|
class QmsAdapter {
|
|
3470
3925
|
constructor(map, options) {
|
|
3471
|
-
__publicField$
|
|
3472
|
-
__publicField$
|
|
3473
|
-
__publicField$
|
|
3926
|
+
__publicField$i(this, "qms");
|
|
3927
|
+
__publicField$i(this, "options");
|
|
3928
|
+
__publicField$i(this, "map");
|
|
3474
3929
|
this.map = map;
|
|
3475
3930
|
const opt = __spreadValues$k(__spreadValues$k({}, createOpt), options);
|
|
3476
3931
|
this.options = opt;
|
|
@@ -3524,29 +3979,29 @@ var NgwMap = (function (exports) {
|
|
|
3524
3979
|
return QmsAdapter;
|
|
3525
3980
|
}
|
|
3526
3981
|
|
|
3527
|
-
var __defProp$
|
|
3982
|
+
var __defProp$r = Object.defineProperty;
|
|
3528
3983
|
var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
|
|
3529
3984
|
var __hasOwnProp$k = Object.prototype.hasOwnProperty;
|
|
3530
3985
|
var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
|
|
3531
|
-
var __defNormalProp$
|
|
3986
|
+
var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3532
3987
|
var __spreadValues$j = (a, b) => {
|
|
3533
3988
|
for (var prop in b || (b = {}))
|
|
3534
3989
|
if (__hasOwnProp$k.call(b, prop))
|
|
3535
|
-
__defNormalProp$
|
|
3990
|
+
__defNormalProp$r(a, prop, b[prop]);
|
|
3536
3991
|
if (__getOwnPropSymbols$k)
|
|
3537
3992
|
for (var prop of __getOwnPropSymbols$k(b)) {
|
|
3538
3993
|
if (__propIsEnum$k.call(b, prop))
|
|
3539
|
-
__defNormalProp$
|
|
3994
|
+
__defNormalProp$r(a, prop, b[prop]);
|
|
3540
3995
|
}
|
|
3541
3996
|
return a;
|
|
3542
3997
|
};
|
|
3543
|
-
var __publicField$
|
|
3998
|
+
var __publicField$h = (obj, key, value) => __defNormalProp$r(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3544
3999
|
class QmsKit {
|
|
3545
4000
|
constructor(options) {
|
|
3546
|
-
__publicField$
|
|
4001
|
+
__publicField$h(this, "options", {
|
|
3547
4002
|
url: "https://qms.nextgis.com"
|
|
3548
4003
|
});
|
|
3549
|
-
__publicField$
|
|
4004
|
+
__publicField$h(this, "url");
|
|
3550
4005
|
this.options = __spreadValues$j(__spreadValues$j({}, this.options), options);
|
|
3551
4006
|
this.url = this.options.url;
|
|
3552
4007
|
}
|
|
@@ -3562,31 +4017,31 @@ var NgwMap = (function (exports) {
|
|
|
3562
4017
|
return createQmsAdapter({ webMap, url: this.url });
|
|
3563
4018
|
}
|
|
3564
4019
|
}
|
|
3565
|
-
__publicField$
|
|
4020
|
+
__publicField$h(QmsKit, "utils", {
|
|
3566
4021
|
createQmsAdapter
|
|
3567
4022
|
});
|
|
3568
4023
|
|
|
3569
|
-
var __defProp$
|
|
3570
|
-
var __defProps$
|
|
3571
|
-
var __getOwnPropDescs$
|
|
4024
|
+
var __defProp$q = Object.defineProperty;
|
|
4025
|
+
var __defProps$c = Object.defineProperties;
|
|
4026
|
+
var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
|
|
3572
4027
|
var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
|
|
3573
4028
|
var __getProtoOf$2 = Object.getPrototypeOf;
|
|
3574
4029
|
var __hasOwnProp$j = Object.prototype.hasOwnProperty;
|
|
3575
4030
|
var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
|
|
3576
4031
|
var __reflectGet$2 = Reflect.get;
|
|
3577
|
-
var __defNormalProp$
|
|
4032
|
+
var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3578
4033
|
var __spreadValues$i = (a, b) => {
|
|
3579
4034
|
for (var prop in b || (b = {}))
|
|
3580
4035
|
if (__hasOwnProp$j.call(b, prop))
|
|
3581
|
-
__defNormalProp$
|
|
4036
|
+
__defNormalProp$q(a, prop, b[prop]);
|
|
3582
4037
|
if (__getOwnPropSymbols$j)
|
|
3583
4038
|
for (var prop of __getOwnPropSymbols$j(b)) {
|
|
3584
4039
|
if (__propIsEnum$j.call(b, prop))
|
|
3585
|
-
__defNormalProp$
|
|
4040
|
+
__defNormalProp$q(a, prop, b[prop]);
|
|
3586
4041
|
}
|
|
3587
4042
|
return a;
|
|
3588
4043
|
};
|
|
3589
|
-
var __spreadProps$
|
|
4044
|
+
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
3590
4045
|
var __superGet$2 = (cls, obj, key) => __reflectGet$2(__getProtoOf$2(cls), key, obj);
|
|
3591
4046
|
var __async$k = (__this, __arguments, generator) => {
|
|
3592
4047
|
return new Promise((resolve, reject) => {
|
|
@@ -3631,7 +4086,7 @@ var NgwMap = (function (exports) {
|
|
|
3631
4086
|
class BasemapTileAdapter extends TileAdapter {
|
|
3632
4087
|
addLayer(opt) {
|
|
3633
4088
|
return __async$k(this, null, function* () {
|
|
3634
|
-
return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$
|
|
4089
|
+
return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$c(__spreadValues$i({}, opt), { url }));
|
|
3635
4090
|
});
|
|
3636
4091
|
}
|
|
3637
4092
|
}
|
|
@@ -3710,25 +4165,25 @@ var NgwMap = (function (exports) {
|
|
|
3710
4165
|
return fields;
|
|
3711
4166
|
}
|
|
3712
4167
|
|
|
3713
|
-
var __defProp$
|
|
3714
|
-
var __defProps$
|
|
3715
|
-
var __getOwnPropDescs$
|
|
4168
|
+
var __defProp$p = Object.defineProperty;
|
|
4169
|
+
var __defProps$b = Object.defineProperties;
|
|
4170
|
+
var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
|
|
3716
4171
|
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
3717
4172
|
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
3718
4173
|
var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
|
|
3719
|
-
var __defNormalProp$
|
|
4174
|
+
var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3720
4175
|
var __spreadValues$h = (a, b) => {
|
|
3721
4176
|
for (var prop in b || (b = {}))
|
|
3722
4177
|
if (__hasOwnProp$i.call(b, prop))
|
|
3723
|
-
__defNormalProp$
|
|
4178
|
+
__defNormalProp$p(a, prop, b[prop]);
|
|
3724
4179
|
if (__getOwnPropSymbols$i)
|
|
3725
4180
|
for (var prop of __getOwnPropSymbols$i(b)) {
|
|
3726
4181
|
if (__propIsEnum$i.call(b, prop))
|
|
3727
|
-
__defNormalProp$
|
|
4182
|
+
__defNormalProp$p(a, prop, b[prop]);
|
|
3728
4183
|
}
|
|
3729
4184
|
return a;
|
|
3730
4185
|
};
|
|
3731
|
-
var __spreadProps$
|
|
4186
|
+
var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
|
|
3732
4187
|
var __async$j = (__this, __arguments, generator) => {
|
|
3733
4188
|
return new Promise((resolve, reject) => {
|
|
3734
4189
|
var fulfilled = (value) => {
|
|
@@ -3754,13 +4209,13 @@ var NgwMap = (function (exports) {
|
|
|
3754
4209
|
var _a;
|
|
3755
4210
|
const filters = options.filters;
|
|
3756
4211
|
if (filters) {
|
|
3757
|
-
let data = yield createFeatureFieldFilterQueries(__spreadProps$
|
|
4212
|
+
let data = yield createFeatureFieldFilterQueries(__spreadProps$b(__spreadValues$h({}, options), {
|
|
3758
4213
|
filters
|
|
3759
4214
|
}));
|
|
3760
4215
|
const clientFilterValidate = (_a = options.clientFilterValidate) != null ? _a : isFilterWithAnyCase(filters);
|
|
3761
4216
|
if (clientFilterValidate) {
|
|
3762
4217
|
data = data.filter((y) => {
|
|
3763
|
-
const fields = prepareNgwFieldsToPropertiesFilter(__spreadProps$
|
|
4218
|
+
const fields = prepareNgwFieldsToPropertiesFilter(__spreadProps$b(__spreadValues$h({}, y.fields), {
|
|
3764
4219
|
id: y.id
|
|
3765
4220
|
}));
|
|
3766
4221
|
const result = propertiesFilter(fields, filters);
|
|
@@ -3848,28 +4303,28 @@ var NgwMap = (function (exports) {
|
|
|
3848
4303
|
return filterOptions;
|
|
3849
4304
|
}
|
|
3850
4305
|
|
|
3851
|
-
var __defProp$
|
|
3852
|
-
var __defProps$
|
|
3853
|
-
var __getOwnPropDescs$
|
|
4306
|
+
var __defProp$o = Object.defineProperty;
|
|
4307
|
+
var __defProps$a = Object.defineProperties;
|
|
4308
|
+
var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
|
|
3854
4309
|
var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
|
|
3855
4310
|
var __getProtoOf$1 = Object.getPrototypeOf;
|
|
3856
4311
|
var __hasOwnProp$h = Object.prototype.hasOwnProperty;
|
|
3857
4312
|
var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
|
|
3858
4313
|
var __reflectGet$1 = Reflect.get;
|
|
3859
|
-
var __defNormalProp$
|
|
4314
|
+
var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3860
4315
|
var __spreadValues$g = (a, b) => {
|
|
3861
4316
|
for (var prop in b || (b = {}))
|
|
3862
4317
|
if (__hasOwnProp$h.call(b, prop))
|
|
3863
|
-
__defNormalProp$
|
|
4318
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
3864
4319
|
if (__getOwnPropSymbols$h)
|
|
3865
4320
|
for (var prop of __getOwnPropSymbols$h(b)) {
|
|
3866
4321
|
if (__propIsEnum$h.call(b, prop))
|
|
3867
|
-
__defNormalProp$
|
|
4322
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
3868
4323
|
}
|
|
3869
4324
|
return a;
|
|
3870
4325
|
};
|
|
3871
|
-
var __spreadProps$
|
|
3872
|
-
var __publicField$
|
|
4326
|
+
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
4327
|
+
var __publicField$g = (obj, key, value) => __defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3873
4328
|
var __superGet$1 = (cls, obj, key) => __reflectGet$1(__getProtoOf$1(cls), key, obj);
|
|
3874
4329
|
var __async$h = (__this, __arguments, generator) => {
|
|
3875
4330
|
return new Promise((resolve, reject) => {
|
|
@@ -3942,11 +4397,11 @@ var NgwMap = (function (exports) {
|
|
|
3942
4397
|
class NgwGeoJsonAdapter extends GeoJsonAdapter {
|
|
3943
4398
|
constructor() {
|
|
3944
4399
|
super(...arguments);
|
|
3945
|
-
__publicField$
|
|
3946
|
-
__publicField$
|
|
3947
|
-
__publicField$
|
|
3948
|
-
__publicField$
|
|
3949
|
-
__publicField$
|
|
4400
|
+
__publicField$g(this, "emitter", new EventEmitter());
|
|
4401
|
+
__publicField$g(this, "__onMapMove");
|
|
4402
|
+
__publicField$g(this, "__onMapMoveStart");
|
|
4403
|
+
__publicField$g(this, "__enableMapMoveListener");
|
|
4404
|
+
__publicField$g(this, "__disableMapMoveListener");
|
|
3950
4405
|
}
|
|
3951
4406
|
addLayer(opt) {
|
|
3952
4407
|
return __async$h(this, null, function* () {
|
|
@@ -4019,10 +4474,10 @@ var NgwMap = (function (exports) {
|
|
|
4019
4474
|
getCount() {
|
|
4020
4475
|
return fetchNgwLayerCount({ connector, resourceId, cache: true });
|
|
4021
4476
|
}
|
|
4022
|
-
updateLayer(
|
|
4477
|
+
updateLayer(opt) {
|
|
4023
4478
|
return __async$h(this, null, function* () {
|
|
4024
4479
|
var _a2;
|
|
4025
|
-
filterArgs =
|
|
4480
|
+
const filterArgs = opt || _lastFilterArgs || {};
|
|
4026
4481
|
if ((_a2 = this.options.strategy) == null ? void 0 : _a2.startsWith("BBOX")) {
|
|
4027
4482
|
yield webMap.onLoad("create");
|
|
4028
4483
|
filterArgs.options = filterArgs.options || {};
|
|
@@ -4047,7 +4502,7 @@ var NgwMap = (function (exports) {
|
|
|
4047
4502
|
try {
|
|
4048
4503
|
this.emitter.emit("preupdate", filterArgs);
|
|
4049
4504
|
webMap._emitLayerEvent("layer:preupdate", options.id || "", filterArgs);
|
|
4050
|
-
const data = yield getData(filterArgs.filters, __spreadProps$
|
|
4505
|
+
const data = yield getData(filterArgs.filters, __spreadProps$a(__spreadValues$g({}, filterArgs.options), {
|
|
4051
4506
|
srs: this.options.srs
|
|
4052
4507
|
}));
|
|
4053
4508
|
let newData = data;
|
|
@@ -4100,7 +4555,7 @@ var NgwMap = (function (exports) {
|
|
|
4100
4555
|
if (this.clearLayer) {
|
|
4101
4556
|
this.clearLayer();
|
|
4102
4557
|
}
|
|
4103
|
-
const data = yield getData(filters, __spreadProps$
|
|
4558
|
+
const data = yield getData(filters, __spreadProps$a(__spreadValues$g({}, opt), {
|
|
4104
4559
|
srs: this.options.srs
|
|
4105
4560
|
}));
|
|
4106
4561
|
this.setData(data);
|
|
@@ -4289,26 +4744,26 @@ var NgwMap = (function (exports) {
|
|
|
4289
4744
|
}
|
|
4290
4745
|
}
|
|
4291
4746
|
|
|
4292
|
-
var __defProp$
|
|
4293
|
-
var __defProps$
|
|
4294
|
-
var __getOwnPropDescs$
|
|
4747
|
+
var __defProp$n = Object.defineProperty;
|
|
4748
|
+
var __defProps$9 = Object.defineProperties;
|
|
4749
|
+
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
4295
4750
|
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
4296
4751
|
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
4297
4752
|
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
4298
|
-
var __defNormalProp$
|
|
4753
|
+
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4299
4754
|
var __spreadValues$f = (a, b) => {
|
|
4300
4755
|
for (var prop in b || (b = {}))
|
|
4301
4756
|
if (__hasOwnProp$g.call(b, prop))
|
|
4302
|
-
__defNormalProp$
|
|
4757
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
4303
4758
|
if (__getOwnPropSymbols$g)
|
|
4304
4759
|
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
4305
4760
|
if (__propIsEnum$g.call(b, prop))
|
|
4306
|
-
__defNormalProp$
|
|
4761
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
4307
4762
|
}
|
|
4308
4763
|
return a;
|
|
4309
4764
|
};
|
|
4310
|
-
var __spreadProps$
|
|
4311
|
-
var __publicField$
|
|
4765
|
+
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
4766
|
+
var __publicField$f = (obj, key, value) => __defNormalProp$n(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4312
4767
|
var __async$f = (__this, __arguments, generator) => {
|
|
4313
4768
|
return new Promise((resolve, reject) => {
|
|
4314
4769
|
var fulfilled = (value) => {
|
|
@@ -4329,11 +4784,47 @@ var NgwMap = (function (exports) {
|
|
|
4329
4784
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
4330
4785
|
});
|
|
4331
4786
|
};
|
|
4787
|
+
class Legend {
|
|
4788
|
+
constructor({
|
|
4789
|
+
layerId,
|
|
4790
|
+
legend,
|
|
4791
|
+
onSymbolRenderChange
|
|
4792
|
+
}) {
|
|
4793
|
+
__publicField$f(this, "layerId");
|
|
4794
|
+
__publicField$f(this, "legend");
|
|
4795
|
+
__publicField$f(this, "onSymbolRenderChange");
|
|
4796
|
+
this.layerId = layerId;
|
|
4797
|
+
this.legend = this.createLegend(legend);
|
|
4798
|
+
this.onSymbolRenderChange = onSymbolRenderChange;
|
|
4799
|
+
}
|
|
4800
|
+
createLegend(items) {
|
|
4801
|
+
return items.map((params) => __spreadProps$9(__spreadValues$f({}, params), {
|
|
4802
|
+
/** @deprecated use display_name instead */
|
|
4803
|
+
name: params.display_name,
|
|
4804
|
+
/** @deprecated use icon instead */
|
|
4805
|
+
symbol: params.icon
|
|
4806
|
+
}));
|
|
4807
|
+
}
|
|
4808
|
+
setSymbolRender(symbolIndex, status) {
|
|
4809
|
+
const legendItem = this.legend.find((l) => l.index === symbolIndex);
|
|
4810
|
+
if (legendItem) {
|
|
4811
|
+
const render = legendItem.render;
|
|
4812
|
+
if (render !== status) {
|
|
4813
|
+
legendItem.render = status;
|
|
4814
|
+
if (this.onSymbolRenderChange) {
|
|
4815
|
+
this.onSymbolRenderChange(
|
|
4816
|
+
this.legend.filter((l) => l.render).map((l) => l.index)
|
|
4817
|
+
);
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4332
4823
|
function createRasterAdapter(_0) {
|
|
4333
4824
|
return __async$f(this, arguments, function* ({
|
|
4334
4825
|
layerOptions,
|
|
4335
|
-
webMap,
|
|
4336
4826
|
connector,
|
|
4827
|
+
webMap,
|
|
4337
4828
|
item
|
|
4338
4829
|
}) {
|
|
4339
4830
|
const resourceCls = item.resource.cls;
|
|
@@ -4362,16 +4853,17 @@ var NgwMap = (function (exports) {
|
|
|
4362
4853
|
constructor(map, _options) {
|
|
4363
4854
|
super(map, _options);
|
|
4364
4855
|
this.map = map;
|
|
4365
|
-
|
|
4366
|
-
__publicField$
|
|
4367
|
-
__publicField$
|
|
4856
|
+
__publicField$f(this, "item", item);
|
|
4857
|
+
__publicField$f(this, "resourceId", resourceId);
|
|
4858
|
+
__publicField$f(this, "_blocked", false);
|
|
4859
|
+
__publicField$f(this, "_layerVisibility");
|
|
4368
4860
|
const opt = ngwApiToAdapterOptions({
|
|
4369
4861
|
options: layerOptions,
|
|
4370
4862
|
webMap,
|
|
4371
4863
|
baseUrl: connector.options.baseUrl || ""
|
|
4372
4864
|
});
|
|
4373
4865
|
if (opt) {
|
|
4374
|
-
const layerAdapterOptions = __spreadProps$
|
|
4866
|
+
const layerAdapterOptions = __spreadProps$9(__spreadValues$f(__spreadValues$f({}, opt), layerOptions.adapterOptions), {
|
|
4375
4867
|
params: { resource: resourceId },
|
|
4376
4868
|
layers: opt.layers || String(resourceId),
|
|
4377
4869
|
resourceId
|
|
@@ -4385,25 +4877,19 @@ var NgwMap = (function (exports) {
|
|
|
4385
4877
|
addLayer(addOptions) {
|
|
4386
4878
|
return super.addLayer(__spreadValues$f(__spreadValues$f({}, this.options), addOptions));
|
|
4387
4879
|
}
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
}, options));
|
|
4394
|
-
const id = this.options.id;
|
|
4395
|
-
if (id !== void 0) {
|
|
4396
|
-
const legend = {
|
|
4397
|
-
layerId: id,
|
|
4398
|
-
legend: ngwLegend.map(({ display_name, icon }) => ({
|
|
4399
|
-
name: display_name,
|
|
4400
|
-
symbol: icon
|
|
4401
|
-
}))
|
|
4402
|
-
};
|
|
4403
|
-
return [legend];
|
|
4880
|
+
showLayer() {
|
|
4881
|
+
this._layerVisibility = true;
|
|
4882
|
+
if (this.layer) {
|
|
4883
|
+
if (!this._blocked) {
|
|
4884
|
+
webMap.mapAdapter.showLayer(this.layer);
|
|
4404
4885
|
}
|
|
4405
|
-
|
|
4406
|
-
|
|
4886
|
+
}
|
|
4887
|
+
}
|
|
4888
|
+
hideLayer() {
|
|
4889
|
+
this._layerVisibility = false;
|
|
4890
|
+
if (this.layer) {
|
|
4891
|
+
webMap.mapAdapter.hideLayer(this.layer);
|
|
4892
|
+
}
|
|
4407
4893
|
}
|
|
4408
4894
|
getIdentificationIds() {
|
|
4409
4895
|
return __async$f(this, null, function* () {
|
|
@@ -4419,8 +4905,69 @@ var NgwMap = (function (exports) {
|
|
|
4419
4905
|
return [];
|
|
4420
4906
|
});
|
|
4421
4907
|
}
|
|
4422
|
-
|
|
4423
|
-
|
|
4908
|
+
getLegend(options) {
|
|
4909
|
+
return __async$f(this, null, function* () {
|
|
4910
|
+
const id = this.options.id;
|
|
4911
|
+
if (id !== void 0) {
|
|
4912
|
+
const ngwLegend = yield connector.get("render.legend_symbols", __spreadValues$f({
|
|
4913
|
+
params: { id: resourceId },
|
|
4914
|
+
cache: true
|
|
4915
|
+
}, options));
|
|
4916
|
+
const legend = new Legend({
|
|
4917
|
+
layerId: id,
|
|
4918
|
+
legend: ngwLegend,
|
|
4919
|
+
onSymbolRenderChange: this._setLegendSymbol.bind(this)
|
|
4920
|
+
});
|
|
4921
|
+
return [legend];
|
|
4922
|
+
}
|
|
4923
|
+
return [];
|
|
4924
|
+
});
|
|
4925
|
+
}
|
|
4926
|
+
_hideLayer() {
|
|
4927
|
+
if (this.options.id) {
|
|
4928
|
+
webMap.mapAdapter.hideLayer(this.layer);
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
_showLayer() {
|
|
4932
|
+
if (this.options.id) {
|
|
4933
|
+
if (this._layerVisibility) {
|
|
4934
|
+
webMap.showLayer(this.options.id, { silent: true });
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4938
|
+
_setLegendSymbol(renderIndexes) {
|
|
4939
|
+
const intervals = this._consolidateIntervals(renderIndexes);
|
|
4940
|
+
if (!intervals.length) {
|
|
4941
|
+
this._hideLayer();
|
|
4942
|
+
this._blocked = true;
|
|
4943
|
+
} else {
|
|
4944
|
+
this._blocked = false;
|
|
4945
|
+
this._showLayer();
|
|
4946
|
+
}
|
|
4947
|
+
if (this.updateLayer) {
|
|
4948
|
+
this.updateLayer({
|
|
4949
|
+
params: {
|
|
4950
|
+
[`symbols[${resourceId}]`]: intervals.join(",") || void 0
|
|
4951
|
+
}
|
|
4952
|
+
});
|
|
4953
|
+
}
|
|
4954
|
+
}
|
|
4955
|
+
_consolidateIntervals(symbols) {
|
|
4956
|
+
const sortedSymbols = symbols.slice().sort((a, b) => a - b);
|
|
4957
|
+
const intervals = [];
|
|
4958
|
+
let start = sortedSymbols[0];
|
|
4959
|
+
let end = start;
|
|
4960
|
+
for (let i = 1; i <= sortedSymbols.length; i++) {
|
|
4961
|
+
if (sortedSymbols[i] === end + 1) {
|
|
4962
|
+
end = sortedSymbols[i];
|
|
4963
|
+
} else {
|
|
4964
|
+
intervals.push(start === end ? `${start}` : `${start}-${end}`);
|
|
4965
|
+
start = sortedSymbols[i];
|
|
4966
|
+
end = start;
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4969
|
+
return intervals;
|
|
4970
|
+
}
|
|
4424
4971
|
};
|
|
4425
4972
|
} else {
|
|
4426
4973
|
throw new Error(adapter + " not supported yet. Only TILE");
|
|
@@ -4428,25 +4975,25 @@ var NgwMap = (function (exports) {
|
|
|
4428
4975
|
});
|
|
4429
4976
|
}
|
|
4430
4977
|
|
|
4431
|
-
var __defProp$
|
|
4432
|
-
var __defProps$
|
|
4433
|
-
var __getOwnPropDescs$
|
|
4978
|
+
var __defProp$m = Object.defineProperty;
|
|
4979
|
+
var __defProps$8 = Object.defineProperties;
|
|
4980
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
4434
4981
|
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
4435
4982
|
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
4436
4983
|
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
4437
|
-
var __defNormalProp$
|
|
4984
|
+
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4438
4985
|
var __spreadValues$e = (a, b) => {
|
|
4439
4986
|
for (var prop in b || (b = {}))
|
|
4440
4987
|
if (__hasOwnProp$f.call(b, prop))
|
|
4441
|
-
__defNormalProp$
|
|
4988
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
4442
4989
|
if (__getOwnPropSymbols$f)
|
|
4443
4990
|
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
4444
4991
|
if (__propIsEnum$f.call(b, prop))
|
|
4445
|
-
__defNormalProp$
|
|
4992
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
4446
4993
|
}
|
|
4447
4994
|
return a;
|
|
4448
4995
|
};
|
|
4449
|
-
var __spreadProps$
|
|
4996
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
4450
4997
|
var __async$e = (__this, __arguments, generator) => {
|
|
4451
4998
|
return new Promise((resolve, reject) => {
|
|
4452
4999
|
var fulfilled = (value) => {
|
|
@@ -4494,7 +5041,7 @@ var NgwMap = (function (exports) {
|
|
|
4494
5041
|
const firstStyle = childrenStyles && childrenStyles[0];
|
|
4495
5042
|
if (firstStyle) {
|
|
4496
5043
|
return createAsyncAdapter(
|
|
4497
|
-
__spreadProps$
|
|
5044
|
+
__spreadProps$8(__spreadValues$e({}, layerOptions), { resource: firstStyle.resource.id }),
|
|
4498
5045
|
webMap,
|
|
4499
5046
|
connector
|
|
4500
5047
|
);
|
|
@@ -4517,7 +5064,7 @@ var NgwMap = (function (exports) {
|
|
|
4517
5064
|
}
|
|
4518
5065
|
if (item) {
|
|
4519
5066
|
const cls = item.resource.cls;
|
|
4520
|
-
const layerOptions = __spreadProps$
|
|
5067
|
+
const layerOptions = __spreadProps$8(__spreadValues$e({}, options), {
|
|
4521
5068
|
resource: resourceId
|
|
4522
5069
|
});
|
|
4523
5070
|
const adapterOptions = {
|
|
@@ -4554,10 +5101,10 @@ var NgwMap = (function (exports) {
|
|
|
4554
5101
|
item.resource.parent.id
|
|
4555
5102
|
);
|
|
4556
5103
|
if (parentItem) {
|
|
4557
|
-
const parentOptions = __spreadProps$
|
|
5104
|
+
const parentOptions = __spreadProps$8(__spreadValues$e({}, options), {
|
|
4558
5105
|
resource: item.resource.parent.id
|
|
4559
5106
|
});
|
|
4560
|
-
adapter = createGeoJsonAdapter(__spreadProps$
|
|
5107
|
+
adapter = createGeoJsonAdapter(__spreadProps$8(__spreadValues$e({}, adapterOptions), {
|
|
4561
5108
|
item: parentItem,
|
|
4562
5109
|
layerOptions: parentOptions
|
|
4563
5110
|
}));
|
|
@@ -4601,31 +5148,46 @@ var NgwMap = (function (exports) {
|
|
|
4601
5148
|
});
|
|
4602
5149
|
}
|
|
4603
5150
|
|
|
4604
|
-
var __defProp$
|
|
5151
|
+
var __defProp$l = Object.defineProperty;
|
|
5152
|
+
var __defProps$7 = Object.defineProperties;
|
|
5153
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
4605
5154
|
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
4606
5155
|
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
4607
5156
|
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
4608
|
-
var __defNormalProp$
|
|
5157
|
+
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4609
5158
|
var __spreadValues$d = (a, b) => {
|
|
4610
5159
|
for (var prop in b || (b = {}))
|
|
4611
5160
|
if (__hasOwnProp$e.call(b, prop))
|
|
4612
|
-
__defNormalProp$
|
|
5161
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
4613
5162
|
if (__getOwnPropSymbols$e)
|
|
4614
5163
|
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
4615
5164
|
if (__propIsEnum$e.call(b, prop))
|
|
4616
|
-
__defNormalProp$
|
|
5165
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
4617
5166
|
}
|
|
4618
5167
|
return a;
|
|
4619
5168
|
};
|
|
5169
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
5170
|
+
var __objRest$1 = (source, exclude) => {
|
|
5171
|
+
var target = {};
|
|
5172
|
+
for (var prop in source)
|
|
5173
|
+
if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
5174
|
+
target[prop] = source[prop];
|
|
5175
|
+
if (source != null && __getOwnPropSymbols$e)
|
|
5176
|
+
for (var prop of __getOwnPropSymbols$e(source)) {
|
|
5177
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
|
|
5178
|
+
target[prop] = source[prop];
|
|
5179
|
+
}
|
|
5180
|
+
return target;
|
|
5181
|
+
};
|
|
4620
5182
|
function updateImageParams(params, resourceId) {
|
|
4621
|
-
const { bbox, width, height, nd } =
|
|
4622
|
-
return {
|
|
5183
|
+
const _a = params, { bbox, width, height, nd } = _a, rest = __objRest$1(_a, ["bbox", "width", "height", "nd"]);
|
|
5184
|
+
return __spreadProps$7(__spreadValues$d({}, rest), {
|
|
4623
5185
|
resource: Array.isArray(resourceId) ? resourceId.join(",") : resourceId,
|
|
4624
5186
|
extent: bbox,
|
|
4625
5187
|
size: width + "," + height,
|
|
4626
5188
|
timestamp: Date.now(),
|
|
4627
5189
|
nd: nd != null ? nd : 200
|
|
4628
|
-
};
|
|
5190
|
+
});
|
|
4629
5191
|
}
|
|
4630
5192
|
const vectorLayerGeomToPaintTypeAlias = {
|
|
4631
5193
|
POINT: "point",
|
|
@@ -4685,26 +5247,26 @@ var NgwMap = (function (exports) {
|
|
|
4685
5247
|
return zoom;
|
|
4686
5248
|
}
|
|
4687
5249
|
|
|
4688
|
-
var __defProp$
|
|
5250
|
+
var __defProp$k = Object.defineProperty;
|
|
4689
5251
|
var __defProps$6 = Object.defineProperties;
|
|
4690
5252
|
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
4691
5253
|
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
4692
5254
|
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
4693
5255
|
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
4694
|
-
var __defNormalProp$
|
|
5256
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4695
5257
|
var __spreadValues$c = (a, b) => {
|
|
4696
5258
|
for (var prop in b || (b = {}))
|
|
4697
5259
|
if (__hasOwnProp$d.call(b, prop))
|
|
4698
|
-
__defNormalProp$
|
|
5260
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
4699
5261
|
if (__getOwnPropSymbols$d)
|
|
4700
5262
|
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
4701
5263
|
if (__propIsEnum$d.call(b, prop))
|
|
4702
|
-
__defNormalProp$
|
|
5264
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
4703
5265
|
}
|
|
4704
5266
|
return a;
|
|
4705
5267
|
};
|
|
4706
5268
|
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
4707
|
-
var __publicField$
|
|
5269
|
+
var __publicField$e = (obj, key, value) => __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4708
5270
|
var __async$d = (__this, __arguments, generator) => {
|
|
4709
5271
|
return new Promise((resolve, reject) => {
|
|
4710
5272
|
var fulfilled = (value) => {
|
|
@@ -4729,11 +5291,11 @@ var NgwMap = (function (exports) {
|
|
|
4729
5291
|
constructor(webMap, item, options, connector, parent, noInit) {
|
|
4730
5292
|
super(__spreadValues$c(__spreadValues$c({}, _NgwWebmapItem.options), options));
|
|
4731
5293
|
this.webMap = webMap;
|
|
4732
|
-
__publicField$
|
|
4733
|
-
__publicField$
|
|
4734
|
-
__publicField$
|
|
4735
|
-
__publicField$
|
|
4736
|
-
__publicField$
|
|
5294
|
+
__publicField$e(this, "item");
|
|
5295
|
+
__publicField$e(this, "connector");
|
|
5296
|
+
__publicField$e(this, "layer");
|
|
5297
|
+
__publicField$e(this, "emitter", new EventEmitter());
|
|
5298
|
+
__publicField$e(this, "_rootDescendantsCount", 0);
|
|
4737
5299
|
if (connector) {
|
|
4738
5300
|
this.connector = connector;
|
|
4739
5301
|
}
|
|
@@ -4795,10 +5357,12 @@ var NgwMap = (function (exports) {
|
|
|
4795
5357
|
}, options));
|
|
4796
5358
|
const legend = {
|
|
4797
5359
|
layerId: id,
|
|
4798
|
-
legend: ngwLegend.map((
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
5360
|
+
legend: ngwLegend.map((legend2) => __spreadValues$c({
|
|
5361
|
+
/** @deprecated use display_name instead */
|
|
5362
|
+
name: legend2.display_name,
|
|
5363
|
+
/** @deprecated use icon instead */
|
|
5364
|
+
symbol: legend2.icon
|
|
5365
|
+
}, legend2))
|
|
4802
5366
|
};
|
|
4803
5367
|
return [legend];
|
|
4804
5368
|
}
|
|
@@ -4921,8 +5485,8 @@ var NgwMap = (function (exports) {
|
|
|
4921
5485
|
return totalValue;
|
|
4922
5486
|
}
|
|
4923
5487
|
};
|
|
4924
|
-
__publicField$
|
|
4925
|
-
__publicField$
|
|
5488
|
+
__publicField$e(_NgwWebmapItem, "GetAdapterFromLayerType", {});
|
|
5489
|
+
__publicField$e(_NgwWebmapItem, "options", {
|
|
4926
5490
|
properties: [
|
|
4927
5491
|
{
|
|
4928
5492
|
type: "boolean",
|
|
@@ -4962,23 +5526,23 @@ var NgwMap = (function (exports) {
|
|
|
4962
5526
|
});
|
|
4963
5527
|
let NgwWebmapItem = _NgwWebmapItem;
|
|
4964
5528
|
|
|
4965
|
-
var __defProp$
|
|
5529
|
+
var __defProp$j = Object.defineProperty;
|
|
4966
5530
|
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
4967
5531
|
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
4968
5532
|
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
4969
|
-
var __defNormalProp$
|
|
5533
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4970
5534
|
var __spreadValues$b = (a, b) => {
|
|
4971
5535
|
for (var prop in b || (b = {}))
|
|
4972
5536
|
if (__hasOwnProp$c.call(b, prop))
|
|
4973
|
-
__defNormalProp$
|
|
5537
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
4974
5538
|
if (__getOwnPropSymbols$c)
|
|
4975
5539
|
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
4976
5540
|
if (__propIsEnum$c.call(b, prop))
|
|
4977
|
-
__defNormalProp$
|
|
5541
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
4978
5542
|
}
|
|
4979
5543
|
return a;
|
|
4980
5544
|
};
|
|
4981
|
-
var __publicField$
|
|
5545
|
+
var __publicField$d = (obj, key, value) => __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4982
5546
|
var __async$c = (__this, __arguments, generator) => {
|
|
4983
5547
|
return new Promise((resolve, reject) => {
|
|
4984
5548
|
var fulfilled = (value) => {
|
|
@@ -5008,10 +5572,10 @@ var NgwMap = (function (exports) {
|
|
|
5008
5572
|
}) {
|
|
5009
5573
|
class OnFirstShowAdapter {
|
|
5010
5574
|
constructor() {
|
|
5011
|
-
__publicField$
|
|
5012
|
-
__publicField$
|
|
5013
|
-
__publicField$
|
|
5014
|
-
__publicField$
|
|
5575
|
+
__publicField$d(this, "options", {});
|
|
5576
|
+
__publicField$d(this, "layer", []);
|
|
5577
|
+
__publicField$d(this, "_removed", false);
|
|
5578
|
+
__publicField$d(this, "_creatingInProgress", false);
|
|
5015
5579
|
}
|
|
5016
5580
|
addLayer() {
|
|
5017
5581
|
return this.layer;
|
|
@@ -5139,26 +5703,26 @@ var NgwMap = (function (exports) {
|
|
|
5139
5703
|
|
|
5140
5704
|
const WEBMAP_BASELAYER_ID_PREFIX = "webmap-baselayer";
|
|
5141
5705
|
|
|
5142
|
-
var __defProp$
|
|
5706
|
+
var __defProp$i = Object.defineProperty;
|
|
5143
5707
|
var __defProps$5 = Object.defineProperties;
|
|
5144
5708
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
5145
5709
|
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
5146
5710
|
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
5147
5711
|
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
5148
|
-
var __defNormalProp$
|
|
5712
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5149
5713
|
var __spreadValues$a = (a, b) => {
|
|
5150
5714
|
for (var prop in b || (b = {}))
|
|
5151
5715
|
if (__hasOwnProp$b.call(b, prop))
|
|
5152
|
-
__defNormalProp$
|
|
5716
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
5153
5717
|
if (__getOwnPropSymbols$b)
|
|
5154
5718
|
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
5155
5719
|
if (__propIsEnum$b.call(b, prop))
|
|
5156
|
-
__defNormalProp$
|
|
5720
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
5157
5721
|
}
|
|
5158
5722
|
return a;
|
|
5159
5723
|
};
|
|
5160
5724
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
5161
|
-
var __publicField$
|
|
5725
|
+
var __publicField$c = (obj, key, value) => __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5162
5726
|
var __async$a = (__this, __arguments, generator) => {
|
|
5163
5727
|
return new Promise((resolve, reject) => {
|
|
5164
5728
|
var fulfilled = (value) => {
|
|
@@ -5183,21 +5747,20 @@ var NgwMap = (function (exports) {
|
|
|
5183
5747
|
constructor(map, options) {
|
|
5184
5748
|
this.map = map;
|
|
5185
5749
|
this.options = options;
|
|
5186
|
-
__publicField$
|
|
5187
|
-
__publicField$
|
|
5750
|
+
__publicField$c(this, "layer");
|
|
5751
|
+
__publicField$c(this, "NgwWebmapItem", NgwWebmapItem);
|
|
5188
5752
|
/**
|
|
5189
5753
|
* Radius for searching objects in pixels
|
|
5190
5754
|
*/
|
|
5191
|
-
__publicField$
|
|
5755
|
+
__publicField$c(this, "pixelRadius", 10);
|
|
5192
5756
|
// webmapSettings.identify_radius,
|
|
5193
|
-
__publicField$
|
|
5194
|
-
__publicField$
|
|
5195
|
-
__publicField$
|
|
5196
|
-
__publicField$
|
|
5197
|
-
__publicField$
|
|
5198
|
-
__publicField$
|
|
5199
|
-
__publicField$
|
|
5200
|
-
__publicField$b(this, "_lastActiveBaselayer");
|
|
5757
|
+
__publicField$c(this, "resourceId");
|
|
5758
|
+
__publicField$c(this, "webmapClassName", "webmap");
|
|
5759
|
+
__publicField$c(this, "emitter", new EventEmitter());
|
|
5760
|
+
__publicField$c(this, "_extent");
|
|
5761
|
+
__publicField$c(this, "response");
|
|
5762
|
+
__publicField$c(this, "_webmapBaselayersIds", []);
|
|
5763
|
+
__publicField$c(this, "_lastActiveBaselayer");
|
|
5201
5764
|
const r = options.resourceId;
|
|
5202
5765
|
if (Array.isArray(r)) {
|
|
5203
5766
|
this.resourceId = r[0];
|
|
@@ -5240,7 +5803,6 @@ var NgwMap = (function (exports) {
|
|
|
5240
5803
|
}
|
|
5241
5804
|
delete this.layer;
|
|
5242
5805
|
delete this.response;
|
|
5243
|
-
delete this._webmapLayersIds;
|
|
5244
5806
|
}
|
|
5245
5807
|
showLayer() {
|
|
5246
5808
|
return __async$a(this, null, function* () {
|
|
@@ -5331,26 +5893,19 @@ var NgwMap = (function (exports) {
|
|
|
5331
5893
|
getIdentificationIds(options) {
|
|
5332
5894
|
return __async$a(this, null, function* () {
|
|
5333
5895
|
const visibleLayers = [];
|
|
5334
|
-
let
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
const parentId = item.parentId;
|
|
5345
|
-
if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
|
|
5346
|
-
const visible = x.properties.property("visibility");
|
|
5347
|
-
const isVisible = visible.get() && !visible.isBlocked();
|
|
5348
|
-
if (isVisible) {
|
|
5349
|
-
visibleLayers.push(parentId);
|
|
5350
|
-
}
|
|
5896
|
+
let deps = this.getDependLayers();
|
|
5897
|
+
deps = deps.sort((a, b) => b.id - a.id);
|
|
5898
|
+
deps.forEach((x) => {
|
|
5899
|
+
const item = x.item;
|
|
5900
|
+
const parentId = item.style_parent_id;
|
|
5901
|
+
if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
|
|
5902
|
+
const visible = x.properties.property("visibility");
|
|
5903
|
+
const isVisible = visible.get() && !visible.isBlocked();
|
|
5904
|
+
if (isVisible) {
|
|
5905
|
+
visibleLayers.push(parentId);
|
|
5351
5906
|
}
|
|
5352
|
-
}
|
|
5353
|
-
}
|
|
5907
|
+
}
|
|
5908
|
+
});
|
|
5354
5909
|
return visibleLayers;
|
|
5355
5910
|
});
|
|
5356
5911
|
}
|
|
@@ -5479,50 +6034,25 @@ var NgwMap = (function (exports) {
|
|
|
5479
6034
|
}
|
|
5480
6035
|
return item;
|
|
5481
6036
|
}
|
|
5482
|
-
_getWebMapIds(options) {
|
|
5483
|
-
return __async$a(this, null, function* () {
|
|
5484
|
-
const webMapItem = this.layer;
|
|
5485
|
-
if (webMapItem && webMapItem.item.item_type === "root") {
|
|
5486
|
-
const layers = webMapItem.tree.getDescendants();
|
|
5487
|
-
const promises = [];
|
|
5488
|
-
for (const x of layers) {
|
|
5489
|
-
const item = x.item;
|
|
5490
|
-
if (item.item_type === "layer") {
|
|
5491
|
-
const id = item.layer_style_id;
|
|
5492
|
-
const promise = this.options.connector.getResource(id, options).then((y) => {
|
|
5493
|
-
if (y) {
|
|
5494
|
-
const parentId = Number(y.resource.parent.id);
|
|
5495
|
-
item.parentId = parentId;
|
|
5496
|
-
return parentId;
|
|
5497
|
-
}
|
|
5498
|
-
});
|
|
5499
|
-
promises.push(promise);
|
|
5500
|
-
}
|
|
5501
|
-
}
|
|
5502
|
-
const ids = yield Promise.all(promises);
|
|
5503
|
-
return ids.filter((x) => x !== void 0);
|
|
5504
|
-
}
|
|
5505
|
-
});
|
|
5506
|
-
}
|
|
5507
6037
|
}
|
|
5508
6038
|
|
|
5509
|
-
var __defProp$
|
|
6039
|
+
var __defProp$h = Object.defineProperty;
|
|
5510
6040
|
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
5511
6041
|
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
5512
6042
|
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
5513
|
-
var __defNormalProp$
|
|
6043
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5514
6044
|
var __spreadValues$9 = (a, b) => {
|
|
5515
6045
|
for (var prop in b || (b = {}))
|
|
5516
6046
|
if (__hasOwnProp$a.call(b, prop))
|
|
5517
|
-
__defNormalProp$
|
|
6047
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
5518
6048
|
if (__getOwnPropSymbols$a)
|
|
5519
6049
|
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
5520
6050
|
if (__propIsEnum$a.call(b, prop))
|
|
5521
|
-
__defNormalProp$
|
|
6051
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
5522
6052
|
}
|
|
5523
6053
|
return a;
|
|
5524
6054
|
};
|
|
5525
|
-
var __publicField$
|
|
6055
|
+
var __publicField$b = (obj, key, value) => __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5526
6056
|
var __async$9 = (__this, __arguments, generator) => {
|
|
5527
6057
|
return new Promise((resolve, reject) => {
|
|
5528
6058
|
var fulfilled = (value) => {
|
|
@@ -5546,9 +6076,9 @@ var NgwMap = (function (exports) {
|
|
|
5546
6076
|
class NgwKit {
|
|
5547
6077
|
constructor(options) {
|
|
5548
6078
|
this.options = options;
|
|
5549
|
-
__publicField$
|
|
5550
|
-
__publicField$
|
|
5551
|
-
__publicField$
|
|
6079
|
+
__publicField$b(this, "url");
|
|
6080
|
+
__publicField$b(this, "connector");
|
|
6081
|
+
__publicField$b(this, "webMap");
|
|
5552
6082
|
if (this.options.connector) {
|
|
5553
6083
|
this.url = this.options.connector.options.baseUrl || "";
|
|
5554
6084
|
this.connector = this.options.connector;
|
|
@@ -5558,7 +6088,7 @@ var NgwMap = (function (exports) {
|
|
|
5558
6088
|
} else {
|
|
5559
6089
|
throw new Error("url is not defined");
|
|
5560
6090
|
}
|
|
5561
|
-
this.connector = new
|
|
6091
|
+
this.connector = new NgwConnectorExtended({
|
|
5562
6092
|
baseUrl: this.url,
|
|
5563
6093
|
auth: this.options.auth
|
|
5564
6094
|
});
|
|
@@ -5609,37 +6139,37 @@ var NgwMap = (function (exports) {
|
|
|
5609
6139
|
}
|
|
5610
6140
|
}
|
|
5611
6141
|
|
|
5612
|
-
var __defProp$
|
|
6142
|
+
var __defProp$g = Object.defineProperty;
|
|
5613
6143
|
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
5614
6144
|
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
5615
6145
|
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
5616
|
-
var __defNormalProp$
|
|
6146
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5617
6147
|
var __spreadValues$8 = (a, b) => {
|
|
5618
6148
|
for (var prop in b || (b = {}))
|
|
5619
6149
|
if (__hasOwnProp$9.call(b, prop))
|
|
5620
|
-
__defNormalProp$
|
|
6150
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
5621
6151
|
if (__getOwnPropSymbols$9)
|
|
5622
6152
|
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
5623
6153
|
if (__propIsEnum$9.call(b, prop))
|
|
5624
|
-
__defNormalProp$
|
|
6154
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
5625
6155
|
}
|
|
5626
6156
|
return a;
|
|
5627
6157
|
};
|
|
5628
|
-
var __publicField$
|
|
6158
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5629
6159
|
class IdentifyItem {
|
|
5630
6160
|
constructor(options) {
|
|
5631
|
-
__publicField$
|
|
5632
|
-
__publicField$
|
|
5633
|
-
__publicField$
|
|
5634
|
-
__publicField$
|
|
5635
|
-
__publicField$
|
|
5636
|
-
__publicField$
|
|
5637
|
-
__publicField$
|
|
5638
|
-
__publicField$
|
|
5639
|
-
__publicField$
|
|
5640
|
-
__publicField$
|
|
5641
|
-
__publicField$
|
|
5642
|
-
__publicField$
|
|
6161
|
+
__publicField$a(this, "id");
|
|
6162
|
+
__publicField$a(this, "label");
|
|
6163
|
+
__publicField$a(this, "layerId");
|
|
6164
|
+
__publicField$a(this, "parent");
|
|
6165
|
+
__publicField$a(this, "fields");
|
|
6166
|
+
__publicField$a(this, "geom");
|
|
6167
|
+
__publicField$a(this, "extensions");
|
|
6168
|
+
__publicField$a(this, "connector");
|
|
6169
|
+
__publicField$a(this, "_item");
|
|
6170
|
+
__publicField$a(this, "_geojson");
|
|
6171
|
+
__publicField$a(this, "_resource");
|
|
6172
|
+
__publicField$a(this, "_extent");
|
|
5643
6173
|
const f = options.feature;
|
|
5644
6174
|
this.id = f.id;
|
|
5645
6175
|
this.geom = f.geom;
|
|
@@ -5725,21 +6255,21 @@ var NgwMap = (function (exports) {
|
|
|
5725
6255
|
});
|
|
5726
6256
|
}
|
|
5727
6257
|
|
|
5728
|
-
var __defProp$
|
|
6258
|
+
var __defProp$f = Object.defineProperty;
|
|
5729
6259
|
var __defProps$4 = Object.defineProperties;
|
|
5730
6260
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
5731
6261
|
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
5732
6262
|
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
5733
6263
|
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
5734
|
-
var __defNormalProp$
|
|
6264
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5735
6265
|
var __spreadValues$7 = (a, b) => {
|
|
5736
6266
|
for (var prop in b || (b = {}))
|
|
5737
6267
|
if (__hasOwnProp$8.call(b, prop))
|
|
5738
|
-
__defNormalProp$
|
|
6268
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
5739
6269
|
if (__getOwnPropSymbols$8)
|
|
5740
6270
|
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
5741
6271
|
if (__propIsEnum$8.call(b, prop))
|
|
5742
|
-
__defNormalProp$
|
|
6272
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
5743
6273
|
}
|
|
5744
6274
|
return a;
|
|
5745
6275
|
};
|
|
@@ -6583,19 +7113,19 @@ var NgwMap = (function (exports) {
|
|
|
6583
7113
|
typeof: evaluateArgs(([arg]) => typeOfValue(arg))
|
|
6584
7114
|
};
|
|
6585
7115
|
|
|
6586
|
-
var __defProp$
|
|
7116
|
+
var __defProp$e = Object.defineProperty;
|
|
6587
7117
|
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
6588
7118
|
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
6589
7119
|
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
6590
|
-
var __defNormalProp$
|
|
7120
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6591
7121
|
var __spreadValues$6 = (a, b) => {
|
|
6592
7122
|
for (var prop in b || (b = {}))
|
|
6593
7123
|
if (__hasOwnProp$7.call(b, prop))
|
|
6594
|
-
__defNormalProp$
|
|
7124
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
6595
7125
|
if (__getOwnPropSymbols$7)
|
|
6596
7126
|
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
6597
7127
|
if (__propIsEnum$7.call(b, prop))
|
|
6598
|
-
__defNormalProp$
|
|
7128
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
6599
7129
|
}
|
|
6600
7130
|
return a;
|
|
6601
7131
|
};
|
|
@@ -6620,19 +7150,19 @@ var NgwMap = (function (exports) {
|
|
|
6620
7150
|
throw new Error(`Expression "${name}" is not supported.`);
|
|
6621
7151
|
}
|
|
6622
7152
|
|
|
6623
|
-
var __defProp$
|
|
7153
|
+
var __defProp$d = Object.defineProperty;
|
|
6624
7154
|
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
6625
7155
|
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
6626
7156
|
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
6627
|
-
var __defNormalProp$
|
|
7157
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6628
7158
|
var __spreadValues$5 = (a, b) => {
|
|
6629
7159
|
for (var prop in b || (b = {}))
|
|
6630
7160
|
if (__hasOwnProp$6.call(b, prop))
|
|
6631
|
-
__defNormalProp$
|
|
7161
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
6632
7162
|
if (__getOwnPropSymbols$6)
|
|
6633
7163
|
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
6634
7164
|
if (__propIsEnum$6.call(b, prop))
|
|
6635
|
-
__defNormalProp$
|
|
7165
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
6636
7166
|
}
|
|
6637
7167
|
return a;
|
|
6638
7168
|
};
|
|
@@ -6671,19 +7201,19 @@ var NgwMap = (function (exports) {
|
|
|
6671
7201
|
return;
|
|
6672
7202
|
}
|
|
6673
7203
|
|
|
6674
|
-
var __defProp$
|
|
7204
|
+
var __defProp$c = Object.defineProperty;
|
|
6675
7205
|
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
6676
7206
|
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
6677
7207
|
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
6678
|
-
var __defNormalProp$
|
|
7208
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6679
7209
|
var __spreadValues$4 = (a, b) => {
|
|
6680
7210
|
for (var prop in b || (b = {}))
|
|
6681
7211
|
if (__hasOwnProp$5.call(b, prop))
|
|
6682
|
-
__defNormalProp$
|
|
7212
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
6683
7213
|
if (__getOwnPropSymbols$5)
|
|
6684
7214
|
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
6685
7215
|
if (__propIsEnum$5.call(b, prop))
|
|
6686
|
-
__defNormalProp$
|
|
7216
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
6687
7217
|
}
|
|
6688
7218
|
return a;
|
|
6689
7219
|
};
|
|
@@ -6807,95 +7337,95 @@ var NgwMap = (function (exports) {
|
|
|
6807
7337
|
return newPaint;
|
|
6808
7338
|
}
|
|
6809
7339
|
|
|
6810
|
-
var __defProp$
|
|
6811
|
-
var __defNormalProp$
|
|
6812
|
-
var __publicField$
|
|
7340
|
+
var __defProp$b = Object.defineProperty;
|
|
7341
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7342
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6813
7343
|
class KeyCodes {
|
|
6814
7344
|
constructor() {
|
|
6815
|
-
__publicField$
|
|
6816
|
-
__publicField$
|
|
6817
|
-
__publicField$
|
|
6818
|
-
__publicField$
|
|
6819
|
-
__publicField$
|
|
6820
|
-
__publicField$
|
|
6821
|
-
__publicField$
|
|
6822
|
-
__publicField$
|
|
6823
|
-
__publicField$
|
|
6824
|
-
__publicField$
|
|
6825
|
-
__publicField$
|
|
6826
|
-
__publicField$
|
|
6827
|
-
__publicField$
|
|
6828
|
-
__publicField$
|
|
6829
|
-
__publicField$
|
|
6830
|
-
__publicField$
|
|
6831
|
-
__publicField$
|
|
6832
|
-
__publicField$
|
|
6833
|
-
__publicField$
|
|
6834
|
-
__publicField$
|
|
6835
|
-
__publicField$
|
|
6836
|
-
__publicField$
|
|
6837
|
-
__publicField$
|
|
6838
|
-
__publicField$
|
|
6839
|
-
__publicField$
|
|
6840
|
-
__publicField$
|
|
6841
|
-
__publicField$
|
|
6842
|
-
__publicField$
|
|
6843
|
-
__publicField$
|
|
6844
|
-
__publicField$
|
|
6845
|
-
__publicField$
|
|
6846
|
-
__publicField$
|
|
6847
|
-
__publicField$
|
|
6848
|
-
__publicField$
|
|
6849
|
-
__publicField$
|
|
6850
|
-
__publicField$
|
|
6851
|
-
__publicField$
|
|
6852
|
-
__publicField$
|
|
6853
|
-
__publicField$
|
|
6854
|
-
__publicField$
|
|
6855
|
-
__publicField$
|
|
6856
|
-
__publicField$
|
|
6857
|
-
__publicField$
|
|
6858
|
-
__publicField$
|
|
6859
|
-
__publicField$
|
|
6860
|
-
__publicField$
|
|
6861
|
-
__publicField$
|
|
6862
|
-
__publicField$
|
|
6863
|
-
__publicField$
|
|
6864
|
-
__publicField$
|
|
6865
|
-
__publicField$
|
|
6866
|
-
__publicField$
|
|
6867
|
-
__publicField$
|
|
6868
|
-
__publicField$
|
|
7345
|
+
__publicField$9(this, "backspace", 8);
|
|
7346
|
+
__publicField$9(this, "tab", 9);
|
|
7347
|
+
__publicField$9(this, "enter", 13);
|
|
7348
|
+
__publicField$9(this, "shift", 16);
|
|
7349
|
+
__publicField$9(this, "ctrl", 17);
|
|
7350
|
+
__publicField$9(this, "alt", 18);
|
|
7351
|
+
__publicField$9(this, "pause/break", 19);
|
|
7352
|
+
__publicField$9(this, "caps_lock", 20);
|
|
7353
|
+
__publicField$9(this, "escape", 27);
|
|
7354
|
+
__publicField$9(this, "page_up", 33);
|
|
7355
|
+
__publicField$9(this, "page_down", 34);
|
|
7356
|
+
__publicField$9(this, "end", 35);
|
|
7357
|
+
__publicField$9(this, "home", 36);
|
|
7358
|
+
__publicField$9(this, "left_arrow", 37);
|
|
7359
|
+
__publicField$9(this, "up_arrow", 38);
|
|
7360
|
+
__publicField$9(this, "right_arrow", 39);
|
|
7361
|
+
__publicField$9(this, "down_arrow", 40);
|
|
7362
|
+
__publicField$9(this, "insert", 45);
|
|
7363
|
+
__publicField$9(this, "delete", 46);
|
|
7364
|
+
__publicField$9(this, "left_window_key", 91);
|
|
7365
|
+
__publicField$9(this, "right_window_key", 92);
|
|
7366
|
+
__publicField$9(this, "select_key", 93);
|
|
7367
|
+
__publicField$9(this, "numpad_0", 96);
|
|
7368
|
+
__publicField$9(this, "numpad_1", 97);
|
|
7369
|
+
__publicField$9(this, "numpad_2", 98);
|
|
7370
|
+
__publicField$9(this, "numpad_3", 99);
|
|
7371
|
+
__publicField$9(this, "numpad_4", 100);
|
|
7372
|
+
__publicField$9(this, "numpad_5", 101);
|
|
7373
|
+
__publicField$9(this, "numpad_6", 102);
|
|
7374
|
+
__publicField$9(this, "numpad_7", 103);
|
|
7375
|
+
__publicField$9(this, "numpad_8", 104);
|
|
7376
|
+
__publicField$9(this, "numpad_9", 105);
|
|
7377
|
+
__publicField$9(this, "multiply", 106);
|
|
7378
|
+
__publicField$9(this, "add", 107);
|
|
7379
|
+
__publicField$9(this, "subtract", 109);
|
|
7380
|
+
__publicField$9(this, "decimal_point", 110);
|
|
7381
|
+
__publicField$9(this, "divide", 111);
|
|
7382
|
+
__publicField$9(this, "f1", 112);
|
|
7383
|
+
__publicField$9(this, "f2", 113);
|
|
7384
|
+
__publicField$9(this, "f3", 114);
|
|
7385
|
+
__publicField$9(this, "f4", 115);
|
|
7386
|
+
__publicField$9(this, "f5", 116);
|
|
7387
|
+
__publicField$9(this, "f6", 117);
|
|
7388
|
+
__publicField$9(this, "f7", 118);
|
|
7389
|
+
__publicField$9(this, "f8", 119);
|
|
7390
|
+
__publicField$9(this, "f9", 120);
|
|
7391
|
+
__publicField$9(this, "f10", 121);
|
|
7392
|
+
__publicField$9(this, "f11", 122);
|
|
7393
|
+
__publicField$9(this, "f12", 123);
|
|
7394
|
+
__publicField$9(this, "num_lock", 144);
|
|
7395
|
+
__publicField$9(this, "scroll_lock", 145);
|
|
7396
|
+
__publicField$9(this, "semi-colon", 186);
|
|
7397
|
+
__publicField$9(this, "equal_sign", 187);
|
|
7398
|
+
__publicField$9(this, ",", 188);
|
|
6869
7399
|
// "comma";
|
|
6870
|
-
__publicField$
|
|
7400
|
+
__publicField$9(this, "-", 189);
|
|
6871
7401
|
// "dash";
|
|
6872
|
-
__publicField$
|
|
7402
|
+
__publicField$9(this, ".", 190);
|
|
6873
7403
|
// "period";
|
|
6874
|
-
__publicField$
|
|
7404
|
+
__publicField$9(this, "/", 191);
|
|
6875
7405
|
// "forward slash";
|
|
6876
|
-
__publicField$
|
|
7406
|
+
__publicField$9(this, "`", 192);
|
|
6877
7407
|
// "grave accent";
|
|
6878
|
-
__publicField$
|
|
7408
|
+
__publicField$9(this, "[", 219);
|
|
6879
7409
|
// "open bracket";
|
|
6880
|
-
__publicField$
|
|
7410
|
+
__publicField$9(this, "\\", 220);
|
|
6881
7411
|
// "back slash";
|
|
6882
|
-
__publicField$
|
|
7412
|
+
__publicField$9(this, "]", 221);
|
|
6883
7413
|
// "close braket";
|
|
6884
|
-
__publicField$
|
|
7414
|
+
__publicField$9(this, "'", 222);
|
|
6885
7415
|
}
|
|
6886
7416
|
// "single quote"
|
|
6887
7417
|
}
|
|
6888
7418
|
|
|
6889
|
-
var __defProp$
|
|
6890
|
-
var __defNormalProp$
|
|
6891
|
-
var __publicField$
|
|
7419
|
+
var __defProp$a = Object.defineProperty;
|
|
7420
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7421
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6892
7422
|
class Keys {
|
|
6893
7423
|
constructor() {
|
|
6894
|
-
__publicField$
|
|
6895
|
-
__publicField$
|
|
6896
|
-
__publicField$
|
|
6897
|
-
__publicField$
|
|
6898
|
-
__publicField$
|
|
7424
|
+
__publicField$8(this, "keyCodeAlias", new KeyCodes());
|
|
7425
|
+
__publicField$8(this, "keys", {});
|
|
7426
|
+
__publicField$8(this, "_windowOnFocus");
|
|
7427
|
+
__publicField$8(this, "_keysPressed");
|
|
7428
|
+
__publicField$8(this, "_keysReleased");
|
|
6899
7429
|
this._windowOnFocus = this.windowOnFocus.bind(this);
|
|
6900
7430
|
this._keysPressed = this.keysPressed.bind(this);
|
|
6901
7431
|
this._keysReleased = this.keysReleased.bind(this);
|
|
@@ -6934,15 +7464,15 @@ var NgwMap = (function (exports) {
|
|
|
6934
7464
|
}
|
|
6935
7465
|
}
|
|
6936
7466
|
|
|
6937
|
-
var __defProp$
|
|
6938
|
-
var __defNormalProp$
|
|
6939
|
-
var __publicField$
|
|
7467
|
+
var __defProp$9 = Object.defineProperty;
|
|
7468
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7469
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6940
7470
|
class StateItem {
|
|
6941
7471
|
constructor(webMap, opt) {
|
|
6942
7472
|
this.webMap = webMap;
|
|
6943
|
-
__publicField$
|
|
6944
|
-
__publicField$
|
|
6945
|
-
__publicField$
|
|
7473
|
+
__publicField$7(this, "name");
|
|
7474
|
+
__publicField$7(this, "event");
|
|
7475
|
+
__publicField$7(this, "value");
|
|
6946
7476
|
if (opt) {
|
|
6947
7477
|
if (opt.value) {
|
|
6948
7478
|
this.setValue(opt.value);
|
|
@@ -6951,7 +7481,11 @@ var NgwMap = (function (exports) {
|
|
|
6951
7481
|
this.name = opt.name;
|
|
6952
7482
|
}
|
|
6953
7483
|
if (opt.event) {
|
|
6954
|
-
|
|
7484
|
+
if (typeof opt.event === "string") {
|
|
7485
|
+
this.event = [opt.event];
|
|
7486
|
+
} else {
|
|
7487
|
+
this.event = opt.event;
|
|
7488
|
+
}
|
|
6955
7489
|
}
|
|
6956
7490
|
}
|
|
6957
7491
|
}
|
|
@@ -6963,6 +7497,34 @@ var NgwMap = (function (exports) {
|
|
|
6963
7497
|
}
|
|
6964
7498
|
}
|
|
6965
7499
|
|
|
7500
|
+
var __defProp$8 = Object.defineProperty;
|
|
7501
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7502
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7503
|
+
class BoundState extends StateItem {
|
|
7504
|
+
constructor() {
|
|
7505
|
+
super(...arguments);
|
|
7506
|
+
__publicField$6(this, "name", "bounds");
|
|
7507
|
+
__publicField$6(this, "event", ["moveend"]);
|
|
7508
|
+
}
|
|
7509
|
+
getValue() {
|
|
7510
|
+
return this.webMap.getBounds();
|
|
7511
|
+
}
|
|
7512
|
+
setValue(bounds) {
|
|
7513
|
+
this.webMap.setView({ bounds });
|
|
7514
|
+
}
|
|
7515
|
+
toString() {
|
|
7516
|
+
const data = this.getValue();
|
|
7517
|
+
if (data) {
|
|
7518
|
+
return data.slice(0, 4).map((x) => x.toFixed(5)).join("_");
|
|
7519
|
+
}
|
|
7520
|
+
return void 0;
|
|
7521
|
+
}
|
|
7522
|
+
parse(str) {
|
|
7523
|
+
const lngLat = str.split("_").map(Number);
|
|
7524
|
+
return lngLat;
|
|
7525
|
+
}
|
|
7526
|
+
}
|
|
7527
|
+
|
|
6966
7528
|
var __defProp$7 = Object.defineProperty;
|
|
6967
7529
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6968
7530
|
var __publicField$5 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -6970,7 +7532,7 @@ var NgwMap = (function (exports) {
|
|
|
6970
7532
|
constructor() {
|
|
6971
7533
|
super(...arguments);
|
|
6972
7534
|
__publicField$5(this, "name", "center");
|
|
6973
|
-
__publicField$5(this, "event", "moveend");
|
|
7535
|
+
__publicField$5(this, "event", ["moveend"]);
|
|
6974
7536
|
}
|
|
6975
7537
|
getValue() {
|
|
6976
7538
|
return this.webMap.getCenter();
|
|
@@ -6978,9 +7540,13 @@ var NgwMap = (function (exports) {
|
|
|
6978
7540
|
setValue(val) {
|
|
6979
7541
|
this.webMap.setCenter(val);
|
|
6980
7542
|
}
|
|
6981
|
-
toString(
|
|
6982
|
-
const
|
|
6983
|
-
|
|
7543
|
+
toString() {
|
|
7544
|
+
const data = this.getValue();
|
|
7545
|
+
if (data) {
|
|
7546
|
+
const d = data.map((x) => x.toFixed(5));
|
|
7547
|
+
return d[0] + "_" + d[1];
|
|
7548
|
+
}
|
|
7549
|
+
return "";
|
|
6984
7550
|
}
|
|
6985
7551
|
parse(str) {
|
|
6986
7552
|
const lngLat = str.split("_").map(Number);
|
|
@@ -6995,7 +7561,7 @@ var NgwMap = (function (exports) {
|
|
|
6995
7561
|
constructor() {
|
|
6996
7562
|
super(...arguments);
|
|
6997
7563
|
__publicField$4(this, "name", "zoom");
|
|
6998
|
-
__publicField$4(this, "event", "zoomend");
|
|
7564
|
+
__publicField$4(this, "event", ["zoomend"]);
|
|
6999
7565
|
}
|
|
7000
7566
|
getValue() {
|
|
7001
7567
|
const zoom = this.webMap.getZoom();
|
|
@@ -7004,8 +7570,8 @@ var NgwMap = (function (exports) {
|
|
|
7004
7570
|
setValue(val) {
|
|
7005
7571
|
this.webMap.setZoom(val);
|
|
7006
7572
|
}
|
|
7007
|
-
toString(
|
|
7008
|
-
return String(
|
|
7573
|
+
toString() {
|
|
7574
|
+
return String(this.getValue());
|
|
7009
7575
|
}
|
|
7010
7576
|
parse(str) {
|
|
7011
7577
|
return Number(str);
|
|
@@ -7074,14 +7640,14 @@ var NgwMap = (function (exports) {
|
|
|
7074
7640
|
__publicField$3(this, "mapAdapter");
|
|
7075
7641
|
__publicField$3(this, "runtimeParams", []);
|
|
7076
7642
|
__publicField$3(this, "getPaintFunctions", _WebMapMain.getPaintFunctions);
|
|
7077
|
-
__publicField$3(this, "
|
|
7643
|
+
__publicField$3(this, "mapStateItems", [CenterState, ZoomState, BoundState]);
|
|
7078
7644
|
__publicField$3(this, "id", ID++);
|
|
7079
7645
|
/**
|
|
7080
7646
|
* From runtime params
|
|
7081
7647
|
*/
|
|
7648
|
+
__publicField$3(this, "mapState", []);
|
|
7082
7649
|
__publicField$3(this, "_initMapState", {});
|
|
7083
7650
|
__publicField$3(this, "_starterKits");
|
|
7084
|
-
__publicField$3(this, "_mapState", []);
|
|
7085
7651
|
__publicField$3(this, "_extent");
|
|
7086
7652
|
__publicField$3(this, "_eventsStatus", {});
|
|
7087
7653
|
__publicField$3(this, "_coordFromMapClickAbort");
|
|
@@ -7116,7 +7682,7 @@ var NgwMap = (function (exports) {
|
|
|
7116
7682
|
create() {
|
|
7117
7683
|
return __async$6(this, null, function* () {
|
|
7118
7684
|
if (!this.getEventStatus("create")) {
|
|
7119
|
-
yield this._setInitMapState(this.
|
|
7685
|
+
yield this._setInitMapState(this.mapStateItems);
|
|
7120
7686
|
yield this._setupMap();
|
|
7121
7687
|
this._emitStatusEvent("create", this);
|
|
7122
7688
|
}
|
|
@@ -7136,16 +7702,22 @@ var NgwMap = (function (exports) {
|
|
|
7136
7702
|
this.mapAdapter.destroy();
|
|
7137
7703
|
}
|
|
7138
7704
|
}
|
|
7139
|
-
|
|
7705
|
+
mapStateWithFunc(func) {
|
|
7140
7706
|
const state = {};
|
|
7141
|
-
this.
|
|
7142
|
-
state[x.name] = x
|
|
7707
|
+
this.mapState.forEach((x) => {
|
|
7708
|
+
state[x.name] = func(x);
|
|
7143
7709
|
});
|
|
7144
7710
|
return state;
|
|
7145
7711
|
}
|
|
7712
|
+
getStateAsString() {
|
|
7713
|
+
return this.mapStateWithFunc((x) => x.toString());
|
|
7714
|
+
}
|
|
7715
|
+
getState() {
|
|
7716
|
+
return this.mapStateWithFunc((x) => x.getValue());
|
|
7717
|
+
}
|
|
7146
7718
|
getRuntimeParams() {
|
|
7147
7719
|
const state = {};
|
|
7148
|
-
this.
|
|
7720
|
+
this.mapState.forEach((x) => {
|
|
7149
7721
|
for (const r of this.runtimeParams) {
|
|
7150
7722
|
const val = r.get(x.name);
|
|
7151
7723
|
if (val !== void 0) {
|
|
@@ -7487,7 +8059,7 @@ var NgwMap = (function (exports) {
|
|
|
7487
8059
|
_setInitMapState(states) {
|
|
7488
8060
|
for (const X of states) {
|
|
7489
8061
|
const state = new X(this);
|
|
7490
|
-
this.
|
|
8062
|
+
this.mapState.push(state);
|
|
7491
8063
|
for (const r of this.runtimeParams) {
|
|
7492
8064
|
const str = r.get(state.name);
|
|
7493
8065
|
if (str !== void 0) {
|
|
@@ -7523,13 +8095,15 @@ var NgwMap = (function (exports) {
|
|
|
7523
8095
|
events.forEach((x) => {
|
|
7524
8096
|
this._mapEvents[x] = (data) => {
|
|
7525
8097
|
if (this.runtimeParams.length) {
|
|
7526
|
-
const
|
|
7527
|
-
|
|
7528
|
-
|
|
8098
|
+
const mapStatusEvents = this.mapState.filter(
|
|
8099
|
+
(y) => y.event.includes(x)
|
|
8100
|
+
);
|
|
8101
|
+
mapStatusEvents.forEach((mapStatusEvent) => {
|
|
8102
|
+
const value = mapStatusEvent.toString();
|
|
7529
8103
|
this.runtimeParams.forEach((r) => {
|
|
7530
8104
|
r.set(mapStatusEvent.name, value);
|
|
7531
8105
|
});
|
|
7532
|
-
}
|
|
8106
|
+
});
|
|
7533
8107
|
}
|
|
7534
8108
|
if (this._eventsStatus) {
|
|
7535
8109
|
this.emitter.emit(x, data);
|
|
@@ -8105,11 +8679,11 @@ var NgwMap = (function (exports) {
|
|
|
8105
8679
|
}
|
|
8106
8680
|
return Promise.resolve();
|
|
8107
8681
|
}
|
|
8108
|
-
updateLayer(layerDef) {
|
|
8682
|
+
updateLayer(layerDef, options) {
|
|
8109
8683
|
const layer = this.getLayer(layerDef);
|
|
8110
8684
|
if (layer) {
|
|
8111
8685
|
if (layer.updateLayer) {
|
|
8112
|
-
return Promise.resolve(layer.updateLayer());
|
|
8686
|
+
return Promise.resolve(layer.updateLayer(options));
|
|
8113
8687
|
} else if (this.isLayerVisible(layer)) {
|
|
8114
8688
|
return this.hideLayer(layer, { silent: true }).then(() => {
|
|
8115
8689
|
return this.showLayer(layer, { silent: true });
|
|
@@ -9026,7 +9600,7 @@ var NgwMap = (function (exports) {
|
|
|
9026
9600
|
});
|
|
9027
9601
|
}
|
|
9028
9602
|
if (!options.connector) {
|
|
9029
|
-
options.connector = new
|
|
9603
|
+
options.connector = new NgwConnectorExtended({
|
|
9030
9604
|
baseUrl: options.baseUrl || "",
|
|
9031
9605
|
auth: options.auth,
|
|
9032
9606
|
withCredentials: options.withCredentials
|
|
@@ -9300,7 +9874,7 @@ var NgwMap = (function (exports) {
|
|
|
9300
9874
|
if (mem.layer.getDependLayers) {
|
|
9301
9875
|
const dependLayers = mem.layer.getDependLayers();
|
|
9302
9876
|
const dependFit = dependLayers.find((x) => {
|
|
9303
|
-
return x.item && x.item.
|
|
9877
|
+
return x.item && x.item.style_parent_id === id;
|
|
9304
9878
|
});
|
|
9305
9879
|
if (dependFit) {
|
|
9306
9880
|
return dependFit.layer;
|