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.
@@ -5249,136 +5249,166 @@ var Calculator;
5249
5249
  if (type == "number" && field.type == EValueType.Color) {
5250
5250
  field.type = EValueType.Input;
5251
5251
  }
5252
- switch (field.type) {
5253
- case EValueType.Color:
5254
- if (type === "number") {
5255
- break;
5256
- }
5257
- value = field.value;
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
- break;
5263
- case EValueType.Gradient:
5264
- if (type === "number") {
5265
- break;
5259
+ else if (typeof value != "number") {
5260
+ value = null;
5266
5261
  }
5267
- value = GetGradientValue(field.value, data, shouldRangesDefaultToMin);
5268
- value = assertColor(value);
5269
- if (value && type == "string") {
5270
- value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
5262
+ }
5263
+ else if (type == "string") {
5264
+ if (typeof value == "number") {
5265
+ value = String(value);
5271
5266
  }
5272
- break;
5273
- case EValueType.RandomColor:
5274
- if (type === "number") {
5275
- break;
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
- value = Color.RandomColor();
5275
+ }
5276
+ else if (type == "color") {
5278
5277
  value = assertColor(value);
5279
- if (value && type == "string") {
5280
- value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
5281
- }
5282
- break;
5283
- case EValueType.TagColor:
5284
- if (type === "number") {
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
- for (let i = 0; i < tags.length; i++) {
5288
- const tag = tags[i];
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
- if (value && type == "string") {
5298
- const cColor = value;
5299
- value = `rgba(${cColor.red},${cColor.green},${cColor.blue},${cColor.alpha})`;
5300
- }
5301
- break;
5302
- // Input can be an arbitrary value.
5303
- // Eg: Result is a colour, a number, a string.
5304
- // This means we first calculate the value, then validate it in the context of the desired type.
5305
- case EValueType.Input:
5306
- value = GetInputValue(field.value, data);
5307
- if (value != null) {
5308
- if (type == "number") {
5309
- if (typeof value == "string" && value != "" && value != null && value != undefined) {
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
- else if (type == "string") {
5317
- if (typeof value == "number") {
5318
- value = String(value);
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
- else if (typeof value == "object") {
5321
- if (isColor(value)) {
5322
- value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
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
- else if (type == "color") {
5330
- value = assertColor(value);
5331
- }
5332
- }
5333
- break;
5334
- // Mapping can be an arbitrary value.
5335
- // Eg: mapping a value to a Client File ID, or a colour, or a number.
5336
- // This means we first calculate the value, then validate it in the context of the desired type.
5337
- case EValueType.Mapping:
5338
- value = GetMappingValue(field.value, data);
5339
- if (value != null) {
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 (typeof value != "number") {
5345
- value = null;
5358
+ else if (type == "color") {
5359
+ value = assertColor(value);
5346
5360
  }
5347
5361
  }
5348
- else if (type == "string") {
5349
- if (typeof value == "number") {
5350
- value = String(value);
5351
- }
5352
- else if (typeof value == "object") {
5353
- if (isColor(value)) {
5354
- value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
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
- else if (type == "color") {
5362
- value = assertColor(typeof value === "number" ? String(value) : value);
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
- else if (type == "color") {
5375
- if (typeof value !== "object" || !value) {
5376
- value = null;
5403
+ else if (type == "color") {
5404
+ if (typeof value !== "object" || !value) {
5405
+ value = null;
5406
+ }
5377
5407
  }
5378
- }
5379
- else if (type == "string") {
5380
- if (typeof value !== "string" || !value) {
5381
- value = null;
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.19";
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