aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/components/ui/menu
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-12-10 18:55:03 +0200
committerTal Gitelman <tg851x@intl.att.com>2017-12-10 19:33:38 +0200
commit51d50f0ef642e0f996a1c8b8d2ef4838bdfec892 (patch)
tree3ac236a864d74d19b0f5c9020891a7a7e5c31b44 /catalog-ui/src/app/ng2/components/ui/menu
parentb5cc2e0695f195716d6ccdc65e73807a6632ec70 (diff)
Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507 Issue-ID: SDC-714 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/components/ui/menu')
-rw-r--r--catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.html3
-rw-r--r--catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.less13
-rw-r--r--catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.ts44
-rw-r--r--catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.html9
-rw-r--r--catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.less13
-rw-r--r--catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.ts70
-rw-r--r--catalog-ui/src/app/ng2/components/ui/menu/menu-list.module.ts27
7 files changed, 179 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.html b/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.html
new file mode 100644
index 0000000000..54640c9414
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.html
@@ -0,0 +1,3 @@
+<div class="w-sdc-menu-item" [ngClass]="styleClass" (click)="performAction()">
+ <ng-content></ng-content>
+</div>
diff --git a/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.less b/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.less
new file mode 100644
index 0000000000..ceb4409144
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.less
@@ -0,0 +1,13 @@
+@import "../../../../../assets/styles/variables";
+
+.w-sdc-menu-item {
+ font-size: 14px;
+ line-height: 14px;
+ color: @main_color_m;
+ padding: 3px 6px;
+
+ &:hover {
+ cursor: pointer;
+ background-color: @main_color_c;
+ }
+} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.ts b/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.ts
new file mode 100644
index 0000000000..8b2006634e
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/menu/menu-item.component.ts
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+import { Component, Input, Output, EventEmitter } from '@angular/core';
+
+@Component({
+ selector: 'menu-item',
+ templateUrl: './menu-item.component.html',
+ styleUrls:['./menu-item.component.less']
+})
+export class MenuItemComponent {
+ @Input() action:Function;
+ @Input() styleClass:any;
+
+ public parentMenu:any;
+
+ constructor() {
+ }
+
+ performAction() {
+ this.action();
+
+ if (this.parentMenu && typeof(this.parentMenu.close) === 'function') {
+ this.parentMenu.close();
+ }
+ }
+}
diff --git a/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.html b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.html
new file mode 100644
index 0000000000..98c4d26fdd
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.html
@@ -0,0 +1,9 @@
+<div
+ class="w-sdc-menu-list"
+ *ngIf="isOpen"
+ [ngClass]="styleClass"
+ [ngStyle]="{'left': position?.x || 0, 'top': position?.y || 0}">
+
+ <ng-content></ng-content>
+
+</div>
diff --git a/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.less b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.less
new file mode 100644
index 0000000000..1b45ea775c
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.less
@@ -0,0 +1,13 @@
+.w-sdc-menu-list {
+ position: fixed;
+ z-index: 100;
+
+ border-style: solid;
+ border-width: 1px;
+ border-color: #d8d8d8;
+ box-sizing: border-box;
+ background-color: #ffffff;
+ box-shadow: 0px 2px 2px 0px rgba(24, 24, 25, 0.1);
+ width: 91px;
+ padding: 6px 0;
+}
diff --git a/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.ts b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.ts
new file mode 100644
index 0000000000..290c8d06af
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.component.ts
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+import { Component, Input, ContentChildren, SimpleChanges, QueryList } from '@angular/core';
+import { MenuItemComponent } from "./menu-item.component";
+import { Point } from "app/models";
+
+@Component({
+ selector: 'menu-list',
+ templateUrl: './menu-list.component.html',
+ styleUrls:['./menu-list.component.less']
+})
+export class MenuListComponent {
+ @Input('open') inputOpen:boolean = false;
+ @Input('position') inputPosition:Point = new Point();
+ @Input() styleClass:any;
+
+ @ContentChildren(MenuItemComponent) menuItems:QueryList<MenuItemComponent>;
+
+ private position:Point;
+ private isOpen:boolean = false;
+
+ constructor() {
+ }
+
+ ngOnChanges(changes:SimpleChanges) {
+ if (changes.inputOpen) {
+ (changes.inputOpen.currentValue) ? this.open() : this.close();
+ }
+ if (changes.inputPosition) {
+ this.changePosition(changes.inputPosition.currentValue);
+ }
+ }
+
+ ngAfterContentInit() {
+ this.menuItems.forEach((c) => c.parentMenu = this);
+ this.menuItems.changes.subscribe((list) => {
+ list.forEach((c) => c.parentMenu = this);
+ });
+ }
+
+ open(): void {
+ this.isOpen = true;
+ }
+
+ close(): void {
+ this.isOpen = false;
+ }
+
+ changePosition(position:Point) {
+ this.position = position;
+ }
+}
diff --git a/catalog-ui/src/app/ng2/components/ui/menu/menu-list.module.ts b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.module.ts
new file mode 100644
index 0000000000..fdbbf59f48
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/menu/menu-list.module.ts
@@ -0,0 +1,27 @@
+import { NgModule } from "@angular/core";
+import { CommonModule } from '@angular/common';
+import { MenuListComponent } from "./menu-list.component";
+import { MenuItemComponent } from "./menu-item.component";
+
+export {
+ MenuListComponent,
+ MenuItemComponent
+};
+
+@NgModule({
+ declarations: [
+ MenuListComponent,
+ MenuItemComponent
+ ],
+ imports: [CommonModule],
+ exports: [
+ MenuListComponent,
+ MenuItemComponent
+ ],
+ entryComponents: [ //need to add anything that will be dynamically created
+ MenuListComponent,
+ MenuItemComponent
+ ]
+})
+export class MenuListModule {
+}