@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';
@@ -1434,7 +1434,7 @@ function newTableRow(row) {
1434
1434
  if (!row.value) {
1435
1435
  throw new Error('Unexpected value. TableRow.value cannot be undefined.');
1436
1436
  }
1437
- const newRow = new TableRowImpl({
1437
+ return new TableRowImpl({
1438
1438
  type: row.type || TableRowType.ITEM,
1439
1439
  checked: row.checked || false,
1440
1440
  index: row.index || 0,
@@ -1448,7 +1448,6 @@ function newTableRow(row) {
1448
1448
  state: row.state || 'readonly',
1449
1449
  children: row.children || []
1450
1450
  });
1451
- return newRow;
1452
1451
  }
1453
1452
  /** @hidden */
1454
1453
  function getSelectableRows(rows, selectableKey) {
@@ -1561,6 +1560,35 @@ function convertTreeObjectsToTableRows(source, selectionMode, tableRows, rowComp
1561
1560
  row.children.push(...children);
1562
1561
  rows.push(...children);
1563
1562
  }
1563
+ if (row.level === 0 && row.isTree) {
1564
+ dfs([row], (r) => {
1565
+ const children = r.children || [];
1566
+ const selectedChildren = [];
1567
+ const indeterminateChildren = [];
1568
+ children.forEach((child) => {
1569
+ if (child.checked === true) {
1570
+ selectedChildren.push(child);
1571
+ }
1572
+ else if (child.checked === null) {
1573
+ indeterminateChildren.push(child);
1574
+ }
1575
+ });
1576
+ const selectedAll = selectedChildren.length === children.length && children.length > 0;
1577
+ const selectedSome = selectedChildren.length > 0;
1578
+ if (r.checked) {
1579
+ applySelectionToChildren(rows, r, [], []);
1580
+ return;
1581
+ }
1582
+ if (selectedAll) {
1583
+ r.checked = true;
1584
+ return;
1585
+ }
1586
+ if (selectedSome || indeterminateChildren.length > 0) {
1587
+ r.checked = null;
1588
+ return;
1589
+ }
1590
+ });
1591
+ }
1564
1592
  });
1565
1593
  return rows;
1566
1594
  }
@@ -1586,6 +1614,14 @@ function getSelectionStatusByRowValue(source, selectionMode, tableRows, rowCompa
1586
1614
  return rowMap;
1587
1615
  }
1588
1616
  /** @hidden */
1617
+ function applySelectionToChildren(allRows, row, addedRows, removedRows) {
1618
+ const allChildren = findRowChildren(row, allRows);
1619
+ allChildren.forEach((r) => {
1620
+ r.checked = row.checked;
1621
+ r.checked ? addedRows.push(r) : removedRows.push(r);
1622
+ });
1623
+ }
1624
+ /** @hidden */
1589
1625
  function findRowChildren(row, allRows) {
1590
1626
  const rowsLength = allRows.length;
1591
1627
  /**
@@ -3765,5 +3801,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3765
3801
  * Generated bundle index. Do not edit.
3766
3802
  */
3767
3803
 
3768
- 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 };
3804
+ 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 };
3769
3805
  //# sourceMappingURL=fundamental-ngx-platform-table-helpers.mjs.map