mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-8468] Remove copy to clipboard action for properties
This commit is contained in:
-4
@@ -6,7 +6,6 @@
|
||||
[attr.data-automation-id]="'card-dateitem-label-' + property.key"
|
||||
[attr.for]="'card-view-dateitem-' + property.key"
|
||||
[ngClass]="{ 'adf-property-readonly-value': isReadonlyProperty || !editable, 'adf-property-value-editable': editable }"
|
||||
[title]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate"
|
||||
>
|
||||
{{ property.label | translate }}
|
||||
</mat-label>
|
||||
@@ -26,7 +25,6 @@
|
||||
class="adf-datepicker-span-button"
|
||||
[attr.data-automation-id]="'datepicker-label-toggle-' + property.key"
|
||||
(click)="showDatePicker()"
|
||||
(dblclick)="copyToClipboard(property.displayValue)"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
(keyup.enter)="showDatePicker()"
|
||||
@@ -95,7 +93,6 @@
|
||||
[attr.data-automation-id]="'card-dateitem-label-' + property.key"
|
||||
[attr.for]="'card-view-dateitem-' + property.key"
|
||||
[ngClass]="{ 'adf-property-readonly-value': isReadonlyProperty || !editable, 'adf-property-value-editable': editable }"
|
||||
[title]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate"
|
||||
>
|
||||
{{ property.label | translate }}
|
||||
</mat-label>
|
||||
@@ -116,7 +113,6 @@
|
||||
class="adf-datepicker-span-button"
|
||||
[attr.data-automation-id]="'datepicker-label-toggle-' + property.key"
|
||||
(click)="showDatePicker()"
|
||||
(dblclick)="copyToClipboard(property.displayValue)"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
(keyup.enter)="showDatePicker()"
|
||||
|
||||
-14
@@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||
import { ClipboardService } from '../../../clipboard/clipboard.service';
|
||||
import { CardViewDatetimeItemModel } from '../../models/card-view-datetimeitem.model';
|
||||
import { AppConfigService } from '../../../app-config/app-config.service';
|
||||
import { DatetimeAdapter, MatDatetimepickerInputEvent } from '@mat-datetimepicker/core';
|
||||
@@ -212,19 +211,6 @@ describe('CardViewDateItemComponent', () => {
|
||||
expect(component.property.value).toEqual(expectedDate);
|
||||
});
|
||||
|
||||
it('should copy value to clipboard on double click', () => {
|
||||
const clipboardService = TestBed.inject(ClipboardService);
|
||||
spyOn(clipboardService, 'copyContentToClipboard');
|
||||
|
||||
component.editable = false;
|
||||
fixture.detectChanges();
|
||||
|
||||
testingUtils.doubleClickByDataAutomationId('datepicker-label-toggle-' + component.property.key);
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(clipboardService.copyContentToClipboard).toHaveBeenCalledWith('Jul 10, 2017', 'CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
});
|
||||
|
||||
describe('clear icon', () => {
|
||||
it('should render the clear icon in case of displayClearAction:true', () => {
|
||||
component.editable = true;
|
||||
|
||||
-11
@@ -27,8 +27,6 @@ import {
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { UserPreferencesService } from '../../../common/services/user-preferences.service';
|
||||
import { BaseCardView } from '../base-card-view';
|
||||
import { ClipboardService } from '../../../clipboard/clipboard.service';
|
||||
import { TranslationService } from '../../../translation/translation.service';
|
||||
import { ADF_DATE_FORMATS, AdfDateFnsAdapter } from '../../../common/utils/date-fns-adapter';
|
||||
import { ADF_DATETIME_FORMATS, AdfDateTimeFnsAdapter } from '../../../common/utils/datetime-fns-adapter';
|
||||
import { isValid } from 'date-fns';
|
||||
@@ -76,8 +74,6 @@ export class CardViewDateItemComponent extends BaseCardView<CardViewDateItemMode
|
||||
private readonly dateAdapter = inject<DateAdapter<Date>>(DateAdapter);
|
||||
private readonly datetimeAdapter = inject<DatetimeAdapter<Date>>(DatetimeAdapter);
|
||||
private readonly userPreferencesService = inject(UserPreferencesService);
|
||||
private readonly clipboardService = inject(ClipboardService);
|
||||
private readonly translateService = inject(TranslationService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
@Input()
|
||||
@@ -203,13 +199,6 @@ export class CardViewDateItemComponent extends BaseCardView<CardViewDateItemMode
|
||||
this.property.default = null;
|
||||
}
|
||||
|
||||
copyToClipboard(valueToCopy: string | string[]) {
|
||||
if (typeof valueToCopy === 'string') {
|
||||
const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
this.clipboardService.copyContentToClipboard(valueToCopy, clipboardMessage);
|
||||
}
|
||||
}
|
||||
|
||||
addDateToList(event: MatDatetimepickerInputEvent<Date>) {
|
||||
if (event.value) {
|
||||
if (isValid(event.value) && this.property.multivalued && Array.isArray(this.property.value)) {
|
||||
|
||||
-4
@@ -42,9 +42,6 @@ export class CardViewItemDispatcherComponent implements OnChanges {
|
||||
@Input()
|
||||
displayClearAction: boolean = true;
|
||||
|
||||
@Input()
|
||||
copyToClipboardAction: boolean = true;
|
||||
|
||||
@Input()
|
||||
useChipsForMultiValueProperty: boolean = true;
|
||||
|
||||
@@ -99,7 +96,6 @@ export class CardViewItemDispatcherComponent implements OnChanges {
|
||||
this.componentReference.instance.displayEmpty = this.displayEmpty;
|
||||
this.componentReference.instance.displayNoneOption = this.displayNoneOption;
|
||||
this.componentReference.instance.displayClearAction = this.displayClearAction;
|
||||
this.componentReference.instance.copyToClipboardAction = this.copyToClipboardAction;
|
||||
this.componentReference.instance.useChipsForMultiValueProperty = this.useChipsForMultiValueProperty;
|
||||
this.componentReference.instance.multiValueSeparator = this.multiValueSeparator;
|
||||
}
|
||||
|
||||
-2
@@ -82,7 +82,6 @@
|
||||
[placeholder]="property.default"
|
||||
[attr.aria-label]="property.label | translate"
|
||||
[formControl]="autocompleteControl"
|
||||
[title]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate"
|
||||
[attr.data-automation-id]="'card-autocomplete-based-selectitem-value-' + property.key"
|
||||
/>
|
||||
} @else {
|
||||
@@ -98,7 +97,6 @@
|
||||
[placeholder]="property.default"
|
||||
[attr.aria-label]="property.label | translate"
|
||||
[formControl]="autocompleteControl"
|
||||
[title]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate"
|
||||
[attr.data-automation-id]="'card-autocomplete-based-selectitem-value-' + property.key"
|
||||
/>
|
||||
}
|
||||
|
||||
-2
@@ -6,9 +6,7 @@
|
||||
[ngClass]="{
|
||||
'adf-property-read-only': isReadonlyProperty
|
||||
}"
|
||||
(dblclick)="copyToClipboard(property.displayValue)"
|
||||
[attr.data-automation-id]="'card-textitem-field-' + property.key"
|
||||
[title]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate"
|
||||
>
|
||||
<mat-label
|
||||
[attr.data-automation-id]="'card-textitem-label-' + property.key"
|
||||
|
||||
-22
@@ -24,7 +24,6 @@ import { CardViewItemIntValidator } from '../../validators/card-view-item-int.va
|
||||
import { CardViewIntItemModel } from '../../models/card-view-intitem.model';
|
||||
import { CardViewFloatItemModel } from '../../models/card-view-floatitem.model';
|
||||
import { MatChipInputEvent } from '@angular/material/chips';
|
||||
import { ClipboardService } from '../../../clipboard/clipboard.service';
|
||||
import { DebugElement, SimpleChange } from '@angular/core';
|
||||
import { CardViewItemValidator } from '../../interfaces/card-view-item-validator.interface';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
@@ -562,27 +561,6 @@ describe('CardViewTextItemComponent', () => {
|
||||
expect(await getTextFieldValue(component.property.key)).toEqual(expectedText);
|
||||
});
|
||||
|
||||
it('should copy value to clipboard on double click', async () => {
|
||||
const clipboardService = TestBed.inject(ClipboardService);
|
||||
spyOn(clipboardService, 'copyContentToClipboard');
|
||||
|
||||
component.property.value = 'myValueToCopy';
|
||||
component.property.icon = 'FAKE_ICON';
|
||||
component.editable = false;
|
||||
component.copyToClipboardAction = true;
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
|
||||
testingUtils.doubleClickByDataAutomationId(`card-textitem-field-${component.property.key}`);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(clipboardService.copyContentToClipboard).toHaveBeenCalledWith(
|
||||
'myValueToCopy',
|
||||
'CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE'
|
||||
);
|
||||
});
|
||||
|
||||
it('should input be disabled if item it NOT editable', async () => {
|
||||
component.editable = false;
|
||||
component.property.clickable = true;
|
||||
|
||||
-14
@@ -19,8 +19,6 @@ import { ChangeDetectorRef, Component, DestroyRef, inject, Input, OnChanges, Sim
|
||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||
import { BaseCardView } from '../base-card-view';
|
||||
import { MatChipInputEvent, MatChipsModule } from '@angular/material/chips';
|
||||
import { ClipboardService } from '../../../clipboard/clipboard.service';
|
||||
import { TranslationService } from '../../../translation/translation.service';
|
||||
import { CardViewItemValidator } from '../../interfaces/card-view-item-validator.interface';
|
||||
import { FormsModule, ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
||||
import { debounceTime, filter } from 'rxjs/operators';
|
||||
@@ -61,16 +59,11 @@ const templateTypes = {
|
||||
host: { class: 'adf-card-view-textitem' }
|
||||
})
|
||||
export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemModel> implements OnChanges {
|
||||
private readonly clipboardService = inject(ClipboardService);
|
||||
private readonly translateService = inject(TranslationService);
|
||||
private readonly cd = inject(ChangeDetectorRef);
|
||||
|
||||
@Input()
|
||||
displayEmpty = true;
|
||||
|
||||
@Input()
|
||||
copyToClipboardAction = true;
|
||||
|
||||
@Input()
|
||||
useChipsForMultiValueProperty = true;
|
||||
|
||||
@@ -217,13 +210,6 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
|
||||
this.update();
|
||||
}
|
||||
|
||||
copyToClipboard(valueToCopy: string) {
|
||||
if (this.copyToClipboardAction) {
|
||||
const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
this.clipboardService.copyContentToClipboard(valueToCopy, clipboardMessage);
|
||||
}
|
||||
}
|
||||
|
||||
undoText(event: KeyboardEvent) {
|
||||
if ((event.ctrlKey || event.metaKey) && event.code === 'KeyZ' && this.textInput.value) {
|
||||
this.textInput.setValue('');
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
[displayEmpty]="displayEmpty"
|
||||
[displayNoneOption]="property['displayNoneOption'] !== undefined ? property['displayNoneOption'] : displayNoneOption"
|
||||
[displayClearAction]="displayClearAction"
|
||||
[copyToClipboardAction]="copyToClipboardAction"
|
||||
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
|
||||
[multiValueSeparator]="multiValueSeparator" />
|
||||
</div>
|
||||
|
||||
@@ -49,10 +49,6 @@ export class CardViewComponent {
|
||||
@Input()
|
||||
displayClearAction: boolean = true;
|
||||
|
||||
/** Toggles whether or not to enable copy to clipboard action. */
|
||||
@Input()
|
||||
copyToClipboardAction: boolean = true;
|
||||
|
||||
/** Toggles whether or not to enable chips for multivalued properties. */
|
||||
@Input()
|
||||
useChipsForMultiValueProperty: boolean = true;
|
||||
|
||||
@@ -69,14 +69,6 @@ export const cardViewArgTypes: ArgTypes = {
|
||||
defaultValue: { summary: 'true' }
|
||||
}
|
||||
},
|
||||
copyToClipboardAction: {
|
||||
control: 'boolean',
|
||||
description: 'Copy to clipboard action - default template in editable mode',
|
||||
table: {
|
||||
type: { summary: 'boolean' },
|
||||
defaultValue: { summary: 'true' }
|
||||
}
|
||||
},
|
||||
useChipsForMultiValueProperty: {
|
||||
control: 'boolean',
|
||||
description: 'Split text for chips using defined separator',
|
||||
@@ -103,7 +95,6 @@ export const cardViewDefaultArgs: Record<string, unknown> = {
|
||||
displayEmpty: true,
|
||||
displayNoneOption: true,
|
||||
displayClearAction: true,
|
||||
copyToClipboardAction: true,
|
||||
useChipsForMultiValueProperty: true,
|
||||
multiValueSeparator: ', '
|
||||
};
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "إلغاء",
|
||||
"CLEAR": "مسح",
|
||||
"TOGGLE": "تبديل القيمة",
|
||||
"COPY_TO_CLIPBOARD": "انقر مرتين لنسخ القيمة",
|
||||
"EDIT_ASPECTS": "تحرير الجانب"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Zrušit",
|
||||
"CLEAR": "Vymazat",
|
||||
"TOGGLE": "Přepnout hodnotu",
|
||||
"COPY_TO_CLIPBOARD": "Dvojím kliknutím zkopírovat hodnotu",
|
||||
"EDIT_ASPECTS": "Úprava aspektů"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Annuller",
|
||||
"CLEAR": "Ryd",
|
||||
"TOGGLE": "Slå værdi til/fra",
|
||||
"COPY_TO_CLIPBOARD": "Dobbeltklik for at kopiere værdien",
|
||||
"EDIT_ASPECTS": "Rediger aspekt"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Abbrechen",
|
||||
"CLEAR": "Löschen",
|
||||
"TOGGLE": "Umschaltwert",
|
||||
"COPY_TO_CLIPBOARD": "Doppelklicken, um den Wert zu kopieren",
|
||||
"EDIT_ASPECTS": "Aspekt bearbeiten"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Cancel",
|
||||
"CLEAR": "Clear",
|
||||
"TOGGLE": "Toggle value",
|
||||
"COPY_TO_CLIPBOARD": "Double click to copy value",
|
||||
"EDIT_ASPECTS": "Edit Aspect"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Cancel",
|
||||
"CLEAR": "Clear",
|
||||
"TOGGLE": "Toggle value",
|
||||
"COPY_TO_CLIPBOARD": "Double click to copy value",
|
||||
"EDIT_ASPECTS": "Edit Aspect"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Cancelar",
|
||||
"CLEAR": "Borrar",
|
||||
"TOGGLE": "Cambiar valor",
|
||||
"COPY_TO_CLIPBOARD": "Haga doble clic para copiar el valor",
|
||||
"EDIT_ASPECTS": "Editar aspecto"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Peruuta",
|
||||
"CLEAR": "Tyhjennä",
|
||||
"TOGGLE": "Vaihda arvoa",
|
||||
"COPY_TO_CLIPBOARD": "Kopioi arvo kaksoisnapsauttamalla",
|
||||
"EDIT_ASPECTS": "Muokkaa ominaisuusjoukkoja"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Annuler",
|
||||
"CLEAR": "Supprimer",
|
||||
"TOGGLE": "Basculer la valeur",
|
||||
"COPY_TO_CLIPBOARD": "Faites un double clic pour copier la valeur",
|
||||
"EDIT_ASPECTS": "Modifier aspect"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Annulla",
|
||||
"CLEAR": "Cancella",
|
||||
"TOGGLE": "Cambiare valore",
|
||||
"COPY_TO_CLIPBOARD": "Fare doppio clic per copiare il valore",
|
||||
"EDIT_ASPECTS": "Modifica aspetto"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "キャンセル",
|
||||
"CLEAR": "消去",
|
||||
"TOGGLE": "値の切り替え",
|
||||
"COPY_TO_CLIPBOARD": "ダブルクリックして値をコピーします",
|
||||
"EDIT_ASPECTS": "アスペクトを編集"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Avbryt",
|
||||
"CLEAR": "Fjern",
|
||||
"TOGGLE": "Bytt verdi",
|
||||
"COPY_TO_CLIPBOARD": "Dobbeltkllikk for å kopiere verdi",
|
||||
"EDIT_ASPECTS": "Rediger aspekt"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Annuleren",
|
||||
"CLEAR": "Wissen",
|
||||
"TOGGLE": "Waarde in-/uitschakelen",
|
||||
"COPY_TO_CLIPBOARD": "Dubbelklikken om waarde te kopiëren",
|
||||
"EDIT_ASPECTS": "Aspect bewerken"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Anuluj",
|
||||
"CLEAR": "Wyczyść",
|
||||
"TOGGLE": "Przełącz wartość",
|
||||
"COPY_TO_CLIPBOARD": "Kliknij dwa razy, aby skopiować wartość",
|
||||
"EDIT_ASPECTS": "Edycja aspektu"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Cancelar",
|
||||
"CLEAR": "Limpar",
|
||||
"TOGGLE": "Alternar valor",
|
||||
"COPY_TO_CLIPBOARD": "Clique duas vezes para copiar o valor",
|
||||
"EDIT_ASPECTS": "Editar aspecto"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"CANCEL": "Cancelar",
|
||||
"CLEAR": "Limpar",
|
||||
"TOGGLE": "Alternar valor",
|
||||
"COPY_TO_CLIPBOARD": "Clique duas vezes para copiar o valor",
|
||||
"EDIT_ASPECTS": "Editar aspeto"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Отмена",
|
||||
"CLEAR": "Очистить",
|
||||
"TOGGLE": "Переключить значение",
|
||||
"COPY_TO_CLIPBOARD": "Нажмите дважды, чтобы скопировать значение",
|
||||
"EDIT_ASPECTS": "Изменить аспект"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "Avbryt",
|
||||
"CLEAR": "Rensa",
|
||||
"TOGGLE": "Växla värde",
|
||||
"COPY_TO_CLIPBOARD": "Dubbelklicka för att kopiera värde",
|
||||
"EDIT_ASPECTS": "Redigera aspekt"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
"CANCEL": "取消",
|
||||
"CLEAR": "清除",
|
||||
"TOGGLE": "切换值",
|
||||
"COPY_TO_CLIPBOARD": "双击以复制值",
|
||||
"EDIT_ASPECTS": "编辑纵横比"
|
||||
},
|
||||
"ACCESSIBILITY": {
|
||||
|
||||
Reference in New Issue
Block a user