bruce-models 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4848,5 +4848,104 @@ var MathUtils;
4848
4848
  MathUtils.RandInt = RandInt;
4849
4849
  })(MathUtils || (MathUtils = {}));
4850
4850
 
4851
- export { AnnDocument, AbstractApi, Api, BruceApi, CamApi, IdmApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, EncryptUtils, MathUtils, ObjectUtils, PathUtils };
4851
+ var UrlUtils;
4852
+ (function (UrlUtils) {
4853
+ function GetQueryString(doc) {
4854
+ var qs = {};
4855
+ var p0 = doc.location.href.indexOf("?");
4856
+ if (p0 >= 0) {
4857
+ var str = doc.location.href.substring(p0 + 1);
4858
+ var tokens = str.split("&");
4859
+ tokens.forEach(function (token) {
4860
+ var p = token.split("=");
4861
+ if (p.length == 2) {
4862
+ qs[p[0]] = p[1];
4863
+ }
4864
+ });
4865
+ }
4866
+ return qs;
4867
+ }
4868
+ UrlUtils.GetQueryString = GetQueryString;
4869
+ var Handler = /** @class */ (function () {
4870
+ function Handler(window, allowedKeys) {
4871
+ this._allowedKeys = null;
4872
+ this._window = window;
4873
+ this._allowedKeys = allowedKeys;
4874
+ }
4875
+ Object.defineProperty(Handler.prototype, "window", {
4876
+ get: function () {
4877
+ return this._window;
4878
+ },
4879
+ enumerable: false,
4880
+ configurable: true
4881
+ });
4882
+ Object.defineProperty(Handler.prototype, "document", {
4883
+ get: function () {
4884
+ var _a;
4885
+ return (_a = this.window) === null || _a === void 0 ? void 0 : _a.document;
4886
+ },
4887
+ enumerable: false,
4888
+ configurable: true
4889
+ });
4890
+ Object.defineProperty(Handler.prototype, "allowedKeys", {
4891
+ get: function () {
4892
+ return this._allowedKeys;
4893
+ },
4894
+ enumerable: false,
4895
+ configurable: true
4896
+ });
4897
+ Handler.prototype.UpdateAllowedKeys = function (allowedKeys) {
4898
+ this._allowedKeys = allowedKeys;
4899
+ var params = this.GetParams();
4900
+ this.refresh(params);
4901
+ };
4902
+ Handler.prototype.UpdateParam = function (key, value) {
4903
+ var params = this.GetParams();
4904
+ params[key + ""] = value + "";
4905
+ this.refresh(params);
4906
+ };
4907
+ Handler.prototype.RemoveParam = function (key) {
4908
+ var params = this.GetParams();
4909
+ params[key + ""] = null;
4910
+ this.refresh(params);
4911
+ };
4912
+ Handler.prototype.GetParamKeys = function () {
4913
+ var params = GetQueryString(this.document);
4914
+ return Object.keys(params);
4915
+ };
4916
+ Handler.prototype.GetParams = function () {
4917
+ return GetQueryString(this.document);
4918
+ };
4919
+ Handler.prototype.GetParam = function (key) {
4920
+ var params = this.GetParams();
4921
+ return params[key + ""];
4922
+ };
4923
+ Handler.prototype.Clear = function () {
4924
+ this.refresh({});
4925
+ };
4926
+ Handler.prototype.refresh = function (data) {
4927
+ var params = [];
4928
+ var keys = Object.keys(data);
4929
+ for (var i = 0; i < keys.length; i++) {
4930
+ var key = keys[i];
4931
+ if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
4932
+ var val = data[key];
4933
+ if (!!val || val == 0) {
4934
+ params.push(key + "=" + val);
4935
+ }
4936
+ }
4937
+ }
4938
+ if (params.length > 0) {
4939
+ this.window.history.replaceState({}, null, "?" + params.join("&"));
4940
+ }
4941
+ else {
4942
+ this.window.history.replaceState({}, null, "");
4943
+ }
4944
+ };
4945
+ return Handler;
4946
+ }());
4947
+ UrlUtils.Handler = Handler;
4948
+ })(UrlUtils || (UrlUtils = {}));
4949
+
4950
+ export { AnnDocument, AbstractApi, Api, BruceApi, CamApi, IdmApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils };
4852
4951
  //# sourceMappingURL=bruce-models.es5.js.map