feat(measurement-table) Display support for measurements from DICOM Structured Reports (#225)
This commit is contained in:
1 parent
e9832f62f7
commit
d94f0eec16
64 files changed
+1797
-78
No files matched your search
+4
@@ -0,0 +1,4 @@
|
||||
<template name="measurementRelabel">
|
||||
<div class="measurement-relabel {{#if this.threeColumns}}tree-columns{{/if}} {{instance.state.get}}" tabindex="-1">
|
||||
</div>
|
||||
</template>
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import {
|
||||
segmentedTerminologyList,
|
||||
segmentedTerminologyCommonList } from '../../../lib/getLabelTerminologyList';
|
||||
|
||||
Template.measurementRelabel.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.value = instance.data.currentValue || '';
|
||||
|
||||
instance.state = new ReactiveVar('closed');
|
||||
|
||||
instance.items = segmentedTerminologyList;
|
||||
instance.commonItems = segmentedTerminologyCommonList;
|
||||
});
|
||||
|
||||
Template.measurementRelabel.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
const $measurementRelabel = instance.$('.measurement-relabel');
|
||||
|
||||
// Make the measure flow bounded by the window borders
|
||||
$measurementRelabel.bounded();
|
||||
|
||||
// Wait template rerender before rendering the selectTree
|
||||
Tracker.afterFlush(() => {
|
||||
// Get the click or rendering position
|
||||
const position = {
|
||||
left: event.clientX || instance.data.position.x,
|
||||
top: event.clientY || instance.data.position.y,
|
||||
};
|
||||
|
||||
// Define the data for selectTreeComponent
|
||||
const data = {
|
||||
key: 'label',
|
||||
items: instance.items,
|
||||
commonItems: instance.commonItems,
|
||||
hideCommon: instance.data.hideCommon,
|
||||
label: 'Assign label',
|
||||
search: true,
|
||||
searchPlaceholder: 'Search labels',
|
||||
threeColumns: instance.data.threeColumns,
|
||||
position
|
||||
};
|
||||
|
||||
// Define in which element the selectTree will be rendered in
|
||||
const parentElement = $measurementRelabel[0];
|
||||
|
||||
// Render the selectTree element
|
||||
instance.selectTreeView = Blaze.renderWithData(Template.selectTree, data, parentElement);
|
||||
|
||||
// Focus the measure flow to handle closing
|
||||
$measurementRelabel.focus();
|
||||
});
|
||||
});
|
||||
|
||||
Template.measurementRelabel.events({
|
||||
'click, mousedown, mouseup'(event, instance) {
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
'click .tree-leaf input'(event, instance) {
|
||||
const $target = $(event.currentTarget);
|
||||
const $measureFlow = instance.$('.measurement-relabel');
|
||||
instance.state.set('selected');
|
||||
|
||||
instance.value = $target.data('component').value();
|
||||
instance.data.updateCallback(instance.value);
|
||||
|
||||
$measureFlow.trigger('close')
|
||||
},
|
||||
|
||||
'blur .measurement-relabel'(event, instance) {
|
||||
const $measurementRelabel = $(event.currentTarget);
|
||||
const element = $measurementRelabel[0];
|
||||
Meteor.defer(() => {
|
||||
const focused = $(':focus')[0];
|
||||
if (element !== focused && !$.contains(element, focused)) {
|
||||
$measurementRelabel.trigger('close');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'mouseleave .measurement-relabel'(event, instance) {
|
||||
const $measurementRelabel = $(event.currentTarget);
|
||||
const canClose = instance.state.get() === 'selected';
|
||||
if (canClose && !$.contains($measurementRelabel[0], event.toElement)) {
|
||||
$measurementRelabel.trigger('close');
|
||||
}
|
||||
},
|
||||
|
||||
'mouseenter .measurement-relabel'(event, instance) {
|
||||
// Prevent from closing if user go out and in too fast
|
||||
clearTimeout(instance.closingTimeout);
|
||||
$(event.currentTarget).off('animationend').removeClass('fadeOut');
|
||||
},
|
||||
|
||||
'close .measurement-relabel'(event, instance) {
|
||||
// Clear the timeout to prevent executing the close process twice
|
||||
clearTimeout(instance.closingTimeout);
|
||||
instance.data.doneCallback();
|
||||
}
|
||||
});
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
.measurement-relabel
|
||||
outline: none
|
||||
position: fixed
|
||||
z-index: 1
|
||||
|
||||
&.fadeOut
|
||||
animateFadeOut()
|
||||
|
||||
.select-tree-root>.tree-content
|
||||
width: 140px
|
||||
|
||||
&>.tree-options
|
||||
position: relative
|
||||
z-index: 2
|
||||
|
||||
.tree-inputs
|
||||
position: relative
|
||||
|
||||
&>.tree-leaf
|
||||
position: relative
|
||||
|
||||
.icon-check
|
||||
theme('background-color', '$activeColor')
|
||||
animateZoomIn()
|
||||
left: -46px
|
||||
position: absolute
|
||||
top: 3px
|
||||
|
||||
span
|
||||
background: white
|
||||
font-weight: normal
|
||||
height: 46px
|
||||
line-height: 46px
|
||||
padding: 0 12px
|
||||
|
||||
input, span
|
||||
display: none
|
||||
|
||||
.actions
|
||||
padding-top: 16px
|
||||
opacity: 0
|
||||
|
||||
&:not(.fadeOut)
|
||||
animateFadeIn()
|
||||
animation-delay: 0.3s
|
||||
|
||||
&.fadeOut
|
||||
animateFadeOut()
|
||||
|
||||
&.selected>.tree-leaf
|
||||
|
||||
span
|
||||
display: block
|
||||
|
||||
&.tree-columns
|
||||
|
||||
.select-tree-root
|
||||
|
||||
&.navigated .select-tree-common .content
|
||||
animation-name: none
|
||||
|
||||
&.selected .select-tree-common .content
|
||||
animation-name: selectTreeCommonCloseLeft
|
||||
|
||||
.select-tree-common
|
||||
padding-left: 0
|
||||
padding-right: 6px
|
||||
right: auto
|
||||
left: 0
|
||||
width: 180px
|
||||
|
||||
&>.tree-content
|
||||
transform-origin(0% 50%)
|
||||
width: 280px
|
||||
|
||||
.select-tree-common .content
|
||||
right: -180px
|
||||
|
||||
&.started .select-tree-common .content
|
||||
right: 46px
|
||||
|
||||
&.navigated .select-tree-common .content
|
||||
animation-name: selectTreeCommonCloseRight
|
||||
|
||||
.tree-inputs>label
|
||||
float: left
|
||||
width: 50%
|
||||
|
||||
@keyframes selectTreeCommonCloseRight {
|
||||
from {
|
||||
height: 37px
|
||||
display: table
|
||||
right: 6px
|
||||
opacity: 1
|
||||
visibility: visible
|
||||
}
|
||||
to {
|
||||
height: 100%
|
||||
right: -100%
|
||||
opacity: 0
|
||||
visibility: hidden
|
||||
width: calc(100% - 6px)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user