@praxisui/table 10.0.0-rc.34 → 10.0.0-rc.35

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-10-19T09:48:25.455Z",
3
+ "generatedAt": "2026-10-21T13:10:38.195Z",
4
4
  "packageName": "@praxisui/table",
5
- "packageVersion": "10.0.0-rc.34",
5
+ "packageVersion": "10.0.0-rc.35",
6
6
  "sourceRegistry": "praxis-component-registry-ingestion",
7
7
  "sourceRegistryVersion": "1.0.0",
8
8
  "componentCount": 3,
@@ -437,17 +437,66 @@ function toTableDetailCardGridContentNode(node) {
437
437
  const field = String(node['field'] || node['valueField'] || '').trim();
438
438
  const authoredExpr = typeof node['valueExpr'] === 'string' ? node['valueExpr'].trim().replace(/^=\s*/, '') : '';
439
439
  const valueExpr = authoredExpr || (field ? `row.${field}` : '');
440
- if (!valueExpr)
441
- return null;
442
- const label = typeof node['label'] === 'string' ? node['label'].trim() : '';
443
- return {
444
- ...(node['id'] ? { id: node['id'] } : {}),
445
- ...(label ? { type: 'metric', label, valueExpr } : { type: 'text', textExpr: valueExpr }),
446
- ...(node['visibleWhen'] != null ? { visibleWhen: node['visibleWhen'] } : {}),
447
- };
440
+ const label = typeof node['label'] === 'string' && node['label'].trim()
441
+ ? node['label'].trim()
442
+ : typeof node['title'] === 'string' && node['title'].trim()
443
+ ? node['title'].trim()
444
+ : '';
445
+ if (valueExpr) {
446
+ return {
447
+ ...(node['id'] ? { id: node['id'] } : {}),
448
+ ...(label ? { type: 'metric', label, valueExpr } : { type: 'text', textExpr: valueExpr }),
449
+ ...(node['visibleWhen'] !== undefined && node['visibleWhen'] !== null ? { visibleWhen: node['visibleWhen'] } : {}),
450
+ };
451
+ }
452
+ if (Object.prototype.hasOwnProperty.call(node, 'value') && node['value'] !== undefined && node['value'] !== null) {
453
+ const literalText = String(node['value']);
454
+ if (label) {
455
+ return {
456
+ type: 'compose',
457
+ ...(node['id'] ? { id: node['id'] } : {}),
458
+ className: 'pfx-expansion-node pfx-expansion-node-value',
459
+ direction: 'column',
460
+ gap: 'xs',
461
+ items: [
462
+ { type: 'text', className: 'pfx-expansion-node-value__label', text: label },
463
+ { type: 'text', className: 'pfx-expansion-node-value__content', text: literalText },
464
+ ],
465
+ ...(node['visibleWhen'] !== undefined && node['visibleWhen'] !== null ? { visibleWhen: node['visibleWhen'] } : {}),
466
+ };
467
+ }
468
+ return {
469
+ type: 'text',
470
+ ...(node['id'] ? { id: node['id'] } : {}),
471
+ text: literalText,
472
+ ...(node['visibleWhen'] !== undefined && node['visibleWhen'] !== null ? { visibleWhen: node['visibleWhen'] } : {}),
473
+ };
474
+ }
475
+ return null;
448
476
  }
449
477
  /** Projects an authored node into a canonical compose item (presenter); a compose result yields its first presenter. */
