From d0b5ad10f67342c9d9053d33f4db3cb63d4b3167 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 11 Aug 2025 11:56:52 +0200 Subject: [PATCH] migrate alert-box in lib, up route airwatch demo layout --- .idea/inspectionProfiles/Project_Default.xml | 22 ++++++++ .idea/modules.xml | 8 +++ .idea/ng-implementation.iml | 10 ++++ .idea/php.xml | 34 ++++++++++++ .idea/vcs.xml | 7 +++ blueprint/README.md | 0 my-workspace/package.json | 3 +- my-workspace/projects/sae-lib/.npmrc | 1 + .../projects/sae-lib/alert-box/alert-box.ts | 12 ++--- .../projects/sae-lib/buttons/copy/copy.html | 7 +++ .../projects/sae-lib/buttons/copy/copy.scss | 0 .../sae-lib/buttons/copy/copy.spec.ts | 23 ++++++++ .../projects/sae-lib/buttons/copy/copy.ts | 54 +++++++++++++++++++ .../feedback-button/feedback-button.scss | 1 - ng-demo | 1 - 15 files changed, 174 insertions(+), 9 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/ng-implementation.iml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml create mode 100644 blueprint/README.md create mode 100644 my-workspace/projects/sae-lib/.npmrc create mode 100644 my-workspace/projects/sae-lib/buttons/copy/copy.html create mode 100644 my-workspace/projects/sae-lib/buttons/copy/copy.scss create mode 100644 my-workspace/projects/sae-lib/buttons/copy/copy.spec.ts create mode 100644 my-workspace/projects/sae-lib/buttons/copy/copy.ts delete mode 160000 ng-demo diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..bc710fc --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..51c826a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/ng-implementation.iml b/.idea/ng-implementation.iml new file mode 100644 index 0000000..59d1756 --- /dev/null +++ b/.idea/ng-implementation.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..284c9de --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..d515f62 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/blueprint/README.md b/blueprint/README.md new file mode 100644 index 0000000..e69de29 diff --git a/my-workspace/package.json b/my-workspace/package.json index 3c124a3..f68710e 100644 --- a/my-workspace/package.json +++ b/my-workspace/package.json @@ -43,8 +43,9 @@ "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", + "sae-lib": "file:../my-workspace/projects/sae-lib", "ng-packagr": "^20.1.0", "typescript": "~5.8.2", "typescript-eslint": "8.34.1" } -} \ No newline at end of file +} diff --git a/my-workspace/projects/sae-lib/.npmrc b/my-workspace/projects/sae-lib/.npmrc new file mode 100644 index 0000000..0b4ed73 --- /dev/null +++ b/my-workspace/projects/sae-lib/.npmrc @@ -0,0 +1 @@ +prefix=/home/tykayn/.npm-global diff --git a/my-workspace/projects/sae-lib/alert-box/alert-box.ts b/my-workspace/projects/sae-lib/alert-box/alert-box.ts index bf4a5fb..fe0a3cb 100644 --- a/my-workspace/projects/sae-lib/alert-box/alert-box.ts +++ b/my-workspace/projects/sae-lib/alert-box/alert-box.ts @@ -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 = ""; } diff --git a/my-workspace/projects/sae-lib/buttons/copy/copy.html b/my-workspace/projects/sae-lib/buttons/copy/copy.html new file mode 100644 index 0000000..dc10c36 --- /dev/null +++ b/my-workspace/projects/sae-lib/buttons/copy/copy.html @@ -0,0 +1,7 @@ + + diff --git a/my-workspace/projects/sae-lib/buttons/copy/copy.scss b/my-workspace/projects/sae-lib/buttons/copy/copy.scss new file mode 100644 index 0000000..e69de29 diff --git a/my-workspace/projects/sae-lib/buttons/copy/copy.spec.ts b/my-workspace/projects/sae-lib/buttons/copy/copy.spec.ts new file mode 100644 index 0000000..7c7c093 --- /dev/null +++ b/my-workspace/projects/sae-lib/buttons/copy/copy.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Copy } from './copy'; + +describe('Copy', () => { + let component: Copy; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Copy] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Copy); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/my-workspace/projects/sae-lib/buttons/copy/copy.ts b/my-workspace/projects/sae-lib/buttons/copy/copy.ts new file mode 100644 index 0000000..c0b6097 --- /dev/null +++ b/my-workspace/projects/sae-lib/buttons/copy/copy.ts @@ -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); + }); + } + +} diff --git a/my-workspace/projects/sae-lib/buttons/feedback-button/feedback-button.scss b/my-workspace/projects/sae-lib/buttons/feedback-button/feedback-button.scss index 3eebdf1..beda863 100644 --- a/my-workspace/projects/sae-lib/buttons/feedback-button/feedback-button.scss +++ b/my-workspace/projects/sae-lib/buttons/feedback-button/feedback-button.scss @@ -38,7 +38,6 @@ justify-content: center; align-items: center; z-index: 1000; - } .feedback-modal { diff --git a/ng-demo b/ng-demo deleted file mode 160000 index 6f5cfc7..0000000 --- a/ng-demo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f5cfc7fd66a143c55f7541e4bbb5b6625e6a8f8