bruce-models 7.1.19 → 7.1.20
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 +137 -107
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +137 -107
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/calculator/calculator.js +136 -106
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/calculator/calculator.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -5249,136 +5249,166 @@ var Calculator;
|
|
|
5249
5249
|
if (type == "number" && field.type == EValueType.Color) {
|
|
5250
5250
|
field.type = EValueType.Input;
|
|
5251
5251
|
}
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
value = assertColor(value);
|
|
5259
|
-
if (value && type == "string") {
|
|
5260
|
-
value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
|
|
5252
|
+
// Custom resolution.
|
|
5253
|
+
if (field.value instanceof Function) {
|
|
5254
|
+
value = field.value(data, tags);
|
|
5255
|
+
if (type == "number") {
|
|
5256
|
+
if (typeof value == "string" && value != "" && value != null && value != undefined) {
|
|
5257
|
+
value = Number(value);
|
|
5261
5258
|
}
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
if (type === "number") {
|
|
5265
|
-
break;
|
|
5259
|
+
else if (typeof value != "number") {
|
|
5260
|
+
value = null;
|
|
5266
5261
|
}
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
if (value
|
|
5270
|
-
value =
|
|
5262
|
+
}
|
|
5263
|
+
else if (type == "string") {
|
|
5264
|
+
if (typeof value == "number") {
|
|
5265
|
+
value = String(value);
|
|
5271
5266
|
}
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5267
|
+
else if (typeof value == "object") {
|
|
5268
|
+
if (isColor(value)) {
|
|
5269
|
+
value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
|
|
5270
|
+
}
|
|
5271
|
+
else {
|
|
5272
|
+
value = null;
|
|
5273
|
+
}
|
|
5276
5274
|
}
|
|
5277
|
-
|
|
5275
|
+
}
|
|
5276
|
+
else if (type == "color") {
|
|
5278
5277
|
value = assertColor(value);
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5278
|
+
}
|
|
5279
|
+
}
|
|
5280
|
+
else {
|
|
5281
|
+
switch (field.type) {
|
|
5282
|
+
case EValueType.Color:
|
|
5283
|
+
if (type === "number") {
|
|
5284
|
+
break;
|
|
5285
|
+
}
|
|
5286
|
+
value = field.value;
|
|
5287
|
+
value = assertColor(value);
|
|
5288
|
+
if (value && type == "string") {
|
|
5289
|
+
value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
|
|
5290
|
+
}
|
|
5285
5291
|
break;
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
if (tag.Color) {
|
|
5290
|
-
value = Color.ColorFromStr(tag.Color);
|
|
5291
|
-
value = assertColor(value);
|
|
5292
|
-
if (value) {
|
|
5293
|
-
break;
|
|
5294
|
-
}
|
|
5292
|
+
case EValueType.Gradient:
|
|
5293
|
+
if (type === "number") {
|
|
5294
|
+
break;
|
|
5295
5295
|
}
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
if (type == "
|
|
5309
|
-
|
|
5310
|
-
value = Number(value);
|
|
5311
|
-
}
|
|
5312
|
-
else if (typeof value != "number") {
|
|
5313
|
-
value = null;
|
|
5314
|
-
}
|
|
5296
|
+
value = GetGradientValue(field.value, data, shouldRangesDefaultToMin);
|
|
5297
|
+
value = assertColor(value);
|
|
5298
|
+
if (value && type == "string") {
|
|
5299
|
+
value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
|
|
5300
|
+
}
|
|
5301
|
+
break;
|
|
5302
|
+
case EValueType.RandomColor:
|
|
5303
|
+
if (type === "number") {
|
|
5304
|
+
break;
|
|
5305
|
+
}
|
|
5306
|
+
value = Color.RandomColor();
|
|
5307
|
+
value = assertColor(value);
|
|
5308
|
+
if (value && type == "string") {
|
|
5309
|
+
value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
|
|
5315
5310
|
}
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5311
|
+
break;
|
|
5312
|
+
case EValueType.TagColor:
|
|
5313
|
+
if (type === "number") {
|
|
5314
|
+
break;
|
|
5315
|
+
}
|
|
5316
|
+
for (let i = 0; i < tags.length; i++) {
|
|
5317
|
+
const tag = tags[i];
|
|
5318
|
+
if (tag.Color) {
|
|
5319
|
+
value = Color.ColorFromStr(tag.Color);
|
|
5320
|
+
value = assertColor(value);
|
|
5321
|
+
if (value) {
|
|
5322
|
+
break;
|
|
5323
|
+
}
|
|
5319
5324
|
}
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5325
|
+
}
|
|
5326
|
+
if (value && type == "string") {
|
|
5327
|
+
const cColor = value;
|
|
5328
|
+
value = `rgba(${cColor.red},${cColor.green},${cColor.blue},${cColor.alpha})`;
|
|
5329
|
+
}
|
|
5330
|
+
break;
|
|
5331
|
+
// Input can be an arbitrary value.
|
|
5332
|
+
// Eg: Result is a colour, a number, a string.
|
|
5333
|
+
// This means we first calculate the value, then validate it in the context of the desired type.
|
|
5334
|
+
case EValueType.Input:
|
|
5335
|
+
value = GetInputValue(field.value, data);
|
|
5336
|
+
if (value != null) {
|
|
5337
|
+
if (type == "number") {
|
|
5338
|
+
if (typeof value == "string" && value != "" && value != null && value != undefined) {
|
|
5339
|
+
value = Number(value);
|
|
5323
5340
|
}
|
|
5324
|
-
else {
|
|
5341
|
+
else if (typeof value != "number") {
|
|
5325
5342
|
value = null;
|
|
5326
5343
|
}
|
|
5327
5344
|
}
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
if (type == "number") {
|
|
5341
|
-
if (typeof value == "string" && value != "" && value != null && value != undefined) {
|
|
5342
|
-
value = Number(value);
|
|
5345
|
+
else if (type == "string") {
|
|
5346
|
+
if (typeof value == "number") {
|
|
5347
|
+
value = String(value);
|
|
5348
|
+
}
|
|
5349
|
+
else if (typeof value == "object") {
|
|
5350
|
+
if (isColor(value)) {
|
|
5351
|
+
value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
|
|
5352
|
+
}
|
|
5353
|
+
else {
|
|
5354
|
+
value = null;
|
|
5355
|
+
}
|
|
5356
|
+
}
|
|
5343
5357
|
}
|
|
5344
|
-
else if (
|
|
5345
|
-
value =
|
|
5358
|
+
else if (type == "color") {
|
|
5359
|
+
value = assertColor(value);
|
|
5346
5360
|
}
|
|
5347
5361
|
}
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5362
|
+
break;
|
|
5363
|
+
// Mapping can be an arbitrary value.
|
|
5364
|
+
// Eg: mapping a value to a Client File ID, or a colour, or a number.
|
|
5365
|
+
// This means we first calculate the value, then validate it in the context of the desired type.
|
|
5366
|
+
case EValueType.Mapping:
|
|
5367
|
+
value = GetMappingValue(field.value, data);
|
|
5368
|
+
if (value != null) {
|
|
5369
|
+
if (type == "number") {
|
|
5370
|
+
if (typeof value == "string" && value != "" && value != null && value != undefined) {
|
|
5371
|
+
value = Number(value);
|
|
5355
5372
|
}
|
|
5356
|
-
else {
|
|
5373
|
+
else if (typeof value != "number") {
|
|
5357
5374
|
value = null;
|
|
5358
5375
|
}
|
|
5359
5376
|
}
|
|
5377
|
+
else if (type == "string") {
|
|
5378
|
+
if (typeof value == "number") {
|
|
5379
|
+
value = String(value);
|
|
5380
|
+
}
|
|
5381
|
+
else if (typeof value == "object") {
|
|
5382
|
+
if (isColor(value)) {
|
|
5383
|
+
value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
|
|
5384
|
+
}
|
|
5385
|
+
else {
|
|
5386
|
+
value = null;
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
}
|
|
5390
|
+
else if (type == "color") {
|
|
5391
|
+
value = assertColor(typeof value === "number" ? String(value) : value);
|
|
5392
|
+
}
|
|
5360
5393
|
}
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5394
|
+
break;
|
|
5395
|
+
}
|
|
5396
|
+
// Extra layer of validation.
|
|
5397
|
+
// This is a backup in case some branch above failed to convert into the right type.
|
|
5398
|
+
if (type == "number") {
|
|
5399
|
+
if (typeof value !== "number" || isNaN(value)) {
|
|
5400
|
+
value = null;
|
|
5364
5401
|
}
|
|
5365
|
-
break;
|
|
5366
|
-
}
|
|
5367
|
-
// Extra layer of validation.
|
|
5368
|
-
// This is a backup in case some branch above failed to convert into the right type.
|
|
5369
|
-
if (type == "number") {
|
|
5370
|
-
if (typeof value !== "number" || isNaN(value)) {
|
|
5371
|
-
value = null;
|
|
5372
5402
|
}
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5403
|
+
else if (type == "color") {
|
|
5404
|
+
if (typeof value !== "object" || !value) {
|
|
5405
|
+
value = null;
|
|
5406
|
+
}
|
|
5377
5407
|
}
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5408
|
+
else if (type == "string") {
|
|
5409
|
+
if (typeof value !== "string" || !value) {
|
|
5410
|
+
value = null;
|
|
5411
|
+
}
|
|
5382
5412
|
}
|
|
5383
5413
|
}
|
|
5384
5414
|
if (value != null) {
|
|
@@ -17461,7 +17491,7 @@ var ChangeSet;
|
|
|
17461
17491
|
})(ChangeSet || (ChangeSet = {}));
|
|
17462
17492
|
|
|
17463
17493
|
// This is updated with the package.json version on build.
|
|
17464
|
-
const VERSION = "7.1.
|
|
17494
|
+
const VERSION = "7.1.20";
|
|
17465
17495
|
|
|
17466
17496
|
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, EntityTypeTrigger, 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, UserMfaMethod, 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, NavigatorChatClient, NavigatorMcpWebSocketClient, ChangeSet };
|
|
17467
17497
|
//# sourceMappingURL=bruce-models.es5.js.map
|