@fundamental-ngx/platform 0.43.9 → 0.43.10

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,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, EventEmitter, inject, Directive, Input, Output, NgZone, ChangeDetectorRef, forwardRef, HostBinding, Optional, ElementRef, Inject, HostListener, Pipe, NgModule } from '@angular/core';
3
3
  import * as i2 from '@fundamental-ngx/cdk/utils';
4
- import { DestroyedService, isString, RtlService, KeyUtil, resizeObservable, FDK_FOCUSABLE_ITEM_DIRECTIVE, FocusableItemDirective } from '@fundamental-ngx/cdk/utils';
4
+ import { DestroyedService, isString, dfs, RtlService, KeyUtil, resizeObservable, FDK_FOCUSABLE_ITEM_DIRECTIVE, FocusableItemDirective } from '@fundamental-ngx/cdk/utils';
5
5
  import { isDataSource, DataSourceDirective, FD_DATA_SOURCE_TRANSFORMER } from '@fundamental-ngx/cdk/data-source';
6
6
  import { Subject, BehaviorSubject, isObservable, Subscription, filter as filter$1, fromEvent, Observable } from 'rxjs';
7
7
  import { map, takeUntil, take, skip, startWith, filter, debounceTime, distinctUntilChanged, share, tap } from 'rxjs/operators';
