@dereekb/dbx-web 13.4.1 → 13.4.2

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.
@@ -61,6 +61,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
61
61
  standalone: true
62
62
  }]
63
63
  }] });
64
+ /**
65
+ * Creates a factory that produces injection component configs for rendering date column headers.
66
+ *
67
+ * The factory initializes each {@link DbxTableDateHeaderComponent} with the column's date metadata.
68
+ *
69
+ * @returns a factory function that maps a date column to its header injection config
70
+ */
64
71
  function dbxTableDateHeaderInjectionFactory() {
65
72
  return (column) => {
66
73
  const config = {
@@ -74,6 +81,14 @@ function dbxTableDateHeaderInjectionFactory() {
74
81
  }
75
82
 
76
83
  const NO_GROUPS_ID = 'none';
84
+ /**
85
+ * Creates a default (ungrouped) table item group that wraps all items under the {@link NO_GROUPS_ID} identifier.
86
+ *
87
+ * Used when no explicit grouping function is provided to the table.
88
+ *
89
+ * @param items - the array of items to include in the default group
90
+ * @returns a default group containing all the provided items
91
+ */
77
92
  function defaultDbxTableItemGroup(items) {
78
93
  return {
79
94
  groupId: NO_GROUPS_ID,
@@ -82,6 +97,7 @@ function defaultDbxTableItemGroup(items) {
82
97
  default: true
83
98
  };
84
99
  }
100
+ /* eslint-enable @typescript-eslint/no-explicit-any */
85
101
 
86
102
  class DbxTableStore extends ComponentStore {
87
103
  constructor() {
@@ -272,6 +288,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
272
288
  imports: [MatDatepickerModule, ReactiveFormsModule, MatButtonModule]
273
289
  }]
274
290
  }], ctorParameters: () => [] });
