ACS-7403: migrate site dropdown to standalone (#9847)

This commit is contained in:
Denys Vuika 2024-07-01 14:25:49 -04:00 committed by GitHub
parent 5fa3afe3a5
commit 0c4259cddf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 244 additions and 335 deletions

View File

@ -275,7 +275,7 @@ for more information about installing and using the source code.
| [Breadcrumb Component](content-services/components/breadcrumb.component.md) | Indicates the current position within a navigation hierarchy. | [Source](../lib/content-services/src/lib/breadcrumb/breadcrumb.component.ts) | | [Breadcrumb Component](content-services/components/breadcrumb.component.md) | Indicates the current position within a navigation hierarchy. | [Source](../lib/content-services/src/lib/breadcrumb/breadcrumb.component.ts) |
| [Content Action component](content-services/components/content-action.component.md) | Adds options to a Document List actions menu for a particular content type. | [Source](../lib/content-services/src/lib/document-list/components/content-action/content-action.component.ts) | | [Content Action component](content-services/components/content-action.component.md) | Adds options to a Document List actions menu for a particular content type. | [Source](../lib/content-services/src/lib/document-list/components/content-action/content-action.component.ts) |
| [Content Metadata Card component](content-services/components/content-metadata-card.component.md) | Displays and edits metadata related to a node. | [Source](../lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts) | | [Content Metadata Card component](content-services/components/content-metadata-card.component.md) | Displays and edits metadata related to a node. | [Source](../lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts) |
| [Content Node Selector Panel component](content-services/components/content-node-selector-panel.component.md) | Opens a Content Node Selector in its own dialog window. | [Source](../lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts) | | [Content Node Selector Panel component](content-services/components/content-node-selector-panel.component.md) | Opens a Content Node Selector in its own dialog window. | [Source](../lib/content-services/src/lib/content-node-selector/content-node-selector-panel/content-node-selector-panel.component.ts) |
| [Content Node Selector component](content-services/components/content-node-selector.component.md) | Allows a user to select items from a Content Services repository. | [Source](../lib/content-services/src/lib/content-node-selector/content-node-selector.component.ts) | | [Content Node Selector component](content-services/components/content-node-selector.component.md) | Allows a user to select items from a Content Services repository. | [Source](../lib/content-services/src/lib/content-node-selector/content-node-selector.component.ts) |
| [Content Type Dialog component](content-services/components/content-type-dialog.component.md) | Confirm dialog when user changes content type of a node. | [Source](../lib/content-services/src/lib/content-type/content-type-dialog.component.ts) | | [Content Type Dialog component](content-services/components/content-type-dialog.component.md) | Confirm dialog when user changes content type of a node. | [Source](../lib/content-services/src/lib/content-type/content-type-dialog.component.ts) |
| [Content User Info component](content-services/components/content-user-info.component.md) | Shows user information for CONTENT and CONTENT_SSO mode. | [Source](../lib/content-services/src/lib/content-user-info/content-user-info.component.ts) | | [Content User Info component](content-services/components/content-user-info.component.md) | Shows user information for CONTENT and CONTENT_SSO mode. | [Source](../lib/content-services/src/lib/content-user-info/content-user-info.component.ts) |
@ -305,7 +305,7 @@ for more information about installing and using the source code.
| [Search Sorting Picker Component](content-services/components/search-sorting-picker.component.md) | Provides an ability to select one of the predefined sorting definitions for search results: | [Source](../lib/content-services/src/lib/search/components/search-sorting-picker/search-sorting-picker.component.ts) | | [Search Sorting Picker Component](content-services/components/search-sorting-picker.component.md) | Provides an ability to select one of the predefined sorting definitions for search results: | [Source](../lib/content-services/src/lib/search/components/search-sorting-picker/search-sorting-picker.component.ts) |
| [Search text component](content-services/components/search-text.component.md) | Implements a text input widget for the Search Filter component. | [Source](../lib/content-services/src/lib/search/components/search-text/search-text.component.ts) | | [Search text component](content-services/components/search-text.component.md) | Implements a text input widget for the Search Filter component. | [Source](../lib/content-services/src/lib/search/components/search-text/search-text.component.ts) |
| [Search component](content-services/components/search.component.md) | Searches items for supplied search terms. | [Source](../lib/content-services/src/lib/search/components/search.component.ts) | | [Search component](content-services/components/search.component.md) | Searches items for supplied search terms. | [Source](../lib/content-services/src/lib/search/components/search.component.ts) |
| [Sites Dropdown component](content-services/components/sites-dropdown.component.md) | Displays a dropdown menu to show and interact with the sites of the current user. | [Source](../lib/content-services/src/lib/site-dropdown/sites-dropdown.component.ts) | | [Sites Dropdown component](content-services/components/sites-dropdown.component.md) | Displays a dropdown menu to show and interact with the sites of the current user. | [Source](../lib/content-services/src/lib/content-node-selector/site-dropdown/sites-dropdown.component.ts) |
| [Tag Node Actions List component](content-services/components/tag-actions.component.md) | Shows available actions for tags. | [Source](../lib/content-services/src/lib/tag/tag-actions.component.ts) | | [Tag Node Actions List component](content-services/components/tag-actions.component.md) | Shows available actions for tags. | [Source](../lib/content-services/src/lib/tag/tag-actions.component.ts) |
| [Tag List component](content-services/components/tag-list.component.md) | Shows tags for an item. | [Source](../lib/content-services/src/lib/tag/tag-list.component.ts) | | [Tag List component](content-services/components/tag-list.component.md) | Shows tags for an item. | [Source](../lib/content-services/src/lib/tag/tag-list.component.ts) |
| [Tag Node List component](content-services/components/tag-node-list.component.md) | Shows tags for a node. | [Source](../lib/content-services/src/lib/tag/tag-node-list.component.ts) | | [Tag Node List component](content-services/components/tag-node-list.component.md) | Shows tags for a node. | [Source](../lib/content-services/src/lib/tag/tag-node-list.component.ts) |

View File

@ -2,10 +2,10 @@
Title: Content Node Selector Panel component Title: Content Node Selector Panel component
Added: v2.1.0 Added: v2.1.0
Status: Active Status: Active
Last reviewed: 2019-03-20 Last reviewed: 2024-06-21
--- ---
# [Content Node Selector Panel component](../../../lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts "Defined in content-node-selector-panel.component.ts") # Content Node Selector Panel Component
Opens a [Content Node Selector](content-node-selector.component.md) in its own dialog window. Opens a [Content Node Selector](content-node-selector.component.md) in its own dialog window.
@ -28,50 +28,53 @@ Opens a [Content Node Selector](content-node-selector.component.md) in its own
### Properties ### Properties
| Name | Type | Default value | Description | | Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- | |-------------------------------|--------------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| breadcrumbTransform | `Function` | | Transformation to be performed on the chosen/folder node before building the breadcrumb UI. Can be useful when custom formatting is needed for the breadcrumb. You can change the path elements from the node that are used to build the breadcrumb using this function. | | breadcrumbTransform | `Function` | | Transformation to be performed on the chosen/folder node before building the breadcrumb UI. Can be useful when custom formatting is needed for the breadcrumb. You can change the path elements from the node that are used to build the breadcrumb using this function. |
| currentFolderId | `string` | null | Node ID of the folder currently listed. | | currentFolderId | `string` | null | Node ID of the folder currently listed. |
| dropdownHideMyFiles | `boolean` | false | Hide the "My Files" option added to the site list by default. See the [Sites Dropdown component](sites-dropdown.component.md) for more information. | | dropdownHideMyFiles | `boolean` | false | Hide the "My Files" option added to the site list by default. See the [Sites Dropdown component](sites-dropdown.component.md) for more information. |
| dropdownSiteList | [`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md) | null | Custom site for site dropdown. This is the same as the `siteList`. property of the Sites Dropdown component (see its doc page for more information). | | dropdownSiteList | `SitePaging` | null | Custom site for site dropdown. This is the same as the `siteList`. property of the Sites Dropdown component (see its doc page for more information). |
| imageResolver | [`ImageResolver`](../../../lib/content-services/src/lib/document-list/data/image-resolver.model.ts) | null | Custom image resolver function. See the [Image Resolver Model](image-resolver.model.md) page for more information. | | imageResolver | `ImageResolver` | null | Custom image resolver function. See the [Image Resolver Model](../models/image-resolver.model.md) page for more information. |
| isSelectionValid | [`ValidationFunction`](../../../lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts) | defaultValidation | Function used to decide if the selected node has permission to be selected. Default value is a function that always returns true. | | isSelectionValid | `ValidationFunction` | defaultValidation | Function used to decide if the selected node has permission to be selected. Default value is a function that always returns true. |
| pageSize | `number` | | Number of items shown per page in the list. | | pageSize | `number` | | Number of items shown per page in the list. |
| restrictRootToCurrentFolderId | `boolean` | false | If true will restrict the search and breadcrumbs to the currentFolderId | | restrictRootToCurrentFolderId | `boolean` | false | If true will restrict the search and breadcrumbs to the currentFolderId |
| selectionMode | `"single" \| "multiple"` | "single" | Define the selection mode for document list. The allowed values are single or multiple | | selectionMode | `"single" \| "multiple"` | "single" | Define the selection mode for document list. The allowed values are single or multiple |
| where | `string` | | Custom _where_ filter function. See the [Document List component](../../content-services/components/document-list.component.md) for more information. | | where | `string` | | Custom _where_ filter function. See the [Document List component](../../content-services/components/document-list.component.md) for more information. |
| excludeSiteContent | `string[]` | | Custom list of site content componentIds. Used to filter out the corresponding items from the displayed nodes | | excludeSiteContent | `string[]` | | Custom list of site content componentIds. Used to filter out the corresponding items from the displayed nodes |
| rowFilter | [`RowFilter`](../../../lib/content-services/src/lib/document-list/data/row-filter.model.ts) | | Custom row filter function. See the [Row Filter Model](row-filter.model.md) page for more information. | | rowFilter | `RowFilter` | | Custom row filter function. See the [Row Filter Model](row-filter.model.md) page for more information. |
| showDropdownSiteList | `boolean` | | Toggle sites list dropdown rendering | | showDropdownSiteList | `boolean` | | Toggle sites list dropdown rendering |
| showFilesInResult | `void` | | Shows the files and folders in the search result | | showFilesInResult | `void` | | Shows the files and folders in the search result |
| showNodeCounter | `boolean` | | Shows the node counter in the breadcrumb | | showNodeCounter | `boolean` | | Shows the node counter in the breadcrumb |
| showSearch | `boolean` | | Toggle search input rendering | | showSearch | `boolean` | | Toggle search input rendering |
### Events ### Events
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | |------------------|--------------------------------|-------------------------------------------|
| currentFolder | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Node>` | Emitted when current folder loaded. | | currentFolder | `EventEmitter<Node>` | Emitted when current folder loaded. |
| folderLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when folder loaded. | | folderLoaded | `EventEmitter<any>` | Emitted when folder loaded. |
| navigationChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntryEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the navigation changes. | | navigationChange | `EventEmitter<NodeEntryEvent>` | Emitted when the navigation changes. |
| select | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Node[]>` | Emitted when the user has chosen an item. | | select | `EventEmitter<Node[]>` | Emitted when the user has chosen an item. |
| showingSearch | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when search is running. | | showingSearch | `EventEmitter<boolean>` | Emitted when search is running. |
| siteChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the select site changes. | | siteChange | `EventEmitter<string>` | Emitted when the select site changes. |
## Details ## Details
This component opens a _content node selector_ in its own dialog window. This behaves a lot like the This component opens a _content node selector_ in its own dialog window. This behaves a lot like the
standard file open/save dialogs used by applications to choose files. Full details are given in the standard file open/save dialogs used by applications to choose files. Full details are given in the
[Content Node Selector component](content-node-selector.component.md) page (this is similar but does [Content Node Selector component](content-node-selector.component.md) page (this is similar but does
not manage the dialog window for you). Also, the not manage the dialog window for you).
[Content Node Dialog service](../services/content-node-dialog.service.md) has several methods that give you
Also, the [Content Node Dialog service](../services/content-node-dialog.service.md) has several methods that give you
finer control over the behavior of the dialog. finer control over the behavior of the dialog.
### Using the breadcrumbTransform function ### Using the breadcrumbTransform function
The `breadcrumbTransform` property lets you modify the [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/Node.md) object that is used to generate the The `breadcrumbTransform` property lets you modify the `Node` object that is used to generate the
list of breadcrumbs. You can use this, for example, to remove path elements that are not list of breadcrumbs. You can use this, for example, to remove path elements that are not
relevant to the use case. See the [Breadcrumb component](breadcrumb.component.md) page for an relevant to the use case.
See the [Breadcrumb component](breadcrumb.component.md) page for an
example of how to use this function. example of how to use this function.
## See also ## See also

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2019-01-16 Last reviewed: 2019-01-16
--- ---
# [Content Node Selector component](../../../lib/content-services/src/lib/content-node-selector/content-node-selector.component.ts "Defined in content-node-selector.component.ts") # Content Node Selector component
Allows a user to select items from a Content Services repository. Allows a user to select items from a Content Services repository.
@ -15,19 +15,18 @@ Allows a user to select items from a Content Services repository.
The [Content Node Selector component](content-node-selector.component.md) works a lot like the standard File Open/Save The [Content Node Selector component](content-node-selector.component.md) works a lot like the standard File Open/Save
dialog used by desktop applications except that it chooses items from a Content Services dialog used by desktop applications except that it chooses items from a Content Services
repository rather than the filesystem. For example, the repository rather than the filesystem.
[Document List component](document-list.component.md) uses a selector to choose the targets
of Copy/Move actions (see the [Content Action component](content-action.component.md) for For example, the [Document List component](document-list.component.md) uses a selector to choose the targets
more information). of Copy/Move actions (see the [Content Action component](content-action.component.md) for more information).
### Showing the dialog ### Showing the dialog
Unlike most components, the [Content Node Selector Component](content-node-selector.component.md) is typically shown in a dialog box Unlike most components, the [Content Node Selector Component](content-node-selector.component.md) is typically shown in a dialog box
rather than the main page and you are responsible for opening the dialog yourself. You can use the rather than the main page, and you are responsible for opening the dialog yourself.
[Angular Material Dialog](https://material.angular.io/components/dialog/overview) for this,
as shown in the usage example. ADF provides the [`ContentNodeSelectorComponentData`](../../../lib/content-services/src/lib/content-node-selector/content-node-selector.component-data.interface.ts) interface You can use the [Angular Material Dialog](https://material.angular.io/components/dialog/overview) for this, as shown in the usage example.
to work with the Dialog's ADF provides the `ContentNodeSelectorComponentData` interface to work with the Dialog [data option](https://material.angular.io/components/dialog/overview#sharing-data-with-the-dialog-component-):
[data option](https://material.angular.io/components/dialog/overview#sharing-data-with-the-dialog-component-):
```ts ```ts
export interface ContentNodeSelectorComponentData { export interface ContentNodeSelectorComponentData {
@ -55,22 +54,22 @@ export interface ContentNodeSelectorComponentData {
The properties are described in the table below: The properties are described in the table below:
| Name | Type | Default value | Description | | Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- | |----------------------|----------------------|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| title | `string` | "" | Dialog title | | title | `string` | "" | Dialog title |
| actionName | `string` | "" | Text to appear on the dialog's main action button ("Move", "Copy", etc) | | actionName | `string` | "" | Text to appear on the dialog's main action button ("Move", "Copy", etc) |
| currentFolderId | `string` | `null` | [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/Node.md) ID of the folder currently listed. | | currentFolderId | `string` | `null` | The ID of the folder node currently listed. |
| dropdownHideMyFiles | `boolean` | `false` | Hide the "My Files" option added to the site list by default. See the [Sites Dropdown component](sites-dropdown.component.md) for more information. | | dropdownHideMyFiles | `boolean` | `false` | Hide the "My Files" option added to the site list by default. See the [Sites Dropdown component](sites-dropdown.component.md) for more information. |
| dropdownSiteList | [`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md) | `null` | Custom site for site dropdown same as siteList. See the [Sites Dropdown component](sites-dropdown.component.md) for more information. | | dropdownSiteList | `SitePaging` | `null` | Custom site for site dropdown same as siteList. See the [Sites Dropdown component](sites-dropdown.component.md) for more information. |
| rowFilter | [`RowFilter`](../../../lib/content-services/src/lib/document-list/data/row-filter.model.ts) | `null` | Custom row filter function. See the [Row Filter Model](../models/row-filter.model.md) page for more information. | | rowFilter | `RowFilter` | `null` | Custom row filter function. See the [Row Filter Model](../models/row-filter.model.md) page for more information. |
| where | `string` | `null` | Custom _where_ filter function. See the [Document List component](document-list.component.md) for more information. | | where | `string` | `null` | Custom _where_ filter function. See the [Document List component](document-list.component.md) for more information. |
| imageResolver | [`ImageResolver`](../../../lib/content-services/src/lib/document-list/data/image-resolver.model.ts) | `null` | Custom image resolver function. See the [Image Resolver Model](../models/image-resolver.model.md) page for more information. | | imageResolver | `ImageResolver` | `null` | Custom image resolver function. See the [Image Resolver Model](../models/image-resolver.model.md) page for more information. |
| pageSize | `number` | | Number of items shown per page in the list. | | pageSize | `number` | | Number of items shown per page in the list. |
| isSelectionValid | [`ValidationFunction`](../../../lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts) | `defaultValidation` | Function used to decide if the selected node has permission to be selected. Default value is a function that always returns true. | | isSelectionValid | `ValidationFunction` | `defaultValidation` | Function used to decide if the selected node has permission to be selected. Default value is a function that always returns true. |
| breadcrumbTransform | `(node: any) => any` | | Transformation to be performed on the chosen/folder node before building the breadcrumb UI. Can be useful when custom formatting is needed for the breadcrumb. You can change the path elements from the node that are used to build the breadcrumb using this function. | | breadcrumbTransform | `(node: any) => any` | | Transformation to be performed on the chosen/folder node before building the breadcrumb UI. Can be useful when custom formatting is needed for the breadcrumb. You can change the path elements from the node that are used to build the breadcrumb using this function. |
| select | [`Subject<Node>`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/Node.md) | | Event emitted with the current node selection when the dialog closes | | select | `Subject<Node>` | | Event emitted with the current node selection when the dialog closes |
| showSearch | `boolean` | `true` | Render search input | | showSearch | `boolean` | `true` | Render search input |
| showDropdownSiteList | `boolean` | `true` | Render sites list dropdown menu | | showDropdownSiteList | `boolean` | `true` | Render sites list dropdown menu |
If you don't want to manage the dialog yourself then it is easier to use the If you don't want to manage the dialog yourself then it is easier to use the
[Content Node Selector Panel component](content-node-selector-panel.component.md), or the [Content Node Selector Panel component](content-node-selector-panel.component.md), or the
@ -81,65 +80,65 @@ the dialog for you.
```ts ```ts
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { ContentNodeSelectorComponentData, ContentNodeSelectorComponent} from '@adf/content-services' import { ContentNodeSelectorComponentData, ContentNodeSelectorComponent} from '@adf/content-services';
import { Subject } from 'rxjs/Subject'; import { Subject } from 'rxjs/Subject';
...
constructor(dialog: MatDialog ... ) {} export class MyComponent {
constructor(dialog: MatDialog) {
}
openSelectorDialog() { openSelectorDialog() {
data: ContentNodeSelectorComponentData = { data: ContentNodeSelectorComponentData = {
title: "Choose an item", title: "Choose an item",
actionName: "Choose", actionName: "Choose",
currentFolderId: someFolderId, currentFolderId: someFolderId,
select: new Subject<Node[]>() select: new Subject<Node[]>()
}; };
this.dialog.open( this.dialog.open(
ContentNodeSelectorComponent, ContentNodeSelectorComponent,
{ {
data, panelClass: 'adf-content-node-selector-dialog', data, panelClass: 'adf-content-node-selector-dialog',
width: '630px' width: '630px'
} }
); );
data.select.subscribe((selections: Node[]) => { data.select.subscribe((selections: Node[]) => {
// Use or store selection... // Use or store selection...
}, },
(error)=>{ (error) => {
//your error handling //your error handling
}, },
()=>{ () => {
//action called when an action or cancel is clicked on the dialog //action called when an action or cancel is clicked on the dialog
this.dialog.closeAll(); this.dialog.closeAll();
}); });
}
} }
``` ```
All the results will be streamed to the select [subject](http://reactivex.io/rxjs/manual/overview.html#subject) present in the [`ContentNodeSelectorComponentData`](../../../lib/content-services/src/lib/content-node-selector/content-node-selector.component-data.interface.ts) object passed to the dialog. All the results will be streamed to the select `subject` present in the `ContentNodeSelectorComponentData` object passed to the dialog.
When the dialog action is selected by clicking, the `data.select` stream will be completed. When the dialog action is selected by clicking, the `data.select` stream will be completed.
### RowFilter and ImageResolver ### RowFilter and ImageResolver
The [Content Node Selector](content-node-selector.component.md) uses a The [Content Node Selector](content-node-selector.component.md) uses a [Document List](document-list.component.md) to display the items that the user can choose.
[Document List](document-list.component.md) to display the As with the standard Document List, you can supply a custom **row filter** function (to hide items that can't be chosen) and a custom **image resolver**
items that the user can choose. As with the standard Document List, you can supply a custom function (to select an image to show in a particular list cell).
**row filter** function (to hide items that can't be chosen) and a custom **image resolver**
function (to select an image to show in a particular list cell). For example, you could use For example, you could use a row filter to hide document nodes in a folder selector.
a row filter to hide document nodes in a folder selector. See the See the [Row Filter Model](../models/row-filter.model.md) and [Image Resolver Model](../models/image-resolver.model.md) pages for more information.
[Row Filter Model](../models/row-filter.model.md) and [Image Resolver Model](../models/image-resolver.model.md)
pages for more information.
### Using the breadcrumbTransform function ### Using the breadcrumbTransform function
The `breadcrumbTransform` property of [`ContentNodeSelectorComponentData`](../../../lib/content-services/src/lib/content-node-selector/content-node-selector.component-data.interface.ts) lets you modify The `breadcrumbTransform` property of `ContentNodeSelectorComponentData` lets you modify
the [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/Node.md) object that is used to generate the the `Node` object that is used to generate the list of breadcrumbs.
list of breadcrumbs. You can use this, for example, to remove path elements that are not
relevant to the use case. See the [Breadcrumb component](breadcrumb.component.md) page for an You can use this, for example, to remove path elements that are not relevant to the use case.
example of how to use this function. See the [Breadcrumb component](breadcrumb.component.md) page for an example of how to use this function.
## See also ## See also
- [Document list component](document-list.component.md) - [Document List Component](document-list.component.md)
- [Content Node Selector Panel component](content-node-selector-panel.component.md) - [Content Node Selector Panel component](content-node-selector-panel.component.md)
- [Content Node Dialog service](../services/content-node-dialog.service.md) - [Content Node Dialog service](../services/content-node-dialog.service.md)

View File

@ -1,11 +1,4 @@
--- # Sites Dropdown component
Title: Sites Dropdown component
Added: v2.0.0
Status: Active
Last reviewed: 2018-11-19
---
# [Sites Dropdown component](../../../lib/content-services/src/lib/site-dropdown/sites-dropdown.component.ts "Defined in sites-dropdown.component.ts")
Displays a dropdown menu to show and interact with the sites of the current user. Displays a dropdown menu to show and interact with the sites of the current user.
@ -19,20 +12,24 @@ Displays a dropdown menu to show and interact with the sites of the current user
</adf-sites-dropdown> </adf-sites-dropdown>
``` ```
## Class members ## API
```ts
import { SitesDropdownComponent } from '@alfresco/adf-content-services';
```
### Properties ### Properties
| Name | Type | Default value | Description | | Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- | |-------------|--------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| hideMyFiles | `boolean` | false | Hide the "My Files" option. | | hideMyFiles | `boolean` | false | Hide the "My Files" option. |
| placeholder | `string` | | Text or a translation key to act as a placeholder. Default value is the key "DROPDOWN.PLACEHOLDER_LABEL". | | placeholder | `string` | | Text or a translation key to act as a placeholder. Default value is the key "DROPDOWN.PLACEHOLDER_LABEL". |
| relations | `string` | | Filter for the results of the sites query. Possible values are "members" and "containers". When "members" is used, the site list will be restricted to the sites that the user is a member of. | | relations | `string` | | Filter for the results of the sites query. Possible values are "members" and "containers". When "members" is used, the site list will be restricted to the sites that the user is a member of. |
| siteList | [`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md) | null | A custom list of sites to be displayed by the dropdown. If no value is given, the sites of the current user are displayed by default. A list of objects only with properties 'title' and 'guid' is enough to be able to display the dropdown. | | siteList | `SitePaging` | null | A custom list of sites to be displayed by the dropdown. If no value is given, the sites of the current user are displayed by default. A list of objects only with properties 'title' and 'guid' is enough to be able to display the dropdown. |
| value | `string` | null | Id of the selected site | | value | `string` | null | Id of the selected site |
### Events ### Events
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | |--------|---------------------------|-------------------------------------------------------------------------------------------------------|
| change | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`>` | Emitted when the user selects a site. When the default option is selected, an empty model is emitted. | | change | `EventEmitter<SiteEntry>` | Emitted when the user selects a site. When the default option is selected, an empty model is emitted. |

View File

@ -1,36 +1,30 @@
--- # Image Resolver Model
Title: Image Resolver Model
Added: v2.0.0
Status: Active
Last reviewed: 2019-02-08
---
# [Image Resolver Model](../../../lib/content-services/document-list/data/image-resolver.model.ts "Defined in image-resolver.model.ts")
Defines the Image Resolver function used by the [Document List Component](../components/document-list.component.md). Defines the Image Resolver function used by the [Document List Component](../components/document-list.component.md).
## Definitions ## Definitions
- `type` **[`ImageResolver`](../../../lib/content-services/src/lib/document-list/data/image-resolver.model.ts)** = (row: [`DataRow`](../../../lib/core/src/lib/datatable/data/data-row.model.ts), column: [`DataColumn`](../../../lib/core/src/lib/datatable/data/data-column.model.ts)) => `string` - `type` **ImageResolver** = (row: `DataRow`, column: `DataColumn`) => `string`
- _row:_ [`DataRow`](../../../lib/core/src/lib/datatable/data/data-row.model.ts) - Data that defines the row - _row:_ `DataRow` - Data that defines the row
- _column:_ [`DataColumn`](../../../lib/core/src/lib/datatable/data/data-column.model.ts) - Data that defines the column - _column:_ `DataColumn` - Data that defines the column
- **Returns** File path for the image - **Returns** File path for the image
## Details ## Details
An image resolver function selects an image file path for an item in An image resolver function selects an image file path for an item in a [Document List Component](../components/document-list.component.md)
a [Document List Component](../components/document-list.component.md) or another component that uses the Document List (such as the [Content Node Selector Panel Component](../components/content-node-selector-panel.component.md)).
or another component that uses the Document List (such as the
[Content Node Selector Panel Component](../components/content-node-selector-panel.component.md)). You can supply your own image resolver You can supply your own image resolver to manage the way folder/file icons and thumbnails are resolved (ie, which image is shown for which item).
to manage the way folder/file icons and thumbnails are resolved (ie, which image is shown for which item).
**Note:** Image resolvers are executed only for columns of the `image` type. **Note:** Image resolvers are executed only for columns of the `image` type.
A typical image resolver implementation receives [`DataRow`](../../../lib/core/src/lib/datatable/data/data-row.model.ts) and [`DataColumn`](../../../lib/core/src/lib/datatable/data/data-column.model.ts) objects as parameters: A typical image resolver implementation receives `DataRow` and `DataColumn` objects as parameters:
```ts ```ts
myImageResolver(row: DataRow, col: DataColumn): string { export class MyComponent {
return '/path/to/image'; myImageResolver(row: DataRow, col: DataColumn): string {
return '/path/to/image';
}
} }
``` ```
@ -74,15 +68,13 @@ export class View1 {
let name = row.getValue(col.key); let name = row.getValue(col.key);
// Format image url // Format image url
return `http://<my custom path to folder icon>/${name}`; return `https://<my custom path to folder icon>/${name}`;
} }
// For the rest of the cases just fallback to default behaviour. // For the rest of the cases just fallback to default behaviour.
return null; return null;
}; };
} }
} }
``` ```