@@ -1431,7 +1431,7 @@ function newTableRow(row) {
1431
1431
  if (!row.value) {
1432
1432
  throw new Error('Unexpected value. TableRow.value cannot be undefined.');
1433
1433
  }
1434
- const newRow = new TableRowImpl({
1434
+ return new TableRowImpl({
1435
1435
  type: row.type || TableRowType.ITEM,
1436
1436
  checked: row.checked || false,
1437
1437
  index: row.index || 0,
@@ -1445,7 +1445,6 @@ function newTableRow(row) {
1445
1445
  state: row.state || 'readonly',
1446
1446
  children: row.children || []
1447
1447
  });
1448
- return newRow;
1449
1448
  }
1450
1449
  /** @hidden */
1451
1450
  function getSelectableRows(rows, selectableKey) {
@@ -1557,6 +1556,35 @@ function convertTreeObjectsToTableRows(source, selectionMode, tableRows, rowComp
1557
1556
  row.children.push(...children);
1558
1557
  rows.push(...children);
1559
1558
  }
1559
+ if (row.level === 0 && row.isTree) {
1560
+ dfs([row], (r) => {
1561
+ const children = r.children || [];
1562
+ const selectedChildren = [];
1563
+ const indeterminateChildren = [];
1564
+ children.forEach((child) => {
1565
+ if (child.checked === true) {
1566
+ selectedChildren.push(child);
1567
+ }
1568
+ else if (child.checked === null) {
1569
+ indeterminateChildren.push(child);
1570
+ }
1571
+ });
1572
+ const selectedAll = selectedChildren.length === children.length && children.length > 0;
1573
+ const selectedSome = selectedChildren.length > 0;
1574
+ if (r.checked) {
1575
+ applySelectionToChildren(rows, r, [], []);
1576
+ return;
1577
+ }
1578
+ if (selectedAll) {
1579
+ r.checked = true;
1580
+ return;
1581
+ }
1582
+ if (selectedSome || indeterminateChildren.length > 0) {
1583
+ r.checked = null;
1584
+ return;
1585
+ }
1586
+ });
1587
+ }
1560
1588
  });
1561
1589
  return rows;
1562
1590
  }
@@ -1582,6 +1610,14 @@ function getSelectionStatusByRowValue(source, selectionMode, tableRows, rowCompa
1582
1610
  return rowMap;
1583
1611
  }
1584
1612
  /** @hidden */
1613
+ function applySelectionToChildren(allRows, row, addedRows, removedRows) {
1614
+ const allChildren = findRowChildren(row, allRows);
1615
+ allChildren.forEach((r) => {
1616
+ r.checked = row.checked;
1617
+ r.checked ? addedRows.push(r) : removedRows.push(r);
1618
+ });
1619
+ }
1620
+ /** @hidden */
1585
1621
  function findRowChildren(row, allRows) {
1586
1622
  const rowsLength = allRows.length;
1587
1623
  /**
@@ -3748,5 +3784,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3748
3784
  * Generated bundle index. Do not edit.
3749
3785
  */
3750
3786
 
3751
- export { ArrayTableDataProvider, ArrayTableDataSource, BaseTableDataProvider, BaseTableDataSource, ChildTableDataSource, ColumnAlign, ColumnResizableSidePipe, ColumnsChange, DEFAULT_HIGHLIGHTING_KEY, DEFAULT_TABLE_PAGE, DEFAULT_TABLE_SEARCH_INPUT, DEFAULT_TABLE_STATE, EDITABLE_ROW_SEMANTIC_STATE, EditableTableCell, FDP_TABLE_DRAGGABLE_DIRECTIVE, FDP_TABLE_STATE_DIRECTIVE, FDP_TABLE_VIRTUAL_SCROLL_DIRECTIVE, FILTER_BOOLEAN_STRATEGIES, FILTER_BOOLEAN_STRATEGY, FILTER_DATE_STRATEGIES, FILTER_DATE_STRATEGY, FILTER_DEFAULT_STRATEGIES, FILTER_DEFAULT_STRATEGY, FILTER_NUMBER_STRATEGIES, FILTER_NUMBER_STRATEGY, FILTER_STRATEGY, FILTER_STRING_STRATEGIES, FILTER_STRING_STRATEGY, FdpCellDef, FdpCellSelectableDirective, FdpEditableCellDef, FdpEditableCellFormDirective, FdpHeaderCellDef, FdpTableCell, FdpTableHeader, FdpViewSettingsFilterCustomDef, FilterType, FilterableColumnDataType, ObservableTableDataProvider, ObservableTableDataSource, PageChange, PlatformTableCellResizableDirective, PlatformTableColumnResponsiveDirective, ROW_HEIGHT, RowClassesPipe, SELECTION_COLUMN_WIDTH, SEMANTIC_HIGHLIGHTING_COLUMN_WIDTH, SaveRowsEvent, SelectionCellStylesPipe, SelectionMode, SortDirection, TABLE_CELL_RESIZABLE_THRESHOLD_PX, TABLE_COLUMN_MIN_WIDTH, TABLE_RESIZER_BORDER_WIDTH, TABLE_SCROLLABLE, Table, TableCellHeaderPopoverDirective, TableCellStylesPipe, TableChildrenDataProvider, TableColumn, TableColumnFreezeEvent, TableColumnResizeService, TableColumnsChangeEvent, TableDataProvider, TableDataSource, TableDataSourceDirective, TableDataSourceParser, TableDraggable, TableDraggableDirective, TableFilterChangeEvent, TableGroupChangeEvent, TableHeaderResizerDirective, TableHelpersModule, TableInitialState, TableInitialStateDirective, TablePageChangeEvent, TableResponsiveService, TableRowActivateEvent, TableRowImpl, TableRowSelectionChangeEvent, TableRowService, TableRowToggleOpenStateEvent, TableRowType, TableRowsRearrangeEvent, TableScrollDispatcherService, TableScrollableDirective, TableSearchChangeEvent, TableSelectionChangeEvent, TableService, TableSortChangeEvent, TableVirtualScroll, TableVirtualScrollDirective, buildNewRowSkeleton, convertObjectsToTableRows, convertTreeLikeToFlatList, convertTreeObjectsToTableRows, convertTreeTableRowToFlatList, createGroupedTableRowsTree, filterByBoolean, filterByDate, filterByNumber, filterByString, findRowChildren, getFilterStrategiesBasedOnDataType, getFreezableColumns, getFreezableEndColumns, getRowParents, getScrollBarWidth, getSelectableRows, getSelectionStatusByRowValue, getUniqueListValuesByKey, isCollectionFilter, isGroupRow, isItemRow, isRowNavigatable, isSelectableRow, isTableRow, isTreeRow, isTreeRowFirstCell, newTableRow, sortTreeLikeGroupedRows, toDataStream };
3787
+ export { ArrayTableDataProvider, ArrayTableDataSource, BaseTableDataProvider, BaseTableDataSource, ChildTableDataSource, ColumnAlign, ColumnResizableSidePipe, ColumnsChange, DEFAULT_HIGHLIGHTING_KEY, DEFAULT_TABLE_PAGE, DEFAULT_TABLE_SEARCH_INPUT, DEFAULT_TABLE_STATE, EDITABLE_ROW_SEMANTIC_STATE, EditableTableCell, FDP_TABLE_DRAGGABLE_DIRECTIVE, FDP_TABLE_STATE_DIRECTIVE, FDP_TABLE_VIRTUAL_SCROLL_DIRECTIVE, FILTER_BOOLEAN_STRATEGIES, FILTER_BOOLEAN_STRATEGY, FILTER_DATE_STRATEGIES, FILTER_DATE_STRATEGY, FILTER_DEFAULT_STRATEGIES, FILTER_DEFAULT_STRATEGY, FILTER_NUMBER_STRATEGIES, FILTER_NUMBER_STRATEGY, FILTER_STRATEGY, FILTER_STRING_STRATEGIES, FILTER_STRING_STRATEGY, FdpCellDef, FdpCellSelectableDirective, FdpEditableCellDef, FdpEditableCellFormDirective, FdpHeaderCellDef, FdpTableCell, FdpTableHeader, FdpViewSettingsFilterCustomDef, FilterType, FilterableColumnDataType, ObservableTableDataProvider, ObservableTableDataSource, PageChange, PlatformTableCellResizableDirective, PlatformTableColumnResponsiveDirective, ROW_HEIGHT, RowClassesPipe, SELECTION_COLUMN_WIDTH, SEMANTIC_HIGHLIGHTING_COLUMN_WIDTH, SaveRowsEvent, SelectionCellStylesPipe, SelectionMode, SortDirection, TABLE_CELL_RESIZABLE_THRESHOLD_PX, TABLE_COLUMN_MIN_WIDTH, TABLE_RESIZER_BORDER_WIDTH, TABLE_SCROLLABLE, Table, TableCellHeaderPopoverDirective, TableCellStylesPipe, TableChildrenDataProvider, TableColumn, TableColumnFreezeEvent, TableColumnResizeService, TableColumnsChangeEvent, TableDataProvider, TableDataSource, TableDataSourceDirective, TableDataSourceParser, TableDraggable, TableDraggableDirective, TableFilterChangeEvent, TableGroupChangeEvent, TableHeaderResizerDirective, TableHelpersModule, TableInitialState, TableInitialStateDirective, TablePageChangeEvent, TableResponsiveService, TableRowActivateEvent, TableRowImpl, TableRowSelectionChangeEvent, TableRowService, TableRowToggleOpenStateEvent, TableRowType, TableRowsRearrangeEvent, TableScrollDispatcherService, TableScrollableDirective, TableSearchChangeEvent, TableSelectionChangeEvent, TableService, TableSortChangeEvent, TableVirtualScroll, TableVirtualScrollDirective, applySelectionToChildren, buildNewRowSkeleton, convertObjectsToTableRows, convertTreeLikeToFlatList, convertTreeObjectsToTableRows, convertTreeTableRowToFlatList, createGroupedTableRowsTree, filterByBoolean, filterByDate, filterByNumber, filterByString, findRowChildren, getFilterStrategiesBasedOnDataType, getFreezableColumns, getFreezableEndColumns, getRowParents, getScrollBarWidth, getSelectableRows, getSelectionStatusByRowValue, getUniqueListValuesByKey, isCollectionFilter, isGroupRow, isItemRow, isRowNavigatable, isSelectableRow, isTableRow, isTreeRow, isTreeRowFirstCell, newTableRow, sortTreeLikeGroupedRows, toDataStream };
3752
3788
  //# sourceMappingURL=fundamental-ngx-platform-table-helpers.mjs.map