Skip to content

Commit

Permalink
[MNT-23166] Missing docs and CR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalKinas committed Nov 15, 2023
1 parent 7bba2d9 commit b493d41
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 2 additions & 0 deletions docs/content-services/components/document-list.component.md
Original file line number Diff line number Diff line change
Expand Up @@ -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". |
Expand All @@ -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 |
Expand Down
1 change: 1 addition & 0 deletions docs/core/components/datatable.component.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1646,11 +1646,19 @@ describe('Column Resizing', () => {
let data: { id: number; name: string }[] = [];
let dataTableSchema: DataColumn[] = [];

function getTableBody(): HTMLDivElement {

Check failure on line 1649 in lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Missing JSDoc comment
return fixture.debugElement.nativeElement.querySelector('.adf-datatable-body');
}

function getResizeHandler(): HTMLDivElement {

Check failure on line 1653 in lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Missing JSDoc comment
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();

Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -1743,21 +1751,21 @@ 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');
});

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');
});
Expand Down Expand Up @@ -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"]');

Expand All @@ -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"]');

Expand All @@ -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');
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>;
noContentTemplate: TemplateRef<any>;
Expand Down

0 comments on commit b493d41

Please sign in to comment.