291
+ /**
292
+ * Creates an injection component config for a date-range day-distance input cell.
293
+ *
294
+ * Initializes the component with the provided configuration for day distance, date bounds, and button format.
295
+ *
296
+ * @param componentConfig - optional configuration for the date range input (day distance, min/max dates, button format)
297
+ * @returns an injection component config that renders a {@link DbxTableDateRangeDayDistanceInputCellInputComponent}
298
+ */
275
299
  function dbxTableDateRangeDayDistanceInputCellInput(componentConfig) {
276
300
  const config = {
277
301
  componentClass: DbxTableDateRangeDayDistanceInputCellInputComponent,
@@ -553,6 +577,7 @@ class DbxColumnSizeColumnDirective {
553
577
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: DbxColumnSizeColumnDirective, decorators: [{
554
578
  type: Directive,
555
579
  args: [{
580
+ // eslint-disable-next-line @angular-eslint/directive-selector
556
581
  selector: '[dbx-column-size-column]',
557
582
  standalone: true
558
583
  }]
@@ -746,9 +771,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
746
771
 
747
772
  const DBX_TABLE_ITEMS_COLUMN_NAME = '_items';
748
773
  const DBX_TABLE_ACTIONS_COLUMN_NAME = '_actions';
774
+ /**
775
+ * Type guard that checks whether a table view element is a group element (header or footer).
776
+ *
777
+ * @param element - the table view element to check
778
+ * @returns `true` if the element represents a group header or footer row
779
+ */
749
780
  function isDbxTableViewGroupElement(element) {
750
781
  return element.type === 'group';
751
782
  }
783
+ /**
784
+ * Type guard that checks whether a table view element is an item data element.
785
+ *
786
+ * @param element - the table view element to check
787
+ * @returns `true` if the element represents an item data row
788
+ */
752
789
  function isDbxTableViewItemElement(element) {
753
790
  return element.type === 'item';
754
791
  }
@@ -774,8 +811,7 @@ class DbxTableViewComponent {
774
811
  const { groupHeader: inputGroupHeader, groupFooter: inputGroupFooter } = viewDelegate;
775
812
  const hasGroupHeader = inputGroupHeader != null ? (group) => inputGroupHeader(group) != null : () => false;
776
813
  const hasGroupFooter = inputGroupFooter != null ? (group) => inputGroupFooter(group) != null : () => false;
777
- return groups
778
- .map((group) => {
814
+ return groups.flatMap((group) => {
779
815
  const { items } = group;
780
816
  const itemElements = items.map((item) => ({
781
817
  type: 'item',
@@ -806,8 +842,7 @@ class DbxTableViewComponent {
806
842
  }
807
843
  }
808
844
  return elements;
809
- })
810
- .flat();
845
+ });
811
846
  }));
812
847
  })), shareReplay(1));
813
848
  elements$ = this.elementsState$.pipe(valueFromFinishedLoadingState(() => []), throttleTime(50, undefined, { leading: true, trailing: true }), shareReplay(1));
@@ -853,8 +888,7 @@ class DbxTableViewComponent {
853
888
  }
854
889
  showFooterRowSignal = computed(() => {
855
890
  const viewDelegate = this.viewDelegateSignal();
856
- const showFooterRow = viewDelegate && (viewDelegate.summaryRowHeader != null || viewDelegate.columnFooter != null || viewDelegate.summaryRowEnd != null);
857
- return showFooterRow;
891
+ return viewDelegate && (viewDelegate.summaryRowHeader != null || viewDelegate.columnFooter != null || viewDelegate.summaryRowEnd != null);
858
892
  }, ...(ngDevMode ? [{ debugName: "showFooterRowSignal" }] : []));
859
893
  showFullSummaryRowSignal = computed(() => {
860
894
  const viewDelegate = this.viewDelegateSignal();
@@ -945,6 +979,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
945
979
  * @returns
946
980
  */
947
981
  const DEFAULT_DBX_TABLE_READER_COLUMN_TRACK_BY = (column) => column.columnName;
982
+ /**
983
+ * Creates a {@link DbxTableReader} that provides reactive access to cell data across all columns and items in the table.
984
+ *
985
+ * @param config The reader configuration containing the delegate and table store
986
+ * @returns A {@link DbxTableReader} instance with observable accessors for cell data
987
+ */
948
988
  function dbxTableReader(config) {
949
989
  const { delegate, tableStore } = config;
950
990
  const { items$ } = tableStore;
@@ -999,11 +1039,10 @@ function dbxTableReader(config) {
999
1039
  return allColumnsData$.pipe(map((columnsData) => columnsData.record[columnKey]), shareReplay(1));
1000
1040
  };
1001
1041
  const loadCellDataPairsForColumn = (column) => {
1002
- const columnsData$ = _columnAccessorForColumn(column).pipe(switchMap((accessor) => {
1042
+ return _columnAccessorForColumn(column).pipe(switchMap((accessor) => {
1003
1043
  // when visibility changes, the data will change to be an empty array
1004
1044
  return accessor ? accessor.cellData$ : of([]);
1005
1045
  }), shareReplay(1));
1006
- return columnsData$;
1007
1046
  };
1008
1047
  const cellDataPairsForColumn = (column) => {
1009
1048
  return loadCellDataPairsForColumn(column);
@@ -1013,7 +1052,7 @@ function dbxTableReader(config) {
1013
1052
  };
1014
1053
  const cellDataPairForColumnAndItem = (column, item) => {
1015
1054
  const itemKey = trackItem(item);
1016
- const columnsData$ = _columnAccessorForColumn(column).pipe(switchMap((columnsData) => {
1055
+ return _columnAccessorForColumn(column).pipe(switchMap((columnsData) => {
1017
1056
  return columnsData
1018
1057
  ? columnsData.cellDataAccessors$.pipe(switchMap((cellDataAccessor) => {
1019
1058
  const itemAccessor = cellDataAccessor.accessorsRecord[itemKey];
@@ -1022,7 +1061,6 @@ function dbxTableReader(config) {
1022
1061
  }))
1023
1062
  : of(null);
1024
1063
  }), shareReplay(1));
1025
- return columnsData$;
1026
1064
  };
1027
1065
  const cellDataForColumnAndItem = (column, item) => {
1028
1066
  return cellDataPairForColumnAndItem(column, item).pipe(map((pair) => pair?.value));