From b493d41c9dd575143caa38ff9955fdc0ab83475f Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Wed, 15 Nov 2023 13:16:39 +0100 Subject: [PATCH] [MNT-23166] Missing docs and CR fixes --- .../components/document-list.component.md | 2 ++ docs/core/components/datatable.component.md | 1 + .../datatable/datatable.component.spec.ts | 30 ++++++++++++------- .../datatable/datatable.component.ts | 4 +-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/docs/content-services/components/document-list.component.md b/docs/content-services/components/document-list.component.md index 71c36ab0a42..867cc759f42 100644 --- a/docs/content-services/components/document-list.component.md +++ b/docs/content-services/components/document-list.component.md @@ -60,6 +60,7 @@ Displays the documents from a repository. | ---- | ---- | ------------- | ----------- | | additionalSorting | [`DataSorting`](../../../lib/core/src/lib/datatable/data/data-sorting.model.ts) | | Defines default sorting. The format is an array of strings `[key direction, otherKey otherDirection]` i.e. `['name desc', 'nodeType asc']` or `['name asc']`. Set this value if you want a base rule to be added to the sorting apart from the one driven by the header. | | allowDropFiles | `boolean` | false | When true, this enables you to drop files directly into subfolders shown as items in the list or into another file to trigger updating it's version. When false, the dropped file will be added to the current folder (ie, the one containing all the items shown in the list). See the [Upload directive](../../core/directives/upload.directive.md) for further details about how the file drop is handled. | +| blurOnResize | `boolean` | true | Toggles blur when columns of the list are being resized. | | columnsPresetKey | `string` | | Key of columns preset set in extension.json| | contentActions | `boolean` | false | Toggles content actions for each row | | contentActionsPosition | `string` | "right" | Position of the content actions dropdown menu. Can be set to "left" or "right". | @@ -71,6 +72,7 @@ Displays the documents from a repository. | headerFilters | `boolean` | false | Toggles the header filters mode. | | imageResolver | `any \| null` | null | Custom function to choose image file paths to show. See the [Image Resolver Model](image-resolver.model.md) page for more information. | | includeFields | `string[]` | | Include additional information about the node in the server request. For example: association, isLink, isLocked and others. | +| isResizingEnabled | `boolean` | false | Toggles column resizing for document list. | | loading | `boolean` | false | Toggles the loading state and animated spinners for the component. Used in combination with `navigate=false` to perform custom navigation and loading state indication. | | locationFormat | `string` | "/" | The default route for all the location-based columns (if declared). | | maxColumnsVisible | `number` | | Limit of possible visible columns, including "$thumbnail" column if provided | diff --git a/docs/core/components/datatable.component.md b/docs/core/components/datatable.component.md index 5eae5ddc439..d81ed66f66b 100644 --- a/docs/core/components/datatable.component.md +++ b/docs/core/components/datatable.component.md @@ -423,6 +423,7 @@ Learm more about styling your datatable: [Customizing the component's styles](#c | actionsPosition | `string` | "right" | Position of the actions dropdown menu. Can be "left" or "right". | | actionsVisibleOnHover | `boolean` | false | Toggles whether the actions dropdown should only be visible if the row is hovered over or the dropdown menu is open. | | allowFiltering | `boolean` | false | Flag that indicate if the datatable allow the use [facet widget](../../../lib/content-services/src/lib/search/models/facet-widget.interface.ts) search for filtering. | +| blurOnResize | `boolean` | true | Toggles blur when columns of the datatable are being resized. | | columns | `any[]` | \[] | The columns that the datatable will show. | | contextMenu | `boolean` | false | Toggles custom context menu for the component. | | data | [`DataTableAdapter`](../../../lib/core/src/lib/datatable/data/datatable-adapter.ts) | | Data source for the table | diff --git a/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts b/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts index 86e7828d012..f90d32cf677 100644 --- a/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts +++ b/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts @@ -1646,11 +1646,19 @@ describe('Column Resizing', () => { let data: { id: number; name: string }[] = []; let dataTableSchema: DataColumn[] = []; + function getTableBody(): HTMLDivElement { + return fixture.debugElement.nativeElement.querySelector('.adf-datatable-body'); + } + + function getResizeHandler(): HTMLDivElement { + return fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle'); + } + const testClassesAfterResizing = (headerColumnsSelector = '.adf-datatable-cell-header', excludedClass = 'adf-datatable__cursor--pointer') => { dataTable.isResizingEnabled = true; fixture.detectChanges(); - const resizeHandle: HTMLElement = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle'); + const resizeHandle: HTMLElement = getResizeHandler(); resizeHandle.dispatchEvent(new MouseEvent('mousedown')); fixture.detectChanges(); @@ -1685,7 +1693,7 @@ describe('Column Resizing', () => { }); it('should NOT display resize handle when the feature is Disabled [isResizingEnabled=false]', () => { - const resizeHandle = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle'); + const resizeHandle = getResizeHandler(); expect(resizeHandle).toBeNull(); const headerColumns = fixture.debugElement.nativeElement.querySelectorAll('.adf-datatable-cell-header'); @@ -1699,7 +1707,7 @@ describe('Column Resizing', () => { dataTable.isResizingEnabled = true; fixture.detectChanges(); - const resizeHandle = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle'); + const resizeHandle = getResizeHandler(); expect(resizeHandle).not.toBeNull(); const headerColumns = fixture.debugElement.nativeElement.querySelectorAll('.adf-datatable-cell-header'); @@ -1743,13 +1751,13 @@ describe('Column Resizing', () => { dataTable.isResizingEnabled = true; fixture.detectChanges(); - const resizeHandle: HTMLElement = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle'); + const resizeHandle: HTMLElement = getResizeHandler(); resizeHandle.dispatchEvent(new MouseEvent('mousedown')); fixture.detectChanges(); }); it('should blur the table body upon resizing starts', () => { - const tableBody = fixture.debugElement.nativeElement.querySelector('.adf-datatable-body'); + const tableBody = getTableBody(); expect(dataTable.isResizing).toBeTrue(); expect(tableBody.classList).toContain('adf-blur-datatable-body'); }); @@ -1757,7 +1765,7 @@ describe('Column Resizing', () => { it('should not blur the table body upon resizing starts when blurOnResize is false', () => { dataTable.blurOnResize = false; fixture.detectChanges(); - const tableBody = fixture.debugElement.nativeElement.querySelector('.adf-datatable-body'); + const tableBody = getTableBody(); expect(dataTable.isResizing).toBeTrue(); expect(tableBody.classList).not.toContain('adf-blur-datatable-body'); }); @@ -1830,7 +1838,7 @@ describe('Column Resizing', () => { tick(); fixture.detectChanges(); - const tableBody = fixture.debugElement.nativeElement.querySelector('.adf-datatable-body'); + const tableBody = getTableBody(); const firstCell: HTMLElement = tableBody.querySelector('[data-automation-id="name1"]'); const secondCell: HTMLElement = tableBody.querySelector('[data-automation-id="name2"]'); @@ -1843,7 +1851,7 @@ describe('Column Resizing', () => { tick(); fixture.detectChanges(); - const tableBody = fixture.debugElement.nativeElement.querySelector('.adf-datatable-body'); + const tableBody = getTableBody(); const firstCell: HTMLElement = tableBody.querySelector('[data-automation-id="name1"]'); const secondCell: HTMLElement = tableBody.querySelector('[data-automation-id="name2"]'); @@ -1855,11 +1863,11 @@ describe('Column Resizing', () => { dataTable.isResizingEnabled = true; fixture.detectChanges(); - const resizeHandle: HTMLElement = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle'); + const resizeHandle: HTMLElement = getResizeHandler(); resizeHandle.dispatchEvent(new MouseEvent('mousedown')); fixture.detectChanges(); - const tableBody = fixture.debugElement.nativeElement.querySelector('.adf-datatable-body'); + const tableBody = getTableBody(); expect(dataTable.isResizing).toBeTrue(); expect(tableBody.classList).toContain('adf-blur-datatable-body'); @@ -1880,7 +1888,7 @@ describe('Column Resizing', () => { dataTable.isResizingEnabled = true; fixture.detectChanges(); - const resizeHandle: HTMLElement = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle'); + const resizeHandle: HTMLElement = getResizeHandler(); resizeHandle.dispatchEvent(new MouseEvent('mousedown')); fixture.detectChanges(); diff --git a/lib/core/src/lib/datatable/components/datatable/datatable.component.ts b/lib/core/src/lib/datatable/components/datatable/datatable.component.ts index 12925b79774..ca48e53fb1a 100644 --- a/lib/core/src/lib/datatable/components/datatable/datatable.component.ts +++ b/lib/core/src/lib/datatable/components/datatable/datatable.component.ts @@ -236,13 +236,13 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges, * Flag that indicates if the datatable allows column resizing. */ @Input() - isResizingEnabled: boolean = false; + isResizingEnabled = false; /** * Flag that indicates if the datatable should be blurred when resizing. */ @Input() - blurOnResize: boolean = true; + blurOnResize = true; headerFilterTemplate: TemplateRef; noContentTemplate: TemplateRef;