diff --git a/docs/docassets/images/adf-buttons-menu-desktop.png b/docs/docassets/images/adf-buttons-menu-desktop.png
new file mode 100644
index 0000000000..9e6c42c611
Binary files /dev/null and b/docs/docassets/images/adf-buttons-menu-desktop.png differ
diff --git a/docs/docassets/images/adf-buttons-menu-mobile.png b/docs/docassets/images/adf-buttons-menu-mobile.png
new file mode 100644
index 0000000000..b1cffe225d
Binary files /dev/null and b/docs/docassets/images/adf-buttons-menu-mobile.png differ
diff --git a/docs/insights/buttons-menu.component.md b/docs/insights/buttons-menu.component.md
new file mode 100644
index 0000000000..567532148d
--- /dev/null
+++ b/docs/insights/buttons-menu.component.md
@@ -0,0 +1,90 @@
+---
+Added: v2.4.0
+Status: Active
+---
+# Buttons Menu Component
+
+Displays buttons on a responsive menu.
+
+## Basic Usage
+
+This component shows buttons on a responsive menu that changes depending on the device's screen.
+
+```html
+
+
+```
+You will need to declare all the buttons that you want to have inside your menu in the parent component.
+
+```ts
+buttons: MenuButton[] = [];
+
+ setButtons() {
+ this.buttons = [
+ new MenuButton({
+ label: 'Settings',
+ icon: 'settings',
+ handler: this.settings.bind(this)
+ }),
+ new MenuButton({
+ label: 'Delete',
+ icon: 'delete',
+ handler: this.deleteItem.bind(this, this.reportId),
+ id: 'delete-button'
+ }),
+ new MenuButton({
+ label: 'Export',
+ icon: 'file_download',
+ handler: this.exportItem.bind(this),
+ id: 'export-button',
+ isVisible: this.isItemValid.bind(this)
+ }),
+ new MenuButton({
+ label: 'Save',
+ icon: 'save',
+ handler: this.saveItem.bind(this),
+ id: 'save-button',
+ isVisible: this.isItemValid.bind(this)
+ })
+ ];
+```
+
+## Properties
+
+####Buttons Menu Component
+
+| Name | Type | Description |
+| --- | --- | -- |
+| buttons | `MenuButton []` | The array that contains all the buttons for the menu |
+
+####Button Model
+
+| Name | Type | Description |
+| --- | --- | -- |
+| label | `string` | Label to display for the button. |
+| icon | `string` | Icon to display for the button. |
+| handler | `function` | Callback for the event handler once the button is clicked. |
+| styles | `string` | Classes to apply to the button. |
+| id | `string` | Id of the button. |
+| isVisible | `function` | Variable to define if button is visible or hidden. This function must return a boolean parameter. For instance, if it returns true the button will be visible. If it returns false the button will be hiden. |
+
+
+## Details
+
+This component uses [Angular Material](https://material.angular.io/) to style the menu.
+
+Desktop view of the menu
+
+
+Mobile view of the menu
+
+
+Menu Button Model
+
+## See also
+
+- [Menu Button Model](./menu-button.model.md)
+
+
+
diff --git a/lib/core/buttons-menu/buttons-menu.component.html b/lib/core/buttons-menu/buttons-menu.component.html
new file mode 100644
index 0000000000..ce3030d75b
--- /dev/null
+++ b/lib/core/buttons-menu/buttons-menu.component.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/core/buttons-menu/buttons-menu.component.spec.ts b/lib/core/buttons-menu/buttons-menu.component.spec.ts
new file mode 100644
index 0000000000..3957c999f6
--- /dev/null
+++ b/lib/core/buttons-menu/buttons-menu.component.spec.ts
@@ -0,0 +1,94 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * 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.
+ */
+
+import { TestBed, async } from '@angular/core/testing';
+import { ButtonsMenuComponent } from './buttons-menu.component';
+import { MenuButton } from './menu-button.model';
+import { MaterialModule } from '../material.module';
+import { CoreTestingModule } from '../testing/core.testing.module';
+
+/*tslint:disable:ban*/
+
+fdescribe('ButtonsMenuComponent', () => {
+
+ let fixture;
+ let buttonsMenuComponent: ButtonsMenuComponent;
+ let element: HTMLElement;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ MaterialModule,
+ CoreTestingModule
+ ]
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ButtonsMenuComponent);
+ element = fixture.nativeElement;
+ buttonsMenuComponent = fixture.debugElement.componentInstance;
+ });
+
+ afterEach(() => {
+ fixture.destroy();
+ TestBed.resetTestingModule();
+ });
+
+ it('should hide buttons menu div if buttons input is empty', async(() => {
+ buttonsMenuComponent.buttons = [];
+ fixture.detectChanges();
+ fixture.whenStable().then(() => {
+ const buttonsMenuElement = element.querySelector('#adf-buttons-menu');
+ expect(buttonsMenuElement).toBeNull();
+ });
+ }));
+
+ it('should render buttons menu when there is at least one button declared in the buttons array', async(() => {
+ const button = new MenuButton({
+ label: 'button',
+ icon: 'button',
+ id: 'clickMe'
+ });
+ buttonsMenuComponent.buttons = [button];
+ fixture.detectChanges();
+ fixture.whenStable().then(() => {
+ const buttonsMenuElement = element.querySelector('#adf-buttons-menu');
+ expect(buttonsMenuElement).not.toBeNull();
+ expect(buttonsMenuElement).toBeDefined();
+ });
+ }));
+
+ it('should call the handler function when button is clicked', async(() => {
+ const button = new MenuButton({
+ label: 'button',
+ icon: 'button',
+ id: 'clickMe'
+ });
+ button.handler = jasmine.createSpy('handler');
+ buttonsMenuComponent.buttons = [button];
+ fixture.detectChanges();
+ fixture.whenStable().then(() => {
+ const buttonsMenuElement: HTMLButtonElement = element.querySelector('#clickMe');
+ expect(buttonsMenuElement).not.toBeNull();
+ expect(buttonsMenuElement).toBeDefined();
+ buttonsMenuElement.click();
+ fixture.detectChanges();
+ expect(button.handler).toHaveBeenCalled();
+ });
+ }));
+});
diff --git a/lib/core/buttons-menu/buttons-menu.component.ts b/lib/core/buttons-menu/buttons-menu.component.ts
new file mode 100644
index 0000000000..69b188351f
--- /dev/null
+++ b/lib/core/buttons-menu/buttons-menu.component.ts
@@ -0,0 +1,38 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * 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.
+ */
+
+/* tslint:disable:component-selector no-access-missing-member no-input-rename */
+
+import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
+import { MenuButton } from './menu-button.model';
+
+@Component({
+ selector: 'adf-buttons-action-menu',
+ templateUrl: './buttons-menu.component.html'
+})
+
+export class ButtonsMenuComponent implements OnChanges {
+ @Input() buttons: MenuButton[];
+
+ ngOnChanges(changes: SimpleChanges) {
+ this.buttons = changes['buttons'].currentValue;
+ }
+
+ hasButtons() {
+ return this.buttons.length > 0 ? true : false;
+ }
+}
diff --git a/lib/core/buttons-menu/buttons-menu.module.ts b/lib/core/buttons-menu/buttons-menu.module.ts
new file mode 100644
index 0000000000..dc350c7a79
--- /dev/null
+++ b/lib/core/buttons-menu/buttons-menu.module.ts
@@ -0,0 +1,39 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * 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.
+ */
+
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+import { TranslateModule } from '@ngx-translate/core';
+import { MaterialModule } from '../material.module';
+import { ButtonsMenuComponent } from './buttons-menu.component';
+import { FlexLayoutModule } from '@angular/flex-layout';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ MaterialModule,
+ TranslateModule,
+ FlexLayoutModule
+ ],
+ declarations: [
+ ButtonsMenuComponent
+ ],
+ exports: [
+ ButtonsMenuComponent
+ ]
+})
+export class ButtonsMenuModule {}
diff --git a/lib/core/buttons-menu/index.ts b/lib/core/buttons-menu/index.ts
new file mode 100644
index 0000000000..4c6ac1d58f
--- /dev/null
+++ b/lib/core/buttons-menu/index.ts
@@ -0,0 +1,18 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * 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.
+ */
+
+export * from './public-api';
diff --git a/lib/core/buttons-menu/menu-button.model.ts b/lib/core/buttons-menu/menu-button.model.ts
new file mode 100644
index 0000000000..be28776fd8
--- /dev/null
+++ b/lib/core/buttons-menu/menu-button.model.ts
@@ -0,0 +1,37 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * 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.
+ */
+
+export type VisibiltyFunction = (obj?: any) => boolean;
+const defaultValidation = () => true;
+
+export class MenuButton {
+ label: string;
+ icon: string;
+ handler: any;
+ styles: string;
+ id: string;
+ isVisible: VisibiltyFunction;
+
+ constructor(obj?: any) {
+ this.label = obj.label;
+ this.icon = obj.icon;
+ this.handler = obj.handler;
+ this.styles = obj.styles || null;
+ this.id = obj.id || null;
+ this.isVisible = obj.isVisible ? obj.isVisible : defaultValidation;
+ }
+}
diff --git a/lib/core/buttons-menu/public-api.ts b/lib/core/buttons-menu/public-api.ts
new file mode 100644
index 0000000000..e50687749e
--- /dev/null
+++ b/lib/core/buttons-menu/public-api.ts
@@ -0,0 +1,20 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * 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.
+ */
+
+export * from './buttons-menu.component';
+export * from './menu-button.model';
+export * from './buttons-menu.module';
diff --git a/lib/core/core.module.ts b/lib/core/core.module.ts
index 25fb75d15d..ed078e7d5c 100644
--- a/lib/core/core.module.ts
+++ b/lib/core/core.module.ts
@@ -40,6 +40,7 @@ import { FormModule } from './form/form.module';
import { SidenavLayoutModule } from './sidenav-layout/sidenav-layout.module';
import { SideBarActionModule } from './sidebar/sidebar-action.module';
import { CommentsModule } from './comments/comments.module';
+import { ButtonsMenuModule } from './buttons-menu/buttons-menu.module';
import { DirectiveModule } from './directives/directive.module';
import { PipeModule } from './pipes/pipe.module';
@@ -151,6 +152,7 @@ export function providers() {
InfoDrawerModule,
DataColumnModule,
DataTableModule,
+ ButtonsMenuModule,
TranslateModule.forChild({
loader: {
provide: TranslateLoader,
@@ -185,7 +187,8 @@ export function providers() {
InfoDrawerModule,
DataColumnModule,
DataTableModule,
- TranslateModule
+ TranslateModule,
+ ButtonsMenuModule
]
})
export class CoreModuleLazy {
@@ -218,6 +221,7 @@ export class CoreModuleLazy {
InfoDrawerModule,
DataColumnModule,
DataTableModule,
+ ButtonsMenuModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
@@ -252,7 +256,8 @@ export class CoreModuleLazy {
InfoDrawerModule,
DataColumnModule,
DataTableModule,
- TranslateModule
+ TranslateModule,
+ ButtonsMenuModule
],
providers: [
...providers(),
diff --git a/lib/core/index.ts b/lib/core/index.ts
index 4e29a0a168..f48f9ee3b9 100644
--- a/lib/core/index.ts
+++ b/lib/core/index.ts
@@ -33,6 +33,7 @@ export * from './app-config/index';
export * from './form/index';
export * from './sidenav-layout/index';
export * from './comments/index';
+export * from './buttons-menu/index';
export * from './pipes/index';
export * from './services/index';
diff --git a/lib/core/styles/prebuilt/_all-theme.scss b/lib/core/styles/prebuilt/_all-theme.scss
index 43320b0716..2c556a5cc0 100644
--- a/lib/core/styles/prebuilt/_all-theme.scss
+++ b/lib/core/styles/prebuilt/_all-theme.scss
@@ -1,9 +1,11 @@
@import '../../../content-services/styles/index';
@import '../../../process-services/styles/index';
@import '../../../core/styles/index';
+@import '../../../insights/styles/index';
@mixin alfresco-material-theme($theme) {
@include adf-content-services-theme($theme);
@include adf-process-services-theme($theme);
@include adf-core-theme($theme);
+ @include adf-insights-theme($theme);
}
diff --git a/lib/insights/analytics-process/analytics-process.module.ts b/lib/insights/analytics-process/analytics-process.module.ts
index 5743dc267c..8d5aafa947 100644
--- a/lib/insights/analytics-process/analytics-process.module.ts
+++ b/lib/insights/analytics-process/analytics-process.module.ts
@@ -24,7 +24,7 @@ import { MaterialModule } from '../material.module';
import { ChartsModule } from 'ng2-charts';
-import { ToolbarModule } from '@alfresco/adf-core';
+import { ToolbarModule, ButtonsMenuModule } from '@alfresco/adf-core';
import { AnalyticsGeneratorComponent } from './components/analytics-generator.component';
import { AnalyticsReportHeatMapComponent } from './components/analytics-report-heat-map.component';
import { AnalyticsReportListComponent } from './components/analytics-report-list.component';
@@ -37,7 +37,10 @@ import { DropdownWidgetAanalyticsComponent } from './components/widgets/dropdown
import { DurationWidgetComponent } from './components/widgets/duration/duration.widget';
import { NumberWidgetAanlyticsComponent } from './components/widgets/number/number.widget';
+
import { AnalyticsService } from './services/analytics.service';
+import { FlexLayoutModule } from '@angular/flex-layout';
+
@NgModule({
imports: [
@@ -48,7 +51,9 @@ import { AnalyticsService } from './services/analytics.service';
DiagramsModule,
MaterialModule,
TranslateModule,
- ToolbarModule
+ ToolbarModule,
+ FlexLayoutModule,
+ ButtonsMenuModule
],
declarations: [
AnalyticsComponent,
diff --git a/lib/insights/analytics-process/components/analytics-report-list.component.scss b/lib/insights/analytics-process/components/analytics-report-list.component.scss
index 64ba5b08b8..a8ac7f72f1 100644
--- a/lib/insights/analytics-process/components/analytics-report-list.component.scss
+++ b/lib/insights/analytics-process/components/analytics-report-list.component.scss
@@ -1,5 +1,8 @@
@mixin adf-analytics-report-list-theme($theme) {
$primary: map-get($theme, primary);
+ $accent: map-get($theme, accent );
+ $background: map-get($theme, background);
+ $foreground: map-get($theme, foreground);
.adf-analytics-report-list {
@@ -43,7 +46,7 @@
position: relative;
min-height: 200px;
overflow: hidden;
- background-color: #269abc;
+ background-color: mat-color($background, background);
display: flex;
flex-direction: column;
cursor: pointer;
@@ -56,7 +59,7 @@
&-icon {
font-size: 70px;
- color: #168aac;
+ color: mat-color($accent);
width: 1em;
height: 1em;
display: inline-block;
@@ -79,16 +82,16 @@
}
&-actions {
- border-top: 1px solid rgba(0,0,0,.1);
+ border-top: 1px solid mat-color($foreground, divider);
padding: 8px;
box-sizing: border-box;
height: 40px;
&-icon {
- color: #e9f1f3;
+ color: mat-color($primary, 50);
&:hover {
- color: #b7dfea;
+ color: mat-color($primary, 100);
}
}
}
diff --git a/lib/insights/analytics-process/components/analytics-report-parameters.component.html b/lib/insights/analytics-process/components/analytics-report-parameters.component.html
index 9560b5dad9..b3182455ad 100644
--- a/lib/insights/analytics-process/components/analytics-report-parameters.component.html
+++ b/lib/insights/analytics-process/components/analytics-report-parameters.component.html
@@ -24,27 +24,10 @@
mode_edit