@nextgis/ngw-map 2.4.1 → 3.0.0-alpha.0
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/index.d.ts +11 -12
- package/lib/ngw-map.cjs.js +23 -13
- 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 +679 -781
- 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 +23 -13
- 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 +679 -781
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version:
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.0; author: NextGIS */
|
|
2
2
|
var domain;
|
|
3
3
|
|
|
4
4
|
// This constructor is used to store event handlers. Instantiating this is
|
|
@@ -471,308 +471,6 @@ function unwrapListeners(arr) {
|
|
|
471
471
|
return ret;
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
var __defProp$N = Object.defineProperty;
|
|
475
|
-
var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
476
|
-
var __publicField$z = (obj, key, value) => __defNormalProp$N(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
477
|
-
class CancelError extends Error {
|
|
478
|
-
constructor() {
|
|
479
|
-
super();
|
|
480
|
-
__publicField$z(this, "name", "CancelError");
|
|
481
|
-
Object.setPrototypeOf(this, CancelError.prototype);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
var __defProp$M = Object.defineProperty;
|
|
486
|
-
var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
487
|
-
var __publicField$y = (obj, key, value) => __defNormalProp$M(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
488
|
-
class PromiseControl {
|
|
489
|
-
constructor(options = {}) {
|
|
490
|
-
this.options = options;
|
|
491
|
-
__publicField$y(this, "_promises", /* @__PURE__ */ new Map());
|
|
492
|
-
}
|
|
493
|
-
get isLoaded() {
|
|
494
|
-
return this._promises.size > 0;
|
|
495
|
-
}
|
|
496
|
-
remove(promise) {
|
|
497
|
-
if (this._promises.has(promise)) {
|
|
498
|
-
this._promises.delete(promise);
|
|
499
|
-
this._onStop();
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
get(promise) {
|
|
503
|
-
return this._promises.get(promise);
|
|
504
|
-
}
|
|
505
|
-
add(promise, name) {
|
|
506
|
-
const key = name ? name : promise;
|
|
507
|
-
const exist = this._promises.get(key);
|
|
508
|
-
if (this.options.onStart && !this.isLoaded) {
|
|
509
|
-
this.options.onStart();
|
|
510
|
-
}
|
|
511
|
-
if (exist) {
|
|
512
|
-
return exist;
|
|
513
|
-
}
|
|
514
|
-
this._promises.set(key, promise);
|
|
515
|
-
promise.finally(() => {
|
|
516
|
-
this.remove(key);
|
|
517
|
-
});
|
|
518
|
-
return promise;
|
|
519
|
-
}
|
|
520
|
-
abort() {
|
|
521
|
-
if (this.isLoaded) {
|
|
522
|
-
this._promises.forEach((x) => {
|
|
523
|
-
if (x.cancel) {
|
|
524
|
-
x.cancel();
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
this._promises.clear();
|
|
528
|
-
this._onStop();
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
waitFunc(func, name = "") {
|
|
532
|
-
name = name || func.name;
|
|
533
|
-
const exist = this.get(name);
|
|
534
|
-
if (exist) {
|
|
535
|
-
return exist;
|
|
536
|
-
}
|
|
537
|
-
return this.add(func(), name);
|
|
538
|
-
}
|
|
539
|
-
WaitForMe(name = "") {
|
|
540
|
-
const get = this.get.bind(this);
|
|
541
|
-
const add = this.add.bind(this);
|
|
542
|
-
return function(target, key, descriptor) {
|
|
543
|
-
const originalMethod = descriptor.value;
|
|
544
|
-
name = name || key;
|
|
545
|
-
descriptor.value = function(...args) {
|
|
546
|
-
const exist = get(name);
|
|
547
|
-
if (exist) {
|
|
548
|
-
return exist;
|
|
549
|
-
}
|
|
550
|
-
const result = add(originalMethod.apply(this, args), name);
|
|
551
|
-
return result;
|
|
552
|
-
};
|
|
553
|
-
return descriptor;
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
/** @deprecated use {@link PromiseControl.WaitForMe } instead */
|
|
557
|
-
GetOrCreateDecorator(name = "") {
|
|
558
|
-
return this.WaitForMe(name);
|
|
559
|
-
}
|
|
560
|
-
_onStop() {
|
|
561
|
-
if (this.options.onStop && !this.isLoaded) {
|
|
562
|
-
this.options.onStop();
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
var __defProp$L = Object.defineProperty;
|
|
568
|
-
var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
569
|
-
var __publicField$x = (obj, key, value) => __defNormalProp$L(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
570
|
-
class TimeoutError extends Error {
|
|
571
|
-
constructor() {
|
|
572
|
-
super();
|
|
573
|
-
__publicField$x(this, "name", "TimeoutError");
|
|
574
|
-
Object.setPrototypeOf(this, TimeoutError.prototype);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
var __defProp$K = Object.defineProperty;
|
|
579
|
-
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
580
|
-
var __publicField$w = (obj, key, value) => __defNormalProp$K(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
581
|
-
var _a;
|
|
582
|
-
const handleCallback = (resolve, reject, callback, r) => {
|
|
583
|
-
try {
|
|
584
|
-
resolve(callback(r));
|
|
585
|
-
} catch (e) {
|
|
586
|
-
reject(e);
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
let ID$3 = 0;
|
|
590
|
-
_a = Symbol.toStringTag;
|
|
591
|
-
const _CancelablePromise = class _CancelablePromise {
|
|
592
|
-
constructor(executor, timeout) {
|
|
593
|
-
// @ts-ignore
|
|
594
|
-
__publicField$w(this, _a);
|
|
595
|
-
__publicField$w(this, "id", ID$3++);
|
|
596
|
-
__publicField$w(this, "_isCanceled", false);
|
|
597
|
-
__publicField$w(this, "_isPending", true);
|
|
598
|
-
__publicField$w(this, "_promise");
|
|
599
|
-
__publicField$w(this, "_cancelPromise");
|
|
600
|
-
__publicField$w(this, "_cancelHandlers", []);
|
|
601
|
-
__publicField$w(this, "_setCanceledCallback");
|
|
602
|
-
__publicField$w(this, "_parentPromise");
|
|
603
|
-
__publicField$w(this, "_children", []);
|
|
604
|
-
this._cancelPromise = new Promise((resolve_, reject_) => {
|
|
605
|
-
this._setCanceledCallback = (er) => resolve_(er || new CancelError());
|
|
606
|
-
});
|
|
607
|
-
const promises = [
|
|
608
|
-
this._cancelPromise,
|
|
609
|
-
new Promise((resolve, reject) => {
|
|
610
|
-
const onResolve = (value) => {
|
|
611
|
-
if (value instanceof _CancelablePromise) {
|
|
612
|
-
this.attach(value);
|
|
613
|
-
} else {
|
|
614
|
-
this._isPending = false;
|
|
615
|
-
}
|
|
616
|
-
resolve(value);
|
|
617
|
-
};
|
|
618
|
-
const onReject = (error) => {
|
|
619
|
-
this._isPending = false;
|
|
620
|
-
reject(error);
|
|
621
|
-
};
|
|
622
|
-
const onCancel = (handler) => {
|
|
623
|
-
if (!this._isPending) {
|
|
624
|
-
throw new Error(
|
|
625
|
-
"The `onCancel` handler was attached after the promise settled."
|
|
626
|
-
);
|
|
627
|
-
}
|
|
628
|
-
this._cancelHandlers.push(handler);
|
|
629
|
-
};
|
|
630
|
-
return executor(onResolve, onReject, onCancel);
|
|
631
|
-
})
|
|
632
|
-
];
|
|
633
|
-
if (timeout) {
|
|
634
|
-
promises.push(
|
|
635
|
-
new Promise((resolve, reject) => {
|
|
636
|
-
setTimeout(() => {
|
|
637
|
-
if (this._isPending) {
|
|
638
|
-
try {
|
|
639
|
-
this.cancel();
|
|
640
|
-
} finally {
|
|
641
|
-
reject(new TimeoutError());
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}, timeout);
|
|
645
|
-
})
|
|
646
|
-
);
|
|
647
|
-
}
|
|
648
|
-
this._promise = Promise.race(promises);
|
|
649
|
-
}
|
|
650
|
-
static createControl(opt) {
|
|
651
|
-
return new PromiseControl(opt);
|
|
652
|
-
}
|
|
653
|
-
static resolve(value) {
|
|
654
|
-
return new _CancelablePromise((resolve) => resolve(value));
|
|
655
|
-
}
|
|
656
|
-
static reject(value) {
|
|
657
|
-
return new _CancelablePromise((resolve, reject) => reject(value));
|
|
658
|
-
}
|
|
659
|
-
static all(values) {
|
|
660
|
-
return new _CancelablePromise((resolve, reject) => {
|
|
661
|
-
Promise.all(values).then(resolve).catch(reject);
|
|
662
|
-
}).catch((er) => {
|
|
663
|
-
if (er instanceof this.CancelError) {
|
|
664
|
-
for (const v of values) {
|
|
665
|
-
const v_ = v;
|
|
666
|
-
if ("cancel" in v_) {
|
|
667
|
-
v_.cancel();
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
throw er;
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
attach(p) {
|
|
675
|
-
if (this._isCanceled) {
|
|
676
|
-
p.cancel();
|
|
677
|
-
} else {
|
|
678
|
-
this._children.push(p);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
then(onfulfilled, onrejected) {
|
|
682
|
-
const p = new _CancelablePromise((resolve, reject) => {
|
|
683
|
-
if (this._promise) {
|
|
684
|
-
const reject_ = (r) => {
|
|
685
|
-
if (onrejected) {
|
|
686
|
-
handleCallback(resolve, reject, onrejected, r);
|
|
687
|
-
} else {
|
|
688
|
-
reject(r);
|
|
689
|
-
}
|
|
690
|
-
};
|
|
691
|
-
this._promise.then((r) => {
|
|
692
|
-
if (this._isCanceled) {
|
|
693
|
-
reject_(r);
|
|
694
|
-
} else {
|
|
695
|
-
if (onfulfilled) {
|
|
696
|
-
handleCallback(resolve, reject, onfulfilled, r);
|
|
697
|
-
} else {
|
|
698
|
-
resolve(r);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}, reject_);
|
|
702
|
-
}
|
|
703
|
-
});
|
|
704
|
-
p._parentPromise = this;
|
|
705
|
-
this._children.push(p);
|
|
706
|
-
return p;
|
|
707
|
-
}
|
|
708
|
-
catch(onrejected) {
|
|
709
|
-
if (this._isCanceled && onrejected) {
|
|
710
|
-
onrejected(new CancelError());
|
|
711
|
-
}
|
|
712
|
-
return this.then(void 0, onrejected);
|
|
713
|
-
}
|
|
714
|
-
finally(onfinally) {
|
|
715
|
-
if (this._promise) {
|
|
716
|
-
return this._promise.finally(onfinally);
|
|
717
|
-
}
|
|
718
|
-
if (this._isCanceled) {
|
|
719
|
-
return Promise.reject(new CancelError());
|
|
720
|
-
}
|
|
721
|
-
return Promise.reject(onfinally);
|
|
722
|
-
}
|
|
723
|
-
cancel() {
|
|
724
|
-
if (this._isCanceled || !this._isPending) {
|
|
725
|
-
return this;
|
|
726
|
-
}
|
|
727
|
-
this._isCanceled = true;
|
|
728
|
-
const parent = this._getTopParent();
|
|
729
|
-
if (parent) {
|
|
730
|
-
parent.cancel();
|
|
731
|
-
}
|
|
732
|
-
if (this._children) {
|
|
733
|
-
this._children.forEach((x) => x.cancel());
|
|
734
|
-
}
|
|
735
|
-
if (this._isPending) {
|
|
736
|
-
if (this._cancelHandlers.length) {
|
|
737
|
-
try {
|
|
738
|
-
for (const handler of this._cancelHandlers) {
|
|
739
|
-
handler();
|
|
740
|
-
}
|
|
741
|
-
} catch (error) {
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
if (this._setCanceledCallback) {
|
|
745
|
-
this._setCanceledCallback();
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
this._destroy();
|
|
749
|
-
return this;
|
|
750
|
-
}
|
|
751
|
-
_getTopParent() {
|
|
752
|
-
let parent = this._parentPromise;
|
|
753
|
-
let hasParent = !!parent;
|
|
754
|
-
while (hasParent) {
|
|
755
|
-
if (parent && parent._parentPromise) {
|
|
756
|
-
parent = parent._parentPromise;
|
|
757
|
-
hasParent = !!parent;
|
|
758
|
-
} else {
|
|
759
|
-
hasParent = false;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
return parent;
|
|
763
|
-
}
|
|
764
|
-
_destroy() {
|
|
765
|
-
this._setCanceledCallback = void 0;
|
|
766
|
-
this._cancelPromise = void 0;
|
|
767
|
-
this._promise = void 0;
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
__publicField$w(_CancelablePromise, "CancelError", CancelError);
|
|
771
|
-
__publicField$w(_CancelablePromise, "TimeoutError", TimeoutError);
|
|
772
|
-
__publicField$w(_CancelablePromise, "PromiseControl", PromiseControl);
|
|
773
|
-
let CancelablePromise = _CancelablePromise;
|
|
774
|
-
Object.setPrototypeOf(CancelablePromise.prototype, Promise.prototype);
|
|
775
|
-
|
|
776
474
|
const svgPath = {
|
|
777
475
|
brill: '<path d="m6 0-5 6 5 6 5-6z"/>',
|
|
778
476
|
circle: '<circle cx="6" cy="6" r="6"/>',
|
|
@@ -1111,7 +809,7 @@ function objectRemoveEmpty(obj) {
|
|
|
1111
809
|
}
|
|
1112
810
|
|
|
1113
811
|
function round(val, toFixed) {
|
|
1114
|
-
const n =
|
|
812
|
+
const n = 1;
|
|
1115
813
|
return Math.round((val + Number.EPSILON) * n) / n;
|
|
1116
814
|
}
|
|
1117
815
|
|
|
@@ -1126,9 +824,9 @@ function fixUrlStr(url) {
|
|
|
1126
824
|
return url.replace(/([^:]\/)\/+/g, "$1");
|
|
1127
825
|
}
|
|
1128
826
|
|
|
1129
|
-
var __defProp$
|
|
1130
|
-
var __defNormalProp$
|
|
1131
|
-
var __publicField$v = (obj, key, value) => __defNormalProp$
|
|
827
|
+
var __defProp$K = Object.defineProperty;
|
|
828
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
829
|
+
var __publicField$v = (obj, key, value) => __defNormalProp$K(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1132
830
|
const _Cache = class _Cache {
|
|
1133
831
|
constructor(options = {}) {
|
|
1134
832
|
__publicField$v(this, "cache", []);
|
|
@@ -1164,8 +862,7 @@ const _Cache = class _Cache {
|
|
|
1164
862
|
* // somewhere else in the code
|
|
1165
863
|
* const item = await cache.addFull('foo', getItemFunc).then((resp) => {
|
|
1166
864
|
* console.log(resp); // 'New item'
|
|
1167
|
-
* })
|
|
1168
|
-
*
|
|
865
|
+
* });
|
|
1169
866
|
* ```
|
|
1170
867
|
*/
|
|
1171
868
|
addFull(key, valueToSet, props) {
|
|
@@ -1180,13 +877,11 @@ const _Cache = class _Cache {
|
|
|
1180
877
|
} else {
|
|
1181
878
|
value = valueToSet;
|
|
1182
879
|
}
|
|
1183
|
-
const
|
|
880
|
+
const nonEmptyProps = props && JSON.parse(JSON.stringify(objectRemoveEmpty(props)));
|
|
1184
881
|
const cacheItem = {
|
|
1185
882
|
key,
|
|
1186
883
|
value,
|
|
1187
|
-
props:
|
|
1188
|
-
// TODO: remove backward compatibility use only props
|
|
1189
|
-
options: props_
|
|
884
|
+
props: nonEmptyProps
|
|
1190
885
|
};
|
|
1191
886
|
if (onlyFull && !full(value)) {
|
|
1192
887
|
return value;
|
|
@@ -1195,7 +890,6 @@ const _Cache = class _Cache {
|
|
|
1195
890
|
if (value instanceof Promise) {
|
|
1196
891
|
value.catch((er) => {
|
|
1197
892
|
this.delete(key, props);
|
|
1198
|
-
throw er;
|
|
1199
893
|
});
|
|
1200
894
|
if (onlyFull) {
|
|
1201
895
|
value.then((x) => {
|
|
@@ -1214,9 +908,7 @@ const _Cache = class _Cache {
|
|
|
1214
908
|
}
|
|
1215
909
|
match(key, props) {
|
|
1216
910
|
const cacheRecord = this._find(key, props);
|
|
1217
|
-
|
|
1218
|
-
return cacheRecord.value;
|
|
1219
|
-
}
|
|
911
|
+
return cacheRecord == null ? void 0 : cacheRecord.value;
|
|
1220
912
|
}
|
|
1221
913
|
matchAll(key, props) {
|
|
1222
914
|
if (key) {
|
|
@@ -1225,37 +917,30 @@ const _Cache = class _Cache {
|
|
|
1225
917
|
return this.cache.map((x) => x.value);
|
|
1226
918
|
}
|
|
1227
919
|
delete(keyOrItem, props) {
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
for (const e of exist) {
|
|
1235
|
-
const index = this.cache.indexOf(e);
|
|
1236
|
-
this.cache.splice(index, 1);
|
|
920
|
+
const itemsToDelete = typeof keyOrItem === "string" ? this.cache.filter((x) => this._filter(x, keyOrItem, props)) : [keyOrItem];
|
|
921
|
+
for (const item of itemsToDelete) {
|
|
922
|
+
const index = this.cache.indexOf(item);
|
|
923
|
+
if (index !== -1) {
|
|
924
|
+
this.cache.splice(index, 1);
|
|
925
|
+
}
|
|
1237
926
|
}
|
|
1238
927
|
}
|
|
1239
928
|
_find(key, props) {
|
|
1240
929
|
return this.cache.find((x) => this._filter(x, key, props));
|
|
1241
930
|
}
|
|
1242
931
|
_filter(item, key, props) {
|
|
1243
|
-
if (item.key
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
return true;
|
|
1249
|
-
}
|
|
1250
|
-
return false;
|
|
932
|
+
if (item.key !== key) return false;
|
|
933
|
+
if (!props) return true;
|
|
934
|
+
const itemProps = item.props;
|
|
935
|
+
return objectDeepEqual(itemProps || {}, objectRemoveEmpty(props));
|
|
1251
936
|
}
|
|
1252
937
|
};
|
|
1253
938
|
__publicField$v(_Cache, "instance", {});
|
|
1254
939
|
let Cache = _Cache;
|
|
1255
940
|
|
|
1256
|
-
var __defProp$
|
|
1257
|
-
var __defNormalProp$
|
|
1258
|
-
var __publicField$u = (obj, key, value) => __defNormalProp$
|
|
941
|
+
var __defProp$J = Object.defineProperty;
|
|
942
|
+
var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
943
|
+
var __publicField$u = (obj, key, value) => __defNormalProp$J(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1259
944
|
class NgwError extends Error {
|
|
1260
945
|
constructor(er) {
|
|
1261
946
|
super();
|
|
@@ -1272,9 +957,9 @@ class NgwError extends Error {
|
|
|
1272
957
|
}
|
|
1273
958
|
}
|
|
1274
959
|
|
|
1275
|
-
var __defProp$
|
|
1276
|
-
var __defNormalProp$
|
|
1277
|
-
var __publicField$t = (obj, key, value) => __defNormalProp$
|
|
960
|
+
var __defProp$I = Object.defineProperty;
|
|
961
|
+
var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
962
|
+
var __publicField$t = (obj, key, value) => __defNormalProp$I(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1278
963
|
class ResourceNotFoundError extends NgwError {
|
|
1279
964
|
constructor(obj) {
|
|
1280
965
|
super(obj);
|
|
@@ -1313,27 +998,24 @@ function resourceToQuery(resource, prefix = "") {
|
|
|
1313
998
|
return query;
|
|
1314
999
|
}
|
|
1315
1000
|
|
|
1316
|
-
var __defProp$
|
|
1317
|
-
var
|
|
1318
|
-
var
|
|
1319
|
-
var
|
|
1320
|
-
var
|
|
1321
|
-
var
|
|
1322
|
-
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1323
|
-
var __spreadValues$t = (a, b) => {
|
|
1001
|
+
var __defProp$H = Object.defineProperty;
|
|
1002
|
+
var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
|
|
1003
|
+
var __hasOwnProp$w = Object.prototype.hasOwnProperty;
|
|
1004
|
+
var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
|
|
1005
|
+
var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1006
|
+
var __spreadValues$v = (a, b) => {
|
|
1324
1007
|
for (var prop in b || (b = {}))
|
|
1325
|
-
if (__hasOwnProp$
|
|
1326
|
-
__defNormalProp$
|
|
1327
|
-
if (__getOwnPropSymbols$
|
|
1328
|
-
for (var prop of __getOwnPropSymbols$
|
|
1329
|
-
if (__propIsEnum$
|
|
1330
|
-
__defNormalProp$
|
|
1008
|
+
if (__hasOwnProp$w.call(b, prop))
|
|
1009
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
1010
|
+
if (__getOwnPropSymbols$w)
|
|
1011
|
+
for (var prop of __getOwnPropSymbols$w(b)) {
|
|
1012
|
+
if (__propIsEnum$w.call(b, prop))
|
|
1013
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
1331
1014
|
}
|
|
1332
1015
|
return a;
|
|
1333
1016
|
};
|
|
1334
|
-
var
|
|
1335
|
-
var
|
|
1336
|
-
var __async$l = (__this, __arguments, generator) => {
|
|
1017
|
+
var __publicField$s = (obj, key, value) => __defNormalProp$H(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1018
|
+
var __async$s = (__this, __arguments, generator) => {
|
|
1337
1019
|
return new Promise((resolve, reject) => {
|
|
1338
1020
|
var fulfilled = (value) => {
|
|
1339
1021
|
try {
|
|
@@ -1374,39 +1056,27 @@ class ResourcesControl {
|
|
|
1374
1056
|
* Fetching resource would be cached to speed up next call
|
|
1375
1057
|
*/
|
|
1376
1058
|
getOne(resource, requestOptions) {
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1379
|
-
const opt = __spreadProps$d(__spreadValues$t({}, requestOptions), { cache: false });
|
|
1380
|
-
if (typeof resource === "string") {
|
|
1381
|
-
forCache.keyname = resource;
|
|
1382
|
-
} else if (typeof resource === "number") {
|
|
1383
|
-
forCache.id = resource;
|
|
1384
|
-
} else if (isObject(resource)) {
|
|
1059
|
+
const opt = __spreadValues$v({}, requestOptions);
|
|
1060
|
+
if (typeof resource === "string") ; else if (typeof resource === "number") ; else if (isObject(resource)) {
|
|
1385
1061
|
if (resource.id !== void 0) {
|
|
1386
|
-
|
|
1062
|
+
resource.id;
|
|
1387
1063
|
} else {
|
|
1388
1064
|
if (resource.keyname) {
|
|
1389
|
-
|
|
1065
|
+
resource.keyname;
|
|
1390
1066
|
}
|
|
1391
1067
|
if (resource.display_name) {
|
|
1392
|
-
|
|
1068
|
+
resource.display_name;
|
|
1393
1069
|
}
|
|
1394
1070
|
}
|
|
1395
1071
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
return this._fetchResourceBy(resource, opt);
|
|
1403
|
-
}
|
|
1404
|
-
return CancelablePromise.resolve(void 0);
|
|
1405
|
-
};
|
|
1406
|
-
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1407
|
-
return cache.addFull("resource", makeRequest, forCache);
|
|
1072
|
+
if (typeof resource === "string") {
|
|
1073
|
+
return this._fetchResourceBy({ keyname: resource }, opt);
|
|
1074
|
+
} else if (typeof resource === "number") {
|
|
1075
|
+
return this._fetchResourceById(resource, opt);
|
|
1076
|
+
} else if (isObject(resource)) {
|
|
1077
|
+
return this._fetchResourceBy(resource, opt);
|
|
1408
1078
|
}
|
|
1409
|
-
return
|
|
1079
|
+
return Promise.resolve(void 0);
|
|
1410
1080
|
}
|
|
1411
1081
|
getOneOrFail(resource, requestOptions) {
|
|
1412
1082
|
return this.getOne(resource, requestOptions).then((res) => {
|
|
@@ -1428,7 +1098,7 @@ class ResourcesControl {
|
|
|
1428
1098
|
*/
|
|
1429
1099
|
getId(resource, requestOptions) {
|
|
1430
1100
|
if (typeof resource === "number") {
|
|
1431
|
-
return
|
|
1101
|
+
return Promise.resolve(resource);
|
|
1432
1102
|
} else if (typeof resource === "string" || isObject(resource)) {
|
|
1433
1103
|
return this.getOne(resource, requestOptions).then((res) => {
|
|
1434
1104
|
if (res) {
|
|
@@ -1436,7 +1106,7 @@ class ResourcesControl {
|
|
|
1436
1106
|
}
|
|
1437
1107
|
});
|
|
1438
1108
|
}
|
|
1439
|
-
return
|
|
1109
|
+
return Promise.resolve(void 0);
|
|
1440
1110
|
}
|
|
1441
1111
|
/**
|
|
1442
1112
|
* A fast way to retrieve resource ID for any resource definition.
|
|
@@ -1463,12 +1133,12 @@ class ResourcesControl {
|
|
|
1463
1133
|
} else {
|
|
1464
1134
|
Object.assign(query, resourceToQuery(resource));
|
|
1465
1135
|
}
|
|
1466
|
-
return this.connector.get("resource.search", requestOptions, __spreadValues$
|
|
1136
|
+
return this.connector.get("resource.search", requestOptions, __spreadValues$v({
|
|
1467
1137
|
serialization: "full"
|
|
1468
1138
|
}, query)).then((resources) => {
|
|
1469
|
-
if (resources) {
|
|
1139
|
+
if ((requestOptions == null ? void 0 : requestOptions.cache) && resources) {
|
|
1470
1140
|
for (const x of resources) {
|
|
1471
|
-
this.cache.add("resource.item",
|
|
1141
|
+
this.cache.add("resource.item", Promise.resolve(x), {
|
|
1472
1142
|
id: x.resource.id
|
|
1473
1143
|
});
|
|
1474
1144
|
}
|
|
@@ -1484,7 +1154,7 @@ class ResourcesControl {
|
|
|
1484
1154
|
if (child) {
|
|
1485
1155
|
return this.getOne(child.resource.parent.id, requestOptions);
|
|
1486
1156
|
}
|
|
1487
|
-
return
|
|
1157
|
+
return Promise.resolve(void 0);
|
|
1488
1158
|
});
|
|
1489
1159
|
}
|
|
1490
1160
|
getChildrenOf(resource, requestOptions) {
|
|
@@ -1514,18 +1184,16 @@ class ResourcesControl {
|
|
|
1514
1184
|
});
|
|
1515
1185
|
}
|
|
1516
1186
|
_getChildrenOf(parent, requestOptions, _items = []) {
|
|
1517
|
-
return this.connector.get(
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
{
|
|
1521
|
-
parent
|
|
1522
|
-
}
|
|
1523
|
-
).then((items) => {
|
|
1187
|
+
return this.connector.get("resource.collection", requestOptions, {
|
|
1188
|
+
parent
|
|
1189
|
+
}).then((items) => {
|
|
1524
1190
|
const recursivePromises = [];
|
|
1525
1191
|
for (const item of items) {
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1192
|
+
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1193
|
+
this.cache.add("resource.item", Promise.resolve(item), {
|
|
1194
|
+
id: item.resource.id
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1529
1197
|
_items.push(item);
|
|
1530
1198
|
if ((requestOptions == null ? void 0 : requestOptions.recursive) && item.resource.children) {
|
|
1531
1199
|
recursivePromises.push(
|
|
@@ -1534,7 +1202,7 @@ class ResourcesControl {
|
|
|
1534
1202
|
}
|
|
1535
1203
|
}
|
|
1536
1204
|
if (recursivePromises.length) {
|
|
1537
|
-
return
|
|
1205
|
+
return Promise.all(recursivePromises).then(() => {
|
|
1538
1206
|
return _items;
|
|
1539
1207
|
});
|
|
1540
1208
|
}
|
|
@@ -1542,11 +1210,12 @@ class ResourcesControl {
|
|
|
1542
1210
|
});
|
|
1543
1211
|
}
|
|
1544
1212
|
_cleanResourceItemCache(id) {
|
|
1545
|
-
return __async$
|
|
1213
|
+
return __async$s(this, null, function* () {
|
|
1214
|
+
var _a;
|
|
1546
1215
|
const all = this.cache.all();
|
|
1547
1216
|
const toDelete = [];
|
|
1548
1217
|
for (const c of all) {
|
|
1549
|
-
const cid = c.
|
|
1218
|
+
const cid = (_a = c.props) == null ? void 0 : _a.id;
|
|
1550
1219
|
if (["resource.item", "resource"].includes(c.key) && cid !== void 0) {
|
|
1551
1220
|
if (typeof cid === "number") {
|
|
1552
1221
|
if (cid === id) {
|
|
@@ -1566,18 +1235,7 @@ class ResourcesControl {
|
|
|
1566
1235
|
});
|
|
1567
1236
|
}
|
|
1568
1237
|
_fetchResourceById(id, requestOptions) {
|
|
1569
|
-
|
|
1570
|
-
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1571
|
-
return this.cache.add("resource.item", promise, {
|
|
1572
|
-
id
|
|
1573
|
-
}).catch((er) => {
|
|
1574
|
-
if (!(er instanceof ResourceNotFoundError)) {
|
|
1575
|
-
throw er;
|
|
1576
|
-
}
|
|
1577
|
-
return void 0;
|
|
1578
|
-
});
|
|
1579
|
-
}
|
|
1580
|
-
return promise();
|
|
1238
|
+
return this.connector.get("resource.item", requestOptions, { id });
|
|
1581
1239
|
}
|
|
1582
1240
|
_fetchResourceBy(resource, requestOptions) {
|
|
1583
1241
|
return this.getMany(resource, requestOptions).then((resources) => {
|
|
@@ -1585,7 +1243,7 @@ class ResourcesControl {
|
|
|
1585
1243
|
});
|
|
1586
1244
|
}
|
|
1587
1245
|
_resourceCacheFilter(resource) {
|
|
1588
|
-
return
|
|
1246
|
+
return Promise.all(this.cache.matchAll("resource.item")).then(
|
|
1589
1247
|
(resources) => {
|
|
1590
1248
|
const items = [];
|
|
1591
1249
|
resources.filter((x) => {
|
|
@@ -1629,9 +1287,16 @@ function removeConnector(connector) {
|
|
|
1629
1287
|
}
|
|
1630
1288
|
}
|
|
1631
1289
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1290
|
+
class AbortError extends Error {
|
|
1291
|
+
constructor(message = "AbortError") {
|
|
1292
|
+
super(message);
|
|
1293
|
+
this.name = "AbortError";
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
var __defProp$G = Object.defineProperty;
|
|
1298
|
+
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1299
|
+
var __publicField$r = (obj, key, value) => __defNormalProp$G(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1635
1300
|
class InsufficientPermissionsError extends NgwError {
|
|
1636
1301
|
constructor(obj) {
|
|
1637
1302
|
super(obj);
|
|
@@ -1654,64 +1319,96 @@ function template(str, data) {
|
|
|
1654
1319
|
});
|
|
1655
1320
|
}
|
|
1656
1321
|
|
|
1322
|
+
var __defProp$F = Object.defineProperty;
|
|
1323
|
+
var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
|
|
1324
|
+
var __hasOwnProp$v = Object.prototype.hasOwnProperty;
|
|
1325
|
+
var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
|
|
1326
|
+
var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1327
|
+
var __spreadValues$u = (a, b) => {
|
|
1328
|
+
for (var prop in b || (b = {}))
|
|
1329
|
+
if (__hasOwnProp$v.call(b, prop))
|
|
1330
|
+
__defNormalProp$F(a, prop, b[prop]);
|
|
1331
|
+
if (__getOwnPropSymbols$v)
|
|
1332
|
+
for (var prop of __getOwnPropSymbols$v(b)) {
|
|
1333
|
+
if (__propIsEnum$v.call(b, prop))
|
|
1334
|
+
__defNormalProp$F(a, prop, b[prop]);
|
|
1335
|
+
}
|
|
1336
|
+
return a;
|
|
1337
|
+
};
|
|
1338
|
+
var __async$r = (__this, __arguments, generator) => {
|
|
1339
|
+
return new Promise((resolve, reject) => {
|
|
1340
|
+
var fulfilled = (value) => {
|
|
1341
|
+
try {
|
|
1342
|
+
step(generator.next(value));
|
|
1343
|
+
} catch (e) {
|
|
1344
|
+
reject(e);
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
var rejected = (value) => {
|
|
1348
|
+
try {
|
|
1349
|
+
step(generator.throw(value));
|
|
1350
|
+
} catch (e) {
|
|
1351
|
+
reject(e);
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1355
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1356
|
+
});
|
|
1357
|
+
};
|
|
1657
1358
|
function apiRequest(opt) {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
"`" + arg + "` url api argument is not specified"
|
|
1673
|
-
);
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
if (url) {
|
|
1677
|
-
url = template(url, replaceParams);
|
|
1359
|
+
return __async$r(this, null, function* () {
|
|
1360
|
+
const { params, name, connector, requestOptions } = opt;
|
|
1361
|
+
const apiItems = yield connector.connect();
|
|
1362
|
+
let apiItem = apiItems && apiItems[name];
|
|
1363
|
+
if (apiItem) {
|
|
1364
|
+
apiItem = [...apiItem];
|
|
1365
|
+
let url = apiItem.shift();
|
|
1366
|
+
if (apiItem.length) {
|
|
1367
|
+
const replaceParams = {};
|
|
1368
|
+
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
1369
|
+
const arg = apiItem[fry];
|
|
1370
|
+
replaceParams[fry] = `{${arg}}`;
|
|
1371
|
+
if (params[arg] === void 0) {
|
|
1372
|
+
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
1678
1373
|
}
|
|
1679
1374
|
}
|
|
1680
|
-
if (
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
url = url + "?" + paramArray.join("&");
|
|
1375
|
+
if (url) {
|
|
1376
|
+
url = template(url, replaceParams);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
if (params) {
|
|
1380
|
+
const paramArray = [];
|
|
1381
|
+
const paramList = params.paramList;
|
|
1382
|
+
if (Array.isArray(paramList)) {
|
|
1383
|
+
paramList.forEach(([key, value]) => {
|
|
1384
|
+
paramArray.push(`${key}=${value}`);
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
for (const p in params) {
|
|
1388
|
+
if (apiItem.indexOf(p) === -1) {
|
|
1389
|
+
paramArray.push(`${p}=${params[p]}`);
|
|
1696
1390
|
}
|
|
1697
1391
|
}
|
|
1698
|
-
if (
|
|
1699
|
-
|
|
1700
|
-
} else {
|
|
1701
|
-
reject(new Error("request url is not set"));
|
|
1392
|
+
if (paramArray.length) {
|
|
1393
|
+
url = `${url}?${paramArray.join("&")}`;
|
|
1702
1394
|
}
|
|
1395
|
+
}
|
|
1396
|
+
if (url) {
|
|
1397
|
+
return connector.makeQuery(url, params, __spreadValues$u({
|
|
1398
|
+
cacheName: name
|
|
1399
|
+
}, requestOptions));
|
|
1703
1400
|
} else {
|
|
1704
|
-
|
|
1401
|
+
throw new Error("Request URL is not set");
|
|
1705
1402
|
}
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
}
|
|
1403
|
+
} else {
|
|
1404
|
+
return void 0;
|
|
1405
|
+
}
|
|
1709
1406
|
});
|
|
1710
1407
|
}
|
|
1711
1408
|
|
|
1712
1409
|
var __defProp$E = Object.defineProperty;
|
|
1713
1410
|
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1714
|
-
var __publicField$q = (obj, key, value) => __defNormalProp$E(obj,
|
|
1411
|
+
var __publicField$q = (obj, key, value) => __defNormalProp$E(obj, key + "" , value);
|
|
1715
1412
|
class NetworkError extends Error {
|
|
1716
1413
|
constructor(url) {
|
|
1717
1414
|
super();
|
|
@@ -1805,23 +1502,59 @@ let loadData;
|
|
|
1805
1502
|
}
|
|
1806
1503
|
|
|
1807
1504
|
var __defProp$D = Object.defineProperty;
|
|
1808
|
-
var
|
|
1809
|
-
var
|
|
1810
|
-
var
|
|
1505
|
+
var __defProps$d = Object.defineProperties;
|
|
1506
|
+
var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
|
|
1507
|
+
var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
|
|
1508
|
+
var __hasOwnProp$u = Object.prototype.hasOwnProperty;
|
|
1509
|
+
var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
|
|
1811
1510
|
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1812
|
-
var __spreadValues$
|
|
1511
|
+
var __spreadValues$t = (a, b) => {
|
|
1813
1512
|
for (var prop in b || (b = {}))
|
|
1814
|
-
if (__hasOwnProp$
|
|
1513
|
+
if (__hasOwnProp$u.call(b, prop))
|
|
1815
1514
|
__defNormalProp$D(a, prop, b[prop]);
|
|
1816
|
-
if (__getOwnPropSymbols$
|
|
1817
|
-
for (var prop of __getOwnPropSymbols$
|
|
1818
|
-
if (__propIsEnum$
|
|
1515
|
+
if (__getOwnPropSymbols$u)
|
|
1516
|
+
for (var prop of __getOwnPropSymbols$u(b)) {
|
|
1517
|
+
if (__propIsEnum$u.call(b, prop))
|
|
1819
1518
|
__defNormalProp$D(a, prop, b[prop]);
|
|
1820
1519
|
}
|
|
1821
1520
|
return a;
|
|
1822
1521
|
};
|
|
1522
|
+
var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
|
|
1523
|
+
var __objRest$2 = (source, exclude) => {
|
|
1524
|
+
var target = {};
|
|
1525
|
+
for (var prop in source)
|
|
1526
|
+
if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1527
|
+
target[prop] = source[prop];
|
|
1528
|
+
if (source != null && __getOwnPropSymbols$u)
|
|
1529
|
+
for (var prop of __getOwnPropSymbols$u(source)) {
|
|
1530
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
|
|
1531
|
+
target[prop] = source[prop];
|
|
1532
|
+
}
|
|
1533
|
+
return target;
|
|
1534
|
+
};
|
|
1823
1535
|
var __publicField$p = (obj, key, value) => __defNormalProp$D(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1536
|
+
var __async$q = (__this, __arguments, generator) => {
|
|
1537
|
+
return new Promise((resolve, reject) => {
|
|
1538
|
+
var fulfilled = (value) => {
|
|
1539
|
+
try {
|
|
1540
|
+
step(generator.next(value));
|
|
1541
|
+
} catch (e) {
|
|
1542
|
+
reject(e);
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
var rejected = (value) => {
|
|
1546
|
+
try {
|
|
1547
|
+
step(generator.throw(value));
|
|
1548
|
+
} catch (e) {
|
|
1549
|
+
reject(e);
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1553
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1554
|
+
});
|
|
1555
|
+
};
|
|
1824
1556
|
let ID$2 = 0;
|
|
1557
|
+
let REQUEST_ID = 0;
|
|
1825
1558
|
class NgwConnector {
|
|
1826
1559
|
constructor(options) {
|
|
1827
1560
|
this.options = options;
|
|
@@ -1831,7 +1564,7 @@ class NgwConnector {
|
|
|
1831
1564
|
__publicField$p(this, "resources");
|
|
1832
1565
|
__publicField$p(this, "cache");
|
|
1833
1566
|
__publicField$p(this, "routeStr", "/api/component/pyramid/route");
|
|
1834
|
-
__publicField$p(this, "activeRequests",
|
|
1567
|
+
__publicField$p(this, "activeRequests", {});
|
|
1835
1568
|
__publicField$p(this, "requestTransform");
|
|
1836
1569
|
const exist = findConnector(options);
|
|
1837
1570
|
this.cache = new Cache({ namespace: options.cacheId });
|
|
@@ -1888,29 +1621,27 @@ class NgwConnector {
|
|
|
1888
1621
|
* ```
|
|
1889
1622
|
*/
|
|
1890
1623
|
connect() {
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
const makeQuery = () => {
|
|
1894
|
-
return this.makeQuery(this.routeStr, {}, {}).then((route) => {
|
|
1895
|
-
resolve(route);
|
|
1896
|
-
}).catch((er) => {
|
|
1897
|
-
reject(er);
|
|
1898
|
-
});
|
|
1899
|
-
};
|
|
1624
|
+
return __async$q(this, null, function* () {
|
|
1625
|
+
const auth = this.options.auth;
|
|
1900
1626
|
if (auth) {
|
|
1901
1627
|
const { login, password } = auth;
|
|
1902
1628
|
if (login && password) {
|
|
1903
|
-
|
|
1904
|
-
return makeQuery();
|
|
1905
|
-
}).catch((er) => reject(er));
|
|
1629
|
+
yield this._login({ login, password });
|
|
1906
1630
|
}
|
|
1907
1631
|
}
|
|
1908
|
-
return makeQuery(
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1632
|
+
return yield this.makeQuery(
|
|
1633
|
+
this.routeStr,
|
|
1634
|
+
{},
|
|
1635
|
+
{
|
|
1636
|
+
cacheName: "route",
|
|
1637
|
+
cache: true,
|
|
1638
|
+
cacheProps: {
|
|
1639
|
+
id: this.id,
|
|
1640
|
+
auth,
|
|
1641
|
+
baseUrl: this.options.baseUrl
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
);
|
|
1914
1645
|
});
|
|
1915
1646
|
}
|
|
1916
1647
|
/**
|
|
@@ -1934,20 +1665,22 @@ class NgwConnector {
|
|
|
1934
1665
|
this.emitter.emit("logout");
|
|
1935
1666
|
}
|
|
1936
1667
|
getUserInfo(credentials, options) {
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1668
|
+
return __async$q(this, null, function* () {
|
|
1669
|
+
if (this.user && this.user.id) {
|
|
1670
|
+
return this.user;
|
|
1671
|
+
}
|
|
1672
|
+
if (credentials) {
|
|
1673
|
+
this.options.auth = credentials;
|
|
1674
|
+
}
|
|
1675
|
+
const options_ = __spreadValues$t({
|
|
1676
|
+
headers: this.getAuthorizationHeaders(credentials)
|
|
1677
|
+
}, options);
|
|
1678
|
+
return this.makeQuery(
|
|
1679
|
+
"/api/component/auth/current_user",
|
|
1680
|
+
{},
|
|
1681
|
+
options_
|
|
1682
|
+
);
|
|
1683
|
+
});
|
|
1951
1684
|
}
|
|
1952
1685
|
/**
|
|
1953
1686
|
* Obtaining the required Headers for authentication of requests in the NGW.
|
|
@@ -1956,7 +1689,7 @@ class NgwConnector {
|
|
|
1956
1689
|
const client = this.makeClientId(credentials);
|
|
1957
1690
|
if (client) {
|
|
1958
1691
|
return {
|
|
1959
|
-
Authorization:
|
|
1692
|
+
Authorization: `Basic ${client}`
|
|
1960
1693
|
};
|
|
1961
1694
|
}
|
|
1962
1695
|
}
|
|
@@ -1964,21 +1697,22 @@ class NgwConnector {
|
|
|
1964
1697
|
credentials = credentials || this.options.auth;
|
|
1965
1698
|
if (credentials) {
|
|
1966
1699
|
const { login, password } = credentials;
|
|
1967
|
-
const str =
|
|
1700
|
+
const str = `${login}:${password}`;
|
|
1701
|
+
const encodedStr = encodeURIComponent(str);
|
|
1968
1702
|
{
|
|
1969
|
-
return window.btoa(
|
|
1703
|
+
return window.btoa(encodedStr);
|
|
1970
1704
|
}
|
|
1971
1705
|
}
|
|
1972
1706
|
}
|
|
1973
1707
|
/** Stop all api requests */
|
|
1974
1708
|
abort() {
|
|
1975
|
-
for (const
|
|
1976
|
-
|
|
1709
|
+
for (const abortController of Object.values(this.activeRequests)) {
|
|
1710
|
+
abortController.abort();
|
|
1977
1711
|
}
|
|
1978
|
-
this.activeRequests =
|
|
1712
|
+
this.activeRequests = {};
|
|
1979
1713
|
}
|
|
1980
1714
|
getActiveApiRequests() {
|
|
1981
|
-
return
|
|
1715
|
+
return __spreadValues$t({}, this.activeRequests);
|
|
1982
1716
|
}
|
|
1983
1717
|
/**
|
|
1984
1718
|
* Send request to NGW api router.
|
|
@@ -2010,23 +1744,10 @@ class NgwConnector {
|
|
|
2010
1744
|
* ```
|
|
2011
1745
|
*/
|
|
2012
1746
|
apiRequest(name, params_ = {}, requestOptions = {}) {
|
|
2013
|
-
var _a
|
|
2014
|
-
const { method, headers, withCredentials, responseType } = requestOptions;
|
|
1747
|
+
var _a;
|
|
2015
1748
|
params_ = (_a = requestOptions.params) != null ? _a : params_;
|
|
2016
1749
|
const params = objectRemoveEmpty(params_);
|
|
2017
|
-
|
|
2018
|
-
if (requestOptions.cache && method === "GET") {
|
|
2019
|
-
return this.cache.add(name, makeApiRequest, __spreadValues$s({
|
|
2020
|
-
params
|
|
2021
|
-
}, objectRemoveEmpty({
|
|
2022
|
-
headers,
|
|
2023
|
-
withCredentials,
|
|
2024
|
-
responseType,
|
|
2025
|
-
baseUrl: this.options.baseUrl,
|
|
2026
|
-
userId: (_b = this.user) == null ? void 0 : _b.id
|
|
2027
|
-
})));
|
|
2028
|
-
}
|
|
2029
|
-
return makeApiRequest();
|
|
1750
|
+
return apiRequest({ name, params, requestOptions, connector: this });
|
|
2030
1751
|
}
|
|
2031
1752
|
/**
|
|
2032
1753
|
* Shortcut method for send POST request to NGW.
|
|
@@ -2116,17 +1837,67 @@ class NgwConnector {
|
|
|
2116
1837
|
* @param params - Query params
|
|
2117
1838
|
* @param options - Request options
|
|
2118
1839
|
*/
|
|
2119
|
-
makeQuery(
|
|
2120
|
-
|
|
2121
|
-
|
|
1840
|
+
makeQuery(_0, _1) {
|
|
1841
|
+
return __async$q(this, arguments, function* (url, params, options = {}) {
|
|
1842
|
+
var _b;
|
|
1843
|
+
url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
|
|
1844
|
+
if (!url) {
|
|
1845
|
+
throw new Error("Empty `url` not allowed");
|
|
1846
|
+
}
|
|
2122
1847
|
if (params) {
|
|
2123
|
-
|
|
1848
|
+
const _a = params, restParams = __objRest$2(_a, ["paramList"]);
|
|
1849
|
+
url = template(url, restParams);
|
|
1850
|
+
}
|
|
1851
|
+
url = encodeURI(fixUrlStr(url));
|
|
1852
|
+
const {
|
|
1853
|
+
cache,
|
|
1854
|
+
signal: externalSignal,
|
|
1855
|
+
method = "GET",
|
|
1856
|
+
headers,
|
|
1857
|
+
cacheName,
|
|
1858
|
+
cacheProps,
|
|
1859
|
+
responseType,
|
|
1860
|
+
withCredentials
|
|
1861
|
+
} = options;
|
|
1862
|
+
const internalAbortController = new AbortController();
|
|
1863
|
+
const internalSignal = internalAbortController.signal;
|
|
1864
|
+
if (externalSignal) {
|
|
1865
|
+
if (externalSignal.aborted) {
|
|
1866
|
+
throw new AbortError();
|
|
1867
|
+
}
|
|
1868
|
+
externalSignal.addEventListener("abort", () => {
|
|
1869
|
+
internalAbortController.abort();
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
options.signal = internalSignal;
|
|
1873
|
+
const createPromise = () => __async$q(this, null, function* () {
|
|
1874
|
+
const id = REQUEST_ID++;
|
|
1875
|
+
this.activeRequests[id] = internalAbortController;
|
|
1876
|
+
try {
|
|
1877
|
+
return this._loadData(url, options);
|
|
1878
|
+
} finally {
|
|
1879
|
+
this._cleanActiveRequest(id);
|
|
1880
|
+
}
|
|
1881
|
+
});
|
|
1882
|
+
if (cache && method === "GET") {
|
|
1883
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadProps$d(__spreadValues$t({}, objectRemoveEmpty({
|
|
1884
|
+
headers,
|
|
1885
|
+
withCredentials,
|
|
1886
|
+
responseType,
|
|
1887
|
+
baseUrl: this.options.baseUrl,
|
|
1888
|
+
userId: (_b = this.user) == null ? void 0 : _b.id
|
|
1889
|
+
})), {
|
|
1890
|
+
params
|
|
1891
|
+
});
|
|
1892
|
+
return this.cache.add(
|
|
1893
|
+
cacheName || url,
|
|
1894
|
+
createPromise,
|
|
1895
|
+
cacheOptions,
|
|
1896
|
+
false
|
|
1897
|
+
);
|
|
2124
1898
|
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
} else {
|
|
2128
|
-
throw new Error("Empty `url` not allowed");
|
|
2129
|
-
}
|
|
1899
|
+
return createPromise();
|
|
1900
|
+
});
|
|
2130
1901
|
}
|
|
2131
1902
|
// -------------------------------------------------------------------------
|
|
2132
1903
|
// Resource Methods
|
|
@@ -2208,26 +1979,29 @@ class NgwConnector {
|
|
|
2208
1979
|
*/
|
|
2209
1980
|
_loadData(url, options) {
|
|
2210
1981
|
options.responseType = options.responseType || "json";
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
}
|
|
2214
|
-
const request = new CancelablePromise((resolve, reject, onCancel) => {
|
|
1982
|
+
return new Promise((resolve, reject) => {
|
|
1983
|
+
var _a;
|
|
2215
1984
|
if (this.user) {
|
|
2216
1985
|
options = options || {};
|
|
2217
|
-
options.headers = __spreadValues$
|
|
1986
|
+
options.headers = __spreadValues$t(__spreadValues$t({}, this.getAuthorizationHeaders()), options.headers);
|
|
2218
1987
|
}
|
|
2219
1988
|
if (this.requestTransform) {
|
|
2220
1989
|
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
2221
1990
|
url = transUrl;
|
|
2222
1991
|
options = transOptions;
|
|
2223
1992
|
}
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
1993
|
+
let runOnAbort = void 0;
|
|
1994
|
+
loadData(url, resolve, options, reject, (handler) => {
|
|
1995
|
+
runOnAbort = handler;
|
|
1996
|
+
});
|
|
1997
|
+
(_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
|
|
1998
|
+
if (runOnAbort !== void 0) {
|
|
1999
|
+
runOnAbort();
|
|
2000
|
+
}
|
|
2001
|
+
reject(new AbortError());
|
|
2002
|
+
});
|
|
2228
2003
|
}).catch((httpError) => {
|
|
2229
|
-
|
|
2230
|
-
if (httpError instanceof CancelablePromise.CancelError) ; else {
|
|
2004
|
+
if (httpError.name !== "AbortError") {
|
|
2231
2005
|
{
|
|
2232
2006
|
console.warn("DEV WARN", httpError);
|
|
2233
2007
|
}
|
|
@@ -2236,31 +2010,24 @@ class NgwConnector {
|
|
|
2236
2010
|
throw er;
|
|
2237
2011
|
}
|
|
2238
2012
|
}
|
|
2013
|
+
throw httpError;
|
|
2239
2014
|
});
|
|
2240
|
-
if (options.signal && typeof options.signal.addEventListener === "function") {
|
|
2241
|
-
options.signal.addEventListener("abort", () => {
|
|
2242
|
-
request.cancel();
|
|
2243
|
-
this._cleanActiveRequests(request);
|
|
2244
|
-
});
|
|
2245
|
-
}
|
|
2246
|
-
this.activeRequests.push(request);
|
|
2247
|
-
return request;
|
|
2248
2015
|
}
|
|
2249
2016
|
_login(credentials, options) {
|
|
2250
|
-
return this
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2017
|
+
return __async$q(this, null, function* () {
|
|
2018
|
+
try {
|
|
2019
|
+
const data = yield this.getUserInfo(credentials, options);
|
|
2020
|
+
this.user = data;
|
|
2021
|
+
this.emitter.emit("login", data);
|
|
2022
|
+
return data;
|
|
2023
|
+
} catch (er) {
|
|
2024
|
+
this.emitter.emit("login:error", er);
|
|
2025
|
+
throw er;
|
|
2026
|
+
}
|
|
2257
2027
|
});
|
|
2258
2028
|
}
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
if (activeRequestIndex !== -1) {
|
|
2262
|
-
this.activeRequests.splice(activeRequestIndex, 1);
|
|
2263
|
-
}
|
|
2029
|
+
_cleanActiveRequest(requestId) {
|
|
2030
|
+
delete this.activeRequests[requestId];
|
|
2264
2031
|
}
|
|
2265
2032
|
_handleHttpError(er) {
|
|
2266
2033
|
if (er) {
|
|
@@ -2281,17 +2048,17 @@ __publicField$p(NgwConnector, "errors", {
|
|
|
2281
2048
|
});
|
|
2282
2049
|
|
|
2283
2050
|
var __defProp$C = Object.defineProperty;
|
|
2284
|
-
var __getOwnPropSymbols$
|
|
2285
|
-
var __hasOwnProp$
|
|
2286
|
-
var __propIsEnum$
|
|
2051
|
+
var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
|
|
2052
|
+
var __hasOwnProp$t = Object.prototype.hasOwnProperty;
|
|
2053
|
+
var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
|
|
2287
2054
|
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2288
|
-
var __spreadValues$
|
|
2055
|
+
var __spreadValues$s = (a, b) => {
|
|
2289
2056
|
for (var prop in b || (b = {}))
|
|
2290
|
-
if (__hasOwnProp$
|
|
2057
|
+
if (__hasOwnProp$t.call(b, prop))
|
|
2291
2058
|
__defNormalProp$C(a, prop, b[prop]);
|
|
2292
|
-
if (__getOwnPropSymbols$
|
|
2293
|
-
for (var prop of __getOwnPropSymbols$
|
|
2294
|
-
if (__propIsEnum$
|
|
2059
|
+
if (__getOwnPropSymbols$t)
|
|
2060
|
+
for (var prop of __getOwnPropSymbols$t(b)) {
|
|
2061
|
+
if (__propIsEnum$t.call(b, prop))
|
|
2295
2062
|
__defNormalProp$C(a, prop, b[prop]);
|
|
2296
2063
|
}
|
|
2297
2064
|
return a;
|
|
@@ -2339,7 +2106,7 @@ function isPropertyFilter(filter) {
|
|
|
2339
2106
|
return false;
|
|
2340
2107
|
}
|
|
2341
2108
|
function featureFilter(feature, filters) {
|
|
2342
|
-
const properties = __spreadValues$
|
|
2109
|
+
const properties = __spreadValues$s({}, feature.properties);
|
|
2343
2110
|
if (properties) {
|
|
2344
2111
|
properties.$id = feature.id;
|
|
2345
2112
|
return propertiesFilter(properties, filters);
|
|
@@ -2377,22 +2144,42 @@ function propertiesFilter(properties, filters) {
|
|
|
2377
2144
|
var __defProp$B = Object.defineProperty;
|
|
2378
2145
|
var __defProps$c = Object.defineProperties;
|
|
2379
2146
|
var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
|
|
2380
|
-
var __getOwnPropSymbols$
|
|
2381
|
-
var __hasOwnProp$
|
|
2382
|
-
var __propIsEnum$
|
|
2147
|
+
var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
|
|
2148
|
+
var __hasOwnProp$s = Object.prototype.hasOwnProperty;
|
|
2149
|
+
var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
|
|
2383
2150
|
var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2384
|
-
var __spreadValues$
|
|
2151
|
+
var __spreadValues$r = (a, b) => {
|
|
2385
2152
|
for (var prop in b || (b = {}))
|
|
2386
|
-
if (__hasOwnProp$
|
|
2153
|
+
if (__hasOwnProp$s.call(b, prop))
|
|
2387
2154
|
__defNormalProp$B(a, prop, b[prop]);
|
|
2388
|
-
if (__getOwnPropSymbols$
|
|
2389
|
-
for (var prop of __getOwnPropSymbols$
|
|
2390
|
-
if (__propIsEnum$
|
|
2155
|
+
if (__getOwnPropSymbols$s)
|
|
2156
|
+
for (var prop of __getOwnPropSymbols$s(b)) {
|
|
2157
|
+
if (__propIsEnum$s.call(b, prop))
|
|
2391
2158
|
__defNormalProp$B(a, prop, b[prop]);
|
|
2392
2159
|
}
|
|
2393
2160
|
return a;
|
|
2394
2161
|
};
|
|
2395
2162
|
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
2163
|
+
var __async$p = (__this, __arguments, generator) => {
|
|
2164
|
+
return new Promise((resolve, reject) => {
|
|
2165
|
+
var fulfilled = (value) => {
|
|
2166
|
+
try {
|
|
2167
|
+
step(generator.next(value));
|
|
2168
|
+
} catch (e) {
|
|
2169
|
+
reject(e);
|
|
2170
|
+
}
|
|
2171
|
+
};
|
|
2172
|
+
var rejected = (value) => {
|
|
2173
|
+
try {
|
|
2174
|
+
step(generator.throw(value));
|
|
2175
|
+
} catch (e) {
|
|
2176
|
+
reject(e);
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2180
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
2181
|
+
});
|
|
2182
|
+
};
|
|
2396
2183
|
const FEATURE_REQUEST_PARAMS = {
|
|
2397
2184
|
srs: 4326,
|
|
2398
2185
|
geom_format: "geojson"
|
|
@@ -2433,10 +2220,9 @@ function updateItemRequestParam(params, options) {
|
|
|
2433
2220
|
}
|
|
2434
2221
|
}
|
|
2435
2222
|
function createFeatureFieldFilterQueries(opt) {
|
|
2436
|
-
|
|
2437
|
-
opt
|
|
2438
|
-
|
|
2439
|
-
return CancelablePromise.all(queries).then((itemsParts) => {
|
|
2223
|
+
return __async$p(this, null, function* () {
|
|
2224
|
+
const queries = getQueries(opt);
|
|
2225
|
+
const itemsParts = yield Promise.all(queries);
|
|
2440
2226
|
const ids = [];
|
|
2441
2227
|
const items = [];
|
|
2442
2228
|
for (const part of itemsParts) {
|
|
@@ -2478,13 +2264,13 @@ function getQueries(opt, _queries = [], _parentAllParams = []) {
|
|
|
2478
2264
|
for (const f of filters_) {
|
|
2479
2265
|
if (isPropertyFilter(f)) {
|
|
2480
2266
|
_queries.push(
|
|
2481
|
-
fetchNgwLayerItemsRequest(__spreadProps$c(__spreadValues$
|
|
2267
|
+
fetchNgwLayerItemsRequest(__spreadProps$c(__spreadValues$r({}, opt), {
|
|
2482
2268
|
paramList: [..._parentAllParams, ...paramList, createParam(f)]
|
|
2483
2269
|
}))
|
|
2484
2270
|
);
|
|
2485
2271
|
} else {
|
|
2486
2272
|
getQueries(
|
|
2487
|
-
__spreadProps$c(__spreadValues$
|
|
2273
|
+
__spreadProps$c(__spreadValues$r({}, opt), {
|
|
2488
2274
|
filters: f
|
|
2489
2275
|
}),
|
|
2490
2276
|
_queries,
|
|
@@ -2505,7 +2291,7 @@ function getQueries(opt, _queries = [], _parentAllParams = []) {
|
|
|
2505
2291
|
if (propertiesFilterList.length) {
|
|
2506
2292
|
for (const x of propertiesFilterList) {
|
|
2507
2293
|
getQueries(
|
|
2508
|
-
__spreadProps$c(__spreadValues$
|
|
2294
|
+
__spreadProps$c(__spreadValues$r({}, opt), {
|
|
2509
2295
|
filters: x
|
|
2510
2296
|
}),
|
|
2511
2297
|
_queries,
|
|
@@ -2514,7 +2300,7 @@ function getQueries(opt, _queries = [], _parentAllParams = []) {
|
|
|
2514
2300
|
}
|
|
2515
2301
|
} else {
|
|
2516
2302
|
_queries.push(
|
|
2517
|
-
fetchNgwLayerItemsRequest(__spreadProps$c(__spreadValues$
|
|
2303
|
+
fetchNgwLayerItemsRequest(__spreadProps$c(__spreadValues$r({}, opt), {
|
|
2518
2304
|
paramList: [..._parentAllParams, ...paramList, ...filters2]
|
|
2519
2305
|
}))
|
|
2520
2306
|
);
|
|
@@ -2530,7 +2316,7 @@ function createWktFromCoordArray(coord) {
|
|
|
2530
2316
|
return `POLYGON((${polygon.join(", ")}))`;
|
|
2531
2317
|
}
|
|
2532
2318
|
function fetchNgwLayerItemsRequest(options) {
|
|
2533
|
-
const params = __spreadValues$
|
|
2319
|
+
const params = __spreadValues$r({}, FEATURE_REQUEST_PARAMS);
|
|
2534
2320
|
const {
|
|
2535
2321
|
limit,
|
|
2536
2322
|
cache,
|
|
@@ -2569,7 +2355,7 @@ function fetchNgwLayerItemsRequest(options) {
|
|
|
2569
2355
|
if (paramList) {
|
|
2570
2356
|
params.paramList = paramList;
|
|
2571
2357
|
}
|
|
2572
|
-
const reqParams = __spreadValues$
|
|
2358
|
+
const reqParams = __spreadValues$r({
|
|
2573
2359
|
id: resourceId
|
|
2574
2360
|
}, params);
|
|
2575
2361
|
return connector.get(
|
|
@@ -2582,52 +2368,90 @@ function fetchNgwLayerItemsRequest(options) {
|
|
|
2582
2368
|
var __defProp$A = Object.defineProperty;
|
|
2583
2369
|
var __defProps$b = Object.defineProperties;
|
|
2584
2370
|
var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
|
|
2585
|
-
var __getOwnPropSymbols$
|
|
2586
|
-
var __hasOwnProp$
|
|
2587
|
-
var __propIsEnum$
|
|
2371
|
+
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
2372
|
+
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
2373
|
+
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
2588
2374
|
var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2589
|
-
var __spreadValues$
|
|
2375
|
+
var __spreadValues$q = (a, b) => {
|
|
2590
2376
|
for (var prop in b || (b = {}))
|
|
2591
|
-
if (__hasOwnProp$
|
|
2377
|
+
if (__hasOwnProp$r.call(b, prop))
|
|
2592
2378
|
__defNormalProp$A(a, prop, b[prop]);
|
|
2593
|
-
if (__getOwnPropSymbols$
|
|
2594
|
-
for (var prop of __getOwnPropSymbols$
|
|
2595
|
-
if (__propIsEnum$
|
|
2379
|
+
if (__getOwnPropSymbols$r)
|
|
2380
|
+
for (var prop of __getOwnPropSymbols$r(b)) {
|
|
2381
|
+
if (__propIsEnum$r.call(b, prop))
|
|
2596
2382
|
__defNormalProp$A(a, prop, b[prop]);
|
|
2597
2383
|
}
|
|
2598
2384
|
return a;
|
|
2599
2385
|
};
|
|
2600
2386
|
var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
|
|
2387
|
+
var __async$o = (__this, __arguments, generator) => {
|
|
2388
|
+
return new Promise((resolve, reject) => {
|
|
2389
|
+
var fulfilled = (value) => {
|
|
2390
|
+
try {
|
|
2391
|
+
step(generator.next(value));
|
|
2392
|
+
} catch (e) {
|
|
2393
|
+
reject(e);
|
|
2394
|
+
}
|
|
2395
|
+
};
|
|
2396
|
+
var rejected = (value) => {
|
|
2397
|
+
try {
|
|
2398
|
+
step(generator.throw(value));
|
|
2399
|
+
} catch (e) {
|
|
2400
|
+
reject(e);
|
|
2401
|
+
}
|
|
2402
|
+
};
|
|
2403
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2404
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
2405
|
+
});
|
|
2406
|
+
};
|
|
2601
2407
|
function fetchNgwLayerItem(options) {
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2408
|
+
return __async$o(this, null, function* () {
|
|
2409
|
+
const params = __spreadValues$q({}, FEATURE_REQUEST_PARAMS);
|
|
2410
|
+
updateItemRequestParam(params, options);
|
|
2411
|
+
const queryParams = __spreadValues$q({
|
|
2412
|
+
id: options.resourceId,
|
|
2413
|
+
fid: options.featureId
|
|
2414
|
+
}, params);
|
|
2415
|
+
const resp = yield options.connector.get(
|
|
2416
|
+
"feature_layer.feature.item",
|
|
2417
|
+
options,
|
|
2418
|
+
queryParams
|
|
2419
|
+
);
|
|
2420
|
+
const toGeojson = () => __async$o(this, null, function* () {
|
|
2421
|
+
if (resp.geom) {
|
|
2422
|
+
return createGeoJsonFeature(resp);
|
|
2423
|
+
} else {
|
|
2424
|
+
const onlyGeomItem = yield fetchNgwLayerItem(__spreadProps$b(__spreadValues$q({}, options), {
|
|
2425
|
+
geom: true,
|
|
2426
|
+
fields: null,
|
|
2427
|
+
extensions: null
|
|
2428
|
+
}));
|
|
2429
|
+
const geom = onlyGeomItem.geom;
|
|
2430
|
+
return createGeoJsonFeature(__spreadProps$b(__spreadValues$q({}, resp), { geom }));
|
|
2624
2431
|
}
|
|
2625
2432
|
});
|
|
2433
|
+
return __spreadProps$b(__spreadValues$q({}, resp), {
|
|
2434
|
+
toGeojson
|
|
2435
|
+
});
|
|
2626
2436
|
});
|
|
2627
2437
|
}
|
|
2628
2438
|
|
|
2629
2439
|
var __defProp$z = Object.defineProperty;
|
|
2440
|
+
var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
|
|
2441
|
+
var __hasOwnProp$q = Object.prototype.hasOwnProperty;
|
|
2442
|
+
var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
|
|
2630
2443
|
var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2444
|
+
var __spreadValues$p = (a, b) => {
|
|
2445
|
+
for (var prop in b || (b = {}))
|
|
2446
|
+
if (__hasOwnProp$q.call(b, prop))
|
|
2447
|
+
__defNormalProp$z(a, prop, b[prop]);
|
|
2448
|
+
if (__getOwnPropSymbols$q)
|
|
2449
|
+
for (var prop of __getOwnPropSymbols$q(b)) {
|
|
2450
|
+
if (__propIsEnum$q.call(b, prop))
|
|
2451
|
+
__defNormalProp$z(a, prop, b[prop]);
|
|
2452
|
+
}
|
|
2453
|
+
return a;
|
|
2454
|
+
};
|
|
2631
2455
|
var __publicField$o = (obj, key, value) => __defNormalProp$z(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2632
2456
|
class BookmarkItem {
|
|
2633
2457
|
constructor(options) {
|
|
@@ -2645,11 +2469,11 @@ class BookmarkItem {
|
|
|
2645
2469
|
this.name = String(item.id);
|
|
2646
2470
|
}
|
|
2647
2471
|
}
|
|
2648
|
-
extent() {
|
|
2472
|
+
extent(opt) {
|
|
2649
2473
|
if (this._extent) {
|
|
2650
|
-
return
|
|
2474
|
+
return Promise.resolve(this._extent);
|
|
2651
2475
|
}
|
|
2652
|
-
return this.options.connector.get("feature_layer.feature.item_extent",
|
|
2476
|
+
return this.options.connector.get("feature_layer.feature.item_extent", opt, {
|
|
2653
2477
|
id: this.resourceId,
|
|
2654
2478
|
fid: this.item.id
|
|
2655
2479
|
}).then((resp) => {
|
|
@@ -2659,18 +2483,18 @@ class BookmarkItem {
|
|
|
2659
2483
|
return lonLat;
|
|
2660
2484
|
});
|
|
2661
2485
|
}
|
|
2662
|
-
geoJson() {
|
|
2486
|
+
geoJson(opt) {
|
|
2663
2487
|
if (this.item.geom) {
|
|
2664
|
-
return
|
|
2488
|
+
return Promise.resolve(createGeoJsonFeature(this.item));
|
|
2665
2489
|
} else {
|
|
2666
|
-
return fetchNgwLayerItem({
|
|
2490
|
+
return fetchNgwLayerItem(__spreadValues$p({
|
|
2667
2491
|
resourceId: this.resourceId,
|
|
2668
2492
|
featureId: this.item.id,
|
|
2669
2493
|
connector: this.options.connector,
|
|
2670
2494
|
geom: true,
|
|
2671
2495
|
fields: null,
|
|
2672
2496
|
extensions: null
|
|
2673
|
-
}).then((onlyGeomItem) => {
|
|
2497
|
+
}, opt)).then((onlyGeomItem) => {
|
|
2674
2498
|
const geom = onlyGeomItem.geom;
|
|
2675
2499
|
this.item.geom = geom;
|
|
2676
2500
|
return createGeoJsonFeature(this.item);
|
|
@@ -2680,22 +2504,20 @@ class BookmarkItem {
|
|
|
2680
2504
|
}
|
|
2681
2505
|
|
|
2682
2506
|
function treeEvery(item, filter, relation, itemPrepare) {
|
|
2683
|
-
return !!treeWrapper(item, filter, relation, treeEvery_
|
|
2507
|
+
return !!treeWrapper(item, filter, relation, treeEvery_);
|
|
2684
2508
|
}
|
|
2685
2509
|
function treeSome(item, filter, relation, itemPrepare) {
|
|
2686
|
-
return !!treeWrapper(item, filter, relation, treeFind_
|
|
2510
|
+
return !!treeWrapper(item, filter, relation, treeFind_);
|
|
2687
2511
|
}
|
|
2688
2512
|
function treeFind(item, filter, relation, itemPrepare) {
|
|
2689
|
-
return treeWrapper(item, filter, relation, treeFind_
|
|
2513
|
+
return treeWrapper(item, filter, relation, treeFind_);
|
|
2690
2514
|
}
|
|
2691
2515
|
function treeFilter(item, filter, relation, itemPrepare) {
|
|
2692
2516
|
return treeWrapper(
|
|
2693
2517
|
item,
|
|
2694
2518
|
filter,
|
|
2695
2519
|
relation,
|
|
2696
|
-
treeFilter_
|
|
2697
|
-
itemPrepare
|
|
2698
|
-
);
|
|
2520
|
+
treeFilter_);
|
|
2699
2521
|
}
|
|
2700
2522
|
function getChildren(item, relation = "children") {
|
|
2701
2523
|
let children = [];
|
|
@@ -2712,13 +2534,6 @@ function getChildren(item, relation = "children") {
|
|
|
2712
2534
|
}
|
|
2713
2535
|
function treeWrapper(item, filter = (x) => !!x, relation = "children", treeFunction, itemPrepare) {
|
|
2714
2536
|
const filterFunction = typeof filter === "function" ? filter : (i) => propertiesFilter(i, filter);
|
|
2715
|
-
if (itemPrepare) {
|
|
2716
|
-
return treeFunction(
|
|
2717
|
-
item,
|
|
2718
|
-
(i) => filterFunction(itemPrepare(i)),
|
|
2719
|
-
relation
|
|
2720
|
-
);
|
|
2721
|
-
}
|
|
2722
2537
|
return treeFunction(item, filterFunction, relation);
|
|
2723
2538
|
}
|
|
2724
2539
|
function treeFind_(item, filterFunc = (x) => !!x, relation, _filtered = []) {
|
|
@@ -2985,7 +2800,7 @@ var __spreadValues$o = (a, b) => {
|
|
|
2985
2800
|
}
|
|
2986
2801
|
return a;
|
|
2987
2802
|
};
|
|
2988
|
-
var __publicField$l = (obj, key, value) => __defNormalProp$w(obj,
|
|
2803
|
+
var __publicField$l = (obj, key, value) => __defNormalProp$w(obj, key + "" , value);
|
|
2989
2804
|
const _CheckProperty = class _CheckProperty extends BaseProperty {
|
|
2990
2805
|
constructor(name, item, options) {
|
|
2991
2806
|
super(name, item, __spreadValues$o(__spreadValues$o({}, _CheckProperty.options), options));
|
|
@@ -3309,9 +3124,10 @@ function getNgwWebmapExtent(webmap) {
|
|
|
3309
3124
|
function fetchNgwLayerExtent({
|
|
3310
3125
|
resourceId,
|
|
3311
3126
|
connector,
|
|
3312
|
-
cache = true
|
|
3127
|
+
cache = true,
|
|
3128
|
+
signal
|
|
3313
3129
|
}) {
|
|
3314
|
-
return connector.get("layer.extent", { cache }, { id: resourceId }).then((resp) => {
|
|
3130
|
+
return connector.get("layer.extent", { cache, signal }, { id: resourceId }).then((resp) => {
|
|
3315
3131
|
if (resp) {
|
|
3316
3132
|
const { maxLat, maxLon, minLat, minLon } = resp.extent;
|
|
3317
3133
|
const extentArray = [minLon, minLat, maxLon, maxLat];
|
|
@@ -3323,11 +3139,12 @@ function fetchNgwLayerItemExtent({
|
|
|
3323
3139
|
resourceId,
|
|
3324
3140
|
featureId,
|
|
3325
3141
|
connector,
|
|
3326
|
-
cache = true
|
|
3142
|
+
cache = true,
|
|
3143
|
+
signal
|
|
3327
3144
|
}) {
|
|
3328
3145
|
return connector.get(
|
|
3329
3146
|
"feature_layer.feature.item_extent",
|
|
3330
|
-
{ cache },
|
|
3147
|
+
{ cache, signal },
|
|
3331
3148
|
{ id: resourceId, fid: featureId }
|
|
3332
3149
|
).then((resp) => {
|
|
3333
3150
|
if (resp) {
|
|
@@ -3338,7 +3155,10 @@ function fetchNgwLayerItemExtent({
|
|
|
3338
3155
|
});
|
|
3339
3156
|
}
|
|
3340
3157
|
function fetchNgwExtent(options) {
|
|
3341
|
-
return options.connector.getResource(options.resourceId
|
|
3158
|
+
return options.connector.getResource(options.resourceId, {
|
|
3159
|
+
signal: options.signal,
|
|
3160
|
+
cache: options.cache
|
|
3161
|
+
}).then((resource) => {
|
|
3342
3162
|
if (resource) {
|
|
3343
3163
|
return fetchNgwResourceExtent(resource, options.connector, options);
|
|
3344
3164
|
}
|
|
@@ -3346,11 +3166,11 @@ function fetchNgwExtent(options) {
|
|
|
3346
3166
|
}
|
|
3347
3167
|
function fetchNgwResourceExtent(item, connector, options) {
|
|
3348
3168
|
if (item.webmap) {
|
|
3349
|
-
return
|
|
3169
|
+
return Promise.resolve(getNgwWebmapExtent(item.webmap));
|
|
3350
3170
|
} else {
|
|
3351
3171
|
const resource = item.resource;
|
|
3352
3172
|
if (resource.cls && resource.cls.indexOf("style") !== -1) {
|
|
3353
|
-
return connector.getResource(resource.parent.id).then((res) => {
|
|
3173
|
+
return connector.getResource(resource.parent.id, options).then((res) => {
|
|
3354
3174
|
if (res) {
|
|
3355
3175
|
return fetchNgwLayerExtent(__spreadProps$a(__spreadValues$l({}, options), {
|
|
3356
3176
|
resourceId: res.resource.id,
|
|
@@ -3370,7 +3190,7 @@ function fetchNgwResourceExtent(item, connector, options) {
|
|
|
3370
3190
|
var __defProp$s = Object.defineProperty;
|
|
3371
3191
|
var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3372
3192
|
var __publicField$i = (obj, key, value) => __defNormalProp$s(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3373
|
-
var __async$
|
|
3193
|
+
var __async$n = (__this, __arguments, generator) => {
|
|
3374
3194
|
return new Promise((resolve, reject) => {
|
|
3375
3195
|
var fulfilled = (value) => {
|
|
3376
3196
|
try {
|
|
@@ -3398,12 +3218,12 @@ class NgwResource {
|
|
|
3398
3218
|
}
|
|
3399
3219
|
/** @deprecated use {@link NgwResource.getBounds} instead */
|
|
3400
3220
|
getExtent() {
|
|
3401
|
-
return __async$
|
|
3221
|
+
return __async$n(this, null, function* () {
|
|
3402
3222
|
return this.getBounds();
|
|
3403
3223
|
});
|
|
3404
3224
|
}
|
|
3405
3225
|
getBounds(options) {
|
|
3406
|
-
return __async$
|
|
3226
|
+
return __async$n(this, null, function* () {
|
|
3407
3227
|
if (this._extent) {
|
|
3408
3228
|
return this._extent;
|
|
3409
3229
|
}
|
|
@@ -3419,7 +3239,7 @@ class NgwResource {
|
|
|
3419
3239
|
}
|
|
3420
3240
|
}
|
|
3421
3241
|
|
|
3422
|
-
var __async$
|
|
3242
|
+
var __async$m = (__this, __arguments, generator) => {
|
|
3423
3243
|
return new Promise((resolve, reject) => {
|
|
3424
3244
|
var fulfilled = (value) => {
|
|
3425
3245
|
try {
|
|
@@ -3440,7 +3260,7 @@ var __async$j = (__this, __arguments, generator) => {
|
|
|
3440
3260
|
});
|
|
3441
3261
|
};
|
|
3442
3262
|
function resourceIdFromLayerOptions(options, connector) {
|
|
3443
|
-
return __async$
|
|
3263
|
+
return __async$m(this, null, function* () {
|
|
3444
3264
|
const resource = options.resource;
|
|
3445
3265
|
const item = resource;
|
|
3446
3266
|
let { keyname, resourceId } = options;
|
|
@@ -3542,7 +3362,7 @@ var __objRest$1 = (source, exclude) => {
|
|
|
3542
3362
|
return target;
|
|
3543
3363
|
};
|
|
3544
3364
|
var __publicField$h = (obj, key, value) => __defNormalProp$r(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3545
|
-
var __async$
|
|
3365
|
+
var __async$l = (__this, __arguments, generator) => {
|
|
3546
3366
|
return new Promise((resolve, reject) => {
|
|
3547
3367
|
var fulfilled = (value) => {
|
|
3548
3368
|
try {
|
|
@@ -3594,7 +3414,7 @@ function createQmsAdapter(webMapOrOptions, url = URL, createOpt = {}) {
|
|
|
3594
3414
|
}
|
|
3595
3415
|
}
|
|
3596
3416
|
addLayer(options) {
|
|
3597
|
-
return __async$
|
|
3417
|
+
return __async$l(this, null, function* () {
|
|
3598
3418
|
if (!this.qms && options.qmsId) {
|
|
3599
3419
|
try {
|
|
3600
3420
|
this.qms = yield loadJson(
|
|
@@ -3702,7 +3522,7 @@ var __spreadValues$i = (a, b) => {
|
|
|
3702
3522
|
};
|
|
3703
3523
|
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
3704
3524
|
var __superGet$2 = (cls, obj, key) => __reflectGet$2(__getProtoOf$2(cls), key, obj);
|
|
3705
|
-
var __async$
|
|
3525
|
+
var __async$k = (__this, __arguments, generator) => {
|
|
3706
3526
|
return new Promise((resolve, reject) => {
|
|
3707
3527
|
var fulfilled = (value) => {
|
|
3708
3528
|
try {
|
|
@@ -3723,7 +3543,7 @@ var __async$h = (__this, __arguments, generator) => {
|
|
|
3723
3543
|
});
|
|
3724
3544
|
};
|
|
3725
3545
|
function createBasemapLayerAdapter(_0) {
|
|
3726
|
-
return __async$
|
|
3546
|
+
return __async$k(this, arguments, function* ({
|
|
3727
3547
|
webMap,
|
|
3728
3548
|
item
|
|
3729
3549
|
}) {
|
|
@@ -3744,7 +3564,7 @@ function createBasemapLayerAdapter(_0) {
|
|
|
3744
3564
|
if (TileAdapter) {
|
|
3745
3565
|
class BasemapTileAdapter extends TileAdapter {
|
|
3746
3566
|
addLayer(opt) {
|
|
3747
|
-
return __async$
|
|
3567
|
+
return __async$k(this, null, function* () {
|
|
3748
3568
|
return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$9(__spreadValues$i({}, opt), { url }));
|
|
3749
3569
|
});
|
|
3750
3570
|
}
|
|
@@ -3784,11 +3604,12 @@ function createPopupContent(feature, item) {
|
|
|
3784
3604
|
function fetchNgwLayerCount({
|
|
3785
3605
|
connector,
|
|
3786
3606
|
resourceId,
|
|
3787
|
-
cache = true
|
|
3607
|
+
cache = true,
|
|
3608
|
+
signal
|
|
3788
3609
|
}) {
|
|
3789
3610
|
return connector.get(
|
|
3790
3611
|
"feature_layer.feature.count",
|
|
3791
|
-
{ cache },
|
|
3612
|
+
{ cache, signal },
|
|
3792
3613
|
{
|
|
3793
3614
|
id: resourceId
|
|
3794
3615
|
}
|
|
@@ -3842,13 +3663,34 @@ var __spreadValues$h = (a, b) => {
|
|
|
3842
3663
|
return a;
|
|
3843
3664
|
};
|
|
3844
3665
|
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
3666
|
+
var __async$j = (__this, __arguments, generator) => {
|
|
3667
|
+
return new Promise((resolve, reject) => {
|
|
3668
|
+
var fulfilled = (value) => {
|
|
3669
|
+
try {
|
|
3670
|
+
step(generator.next(value));
|
|
3671
|
+
} catch (e) {
|
|
3672
|
+
reject(e);
|
|
3673
|
+
}
|
|
3674
|
+
};
|
|
3675
|
+
var rejected = (value) => {
|
|
3676
|
+
try {
|
|
3677
|
+
step(generator.throw(value));
|
|
3678
|
+
} catch (e) {
|
|
3679
|
+
reject(e);
|
|
3680
|
+
}
|
|
3681
|
+
};
|
|
3682
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3683
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
3684
|
+
});
|
|
3685
|
+
};
|
|
3845
3686
|
function fetchNgwLayerItems(options) {
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3687
|
+
return __async$j(this, null, function* () {
|
|
3688
|
+
var _a;
|
|
3689
|
+
const filters = options.filters;
|
|
3690
|
+
if (filters) {
|
|
3691
|
+
let data = yield createFeatureFieldFilterQueries(__spreadProps$8(__spreadValues$h({}, options), {
|
|
3692
|
+
filters
|
|
3693
|
+
}));
|
|
3852
3694
|
const clientFilterValidate = (_a = options.clientFilterValidate) != null ? _a : isFilterWithAnyCase(filters);
|
|
3853
3695
|
if (clientFilterValidate) {
|
|
3854
3696
|
data = data.filter((y) => {
|
|
@@ -3860,10 +3702,10 @@ function fetchNgwLayerItems(options) {
|
|
|
3860
3702
|
});
|
|
3861
3703
|
}
|
|
3862
3704
|
return data;
|
|
3863
|
-
}
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
}
|
|
3705
|
+
} else {
|
|
3706
|
+
return fetchNgwLayerItemsRequest(options);
|
|
3707
|
+
}
|
|
3708
|
+
});
|
|
3867
3709
|
}
|
|
3868
3710
|
function isFilterWithAnyCase(filters) {
|
|
3869
3711
|
if (filters[0] === "any") {
|
|
@@ -3881,8 +3723,29 @@ function isFilterWithAnyCase(filters) {
|
|
|
3881
3723
|
return false;
|
|
3882
3724
|
}
|
|
3883
3725
|
|
|
3726
|
+
var __async$i = (__this, __arguments, generator) => {
|
|
3727
|
+
return new Promise((resolve, reject) => {
|
|
3728
|
+
var fulfilled = (value) => {
|
|
3729
|
+
try {
|
|
3730
|
+
step(generator.next(value));
|
|
3731
|
+
} catch (e) {
|
|
3732
|
+
reject(e);
|
|
3733
|
+
}
|
|
3734
|
+
};
|
|
3735
|
+
var rejected = (value) => {
|
|
3736
|
+
try {
|
|
3737
|
+
step(generator.throw(value));
|
|
3738
|
+
} catch (e) {
|
|
3739
|
+
reject(e);
|
|
3740
|
+
}
|
|
3741
|
+
};
|
|
3742
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3743
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
3744
|
+
});
|
|
3745
|
+
};
|
|
3884
3746
|
function fetchNgwLayerFeatures(options) {
|
|
3885
|
-
return
|
|
3747
|
+
return __async$i(this, null, function* () {
|
|
3748
|
+
const x = yield fetchNgwLayerItems(options);
|
|
3886
3749
|
const features = [];
|
|
3887
3750
|
x.forEach((y) => {
|
|
3888
3751
|
features.push(createGeoJsonFeature(y));
|
|
@@ -3942,7 +3805,7 @@ var __spreadValues$g = (a, b) => {
|
|
|
3942
3805
|
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
3943
3806
|
var __publicField$f = (obj, key, value) => __defNormalProp$n(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3944
3807
|
var __superGet$1 = (cls, obj, key) => __reflectGet$1(__getProtoOf$1(cls), key, obj);
|
|
3945
|
-
var __async$
|
|
3808
|
+
var __async$h = (__this, __arguments, generator) => {
|
|
3946
3809
|
return new Promise((resolve, reject) => {
|
|
3947
3810
|
var fulfilled = (value) => {
|
|
3948
3811
|
try {
|
|
@@ -3963,7 +3826,7 @@ var __async$g = (__this, __arguments, generator) => {
|
|
|
3963
3826
|
});
|
|
3964
3827
|
};
|
|
3965
3828
|
function createGeoJsonAdapter(props) {
|
|
3966
|
-
return __async$
|
|
3829
|
+
return __async$h(this, null, function* () {
|
|
3967
3830
|
var _a, _b;
|
|
3968
3831
|
const {
|
|
3969
3832
|
item,
|
|
@@ -3979,29 +3842,35 @@ function createGeoJsonAdapter(props) {
|
|
|
3979
3842
|
const _loadedIds = [];
|
|
3980
3843
|
let _fullDataLoad = false;
|
|
3981
3844
|
let _lastFilterArgs;
|
|
3982
|
-
let
|
|
3845
|
+
let internalAbortController;
|
|
3983
3846
|
const resourceId = yield resourceIdFromLayerOptions(options, connector);
|
|
3984
3847
|
if ((_b = (_a = options.adapterOptions) == null ? void 0 : _a.popupOptions) == null ? void 0 : _b.fromProperties) {
|
|
3985
3848
|
options.adapterOptions.popupOptions.createPopupContent = ({ feature }) => {
|
|
3986
3849
|
return feature && createPopupContent(feature, item);
|
|
3987
3850
|
};
|
|
3988
3851
|
}
|
|
3989
|
-
const getData = (filters, filterOpt) => __async$
|
|
3852
|
+
const getData = (filters, filterOpt) => __async$h(this, null, function* () {
|
|
3990
3853
|
abort();
|
|
3854
|
+
internalAbortController = new AbortController();
|
|
3855
|
+
const internalSignal = internalAbortController.signal;
|
|
3856
|
+
if (filterOpt == null ? void 0 : filterOpt.signal) {
|
|
3857
|
+
filterOpt.signal.addEventListener("abort", internalAbortController.abort);
|
|
3858
|
+
}
|
|
3859
|
+
filterOpt = filterOpt || {};
|
|
3860
|
+
filterOpt.signal = internalSignal;
|
|
3991
3861
|
_lastFilterArgs = { filters, options: filterOpt };
|
|
3992
|
-
|
|
3862
|
+
return fetchNgwLayerFeatureCollection(__spreadValues$g({
|
|
3993
3863
|
resourceId,
|
|
3994
3864
|
filters,
|
|
3995
3865
|
connector,
|
|
3996
3866
|
cache: true
|
|
3997
3867
|
}, filterOpt));
|
|
3998
|
-
return yield _dataPromise;
|
|
3999
3868
|
});
|
|
4000
3869
|
let removed = false;
|
|
4001
3870
|
const abort = () => {
|
|
4002
|
-
if (
|
|
4003
|
-
|
|
4004
|
-
|
|
3871
|
+
if (internalAbortController) {
|
|
3872
|
+
internalAbortController.abort();
|
|
3873
|
+
internalAbortController = void 0;
|
|
4005
3874
|
}
|
|
4006
3875
|
};
|
|
4007
3876
|
class NgwGeoJsonAdapter extends GeoJsonAdapter {
|
|
@@ -4014,7 +3883,7 @@ function createGeoJsonAdapter(props) {
|
|
|
4014
3883
|
__publicField$f(this, "__disableMapMoveListener");
|
|
4015
3884
|
}
|
|
4016
3885
|
addLayer(opt) {
|
|
4017
|
-
return __async$
|
|
3886
|
+
return __async$h(this, null, function* () {
|
|
4018
3887
|
let needUpdate = !opt.data;
|
|
4019
3888
|
const waitFullLoad = opt.waitFullLoad !== void 0 ? opt.waitFullLoad : true;
|
|
4020
3889
|
if (options.id !== void 0) {
|
|
@@ -4059,7 +3928,7 @@ function createGeoJsonAdapter(props) {
|
|
|
4059
3928
|
return this.getBounds();
|
|
4060
3929
|
}
|
|
4061
3930
|
getBounds() {
|
|
4062
|
-
return __async$
|
|
3931
|
+
return __async$h(this, null, function* () {
|
|
4063
3932
|
const hasData = this.getLayers && this.getLayers().length;
|
|
4064
3933
|
const strategy = this.options.strategy;
|
|
4065
3934
|
if ((strategy == null ? void 0 : strategy.startsWith("BBOX")) || hasData) {
|
|
@@ -4085,7 +3954,7 @@ function createGeoJsonAdapter(props) {
|
|
|
4085
3954
|
return fetchNgwLayerCount({ connector, resourceId, cache: true });
|
|
4086
3955
|
}
|
|
4087
3956
|
updateLayer(filterArgs) {
|
|
4088
|
-
return __async$
|
|
3957
|
+
return __async$h(this, null, function* () {
|
|
4089
3958
|
var _a2;
|
|
4090
3959
|
filterArgs = filterArgs || _lastFilterArgs || {};
|
|
4091
3960
|
if ((_a2 = this.options.strategy) == null ? void 0 : _a2.startsWith("BBOX")) {
|
|
@@ -4151,7 +4020,7 @@ function createGeoJsonAdapter(props) {
|
|
|
4151
4020
|
});
|
|
4152
4021
|
}
|
|
4153
4022
|
propertiesFilter(filters, opt) {
|
|
4154
|
-
return __async$
|
|
4023
|
+
return __async$h(this, null, function* () {
|
|
4155
4024
|
abort();
|
|
4156
4025
|
if (this.filter && _fullDataLoad) {
|
|
4157
4026
|
this.filter((e) => {
|
|
@@ -4225,7 +4094,7 @@ function createGeoJsonAdapter(props) {
|
|
|
4225
4094
|
});
|
|
4226
4095
|
}
|
|
4227
4096
|
|
|
4228
|
-
var __async$
|
|
4097
|
+
var __async$g = (__this, __arguments, generator) => {
|
|
4229
4098
|
return new Promise((resolve, reject) => {
|
|
4230
4099
|
var fulfilled = (value) => {
|
|
4231
4100
|
try {
|
|
@@ -4246,7 +4115,7 @@ var __async$f = (__this, __arguments, generator) => {
|
|
|
4246
4115
|
});
|
|
4247
4116
|
};
|
|
4248
4117
|
function createWebMapAdapter(_0) {
|
|
4249
|
-
return __async$
|
|
4118
|
+
return __async$g(this, arguments, function* ({
|
|
4250
4119
|
layerOptions: options,
|
|
4251
4120
|
webMap,
|
|
4252
4121
|
connector
|
|
@@ -4374,7 +4243,7 @@ var __spreadValues$f = (a, b) => {
|
|
|
4374
4243
|
};
|
|
4375
4244
|
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
4376
4245
|
var __publicField$e = (obj, key, value) => __defNormalProp$m(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4377
|
-
var __async$
|
|
4246
|
+
var __async$f = (__this, __arguments, generator) => {
|
|
4378
4247
|
return new Promise((resolve, reject) => {
|
|
4379
4248
|
var fulfilled = (value) => {
|
|
4380
4249
|
try {
|
|
@@ -4395,7 +4264,7 @@ var __async$e = (__this, __arguments, generator) => {
|
|
|
4395
4264
|
});
|
|
4396
4265
|
};
|
|
4397
4266
|
function createRasterAdapter(_0) {
|
|
4398
|
-
return __async$
|
|
4267
|
+
return __async$f(this, arguments, function* ({
|
|
4399
4268
|
layerOptions,
|
|
4400
4269
|
webMap,
|
|
4401
4270
|
connector,
|
|
@@ -4451,7 +4320,7 @@ function createRasterAdapter(_0) {
|
|
|
4451
4320
|
return super.addLayer(__spreadValues$f(__spreadValues$f({}, this.options), addOptions));
|
|
4452
4321
|
}
|
|
4453
4322
|
getLegend(options) {
|
|
4454
|
-
return __async$
|
|
4323
|
+
return __async$f(this, null, function* () {
|
|
4455
4324
|
const ngwLegend = yield connector.get("render.legend_symbols", __spreadValues$f({
|
|
4456
4325
|
params: { id: resourceId },
|
|
4457
4326
|
cache: true
|
|
@@ -4471,7 +4340,7 @@ function createRasterAdapter(_0) {
|
|
|
4471
4340
|
});
|
|
4472
4341
|
}
|
|
4473
4342
|
getIdentificationIds() {
|
|
4474
|
-
return __async$
|
|
4343
|
+
return __async$f(this, null, function* () {
|
|
4475
4344
|
if (this.item) {
|
|
4476
4345
|
if (adapter === "MVT") {
|
|
4477
4346
|
return [this.item.resource.id];
|
|
@@ -4512,7 +4381,7 @@ var __spreadValues$e = (a, b) => {
|
|
|
4512
4381
|
return a;
|
|
4513
4382
|
};
|
|
4514
4383
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
4515
|
-
var __async$
|
|
4384
|
+
var __async$e = (__this, __arguments, generator) => {
|
|
4516
4385
|
return new Promise((resolve, reject) => {
|
|
4517
4386
|
var fulfilled = (value) => {
|
|
4518
4387
|
try {
|
|
@@ -4548,7 +4417,7 @@ const supportCls = [
|
|
|
4548
4417
|
"tmsclient_layer"
|
|
4549
4418
|
];
|
|
4550
4419
|
function createAdapterFromFirstStyle(_0) {
|
|
4551
|
-
return __async$
|
|
4420
|
+
return __async$e(this, arguments, function* ({
|
|
4552
4421
|
layerOptions,
|
|
4553
4422
|
webMap,
|
|
4554
4423
|
connector,
|
|
@@ -4567,7 +4436,7 @@ function createAdapterFromFirstStyle(_0) {
|
|
|
4567
4436
|
});
|
|
4568
4437
|
}
|
|
4569
4438
|
function createAsyncAdapter(options, webMap, connector) {
|
|
4570
|
-
return __async$
|
|
4439
|
+
return __async$e(this, null, function* () {
|
|
4571
4440
|
let adapter;
|
|
4572
4441
|
let item;
|
|
4573
4442
|
const adapterType = options.adapter;
|
|
@@ -4764,7 +4633,7 @@ var __spreadValues$c = (a, b) => {
|
|
|
4764
4633
|
return a;
|
|
4765
4634
|
};
|
|
4766
4635
|
var __publicField$d = (obj, key, value) => __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4767
|
-
var __async$
|
|
4636
|
+
var __async$d = (__this, __arguments, generator) => {
|
|
4768
4637
|
return new Promise((resolve, reject) => {
|
|
4769
4638
|
var fulfilled = (value) => {
|
|
4770
4639
|
try {
|
|
@@ -4814,7 +4683,7 @@ const _NgwWebmapItem = class _NgwWebmapItem extends Item {
|
|
|
4814
4683
|
}
|
|
4815
4684
|
}
|
|
4816
4685
|
static create(webMap, item, options, connector, parent) {
|
|
4817
|
-
return __async$
|
|
4686
|
+
return __async$d(this, null, function* () {
|
|
4818
4687
|
const ngwWebmapItem = new _NgwWebmapItem(
|
|
4819
4688
|
webMap,
|
|
4820
4689
|
item,
|
|
@@ -4843,15 +4712,14 @@ const _NgwWebmapItem = class _NgwWebmapItem extends Item {
|
|
|
4843
4712
|
return this.layer;
|
|
4844
4713
|
}
|
|
4845
4714
|
getLegend(options) {
|
|
4846
|
-
return __async$
|
|
4715
|
+
return __async$d(this, null, function* () {
|
|
4847
4716
|
var _a;
|
|
4848
4717
|
const id = (_a = this.layer) == null ? void 0 : _a.id;
|
|
4849
4718
|
if (id !== void 0) {
|
|
4850
4719
|
const connector = this.connector;
|
|
4851
4720
|
if (connector) {
|
|
4852
4721
|
const ngwLegend = yield connector.get("render.legend_symbols", __spreadValues$c({
|
|
4853
|
-
params: { id: this.item.resourceId }
|
|
4854
|
-
cache: true
|
|
4722
|
+
params: { id: this.item.resourceId }
|
|
4855
4723
|
}, options));
|
|
4856
4724
|
const legend = {
|
|
4857
4725
|
layerId: id,
|
|
@@ -5042,7 +4910,7 @@ var __spreadValues$b = (a, b) => {
|
|
|
5042
4910
|
return a;
|
|
5043
4911
|
};
|
|
5044
4912
|
var __publicField$c = (obj, key, value) => __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5045
|
-
var __async$
|
|
4913
|
+
var __async$c = (__this, __arguments, generator) => {
|
|
5046
4914
|
return new Promise((resolve, reject) => {
|
|
5047
4915
|
var fulfilled = (value) => {
|
|
5048
4916
|
try {
|
|
@@ -5063,7 +4931,7 @@ var __async$b = (__this, __arguments, generator) => {
|
|
|
5063
4931
|
});
|
|
5064
4932
|
};
|
|
5065
4933
|
function createOnFirstShowAdapter(_0) {
|
|
5066
|
-
return __async$
|
|
4934
|
+
return __async$c(this, arguments, function* ({
|
|
5067
4935
|
webMap,
|
|
5068
4936
|
adapterOptions = {},
|
|
5069
4937
|
onLayerAdded,
|
|
@@ -5089,7 +4957,7 @@ function createOnFirstShowAdapter(_0) {
|
|
|
5089
4957
|
return this._removed;
|
|
5090
4958
|
}
|
|
5091
4959
|
showLayer() {
|
|
5092
|
-
return __async$
|
|
4960
|
+
return __async$c(this, null, function* () {
|
|
5093
4961
|
this.options.visibility = true;
|
|
5094
4962
|
if (this.layer.length) {
|
|
5095
4963
|
for (const x of this.layer) {
|
|
@@ -5101,7 +4969,7 @@ function createOnFirstShowAdapter(_0) {
|
|
|
5101
4969
|
});
|
|
5102
4970
|
}
|
|
5103
4971
|
hideLayer() {
|
|
5104
|
-
return __async$
|
|
4972
|
+
return __async$c(this, null, function* () {
|
|
5105
4973
|
this.options.visibility = false;
|
|
5106
4974
|
if (this.layer) {
|
|
5107
4975
|
for (const x of this.layer) {
|
|
@@ -5111,7 +4979,7 @@ function createOnFirstShowAdapter(_0) {
|
|
|
5111
4979
|
});
|
|
5112
4980
|
}
|
|
5113
4981
|
loadLayer() {
|
|
5114
|
-
return __async$
|
|
4982
|
+
return __async$c(this, null, function* () {
|
|
5115
4983
|
if (!this.layer.length && !this._creatingInProgress) {
|
|
5116
4984
|
this._creatingInProgress = true;
|
|
5117
4985
|
const Adapter = yield createAdapter(this);
|
|
@@ -5145,7 +5013,7 @@ function createOnFirstShowAdapter(_0) {
|
|
|
5145
5013
|
});
|
|
5146
5014
|
}
|
|
5147
5015
|
|
|
5148
|
-
var __async$
|
|
5016
|
+
var __async$b = (__this, __arguments, generator) => {
|
|
5149
5017
|
return new Promise((resolve, reject) => {
|
|
5150
5018
|
var fulfilled = (value) => {
|
|
5151
5019
|
try {
|
|
@@ -5166,7 +5034,7 @@ var __async$a = (__this, __arguments, generator) => {
|
|
|
5166
5034
|
});
|
|
5167
5035
|
};
|
|
5168
5036
|
function createOnFirstShowNgwAdapter(_0) {
|
|
5169
|
-
return __async$
|
|
5037
|
+
return __async$b(this, arguments, function* ({
|
|
5170
5038
|
webMap,
|
|
5171
5039
|
connector,
|
|
5172
5040
|
item,
|
|
@@ -5219,7 +5087,7 @@ var __spreadValues$a = (a, b) => {
|
|
|
5219
5087
|
return a;
|
|
5220
5088
|
};
|
|
5221
5089
|
var __publicField$b = (obj, key, value) => __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5222
|
-
var __async$
|
|
5090
|
+
var __async$a = (__this, __arguments, generator) => {
|
|
5223
5091
|
return new Promise((resolve, reject) => {
|
|
5224
5092
|
var fulfilled = (value) => {
|
|
5225
5093
|
try {
|
|
@@ -5270,7 +5138,7 @@ class NgwWebmapLayerAdapter {
|
|
|
5270
5138
|
}
|
|
5271
5139
|
}
|
|
5272
5140
|
addLayer(options) {
|
|
5273
|
-
return __async$
|
|
5141
|
+
return __async$a(this, null, function* () {
|
|
5274
5142
|
var _a, _b;
|
|
5275
5143
|
this.options = __spreadValues$a(__spreadValues$a({}, this.options), options);
|
|
5276
5144
|
this.layer = yield this._getWebMapLayerItem();
|
|
@@ -5303,21 +5171,21 @@ class NgwWebmapLayerAdapter {
|
|
|
5303
5171
|
delete this._webmapLayersIds;
|
|
5304
5172
|
}
|
|
5305
5173
|
showLayer() {
|
|
5306
|
-
return __async$
|
|
5174
|
+
return __async$a(this, null, function* () {
|
|
5307
5175
|
if (this.layer && this.layer.properties) {
|
|
5308
5176
|
return this.layer.properties.property("visibility").set(true);
|
|
5309
5177
|
}
|
|
5310
5178
|
});
|
|
5311
5179
|
}
|
|
5312
5180
|
hideLayer() {
|
|
5313
|
-
return __async$
|
|
5181
|
+
return __async$a(this, null, function* () {
|
|
5314
5182
|
if (this.layer && this.layer.properties) {
|
|
5315
5183
|
return this.layer.properties.property("visibility").set(false);
|
|
5316
5184
|
}
|
|
5317
5185
|
});
|
|
5318
5186
|
}
|
|
5319
5187
|
setOpacity(val) {
|
|
5320
|
-
return __async$
|
|
5188
|
+
return __async$a(this, null, function* () {
|
|
5321
5189
|
if (this.layer && this.layer.properties) {
|
|
5322
5190
|
return this.layer.properties.property("opacity").set(val);
|
|
5323
5191
|
}
|
|
@@ -5342,22 +5210,22 @@ class NgwWebmapLayerAdapter {
|
|
|
5342
5210
|
return webmap.bookmark_resource.id;
|
|
5343
5211
|
}
|
|
5344
5212
|
}
|
|
5345
|
-
fetchBookmarks() {
|
|
5213
|
+
fetchBookmarks(options) {
|
|
5346
5214
|
const bookmarkResId = this.getBookmarksResourceId();
|
|
5347
5215
|
const connector = this.options.connector;
|
|
5348
5216
|
if (bookmarkResId) {
|
|
5349
|
-
return connector.getResourceOrFail(bookmarkResId).then((item) => {
|
|
5217
|
+
return connector.getResourceOrFail(bookmarkResId, options).then((item) => {
|
|
5350
5218
|
var _a;
|
|
5351
5219
|
const labelField = (_a = item.feature_layer) == null ? void 0 : _a.fields.find(
|
|
5352
5220
|
(x) => x.label_field
|
|
5353
5221
|
);
|
|
5354
5222
|
const keyname = labelField && labelField.keyname;
|
|
5355
|
-
return fetchNgwLayerItems({
|
|
5223
|
+
return fetchNgwLayerItems(__spreadValues$a({
|
|
5356
5224
|
connector,
|
|
5357
5225
|
resourceId: bookmarkResId,
|
|
5358
5226
|
geom: false,
|
|
5359
5227
|
fields: keyname ? [keyname] : void 0
|
|
5360
|
-
}).then((items) => {
|
|
5228
|
+
}, options)).then((items) => {
|
|
5361
5229
|
const bookmarks = [];
|
|
5362
5230
|
for (const i of items) {
|
|
5363
5231
|
const bookmark = new BookmarkItem({
|
|
@@ -5376,24 +5244,24 @@ class NgwWebmapLayerAdapter {
|
|
|
5376
5244
|
"Webmap was not loaded correctly, it is impossible to extract bookmarks"
|
|
5377
5245
|
);
|
|
5378
5246
|
}
|
|
5379
|
-
getLegend() {
|
|
5380
|
-
return __async$
|
|
5247
|
+
getLegend(options) {
|
|
5248
|
+
return __async$a(this, null, function* () {
|
|
5381
5249
|
const legends = [];
|
|
5382
5250
|
let deps = this.getDependLayers();
|
|
5383
5251
|
deps = deps.sort((a, b) => b.id - a.id);
|
|
5384
5252
|
for (const d of deps) {
|
|
5385
|
-
const layerLegend = yield d.getLegend();
|
|
5253
|
+
const layerLegend = yield d.getLegend(options);
|
|
5386
5254
|
legends.push(...layerLegend);
|
|
5387
5255
|
}
|
|
5388
5256
|
return legends;
|
|
5389
5257
|
});
|
|
5390
5258
|
}
|
|
5391
|
-
getIdentificationIds() {
|
|
5392
|
-
return __async$
|
|
5259
|
+
getIdentificationIds(options) {
|
|
5260
|
+
return __async$a(this, null, function* () {
|
|
5393
5261
|
const visibleLayers = [];
|
|
5394
5262
|
let ids = this._webmapLayersIds;
|
|
5395
5263
|
if (!ids) {
|
|
5396
|
-
ids = yield this._getWebMapIds();
|
|
5264
|
+
ids = yield this._getWebMapIds(options);
|
|
5397
5265
|
this._webmapLayersIds = ids;
|
|
5398
5266
|
}
|
|
5399
5267
|
if (ids && ids.length) {
|
|
@@ -5415,7 +5283,7 @@ class NgwWebmapLayerAdapter {
|
|
|
5415
5283
|
});
|
|
5416
5284
|
}
|
|
5417
5285
|
_getWebMapLayerItem() {
|
|
5418
|
-
return __async$
|
|
5286
|
+
return __async$a(this, null, function* () {
|
|
5419
5287
|
if (this.resourceId) {
|
|
5420
5288
|
const webmap = yield this.getWebMapConfig(this.resourceId);
|
|
5421
5289
|
if (webmap && webmap.root_item) {
|
|
@@ -5448,7 +5316,7 @@ class NgwWebmapLayerAdapter {
|
|
|
5448
5316
|
});
|
|
5449
5317
|
}
|
|
5450
5318
|
getWebMapConfig(id) {
|
|
5451
|
-
return __async$
|
|
5319
|
+
return __async$a(this, null, function* () {
|
|
5452
5320
|
const data = yield this.options.connector.getResource(id);
|
|
5453
5321
|
if (data) {
|
|
5454
5322
|
this.response = data;
|
|
@@ -5542,8 +5410,8 @@ class NgwWebmapLayerAdapter {
|
|
|
5542
5410
|
}
|
|
5543
5411
|
return item;
|
|
5544
5412
|
}
|
|
5545
|
-
_getWebMapIds() {
|
|
5546
|
-
return __async$
|
|
5413
|
+
_getWebMapIds(options) {
|
|
5414
|
+
return __async$a(this, null, function* () {
|
|
5547
5415
|
const webMapItem = this.layer;
|
|
5548
5416
|
if (webMapItem && webMapItem.item.item_type === "root") {
|
|
5549
5417
|
const layers = webMapItem.tree.getDescendants();
|
|
@@ -5552,7 +5420,7 @@ class NgwWebmapLayerAdapter {
|
|
|
5552
5420
|
const item = x.item;
|
|
5553
5421
|
if (item.item_type === "layer") {
|
|
5554
5422
|
const id = item.layer_style_id;
|
|
5555
|
-
const promise = this.options.connector.getResource(id).then((y) => {
|
|
5423
|
+
const promise = this.options.connector.getResource(id, options).then((y) => {
|
|
5556
5424
|
if (y) {
|
|
5557
5425
|
const parentId = Number(y.resource.parent.id);
|
|
5558
5426
|
item.parentId = parentId;
|
|
@@ -5586,7 +5454,7 @@ var __spreadValues$9 = (a, b) => {
|
|
|
5586
5454
|
return a;
|
|
5587
5455
|
};
|
|
5588
5456
|
var __publicField$a = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5589
|
-
var __async$
|
|
5457
|
+
var __async$9 = (__this, __arguments, generator) => {
|
|
5590
5458
|
return new Promise((resolve, reject) => {
|
|
5591
5459
|
var fulfilled = (value) => {
|
|
5592
5460
|
try {
|
|
@@ -5631,7 +5499,7 @@ class NgwKit {
|
|
|
5631
5499
|
classAdapters[cls] = adapter;
|
|
5632
5500
|
}
|
|
5633
5501
|
onLoadSync(webMap) {
|
|
5634
|
-
return __async$
|
|
5502
|
+
return __async$9(this, null, function* () {
|
|
5635
5503
|
if (this.options.resourceId && this.url) {
|
|
5636
5504
|
const resourceIds = [this.options.resourceId];
|
|
5637
5505
|
if (resourceIds.length) {
|
|
@@ -5714,7 +5582,7 @@ class IdentifyItem {
|
|
|
5714
5582
|
}
|
|
5715
5583
|
identify(options = {}) {
|
|
5716
5584
|
if (this._item) {
|
|
5717
|
-
return
|
|
5585
|
+
return Promise.resolve(this._item);
|
|
5718
5586
|
}
|
|
5719
5587
|
return fetchNgwLayerItem(__spreadValues$8({
|
|
5720
5588
|
connector: this.connector,
|
|
@@ -5729,30 +5597,30 @@ class IdentifyItem {
|
|
|
5729
5597
|
return resp;
|
|
5730
5598
|
});
|
|
5731
5599
|
}
|
|
5732
|
-
resource() {
|
|
5600
|
+
resource(opt) {
|
|
5733
5601
|
if (this._resource) {
|
|
5734
|
-
return
|
|
5602
|
+
return Promise.resolve(this._resource.feature_layer);
|
|
5735
5603
|
}
|
|
5736
|
-
return this.connector.getResource(this.layerId).then((resp) => {
|
|
5604
|
+
return this.connector.getResource(this.layerId, opt).then((resp) => {
|
|
5737
5605
|
this._resource = resp;
|
|
5738
5606
|
return this._resource.feature_layer;
|
|
5739
5607
|
});
|
|
5740
5608
|
}
|
|
5741
|
-
getBounds() {
|
|
5609
|
+
getBounds(opt) {
|
|
5742
5610
|
if (this._extent) {
|
|
5743
|
-
return
|
|
5611
|
+
return Promise.resolve(this._extent);
|
|
5744
5612
|
}
|
|
5745
|
-
return fetchNgwLayerItemExtent({
|
|
5613
|
+
return fetchNgwLayerItemExtent(__spreadValues$8({
|
|
5746
5614
|
connector: this.connector,
|
|
5747
5615
|
featureId: this.id,
|
|
5748
5616
|
resourceId: this.layerId
|
|
5749
|
-
});
|
|
5617
|
+
}, opt));
|
|
5750
5618
|
}
|
|
5751
|
-
geojson() {
|
|
5619
|
+
geojson(options) {
|
|
5752
5620
|
if (this._geojson) {
|
|
5753
|
-
return
|
|
5621
|
+
return Promise.resolve(this._geojson);
|
|
5754
5622
|
}
|
|
5755
|
-
return this.identify().then((resp) => {
|
|
5623
|
+
return this.identify(options).then((resp) => {
|
|
5756
5624
|
return resp.toGeojson().then((geojson) => {
|
|
5757
5625
|
this._geojson = geojson;
|
|
5758
5626
|
return geojson;
|
|
@@ -5761,8 +5629,29 @@ class IdentifyItem {
|
|
|
5761
5629
|
}
|
|
5762
5630
|
}
|
|
5763
5631
|
|
|
5632
|
+
var __async$8 = (__this, __arguments, generator) => {
|
|
5633
|
+
return new Promise((resolve, reject) => {
|
|
5634
|
+
var fulfilled = (value) => {
|
|
5635
|
+
try {
|
|
5636
|
+
step(generator.next(value));
|
|
5637
|
+
} catch (e) {
|
|
5638
|
+
reject(e);
|
|
5639
|
+
}
|
|
5640
|
+
};
|
|
5641
|
+
var rejected = (value) => {
|
|
5642
|
+
try {
|
|
5643
|
+
step(generator.throw(value));
|
|
5644
|
+
} catch (e) {
|
|
5645
|
+
reject(e);
|
|
5646
|
+
}
|
|
5647
|
+
};
|
|
5648
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
5649
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
5650
|
+
});
|
|
5651
|
+
};
|
|
5764
5652
|
function fetchNgwLayerFeature(options) {
|
|
5765
|
-
return
|
|
5653
|
+
return __async$8(this, null, function* () {
|
|
5654
|
+
const item = yield fetchNgwLayerItem(options);
|
|
5766
5655
|
return createGeoJsonFeature(item);
|
|
5767
5656
|
});
|
|
5768
5657
|
}
|
|
@@ -5847,7 +5736,7 @@ function fetchIdentifyGeoJson(options) {
|
|
|
5847
5736
|
const withGeom = item.features.find((x) => x.geom);
|
|
5848
5737
|
if (withGeom && withGeom.geom) {
|
|
5849
5738
|
const geom = withGeom.geom;
|
|
5850
|
-
return
|
|
5739
|
+
return Promise.resolve(
|
|
5851
5740
|
createGeoJsonFeature(__spreadProps$4(__spreadValues$7({}, withGeom), {
|
|
5852
5741
|
geom
|
|
5853
5742
|
}))
|
|
@@ -5860,7 +5749,7 @@ function fetchIdentifyGeoJson(options) {
|
|
|
5860
5749
|
if (params && params.length) {
|
|
5861
5750
|
return fetchNgwLayerFeature(__spreadValues$7(__spreadProps$4(__spreadValues$7({}, requestOptions), { connector }), params[0]));
|
|
5862
5751
|
}
|
|
5863
|
-
return
|
|
5752
|
+
return Promise.resolve(void 0);
|
|
5864
5753
|
}
|
|
5865
5754
|
function fetchIdentifyItem(options) {
|
|
5866
5755
|
const { connector, identify } = options;
|
|
@@ -5870,7 +5759,7 @@ function fetchIdentifyItem(options) {
|
|
|
5870
5759
|
connector
|
|
5871
5760
|
}, options.requestOptions), params[0]));
|
|
5872
5761
|
}
|
|
5873
|
-
return
|
|
5762
|
+
return Promise.resolve(void 0);
|
|
5874
5763
|
}
|
|
5875
5764
|
function featureLayerIdentify(options) {
|
|
5876
5765
|
const { geom, signal, cache, layers } = options;
|
|
@@ -5914,9 +5803,9 @@ function getPolygonCoordinates(geom) {
|
|
|
5914
5803
|
function sendIdentifyRequest(ev, options) {
|
|
5915
5804
|
deprecatedMapClick(ev);
|
|
5916
5805
|
const [lng, lat] = ev.lngLat;
|
|
5917
|
-
const { geom, radius
|
|
5806
|
+
const { geom, radius } = options;
|
|
5918
5807
|
const geom_ = geom != null ? geom : getCirclePolygonCoordinates(lng, lat, radius);
|
|
5919
|
-
return featureLayerIdentify(__spreadProps$4(__spreadValues$7({}, options), { geom: geom_
|
|
5808
|
+
return featureLayerIdentify(__spreadProps$4(__spreadValues$7({}, options), { geom: geom_ }));
|
|
5920
5809
|
}
|
|
5921
5810
|
function createIdentifyItem(opt) {
|
|
5922
5811
|
return new IdentifyItem(opt);
|
|
@@ -7126,7 +7015,7 @@ const _WebMapMain = class _WebMapMain {
|
|
|
7126
7015
|
__publicField$3(this, "_mapState", []);
|
|
7127
7016
|
__publicField$3(this, "_extent");
|
|
7128
7017
|
__publicField$3(this, "_eventsStatus", {});
|
|
7129
|
-
__publicField$3(this, "
|
|
7018
|
+
__publicField$3(this, "_coordFromMapClickAbort");
|
|
7130
7019
|
__publicField$3(this, "_mapEvents", {});
|
|
7131
7020
|
this.mapAdapter = mapOptions.mapAdapter;
|
|
7132
7021
|
this._starterKits = mapOptions.starterKits || [];
|
|
@@ -7441,36 +7330,34 @@ const _WebMapMain = class _WebMapMain {
|
|
|
7441
7330
|
return { stop };
|
|
7442
7331
|
}
|
|
7443
7332
|
stopGetCoordFromMapClick() {
|
|
7444
|
-
if (this.
|
|
7445
|
-
this.
|
|
7333
|
+
if (this._coordFromMapClickAbort) {
|
|
7334
|
+
this._coordFromMapClickAbort();
|
|
7335
|
+
this._coordFromMapClickAbort = void 0;
|
|
7446
7336
|
}
|
|
7447
7337
|
}
|
|
7448
7338
|
getCoordFromMapClick() {
|
|
7449
|
-
if (!this.
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
}
|
|
7469
|
-
);
|
|
7339
|
+
if (!this._coordFromMapClickAbort) {
|
|
7340
|
+
return new Promise((resolve, reject) => {
|
|
7341
|
+
const cursor = this.getCursor() || "grab";
|
|
7342
|
+
this._removeEventListeners({ include: ["click"] });
|
|
7343
|
+
this.setCursor("crosshair");
|
|
7344
|
+
const onCancel_ = () => {
|
|
7345
|
+
this.setCursor(cursor);
|
|
7346
|
+
this._addEventsListeners({ include: ["click"] });
|
|
7347
|
+
this.mapAdapter.emitter.off("click", onMapClick);
|
|
7348
|
+
this._coordFromMapClickAbort = void 0;
|
|
7349
|
+
};
|
|
7350
|
+
const onMapClick = (e) => {
|
|
7351
|
+
onCancel_();
|
|
7352
|
+
deprecatedMapClick(e);
|
|
7353
|
+
resolve(e.lngLat);
|
|
7354
|
+
};
|
|
7355
|
+
this.mapAdapter.emitter.once("click", onMapClick);
|
|
7356
|
+
this._coordFromMapClickAbort = onCancel_;
|
|
7357
|
+
});
|
|
7470
7358
|
} else {
|
|
7471
7359
|
return this.getCoordFromMapClick();
|
|
7472
7360
|
}
|
|
7473
|
-
return this._coordFromMapClickPromise;
|
|
7474
7361
|
}
|
|
7475
7362
|
_emitStatusEvent(eventName, data) {
|
|
7476
7363
|
const _eventName = eventName;
|
|
@@ -9285,26 +9172,35 @@ const _NgwMap = class _NgwMap extends WebMap {
|
|
|
9285
9172
|
}, options));
|
|
9286
9173
|
}
|
|
9287
9174
|
fetchIdentifyItem(identify, requestOptions) {
|
|
9175
|
+
const abortController = new AbortController();
|
|
9176
|
+
const abortSignal = abortController.signal;
|
|
9177
|
+
if (requestOptions == null ? void 0 : requestOptions.signal) {
|
|
9178
|
+
requestOptions.signal.addEventListener("abort", abortController.abort);
|
|
9179
|
+
}
|
|
9180
|
+
requestOptions = requestOptions || {};
|
|
9181
|
+
requestOptions.signal = abortSignal;
|
|
9288
9182
|
const promise = fetchIdentifyItem({
|
|
9289
9183
|
identify,
|
|
9290
9184
|
connector: this.connector,
|
|
9291
9185
|
requestOptions
|
|
9292
9186
|
// multiple,
|
|
9293
9187
|
});
|
|
9294
|
-
this._addPromise("identify", promise);
|
|
9188
|
+
this._addPromise("identify", promise, abortController);
|
|
9295
9189
|
return promise;
|
|
9296
9190
|
}
|
|
9297
9191
|
fetchIdentifyGeoJson(identify, multiple = false) {
|
|
9192
|
+
const abortController = new AbortController();
|
|
9298
9193
|
const promise = fetchIdentifyGeoJson({
|
|
9299
9194
|
identify,
|
|
9300
9195
|
connector: this.connector,
|
|
9301
|
-
multiple
|
|
9196
|
+
multiple,
|
|
9197
|
+
requestOptions: { signal: abortController.signal }
|
|
9302
9198
|
});
|
|
9303
9199
|
if (promise && "then" in promise) {
|
|
9304
|
-
this._addPromise("identify", promise);
|
|
9200
|
+
this._addPromise("identify", promise, abortController);
|
|
9305
9201
|
return promise;
|
|
9306
9202
|
} else {
|
|
9307
|
-
return
|
|
9203
|
+
return Promise.resolve(promise);
|
|
9308
9204
|
}
|
|
9309
9205
|
}
|
|
9310
9206
|
/**
|
|
@@ -9478,7 +9374,7 @@ const _NgwMap = class _NgwMap extends WebMap {
|
|
|
9478
9374
|
args.forEach((name) => {
|
|
9479
9375
|
const group = this._promises[name];
|
|
9480
9376
|
if (group) {
|
|
9481
|
-
group.forEach((x) => x.
|
|
9377
|
+
group.forEach((x) => x[1].abort());
|
|
9482
9378
|
this._promises[name] = [];
|
|
9483
9379
|
}
|
|
9484
9380
|
});
|
|
@@ -9545,11 +9441,13 @@ const _NgwMap = class _NgwMap extends WebMap {
|
|
|
9545
9441
|
}, highlightDuration);
|
|
9546
9442
|
}
|
|
9547
9443
|
}
|
|
9444
|
+
const abortController = new AbortController();
|
|
9548
9445
|
const selectPromise = sendIdentifyRequest(ev, {
|
|
9549
9446
|
layers: ids,
|
|
9550
9447
|
connector: this.connector,
|
|
9551
9448
|
radius,
|
|
9552
|
-
geom
|
|
9449
|
+
geom,
|
|
9450
|
+
signal: abortController.signal
|
|
9553
9451
|
}).then((resp) => {
|
|
9554
9452
|
const identify = __spreadProps(__spreadValues({}, resp), {
|
|
9555
9453
|
resources: ids,
|
|
@@ -9560,22 +9458,22 @@ const _NgwMap = class _NgwMap extends WebMap {
|
|
|
9560
9458
|
this._emitStatusEvent("ngw:select", identifyEvent);
|
|
9561
9459
|
return identifyEvent;
|
|
9562
9460
|
});
|
|
9563
|
-
this._addPromise("select", selectPromise);
|
|
9461
|
+
this._addPromise("select", selectPromise, abortController);
|
|
9564
9462
|
return selectPromise;
|
|
9565
9463
|
});
|
|
9566
9464
|
}
|
|
9567
|
-
_addPromise(groupName, promise) {
|
|
9465
|
+
_addPromise(groupName, promise, abortController) {
|
|
9568
9466
|
const group = this._promises[groupName];
|
|
9569
|
-
if (group && group.
|
|
9467
|
+
if (group && group.findIndex((g) => g[0] === promise) === -1) {
|
|
9570
9468
|
const removeFromGroup = () => {
|
|
9571
|
-
const index = group.
|
|
9469
|
+
const index = group.findIndex((g) => g[0] === promise);
|
|
9572
9470
|
if (index !== -1) {
|
|
9573
9471
|
group.splice(index, 1);
|
|
9574
9472
|
}
|
|
9575
9473
|
};
|
|
9576
9474
|
promise.then(removeFromGroup);
|
|
9577
9475
|
promise.catch(removeFromGroup);
|
|
9578
|
-
group.push(promise);
|
|
9476
|
+
group.push([promise, abortController]);
|
|
9579
9477
|
}
|
|
9580
9478
|
}
|
|
9581
9479
|
_isFitFromResource() {
|