mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4394] - add suport for copy clipboard on JSON cell type (#4611)
* [ADF-4394] - add suport for copy clipboard on JSON cell type * [ADF-4394] - lint * [ADF-4394] - change translation keys
This commit is contained in:
committed by
Maurizio Vitale
parent
e1a0475dfc
commit
550c0006c9
@@ -179,9 +179,7 @@
|
|||||||
"REPLACE_COLUMNS": "Replace columns",
|
"REPLACE_COLUMNS": "Replace columns",
|
||||||
"LOAD_NODE": "Load Node",
|
"LOAD_NODE": "Load Node",
|
||||||
"MULTISELECT": "Multiselect",
|
"MULTISELECT": "Multiselect",
|
||||||
"MULTISELECT_DESCRIPTION": "Use Cmd (Mac) or Ctrl (Windows) to toggle selection of multiple items",
|
"MULTISELECT_DESCRIPTION": "Use Cmd (Mac) or Ctrl (Windows) to toggle selection of multiple items"
|
||||||
"CLICK_TO_COPY": "Click to copy",
|
|
||||||
"SUCCESS_COPY": "Text copied to clipboard"
|
|
||||||
},
|
},
|
||||||
"ANALYTICS_REPORT": {
|
"ANALYTICS_REPORT": {
|
||||||
"NO_REPORT_MESSAGE": "No report selected. Choose a report from the list"
|
"NO_REPORT_MESSAGE": "No report selected. Choose a report from the list"
|
||||||
|
@@ -36,8 +36,8 @@ import { Node } from '@alfresco/js-api';
|
|||||||
template: `
|
template: `
|
||||||
<ng-container>
|
<ng-container>
|
||||||
<span *ngIf="copyContent; else defaultCell"
|
<span *ngIf="copyContent; else defaultCell"
|
||||||
adf-clipboard="DATATABLE.CLICK_TO_COPY"
|
adf-clipboard="CLIPBOARD.CLICK_TO_COPY"
|
||||||
[clipboard-notification]="'DATATABLE.SUCCESS_COPY'"
|
[clipboard-notification]="'CLIPBOARD.SUCCESS_COPY'"
|
||||||
[attr.aria-label]="value$ | async"
|
[attr.aria-label]="value$ | async"
|
||||||
[title]="tooltip"
|
[title]="tooltip"
|
||||||
class="adf-datatable-cell-value"
|
class="adf-datatable-cell-value"
|
||||||
|
@@ -162,6 +162,7 @@
|
|||||||
<div *ngSwitchCase="'json'" class="adf-cell-value"
|
<div *ngSwitchCase="'json'" class="adf-cell-value"
|
||||||
[attr.data-automation-id]="'text_' + data.getValue(row, col)">
|
[attr.data-automation-id]="'text_' + data.getValue(row, col)">
|
||||||
<adf-json-cell
|
<adf-json-cell
|
||||||
|
[copyContent]="col.copyContent"
|
||||||
[data]="data"
|
[data]="data"
|
||||||
[column]="col"
|
[column]="col"
|
||||||
[row]="row">
|
[row]="row">
|
||||||
|
@@ -2,3 +2,7 @@
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.adf-datatable-cell-value {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation, Input } from '@angular/core';
|
||||||
import { DataTableCellComponent } from './datatable-cell.component';
|
import { DataTableCellComponent } from './datatable-cell.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -23,10 +23,20 @@ import { DataTableCellComponent } from './datatable-cell.component';
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
template: `
|
template: `
|
||||||
<ng-container>
|
<ng-container>
|
||||||
|
<span *ngIf="copyContent; else defaultJsonTemplate" class="adf-datatable-cell-value">
|
||||||
|
<pre
|
||||||
|
class="adf-datatable-json-cell"
|
||||||
|
[adf-clipboard]="'CLIPBOARD.CLICK_TO_COPY'"
|
||||||
|
[clipboard-notification]="'CLIPBOARD.SUCCESS_COPY'">
|
||||||
|
{{ value$ | async | json }}
|
||||||
|
</pre>
|
||||||
|
</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #defaultJsonTemplate>
|
||||||
<span class="adf-datatable-cell-value">
|
<span class="adf-datatable-cell-value">
|
||||||
<pre class="adf-datatable-json-cell">{{ value$ | async | json }}</pre>
|
<pre class="adf-datatable-json-cell">{{ value$ | async | json }}</pre>
|
||||||
</span>
|
</span>
|
||||||
</ng-container>
|
</ng-template>
|
||||||
`,
|
`,
|
||||||
styleUrls: ['./json-cell.component.scss'],
|
styleUrls: ['./json-cell.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
@@ -34,6 +44,10 @@ import { DataTableCellComponent } from './datatable-cell.component';
|
|||||||
})
|
})
|
||||||
export class JsonCellComponent extends DataTableCellComponent implements OnInit {
|
export class JsonCellComponent extends DataTableCellComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Enables/disables a Clipboard directive to allow copying of the cell's content. */
|
||||||
|
@Input()
|
||||||
|
copyContent: boolean;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.column && this.column.key && this.row && this.data) {
|
if (this.column && this.column.key && this.row && this.data) {
|
||||||
this.value$.next(this.data.getValue(this.row, this.column));
|
this.value$.next(this.data.getValue(this.row, this.column));
|
||||||
|
@@ -422,6 +422,9 @@
|
|||||||
"CRYPTODOC_ENABLED": "Is Cryptodoc Enabled"
|
"CRYPTODOC_ENABLED": "Is Cryptodoc Enabled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"CLIPBOARD": {
|
||||||
|
"CLICK_TO_COPY": "Click to copy",
|
||||||
|
"SUCCESS_COPY": "Text copied to clipboard"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user