From b2a3acea0d0f66028c9ce5fad02d4ecc64abf70c Mon Sep 17 00:00:00 2001 From: Israel Lavi Date: Tue, 7 Aug 2018 10:54:17 +0300 Subject: Initial commit. Adding files needed for Linux Foundation. Change-Id: I9f2b4851a5ae01f83800c7f8bab8608a2221c730 Issue-ID: SDC-1608 Signed-off-by: Israel Lavi --- src/angular/accordion/accordion.component.html.ts | 2 +- src/angular/accordion/accordion.component.ts | 10 +- src/angular/accordion/accordion.module.ts | 7 +- .../autocomplete/autocomplete.component.html.ts | 2 +- src/angular/autocomplete/autocomplete.component.ts | 39 +++---- src/angular/autocomplete/autocomplete.module.ts | 17 +-- .../buttons/button-file-opener.component.html.ts | 18 +++ .../buttons/button-file-opener.component.ts | 61 ++++++++++ src/angular/buttons/button.component.html.ts | 4 +- src/angular/buttons/button.component.ts | 16 ++- src/angular/buttons/buttons.module.ts | 8 +- src/angular/buttons/ibutton.interface.ts | 14 +++ src/angular/checklist/checklist.component.html.ts | 2 +- src/angular/checklist/checklist.component.ts | 4 +- src/angular/checklist/models/ChecklistItem.ts | 4 +- src/angular/common/enums.ts | 25 ++++ src/angular/common/index.ts | 7 +- src/angular/components.ts | 30 ++++- src/angular/favicon.ico | Bin 0 -> 5430 bytes src/angular/filterbar/filter-bar.component.html.ts | 2 +- src/angular/filterbar/filter-bar.component.ts | 5 +- src/angular/filterbar/filter-bar.module.ts | 6 +- .../checkbox/checkbox.component.html.ts | 4 +- .../checkbox/checkbox.component.spec.ts | 1 - .../form-elements/checkbox/checkbox.component.ts | 3 +- .../form-elements/dropdown/dropdown-models.ts | 14 +-- .../dropdown/dropdown.component.html.ts | 2 +- .../form-elements/dropdown/dropdown.component.ts | 20 +++- src/angular/form-elements/form-elements.module.ts | 7 +- .../form-elements/input/input.component.html.ts | 19 --- src/angular/form-elements/input/input.component.ts | 54 --------- .../radios/radio-buttons-group.component.html.ts | 6 +- .../radios/radio-buttons-group.component.ts | 8 +- .../text-elements/base-text-element.component.ts | 46 ++++++++ .../text-elements/input/input.component.html.ts | 19 +++ .../text-elements/input/input.component.ts | 18 +++ .../textarea/textarea.component.html.ts | 18 +++ .../text-elements/textarea/textarea.component.ts | 14 +++ .../validation/validatable.component.ts | 8 +- .../validation/validation-group.component.html.ts | 2 +- .../validation/validation-group.component.ts | 12 +- .../validation/validation.component.html.ts | 4 +- .../validation/validation.component.ts | 9 +- .../form-elements/validation/validation.module.ts | 1 - .../validators/base.validator.component.html.ts | 4 +- .../validators/base.validator.component.ts | 8 +- .../validators/custom.validator.component.ts | 2 +- .../validators/regex.validator.component.ts | 2 +- .../validators/required.validator.component.ts | 2 +- src/angular/index.html | 14 +++ src/angular/index.ts | 31 ++++- src/angular/loader/loader.component.html.ts | 13 +++ src/angular/loader/loader.component.ts | 53 +++++++++ src/angular/loader/loader.module.ts | 21 ++++ src/angular/loader/loader.service.ts | 37 ++++++ src/angular/modals/modal-button.component.ts | 10 +- src/angular/modals/modal-close-button.component.ts | 11 +- src/angular/modals/modal.component.html.ts | 24 ++-- src/angular/modals/modal.component.spec.ts | 129 ++++++++++----------- src/angular/modals/modal.component.ts | 100 +++++++++++++--- src/angular/modals/modal.service.ts | 90 ++++---------- src/angular/modals/models/modal-config.ts | 31 ++--- .../multiline-ellipsis.component.html.ts | 8 ++ .../multiline-ellipsis.component.ts | 70 +++++++++++ .../multiline-ellipsis.module.ts | 11 ++ src/angular/ng1.module.ts | 15 ++- .../container/notifcontainer.component.html.ts | 2 +- .../container/notifcontainer.component.ts | 10 +- ...notification-inner-content-example.component.ts | 5 +- src/angular/notifications/notification.module.ts | 5 +- .../notification/notification.component.html.ts | 2 +- .../notification/notification.component.ts | 18 +-- .../services/notifications.service.ts | 18 +-- .../notifications/utilities/notification.config.ts | 10 +- src/angular/polyfills.ts | 67 +++++++++++ .../popup-menu/popup-menu-item.component.spec.ts | 3 - src/angular/popup-menu/popup-menu.module.ts | 1 - src/angular/searchbar/search-bar.component.html.ts | 2 +- src/angular/searchbar/search-bar.component.ts | 11 +- src/angular/services.ts | 13 +++ src/angular/styles.css | 9 ++ .../svg-icon/svg-icon-label.component.html.ts | 2 +- src/angular/svg-icon/svg-icon-label.component.ts | 4 +- src/angular/svg-icon/svg-icon.component.html.ts | 2 +- src/angular/svg-icon/svg-icon.component.ts | 51 ++++---- src/angular/tabs/children/tab.component.html.ts | 2 +- src/angular/tabs/children/tab.component.ts | 2 +- src/angular/tabs/tabs.component.html.ts | 2 +- src/angular/tabs/tabs.component.ts | 31 ++--- src/angular/tabs/tabs.module.ts | 1 - src/angular/tag-cloud/tag-cloud.component.html.ts | 2 +- src/angular/tag-cloud/tag-cloud.component.ts | 12 +- .../tag-cloud/tag-item/tag-item.component.html.ts | 2 +- .../tag-cloud/tag-item/tag-item.component.ts | 2 +- src/angular/test.ts | 29 +++++ src/angular/tiles/tile.component.html.ts | 2 +- src/angular/tiles/tile.component.ts | 2 +- src/angular/tooltip/tooltip.directive.ts | 2 +- src/angular/tooltip/tooltip.module.ts | 2 + src/angular/tsconfig.app.json | 15 +++ src/angular/tsconfig.spec.json | 20 ++++ src/angular/typings.d.ts | 10 ++ .../utils/create-dynamic-component.service.ts | 3 +- 103 files changed, 1115 insertions(+), 519 deletions(-) create mode 100644 src/angular/buttons/button-file-opener.component.html.ts create mode 100644 src/angular/buttons/button-file-opener.component.ts create mode 100644 src/angular/buttons/ibutton.interface.ts create mode 100644 src/angular/favicon.ico delete mode 100644 src/angular/form-elements/input/input.component.html.ts delete mode 100644 src/angular/form-elements/input/input.component.ts create mode 100644 src/angular/form-elements/text-elements/base-text-element.component.ts create mode 100644 src/angular/form-elements/text-elements/input/input.component.html.ts create mode 100644 src/angular/form-elements/text-elements/input/input.component.ts create mode 100644 src/angular/form-elements/text-elements/textarea/textarea.component.html.ts create mode 100644 src/angular/form-elements/text-elements/textarea/textarea.component.ts create mode 100644 src/angular/index.html create mode 100644 src/angular/loader/loader.component.html.ts create mode 100644 src/angular/loader/loader.component.ts create mode 100644 src/angular/loader/loader.module.ts create mode 100644 src/angular/loader/loader.service.ts create mode 100644 src/angular/multiline-ellipsis/multiline-ellipsis.component.html.ts create mode 100644 src/angular/multiline-ellipsis/multiline-ellipsis.component.ts create mode 100644 src/angular/multiline-ellipsis/multiline-ellipsis.module.ts create mode 100644 src/angular/polyfills.ts create mode 100644 src/angular/services.ts create mode 100644 src/angular/styles.css create mode 100644 src/angular/test.ts create mode 100644 src/angular/tsconfig.app.json create mode 100644 src/angular/tsconfig.spec.json create mode 100644 src/angular/typings.d.ts (limited to 'src/angular') diff --git a/src/angular/accordion/accordion.component.html.ts b/src/angular/accordion/accordion.component.html.ts index ac5f81f..2679906 100644 --- a/src/angular/accordion/accordion.component.html.ts +++ b/src/angular/accordion/accordion.component.html.ts @@ -1,4 +1,4 @@ -export default ` +export const template = `
diff --git a/src/angular/accordion/accordion.component.ts b/src/angular/accordion/accordion.component.ts index b16df89..e81597e 100644 --- a/src/angular/accordion/accordion.component.ts +++ b/src/angular/accordion/accordion.component.ts @@ -1,10 +1,6 @@ -/** - * Created by M.S.BIT on 26/04/2018. - */ - -import {Component, Input, Output, EventEmitter} from "@angular/core"; -import {Placement} from "../common/enums"; -import template from './accordion.component.html'; +import { Component, Input, Output, EventEmitter } from "@angular/core"; +import { Placement } from "../common/enums"; +import { template } from './accordion.component.html'; @Component({ selector: 'sdc-accordion', diff --git a/src/angular/accordion/accordion.module.ts b/src/angular/accordion/accordion.module.ts index 6cda646..7b3bb95 100644 --- a/src/angular/accordion/accordion.module.ts +++ b/src/angular/accordion/accordion.module.ts @@ -1,10 +1,7 @@ -/** - * Created by M.S.BIT on 26/04/2018. - */ import { NgModule } from "@angular/core"; import { CommonModule } from "@angular/common"; -import {AccordionComponent} from "./accordion.component"; -import {SvgIconModule} from "../svg-icon/svg-icon.module"; +import { AccordionComponent } from "./accordion.component"; +import { SvgIconModule } from "../svg-icon/svg-icon.module"; @NgModule({ declarations: [ diff --git a/src/angular/autocomplete/autocomplete.component.html.ts b/src/angular/autocomplete/autocomplete.component.html.ts index 5df7352..8e57f9e 100644 --- a/src/angular/autocomplete/autocomplete.component.html.ts +++ b/src/angular/autocomplete/autocomplete.component.html.ts @@ -1,4 +1,4 @@ -export default ` +export const template = `
*', animate('200ms')) ]), - ], - providers: [AutocompletePipe] + ] }) -export class SearchWithAutoCompleteComponent implements OnInit { +export class AutoCompleteComponent implements OnInit { @Input() public data: any[] = []; @Input() public dataSchema: IDataSchema; @Input() public dataUrl: string; @@ -36,12 +30,12 @@ export class SearchWithAutoCompleteComponent implements OnInit { @Input() public placeholder: string; @Output() public itemSelected: EventEmitter = new EventEmitter(); - private searchQuery: string; + public searchQuery: string; private complexData: any[] = []; - private autoCompleteResults: any[] = []; + public autoCompleteResults: any[] = []; private isItemSelected: boolean = false; - public constructor(private http: Http, private autocompletePipe: AutocompletePipe) { + public constructor(private http: HttpClient, private autocompletePipe: AutocompletePipe) { } public ngOnInit(): void { @@ -82,18 +76,18 @@ export class SearchWithAutoCompleteComponent implements OnInit { this.itemSelected.emit(selectedItem.key); } - private onSearchQueryChanged = (searchText: string): void => { + public onSearchQueryChanged = (searchText: string): void => { if (searchText !== this.searchQuery) { this.searchQuery = searchText; if (!this.searchQuery) { this.onClearSearch(); } else { if (this.dataUrl) { - const params: URLSearchParams = new URLSearchParams(); - params.set('searchQuery', this.searchQuery); - this.http.get(this.dataUrl, {search: params}) + const params = new HttpParams(); + params.append('searchQuery', this.searchQuery); + this.http.get(this.dataUrl, {params}) .map((response) => { - this.data = response.json(); + this.data = JSON.parse(JSON.stringify(response)); this.handleLocalData(); this.autoCompleteResults = this.complexData; }).subscribe(); @@ -112,3 +106,8 @@ export class SearchWithAutoCompleteComponent implements OnInit { } } } + +export interface IDataSchema { + key: string; + value: string; +} diff --git a/src/angular/autocomplete/autocomplete.module.ts b/src/angular/autocomplete/autocomplete.module.ts index 1bead47..f105669 100644 --- a/src/angular/autocomplete/autocomplete.module.ts +++ b/src/angular/autocomplete/autocomplete.module.ts @@ -1,23 +1,26 @@ import { NgModule } from "@angular/core"; -import { SearchWithAutoCompleteComponent } from "./autocomplete.component"; +import { AutoCompleteComponent } from "./autocomplete.component"; import { CommonModule } from "@angular/common"; import { FilterBarModule } from "../filterbar/filter-bar.module"; import { AutocompletePipe } from "./autocomplete.pipe"; -import { HttpModule } from '@angular/http'; +import { BrowserModule } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @NgModule({ declarations: [ - SearchWithAutoCompleteComponent, + AutoCompleteComponent, AutocompletePipe ], imports: [ + BrowserModule, + BrowserAnimationsModule, FilterBarModule, - CommonModule, - HttpModule + CommonModule ], exports: [ - SearchWithAutoCompleteComponent - ], + AutoCompleteComponent, + AutocompletePipe + ] }) export class AutoCompleteModule { } diff --git a/src/angular/buttons/button-file-opener.component.html.ts b/src/angular/buttons/button-file-opener.component.html.ts new file mode 100644 index 0000000..dd24be3 --- /dev/null +++ b/src/angular/buttons/button-file-opener.component.html.ts @@ -0,0 +1,18 @@ +export const template = ` +
+ {{ text }} + +
+`; + +// base-sixty-four-input diff --git a/src/angular/buttons/button-file-opener.component.ts b/src/angular/buttons/button-file-opener.component.ts new file mode 100644 index 0000000..399eb9a --- /dev/null +++ b/src/angular/buttons/button-file-opener.component.ts @@ -0,0 +1,61 @@ +import { Component, Input, Output, EventEmitter, HostBinding, ViewChild, AfterViewInit } from '@angular/core'; +import { ButtonComponent } from './button.component'; +import { template } from "./button-file-opener.component.html"; + +export class FileObject { + filesize: string; + filetype: string; + filename: string; + base64: string; +} + +@Component({ + selector: "sdc-button-file-opener", + template: template, + styles: [` + input[type=file] { + display: none; + } + `] +}) +export class ButtonFileOpenerComponent extends ButtonComponent implements AfterViewInit { + + @Input() public extensions: string; + @Output() public fileUpload: EventEmitter; + @HostBinding('class.sdc-button__wrapper') true; + + public allowedExtensions: string; + private fileObject: FileObject; + + constructor() { + super(); + this.fileUpload = new EventEmitter(); + this.fileObject = new FileObject(); + } + + ngAfterViewInit() : void { + this.allowedExtensions = this.extensions && this.extensions.split(',').map(x => '.' + x).join(','); + } + + public onFileSelectaa(event): void { + let file = event.srcElement.files[0]; + debugger + this.fileUpload.emit({file: file}); + } + + public onFileSelect(e): void { + var file = e.dataTransfer ? e.dataTransfer.files[0] : e.target.files[0]; + var reader = new FileReader(); + this.fileObject.filesize = file.size; + this.fileObject.filetype = file.type; + this.fileObject.filename = file.name; + reader.onload = this._handleReaderLoaded.bind(this); + reader.readAsDataURL(file); + } + private _handleReaderLoaded(e) { + let base64 = e.target.result; + this.fileObject.base64 = base64.split('base64,')[1]; + this.fileUpload.emit(this.fileObject); + } + +} diff --git a/src/angular/buttons/button.component.html.ts b/src/angular/buttons/button.component.html.ts index f903fd1..33a630a 100644 --- a/src/angular/buttons/button.component.html.ts +++ b/src/angular/buttons/button.component.html.ts @@ -1,11 +1,11 @@ -export default ` +export const template = `