LT-67: Migrating DIMSE inputs to components

This commit is contained in:
Bruno Alves de Faria committed 2016-08-31 08:09:27 -03:00
1 parent c3d7c2af09
commit e5eb98cbc0
6 files changed
+54 -41

No files matched your search

@@ -29,22 +29,30 @@ OHIF.mixins.group = new OHIF.Mixin({
// Get or set the child components values
component.value = value => {
const isGet = _.isUndefined(value);
const isArray = instance.data.arrayValues;
const result = isArray ? [] : {};
if (isGet) {
const result = {};
component.registeredItems.forEach(child => {
const key = child.templateInstance.data.key;
if (key) {
result[key] = child.value();
if (!isArray) {
const key = child.templateInstance.data.key;
if (key) {
result[key] = child.value();
}
} else {
result.push(child.value());
}
});
return result;
}
const groupValue = typeof value === 'object' ? value : {};
const groupValue = typeof value === 'object' ? value : result;
let i = 0;
component.registeredItems.forEach(child => {
const key = child.templateInstance.data.key;
const key = isArray ? i : child.templateInstance.data.key;
const childValue = _.isUndefined(groupValue[key]) ? null : groupValue[key];
child.value(childValue);
i++;
});
component.$element.trigger('change');
};
@@ -52,10 +52,13 @@ OHIF.mixins.schemaData = new OHIF.Mixin({
const parent = OHIF.blaze.getParentComponent(Blaze.currentView);
// Get he parent component key
let parentKey = parent && parent.templateInstance.data.pathKey;
const parentKey = parent && parent.templateInstance.data.pathKey;
// Check if the parent is an array group
const isParentArray = parent && parent.templateInstance.data.arrayValues;
// Set the path key for this component
data.pathKey = data.key || '';
data.pathKey = data.key || (isParentArray ? '$' : '');
if (data.pathKey && typeof parentKey === 'string') {
const prefix = parentKey ? `${parentKey}.` : '';
data.pathKey = `${prefix}${data.pathKey}`;
@@ -107,7 +110,7 @@ OHIF.mixins.schemaData = new OHIF.Mixin({
const component = instance.component;
// Get the current schema data using component's key
const currentSchema = getCurrentSchema(component.parent, instance.data.key);
const currentSchema = getCurrentSchema(component.parent, instance.data.pathKey);
// Stop here if there's no schema data for current key
if (!currentSchema) {