bruce-models 1.8.4 → 1.8.6
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 +82 -6
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +82 -6
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/calculator/calculator.js +72 -0
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +10 -6
- package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
- package/dist/types/calculator/calculator.d.ts +3 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -2086,6 +2086,7 @@ var Calculator;
|
|
|
2086
2086
|
/**
|
|
2087
2087
|
* Calculates the value of arbitrary field options.
|
|
2088
2088
|
* The context calling this should validate results and parse stuff if needed.
|
|
2089
|
+
* @deprecated use specific calls: eg GetColor or GetNumber.
|
|
2089
2090
|
* @param fields
|
|
2090
2091
|
* @param entity
|
|
2091
2092
|
* @param tags
|
|
@@ -2190,6 +2191,77 @@ var Calculator;
|
|
|
2190
2191
|
return null;
|
|
2191
2192
|
}
|
|
2192
2193
|
Calculator.GetColor = GetColor;
|
|
2194
|
+
function GetNumber(fields, entity, tags) {
|
|
2195
|
+
if (!tags) {
|
|
2196
|
+
tags = [];
|
|
2197
|
+
}
|
|
2198
|
+
if (!entity) {
|
|
2199
|
+
entity = {};
|
|
2200
|
+
}
|
|
2201
|
+
for (let i = 0; i < fields.length; i++) {
|
|
2202
|
+
const field = fields[i];
|
|
2203
|
+
let value;
|
|
2204
|
+
switch (field.type) {
|
|
2205
|
+
case EValueType.Gradient:
|
|
2206
|
+
value = Number(GetGradientValue(field.value, entity));
|
|
2207
|
+
break;
|
|
2208
|
+
case EValueType.Color:
|
|
2209
|
+
case EValueType.Input:
|
|
2210
|
+
value = Number(GetInputValue(field.value, entity));
|
|
2211
|
+
break;
|
|
2212
|
+
case EValueType.Mapping:
|
|
2213
|
+
value = Number(GetMappingValue(field.value, entity));
|
|
2214
|
+
break;
|
|
2215
|
+
}
|
|
2216
|
+
if (value || value == 0) {
|
|
2217
|
+
return value;
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
return null;
|
|
2221
|
+
}
|
|
2222
|
+
Calculator.GetNumber = GetNumber;
|
|
2223
|
+
function GetString(fields, entity, tags) {
|
|
2224
|
+
if (!tags) {
|
|
2225
|
+
tags = [];
|
|
2226
|
+
}
|
|
2227
|
+
if (!entity) {
|
|
2228
|
+
entity = {};
|
|
2229
|
+
}
|
|
2230
|
+
for (let i = 0; i < fields.length; i++) {
|
|
2231
|
+
const field = fields[i];
|
|
2232
|
+
let value;
|
|
2233
|
+
switch (field.type) {
|
|
2234
|
+
case EValueType.Gradient:
|
|
2235
|
+
value = String(GetGradientValue(field.value, entity));
|
|
2236
|
+
break;
|
|
2237
|
+
case EValueType.Color:
|
|
2238
|
+
case EValueType.Input:
|
|
2239
|
+
value = String(GetInputValue(field.value, entity));
|
|
2240
|
+
break;
|
|
2241
|
+
case EValueType.Mapping:
|
|
2242
|
+
value = String(GetMappingValue(field.value, entity));
|
|
2243
|
+
break;
|
|
2244
|
+
case EValueType.RandomColor:
|
|
2245
|
+
var color = Color.RandomColor();
|
|
2246
|
+
value = `rgba(${color.red},${color.green},${color.blue},${color.alpha})`;
|
|
2247
|
+
break;
|
|
2248
|
+
case EValueType.TagColor:
|
|
2249
|
+
for (let i = 0; i < tags.length; i++) {
|
|
2250
|
+
const tag = tags[i];
|
|
2251
|
+
if (tag.Color) {
|
|
2252
|
+
value = tag.Color;
|
|
2253
|
+
break;
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
break;
|
|
2257
|
+
}
|
|
2258
|
+
if (value) {
|
|
2259
|
+
return value;
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
return null;
|
|
2263
|
+
}
|
|
2264
|
+
Calculator.GetString = GetString;
|
|
2193
2265
|
function GetMappingValue(value, entity) {
|
|
2194
2266
|
const attrPath = parseLegacyPath(value.field);
|
|
2195
2267
|
let eValue = Entity.GetValue({
|
|
@@ -4300,7 +4372,7 @@ var EntityFilterGetter;
|
|
|
4300
4372
|
this.viewAreaSub();
|
|
4301
4373
|
}
|
|
4302
4374
|
else {
|
|
4303
|
-
this.getterLoopId
|
|
4375
|
+
this.getterLoopId += 1;
|
|
4304
4376
|
this.viewAreaDispose();
|
|
4305
4377
|
}
|
|
4306
4378
|
}
|
|
@@ -4342,13 +4414,14 @@ var EntityFilterGetter;
|
|
|
4342
4414
|
let curCellIndex = cells.length > 0 ? 0 : null;
|
|
4343
4415
|
let postedScanning = false;
|
|
4344
4416
|
let postedLoading = false;
|
|
4417
|
+
let total = 0;
|
|
4345
4418
|
while (retryAttempts > 0 && curCellIndex != null) {
|
|
4346
|
-
if (this.getterLoopId != loopId) {
|
|
4347
|
-
break;
|
|
4348
|
-
}
|
|
4349
4419
|
if (retryDelay > 0) {
|
|
4350
4420
|
yield delay(retryDelay);
|
|
4351
4421
|
}
|
|
4422
|
+
if (this.getterLoopId != loopId) {
|
|
4423
|
+
break;
|
|
4424
|
+
}
|
|
4352
4425
|
if (!postedScanning) {
|
|
4353
4426
|
this.postStatus({ msg: EStatus.Scanning, revoking: false });
|
|
4354
4427
|
postedScanning = true;
|
|
@@ -4363,13 +4436,13 @@ var EntityFilterGetter;
|
|
|
4363
4436
|
continue;
|
|
4364
4437
|
}
|
|
4365
4438
|
try {
|
|
4366
|
-
|
|
4439
|
+
let { entities } = yield Entity.GetList({
|
|
4367
4440
|
api: this.api,
|
|
4368
4441
|
filter: {
|
|
4369
4442
|
pageSize: PAGE_SIZE,
|
|
4370
4443
|
pageIndex: curCell.FetchPageIndex,
|
|
4371
4444
|
entityTypeId: this.typeId,
|
|
4372
|
-
|
|
4445
|
+
layerIds: this.tagIds,
|
|
4373
4446
|
bounds: curCell.GetBounds(),
|
|
4374
4447
|
sortOrder: Api.ESortOrder.Asc,
|
|
4375
4448
|
entityTypeConditions: this.attrFilter
|
|
@@ -4383,6 +4456,9 @@ var EntityFilterGetter;
|
|
|
4383
4456
|
if (this.getterLoopId != loopId) {
|
|
4384
4457
|
break;
|
|
4385
4458
|
}
|
|
4459
|
+
if (entities.length) {
|
|
4460
|
+
total += entities.length;
|
|
4461
|
+
}
|
|
4386
4462
|
if (!postedLoading) {
|
|
4387
4463
|
this.postStatus({ msg: EStatus.Loading, revoking: false });
|
|
4388
4464
|
postedLoading = true;
|