bruce-models 1.9.8 → 1.9.9
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/dist/bruce-models.es5.js +20 -14
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +20 -14
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-settings.js +2 -2
- package/dist/lib/account/account.js +185 -185
- package/dist/lib/ann-document/ann-document.js +86 -86
- package/dist/lib/api/abstract-api.js +246 -246
- package/dist/lib/api/api-getters.js +134 -134
- package/dist/lib/api/api.js +93 -93
- package/dist/lib/api/bruce-api.js +216 -216
- package/dist/lib/api/cam-api.js +85 -82
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/global-api.js +81 -81
- package/dist/lib/api/idm-api.js +85 -82
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/lib/bruce-models.js +86 -86
- package/dist/lib/calculator/calculator.js +341 -341
- package/dist/lib/client-file/client-file.js +245 -245
- package/dist/lib/common/bounds.js +61 -61
- package/dist/lib/common/bruce-event.js +46 -46
- package/dist/lib/common/bruce-variable.js +60 -60
- package/dist/lib/common/cache.js +165 -165
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +123 -123
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +56 -56
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form-content.js +26 -26
- package/dist/lib/custom-form/custom-form.js +106 -106
- package/dist/lib/data-lab/data-lab.js +49 -49
- package/dist/lib/entity/entity-attachment-type.js +83 -83
- package/dist/lib/entity/entity-attachment.js +122 -122
- package/dist/lib/entity/entity-attribute.js +29 -29
- package/dist/lib/entity/entity-comment.js +82 -82
- package/dist/lib/entity/entity-coords.js +149 -149
- package/dist/lib/entity/entity-link.js +82 -82
- package/dist/lib/entity/entity-lod-category.js +100 -100
- package/dist/lib/entity/entity-lod.js +185 -185
- package/dist/lib/entity/entity-relation-type.js +109 -109
- package/dist/lib/entity/entity-relation.js +132 -132
- package/dist/lib/entity/entity-source.js +136 -136
- package/dist/lib/entity/entity-tag.js +149 -149
- package/dist/lib/entity/entity-type-visual-settings.js +13 -13
- package/dist/lib/entity/entity-type.js +113 -113
- package/dist/lib/entity/entity.js +319 -319
- package/dist/lib/entity/getters/batched-data-getter.js +84 -84
- package/dist/lib/entity/getters/entity-filter-getter.js +303 -303
- package/dist/lib/entity/getters/entity-globe.js +211 -211
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +53 -53
- package/dist/lib/import/import-csv.js +23 -23
- package/dist/lib/import/import-json.js +23 -23
- package/dist/lib/import/import-kml.js +23 -23
- package/dist/lib/import/imported-file.js +91 -91
- package/dist/lib/internal/uploader.js +76 -76
- package/dist/lib/markup/markup.js +185 -185
- package/dist/lib/plugin/plugin.js +83 -83
- package/dist/lib/program-key/program-key.js +111 -111
- package/dist/lib/project/menu-item.js +121 -121
- package/dist/lib/project/project-view-bookmark.js +147 -147
- package/dist/lib/project/project-view-legacy-tile.js +77 -77
- package/dist/lib/project/project-view-tile.js +125 -125
- package/dist/lib/project/project-view.js +133 -133
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/message-broker.js +142 -142
- package/dist/lib/server/pending-action.js +71 -71
- package/dist/lib/server/task.js +63 -63
- package/dist/lib/style/style.js +117 -117
- package/dist/lib/tileset/tileset.js +415 -415
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +137 -137
- package/dist/lib/user/user-group.js +94 -94
- package/dist/lib/user/user.js +446 -446
- package/dist/lib/util/encrypt-utils.js +19 -19
- package/dist/lib/util/math-utils.js +40 -40
- package/dist/lib/util/object-utils.js +17 -17
- package/dist/lib/util/path-utils.js +61 -61
- package/dist/lib/util/url-utils.js +94 -94
- package/package.json +3 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EncryptUtils = void 0;
|
|
4
|
-
var EncryptUtils;
|
|
5
|
-
(function (EncryptUtils) {
|
|
6
|
-
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
7
|
-
function Cyrb53Hash(str, seed = 0) {
|
|
8
|
-
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
9
|
-
for (let i = 0, ch; i < str.length; i++) {
|
|
10
|
-
ch = str.charCodeAt(i);
|
|
11
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
12
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
13
|
-
}
|
|
14
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
15
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
16
|
-
return (4294967296 * (2097151 & h2) + (h1 >>> 0));
|
|
17
|
-
}
|
|
18
|
-
EncryptUtils.Cyrb53Hash = Cyrb53Hash;
|
|
19
|
-
})(EncryptUtils = exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EncryptUtils = void 0;
|
|
4
|
+
var EncryptUtils;
|
|
5
|
+
(function (EncryptUtils) {
|
|
6
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
7
|
+
function Cyrb53Hash(str, seed = 0) {
|
|
8
|
+
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
9
|
+
for (let i = 0, ch; i < str.length; i++) {
|
|
10
|
+
ch = str.charCodeAt(i);
|
|
11
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
12
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
13
|
+
}
|
|
14
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
15
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
16
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0));
|
|
17
|
+
}
|
|
18
|
+
EncryptUtils.Cyrb53Hash = Cyrb53Hash;
|
|
19
|
+
})(EncryptUtils = exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
20
20
|
//# sourceMappingURL=encrypt-utils.js.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MathUtils = void 0;
|
|
4
|
-
var MathUtils;
|
|
5
|
-
(function (MathUtils) {
|
|
6
|
-
/**
|
|
7
|
-
* Rounds a number to a given number of decimal places.
|
|
8
|
-
* @param num
|
|
9
|
-
* @param decimals
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
function Round(num, decimals = 0) {
|
|
13
|
-
if (decimals <= 0) {
|
|
14
|
-
return Math.round(num);
|
|
15
|
-
}
|
|
16
|
-
let tmp = "1";
|
|
17
|
-
for (let i = 0; i < decimals; i++) {
|
|
18
|
-
tmp += "0";
|
|
19
|
-
}
|
|
20
|
-
const d = parseFloat(tmp);
|
|
21
|
-
return Math.round((num + Number.EPSILON) * d) / d;
|
|
22
|
-
}
|
|
23
|
-
MathUtils.Round = Round;
|
|
24
|
-
/**
|
|
25
|
-
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
26
|
-
* @param min
|
|
27
|
-
* @param max
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
function RandInt(min, max) {
|
|
31
|
-
if (min == max) {
|
|
32
|
-
return min;
|
|
33
|
-
}
|
|
34
|
-
else if (min > max) {
|
|
35
|
-
throw ("Min is greater than max.");
|
|
36
|
-
}
|
|
37
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
38
|
-
}
|
|
39
|
-
MathUtils.RandInt = RandInt;
|
|
40
|
-
})(MathUtils = exports.MathUtils || (exports.MathUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MathUtils = void 0;
|
|
4
|
+
var MathUtils;
|
|
5
|
+
(function (MathUtils) {
|
|
6
|
+
/**
|
|
7
|
+
* Rounds a number to a given number of decimal places.
|
|
8
|
+
* @param num
|
|
9
|
+
* @param decimals
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
function Round(num, decimals = 0) {
|
|
13
|
+
if (decimals <= 0) {
|
|
14
|
+
return Math.round(num);
|
|
15
|
+
}
|
|
16
|
+
let tmp = "1";
|
|
17
|
+
for (let i = 0; i < decimals; i++) {
|
|
18
|
+
tmp += "0";
|
|
19
|
+
}
|
|
20
|
+
const d = parseFloat(tmp);
|
|
21
|
+
return Math.round((num + Number.EPSILON) * d) / d;
|
|
22
|
+
}
|
|
23
|
+
MathUtils.Round = Round;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
26
|
+
* @param min
|
|
27
|
+
* @param max
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
function RandInt(min, max) {
|
|
31
|
+
if (min == max) {
|
|
32
|
+
return min;
|
|
33
|
+
}
|
|
34
|
+
else if (min > max) {
|
|
35
|
+
throw ("Min is greater than max.");
|
|
36
|
+
}
|
|
37
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
38
|
+
}
|
|
39
|
+
MathUtils.RandInt = RandInt;
|
|
40
|
+
})(MathUtils = exports.MathUtils || (exports.MathUtils = {}));
|
|
41
41
|
//# sourceMappingURL=math-utils.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectUtils = void 0;
|
|
4
|
-
var ObjectUtils;
|
|
5
|
-
(function (ObjectUtils) {
|
|
6
|
-
/**
|
|
7
|
-
* Generates a Bruce compatible UID.
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
function UId() {
|
|
11
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
12
|
-
const r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
|
|
13
|
-
return v.toString(16);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
ObjectUtils.UId = UId;
|
|
17
|
-
})(ObjectUtils = exports.ObjectUtils || (exports.ObjectUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectUtils = void 0;
|
|
4
|
+
var ObjectUtils;
|
|
5
|
+
(function (ObjectUtils) {
|
|
6
|
+
/**
|
|
7
|
+
* Generates a Bruce compatible UID.
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
function UId() {
|
|
11
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
12
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
|
|
13
|
+
return v.toString(16);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
ObjectUtils.UId = UId;
|
|
17
|
+
})(ObjectUtils = exports.ObjectUtils || (exports.ObjectUtils = {}));
|
|
18
18
|
//# sourceMappingURL=object-utils.js.map
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PathUtils = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility to help with parsing and wrapping Bruce paths.
|
|
6
|
-
*/
|
|
7
|
-
var PathUtils;
|
|
8
|
-
(function (PathUtils) {
|
|
9
|
-
function Parse(str) {
|
|
10
|
-
if (!str) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
const broken = str.split("\"/\"");
|
|
14
|
-
if (broken.length > 0) {
|
|
15
|
-
let top = broken[0];
|
|
16
|
-
if (top.length > 0) {
|
|
17
|
-
if (top.charAt(0) == "\"") {
|
|
18
|
-
top = top.substring(1);
|
|
19
|
-
}
|
|
20
|
-
broken[0] = top;
|
|
21
|
-
}
|
|
22
|
-
const endIndex = broken.length - 1;
|
|
23
|
-
let bot = broken[endIndex];
|
|
24
|
-
if (bot.length > 0) {
|
|
25
|
-
if (bot.charAt(bot.length - 1) == "\"") {
|
|
26
|
-
bot = bot.substring(0, bot.length - 1);
|
|
27
|
-
}
|
|
28
|
-
broken[endIndex] = bot;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return broken;
|
|
32
|
-
}
|
|
33
|
-
PathUtils.Parse = Parse;
|
|
34
|
-
function Wrap(path) {
|
|
35
|
-
let tmp = "\"";
|
|
36
|
-
for (let i = 0; i < path.length; i++) {
|
|
37
|
-
let section = path[i];
|
|
38
|
-
tmp += section;
|
|
39
|
-
if (i < path.length - 1) {
|
|
40
|
-
tmp += "\"/\"";
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
tmp += "\"";
|
|
44
|
-
return tmp;
|
|
45
|
-
}
|
|
46
|
-
PathUtils.Wrap = Wrap;
|
|
47
|
-
function ParseLegacy(str) {
|
|
48
|
-
const broken = str.split(".");
|
|
49
|
-
for (let i = 0; i < broken.length; i++) {
|
|
50
|
-
let piece = broken[0];
|
|
51
|
-
if (piece.charAt(0) == "\"") {
|
|
52
|
-
piece = broken[0] = piece.substring(1);
|
|
53
|
-
}
|
|
54
|
-
if (piece.charAt(piece.length - 1) == "\"") {
|
|
55
|
-
broken[0] = piece.substring(0, piece.length - 1);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return broken;
|
|
59
|
-
}
|
|
60
|
-
PathUtils.ParseLegacy = ParseLegacy;
|
|
61
|
-
})(PathUtils = exports.PathUtils || (exports.PathUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PathUtils = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility to help with parsing and wrapping Bruce paths.
|
|
6
|
+
*/
|
|
7
|
+
var PathUtils;
|
|
8
|
+
(function (PathUtils) {
|
|
9
|
+
function Parse(str) {
|
|
10
|
+
if (!str) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const broken = str.split("\"/\"");
|
|
14
|
+
if (broken.length > 0) {
|
|
15
|
+
let top = broken[0];
|
|
16
|
+
if (top.length > 0) {
|
|
17
|
+
if (top.charAt(0) == "\"") {
|
|
18
|
+
top = top.substring(1);
|
|
19
|
+
}
|
|
20
|
+
broken[0] = top;
|
|
21
|
+
}
|
|
22
|
+
const endIndex = broken.length - 1;
|
|
23
|
+
let bot = broken[endIndex];
|
|
24
|
+
if (bot.length > 0) {
|
|
25
|
+
if (bot.charAt(bot.length - 1) == "\"") {
|
|
26
|
+
bot = bot.substring(0, bot.length - 1);
|
|
27
|
+
}
|
|
28
|
+
broken[endIndex] = bot;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return broken;
|
|
32
|
+
}
|
|
33
|
+
PathUtils.Parse = Parse;
|
|
34
|
+
function Wrap(path) {
|
|
35
|
+
let tmp = "\"";
|
|
36
|
+
for (let i = 0; i < path.length; i++) {
|
|
37
|
+
let section = path[i];
|
|
38
|
+
tmp += section;
|
|
39
|
+
if (i < path.length - 1) {
|
|
40
|
+
tmp += "\"/\"";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
tmp += "\"";
|
|
44
|
+
return tmp;
|
|
45
|
+
}
|
|
46
|
+
PathUtils.Wrap = Wrap;
|
|
47
|
+
function ParseLegacy(str) {
|
|
48
|
+
const broken = str.split(".");
|
|
49
|
+
for (let i = 0; i < broken.length; i++) {
|
|
50
|
+
let piece = broken[0];
|
|
51
|
+
if (piece.charAt(0) == "\"") {
|
|
52
|
+
piece = broken[0] = piece.substring(1);
|
|
53
|
+
}
|
|
54
|
+
if (piece.charAt(piece.length - 1) == "\"") {
|
|
55
|
+
broken[0] = piece.substring(0, piece.length - 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return broken;
|
|
59
|
+
}
|
|
60
|
+
PathUtils.ParseLegacy = ParseLegacy;
|
|
61
|
+
})(PathUtils = exports.PathUtils || (exports.PathUtils = {}));
|
|
62
62
|
//# sourceMappingURL=path-utils.js.map
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UrlUtils = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility to help with url manipulation.
|
|
6
|
-
*/
|
|
7
|
-
var UrlUtils;
|
|
8
|
-
(function (UrlUtils) {
|
|
9
|
-
function GetQueryString(doc) {
|
|
10
|
-
const qs = {};
|
|
11
|
-
const p0 = doc.location.href.indexOf("?");
|
|
12
|
-
if (p0 >= 0) {
|
|
13
|
-
const str = doc.location.href.substring(p0 + 1);
|
|
14
|
-
const tokens = str.split("&");
|
|
15
|
-
tokens.forEach(token => {
|
|
16
|
-
const p = token.split("=");
|
|
17
|
-
if (p.length == 2) {
|
|
18
|
-
qs[p[0]] = p[1];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return qs;
|
|
23
|
-
}
|
|
24
|
-
UrlUtils.GetQueryString = GetQueryString;
|
|
25
|
-
/**
|
|
26
|
-
* Helper to get and set url params for a given window.
|
|
27
|
-
*/
|
|
28
|
-
class Handler {
|
|
29
|
-
constructor(window, allowedKeys) {
|
|
30
|
-
this._allowedKeys = null;
|
|
31
|
-
this._window = window;
|
|
32
|
-
this._allowedKeys = allowedKeys;
|
|
33
|
-
}
|
|
34
|
-
get window() {
|
|
35
|
-
return this._window;
|
|
36
|
-
}
|
|
37
|
-
get document() {
|
|
38
|
-
var _a;
|
|
39
|
-
return (_a = this.window) === null || _a === void 0 ? void 0 : _a.document;
|
|
40
|
-
}
|
|
41
|
-
get allowedKeys() {
|
|
42
|
-
return this._allowedKeys;
|
|
43
|
-
}
|
|
44
|
-
UpdateAllowedKeys(allowedKeys) {
|
|
45
|
-
this._allowedKeys = allowedKeys;
|
|
46
|
-
let params = this.GetParams();
|
|
47
|
-
this.refresh(params);
|
|
48
|
-
}
|
|
49
|
-
UpdateParam(key, value) {
|
|
50
|
-
let params = this.GetParams();
|
|
51
|
-
params[key + ""] = value + "";
|
|
52
|
-
this.refresh(params);
|
|
53
|
-
}
|
|
54
|
-
RemoveParam(key) {
|
|
55
|
-
let params = this.GetParams();
|
|
56
|
-
params[key + ""] = null;
|
|
57
|
-
this.refresh(params);
|
|
58
|
-
}
|
|
59
|
-
GetParamKeys() {
|
|
60
|
-
let params = GetQueryString(this.document);
|
|
61
|
-
return Object.keys(params);
|
|
62
|
-
}
|
|
63
|
-
GetParams() {
|
|
64
|
-
return GetQueryString(this.document);
|
|
65
|
-
}
|
|
66
|
-
GetParam(key) {
|
|
67
|
-
let params = this.GetParams();
|
|
68
|
-
return params[key + ""];
|
|
69
|
-
}
|
|
70
|
-
Clear() {
|
|
71
|
-
this.refresh({});
|
|
72
|
-
}
|
|
73
|
-
refresh(urlParams) {
|
|
74
|
-
const params = [];
|
|
75
|
-
const keys = Object.keys(urlParams);
|
|
76
|
-
for (let i = 0; i < keys.length; i++) {
|
|
77
|
-
const key = keys[i];
|
|
78
|
-
if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
|
|
79
|
-
const val = urlParams[key];
|
|
80
|
-
if (!!val || val == 0) {
|
|
81
|
-
params.push(`${key}=${val}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (params.length > 0) {
|
|
86
|
-
this.window.history.replaceState({}, null, "?" + params.join("&"));
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
this.window.history.replaceState({}, null, "");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
UrlUtils.Handler = Handler;
|
|
94
|
-
})(UrlUtils = exports.UrlUtils || (exports.UrlUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UrlUtils = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility to help with url manipulation.
|
|
6
|
+
*/
|
|
7
|
+
var UrlUtils;
|
|
8
|
+
(function (UrlUtils) {
|
|
9
|
+
function GetQueryString(doc) {
|
|
10
|
+
const qs = {};
|
|
11
|
+
const p0 = doc.location.href.indexOf("?");
|
|
12
|
+
if (p0 >= 0) {
|
|
13
|
+
const str = doc.location.href.substring(p0 + 1);
|
|
14
|
+
const tokens = str.split("&");
|
|
15
|
+
tokens.forEach(token => {
|
|
16
|
+
const p = token.split("=");
|
|
17
|
+
if (p.length == 2) {
|
|
18
|
+
qs[p[0]] = p[1];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return qs;
|
|
23
|
+
}
|
|
24
|
+
UrlUtils.GetQueryString = GetQueryString;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to get and set url params for a given window.
|
|
27
|
+
*/
|
|
28
|
+
class Handler {
|
|
29
|
+
constructor(window, allowedKeys) {
|
|
30
|
+
this._allowedKeys = null;
|
|
31
|
+
this._window = window;
|
|
32
|
+
this._allowedKeys = allowedKeys;
|
|
33
|
+
}
|
|
34
|
+
get window() {
|
|
35
|
+
return this._window;
|
|
36
|
+
}
|
|
37
|
+
get document() {
|
|
38
|
+
var _a;
|
|
39
|
+
return (_a = this.window) === null || _a === void 0 ? void 0 : _a.document;
|
|
40
|
+
}
|
|
41
|
+
get allowedKeys() {
|
|
42
|
+
return this._allowedKeys;
|
|
43
|
+
}
|
|
44
|
+
UpdateAllowedKeys(allowedKeys) {
|
|
45
|
+
this._allowedKeys = allowedKeys;
|
|
46
|
+
let params = this.GetParams();
|
|
47
|
+
this.refresh(params);
|
|
48
|
+
}
|
|
49
|
+
UpdateParam(key, value) {
|
|
50
|
+
let params = this.GetParams();
|
|
51
|
+
params[key + ""] = value + "";
|
|
52
|
+
this.refresh(params);
|
|
53
|
+
}
|
|
54
|
+
RemoveParam(key) {
|
|
55
|
+
let params = this.GetParams();
|
|
56
|
+
params[key + ""] = null;
|
|
57
|
+
this.refresh(params);
|
|
58
|
+
}
|
|
59
|
+
GetParamKeys() {
|
|
60
|
+
let params = GetQueryString(this.document);
|
|
61
|
+
return Object.keys(params);
|
|
62
|
+
}
|
|
63
|
+
GetParams() {
|
|
64
|
+
return GetQueryString(this.document);
|
|
65
|
+
}
|
|
66
|
+
GetParam(key) {
|
|
67
|
+
let params = this.GetParams();
|
|
68
|
+
return params[key + ""];
|
|
69
|
+
}
|
|
70
|
+
Clear() {
|
|
71
|
+
this.refresh({});
|
|
72
|
+
}
|
|
73
|
+
refresh(urlParams) {
|
|
74
|
+
const params = [];
|
|
75
|
+
const keys = Object.keys(urlParams);
|
|
76
|
+
for (let i = 0; i < keys.length; i++) {
|
|
77
|
+
const key = keys[i];
|
|
78
|
+
if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
|
|
79
|
+
const val = urlParams[key];
|
|
80
|
+
if (!!val || val == 0) {
|
|
81
|
+
params.push(`${key}=${val}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (params.length > 0) {
|
|
86
|
+
this.window.history.replaceState({}, null, "?" + params.join("&"));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.window.history.replaceState({}, null, "");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
UrlUtils.Handler = Handler;
|
|
94
|
+
})(UrlUtils = exports.UrlUtils || (exports.UrlUtils = {}));
|
|
95
95
|
//# sourceMappingURL=url-utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bruce-models",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "dist/bruce-models.umd.js",
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
"ts-jest": "^23.10.2",
|
|
67
67
|
"ts-node": "^7.0.1",
|
|
68
68
|
"typedoc": "^0.12.0",
|
|
69
|
-
"typescript": "^3.9.10"
|
|
69
|
+
"typescript": "^3.9.10",
|
|
70
|
+
"ws": "^8.13.0"
|
|
70
71
|
},
|
|
71
72
|
"dependencies": {
|
|
72
73
|
"isomorphic-fetch": "^3.0.0",
|