bruce-models 6.4.9 → 6.5.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-models.es5.js +42 -4
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +42 -4
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/calculator/calculator.js +41 -3
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -5052,7 +5052,45 @@ var Calculator;
|
|
|
5052
5052
|
}
|
|
5053
5053
|
for (let i = 0; i < value.values.length; i++) {
|
|
5054
5054
|
const option = value.values[i];
|
|
5055
|
-
|
|
5055
|
+
let mapValue = option.fieldValue;
|
|
5056
|
+
// If mapValue is prefixed with "JS:", we evaluate it as JavaScript.
|
|
5057
|
+
// This lets us do things like JS:Boolean("${}") as a quick way to map 'existence' to a target value.
|
|
5058
|
+
if (typeof mapValue === "string" && mapValue.startsWith("JS:")) {
|
|
5059
|
+
try {
|
|
5060
|
+
let jsEval = mapValue.replace("JS:", "").trim();
|
|
5061
|
+
const attrPathStr = PathUtils.Wrap(attrPath);
|
|
5062
|
+
jsEval = jsEval.replace("${}", "${" + attrPathStr + "}");
|
|
5063
|
+
jsEval = BruceVariable.SwapValues({
|
|
5064
|
+
str: jsEval,
|
|
5065
|
+
entity: entity
|
|
5066
|
+
});
|
|
5067
|
+
// https://rollupjs.org/guide/en/#avoiding-eval
|
|
5068
|
+
// This stops eval warning.
|
|
5069
|
+
const eval2 = eval;
|
|
5070
|
+
mapValue = eval2(jsEval);
|
|
5071
|
+
// We currently expect eval to return a validity bool.
|
|
5072
|
+
// So it either matches and we return it, or it doesn't and we continue.
|
|
5073
|
+
if (mapValue) {
|
|
5074
|
+
return option.appliedValue;
|
|
5075
|
+
}
|
|
5076
|
+
else {
|
|
5077
|
+
continue;
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
catch (exception) {
|
|
5081
|
+
const e = exception;
|
|
5082
|
+
let suppress = false;
|
|
5083
|
+
if (e && typeof e == "object") {
|
|
5084
|
+
const msg = e.message;
|
|
5085
|
+
suppress = !!msg && (msg.includes("Unexpected end") || msg.includes("got end of script"));
|
|
5086
|
+
}
|
|
5087
|
+
if (!suppress) {
|
|
5088
|
+
console.error(e);
|
|
5089
|
+
}
|
|
5090
|
+
// Eval failed, therefor not a valid mapping-row.
|
|
5091
|
+
continue;
|
|
5092
|
+
}
|
|
5093
|
+
}
|
|
5056
5094
|
let isMapValueNum = !isNaN(+mapValue);
|
|
5057
5095
|
if (isMapValueNum == null) {
|
|
5058
5096
|
isMapValueNum = false;
|
|
@@ -5089,7 +5127,7 @@ var Calculator;
|
|
|
5089
5127
|
// Common as mapping value is typically a user-entered string.
|
|
5090
5128
|
else if (typeof eValue === "boolean" && typeof mapValue === "string") {
|
|
5091
5129
|
const eValueStr = eValue ? "true" : "false";
|
|
5092
|
-
if (mapValue == eValueStr) {
|
|
5130
|
+
if (mapValue.toLowerCase() == eValueStr) {
|
|
5093
5131
|
return option.appliedValue;
|
|
5094
5132
|
}
|
|
5095
5133
|
}
|
|
@@ -5097,7 +5135,7 @@ var Calculator;
|
|
|
5097
5135
|
// Have not seen this happen yet, but preparing for any future cases.
|
|
5098
5136
|
else if (typeof mapValue === "boolean" && typeof eValue === "string") {
|
|
5099
5137
|
const mapValueStr = mapValue ? "true" : "false";
|
|
5100
|
-
if (mapValueStr == eValue) {
|
|
5138
|
+
if (mapValueStr == eValue.toLowerCase()) {
|
|
5101
5139
|
return option.appliedValue;
|
|
5102
5140
|
}
|
|
5103
5141
|
}
|
|
@@ -16109,7 +16147,7 @@ var Tracking;
|
|
|
16109
16147
|
})(Tracking || (Tracking = {}));
|
|
16110
16148
|
|
|
16111
16149
|
// This is updated with the package.json version on build.
|
|
16112
|
-
const VERSION = "6.
|
|
16150
|
+
const VERSION = "6.5.0";
|
|
16113
16151
|
|
|
16114
16152
|
export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking };
|
|
16115
16153
|
//# sourceMappingURL=bruce-models.es5.js.map
|