mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4391] Doc review for 3.2 (#4601)
* [ADF-4391] Reviewed new clipboard class docs * [ADF-4391] Reviewed new proc cloud class docs * [ADF-4391] Reviewed new datatable doc additions
This commit is contained in:
committed by
Eugenio Romano
parent
16aaa0f0b3
commit
921fdc00df
@@ -23,13 +23,16 @@ import { ClipboardService } from './clipboard.service';
|
||||
exportAs: 'adfClipboard'
|
||||
})
|
||||
export class ClipboardDirective {
|
||||
/** Translation key or message for the tooltip. */
|
||||
// tslint:disable-next-line:no-input-rename
|
||||
@Input('adf-clipboard')
|
||||
placeholder: string;
|
||||
|
||||
/** Reference to the HTML element containing the text to copy. */
|
||||
@Input()
|
||||
target: HTMLInputElement | HTMLTextAreaElement;
|
||||
|
||||
/** Translation key or message for snackbar notification. */
|
||||
// tslint:disable-next-line:no-input-rename
|
||||
@Input('clipboard-notification') message: string;
|
||||
|
||||
|
@@ -28,6 +28,11 @@ export class ClipboardService {
|
||||
private logService: LogService,
|
||||
private notificationService: NotificationService) {}
|
||||
|
||||
/**
|
||||
* Checks if the target element can have its text copied.
|
||||
* @param target Target HTML element
|
||||
* @returns True if the text can be copied, false otherwise
|
||||
*/
|
||||
isTargetValid(target: HTMLInputElement | HTMLTextAreaElement) {
|
||||
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
|
||||
return !target.hasAttribute('disabled');
|
||||
@@ -35,6 +40,11 @@ export class ClipboardService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies text from an HTML element to the clipboard.
|
||||
* @param target HTML element to be copied
|
||||
* @param message Snackbar message to alert when copying happens
|
||||
*/
|
||||
copyToClipboard(target: HTMLInputElement | HTMLTextAreaElement, message?: string) {
|
||||
if (this.isTargetValid(target)) {
|
||||
try {
|
||||
@@ -48,6 +58,11 @@ export class ClipboardService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a text string to the clipboard.
|
||||
* @param content Text to copy
|
||||
* @param message Snackbar message to alert when copying happens
|
||||
*/
|
||||
copyContentToClipboard(content: string, message: string) {
|
||||
try {
|
||||
document.addEventListener('copy', (e: ClipboardEvent) => {
|
||||
|
@@ -32,7 +32,7 @@ export class DataColumnComponent implements OnInit {
|
||||
key: string;
|
||||
|
||||
/** Value type for the column. Possible settings are 'text', 'image',
|
||||
* 'date', 'fileSize' and 'location'.
|
||||
* 'date', 'fileSize', 'location', and 'json'.
|
||||
*/
|
||||
@Input()
|
||||
type: string = 'text';
|
||||
@@ -66,7 +66,7 @@ export class DataColumnComponent implements OnInit {
|
||||
@Input('class')
|
||||
cssClass: string;
|
||||
|
||||
/** flag to show the copy content directive */
|
||||
/** Enables/disables a Clipboard directive to allow copying of cell contents. */
|
||||
@Input()
|
||||
copyContent: boolean;
|
||||
|
||||
|
@@ -55,20 +55,25 @@ import { Node } from '@alfresco/js-api';
|
||||
host: { class: 'adf-datatable-cell' }
|
||||
})
|
||||
export class DataTableCellComponent implements OnInit, OnDestroy {
|
||||
/** Data table adapter instance. */
|
||||
@Input()
|
||||
data: DataTableAdapter;
|
||||
|
||||
/** Data that defines the column. */
|
||||
@Input()
|
||||
column: DataColumn;
|
||||
|
||||
/** Data that defines the row. */
|
||||
@Input()
|
||||
row: DataRow;
|
||||
|
||||
value$ = new BehaviorSubject<any>('');
|
||||
|
||||
/** Enables/disables a Clipboard directive to allow copying of the cell's content. */
|
||||
@Input()
|
||||
copyContent: boolean;
|
||||
|
||||
/** Text for the cell's tooltip. */
|
||||
@Input()
|
||||
tooltip: string;
|
||||
|
||||
|
Reference in New Issue
Block a user