@masterteam/client-components 0.0.63 → 0.0.65
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.
|
@@ -175,21 +175,25 @@ class ClientListStateService {
|
|
|
175
175
|
target.areaType !== 'table') {
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
|
+
const propertyMaps = this.createPropertyMaps(response.catalog);
|
|
178
179
|
const columns = (response.projectionMeta?.columns ?? [])
|
|
179
180
|
.filter((column) => column.visible)
|
|
180
181
|
.sort((a, b) => a.order - b.order)
|
|
181
|
-
.map((column, index) =>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
.map((column, index) => {
|
|
183
|
+
const property = this.resolvePropertyMeta(column.key, propertyMaps);
|
|
184
|
+
return {
|
|
185
|
+
key: column.key,
|
|
186
|
+
normalizedKey: property?.normalizedKey ?? column.key,
|
|
187
|
+
label: column.label,
|
|
188
|
+
type: 'entity',
|
|
189
|
+
sortable: !UNSORTABLE_ENTITY_VIEW_TYPES.has(column.viewType),
|
|
190
|
+
width: index === 0 ? '200px' : undefined,
|
|
191
|
+
viewType: column.viewType,
|
|
192
|
+
order: column.order,
|
|
193
|
+
visible: column.visible,
|
|
194
|
+
configuration: column.configuration ?? null,
|
|
195
|
+
};
|
|
196
|
+
});
|
|
193
197
|
const lang = this.resolveActiveLang();
|
|
194
198
|
const rows = (response.records ?? []).map((record) => {
|
|
195
199
|
const row = {
|
|
@@ -875,6 +879,9 @@ class ClientListCardsView {
|
|
|
875
879
|
entity.name;
|
|
876
880
|
return {
|
|
877
881
|
key: String(key),
|
|
882
|
+
normalizedKey: typeof raw['normalizedKey'] === 'string'
|
|
883
|
+
? raw['normalizedKey']
|
|
884
|
+
: String(key),
|
|
878
885
|
label: entity.name ?? String(key),
|
|
879
886
|
type: 'entity',
|
|
880
887
|
viewType: (entity.viewType ?? 'Text'),
|
|
@@ -1330,8 +1337,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1330
1337
|
function mergeRuntimeFilters(configured = [], runtime = {}, columns = []) {
|
|
1331
1338
|
const filters = [...configured];
|
|
1332
1339
|
for (const [rawKey, rawValue] of Object.entries(runtime)) {
|
|
1333
|
-
const
|
|
1334
|
-
const
|
|
1340
|
+
const column = columns.find((item) => item.key === rawKey || item.normalizedKey === rawKey);
|
|
1341
|
+
const key = rawKey === 'generalSearch' ? 'Name' : (column?.normalizedKey ?? rawKey);
|
|
1335
1342
|
const filterType = column
|
|
1336
1343
|
? TableValueResolver.getColumnFilterType(column)
|
|
1337
1344
|
: null;
|
|
@@ -1355,6 +1362,9 @@ function mergeRuntimeFilters(configured = [], runtime = {}, columns = []) {
|
|
|
1355
1362
|
}
|
|
1356
1363
|
return filters;
|
|
1357
1364
|
}
|
|
1365
|
+
function runtimeFiltersChanged(previous, next) {
|
|
1366
|
+
return JSON.stringify(previous ?? {}) !== JSON.stringify(next ?? {});
|
|
1367
|
+
}
|
|
1358
1368
|
function appendRange(filters, key, range, isDate) {
|
|
1359
1369
|
const from = toRangeValue(range.from, isDate);
|
|
1360
1370
|
const to = toRangeValue(range.to, isDate);
|
|
@@ -1372,7 +1382,12 @@ function toRangeValue(value, isDate) {
|
|
|
1372
1382
|
if (value === null || value === undefined || value === '')
|
|
1373
1383
|
return null;
|
|
1374
1384
|
if (!isDate)
|
|
1375
|
-
return value;
|
|
1385
|
+
return toScalar(value);
|
|
1386
|
+
if (typeof value === 'string') {
|
|
1387
|
+
const trimmed = value.trim();
|
|
1388
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(trimmed))
|
|
1389
|
+
return trimmed;
|
|
1390
|
+
}
|
|
1376
1391
|
const date = value instanceof Date ? value : new Date(String(value));
|
|
1377
1392
|
if (Number.isNaN(date.getTime()))
|
|
1378
1393
|
return null;
|
|
@@ -1387,8 +1402,12 @@ function toScalar(value) {
|
|
|
1387
1402
|
}
|
|
1388
1403
|
if (value === null || value === undefined || value === '')
|
|
1389
1404
|
return null;
|
|
1390
|
-
if (typeof value
|
|
1405
|
+
if (typeof value === 'string' || typeof value === 'number')
|
|
1391
1406
|
return value;
|
|
1407
|
+
if (typeof value === 'boolean')
|
|
1408
|
+
return String(value);
|
|
1409
|
+
if (typeof value !== 'object')
|
|
1410
|
+
return null;
|
|
1392
1411
|
const item = value;
|
|
1393
1412
|
return toScalar(item['value'] ??
|
|
1394
1413
|
item['id'] ??
|
|
@@ -1444,13 +1463,17 @@ class ClientList {
|
|
|
1444
1463
|
if (!item || item.type === 'informative' || !item.config.isPaginated) {
|
|
1445
1464
|
return;
|
|
1446
1465
|
}
|
|
1447
|
-
this.runtimeFilters.
|
|
1466
|
+
const nextFilters = event.filters ?? this.runtimeFilters.get(item.key) ?? {};
|
|
1467
|
+
const filtersChanged = runtimeFiltersChanged(this.runtimeFilters.get(item.key), nextFilters);
|
|
1468
|
+
this.runtimeFilters.set(item.key, nextFilters);
|
|
1448
1469
|
if (item.areaType === 'cards') {
|
|
1449
1470
|
this.loadCards(item.key, item.config);
|
|
1450
1471
|
return;
|
|
1451
1472
|
}
|
|
1452
1473
|
const take = this.resolvePositiveInteger(event.pageSize) ?? item.take;
|
|
1453
|
-
const skip =
|
|
1474
|
+
const skip = filtersChanged
|
|
1475
|
+
? 0
|
|
1476
|
+
: (this.resolveNonNegativeInteger(event.first) ?? 0);
|
|
1454
1477
|
this.state.setTablePaging(item.key, skip, take);
|
|
1455
1478
|
this.loadTable(item.key, item.config, skip, take);
|
|
1456
1479
|
}
|