diff --git a/README.md b/README.md index fac293c..d1198ef 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ The test dashboard is part of the Sparc Portal and is meant to compare various v View the storybook of working components here https://nih-sparc.github.io/TestDashboard/?path=/docs/components-biolucidaviewer--docs +Dev version here +https://sparc-app-2-dev-features-2a5a06b8ea5c.herokuapp.com/apps/dashboard + ## Recommended IDE Setup [VSCode](https://code.visualstudio.com/) @@ -50,9 +53,8 @@ Yarn run lint ## Dependency Setup -If you are installing this project as a node module dependency you need the following installed in your project. +If you are installing this project as a node module [npm](https://www.npmjs.com/package/sparc-dashboard-beta) dependency you need the following installed in your project. Vue(^3.3.4), Pinia(^2.1.7), mitt (^3.0.1), sparc-design-system-components-2 (0.0.26) - ```sh yarn add pina yarn add vue @@ -69,15 +71,13 @@ import App from './App.vue' import { createPinia } from 'pinia'; import 'sparc-dashboard-beta/dist/style.css' import sparcDesignSystemComponents2Umd from 'sparc-design-system-components-2'; -import {default as SparcDashboard, installDashboard as install} from 'sparc-dashboard-beta/dist/index.js' +import {default as SparcDashboard, installDashboard} from 'sparc-dashboard-beta'; const app = createApp(App); let piniaInstance = createPinia(); app.use(piniaInstance); - -installDashboard(app, piniaInstance); //call the install method and pass in the app and pinia instance +installDashboard(app, piniaInstance);//call the install method and pass in the app and pinia instance app.component("SparcDashboard",SparcDashboard) // add the dashboard component to your vue app - app.use(sparcDesignSystemComponents2Umd); app.mount('#app'); @@ -96,40 +96,84 @@ Clone the github repo and navigate to src/components/SampleComponent.vue Expose Your Custom Component to the Dashboard: - Add component tag name to the main.ts document - src/main.ts + src/main.ts or src/main.js ``` const componentMap = [ - 'SubjectNav', - 'ImageSelector', - 'ImageViewer' + 'ImageSelector', + 'FlatmapViewer', + 'BiolucidaViewer', + 'QDBGraph' ] ``` Using the component “SampleComponent”, It would look something like this: ``` const componentMap = [ - 'SubjectNav', - 'ImageSelector', - 'ImageViewer', + 'ImageSelector', + 'FlatmapViewer', + 'BiolucidaViewer', + 'QDBGraph', 'SampleComponent' ] ``` * component name should align with file name. SampleComponent.vue should be renamed and then that new name should be added in main.ts +### Template -### PROPERTIES -These are passed down to the your component (SampleComponent) from its wrapper via the props value +This is your default template. Customize however you like with html and vue 3 markup. Do not delete the header which is added via the tag +``` + ``` +## Header +### Set Name + +This line in your setup script allows you to set the header to your widget name. It does not have to match to file name. +``` + const widgetName = ref('New Custom Component!');//replace with component name you want shown + ``` +DO NOT DELETE SLOT + +This is where your header is set. Do not delete or change the name +``` + +``` + +### Set Icons + +There are default icons on the header. A download one and a close icon (when in edit mode). +You can add a custom icon to your widget's header and send it a function. + +Here we are adding a graph icon that when clicked will alert the user. +js +``` + const childIcons=shallowRef([{"comp":GraphIcon,"event":testIcon}]); + function testIcon(){alert("test icon function")}; +``` +html +``` + +``` +A more practical case will be to open a settings window. Simply have a function that sets your settings visibility to true. See QDBGraph and it's QDBGraphSettings for a working example. + +### PROPERTIES +These are passed down to the your component (SampleComponent) from its wrapper via the props value + +**there are no properties available at this time ### CUSTOM EMITS/EVENTS: @@ -152,81 +196,87 @@ Example: let payload ={} emit('SampleComponent-eventName',payload); ``` - *see options for events you can emit that are already standard throughout the dashboard. - -### OPTIONS - -***setTitle:*** -component ‘s name defaults to it’s vue tag-name. This allows you override it and add a different name - -Example: - ``` -const emit = defineEmits(['setTitle']); -emit('setTitle','MUSE Image Viewer'); -``` - -**other options to come. Examples might include a standard way of setting a filter that most widgets would find useful (age/sex/metadata for example)** ### EVENTS -***ImageSelector-selectImage*** -- Thrown when image selector widget has selected an image -Example: +***ImageSelector-mbfImageSelected*** +- Thrown when image selector (ImageSelector.vue) widget has selected an image +Example for use: ``` -emitter.on('ImageSelector-selectImage', (value) => { +emitter.on('ImageSelector-mbfImageSelected', (value) => { //do something }); - ``` -Here is an example of the SampleComponent.vue file as of 1/26/2024. See github for latest versions - ``` - - ``` diff --git a/src/components/BiolucidaViewer.vue b/src/components/BiolucidaViewer.vue index d50469b..b638b44 100644 --- a/src/components/BiolucidaViewer.vue +++ b/src/components/BiolucidaViewer.vue @@ -1,9 +1,12 @@