migrate alert-box in lib, up route airwatch demo layout
This commit is contained in:
parent
fe63fec58f
commit
d0b5ad10f6
15 changed files with 174 additions and 9 deletions
1
my-workspace/projects/sae-lib/.npmrc
Normal file
1
my-workspace/projects/sae-lib/.npmrc
Normal file
|
@ -0,0 +1 @@
|
|||
prefix=/home/tykayn/.npm-global
|
|
@ -1,14 +1,16 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {NgClass} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-alert-box',
|
||||
imports: [
|
||||
],
|
||||
selector: 'sae-alert-box',
|
||||
imports: [],
|
||||
templateUrl: './alert-box.html',
|
||||
styleUrl: './alert-box.scss'
|
||||
})
|
||||
export class AlertBox {
|
||||
@Input() public message = "";
|
||||
|
||||
@Input() public _alertKind = "warning";
|
||||
|
||||
get alertKind(): string {
|
||||
return this._alertKind;
|
||||
}
|
||||
|
@ -16,7 +18,5 @@ export class AlertBox {
|
|||
set alertKind(value: string) {
|
||||
this._alertKind = value;
|
||||
}
|
||||
@Input() public _alertKind: string = "warning";
|
||||
@Input() public message: string = "";
|
||||
|
||||
}
|
||||
|
|
7
my-workspace/projects/sae-lib/buttons/copy/copy.html
Normal file
7
my-workspace/projects/sae-lib/buttons/copy/copy.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<button class="button copy" (click)="copy()">
|
||||
<i class="ri-file-copy-2-fill"></i>
|
||||
<span class="label">
|
||||
Copy
|
||||
</span>
|
||||
</button>
|
||||
|
0
my-workspace/projects/sae-lib/buttons/copy/copy.scss
Normal file
0
my-workspace/projects/sae-lib/buttons/copy/copy.scss
Normal file
23
my-workspace/projects/sae-lib/buttons/copy/copy.spec.ts
Normal file
23
my-workspace/projects/sae-lib/buttons/copy/copy.spec.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { Copy } from './copy';
|
||||
|
||||
describe('Copy', () => {
|
||||
let component: Copy;
|
||||
let fixture: ComponentFixture<Copy>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [Copy]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(Copy);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
54
my-workspace/projects/sae-lib/buttons/copy/copy.ts
Normal file
54
my-workspace/projects/sae-lib/buttons/copy/copy.ts
Normal file
|
@ -0,0 +1,54 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-copy',
|
||||
imports: [],
|
||||
templateUrl: './copy.html',
|
||||
styleUrl: './copy.scss'
|
||||
})
|
||||
export class Copy {
|
||||
|
||||
@Input() textToCopy = "";
|
||||
|
||||
copy() {
|
||||
this.copyTextToClipboard(this.textToCopy)
|
||||
}
|
||||
|
||||
fallbackCopyTextToClipboard(text: any) {
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.value = text;
|
||||
|
||||
// Avoid scrolling to bottom
|
||||
textArea.style.top = "0";
|
||||
textArea.style.left = "0";
|
||||
textArea.style.position = "fixed";
|
||||
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'successful' : 'unsuccessful';
|
||||
console.log('Fallback: Copying text command was ' + msg);
|
||||
} catch (err) {
|
||||
console.error('Fallback: Oops, unable to copy', err);
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
|
||||
copyTextToClipboard(text: string) {
|
||||
console.log("copier", text)
|
||||
if (!navigator.clipboard) {
|
||||
this.fallbackCopyTextToClipboard(text);
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(function () {
|
||||
console.log('Async: Copying to clipboard was successful!');
|
||||
}, function (err) {
|
||||
console.error('Async: Could not copy text: ', err);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -38,7 +38,6 @@
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
|
||||
}
|
||||
|
||||
.feedback-modal {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue