@masterteam/components 0.0.261 → 0.0.263

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.
@@ -15,6 +15,7 @@ import * as i1 from 'primeng/tieredmenu';
15
15
  import { TieredMenuModule } from 'primeng/tieredmenu';
16
16
  import * as i1$2 from 'primeng/popover';
17
17
  import { PopoverModule } from 'primeng/popover';
18
+ import { parseClockTime, clockTimeToSeconds, toClockTimeParts, MTDateFormatPipe } from '@masterteam/components';
18
19
  import { DateField } from '@masterteam/components/date-field';
19
20
  import { NumberField } from '@masterteam/components/number-field';
20
21
  import { MultiSelectField } from '@masterteam/components/multi-select-field';
@@ -31,7 +32,6 @@ import * as i3 from 'primeng/skeleton';
31
32
  import { SkeletonModule } from 'primeng/skeleton';
32
33
  import * as i4 from 'primeng/progressbar';
33
34
  import { ProgressBarModule } from 'primeng/progressbar';
34
- import { MTDateFormatPipe } from '@masterteam/components';
35
35
  import { ConfirmationService } from '@masterteam/components/confirmation';
36
36
  import { EntityPreview } from '@masterteam/components/entities';
37
37
 
@@ -192,8 +192,8 @@ class TableValueResolver {
192
192
  ]);
193
193
  /**
194
194
  * `Time` is sortable and exportable but not filterable: a time-of-day has no
195
- * meaningful date-range filter, and the stored value is a full instant, so a
196
- * date picker would silently filter by day instead of by clock time.
195
+ * meaningful date-range filter, and a date picker cannot express one — it
196
+ * would silently filter by day instead of by clock time.
197
197
  */
198
198
  static FILTERABLE_ENTITY_VIEW_TYPES = new Set(TableValueResolver.ALL_ENTITY_VIEW_TYPES.filter((viewType) => viewType !== 'Attachment' &&
199
199
  viewType !== 'Time' &&
@@ -672,13 +672,17 @@ class TableValueResolver {
672
672
  : TableValueResolver.resolveDisplayValue(entityData.value);
673
673
  case 'Date':
674
674
  case 'DateTime':
675
- // `Time` sorts on the same instant as its siblings. Its export runs
676
- // through `mtDateFormat` in the table/cards date path, not here, because
677
- // the backend `value` for a Time property is the unformatted ISO string.
678
- case 'Time':
679
675
  return usage === 'sort'
680
676
  ? TableValueResolver.normalizeDateSortValue(entityData.rawValue ?? entityData.value)
681
677
  : TableValueResolver.resolveDisplayValue(entityData.value);
678
+ // `Time` sorts by clock, not by instant — a time of day has no calendar
679
+ // date to order by. Its export runs through `mtDateFormat` in the
680
+ // table/cards date path, not here, because the backend `value` for a Time
681
+ // property is the unformatted stored value.
682
+ case 'Time':
683
+ return usage === 'sort'
684
+ ? TableValueResolver.normalizeClockSortValue(entityData.rawValue ?? entityData.value)
685
+ : TableValueResolver.resolveDisplayValue(entityData.value);
682
686
  case 'Checkbox':
683
687
  return TableValueResolver.resolveBooleanValue(entityData.rawValue ?? entityData.value);
684
688
  case 'LongText':
@@ -791,6 +795,28 @@ class TableValueResolver {
791
795
  : new Date(String(resolvedValue)).getTime();
792
796
  return Number.isNaN(timestamp) ? null : timestamp;
793
797
  }
798
+ /**
799
+ * Order a `Time` cell by seconds since midnight. The stored shape is a
800
+ * wall-clock `HH:mm:ss`, which `Date` cannot parse at all; values still held
801
+ * as a full instant contribute their local clock, so a column holding both
802
+ * shapes still sorts by time of day rather than by the date part.
803
+ */
804
+ static normalizeClockSortValue(value) {
805
+ const resolvedValue = TableValueResolver.resolveDateValue(value);
806
+ if (resolvedValue === null ||
807
+ resolvedValue === undefined ||
808
+ resolvedValue === '') {
809
+ return null;
810
+ }
811
+ const clockTime = parseClockTime(resolvedValue);
812
+ if (clockTime)
813
+ return clockTimeToSeconds(clockTime);
814
+ const parsed = resolvedValue instanceof Date
815
+ ? resolvedValue
816
+ : new Date(String(resolvedValue));
817
+ const parsedClockTime = toClockTimeParts(parsed);
818
+ return parsedClockTime ? clockTimeToSeconds(parsedClockTime) : null;
819
+ }
794
820
  /**
795
821
  * Resolves an entity column's view type from the column def, falling back to
796
822
  * a sample row's cell. Public because grouping decides what it can bucket
@@ -2876,7 +2902,7 @@ class Table {
2876
2902
  if (column.type === 'entity') {
2877
2903
  // `Time` is resolved ahead of the filter gate below: it is deliberately
2878
2904
  // not filterable, but it still has to export as a formatted clock time
2879
- // rather than the raw ISO instant the backend sends.
2905
+ // rather than the raw stored value.
2880
2906
  if (TableValueResolver.getEntityViewType(column, row) === 'Time') {
2881
2907
  return 'time';
2882
2908
  }