Compare commits

...

2 Commits

Author SHA1 Message Date
32aa412d1e Font Styling (#3252)
* working proto for font size

* wip

* Font styling

 - Base classes for font-size and font;
 - WIP!

* working data attribute for fontsize

* Font styling

 - Add `js-style-receiver` to markup, refine style targeting JS for
 better application of styles;
 - Refinements to font and size CSS;
 - WIP!

* Font styling

 - Redo CSS to use `data-*` attributes;
 - New `u-style-receiver` class for use as font-size and font-family CSS
 selector target;
 - New `js-style-receiver` class for use as JS target by ObjectView.vue;
 - New classes added to markup in all Open MCT views;
 - Changed font-size values from 'is-font-size--*' to just the number;
 - Some refinement to individual views to account for font-sizing
 capability;
 - Removed automatic font-size 13px being set by SubobjectView.vue;
 - WIP!

* working mixed styles

* Font styling

 - Added `u-style-receiver` to TelemetryView.vue;
 - Added `icon-font-size` to Font Size dropdown button;
 - TODO: better font-size icon;

* working font-family

* Font styling

 - Art for `icon-font-size` glyph updated;
 - Redefined glyph usage in some Layout toolbar buttons;
 - Updated font-size and font dropdown menus options text;

* Font styling

 - Refined font-size and font dropdown values;
 - Fixed toolbar-select-menu.vue to remove 'px' from non-specific option
  return;

* dont allow font styling on layouts that contain other layouts

* fix lint warning

Co-authored-by: charlesh88 <charlesh88@gmail.com>
2020-07-31 10:37:33 -07:00
cb7f431fdf Snapshot outdated objects fix (#3251)
* [Snapshots] Are holding on to outdated domainObjects when clicking on preview #3078

* #3250 :  [Preview] Preview window should not have any context menu actions

* cleanup: removed redundant code

Co-authored-by: Mandlik, Nikhil K. (ARC-TI)[KBR Wyle Services, LLC] <nikhil.k.mandlik@nasa.gov>
2020-07-29 16:34:32 -07:00
30 changed files with 426 additions and 95 deletions

View File

@ -19,7 +19,7 @@
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<div class="c-clock l-time-display" ng-controller="ClockController as clock">
<div class="c-clock l-time-display u-style-receiver js-style-receiver" ng-controller="ClockController as clock">
<div class="c-clock__timezone">
{{clock.zone()}}
</div>

View File

@ -19,7 +19,7 @@
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<div class="c-timer is-{{timer.timerState}}" ng-controller="TimerController as timer">
<div class="c-timer u-style-receiver js-style-receiver is-{{timer.timerState}}" ng-controller="TimerController as timer">
<div class="c-timer__controls">
<button ng-click="timer.clickStopButton()"
ng-hide="timer.timerState == 'stopped'"

View File

@ -21,7 +21,7 @@
*****************************************************************************/
<template>
<div class="c-lad-table-wrapper">
<div class="c-lad-table-wrapper u-style-receiver js-style-receiver">
<table class="c-table c-lad-table">
<thead>
<tr>

View File

@ -22,7 +22,7 @@
<template>
<component :is="urlDefined ? 'a' : 'span'"
class="c-condition-widget"
class="c-condition-widget u-style-receiver js-style-receiver"
:href="urlDefined ? internalDomainObject.url : null"
>
<div class="c-condition-widget__label">

View File

@ -124,7 +124,117 @@ define(['lodash'], function (_) {
'telemetry.plot.overlay-multi': [
VIEW_TYPES['telemetry.plot.stacked']
]
};
},
SMALL_FONT_SIZES = [
{
name: 'Default Size',
value: 'default'
},
{
name: '8px',
value: '8'
},
{
name: '9px',
value: '9'
},
{
name: '10px',
value: '10'
},
{
name: '11px',
value: '11'
},
{
name: '12px',
value: '12'
},
{
name: '13px',
value: '13'
},
{
name: '14px',
value: '14'
},
{
name: '16px',
value: '16'
},
{
name: '18px',
value: '18'
},
{
name: '20px',
value: '20'
},
{
name: '24px',
value: '24'
}
],
LARGE_FONT_SIZES = [
{
name: '28px',
value: '28'
},
{
name: '32px',
value: '32'
},
{
name: '36px',
value: '36'
},
{
name: '42px',
value: '42'
},
{
name: '48px',
value: '48'
},
{
name: '72px',
value: '72'
},
{
name: '96px',
value: '96'
},
{
name: '128px',
value: '128'
}
],
FONTS = [
{
name: 'Default',
value: 'default'
},
{
name: 'Bold',
value: 'default-bold'
},
{
name: 'Narrow',
value: 'narrow'
},
{
name: 'Narrow Bold',
value: 'narrow-bold'
},
{
name: 'Monospace',
value: 'monospace'
},
{
name: 'Monospace Bold',
value: 'monospace-bold'
}
]
function getUserInput(form) {
return openmct.$injector.get('dialogService').getUserInput(form, {});
@ -378,25 +488,136 @@ define(['lodash'], function (_) {
}
}
function getTextSizeMenu(selectedParent, selection) {
const TEXT_SIZE = [8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 30, 36, 48, 72, 96, 128];
return {
control: "select-menu",
domainObject: selectedParent,
applicableSelectedItems: selection.filter(selectionPath => {
let type = selectionPath[0].context.layoutItem.type;
return type === 'text-view' || type === 'telemetry-view';
}),
property: function (selectionPath) {
return getPath(selectionPath) + ".size";
},
title: "Set text size",
options: TEXT_SIZE.map(size => {
return {
value: size + "px"
};
})
};
function getAvailableFontSizeOptions(selection) {
let sizeOptions = 'big';
selection.forEach(selectable => {
if (selectable[0].context.item) {
if (selectable[0].context.item.type.includes('plot') ||
selectable[0].context.item.type.includes('table')) {
sizeOptions = 'small';
}
}
});
if (sizeOptions === 'small') {
return SMALL_FONT_SIZES;
} else {
return SMALL_FONT_SIZES.concat(LARGE_FONT_SIZES);
}
}
function getFontSizeMenu(selectedParent, selection) {
if (selection.length === 1) {
let primary = selection[0][0];
let type = primary.context.layoutItem.type;
if (type === 'subobject-view') {
let objectType = primary.context.item.type;
if (objectType === 'layout' ||
objectType === 'flexible-layout' ||
objectType === 'tabs') {
return;
}
}
return {
control: 'select-menu',
domainObject: selectedParent,
icon: "icon-font-size",
applicableSelectedItems: selection,
property: (selectionPath) => {
return getPath(selectionPath) + '.fontSize';
},
title: "Set font size",
options: getAvailableFontSizeOptions(selection)
};
} else {
return {
control: 'select-menu',
domainObject: selectedParent,
icon: "icon-font-size",
applicableSelectedItems: selection.filter(selectionPath => {
let type = selectionPath[0].context.layoutItem.type;
if (type === 'line-view' || type === 'box-view') {
return false;
} else if (type === 'subobject-view') {
let objectType = selectionPath[0].context.item.type;
if (objectType === 'layout' ||
objectType === 'flexible-layout' ||
objectType === 'tabs') {
return false;
}
}
return true;
}),
property: (selectionPath) => {
return getPath(selectionPath) + '.fontSize';
},
title: "Set font size",
options: getAvailableFontSizeOptions(selection)
}
}
}
function getFontMenu(selectedParent, selection) {
if (selection.length === 1) {
let primary = selection[0][0];
let type = primary.context.layoutItem.type;
if (type === 'subobject-view') {
let objectType = primary.context.item.type;
if (objectType === 'layout' ||
objectType === 'flexible-layout' ||
objectType === 'tabs') {
return;
}
}
return {
control: 'select-menu',
domainObject: selectedParent,
icon: "icon-font",
applicableSelectedItems: selection,
property: (selectionPath) => {
return getPath(selectionPath) + '.font';
},
title: "Set font style",
options: FONTS
}
} else {
return {
control: 'select-menu',
domainObject: selectedParent,
icon: "icon-font",
applicableSelectedItems: selection.filter(selectionPath => {
let type = selectionPath[0].context.layoutItem.type;
if (type === 'line-view' || type === 'box-view') {
return false;
} else if (type === 'subobject-view') {
let objectType = selectionPath[0].context.item.type;
if (objectType === 'layout' ||
objectType === 'flexible-layout' ||
objectType === 'tabs') {
return false;
}
}
return true;
}),
property: (selectionPath) => {
return getPath(selectionPath) + '.font';
},
title: "Set font style",
options: FONTS
}
}
}
function getTextButton(selectedParent, selection) {
@ -409,7 +630,7 @@ define(['lodash'], function (_) {
property: function (selectionPath) {
return getPath(selectionPath);
},
icon: "icon-font",
icon: "icon-pencil",
title: "Edit text properties",
dialog: DIALOG_FORM.text
};
@ -586,7 +807,8 @@ define(['lodash'], function (_) {
'display-mode': [],
'telemetry-value': [],
'style': [],
'text-style': [],
'font-size': [],
'font-family': [],
'position': [],
'duplicate': [],
'remove': []
@ -622,6 +844,16 @@ define(['lodash'], function (_) {
if (toolbar.viewSwitcher.length === 0) {
toolbar.viewSwitcher = [getViewSwitcherMenu(selectedParent, selectionPath, selectedObjects)];
}
if (toolbar['font-size'].length === 0) {
toolbar['font-size'] = [
getFontSizeMenu(selectedParent, selectedObjects)
];
}
if (toolbar['font-family'].length === 0) {
toolbar['font-family'] = [
getFontMenu(selectedParent, selectedObjects)
];
}
} else if (layoutItem.type === 'telemetry-view') {
if (toolbar['display-mode'].length === 0) {
toolbar['display-mode'] = [getDisplayModeMenu(selectedParent, selectedObjects)];
@ -629,9 +861,14 @@ define(['lodash'], function (_) {
if (toolbar['telemetry-value'].length === 0) {
toolbar['telemetry-value'] = [getTelemetryValueMenu(selectionPath, selectedObjects)];
}
if (toolbar['text-style'].length === 0) {
toolbar['text-style'] = [
getTextSizeMenu(selectedParent, selectedObjects)
if (toolbar['font-size'].length === 0) {
toolbar['font-size'] = [
getFontSizeMenu(selectedParent, selectedObjects)
];
}
if (toolbar['font-family'].length === 0) {
toolbar['font-family'] = [
getFontMenu(selectedParent, selectedObjects)
];
}
if (toolbar.position.length === 0) {
@ -650,9 +887,14 @@ define(['lodash'], function (_) {
toolbar.viewSwitcher = [getViewSwitcherMenu(selectedParent, selectionPath, selectedObjects)];
}
} else if (layoutItem.type === 'text-view') {
if (toolbar['text-style'].length === 0) {
toolbar['text-style'] = [
getTextSizeMenu(selectedParent, selectedObjects)
if (toolbar['font-size'].length === 0) {
toolbar['font-size'] = [
getFontSizeMenu(selectedParent, selectedObjects)
];
}
if (toolbar['font-family'].length === 0) {
toolbar['font-family'] = [
getFontMenu(selectedParent, selectedObjects)
];
}
if (toolbar.position.length === 0) {

View File

@ -29,7 +29,7 @@
@endMove="() => $emit('endMove')"
>
<div
class="c-box-view"
class="c-box-view u-style-receiver js-style-receiver"
:class="[styleClass]"
:style="style"
></div>

View File

@ -22,7 +22,7 @@
<template>
<div
class="l-layout"
class="l-layout u-style-receiver js-style-receiver"
:class="{
'is-multi-selected': selectedLayoutItems.length > 1,
'allow-editing': isEditing

View File

@ -81,6 +81,7 @@ export default {
style() {
let backgroundImage = 'url(' + this.item.url + ')';
let border = '1px solid ' + this.item.stroke;
if (this.itemStyle) {
if (this.itemStyle.imageUrl !== undefined) {
backgroundImage = 'url(' + this.itemStyle.imageUrl + ')';

View File

@ -35,6 +35,8 @@
:object-path="currentObjectPath"
:has-frame="item.hasFrame"
:show-edit-view="false"
:font-size="item.fontSize"
:font="item.font"
/>
</layout-frame>
</template>
@ -73,6 +75,8 @@ export default {
y: position[1],
identifier: domainObject.identifier,
hasFrame: hasFrameByDefault(domainObject.type),
fontSize: 'default',
font: 'default',
viewKey
};
},
@ -120,7 +124,6 @@ export default {
if (!this.context) {
return;
}
this.context.layoutItem = newItem;
}
},

View File

@ -30,12 +30,14 @@
>
<div
v-if="domainObject"
class="c-telemetry-view"
class="u-style-receiver c-telemetry-view"
:class="{
styleClass,
'is-missing': domainObject.status === 'missing'
}"
:style="styleObject"
:data-font-size="item.fontSize"
:data-font="item.font"
@contextmenu.prevent="showContextMenu"
>
<div class="is-missing__indicator"
@ -89,7 +91,8 @@ export default {
stroke: "",
fill: "",
color: "",
size: "13px"
fontSize: 'default',
font: 'default'
};
},
inject: ['openmct', 'objectPath'],
@ -136,10 +139,15 @@ export default {
return displayMode === 'all' || displayMode === 'value';
},
styleObject() {
return Object.assign({}, {
fontSize: this.item.size
}, this.itemStyle);
let size;
//for legacy size support
if (!this.item.fontSize) {
size = this.item.size
}
return Object.assign({}, {
size
}, this.itemStyle);
},
fieldName() {
return this.valueMetadata && this.valueMetadata.name;

View File

@ -29,7 +29,9 @@
@endMove="() => $emit('endMove')"
>
<div
class="c-text-view"
class="c-text-view u-style-receiver js-style-receiver"
:data-font-size="item.fontSize"
:data-font="item.font"
:class="[styleClass]"
:style="style"
>
@ -47,13 +49,14 @@ export default {
return {
fill: '',
stroke: '',
size: '13px',
color: '',
x: 1,
y: 1,
width: 10,
height: 5,
text: element.text
text: element.text,
fontSize: 'default',
font: 'default'
};
},
inject: ['openmct'],
@ -84,8 +87,14 @@ export default {
},
computed: {
style() {
let size;
//legacy size support
if (!this.item.fontSize) {
size = this.item.size;
}
return Object.assign({
fontSize: this.item.size
size
}, this.itemStyle);
}
},

View File

@ -29,7 +29,7 @@
>
</div>
<div class="c-imagery__control-bar">
<div class="c-imagery__timestamp">{{ getTime() }}</div>
<div class="c-imagery__timestamp u-style-receiver js-style-receiver">{{ getTime() }}</div>
<div class="h-local-controls flex-elem">
<button
class="c-button icon-pause pause-play"

View File

@ -248,7 +248,8 @@ export default {
previewEmbed() {
const self = this;
const previewAction = new PreviewAction(self.openmct);
previewAction.invoke(JSON.parse(self.embed.objectPath));
this.openmct.objects.get(self.embed.domainObject.identifier)
.then(domainObject => previewAction.invoke([domainObject]));
},
removeEmbed(success) {
if (!success) {

View File

@ -95,8 +95,7 @@ export const createNewEmbed = (snapshotMeta, snapshot = '') => {
id: 'embed-' + date,
name,
snapshot,
type,
objectPath: JSON.stringify(objectPath)
type
};
}

View File

@ -41,7 +41,7 @@
</button>
</div>
<div class="l-view-section">
<div class="l-view-section u-style-receiver js-style-receiver">
<div class="c-loading--overlay loading"
ng-show="!!pending"></div>
<mct-plot config="controller.config"

View File

@ -40,7 +40,7 @@
title="Toggle cursor guides">
</button>
</div>
<div class="l-view-section">
<div class="l-view-section u-style-receiver js-style-receiver">
<div class="c-loading--overlay loading"
ng-show="!!currentRequest.pending"></div>
<div class="gl-plot child-frame u-inspectable"

View File

@ -9,6 +9,9 @@
.c-telemetry-table {
// Table that displays telemetry in a scrolling body area
@include fontAndSize();
display: flex;
flex-flow: column nowrap;
justify-content: flex-start;

View File

@ -125,7 +125,7 @@
<!-- alternate controlbar end -->
<div
class="c-table c-telemetry-table c-table--filterable c-table--sortable has-control-bar"
class="c-table c-telemetry-table c-table--filterable c-table--sortable has-control-bar u-style-receiver js-style-receiver"
:class="{
'loading': loading,
'is-paused' : paused

View File

@ -102,6 +102,8 @@ $colorProgressBarHolder: rgba(black, 0.1);
$colorProgressBar: #0085ad;
$progressAnimW: 500px;
$progressBarMinH: 6px;
/************************** FONT STYLING */
$listFontSizes: 8,9,10,11,12,13,14,16,18,20,24,28,32,36,42,48,72,96,128;
/************************** GLYPH CHAR UNICODES */
$glyph-icon-alert-rect: '\e900';

View File

@ -96,6 +96,31 @@ body.desktop {
}
}
/******************************************************** FONTS */
@mixin fontAndSize() {
@each $size in $listFontSizes {
&[data-font-size="#{$size}"] {
font-size: #{$size}px;
}
}
&[data-font*="bold"] {
font-weight: bold;
}
&[data-font*="narrow"] {
font-family: 'Arial Narrow', sans-serif;
}
&[data-font*="monospace"] {
font-family: 'Andale Mono', sans-serif;
}
}
.u-style-receiver {
@include fontAndSize();
}
/******************************************************** HTML ENTITIES */
a {
color: $colorA;
@ -226,7 +251,7 @@ body.desktop .has-local-controls {
}
/******************************************************** STATES */
@mixin spinner($b: 5px, $c: $colorKey) {
@mixin spinner($b: 5, $c: $colorKey) {
animation-name: rotation-centered;
animation-duration: 0.5s;
animation-iteration-count: infinite;
@ -276,13 +301,13 @@ body.desktop .has-local-controls {
}
&.c-tree__item {
$d: $waitSpinnerTreeD;
$spinnerL: 19px + $d/2;
$spinnerL: 19 + $d/2;
display: flex;
align-items: center;
padding-left: $spinnerL + $d/2 + $interiorMargin;
background: $colorLoadingBg;
min-height: 5px + $d;
min-height: 5 + $d;
.c-tree__item__label {
font-style: italic;
@ -291,7 +316,7 @@ body.desktop .has-local-controls {
&:before {
height: $d;
width: $d;
border-width: 4px;
border-width: 4;
left: $spinnerL;
}
&:after {

View File

@ -52,6 +52,7 @@
$ctrlW: 22px;
&__controls {
font-size: 1rem !important;
margin-right: 0;
min-width: 0;
overflow: hidden;
@ -62,7 +63,7 @@
}
&__direction {
font-size: 0.9em;
font-size: 0.9rem !important;
margin-right: $interiorMargin;
}

View File

@ -2,7 +2,7 @@
"metadata": {
"name": "Open MCT Symbols 16px",
"lastOpened": 0,
"created": 1593102875898
"created": 1596146160781
},
"iconSets": [
{
@ -752,7 +752,7 @@
"tempChar": ""
},
{
"order": 114,
"order": 189,
"id": 4,
"name": "icon-font-size",
"prevSize": 24,
@ -2686,17 +2686,26 @@
{
"id": 4,
"paths": [
"M842.841 380.048h-120.956l-52.382 139.676 52.918 141.12 59.942-159.84 62.361 166.314h-119.884l34.019 90.717h119.884l39.695 105.836h105.836l-181.434-483.823z",
"M263.903 160.129l-263.903 703.742h153.944l57.729-153.944h280.397l57.729 153.944h153.944l-263.903-703.742zM261.154 577.976l90.717-241.911 90.717 241.911z"
"M1148 416h-152l-65.82 175.54 66.5 177.32 75.32-200.86 78.38 209h-150.66l42.76 114h150.64l49.88 133h133l-228-608z",
"M384 0l-384 1024h224l84-224h408l84 224h224l-384-1024zM380 608l132-352 132 352z"
],
"attrs": [
{},
{}
],
"attrs": [],
"grid": 16,
"tags": [
"icon-font-size-alt1"
],
"isMulticolor": false,
"isMulticolor2": false,
"colorPermutations": {
"12552552551": []
}
"12552552551": [
{},
{}
]
},
"width": 1376
},
{
"id": 141,

View File

@ -100,7 +100,7 @@
<glyph unicode="&#xea2c;" glyph-name="icon-frame-hide" d="M128 642h420l104 128h-652v-802.4l128 157.4zM896 2h-420l-104-128h652v802.4l-128-157.4zM832 834l-832-1024h192l832 1024zM392 450l104 128h-304v-128z" />
<glyph unicode="&#xea2d;" glyph-name="icon-import" d="M832 639.6v-639.4c0-0.2-0.2-0.2-0.4-0.4h-319.6v-192h320c105.6 0 192 86.4 192 192v640.2c0 105.6-86.4 192-192 192h-320v-192h319.6c0.2 0 0.4-0.2 0.4-0.4zM192 128v-192l384 384-384 384v-192h-192v-384z" />
<glyph unicode="&#xea2e;" glyph-name="icon-export" d="M192 0.34v639.32l0.34 0.34h319.66v192h-320c-105.6 0-192-86.4-192-192v-640c0-105.6 86.4-192 192-192h320v192h-319.66zM1024 320l-384 384v-192h-192v-384h192v-192l384 384z" />
<glyph unicode="&#xea2f;" glyph-name="icon-font-size" d="M842.841 451.952h-120.956l-52.382-139.676 52.918-141.12 59.942 159.84 62.361-166.314h-119.884l34.019-90.717h119.884l39.695-105.836h105.836l-181.434 483.823zM263.903 671.871l-263.903-703.742h153.944l57.729 153.944h280.397l57.729-153.944h153.944l-263.903 703.742zM261.154 254.024l90.717 241.911 90.717-241.911z" />
<glyph unicode="&#xea2f;" glyph-name="icon-font-size" horiz-adv-x="1376" d="M1148 416h-152l-65.82-175.54 66.5-177.32 75.32 200.86 78.38-209h-150.66l42.76-114h150.64l49.88-133h133l-228 608zM384 832l-384-1024h224l84 224h408l84-224h224l-384 1024zM380 224l132 352 132-352z" />
<glyph unicode="&#xea30;" glyph-name="icon-clear-data" d="M632 520l-120-120-120 120-80-80 120-120-120-120 80-80 120 120 120-120 80 80-120 120 120 120-80 80zM512 832c-282.76 0-512-86-512-192v-640c0-106 229.24-192 512-192s512 86 512 192v640c0 106-229.24 192-512 192zM512 0c-176.731 0-320 143.269-320 320s143.269 320 320 320c176.731 0 320-143.269 320-320v0c0-176.731-143.269-320-320-320v0z" />
<glyph unicode="&#xea31;" glyph-name="icon-history" d="M576 768c-247.4 0-448-200.6-448-448h-128l192-192 192 192h-128c0 85.4 33.2 165.8 93.8 226.2 60.4 60.6 140.8 93.8 226.2 93.8s165.8-33.2 226.2-93.8c60.6-60.4 93.8-140.8 93.8-226.2s-33.2-165.8-93.8-226.2c-60.4-60.6-140.8-93.8-226.2-93.8s-165.8 33.2-226.2 93.8l-90.6-90.6c81-81 193-131.2 316.8-131.2 247.4 0 448 200.6 448 448s-200.6 448-448 448zM576 560c-26.6 0-48-21.4-48-48v-211.8l142-142c9.4-9.4 21.6-14 34-14s24.6 4.6 34 14c18.8 18.8 18.8 49.2 0 67.8l-114 114v172c0 26.6-21.4 48-48 48z" />
<glyph unicode="&#xea32;" glyph-name="icon-arrow-up-to-parent" horiz-adv-x="1056" d="M643.427 6.739c-81.955 0.697-148.179 67.065-148.642 149.010v395.872l296.871-247.393v197.914l-395.828 329.857-395.828-328.62v-197.502l296.871 246.156v-396.241c0-190.905 155.239-346.556 346.144-346.968l412.321-0.825 0.412 197.914z" />

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -66,6 +66,8 @@
:object="domainObject"
:show-edit-view="showEditView"
:object-path="objectPath"
:font-size="fontSize"
:font="font"
/>
</div>
</template>
@ -103,6 +105,14 @@ export default {
showEditView: {
type: Boolean,
default: true
},
fontSize: {
type: String,
default: ''
},
font: {
type: String,
default: ''
}
},
data() {

View File

@ -20,12 +20,30 @@ export default {
default: () => {
return [];
}
},
fontSize: {
type: String,
default: ''
},
font: {
type: String,
default: ''
}
},
watch: {
object(newObject, oldObject) {
this.currentObject = newObject;
this.debounceUpdateView();
},
fontSize(newSize, oldSize) {
if (newSize !== oldSize) {
this.setFontSize(newSize);
}
},
font(newFont, oldFont) {
if (newFont !== oldFont) {
this.setFont(newFont);
}
}
},
destroyed() {
@ -63,8 +81,9 @@ export default {
if (this.currentObject) {
//This is to apply styles to subobjects in a layout
this.initObjectStyles();
this.setFontSize(this.fontSize);
this.setFont(this.font);
}
},
methods: {
clear() {
@ -91,6 +110,15 @@ export default {
this.openmct.objectViews.off('clearData', this.clearData);
},
getStyleReceiver() {
let styleReceiver = this.$el.querySelector('.js-style-receiver');
if (!styleReceiver) {
styleReceiver = this.$el.querySelector(':first-child');
}
return styleReceiver;
},
invokeEditModeHandler(editMode) {
let edit;
@ -111,20 +139,20 @@ export default {
return;
}
let keys = Object.keys(styleObj);
let elemToStyle = this.getStyleReceiver();
keys.forEach(key => {
let firstChild = this.$el.querySelector(':first-child');
if (firstChild) {
if (elemToStyle) {
if ((typeof styleObj[key] === 'string') && (styleObj[key].indexOf('__no_value') > -1)) {
if (firstChild.style[key]) {
firstChild.style[key] = '';
if (elemToStyle.style[key]) {
elemToStyle.style[key] = '';
}
} else {
if (!styleObj.isStyleInvisible && firstChild.classList.contains(STYLE_CONSTANTS.isStyleInvisible)) {
firstChild.classList.remove(STYLE_CONSTANTS.isStyleInvisible);
} else if (styleObj.isStyleInvisible && !firstChild.classList.contains(styleObj.isStyleInvisible)) {
firstChild.classList.add(styleObj.isStyleInvisible);
if (!styleObj.isStyleInvisible && elemToStyle.classList.contains(STYLE_CONSTANTS.isStyleInvisible)) {
elemToStyle.classList.remove(STYLE_CONSTANTS.isStyleInvisible);
} else if (styleObj.isStyleInvisible && !elemToStyle.classList.contains(styleObj.isStyleInvisible)) {
elemToStyle.classList.add(styleObj.isStyleInvisible);
}
firstChild.style[key] = styleObj[key];
elemToStyle.style[key] = styleObj[key];
}
}
});
@ -305,6 +333,14 @@ export default {
parentObject = objectPath[1];
return [browseObject, parentObject, this.currentObject].every(object => object && !object.locked);
},
setFontSize(newSize) {
let elemToStyle = this.getStyleReceiver();
elemToStyle.dataset.fontSize = newSize;
},
setFont(newFont) {
let elemToStyle = this.getStyleReceiver();
elemToStyle.dataset.font = newFont;
}
}
}

View File

@ -2,7 +2,7 @@
<div class="c-inspector__header">
<div v-if="!multiSelect"
class="c-inspector__selected c-object-label"
:class="{'is-missing': domainObject.status === 'missing' }"
:class="{'is-missing': domainObject && domainObject.status === 'missing' }"
>
<div class="c-object-label__type-icon"
:class="typeCssClass"

View File

@ -10,7 +10,6 @@
<span class="l-browse-bar__object-name c-object-label__name">
{{ domainObject.name }}
</span>
<context-menu-drop-down :object-path="objectPath" />
</div>
</div>
<div class="l-browse-bar__end">
@ -21,12 +20,6 @@
:current-view="currentView"
@setView="setView"
/>
<NotebookMenuSwitcher v-if="showNotebookMenuSwitcher"
:domain-object="domainObject"
:ignore-link="true"
:object-path="objectPath"
class="c-notebook-snapshot-menubutton"
/>
</div>
</div>
</div>
@ -34,18 +27,13 @@
<script>
import ContextMenuDropDown from '../../ui/components/contextMenuDropDown.vue';
import NotebookMenuSwitcher from '@/plugins/notebook/components/notebook-menu-switcher.vue';
import ViewSwitcher from '../../ui/layout/ViewSwitcher.vue';
export default {
inject: [
'openmct',
'objectPath'
'openmct'
],
components: {
ContextMenuDropDown,
NotebookMenuSwitcher,
ViewSwitcher
},
props: {
@ -67,12 +55,6 @@ export default {
return false;
}
},
showNotebookMenuSwitcher: {
type: Boolean,
default: () => {
return false;
}
},
views: {
type: Array,
default: () => {

View File

@ -50,7 +50,7 @@ export default {
return selectedOption.name || selectedOption.value
}
// If no selected option, then options are non-specific
return '??px';
return '??';
},
nonSpecific() {
return this.options.nonSpecific === true;