bruce-cesium 4.2.8 → 4.3.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/dist/bruce-cesium.es5.js +127 -13
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +125 -11
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/widgets/widget-left-panel.js +124 -10
- package/dist/lib/widgets/widget-left-panel.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/widgets/widget-left-panel.d.ts +10 -1
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -23107,6 +23107,16 @@
|
|
|
23107
23107
|
enumerable: false,
|
|
23108
23108
|
configurable: true
|
|
23109
23109
|
});
|
|
23110
|
+
Object.defineProperty(WidgetLeftPanel.prototype, "OnBookmarkSelect", {
|
|
23111
|
+
get: function () {
|
|
23112
|
+
if (this._onBookmarkSelect == null) {
|
|
23113
|
+
this._onBookmarkSelect = new BModels.BruceEvent();
|
|
23114
|
+
}
|
|
23115
|
+
return this._onBookmarkSelect;
|
|
23116
|
+
},
|
|
23117
|
+
enumerable: false,
|
|
23118
|
+
configurable: true
|
|
23119
|
+
});
|
|
23110
23120
|
Object.defineProperty(WidgetLeftPanel.prototype, "Loading", {
|
|
23111
23121
|
get: function () {
|
|
23112
23122
|
return this._loading;
|
|
@@ -23157,6 +23167,10 @@
|
|
|
23157
23167
|
};
|
|
23158
23168
|
WidgetLeftPanel.prototype.Dispose = function () {
|
|
23159
23169
|
_super.prototype.Dispose.call(this);
|
|
23170
|
+
if (this.envSubRemoval) {
|
|
23171
|
+
this.envSubRemoval();
|
|
23172
|
+
this.envSubRemoval = null;
|
|
23173
|
+
}
|
|
23160
23174
|
if (this._enabledTabContent) {
|
|
23161
23175
|
this._enabledTabContent.Dispose();
|
|
23162
23176
|
this._enabledTabContent = null;
|
|
@@ -23169,21 +23183,36 @@
|
|
|
23169
23183
|
}
|
|
23170
23184
|
var style = document.createElement("style");
|
|
23171
23185
|
style.id = this.STYLESHEET_ID;
|
|
23172
|
-
style.innerHTML = "\n .NextspaceLeftPanel {\n align-items: center;\n background-color: #21272a;\n cursor: default;\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n height: 100%;\n padding-
|
|
23186
|
+
style.innerHTML = "\n .NextspaceLeftPanel {\n align-items: center;\n background-color: #21272a;\n cursor: default;\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n height: 100%;\n padding-top: 15px;\n position: absolute;\n width: 50px;\n z-index: 1;\n top: 0;\n left: 0;\n box-sizing: border-box;\n }\n\n .NextspaceLeftPanel * {\n box-sizing: border-box;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelBreaker {\n background-color: hsla(0,0%,50%,.231);\n flex-shrink: 0;\n height: 2px;\n margin-bottom: 15px;\n width: calc(100% - 8px);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelBottomBreaker {\n margin-top: auto;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton {\n border-radius: 3px;\n color: #fff;\n cursor: pointer;\n font-size: 18px;\n height: 32px;\n overflow: hidden;\n width: 32px;\n margin-bottom: 15px;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton:first-of-type {\n margin-bottom: 8px;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon {\n align-items: center;\n display: flex;\n justify-content: center;\n position: relative;\n transition: .3s ease;\n height: 100%;\n width: 100%;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon:hover {\n transform: scale(1.2);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[no-content=\"true\"] {\n cursor: default;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[no-content=\"true\"] >.NextspaceLeftPanelButtonIcon:hover {\n transform: none;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon >svg {\n cursor: pointer;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled=\"true\"] >.NextspaceLeftPanelButtonIcon {\n background-color: #fff;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled=\"true\"] >.NextspaceLeftPanelButtonIcon >svg {\n filter: invert(1);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-disabled=\"true\"] {\n opacity: .5;\n pointer-events: none\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelTabContent {\n display: none;\n width: 300px;\n height: 100%;\n position: absolute;\n top: 0;\n left: 50px;\n background-color: #21272a;\n padding: 40px 30px 30px;\n flex-direction: column;\n flex-grow: 1;\n flex-shrink: 1;\n overflow: hidden;\n }\n\n .NextspaceLeftPanel .NextspaceLeftPanelTabContentCloseButton {\n color: #fff;\n cursor: pointer;\n opacity: .7;\n position: absolute;\n right: 22px;\n top: 14px;\n transition: transform .3s ease;\n z-index: 1;\n }\n\n .NextspaceLeftPanel .NextspaceLeftPanelTabContentCloseButton:hover {\n transform: scale(1.2);\n }\n ";
|
|
23173
23187
|
document.head.appendChild(style);
|
|
23174
23188
|
};
|
|
23175
23189
|
WidgetLeftPanel.prototype._generateElement = function () {
|
|
23190
|
+
var _this = this;
|
|
23176
23191
|
var element = document.createElement("div");
|
|
23177
23192
|
element.className = "NextspaceLeftPanel";
|
|
23178
23193
|
this.Container.appendChild(element);
|
|
23179
23194
|
this._element = element;
|
|
23180
|
-
this._addPlaceholderTab("Dashboard", "\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11 9C11 10.1046 10.1046 11 9 11C7.89543 11 7 10.1046 7 9C7 7.89543 7.89543 7 9 7C10.1046 7 11 7.89543 11 9ZM18 9C18 10.1046 17.1046 11 16 11C14.8954 11 14 10.1046 14 9C14 7.89543 14.8954 7 16 7C17.1046 7 18 7.89543 18 9ZM23 11C24.1046 11 25 10.1046 25 9C25 7.89543 24.1046 7 23 7C21.8954 7 21 7.89543 21 9C21 10.1046 21.8954 11 23 11ZM11 16C11 17.1046 10.1046 18 9 18C7.89543 18 7 17.1046 7 16C7 14.8954 7.89543 14 9 14C10.1046 14 11 14.8954 11 16ZM9 25C10.1046 25 11 24.1046 11 23C11 21.8954 10.1046 21 9 21C7.89543 21 7 21.8954 7 23C7 24.1046 7.89543 25 9 25ZM18 16C18 17.1046 17.1046 18 16 18C14.8954 18 14 17.1046 14 16C14 14.8954 14.8954 14 16 14C17.1046 14 18 14.8954 18 16ZM16 25C17.1046 25 18 24.1046 18 23C18 21.8954 17.1046 21 16 21C14.8954 21 14 21.8954 14 23C14 24.1046 14.8954 25 16 25ZM25 16C25 17.1046 24.1046 18 23 18C21.8954 18 21 17.1046 21 16C21 14.8954 21.8954 14 23 14C24.1046 14 25 14.8954 25 16ZM23 25C24.1046 25 25 24.1046 25 23C25 21.8954 24.1046 21 23 21C21.8954 21 21 21.8954 21 23C21 24.1046 21.8954 25 23 25Z\" fill=\"white\"></path>\n ");
|
|
23195
|
+
this._addPlaceholderTab("Dashboard", "\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11 9C11 10.1046 10.1046 11 9 11C7.89543 11 7 10.1046 7 9C7 7.89543 7.89543 7 9 7C10.1046 7 11 7.89543 11 9ZM18 9C18 10.1046 17.1046 11 16 11C14.8954 11 14 10.1046 14 9C14 7.89543 14.8954 7 16 7C17.1046 7 18 7.89543 18 9ZM23 11C24.1046 11 25 10.1046 25 9C25 7.89543 24.1046 7 23 7C21.8954 7 21 7.89543 21 9C21 10.1046 21.8954 11 23 11ZM11 16C11 17.1046 10.1046 18 9 18C7.89543 18 7 17.1046 7 16C7 14.8954 7.89543 14 9 14C10.1046 14 11 14.8954 11 16ZM9 25C10.1046 25 11 24.1046 11 23C11 21.8954 10.1046 21 9 21C7.89543 21 7 21.8954 7 23C7 24.1046 7.89543 25 9 25ZM18 16C18 17.1046 17.1046 18 16 18C14.8954 18 14 17.1046 14 16C14 14.8954 14.8954 14 16 14C17.1046 14 18 14.8954 18 16ZM16 25C17.1046 25 18 24.1046 18 23C18 21.8954 17.1046 21 16 21C14.8954 21 14 21.8954 14 23C14 24.1046 14.8954 25 16 25ZM25 16C25 17.1046 24.1046 18 23 18C21.8954 18 21 17.1046 21 16C21 14.8954 21.8954 14 23 14C24.1046 14 25 14.8954 25 16ZM23 25C24.1046 25 25 24.1046 25 23C25 21.8954 24.1046 21 23 21C21.8954 21 21 21.8954 21 23C21 24.1046 21.8954 25 23 25Z\" fill=\"white\"></path>\n </svg>\n ");
|
|
23181
23196
|
var breaker = document.createElement("div");
|
|
23182
23197
|
breaker.className = "NextspaceLeftPanelBreaker";
|
|
23183
23198
|
this._element.appendChild(breaker);
|
|
23184
|
-
this._addPanelTab("bookmarks", "Bookmarks", "\n <path d=\"M23 25V7H9V25L16 18L23 25Z\" fill=\"white\" stroke=\"white\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n ");
|
|
23199
|
+
this._addPanelTab("bookmarks", "Bookmarks", "\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M23 25V7H9V25L16 18L23 25Z\" fill=\"white\" stroke=\"white\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n ");
|
|
23200
|
+
var bottomBreaker = document.createElement("div");
|
|
23201
|
+
bottomBreaker.className = "NextspaceLeftPanelBottomBreaker";
|
|
23202
|
+
this._element.appendChild(bottomBreaker);
|
|
23203
|
+
this._addUserProfileTab();
|
|
23185
23204
|
var panelContent = document.createElement("div");
|
|
23186
23205
|
panelContent.className = "NextspaceLeftPanelTabContent";
|
|
23206
|
+
var panelContentCloseButton = document.createElement("div");
|
|
23207
|
+
panelContentCloseButton.setAttribute("title", "Close");
|
|
23208
|
+
panelContentCloseButton.className = "NextspaceLeftPanelTabContentCloseButton";
|
|
23209
|
+
panelContentCloseButton.innerHTML = "\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M18.3002 5.70973C17.9102 5.31973 17.2802 5.31973 16.8902 5.70973L12.0002 10.5897L7.11022 5.69973C6.72022 5.30973 6.09021 5.30973 5.70021 5.69973C5.31021 6.08973 5.31021 6.71973 5.70021 7.10973L10.5902 11.9997L5.70021 16.8897C5.31021 17.2797 5.31021 17.9097 5.70021 18.2997C6.09021 18.6897 6.72022 18.6897 7.11022 18.2997L12.0002 13.4097L16.8902 18.2997C17.2802 18.6897 17.9102 18.6897 18.3002 18.2997C18.6902 17.9097 18.6902 17.2797 18.3002 16.8897L13.4102 11.9997L18.3002 7.10973C18.6802 6.72973 18.6802 6.08973 18.3002 5.70973Z\" fill=\"white\"></path></svg>\n ";
|
|
23210
|
+
panelContentCloseButton.onclick = function () {
|
|
23211
|
+
_this._enabledPanelTab = "";
|
|
23212
|
+
_this._updatePanelContent();
|
|
23213
|
+
_this._updatePanelStyles();
|
|
23214
|
+
};
|
|
23215
|
+
panelContent.appendChild(panelContentCloseButton);
|
|
23187
23216
|
this._element.appendChild(panelContent);
|
|
23188
23217
|
this._updatePanelStyles();
|
|
23189
23218
|
};
|
|
@@ -23230,15 +23259,87 @@
|
|
|
23230
23259
|
tabButton.style.pointerEvents = "none";
|
|
23231
23260
|
var buttonBookmarksIcon = document.createElement("div");
|
|
23232
23261
|
buttonBookmarksIcon.className = "NextspaceLeftPanelButtonIcon";
|
|
23233
|
-
|
|
23234
|
-
buttonBookmarksIconSvg.setAttribute("viewBox", "0 0 32 32");
|
|
23235
|
-
buttonBookmarksIconSvg.setAttribute("width", "32");
|
|
23236
|
-
buttonBookmarksIconSvg.setAttribute("height", "32");
|
|
23237
|
-
buttonBookmarksIconSvg.innerHTML = svgStr;
|
|
23238
|
-
buttonBookmarksIcon.appendChild(buttonBookmarksIconSvg);
|
|
23262
|
+
buttonBookmarksIcon.innerHTML = svgStr;
|
|
23239
23263
|
tabButton.appendChild(buttonBookmarksIcon);
|
|
23240
23264
|
this._element.appendChild(tabButton);
|
|
23241
23265
|
};
|
|
23266
|
+
/**
|
|
23267
|
+
* User profile handled separately.
|
|
23268
|
+
* This is because for a while it will be just an indicator of logged in user session.
|
|
23269
|
+
* It won't have a tab content.
|
|
23270
|
+
*/
|
|
23271
|
+
WidgetLeftPanel.prototype._addUserProfileTab = function () {
|
|
23272
|
+
var tabButton = document.createElement("div");
|
|
23273
|
+
tabButton.className = "NextspaceLeftPanelButton";
|
|
23274
|
+
tabButton.setAttribute("title", "Not logged in");
|
|
23275
|
+
tabButton.setAttribute("no-content", "true");
|
|
23276
|
+
var buttonBookmarksIcon = document.createElement("div");
|
|
23277
|
+
buttonBookmarksIcon.className = "NextspaceLeftPanelButtonIcon";
|
|
23278
|
+
var LOGGED_OUT_ICON = "\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V19C4 19.55 4.45 20 5 20H19C19.55 20 20 19.55 20 19V18C20 15.34 14.67 14 12 14Z\" fill=\"white\"/>\n </svg>\n ";
|
|
23279
|
+
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
23280
|
+
tabButton.appendChild(buttonBookmarksIcon);
|
|
23281
|
+
this._element.appendChild(tabButton);
|
|
23282
|
+
function getInitials(name) {
|
|
23283
|
+
var nameSplit = name.split(" ");
|
|
23284
|
+
if (nameSplit.length > 1) {
|
|
23285
|
+
return nameSplit[0][0] + nameSplit[1][0];
|
|
23286
|
+
}
|
|
23287
|
+
else {
|
|
23288
|
+
return nameSplit[0][0];
|
|
23289
|
+
}
|
|
23290
|
+
}
|
|
23291
|
+
function GetColorForString(str) {
|
|
23292
|
+
var stringUniqueHash = [].concat(str).reduce(function (acc, char) { return char.charCodeAt(0) + ((acc << 5) - acc); }, 0);
|
|
23293
|
+
return "hsl(".concat(stringUniqueHash % 360, ", 95%, 35%)");
|
|
23294
|
+
}
|
|
23295
|
+
/**
|
|
23296
|
+
* Updates the tab button based on the current user session.
|
|
23297
|
+
*/
|
|
23298
|
+
function updateProfile() {
|
|
23299
|
+
var _a;
|
|
23300
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23301
|
+
var session, isLoggedIn, userName, initials, e_2;
|
|
23302
|
+
return __generator(this, function (_b) {
|
|
23303
|
+
switch (_b.label) {
|
|
23304
|
+
case 0:
|
|
23305
|
+
_b.trys.push([0, 2, , 3]);
|
|
23306
|
+
return [4 /*yield*/, BModels.Session.Get({
|
|
23307
|
+
sessionId: BModels.ENVIRONMENT.PARAMS.sessionId ? BModels.ENVIRONMENT.PARAMS.sessionId : "anonymous",
|
|
23308
|
+
})];
|
|
23309
|
+
case 1:
|
|
23310
|
+
session = (_b.sent()).session;
|
|
23311
|
+
isLoggedIn = session.ID != "anonymous" && ((_a = session.User) === null || _a === void 0 ? void 0 : _a.ID) != "anonymous";
|
|
23312
|
+
userName = session.User.FullName ? session.User.FullName : session.User.ID;
|
|
23313
|
+
tabButton.setAttribute("title", isLoggedIn ? userName : "Not logged in");
|
|
23314
|
+
// Draw a circle with the user's initials.
|
|
23315
|
+
if (isLoggedIn) {
|
|
23316
|
+
initials = getInitials(userName);
|
|
23317
|
+
buttonBookmarksIcon.innerHTML = "\n <div \n style=\"\n background-color: ".concat(GetColorForString(userName), "; \n color: white;\n border-radius: 50%;\n display: flex; \n align-items: center; \n justify-content: center; \n font-size: 12px;\n font-family: Arial;\n height: 100%; \n width: 100%;\">\n ").concat(initials, "\n </div>\n ");
|
|
23318
|
+
}
|
|
23319
|
+
else {
|
|
23320
|
+
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
23321
|
+
}
|
|
23322
|
+
return [3 /*break*/, 3];
|
|
23323
|
+
case 2:
|
|
23324
|
+
e_2 = _b.sent();
|
|
23325
|
+
console.error(e_2);
|
|
23326
|
+
tabButton.setAttribute("title", "Not logged in");
|
|
23327
|
+
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
23328
|
+
return [3 /*break*/, 3];
|
|
23329
|
+
case 3: return [2 /*return*/];
|
|
23330
|
+
}
|
|
23331
|
+
});
|
|
23332
|
+
});
|
|
23333
|
+
}
|
|
23334
|
+
if (this.envSubRemoval) {
|
|
23335
|
+
this.envSubRemoval();
|
|
23336
|
+
this.envSubRemoval = null;
|
|
23337
|
+
}
|
|
23338
|
+
this.envSubRemoval = BModels.ENVIRONMENT.OnParamsChange.Subscribe(function () {
|
|
23339
|
+
updateProfile();
|
|
23340
|
+
});
|
|
23341
|
+
updateProfile();
|
|
23342
|
+
};
|
|
23242
23343
|
/**
|
|
23243
23344
|
* Updates the panel styles based on the current state.
|
|
23244
23345
|
* Eg: if a tab is enabled, the button should be highlighted.
|
|
@@ -23247,8 +23348,14 @@
|
|
|
23247
23348
|
var _this = this;
|
|
23248
23349
|
var buttons = this._element.querySelectorAll(".NextspaceLeftPanelButton");
|
|
23249
23350
|
buttons.forEach(function (button) {
|
|
23250
|
-
var
|
|
23351
|
+
var buttonTab = button.getAttribute("widget-left-panel-tab");
|
|
23352
|
+
var isEnabled = buttonTab === _this._enabledPanelTab;
|
|
23251
23353
|
button.setAttribute("is-enabled", isEnabled ? "true" : "false");
|
|
23354
|
+
// Disable for specific tabs.
|
|
23355
|
+
// Eg: bookmarks require a viewId.
|
|
23356
|
+
if (buttonTab === "bookmarks") {
|
|
23357
|
+
button.setAttribute("is-disabled", !_this._viewId ? "true" : "false");
|
|
23358
|
+
}
|
|
23252
23359
|
});
|
|
23253
23360
|
// Make the tab content visible/invisible based on the current state.
|
|
23254
23361
|
var contentDisplayState = this._enabledPanelTab ? "flex" : "none";
|
|
@@ -23275,6 +23382,10 @@
|
|
|
23275
23382
|
});
|
|
23276
23383
|
break;
|
|
23277
23384
|
default:
|
|
23385
|
+
if (this.customTabs.has(this._enabledPanelTab) === false) {
|
|
23386
|
+
console.error("Tab ".concat(this._enabledPanelTab, " not found."));
|
|
23387
|
+
return;
|
|
23388
|
+
}
|
|
23278
23389
|
tabContent = new (this.customTabs.get(this._enabledPanelTab)({
|
|
23279
23390
|
widget: this,
|
|
23280
23391
|
container: container
|
|
@@ -23311,6 +23422,9 @@
|
|
|
23311
23422
|
viewer: this._viewer,
|
|
23312
23423
|
viewId: this._viewId
|
|
23313
23424
|
});
|
|
23425
|
+
if (this._onBookmarkSelect) {
|
|
23426
|
+
this._onBookmarkSelect.Trigger(bookmark);
|
|
23427
|
+
}
|
|
23314
23428
|
};
|
|
23315
23429
|
return WidgetLeftPanel;
|
|
23316
23430
|
}(exports.Widget.AWidget));
|
|
@@ -26236,7 +26350,7 @@
|
|
|
26236
26350
|
ViewerUtils.AssertIonToken = AssertIonToken;
|
|
26237
26351
|
})(exports.ViewerUtils || (exports.ViewerUtils = {}));
|
|
26238
26352
|
|
|
26239
|
-
var VERSION = "4.
|
|
26353
|
+
var VERSION = "4.3.0";
|
|
26240
26354
|
|
|
26241
26355
|
exports.VERSION = VERSION;
|
|
26242
26356
|
exports.CesiumParabola = CesiumParabola;
|