From b13ae23173b2e4f75b5505afdc10de046ef126c7 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Mon, 5 Jan 2026 09:01:30 +0000 Subject: [PATCH] ACS-10914 Remove unused allowable operation directive (#11476) --- docs/README.md | 2 - .../check-allowable-operation.directive.md | 139 --------------- ...base-card-view-content-update.interface.md | 52 ------ .../card-view-content-update.service.md | 1 - .../card-view-content-update.service.ts | 3 +- .../components/content-metadata/mock-data.ts | 78 --------- ...heck-allowable-operation.directive.spec.ts | 160 ------------------ .../check-allowable-operation.directive.ts | 125 -------------- .../directives/content-directive.module.ts | 5 +- .../directives/node-delete.directive.spec.ts | 5 +- .../src/lib/directives/public-api.ts | 1 - ...base-card-view-content-update.interface.ts | 29 ---- ...e-allowable-operation-subject.interface.ts | 20 --- .../src/lib/interfaces/public-api.ts | 3 - .../components/upload-button.component.ts | 8 +- .../components/upload-drag-area.component.ts | 8 +- .../upload-version-button.component.ts | 4 +- lib/core/src/lib/interface/index.ts | 18 -- .../src/lib/interface/injection.tokens.ts | 20 --- lib/core/src/lib/interface/public-api.ts | 18 -- lib/core/src/public-api.ts | 1 - 21 files changed, 12 insertions(+), 688 deletions(-) delete mode 100644 docs/content-services/directives/check-allowable-operation.directive.md delete mode 100644 docs/content-services/interfaces/base-card-view-content-update.interface.md delete mode 100644 lib/content-services/src/lib/content-metadata/components/content-metadata/mock-data.ts delete mode 100644 lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts delete mode 100644 lib/content-services/src/lib/directives/check-allowable-operation.directive.ts delete mode 100644 lib/content-services/src/lib/interfaces/base-card-view-content-update.interface.ts delete mode 100644 lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts delete mode 100644 lib/core/src/lib/interface/index.ts delete mode 100644 lib/core/src/lib/interface/injection.tokens.ts delete mode 100644 lib/core/src/lib/interface/public-api.ts diff --git a/docs/README.md b/docs/README.md index 48d4d5f9a8..a2a0370288 100644 --- a/docs/README.md +++ b/docs/README.md @@ -321,7 +321,6 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | | [Auto Focus directive](content-services/directives/auto-focus.directive.md) | Automatically focuses HTML element after content is initialized. | [Source](../lib/content-services/src/lib/directives/auto-focus.directive.ts) | -| [Check Allowable Operation directive](content-services/directives/check-allowable-operation.directive.md) | Selectively disables an HTML element or Angular component. | [Source](../lib/content-services/src/lib/directives/check-allowable-operation.directive.ts) | | [Node Public File Share Directive](content-services/directives/content-node-share.directive.md) | Creates and manages public shared links for files. | [Source](../lib/content-services/src/lib/content-node-share/content-node-share.directive.ts) | | [File Draggable directive](content-services/directives/file-draggable.directive.md) | Provides drag-and-drop features for an element such as a div. | [Source](../lib/content-services/src/lib/upload/directives/file-draggable.directive.ts) | | [Inherit Permission directive](content-services/directives/inherited-button.directive.md) | Update the current node by adding/removing the inherited permissions. | [Source](../lib/content-services/src/lib/permission-manager/components/inherited-button.directive.ts) | @@ -344,7 +343,6 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | -| [Base Card View Content Update interface](content-services/interfaces/base-card-view-content-update.interface.md) | Specifies required properties and methods for Card View Content Update service. Extends from BaseCardViewUpdate. | [Source](../lib/content-services/src/lib/interfaces/base-card-view-content-update.interface.ts) | | | [Search widget interface](content-services/interfaces/search-widget.interface.md) | Specifies required properties for Search filter component widgets. | [Source](../lib/content-services/src/lib/search/models/search-widget.interface.ts) | | [Content Metadata Custom Panel interface](content-services/interfaces/content-metadata-custom-panel.interface.md) | Specifies required properties for metadata custom panel. | [Source](../lib/content-services/src/lib/content-metadata/interfaces/content-metadata-custom-panel.interface.ts) | diff --git a/docs/content-services/directives/check-allowable-operation.directive.md b/docs/content-services/directives/check-allowable-operation.directive.md deleted file mode 100644 index 1714cf0b15..0000000000 --- a/docs/content-services/directives/check-allowable-operation.directive.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -Title: Check Allowable Operation directive -Added: v2.0.0 -Status: Active -Last reviewed: 2019-02-13 ---- - -# [Check Allowable Operation directive](../../../lib/content-services/src/lib/directives/check-allowable-operation.directive.ts "Defined in check-allowable-operation.directive.ts") - -Selectively disables an HTML element or Angular component. - -## Contents - -- [Basic Usage](#basic-usage) -- [Class members](#class-members) - - [Properties](#properties) -- [Details](#details) - - [HTML element example](#html-element-example) - - [Angular component example](#angular-component-example) - - [Implementing the NodeAllowableOperationSubject interface](#implementing-the-nodeallowableoperationsubject-interface) - - [Defining your component as an EXTENDIBLE_COMPONENT parent component](#defining-your-component-as-an-extendible_component-parent-component) - -## Basic Usage - -```html - - - - - - ... - -``` - -## Class members - -### Properties - -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| nodes | [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`[]` | \[] | Nodes to check permission for. | -| permission | `string` | null | Node permission to check (create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions). | - -## Details - -The [Check Allowable Operation Directive](../../../lib/content-services/src/lib/directives/check-allowable-operation.directive.ts) lets you disable an HTML element or Angular component -by taking a collection of [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md) instances and checking their permissions. - -The decorated element will be disabled if: - -- there are no nodes in the collection -- at least one of the nodes does not have the required permission - -### HTML element example - -A typical use case is to bind a [Document List](../components/document-list.component.md) -selection property to a toolbar button. In the following example, the "Delete" button should -be disabled if no selection is present or if user does not have permission to delete at least one node in the selection: - -```html - - - - - - ... - -``` - -The button will be disabled by default and will change state when the user selects or deselects -one or more documents that they have permission to delete. - -### Angular component example - -You can add the directive to any Angular component that implements the [`NodeAllowableOperationSubject`](../../../lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts) -interface (the [Upload Drag Area component](../components/upload-drag-area.component.md), -for example). You can also use it in much the same way as you would with an HTML element: - -```html - - ... - -``` - -To enable your own component to work with this directive, you need to implement the -[`NodeAllowableOperationSubject`](../../../lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts) interface and also define it as an -[`EXTENDIBLE_COMPONENT`](../../../lib/core/src/lib/interface/injection.tokens.ts) -parent component, -as described in the following sections. - -### Implementing the NodeAllowableOperationSubject interface - -The component must implement the [`NodeAllowableOperationSubject`](../../../lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts) interface which means it must have a -boolean `disabled` property. This is the property that will be set by the directive: - -```js -import { NodePermissionSubject } from '@alfresco/adf-core'; - -@Component({...}) -export class UploadDragAreaComponent implements NodeAllowableOperationSubject { - public disabled: boolean = false; -} -``` - -### Defining your component as an EXTENDIBLE_COMPONENT parent component - -The directive will look up the component in the dependency injection tree, -up to the `@Host()` component. The host component is typically the component that requests -the dependency. However, when this component is projected into a parent component, the -parent becomes the host. This means you must provide your component with forward referencing -as the -[`EXTENDIBLE_COMPONENT`](../../../lib/core/src/lib/interface/injection.tokens.ts) -and also provide your component as a `viewProvider`: - -```js -import { EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; - -@Component({ - ... - viewProviders: [ - { provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadDragAreaComponent)} - ] -}) -export class UploadDragAreaComponent implements NodeAllowableOperationSubject { ... } -``` - -**Note:** the usage of **viewProviders** (instead of **providers**) is very important, especially if you want to use this directive on a transcluded component. diff --git a/docs/content-services/interfaces/base-card-view-content-update.interface.md b/docs/content-services/interfaces/base-card-view-content-update.interface.md deleted file mode 100644 index 3b6fe80185..0000000000 --- a/docs/content-services/interfaces/base-card-view-content-update.interface.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -Title: Base Card View Content Update interface -Added: v6.0.0 -Status: Active -Last reviewed: 2022-11-25 ---- - -# [Base Card View Content Update interface](../../../lib/content-services/src/lib/interfaces/base-card-view-content-update.interface.ts "Defined in base-card-view-content-update.interface.ts") - -Specifies required properties and methods for [Card View Content Update service](lib/content-services/src/lib/common/services/card-view-content-update.service.ts). -Extends from [`BaseCardViewUpdate`](../../../lib/core/src/lib/card-view/interfaces/base-card-view-update.interface.ts). - -## Basic usage - -```ts -export interface BaseCardViewContentUpdate { - itemUpdated$: Subject; - updatedAspect$: Subject; - - update(property: CardViewBaseItemModel, newValue: any); - updateElement(notification: CardViewBaseItemModel); - updateNodeAspect(node: Node); -} -``` - -### Properties - -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| itemUpdated$ | [`Subject`](http://reactivex.io/documentation/subject.html)`<`[`UpdateNotification`](../../../lib/core/src/lib/card-view/interfaces/update-notification.interface.ts)`>` | | The current updated item. | -| updatedAspect$ | [`Subject`](http://reactivex.io/documentation/subject.html)`<`[`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md)`>`(@alfresco/js-api) | | [`Subject`](http://reactivex.io/documentation/subject.html) holding the current node | - -### Methods - -- **update**(property: [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts), newValue: `any`)
- Update itemUpdated$ property. - - - property:\_ [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) - The property. - - newValue:\_ `any` - new value. - -- **updateElement**(notification: [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts))
- Update updateItem$ observable. - - - notification:\_ [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) - The notification. - -- **updateNodeAspect**(node: [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md))
- Update node aspect observable. - - node:\_ [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) - The node. - -## See also - -- [CardViewContentUpdate service](../services/card-view-content-update.service.md) diff --git a/docs/content-services/services/card-view-content-update.service.md b/docs/content-services/services/card-view-content-update.service.md index c487e805ca..7d2efbe1db 100644 --- a/docs/content-services/services/card-view-content-update.service.md +++ b/docs/content-services/services/card-view-content-update.service.md @@ -8,7 +8,6 @@ Last reviewed: 2022-11-25 # [Card View Content Update Service](../../../lib/content-services/src/lib/common/services/card-view-content-update.service.ts "Defined in card-view-content-update.service.ts") Manages Card View properties in the content services environment. -Implements [`BaseCardViewContentUpdate`](../../../lib/content-services/src/lib/interfaces/base-card-view-content-update.interface.ts). ## Class members diff --git a/lib/content-services/src/lib/common/services/card-view-content-update.service.ts b/lib/content-services/src/lib/common/services/card-view-content-update.service.ts index 3aa83eafdc..9be6184a1d 100644 --- a/lib/content-services/src/lib/common/services/card-view-content-update.service.ts +++ b/lib/content-services/src/lib/common/services/card-view-content-update.service.ts @@ -19,12 +19,11 @@ import { UpdateNotification, CardViewBaseItemModel, CardViewUpdateService } from import { Node } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; -import { BaseCardViewContentUpdate } from '../../interfaces/base-card-view-content-update.interface'; @Injectable({ providedIn: 'root' }) -export class CardViewContentUpdateService implements BaseCardViewContentUpdate { +export class CardViewContentUpdateService { itemUpdated$ = new Subject(); updatedAspect$ = new Subject(); diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/mock-data.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/mock-data.ts deleted file mode 100644 index 8115a3f049..0000000000 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/mock-data.ts +++ /dev/null @@ -1,78 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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 const mockGroupProperties = [ - { - title: 'EXIF', - properties: [ - { - label: 'Image Width', - value: 363, - key: 'properties.exif:pixelXDimension', - default: null, - editable: true, - clickable: false, - icon: '', - data: null, - type: 'int', - multiline: false, - pipes: [], - clickCallBack: null, - displayValue: 400 - }, - { - label: 'Image Height', - value: 400, - key: 'properties.exif:pixelYDimension', - default: null, - editable: true, - clickable: false, - icon: '', - data: null, - type: 'int', - multiline: false, - pipes: [], - clickCallBack: null, - displayValue: 400 - } - ], - editable: true, - expanded: true - }, - { - title: 'CUSTOM', - properties: [ - { - label: 'Height', - value: 400, - key: 'properties.custom:abc', - default: null, - editable: true, - clickable: false, - icon: '', - data: null, - type: 'int', - multiline: false, - pipes: [], - clickCallBack: null, - displayValue: 400 - } - ], - editable: true, - expanded: true - } -]; diff --git a/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts b/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts deleted file mode 100644 index 228f61bf82..0000000000 --- a/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts +++ /dev/null @@ -1,160 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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 { ChangeDetectorRef, Component, ElementRef, SimpleChange } from '@angular/core'; -import { ContentService } from '../common/services/content.service'; -import { CheckAllowableOperationDirective } from './check-allowable-operation.directive'; -import { TestBed } from '@angular/core/testing'; -import { NodeAllowableOperationSubject } from '../interfaces/node-allowable-operation-subject.interface'; -import { RedirectAuthService } from '@alfresco/adf-core'; -import { EMPTY, of } from 'rxjs'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; - -@Component({ - selector: 'adf-text-subject', - template: '' -}) -class TestComponent implements NodeAllowableOperationSubject { - disabled: boolean = false; -} - -describe('CheckAllowableOperationDirective', () => { - let changeDetectorMock: ChangeDetectorRef; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }] - }); - changeDetectorMock = { detectChanges: () => {} } as ChangeDetectorRef; - }); - - describe('HTML nativeElement as subject', () => { - it('updates element on nodes change', () => { - const directive = new CheckAllowableOperationDirective(null, null, null, changeDetectorMock); - spyOn(directive, 'updateElement').and.stub(); - - const nodes = [{}, {}]; - const change = new SimpleChange([], nodes, false); - directive.ngOnChanges({ nodes: change }); - - expect(directive.updateElement).toHaveBeenCalled(); - }); - - it('updates element only on subsequent change', () => { - const directive = new CheckAllowableOperationDirective(null, null, null, changeDetectorMock); - spyOn(directive, 'updateElement').and.stub(); - - const nodes = [{}, {}]; - const change = new SimpleChange([], nodes, true); - directive.ngOnChanges({ nodes: change }); - - expect(directive.updateElement).not.toHaveBeenCalled(); - }); - - it('enables decorated element', () => { - const renderer = jasmine.createSpyObj('renderer', ['removeAttribute']); - const elementRef = new ElementRef({}); - const directive = new CheckAllowableOperationDirective(elementRef, renderer, null, changeDetectorMock); - - directive.enableElement(); - - expect(renderer.removeAttribute).toHaveBeenCalledWith(elementRef.nativeElement, 'disabled'); - }); - - it('disables decorated element', () => { - const renderer = jasmine.createSpyObj('renderer', ['setAttribute']); - const elementRef = new ElementRef({}); - const directive = new CheckAllowableOperationDirective(elementRef, renderer, null, changeDetectorMock); - - directive.disableElement(); - - expect(renderer.setAttribute).toHaveBeenCalledWith(elementRef.nativeElement, 'disabled', 'true'); - }); - - it('disables element when nodes not available', () => { - const directive = new CheckAllowableOperationDirective(null, null, null, changeDetectorMock); - spyOn(directive, 'disableElement').and.stub(); - - directive.nodes = null; - expect(directive.updateElement()).toBeFalsy(); - - directive.nodes = []; - expect(directive.updateElement()).toBeFalsy(); - }); - - it('enables element when all nodes have expected permission', () => { - const contentService = TestBed.inject(ContentService); - spyOn(contentService, 'hasAllowableOperations').and.returnValue(true); - - const directive = new CheckAllowableOperationDirective(null, null, contentService, changeDetectorMock); - spyOn(directive, 'enableElement').and.stub(); - - directive.nodes = [{}, {}] as any[]; - - expect(directive.updateElement()).toBeTruthy(); - expect(directive.enableElement).toHaveBeenCalled(); - }); - - it('disables element when one of the nodes have no permission', () => { - const contentService = TestBed.inject(ContentService); - spyOn(contentService, 'hasAllowableOperations').and.returnValue(false); - - const directive = new CheckAllowableOperationDirective(null, null, contentService, changeDetectorMock); - spyOn(directive, 'disableElement').and.stub(); - - directive.nodes = [{}, {}] as any[]; - - expect(directive.updateElement()).toBeFalsy(); - expect(directive.disableElement).toHaveBeenCalled(); - }); - }); - - describe('Angular component as subject', () => { - it('disables decorated component', () => { - const contentService = TestBed.inject(ContentService); - spyOn(contentService, 'hasAllowableOperations').and.returnValue(false); - spyOn(changeDetectorMock, 'detectChanges'); - - const testComponent = new TestComponent(); - testComponent.disabled = false; - const directive = new CheckAllowableOperationDirective(null, null, contentService, changeDetectorMock, testComponent); - directive.nodes = [{}, {}] as any[]; - - directive.updateElement(); - - expect(testComponent.disabled).toBeTruthy(); - expect(changeDetectorMock.detectChanges).toHaveBeenCalledTimes(1); - }); - - it('enables decorated component', () => { - const contentService = TestBed.inject(ContentService); - spyOn(contentService, 'hasAllowableOperations').and.returnValue(true); - spyOn(changeDetectorMock, 'detectChanges'); - - const testComponent = new TestComponent(); - testComponent.disabled = true; - const directive = new CheckAllowableOperationDirective(null, null, contentService, changeDetectorMock, testComponent); - directive.nodes = [{}, {}] as any[]; - - directive.updateElement(); - - expect(testComponent.disabled).toBeFalsy(); - expect(changeDetectorMock.detectChanges).toHaveBeenCalledTimes(1); - }); - }); -}); diff --git a/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts b/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts deleted file mode 100644 index 4693745332..0000000000 --- a/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts +++ /dev/null @@ -1,125 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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. - */ - -/* eslint-disable @angular-eslint/no-input-rename */ - -import { ChangeDetectorRef, Directive, ElementRef, Host, Inject, Input, OnChanges, Optional, Renderer2, SimpleChanges } from '@angular/core'; -import { NodeEntry } from '@alfresco/js-api'; -import { EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; -import { ContentService } from '../common/services/content.service'; -import { NodeAllowableOperationSubject } from '../interfaces/node-allowable-operation-subject.interface'; - -@Directive({ - standalone: true, - selector: '[adf-check-allowable-operation]' -}) -export class CheckAllowableOperationDirective implements OnChanges { - /** - * Node permission to check (create, delete, update, updatePermissions, - * !create, !delete, !update, !updatePermissions). - */ - @Input('adf-check-allowable-operation') - permission: string = null; - - /** Nodes to check permission for. */ - @Input('adf-nodes') - nodes: NodeEntry[] = []; - - constructor( - private elementRef: ElementRef, - private renderer: Renderer2, - private contentService: ContentService, - private changeDetector: ChangeDetectorRef, - - @Host() - @Optional() - @Inject(EXTENDIBLE_COMPONENT) - private parentComponent?: NodeAllowableOperationSubject - ) {} - - ngOnChanges(changes: SimpleChanges) { - if (changes.nodes && !changes.nodes.firstChange) { - this.updateElement(); - } - } - - /** - * Updates disabled state for the decorated element - * - * @returns the new state - */ - updateElement(): boolean { - const enable = this.hasAllowableOperations(this.nodes, this.permission); - - if (enable) { - this.enable(); - } else { - this.disable(); - } - - return enable; - } - - private enable(): void { - if (this.parentComponent) { - this.parentComponent.disabled = false; - this.changeDetector.detectChanges(); - } else { - this.enableElement(); - } - } - - private disable(): void { - if (this.parentComponent) { - this.parentComponent.disabled = true; - this.changeDetector.detectChanges(); - } else { - this.disableElement(); - } - } - - /** - * Enables decorated element - * - */ - enableElement(): void { - this.renderer.removeAttribute(this.elementRef.nativeElement, 'disabled'); - } - - /** - * Disables decorated element - * - */ - disableElement(): void { - this.renderer.setAttribute(this.elementRef.nativeElement, 'disabled', 'true'); - } - - /** - * Checks whether all nodes have a particular permission - * - * @param nodes Node collection to check - * @param permission Permission to check for each node - * @returns `true` if there are allowable operations, otherwise `false` - */ - hasAllowableOperations(nodes: NodeEntry[], permission: string): boolean { - if (nodes && nodes.length > 0) { - return nodes.every((node) => this.contentService.hasAllowableOperations(node.entry, permission)); - } - - return false; - } -} diff --git a/lib/content-services/src/lib/directives/content-directive.module.ts b/lib/content-services/src/lib/directives/content-directive.module.ts index 02fe9f5e98..f03e55dcd1 100644 --- a/lib/content-services/src/lib/directives/content-directive.module.ts +++ b/lib/content-services/src/lib/directives/content-directive.module.ts @@ -19,7 +19,6 @@ import { NgModule } from '@angular/core'; import { NodeLockDirective } from './node-lock.directive'; import { NodeCounterComponent, NodeCounterDirective } from './node-counter.directive'; import { AutoFocusDirective } from './auto-focus.directive'; -import { CheckAllowableOperationDirective } from './check-allowable-operation.directive'; import { LibraryFavoriteDirective } from './library-favorite.directive'; import { LibraryMembershipDirective } from './library-membership.directive'; import { NodeDeleteDirective } from './node-delete.directive'; @@ -27,12 +26,12 @@ import { NodeFavoriteDirective } from './node-favorite.directive'; import { NodeRestoreDirective } from './node-restore.directive'; import { NodeDownloadDirective } from './node-download.directive'; +/* @deprecated import standalone directives instead */ export const CONTENT_DIRECTIVES = [ NodeLockDirective, NodeCounterDirective, NodeCounterComponent, AutoFocusDirective, - CheckAllowableOperationDirective, LibraryFavoriteDirective, LibraryMembershipDirective, NodeDeleteDirective, @@ -41,7 +40,7 @@ export const CONTENT_DIRECTIVES = [ NodeDownloadDirective ]; -/** @deprecated import CONTENT_DIRECTIVES or standalone directives instead */ +/** @deprecated import standalone directives instead */ @NgModule({ imports: [...CONTENT_DIRECTIVES], exports: [...CONTENT_DIRECTIVES] diff --git a/lib/content-services/src/lib/directives/node-delete.directive.spec.ts b/lib/content-services/src/lib/directives/node-delete.directive.spec.ts index bbfd136bf2..ab6c13a180 100644 --- a/lib/content-services/src/lib/directives/node-delete.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-delete.directive.spec.ts @@ -21,7 +21,6 @@ import { By } from '@angular/platform-browser'; import { NodeDeleteDirective } from './node-delete.directive'; import { RedirectAuthService } from '@alfresco/adf-core'; import { EMPTY, of, Subscription } from 'rxjs'; -import { CheckAllowableOperationDirective } from './check-allowable-operation.directive'; @Component({ imports: [NodeDeleteDirective], @@ -37,8 +36,8 @@ class TestComponent { } @Component({ - imports: [NodeDeleteDirective, CheckAllowableOperationDirective], - template: `
` + imports: [NodeDeleteDirective], + template: `
` }) class TestWithPermissionsComponent { selection: any[] = []; diff --git a/lib/content-services/src/lib/directives/public-api.ts b/lib/content-services/src/lib/directives/public-api.ts index d9db4cfbbe..1183a0cb47 100644 --- a/lib/content-services/src/lib/directives/public-api.ts +++ b/lib/content-services/src/lib/directives/public-api.ts @@ -19,7 +19,6 @@ export * from './content-directive.module'; export * from './node-lock.directive'; export * from './node-counter.directive'; export * from './auto-focus.directive'; -export * from './check-allowable-operation.directive'; export * from './library-favorite.directive'; export * from './library-membership.directive'; export * from './node-delete.directive'; diff --git a/lib/content-services/src/lib/interfaces/base-card-view-content-update.interface.ts b/lib/content-services/src/lib/interfaces/base-card-view-content-update.interface.ts deleted file mode 100644 index 64cb19817b..0000000000 --- a/lib/content-services/src/lib/interfaces/base-card-view-content-update.interface.ts +++ /dev/null @@ -1,29 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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 { CardViewBaseItemModel, UpdateNotification } from '@alfresco/adf-core'; -import { Node } from '@alfresco/js-api'; -import { Subject } from 'rxjs'; - -export interface BaseCardViewContentUpdate { - itemUpdated$: Subject; - updatedAspect$: Subject; - - update(property: CardViewBaseItemModel, newValue: any); - updateElement(notification: CardViewBaseItemModel); - updateNodeAspect(node: Node); -} diff --git a/lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts b/lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts deleted file mode 100644 index 599f3f6a66..0000000000 --- a/lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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 interface NodeAllowableOperationSubject { - disabled: boolean; -} diff --git a/lib/content-services/src/lib/interfaces/public-api.ts b/lib/content-services/src/lib/interfaces/public-api.ts index 388746d14d..ef40c13de5 100644 --- a/lib/content-services/src/lib/interfaces/public-api.ts +++ b/lib/content-services/src/lib/interfaces/public-api.ts @@ -15,10 +15,7 @@ * limitations under the License. */ -export * from './node-allowable-operation-subject.interface'; export * from './library-entity.interface'; export * from './restore-message-model.interface'; export * from './library-membership-error-event.interface'; export * from './library-membership-toggle-event.interface'; -export * from './base-card-view-content-update.interface'; - diff --git a/lib/content-services/src/lib/upload/components/upload-button.component.ts b/lib/content-services/src/lib/upload/components/upload-button.component.ts index 299630437c..4bedbbbd36 100644 --- a/lib/content-services/src/lib/upload/components/upload-button.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-button.component.ts @@ -15,8 +15,8 @@ * limitations under the License. */ -import { EXTENDIBLE_COMPONENT, FileUtils } from '@alfresco/adf-core'; -import { Component, EventEmitter, forwardRef, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation, inject } from '@angular/core'; +import { FileUtils } from '@alfresco/adf-core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation, inject } from '@angular/core'; import { NodesApiService } from '../../common/services/nodes-api.service'; import { ContentService } from '../../common/services/content.service'; import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; @@ -24,7 +24,6 @@ import { Node } from '@alfresco/js-api'; import { Subject } from 'rxjs'; import { PermissionModel } from '../../document-list/models/permissions.model'; import { UploadBase } from './base-upload/upload-base'; -import { NodeAllowableOperationSubject } from '../../interfaces/node-allowable-operation-subject.interface'; import { CommonModule } from '@angular/common'; import { MatButtonModule } from '@angular/material/button'; import { TranslatePipe } from '@ngx-translate/core'; @@ -35,10 +34,9 @@ import { MatIconModule } from '@angular/material/icon'; imports: [CommonModule, MatButtonModule, TranslatePipe, MatIconModule], templateUrl: './upload-button.component.html', styleUrls: ['./upload-button.component.scss'], - viewProviders: [{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadButtonComponent) }], encapsulation: ViewEncapsulation.None }) -export class UploadButtonComponent extends UploadBase implements OnInit, OnChanges, NodeAllowableOperationSubject { +export class UploadButtonComponent extends UploadBase implements OnInit, OnChanges { private contentService = inject(ContentService); private nodesApiService = inject(NodesApiService); diff --git a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts index ceebaca520..41ab09ac5f 100644 --- a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts @@ -15,9 +15,8 @@ * limitations under the License. */ -import { EXTENDIBLE_COMPONENT, FileInfo, FileUtils, NotificationService } from '@alfresco/adf-core'; -import { Component, forwardRef, ViewEncapsulation, inject } from '@angular/core'; -import { NodeAllowableOperationSubject } from '../../interfaces/node-allowable-operation-subject.interface'; +import { FileInfo, FileUtils, NotificationService } from '@alfresco/adf-core'; +import { Component, ViewEncapsulation, inject } from '@angular/core'; import { UploadBase } from './base-upload/upload-base'; import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; import { ContentService } from '../../common/services/content.service'; @@ -31,10 +30,9 @@ import { FileDraggableDirective } from '../directives/file-draggable.directive'; templateUrl: './upload-drag-area.component.html', styleUrls: ['./upload-drag-area.component.scss'], host: { class: 'adf-upload-drag-area' }, - viewProviders: [{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadDragAreaComponent) }], encapsulation: ViewEncapsulation.None }) -export class UploadDragAreaComponent extends UploadBase implements NodeAllowableOperationSubject { +export class UploadDragAreaComponent extends UploadBase { private notificationService = inject(NotificationService); private contentService = inject(ContentService); diff --git a/lib/content-services/src/lib/upload/components/upload-version-button.component.ts b/lib/content-services/src/lib/upload/components/upload-version-button.component.ts index 1bd617de40..30fa741aa0 100644 --- a/lib/content-services/src/lib/upload/components/upload-version-button.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-version-button.component.ts @@ -15,8 +15,7 @@ * limitations under the License. */ -import { EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; -import { Component, forwardRef, Input, OnChanges, ViewEncapsulation, OnInit } from '@angular/core'; +import { Component, Input, OnChanges, ViewEncapsulation, OnInit } from '@angular/core'; import { Node } from '@alfresco/js-api'; import { UploadButtonComponent } from './upload-button.component'; import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; @@ -31,7 +30,6 @@ import { MatIconModule } from '@angular/material/icon'; imports: [CommonModule, MatButtonModule, TranslatePipe, MatIconModule], templateUrl: './upload-button.component.html', styleUrls: ['./upload-button.component.scss'], - viewProviders: [{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadVersionButtonComponent) }], encapsulation: ViewEncapsulation.None, host: { class: 'adf-upload-version-button' } }) diff --git a/lib/core/src/lib/interface/index.ts b/lib/core/src/lib/interface/index.ts deleted file mode 100644 index f22da90e09..0000000000 --- a/lib/core/src/lib/interface/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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'; diff --git a/lib/core/src/lib/interface/injection.tokens.ts b/lib/core/src/lib/interface/injection.tokens.ts deleted file mode 100644 index b78eda183e..0000000000 --- a/lib/core/src/lib/interface/injection.tokens.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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 { Component, InjectionToken } from '@angular/core'; - -export const EXTENDIBLE_COMPONENT = new InjectionToken('extendible.component'); diff --git a/lib/core/src/lib/interface/public-api.ts b/lib/core/src/lib/interface/public-api.ts deleted file mode 100644 index 41f9b2325d..0000000000 --- a/lib/core/src/lib/interface/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 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 './injection.tokens'; diff --git a/lib/core/src/public-api.ts b/lib/core/src/public-api.ts index 89143c2025..a7eb51c1eb 100644 --- a/lib/core/src/public-api.ts +++ b/lib/core/src/public-api.ts @@ -50,7 +50,6 @@ export * from './lib/search-text/index'; export * from './lib/snackbar-content/index'; export * from './lib/translation/index'; export * from './lib/common/utils/index'; -export * from './lib/interface/index'; export * from './lib/models/index'; export * from './lib/events/index'; export * from './lib/mock/index';