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.umd.js
CHANGED
|
@@ -2045,6 +2045,7 @@
|
|
|
2045
2045
|
/**
|
|
2046
2046
|
* Calculates the value of arbitrary field options.
|
|
2047
2047
|
* The context calling this should validate results and parse stuff if needed.
|
|
2048
|
+
* @deprecated use specific calls: eg GetColor or GetNumber.
|
|
2048
2049
|
* @param fields
|
|
2049
2050
|
* @param entity
|
|
2050
2051
|
* @param tags
|
|
@@ -2149,6 +2150,77 @@
|
|
|
2149
2150
|
return null;
|
|
2150
2151
|
}
|
|
2151
2152
|
Calculator.GetColor = GetColor;
|
|
2153
|
+
function GetNumber(fields, entity, tags) {
|
|
2154
|
+
if (!tags) {
|
|
2155
|
+
tags = [];
|
|
2156
|
+
}
|
|
2157
|
+
if (!entity) {
|
|
2158
|
+
entity = {};
|
|
2159
|
+
}
|
|
2160
|
+
for (let i = 0; i < fields.length; i++) {
|
|
2161
|
+
const field = fields[i];
|
|
2162
|
+
let value;
|
|
2163
|
+
switch (field.type) {
|
|
2164
|
+
case EValueType.Gradient:
|
|
2165
|
+
value = Number(GetGradientValue(field.value, entity));
|
|
2166
|
+
break;
|
|
2167
|
+
case EValueType.Color:
|
|
2168
|
+
case EValueType.Input:
|
|
2169
|
+
value = Number(GetInputValue(field.value, entity));
|
|
2170
|
+
break;
|
|
2171
|
+
case EValueType.Mapping:
|
|
2172
|
+
value = Number(GetMappingValue(field.value, entity));
|
|
2173
|
+
break;
|
|
2174
|
+
}
|
|
2175
|
+
if (value || value == 0) {
|
|
2176
|
+
return value;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
return null;
|
|
2180
|
+
}
|
|
2181
|
+
Calculator.GetNumber = GetNumber;
|
|
2182
|
+
function GetString(fields, entity, tags) {
|
|
2183
|
+
if (!tags) {
|
|
2184
|
+
tags = [];
|
|
2185
|
+
}
|
|
2186
|
+
if (!entity) {
|
|
2187
|
+
entity = {};
|
|
2188
|
+
}
|
|
2189
|
+
for (let i = 0; i < fields.length; i++) {
|
|
2190
|
+
const field = fields[i];
|
|
2191
|
+
let value;
|
|
2192
|
+
switch (field.type) {
|
|
2193
|
+
case EValueType.Gradient:
|
|
2194
|
+
value = String(GetGradientValue(field.value, entity));
|
|
2195
|
+
break;
|
|
2196
|
+
case EValueType.Color:
|
|
2197
|
+
case EValueType.Input:
|
|
2198
|
+
value = String(GetInputValue(field.value, entity));
|
|
2199
|
+
break;
|
|
2200
|
+
case EValueType.Mapping:
|
|
2201
|
+
value = String(GetMappingValue(field.value, entity));
|
|
2202
|
+
break;
|
|
2203
|
+
case EValueType.RandomColor:
|
|
2204
|
+
var color = exports.Color.RandomColor();
|
|
2205
|
+
value = `rgba(${color.red},${color.green},${color.blue},${color.alpha})`;
|
|
2206
|
+
break;
|
|
2207
|
+
case EValueType.TagColor:
|
|
2208
|
+
for (let i = 0; i < tags.length; i++) {
|
|
2209
|
+
const tag = tags[i];
|
|
2210
|
+
if (tag.Color) {
|
|
2211
|
+
value = tag.Color;
|
|
2212
|
+
break;
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
break;
|
|
2216
|
+
}
|
|
2217
|
+
if (value) {
|
|
2218
|
+
return value;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
return null;
|
|
2222
|
+
}
|
|
2223
|
+
Calculator.GetString = GetString;
|
|
2152
2224
|
function GetMappingValue(value, entity) {
|
|
2153
2225
|
const attrPath = parseLegacyPath(value.field);
|
|
2154
2226
|
let eValue = exports.Entity.GetValue({
|
|
@@ -4188,7 +4260,7 @@
|
|
|
4188
4260
|
this.viewAreaSub();
|
|
4189
4261
|
}
|
|
4190
4262
|
else {
|
|
4191
|
-
this.getterLoopId
|
|
4263
|
+
this.getterLoopId += 1;
|
|
4192
4264
|
this.viewAreaDispose();
|
|
4193
4265
|
}
|
|
4194
4266
|
}
|
|
@@ -4230,13 +4302,14 @@
|
|
|
4230
4302
|
let curCellIndex = cells.length > 0 ? 0 : null;
|
|
4231
4303
|
let postedScanning = false;
|
|
4232
4304
|
let postedLoading = false;
|
|
4305
|
+
let total = 0;
|
|
4233
4306
|
while (retryAttempts > 0 && curCellIndex != null) {
|
|
4234
|
-
if (this.getterLoopId != loopId) {
|
|
4235
|
-
break;
|
|
4236
|
-
}
|
|
4237
4307
|
if (retryDelay > 0) {
|
|
4238
4308
|
yield delay(retryDelay);
|
|
4239
4309
|
}
|
|
4310
|
+
if (this.getterLoopId != loopId) {
|
|
4311
|
+
break;
|
|
4312
|
+
}
|
|
4240
4313
|
if (!postedScanning) {
|
|
4241
4314
|
this.postStatus({ msg: EStatus.Scanning, revoking: false });
|
|
4242
4315
|
postedScanning = true;
|
|
@@ -4251,13 +4324,13 @@
|
|
|
4251
4324
|
continue;
|
|
4252
4325
|
}
|
|
4253
4326
|
try {
|
|
4254
|
-
|
|
4327
|
+
let { entities } = yield exports.Entity.GetList({
|
|
4255
4328
|
api: this.api,
|
|
4256
4329
|
filter: {
|
|
4257
4330
|
pageSize: PAGE_SIZE,
|
|
4258
4331
|
pageIndex: curCell.FetchPageIndex,
|
|
4259
4332
|
entityTypeId: this.typeId,
|
|
4260
|
-
|
|
4333
|
+
layerIds: this.tagIds,
|
|
4261
4334
|
bounds: curCell.GetBounds(),
|
|
4262
4335
|
sortOrder: exports.Api.ESortOrder.Asc,
|
|
4263
4336
|
entityTypeConditions: this.attrFilter
|
|
@@ -4271,6 +4344,9 @@
|
|
|
4271
4344
|
if (this.getterLoopId != loopId) {
|
|
4272
4345
|
break;
|
|
4273
4346
|
}
|
|
4347
|
+
if (entities.length) {
|
|
4348
|
+
total += entities.length;
|
|
4349
|
+
}
|
|
4274
4350
|
if (!postedLoading) {
|
|
4275
4351
|
this.postStatus({ msg: EStatus.Loading, revoking: false });
|
|
4276
4352
|
postedLoading = true;
|