Replacing studyListContextMenu for dropdown
This commit is contained in:
1 parent
4daf7d8bf8
commit
485f82f64c
22 files changed
+250
-325
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
class Dropdown {
|
||||
constructor() {
|
||||
this.observer = new Tracker.Dependency();
|
||||
this._items = [];
|
||||
this.observer.changed();
|
||||
}
|
||||
|
||||
clearItems() {
|
||||
this._items = [];
|
||||
this.observer.changed();
|
||||
}
|
||||
|
||||
setItems(items) {
|
||||
this._items = items;
|
||||
this.observer.changed();
|
||||
}
|
||||
|
||||
addItem(item) {
|
||||
this._items.push(item);
|
||||
this.observer.changed();
|
||||
}
|
||||
|
||||
removeItem(item) {
|
||||
this._items = _.without(this._items, item);
|
||||
this.observer.changed();
|
||||
}
|
||||
|
||||
getItems() {
|
||||
this.observer.depend();
|
||||
return this._items;
|
||||
}
|
||||
}
|
||||
|
||||
OHIF.ui.Dropdown = Dropdown;
|
||||
File renamed without changes.
@@ -1,29 +0,0 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.ui.showFormDropdown = (templateName, dropdownData) => {
|
||||
// Check if the given template exists
|
||||
const template = Template[templateName];
|
||||
if (!template) {
|
||||
throw {
|
||||
name: 'TEMPLATE_NOT_FOUND',
|
||||
message: `Template ${templateName} not found.`
|
||||
};
|
||||
}
|
||||
|
||||
// Prepare the method to destroy the view
|
||||
let view;
|
||||
const destroyView = () => Blaze.remove(view);
|
||||
const templateData = _.extend({}, dropdownData, {
|
||||
destroyView
|
||||
});
|
||||
|
||||
// Render the dialog with the given template and data
|
||||
view = Blaze.renderWithData(template, templateData, document.body);
|
||||
|
||||
// Return the dropdown element to enable position manipulation
|
||||
const dropdown = view.firstNode();
|
||||
return dropdown;
|
||||
};
|
||||
@@ -4,7 +4,7 @@ import './dialog/display.js';
|
||||
import './dialog/spatial.js';
|
||||
import './dialog/unsavedChangesDialog.js';
|
||||
import './draggable/draggable.js';
|
||||
import './dropdown/dropdown.js';
|
||||
import './dropdown/form.js';
|
||||
import './dropdown/class.js';
|
||||
import './dropdown/display.js';
|
||||
import './resizable/resizable.js';
|
||||
import './unsavedChanges/unsavedChanges.js';
|
||||
Reference in new issue
Block a user