450
478
  function toTableDetailComposeItemNode(node) {
479
+ if (node &&
480
+ typeof node === 'object' &&
481
+ node['type'] === 'value' &&
482
+ !node['field'] &&
483
+ !node['valueField'] &&
484
+ !node['valueExpr'] &&
485
+ Object.prototype.hasOwnProperty.call(node, 'value') &&
486
+ node['value'] !== undefined &&
487
+ node['value'] !== null) {
488
+ const label = typeof node['label'] === 'string' && node['label'].trim()
489
+ ? node['label'].trim()
490
+ : typeof node['title'] === 'string' && node['title'].trim()
491
+ ? node['title'].trim()
492
+ : '';
493
+ return {
494
+ type: 'text',
495
+ ...(node['id'] ? { id: node['id'] } : {}),
496
+ text: label ? `${label}: ${String(node['value'])}` : String(node['value']),
497
+ ...(node['visibleWhen'] !== undefined && node['visibleWhen'] !== null ? { visibleWhen: node['visibleWhen'] } : {}),
498
+ };
499
+ }
451
500
  const projected = toTableDetailCardGridContentNode(node);
452
501
  if (!projected)
453
502
  return null;
@@ -1176,13 +1225,16 @@ class TableSchemaColumnProjector {
1176
1225
  // It never admits hidden fields, overrides field identity, or selects membership.
1177
1226
  const combined = [...schemaColumns, ...additions];
1178
1227
  if (Array.isArray(projection?.order) && projection.order.length > 0) {
1228
+ const additionFields = new Set(additions.map((col) => col.field));
1179
1229
  combined.sort((left, right) => {
1180
1230
  return (presentationOrder.get(left.field) ?? Number.MAX_SAFE_INTEGER)
1181
1231
  - (presentationOrder.get(right.field) ?? Number.MAX_SAFE_INTEGER);
1182
1232
  });
1183
- return combined.map((column) => {
1184
- const explicitOrder = presentationOrder.get(column.field);
1185
- return explicitOrder !== undefined ? { ...column, order: explicitOrder } : column;
1233
+ return combined.map((column, index) => {
1234
+ if (!additionFields.has(column.field) || presentationOrder.has(column.field)) {
1235
+ return { ...column, order: index };
1236
+ }
1237
+ return column;
1186
1238
  });
1187
1239
  }
1188
1240
  return combined;
@@ -1311,10 +1363,23 @@ class TableSchemaColumnProjector {
1311
1363
  }
1312
1364
  const schemaDataType = this.normalizePresentationToken(field.type);
1313
1365
  const schemaFormat = this.normalizePresentationToken(field.format);
1314
- if (col.type === 'number' &&
1315
- !col.format &&
1316
- (schemaDataType === 'integer' || schemaFormat === 'int32' || schemaFormat === 'int64')) {
1317
- col.format = '1.0-0';
1366
+ if (col.type === 'number' && !col.format) {
1367
+ if (schemaDataType === 'integer' ||
1368
+ schemaFormat === 'integer' ||
1369
+ schemaFormat === 'int32' ||
1370
+ schemaFormat === 'int64' ||
1371
+ numericFormat === 'integer' ||
1372
+ numericFormat === 'int32' ||
1373
+ numericFormat === 'int64') {
1374
+ col.format = '1.0-0';
1375
+ }
1376
+ else {
1377
+ const explicitDecimals = this.firstFiniteNumber(field.decimalPlaces, field.extraProperties?.decimalPlaces);
1378
+ if (explicitDecimals !== undefined && explicitDecimals >= 0) {
1379
+ const decimals = Math.trunc(explicitDecimals);
1380
+ col.format = `1.${decimals}-${decimals}`;
1381
+ }
1382
+ }
1318
1383
  }
1319
1384
  const textMaskFormat = resolveTextMaskFormatFromFieldDefinition(field);
1320
1385
  const maskResolvedType = resolveColumnTypeFromFieldDefinition(field, col.type);
@@ -1331,14 +1396,14 @@ class TableSchemaColumnProjector {
1331
1396
  return;
1332
1397
  const ctl = (field.controlType || '').toString().trim().toLowerCase();
1333
1398
  const fname = (field.name || '').toString();
1334
- const lname = fname.toLowerCase();
1335
1399
  const isAvatarByControl = ctl === 'avatar';
1336
1400
  if (isAvatarByControl) {
1401
+ const initialsField = this.firstNonEmptyString(field.initialsField, field.extraProperties?.initialsField) || 'nomeCompleto';
1337
1402
  col.renderer = {
1338
1403
  type: 'avatar',
1339
1404
  avatar: {
1340
1405
  srcField: fname,
1341
- initialsField: 'nomeCompleto',
1406
+ initialsField,
1342
1407
  shape: 'circle',
1343
1408
  size: 32,
1344
1409
  },
@@ -1492,6 +1557,17 @@ class TableSchemaColumnProjector {
1492
1557
  const explicit = this.firstNonEmptyString(field.booleanFormat, field.extraProperties?.booleanFormat);
1493
1558
  if (explicit)
1494
1559
  return explicit;
1560
+ const trueLabel = this.firstNonEmptyString(field.trueLabel, field.labelTrue, field.extraProperties?.trueLabel, field.extraProperties?.labelTrue);
1561
+ const falseLabel = this.firstNonEmptyString(field.falseLabel, field.labelFalse, field.extraProperties?.falseLabel, field.extraProperties?.labelFalse);
1562
+ if (trueLabel && falseLabel) {
1563
+ const tNorm = this.normalizePresentationToken(trueLabel);
1564
+ const fNorm = this.normalizePresentationToken(falseLabel);
1565
+ if (tNorm === 'ativo' && fNorm === 'inativo')
1566
+ return 'active-inactive';
1567
+ if (tNorm === 'sim' && (fNorm === 'nao' || fNorm === 'não'))
1568
+ return 'yes-no';
1569
+ return `custom|${trueLabel}|${falseLabel}`;
1570
+ }
1495
1571
  const name = this.normalizePresentationToken(field.name);
1496
1572
  if (name === 'ativo' || name === 'active' || name.endsWith('ativo')) {
1497
1573
  return 'active-inactive';