diff --git a/index.html b/index.html index 0525853be0..e2037fedbf 100644 --- a/index.html +++ b/index.html @@ -77,6 +77,7 @@ openmct.install(openmct.plugins.SummaryWidget()); openmct.install(openmct.plugins.Notebook()); openmct.install(openmct.plugins.FolderView()); + openmct.install(openmct.plugins.Tabs()); openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0}); openmct.time.timeSystem('utc'); openmct.start(); diff --git a/src/plugins/plugins.js b/src/plugins/plugins.js index 7efb3da0c2..a9e0c7ade3 100644 --- a/src/plugins/plugins.js +++ b/src/plugins/plugins.js @@ -37,6 +37,7 @@ define([ './notebook/plugin', './displayLayout/plugin', './folderView/plugin', + './tabs/plugin', '../../platform/features/fixed/plugin' ], function ( _, @@ -55,6 +56,7 @@ define([ Notebook, DisplayLayoutPlugin, FolderView, + Tabs, FixedView ) { var bundleMap = { @@ -167,6 +169,7 @@ define([ plugins.Notebook = Notebook; plugins.DisplayLayout = DisplayLayoutPlugin.default; plugins.FolderView = FolderView; + plugins.Tabs = Tabs; plugins.FixedView = FixedView; return plugins; diff --git a/src/plugins/tabs/components/tabs.vue b/src/plugins/tabs/components/tabs.vue new file mode 100644 index 0000000000..ecaf8d6140 --- /dev/null +++ b/src/plugins/tabs/components/tabs.vue @@ -0,0 +1,177 @@ + + + + + + Drag objects here to add them to this view. + + {{tab.model.name}} + + + + + + {{currentTab.model.name}} + + + + + + + + + + + diff --git a/src/plugins/tabs/plugin.js b/src/plugins/tabs/plugin.js new file mode 100644 index 0000000000..d9d5e5e316 --- /dev/null +++ b/src/plugins/tabs/plugin.js @@ -0,0 +1,42 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2018, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT is 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. + * + * Open MCT includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ + +define([ + './tabs' +], function ( + Tabs +) { + return function plugin() { + return function install(openmct) { + openmct.objectViews.addProvider(new Tabs(openmct)); + + openmct.types.addType('tabs', { + name: "Tabs View", + creatable: true, + cssClass: 'icon-tabs-view', + initialize(domainObject) { + domainObject.composition = []; + } + }); + }; + }; +}); diff --git a/src/plugins/tabs/tabs.js b/src/plugins/tabs/tabs.js new file mode 100644 index 0000000000..e896e7acd6 --- /dev/null +++ b/src/plugins/tabs/tabs.js @@ -0,0 +1,68 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2018, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT is 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. + * + * Open MCT includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ + +define([ + './components/tabs.vue', + 'vue' +], function ( + TabsComponent, + Vue +) { + function Tabs(openmct) { + return { + key: 'tabs', + name: 'Tabs', + cssClass: 'icon-list-view', + canView: function (domainObject) { + return domainObject.type === 'tabs'; + }, + view: function (domainObject) { + let component; + + return { + show: function (element) { + component = new Vue({ + components: { + TabsComponent: TabsComponent.default + }, + provide: { + openmct, + domainObject, + composition: openmct.composition.get(domainObject) + }, + el: element, + template: '' + }); + }, + destroy: function (element) { + component.$destroy(); + component = undefined; + } + }; + }, + priority: function () { + return 1; + } + }; + } + return Tabs; +}); diff --git a/src/styles-new/_constants-espresso.scss b/src/styles-new/_constants-espresso.scss index 406e1261da..99258d0c6a 100644 --- a/src/styles-new/_constants-espresso.scss +++ b/src/styles-new/_constants-espresso.scss @@ -104,10 +104,15 @@ $colorGridLines: rgba($editColor, 0.2); $colorIconAlias: #4af6f3; $colorIconAliasForKeyFilter: #aaa; +// Holders +$colorTabsHolderBg: rgba(black, 0.2); + // Buttons and Controls -$colorBtnBg: lighten($colorBodyBg, 10%); // ! -$colorBtnBgHov: lighten($colorBtnBg, 10%); // ! -$colorBtnFg: lighten($colorBodyFg, 10%); // ! +$colorBtnBg: lighten($colorBodyBg, 10%); +$colorBtnBgHov: lighten($colorBtnBg, 10%); +$colorBtnFg: lighten($colorBodyFg, 10%); +$colorBtnReverseFg: lighten($colorBtnFg, 10%); +$colorBtnReverseBg: lighten($colorBtnBg, 10%); $colorBtnFgHov: $colorBtnFg; $colorBtnMajorBg: $colorKey; $colorBtnMajorBgHov: $colorKeyHov; @@ -119,6 +124,10 @@ $colorBtnCautionFg: $colorBtnFg; $colorClickIcon: $colorKey; $colorClickIconBgHov: rgba($colorKey, 0.6); $colorClickIconFgHov: $colorKeyHov; +$colorDropHint: $colorKey; +$colorDropHintBg: darken($colorDropHint, 10%); +$colorDropHintBgHov: $colorDropHint; +$colorDropHintFg: lighten($colorDropHint, 40%); // Menus $colorMenuBg: lighten($colorBodyBg, 15%); diff --git a/src/styles-new/_constants-snow.scss b/src/styles-new/_constants-snow.scss index eff80e931a..5ff8c98849 100644 --- a/src/styles-new/_constants-snow.scss +++ b/src/styles-new/_constants-snow.scss @@ -104,10 +104,15 @@ $colorGridLines: rgba($editColor, 0.2); $colorIconAlias: #4af6f3; $colorIconAliasForKeyFilter: #aaa; +// Holders +$colorTabsHolderBg: rgba($colorBodyFg, 0.2); + // Buttons and Controls -$colorBtnBg: #aaaaaa; +$colorBtnBg: #aaa; $colorBtnBgHov: darken($colorBtnBg, 10%); $colorBtnFg: #fff; +$colorBtnReverseFg: $colorBodyBg; +$colorBtnReverseBg: $colorBodyFg; $colorBtnFgHov: $colorBtnFg; $colorBtnMajorBg: $colorKey; $colorBtnMajorBgHov: $colorKeyHov; @@ -119,6 +124,10 @@ $colorBtnCautionFg: $colorBtnFg; $colorClickIcon: $colorKey; $colorClickIconBgHov: rgba($colorKey, 0.2); $colorClickIconFgHov: $colorKeyHov; +$colorDropHint: $colorKey; +$colorDropHintBg: darken($colorDropHint, 10%); +$colorDropHintBgHov: $colorDropHint; +$colorDropHintFg: lighten($colorDropHint, 40%); // Menus $colorMenuBg: lighten($colorBodyBg, 10%); diff --git a/src/styles-new/_controls.scss b/src/styles-new/_controls.scss index cfc4e500b8..e918403935 100644 --- a/src/styles-new/_controls.scss +++ b/src/styles-new/_controls.scss @@ -32,13 +32,6 @@ button { } .c-button--menu { - $m: $interiorMargin; - - &:before, - > * { - margin-right: $m; - } - &:after { content: $glyph-icon-arrow-down; font-family: symbolsfont; @@ -46,6 +39,10 @@ button { } } +.c-compact-button { + @include cCompactButtons($bg: $colorBtnBg, $fg: $colorBtnFg, $bgHov: $colorBtnBgHov); +} + /********* Icon Buttons */ .c-click-icon { @include cClickIcon(); @@ -487,3 +484,48 @@ input[type=number]::-webkit-outer-spin-button { @include cControl(); > * + * { margin-left: $interiorMargin; } } + +/***************************************************** DRAG AND DROP */ +.c-drop-hint { + // Used in Tabs View, Flexible Grid Layouts + @include abs(); + background-color: $colorDropHintBg; + color: $colorDropHintFg; + border-radius: $basicCr; + border: 1px dashed $colorDropHintFg; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + transition: $transOut; + z-index: 50; + + opacity: 0; // Must use this (rather than display: none) to enable transition effects + pointer-events: none; + + &:before { + $h: 80%; + $mh: 50px; + background: $bg-icon-activity; // TODO: change to $bg-icon-plus + background-size: contain; + background-position: center center; + background-repeat: no-repeat; + content: ''; + display: block; + filter: $colorKeyFilterHov; + height: $h; width: $h; + max-height: $mh; max-width: $mh; + } + + .is-dragging & { + pointer-events: inherit; + transition: $transIn; + opacity: 0.8; + } + + .is-mouse-over & { + transition: $transIn; + background-color: $colorDropHintBgHov; + opacity: 0.9; + } +} diff --git a/src/styles-new/_mixins.scss b/src/styles-new/_mixins.scss index ff7097e31b..a3ab063023 100644 --- a/src/styles-new/_mixins.scss +++ b/src/styles-new/_mixins.scss @@ -172,7 +172,7 @@ unicode-bidi:bidi-override; } -/************************** CONTROLS, BUTTONS */ +/************************** CONTROLS, BUTTONS, INPUTS */ @mixin hover { body.desktop & { &:hover { @@ -236,6 +236,15 @@ box-shadow: $shdw; } +@mixin buttonBehavior() { + // Assign transition timings + transition: $transOut; + + @include hover() { + transition: $transIn; + } +} + @mixin cControl() { $fs: 1em; @include userSelectNone(); @@ -266,11 +275,17 @@ @mixin cButton() { @include cControl(); @include themedButton(); + //@include buttonBehavior(); border-radius: $controlCr; color: $colorBtnFg; cursor: pointer; padding: $interiorMargin floor($interiorMargin * 1.25); + &:after, + > * { + margin-left: $interiorMarginSm; + } + @include hover() { background: $colorBtnBgHov; color: $colorBtnFgHov; @@ -347,6 +362,50 @@ } } +@mixin cCompactButtons($bg, $fg, $bgHov) { + // Used in Tab view + // To be used in indicators popups? + + $m: 1px; + $btnM: $m; + + &-holder { + background: $colorTabsHolderBg; + border-radius: $controlCr; + padding: $m ($m - $btnM) ($m - $btnM) $m; + display: flex; + flex-flow: row wrap; + justify-content: stretch; + + > * { + margin: 0 $btnM $btnM 0; + } + } + + background: $colorBtnBg; + color: $colorBtnFg; + flex: 1 1 auto; + padding: $interiorMargin; + + &:before { + opacity: 0.5; + } + + > * { + margin-left: $interiorMarginSm; + } + + @include hover() { + background: $bgHov; + } + + &.is-current { + background: $colorBtnReverseBg; + color: $colorBtnReverseFg; + pointer-events: none; + } +} + @mixin wrappedInput() { // An input that is wrapped. Optionally includes a __label or icon element. // Based on .c-search. diff --git a/src/styles-new/notebook.scss b/src/styles-new/notebook.scss index 40a98e1699..ec3f1748d5 100644 --- a/src/styles-new/notebook.scss +++ b/src/styles-new/notebook.scss @@ -64,6 +64,7 @@ } &__drag-area { + // TODO: recast this element to use c-drop-hint element background: rgba($colorKey, 0.1); border: 1px dashed rgba($colorKey, 0.7); border-radius: $controlCr;