View File

@ -21,15 +21,15 @@ import { By } from '@angular/platform-browser';
import { Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging, SitePagingList } from '@alfresco/js-api'; import { Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging, SitePagingList } from '@alfresco/js-api';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
import { ContentTestingModule } from '../testing/content.testing.module'; import { ContentTestingModule } from '../../testing/content.testing.module';
import { DocumentListService } from '../document-list/services/document-list.service'; import { DocumentListService } from '../../document-list/services/document-list.service';
import { DocumentListComponent } from '../document-list/components/document-list.component'; import { DocumentListComponent } from '../../document-list/components/document-list.component';
import { CustomResourcesService } from '../document-list/services/custom-resources.service'; import { CustomResourcesService } from '../../document-list/services/custom-resources.service';
import { NodeEntryEvent, ShareDataRow } from '../document-list'; import { NodeEntryEvent, ShareDataRow } from '../../document-list';
import { SearchQueryBuilderService } from '../search'; import { SearchQueryBuilderService } from '../../search';
import { mockSearchRequest } from '../mock/search-query.mock'; import { mockSearchRequest } from '../../mock/search-query.mock';
import { SitesService } from '../common/services/sites.service'; import { SitesService } from '../../common/services/sites.service';
import { NodesApiService } from '../common/services/nodes-api.service'; import { NodesApiService } from '../../common/services/nodes-api.service';
const fakeResultSetPaging: ResultSetPaging = { const fakeResultSetPaging: ResultSetPaging = {
list: { list: {

View File

@ -147,8 +147,7 @@ h2.adf-search-results-label {
.adf-datatable-body .adf-datatable-row { .adf-datatable-body .adf-datatable-row {
min-height: 40px; min-height: 40px;
@media screen and (-ms-high-contrast: active), @media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
screen and (-ms-high-contrast: none) {
padding-top: 15px; padding-top: 15px;
} }

View File

@ -20,17 +20,17 @@ import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testin
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { Node, NodeEntry, NodePaging, ResultSetPaging, Site, SiteEntry, SitePaging, SitePagingList, UserInfo } from '@alfresco/js-api'; import { Node, NodeEntry, NodePaging, ResultSetPaging, Site, SiteEntry, SitePaging, SitePagingList, UserInfo } from '@alfresco/js-api';
import { DataRow, ThumbnailService, DataColumn } from '@alfresco/adf-core'; import { DataRow, ThumbnailService, DataColumn } from '@alfresco/adf-core';
import { ContentService, UploadService, NodesApiService, SitesService, FileModel, FileUploadStatus, FileUploadCompleteEvent } from '../common'; import { ContentService, UploadService, NodesApiService, SitesService, FileModel, FileUploadStatus, FileUploadCompleteEvent } from '../../common';
import { of, throwError } from 'rxjs'; import { of, throwError } from 'rxjs';
import { DropdownBreadcrumbComponent } from '../breadcrumb'; import { DropdownBreadcrumbComponent } from '../../breadcrumb';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
import { ContentTestingModule } from '../testing/content.testing.module'; import { ContentTestingModule } from '../../testing/content.testing.module';
import { DocumentListService } from '../document-list/services/document-list.service'; import { DocumentListService } from '../../document-list/services/document-list.service';
import { DropdownSitesComponent } from '../site-dropdown/sites-dropdown.component'; import { DropdownSitesComponent } from '../site-dropdown/sites-dropdown.component';
import { NodeEntryEvent, ShareDataRow, ShareDataTableAdapter } from '../document-list'; import { NodeEntryEvent, ShareDataRow, ShareDataTableAdapter } from '../../document-list';
import { SearchQueryBuilderService } from '../search'; import { SearchQueryBuilderService } from '../../search';
import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service'; import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service';
import { mockContentModelTextProperty } from '../mock/content-model.mock'; import { mockContentModelTextProperty } from '../../mock/content-model.mock';
const fakeResultSetPaging: ResultSetPaging = { const fakeResultSetPaging: ResultSetPaging = {
list: { list: {

View File

@ -25,18 +25,18 @@ import {
DataSorting, DataSorting,
ShowHeaderMode ShowHeaderMode
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { NodesApiService, UploadService, FileUploadCompleteEvent, FileUploadDeleteEvent, SitesService } from '../common'; import { NodesApiService, UploadService, FileUploadCompleteEvent, FileUploadDeleteEvent, SitesService } from '../../common';
import { UntypedFormControl } from '@angular/forms'; import { UntypedFormControl } from '@angular/forms';
import { Node, NodePaging, Pagination, SiteEntry, SitePaging, NodeEntry, SearchRequest, RequestScope } from '@alfresco/js-api'; import { Node, NodePaging, Pagination, SiteEntry, SitePaging, NodeEntry, SearchRequest, RequestScope } from '@alfresco/js-api';
import { DocumentListComponent } from '../document-list/components/document-list.component'; import { DocumentListComponent } from '../../document-list/components/document-list.component';
import { RowFilter } from '../document-list/data/row-filter.model'; import { RowFilter } from '../../document-list/data/row-filter.model';
import { ImageResolver } from '../document-list/data/image-resolver.model'; import { ImageResolver } from '../../document-list/data/image-resolver.model';
import { CustomResourcesService } from '../document-list/services/custom-resources.service'; import { CustomResourcesService } from '../../document-list/services/custom-resources.service';
import { ShareDataRow } from '../document-list/data/share-data-row.model'; import { ShareDataRow } from '../../document-list/data/share-data-row.model';
import { NodeEntryEvent } from '../document-list/components/node.event'; import { NodeEntryEvent } from '../../document-list/components/node.event';
import { debounceTime, takeUntil } from 'rxjs/operators'; import { debounceTime, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { SearchQueryBuilderService } from '../search'; import { SearchQueryBuilderService } from '../../search';
import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service'; import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service';
export type ValidationFunction = (entry: Node) => boolean; export type ValidationFunction = (entry: Node) => boolean;

View File

@ -16,10 +16,9 @@
*/ */
import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service'; import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service';
import { mockContentModelDateProperty, mockContentModelTextProperty, mockConvertedSearchCategoriesFromModels } from '../mock/content-model.mock'; import { mockContentModelDateProperty, mockContentModelTextProperty, mockConvertedSearchCategoriesFromModels } from '../../mock/content-model.mock';
describe('ContentNodeSelectorPanelService', () => { describe('ContentNodeSelectorPanelService', () => {
const contentNodeSelectorPanelService = new ContentNodeSelectorPanelService(); const contentNodeSelectorPanelService = new ContentNodeSelectorPanelService();
it('should support text type', () => { it('should support text type', () => {
@ -42,7 +41,7 @@ describe('ContentNodeSelectorPanelService', () => {
}); });
it('should modelPropertyTypeToSearchFilterTypeMap contain only the supported types', () => { it('should modelPropertyTypeToSearchFilterTypeMap contain only the supported types', () => {
const expectedSupportedTypesMap = new Map<string, string> (); const expectedSupportedTypesMap = new Map<string, string>();
expectedSupportedTypesMap.set('d:text', 'text'); expectedSupportedTypesMap.set('d:text', 'text');
expectedSupportedTypesMap.set('d:date', 'date-range'); expectedSupportedTypesMap.set('d:date', 'date-range');
expectedSupportedTypesMap.set('d:datetime', 'datetime-range'); expectedSupportedTypesMap.set('d:datetime', 'datetime-range');

View File

@ -16,15 +16,14 @@
*/ */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { SearchCategory } from '../search/models/search-category.interface'; import { SearchCategory } from '../../search/models/search-category.interface';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ContentNodeSelectorPanelService { export class ContentNodeSelectorPanelService {
propertyTypes = ['d:text', 'd:date', 'd:datetime']; propertyTypes = ['d:text', 'd:date', 'd:datetime'];
modelPropertyTypeToSearchFilterTypeMap = new Map<string, string> (); modelPropertyTypeToSearchFilterTypeMap = new Map<string, string>();
customModels: any[]; customModels: any[];
constructor() { constructor() {
@ -35,7 +34,7 @@ export class ContentNodeSelectorPanelService {
convertCustomModelPropertiesToSearchCategories(): SearchCategory[] { convertCustomModelPropertiesToSearchCategories(): SearchCategory[] {
const searchConfig: SearchCategory[] = []; const searchConfig: SearchCategory[] = [];
this.customModels?.forEach( (propertyModel) => { this.customModels?.forEach((propertyModel) => {
searchConfig.push(this.convertModelPropertyIntoSearchFilter(propertyModel)); searchConfig.push(this.convertModelPropertyIntoSearchFilter(propertyModel));
}); });
@ -46,7 +45,7 @@ export class ContentNodeSelectorPanelService {
let filterSearch: SearchCategory; let filterSearch: SearchCategory;
if (this.isTypeSupported(modelProperty.dataType)) { if (this.isTypeSupported(modelProperty.dataType)) {
filterSearch = { filterSearch = {
id : modelProperty.prefixedName, id: modelProperty.prefixedName,
name: modelProperty.prefixedName, name: modelProperty.prefixedName,
expanded: false, expanded: false,
enabled: true, enabled: true,
@ -66,5 +65,4 @@ export class ContentNodeSelectorPanelService {
isTypeSupported(dataType: string): boolean { isTypeSupported(dataType: string): boolean {
return this.propertyTypes.includes(dataType); return this.propertyTypes.includes(dataType);
} }
} }

View File

@ -29,7 +29,7 @@ import { ContentTestingModule } from '../testing/content.testing.module';
import { DocumentListService } from '../document-list/services/document-list.service'; import { DocumentListService } from '../document-list/services/document-list.service';
import { DocumentListComponent } from '../document-list/components/document-list.component'; import { DocumentListComponent } from '../document-list/components/document-list.component';
import { UploadModule } from '../upload'; import { UploadModule } from '../upload';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel/content-node-selector-panel.component';
import { NodeAction } from '../document-list/models/node-action.enum'; import { NodeAction } from '../document-list/models/node-action.enum';
import { SitesService } from '../common/services/sites.service'; import { SitesService } from '../common/services/sites.service';
import { NodesApiService } from '../common/services/nodes-api.service'; import { NodesApiService } from '../common/services/nodes-api.service';

View File

@ -19,10 +19,8 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MaterialModule } from '../material.module'; import { MaterialModule } from '../material.module';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel/content-node-selector-panel.component';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
import { ContentNodeSelectorComponent } from './content-node-selector.component'; import { ContentNodeSelectorComponent } from './content-node-selector.component';
import { SitesDropdownModule } from '../site-dropdown/sites-dropdown.module';
import { BreadcrumbModule } from '../breadcrumb/breadcrumb.module'; import { BreadcrumbModule } from '../breadcrumb/breadcrumb.module';
import { SearchModule } from '../search/search.module'; import { SearchModule } from '../search/search.module';
import { CoreModule } from '@alfresco/adf-core'; import { CoreModule } from '@alfresco/adf-core';
@ -31,6 +29,7 @@ import { NameLocationCellComponent } from './name-location-cell/name-location-ce
import { UploadModule } from '../upload/upload.module'; import { UploadModule } from '../upload/upload.module';
import { SearchQueryBuilderService } from '../search/services/search-query-builder.service'; import { SearchQueryBuilderService } from '../search/services/search-query-builder.service';
import { ContentDirectiveModule } from '../directives/content-directive.module'; import { ContentDirectiveModule } from '../directives/content-directive.module';
import { DropdownSitesComponent } from './site-dropdown/sites-dropdown.component';
@NgModule({ @NgModule({
imports: [ imports: [
@ -39,23 +38,16 @@ import { ContentDirectiveModule } from '../directives/content-directive.module';
CoreModule, CoreModule,
CommonModule, CommonModule,
MaterialModule, MaterialModule,
SitesDropdownModule, DropdownSitesComponent,
BreadcrumbModule, BreadcrumbModule,
SearchModule, SearchModule,
DocumentListModule, DocumentListModule,
UploadModule, UploadModule,
ContentDirectiveModule ContentDirectiveModule,
], NameLocationCellComponent
exports: [
ContentNodeSelectorPanelComponent,
NameLocationCellComponent,
ContentNodeSelectorComponent
],
declarations: [
ContentNodeSelectorPanelComponent,
NameLocationCellComponent,
ContentNodeSelectorComponent
], ],
exports: [ContentNodeSelectorPanelComponent, NameLocationCellComponent, ContentNodeSelectorComponent],
declarations: [ContentNodeSelectorPanelComponent, ContentNodeSelectorComponent],
providers: [SearchQueryBuilderService] providers: [SearchQueryBuilderService]
}) })
export class ContentNodeSelectorModule {} export class ContentNodeSelectorModule {}

View File

@ -27,9 +27,7 @@ describe('NameLocationCellComponent', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ imports: [NameLocationCellComponent]
NameLocationCellComponent
]
}); });
fixture = TestBed.createComponent(NameLocationCellComponent); fixture = TestBed.createComponent(NameLocationCellComponent);
component = fixture.componentInstance; component = fixture.componentInstance;

View File

@ -20,6 +20,7 @@ import { DataRow } from '@alfresco/adf-core';
@Component({ @Component({
selector: 'adf-name-location-cell', selector: 'adf-name-location-cell',
standalone: true,
template: ` template: `
<div class="adf-name-location-cell-name adf-datatable-cell-value" [title]="name">{{ name }}</div> <div class="adf-name-location-cell-name adf-datatable-cell-value" [title]="name">{{ name }}</div>
<div class="adf-name-location-cell-location adf-datatable-cell-value" [title]="path">{{ path }}</div> <div class="adf-name-location-cell-location adf-datatable-cell-value" [title]="path">{{ path }}</div>
@ -30,7 +31,6 @@ import { DataRow } from '@alfresco/adf-core';
host: { class: 'adf-name-location-cell adf-datatable-content-cell' } host: { class: 'adf-name-location-cell adf-datatable-content-cell' }
}) })
export class NameLocationCellComponent implements OnInit { export class NameLocationCellComponent implements OnInit {
name: string = ''; name: string = '';
path: string = ''; path: string = '';

View File

@ -16,10 +16,11 @@
*/ */
export * from './name-location-cell/name-location-cell.component'; export * from './name-location-cell/name-location-cell.component';
export * from './site-dropdown/sites-dropdown.component';
export * from './content-node-selector.component-data.interface'; export * from './content-node-selector.component-data.interface';
export * from './content-node-selector-panel.component'; export * from './content-node-selector-panel/content-node-selector-panel.component';
export * from './content-node-selector.component'; export * from './content-node-selector.component';
export * from './content-node-dialog.service'; export * from './content-node-dialog.service';
export * from './content-node-selector-panel.service'; export * from './content-node-selector-panel/content-node-selector-panel.service';
export * from './content-node-selector.module'; export * from './content-node-selector.module';

View File

@ -4,12 +4,10 @@
<mat-select <mat-select
adf-infinite-select-scroll adf-infinite-select-scroll
(scrollEnd)="loadAllOnScroll()" (scrollEnd)="loadAllOnScroll()"
#siteSelect
data-automation-id="site-my-files-option" data-automation-id="site-my-files-option"
class="adf-site-dropdown-list-element" class="adf-site-dropdown-list-element"
id="site-dropdown" id="site-dropdown"
placeholder="{{placeholder | translate}}" placeholder="{{placeholder | translate}}"
floatPlaceholder="never"
[(value)]="selected" [(value)]="selected"
(selectionChange)="selectedSite($event)"> (selectionChange)="selectedSite($event)">
<mat-select-trigger class="adf-sites-dropdown-select-trigger"> <mat-select-trigger class="adf-sites-dropdown-select-trigger">

View File

@ -25,9 +25,9 @@ import {
getFakeSitePagingFirstPage, getFakeSitePagingFirstPage,
getFakeSitePagingLastPage, getFakeSitePagingLastPage,
getFakeSitePagingWithMembers getFakeSitePagingWithMembers
} from '../mock'; } from '../../mock';
import { ContentTestingModule } from '../testing/content.testing.module'; import { ContentTestingModule } from '../../testing/content.testing.module';
import { SitesService } from '../common/services/sites.service'; import { SitesService } from '../../common/services/sites.service';
import { HarnessLoader } from '@angular/cdk/testing'; import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatSelectHarness } from '@angular/material/select/testing'; import { MatSelectHarness } from '@angular/material/select/testing';

View File

@ -18,10 +18,12 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { InfiniteSelectScrollDirective, AuthenticationService } from '@alfresco/adf-core'; import { InfiniteSelectScrollDirective, AuthenticationService } from '@alfresco/adf-core';
import { SitePaging, SiteEntry, Site } from '@alfresco/js-api'; import { SitePaging, SiteEntry, Site } from '@alfresco/js-api';
import { MatSelectChange } from '@angular/material/select'; import { MatSelectChange, MatSelectModule } from '@angular/material/select';
import { LiveAnnouncer } from '@angular/cdk/a11y'; import { LiveAnnouncer } from '@angular/cdk/a11y';
import { TranslateService } from '@ngx-translate/core'; import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { SitesService } from '../common/services/sites.service'; import { SitesService } from '../../common/services/sites.service';
import { CommonModule } from '@angular/common';
import { MatFormFieldModule } from '@angular/material/form-field';
/* eslint-disable no-shadow */ /* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
@ -33,6 +35,8 @@ export enum Relations {
@Component({ @Component({
selector: 'adf-sites-dropdown', selector: 'adf-sites-dropdown',
standalone: true,
imports: [CommonModule, TranslateModule, MatFormFieldModule, MatSelectModule, InfiniteSelectScrollDirective],
templateUrl: './sites-dropdown.component.html', templateUrl: './sites-dropdown.component.html',
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
host: { class: 'adf-sites-dropdown' } host: { class: 'adf-sites-dropdown' }
@ -75,7 +79,7 @@ export class DropdownSitesComponent implements OnInit {
* an empty model is emitted. * an empty model is emitted.
*/ */
@Output() @Output()
change: EventEmitter<SiteEntry> = new EventEmitter(); change = new EventEmitter<SiteEntry>();
@Output() @Output()
error = new EventEmitter<any>(); error = new EventEmitter<any>();

View File

@ -26,7 +26,6 @@ import { TagModule } from './tag/tag.module';
import { DocumentListModule } from './document-list/document-list.module'; import { DocumentListModule } from './document-list/document-list.module';
import { UploadModule } from './upload/upload.module'; import { UploadModule } from './upload/upload.module';
import { SearchModule } from './search/search.module'; import { SearchModule } from './search/search.module';
import { SitesDropdownModule } from './site-dropdown/sites-dropdown.module';
import { BreadcrumbModule } from './breadcrumb/breadcrumb.module'; import { BreadcrumbModule } from './breadcrumb/breadcrumb.module';
import { VersionManagerModule } from './version-manager/version-manager.module'; import { VersionManagerModule } from './version-manager/version-manager.module';
import { ContentNodeSelectorModule } from './content-node-selector/content-node-selector.module'; import { ContentNodeSelectorModule } from './content-node-selector/content-node-selector.module';
@ -49,6 +48,7 @@ import { ContentUserInfoModule } from './content-user-info/content-user-info.mod
import { CategoriesModule } from './category/category.module'; import { CategoriesModule } from './category/category.module';
import { contentAuthLoaderFactory } from './auth-loader/content-auth-loader-factory'; import { contentAuthLoaderFactory } from './auth-loader/content-auth-loader-factory';
import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.service'; import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.service';
import { DropdownSitesComponent } from './content-node-selector/site-dropdown/sites-dropdown.component';
@NgModule({ @NgModule({
imports: [ imports: [
@ -64,7 +64,7 @@ import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.serv
ContentUserInfoModule, ContentUserInfoModule,
UploadModule, UploadModule,
MaterialModule, MaterialModule,
SitesDropdownModule, DropdownSitesComponent,
BreadcrumbModule, BreadcrumbModule,
ContentNodeSelectorModule, ContentNodeSelectorModule,
ContentNodeShareModule, ContentNodeShareModule,
@ -90,7 +90,7 @@ import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.serv
ContentUserInfoModule, ContentUserInfoModule,
UploadModule, UploadModule,
SearchModule, SearchModule,
SitesDropdownModule, DropdownSitesComponent,
BreadcrumbModule, BreadcrumbModule,
ContentNodeSelectorModule, ContentNodeSelectorModule,
ContentNodeShareModule, ContentNodeShareModule,

View File

@ -30,18 +30,19 @@ import { ContentNodeDialogService } from '../../content-node-selector/content-no
providedIn: 'root' providedIn: 'root'
}) })
export class DocumentActionsService { export class DocumentActionsService {
permissionEvent = new Subject<PermissionModel>(); permissionEvent = new Subject<PermissionModel>();
error = new Subject<Error>(); error = new Subject<Error>();
success = new Subject<string>(); success = new Subject<string>();
private handlers: { [id: string]: ContentActionHandler } = {}; private handlers: { [id: string]: ContentActionHandler } = {};
constructor(private nodeActionsService: NodeActionsService, constructor(
private contentNodeDialogService: ContentNodeDialogService, private nodeActionsService: NodeActionsService,
private translation: TranslationService, private contentNodeDialogService: ContentNodeDialogService,
private documentListService?: DocumentListService, private translation: TranslationService,
private contentService?: ContentService) { private documentListService?: DocumentListService,
private contentService?: ContentService
) {
this.setupActionHandlers(); this.setupActionHandlers();
} }
@ -114,32 +115,34 @@ export class DocumentActionsService {
} }
private prepareHandlers(actionObservable: Subject<string>): void { private prepareHandlers(actionObservable: Subject<string>): void {
actionObservable.subscribe( actionObservable.subscribe((fileOperationMessage) => {
(fileOperationMessage) => { this.success.next(fileOperationMessage);
this.success.next(fileOperationMessage); }, this.error.next.bind(this.error));
},
this.error.next.bind(this.error)
);
} }
private deleteNode(node: NodeEntry, _target?: any, permission?: string): Observable<any> { private deleteNode(node: NodeEntry, _target?: any, permission?: string): Observable<any> {
if (this.canExecuteAction(node)) { if (this.canExecuteAction(node)) {
if (this.contentService.hasAllowableOperations(node.entry, permission)) { if (this.contentService.hasAllowableOperations(node.entry, permission)) {
const handlerObservable = this.documentListService.deleteNode(node.entry.id); const handlerObservable = this.documentListService.deleteNode(node.entry.id);
handlerObservable.subscribe(() => { handlerObservable.subscribe(
const message = this.translation.instant('CORE.DELETE_NODE.SINGULAR', { name: node.entry.name }); () => {
this.success.next(message); const message = this.translation.instant('CORE.DELETE_NODE.SINGULAR', { name: node.entry.name });
}, () => { this.success.next(message);
const message = this.translation.instant('CORE.DELETE_NODE.ERROR_SINGULAR', { name: node.entry.name }); },
this.error.next(message); () => {
}); const message = this.translation.instant('CORE.DELETE_NODE.ERROR_SINGULAR', { name: node.entry.name });
this.error.next(message);
}
);
return handlerObservable; return handlerObservable;
} else { } else {
this.permissionEvent.next(new PermissionModel({ this.permissionEvent.next(
type: 'content', new PermissionModel({
action: 'delete', type: 'content',
permission action: 'delete',
})); permission
})
);
return throwError(new Error('No permission to delete')); return throwError(new Error('No permission to delete'));
} }
} }

View File

@ -32,21 +32,21 @@ import { NodeAction } from '../models/node-action.enum';
}) })
// eslint-disable-next-line @angular-eslint/directive-class-suffix // eslint-disable-next-line @angular-eslint/directive-class-suffix
export class NodeActionsService { export class NodeActionsService {
@Output() @Output()
error = new EventEmitter<any>(); error = new EventEmitter<any>();
constructor(private contentDialogService: ContentNodeDialogService, constructor(
public dialogRef: MatDialog, private contentDialogService: ContentNodeDialogService,
public content: ContentService, public dialogRef: MatDialog,
private documentListService?: DocumentListService, public content: ContentService,
private apiService?: AlfrescoApiService, private documentListService?: DocumentListService,
private dialog?: MatDialog, private apiService?: AlfrescoApiService,
private downloadService?: DownloadService) {} private dialog?: MatDialog,
private downloadService?: DownloadService
) {}
downloadNode(node: NodeEntry) { downloadNode(node: NodeEntry) {
new NodeDownloadDirective(this.apiService, this.downloadService, this.dialog) new NodeDownloadDirective(this.apiService, this.downloadService, this.dialog).downloadNode(node);
.downloadNode(node);
} }
/** /**
@ -102,23 +102,29 @@ export class NodeActionsService {
* @param permission permission which is needed to apply the action * @param permission permission which is needed to apply the action
* @returns operation result * @returns operation result
*/ */
private doFileOperation(action: NodeAction.COPY | NodeAction.MOVE, type: 'content' | 'folder', contentEntry: Node, permission?: string): Subject<string> { private doFileOperation(
action: NodeAction.COPY | NodeAction.MOVE,
type: 'content' | 'folder',
contentEntry: Node,
permission?: string
): Subject<string> {
const observable = new Subject<string>(); const observable = new Subject<string>();
this.contentDialogService this.contentDialogService.openCopyMoveDialog(action, contentEntry, permission).subscribe(
.openCopyMoveDialog(action, contentEntry, permission) (selections: Node[]) => {
.subscribe((selections: Node[]) => {
const selection = selections[0]; const selection = selections[0];
this.documentListService[`${action.toLowerCase()}Node`].call(this.documentListService, contentEntry.id, selection.id) this.documentListService[`${action.toLowerCase()}Node`]
.call(this.documentListService, contentEntry.id, selection.id)
.subscribe( .subscribe(
observable.next.bind(observable, `OPERATION.SUCCESS.${type.toUpperCase()}.${action}`), observable.next.bind(observable, `OPERATION.SUCCESS.${type.toUpperCase()}.${action}`),
observable.error.bind(observable) observable.error.bind(observable)
); );
}, },
(error) => { (error) => {
observable.error(error); observable.error(error);
return observable; return observable;
}); }
);
return observable; return observable;
} }
} }

View File

@ -16,7 +16,7 @@
*/ */
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ContentNodeSelectorPanelService } from '../../../content-node-selector/content-node-selector-panel.service'; import { ContentNodeSelectorPanelService } from '../../../content-node-selector/content-node-selector-panel/content-node-selector-panel.service';
import { SearchQueryBuilderService } from '../../services/search-query-builder.service'; import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
@Component({ @Component({

View File

@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';

View File

@ -1,20 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './sites-dropdown.component';
export * from './sites-dropdown.module';

View File

@ -1,41 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MaterialModule } from '../material.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DropdownSitesComponent } from './sites-dropdown.component';
import { CoreModule } from '@alfresco/adf-core';
@NgModule({
imports: [
CommonModule,
MaterialModule,
FormsModule,
ReactiveFormsModule,
CoreModule
],
exports: [
DropdownSitesComponent
],
declarations: [
DropdownSitesComponent
]
})
export class SitesDropdownModule {}

View File

@ -21,7 +21,6 @@ export * from './lib/document-list/index';
export * from './lib/content-user-info/index'; export * from './lib/content-user-info/index';
export * from './lib/upload/index'; export * from './lib/upload/index';
export * from './lib/search/index'; export * from './lib/search/index';
export * from './lib/site-dropdown/index';
export * from './lib/breadcrumb/index'; export * from './lib/breadcrumb/index';
export * from './lib/version-manager/index'; export * from './lib/version-manager/index';
export * from './lib/content-node-selector/index'; export * from './lib/content-node-selector/index';