From 3fd4e2942918c0008ed9735af7052c42d95c7273 Mon Sep 17 00:00:00 2001 From: Juan Date: Tue, 13 Mar 2018 12:07:28 +0100 Subject: [PATCH] vnTextarea style fix, new component vnMenu wich extends vnPopover --- .../components/drop-down/drop-down.spec.js | 2 ++ client/core/src/components/index.js | 5 ++-- client/core/src/components/menu/menu.js | 24 +++++++++++++++++++ client/core/src/components/popover/popover.js | 4 ++++ client/core/src/components/popover/style.scss | 2 +- .../core/src/components/textarea/style.scss | 6 +++++ .../core/src/components/textarea/textarea.js | 1 + .../src/components/main-menu/main-menu.html | 12 +++++----- .../salix/src/components/main-menu/style.scss | 4 ++-- e2e/helpers/extensions.js | 2 +- .../application/config/datasources.json | 2 +- .../print/application/config/datasources.json | 2 +- 12 files changed, 52 insertions(+), 14 deletions(-) create mode 100755 client/core/src/components/menu/menu.js create mode 100644 client/core/src/components/textarea/style.scss diff --git a/client/core/src/components/drop-down/drop-down.spec.js b/client/core/src/components/drop-down/drop-down.spec.js index f0bd93853..0b46f9ade 100644 --- a/client/core/src/components/drop-down/drop-down.spec.js +++ b/client/core/src/components/drop-down/drop-down.spec.js @@ -30,6 +30,8 @@ describe('Component vnDropDown', () => { let popoverTemplate = require('../popover/popover.html'); let $popover = angular.element(`
${popoverTemplate}
`); $scope.popover = $componentController('vnPopover', {$element: $popover, $scope, $timeout, $transitions}); + $scope.popover.$postLink(); + $scope.model = $componentController('vnModel', {$httpBackend, $q, $filter}); controller = $componentController('vnDropDown', {$element, $scope, $transclude: null, $timeout, $httpBackend, $translate: null}); controller.$postLink(); diff --git a/client/core/src/components/index.js b/client/core/src/components/index.js index 9077ada71..774971572 100644 --- a/client/core/src/components/index.js +++ b/client/core/src/components/index.js @@ -2,8 +2,6 @@ import './textfield/textfield'; import './watcher/watcher'; import './paging/paging'; import './icon/icon'; -import './autocomplete/autocomplete'; -import './popover/popover'; import './dialog/dialog'; import './confirm/confirm'; import './title/title'; @@ -12,7 +10,10 @@ import './spinner/spinner'; import './snackbar/snackbar'; import './tooltip/tooltip'; import './icon-menu/icon-menu'; +import './popover/popover'; +import './autocomplete/autocomplete'; import './drop-down/drop-down'; +import './menu/menu'; import './column-header/column-header'; import './grid-header/grid-header'; import './multi-check/multi-check'; diff --git a/client/core/src/components/menu/menu.js b/client/core/src/components/menu/menu.js new file mode 100755 index 000000000..ce32502d9 --- /dev/null +++ b/client/core/src/components/menu/menu.js @@ -0,0 +1,24 @@ +import ngModule from '../../module'; +import Popover from '../popover/popover'; + +export default class Menu extends Popover { + $postLink() { + super.$postLink(); + this.element.addEventListener('click', + () => this.onClick()); + } + + onClick() { + this.hide(); + } +} + +ngModule.component('vnMenu', { + template: require('../popover/popover.html'), + controller: Menu, + transclude: true, + bindings: { + onOpen: '&?', + onClose: '&?' + } +}); diff --git a/client/core/src/components/popover/popover.js b/client/core/src/components/popover/popover.js index 45a25918f..253e00e95 100644 --- a/client/core/src/components/popover/popover.js +++ b/client/core/src/components/popover/popover.js @@ -11,6 +11,10 @@ export default class Popover extends Component { this.$timeout = $timeout; this.$transitions = $transitions; this._shown = false; + } + + $postLink() { + this.$element.addClass('vn-popover'); this.docKeyDownHandler = e => this.onDocKeyDown(e); this.docFocusInHandler = e => this.onDocFocusIn(e); diff --git a/client/core/src/components/popover/style.scss b/client/core/src/components/popover/style.scss index f8323fb5e..458a47df9 100644 --- a/client/core/src/components/popover/style.scss +++ b/client/core/src/components/popover/style.scss @@ -1,4 +1,4 @@ -vn-popover { +.vn-popover { display: none; z-index: 10; position: fixed; diff --git a/client/core/src/components/textarea/style.scss b/client/core/src/components/textarea/style.scss new file mode 100644 index 000000000..91b29b3cf --- /dev/null +++ b/client/core/src/components/textarea/style.scss @@ -0,0 +1,6 @@ +vn-textarea { + & > .mdl-textfield { + width: initial; + display: block; + } +} \ No newline at end of file diff --git a/client/core/src/components/textarea/textarea.js b/client/core/src/components/textarea/textarea.js index 6bacdfc9f..122259ff3 100644 --- a/client/core/src/components/textarea/textarea.js +++ b/client/core/src/components/textarea/textarea.js @@ -1,5 +1,6 @@ import ngModule from '../../module'; import template from './textarea.html'; +import './style.scss'; directive.$inject = ['vnTemplate']; export function directive(vnTemplate) { diff --git a/client/salix/src/components/main-menu/main-menu.html b/client/salix/src/components/main-menu/main-menu.html index 72a4bdc06..33703f371 100644 --- a/client/salix/src/components/main-menu/main-menu.html +++ b/client/salix/src/components/main-menu/main-menu.html @@ -9,22 +9,22 @@ vn-popover="apps-menu" translate-attr="{title: 'Applications'}"> - -