File tree Expand file tree Collapse file tree 16 files changed +58
-51
lines changed
Expand file tree Collapse file tree 16 files changed +58
-51
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Vue.use(Vuetify);
2626export const { applyHook, registerHook } = HookManager ;
2727
2828export function registerWidget ( name , component ) {
29- Store . commit ( Mutations . ADD_PROPERTY_MAPPING , { name, component } ) ;
29+ Store . commit ( Mutations . SIMPUT_ADD_PROPERTY_MAPPING , { name, component } ) ;
3030}
3131
3232export function registerType ( type , urls ) {
@@ -86,16 +86,17 @@ export function createViewer() {
8686 type : dataset . type ,
8787 data : dataset . data ,
8888 } ) ;
89- return Store . dispatch ( Actions . LOAD_TEMPLATE , dataset . type ) ;
89+ return Store . dispatch ( Actions . SIMPUT_LOAD_TEMPLATE , dataset . type ) ;
9090 }
9191 return Promise . reject ( new Error ( 'No model found in download' ) ) ;
9292 } ) ;
93- } else if ( type ) {
93+ }
94+ if ( type ) {
9495 Store . commit ( Mutations . SET_MODEL , {
9596 type,
9697 data : { } ,
9798 } ) ;
98- return Store . dispatch ( Actions . LOAD_TEMPLATE , type ) ;
99+ return Store . dispatch ( Actions . SIMPUT_LOAD_TEMPLATE , type ) ;
99100 }
100101 return Promise . resolve ( ) ;
101102 } ,
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default {
1414 } ,
1515 computed : Object . assign (
1616 mapGetters ( {
17- dataModel : Getters . MODEL ,
17+ dataModel : Getters . SIMPUT_MODEL ,
1818 } )
1919 ) ,
2020 data ( ) {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default {
1818 window . open ( sample . goTo , '_blank' ) ;
1919 } else {
2020 this . $store . commit ( Mutations . SET_MODEL , sample . model ) ;
21- this . $store . dispatch ( Actions . LOAD_TEMPLATE , sample . model . type ) ;
21+ this . $store . dispatch ( Actions . SIMPUT_LOAD_TEMPLATE , sample . model . type ) ;
2222 }
2323 } ,
2424 } ,
Original file line number Diff line number Diff line change 1- import { mapState } from 'vuex' ;
1+ import { mapGetters } from 'vuex' ;
22
33// ---------------------------------------------------------------------------
44
55export default {
66 name : 'PropertyFactory' ,
77 props : [ 'prop' , 'viewData' ] ,
8- computed : mapState ( {
9- component ( state ) {
10- return state . properties . mapping [ this . prop . ui . propType . toLowerCase ( ) ] ;
8+ computed : {
9+ ...mapGetters ( {
10+ getComponent : 'SIMPUT_COMPONENT_GET' ,
11+ } ) ,
12+ component ( ) {
13+ return this . getComponent ( this . prop . ui . propType ) ;
1114 } ,
12- } ) ,
15+ } ,
1316} ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export default {
2525 return ( property . show || alwaysShow ) ( this . viewData ) ? 'block' : 'none' ;
2626 } ,
2727 updateViewData ( newData ) {
28- this . $store . state . templates . dataManager . updateViewData ( newData ) ;
28+ this . $store . getters . SIMPUT_DATAMANAGER . updateViewData ( newData ) ;
2929 } ,
3030 } ,
3131} ;
Original file line number Diff line number Diff line change 1- import { mapState } from 'vuex' ;
1+ import { mapGetters } from 'vuex' ;
22
33import PropertyPanel from 'simput/src/components/core/PropertyPanel' ;
44
@@ -9,23 +9,21 @@ export default {
99 components : {
1010 PropertyPanel,
1111 } ,
12- computed : Object . assign (
13- {
14- panelData ( ) {
15- if ( this . dataManager ) {
16- return this . dataManager . getPropertyList ( ) ;
17- }
18- return [ ] ;
19- } ,
20- viewData ( ) {
21- if ( this . dataManager ) {
22- return this . dataManager . getActiveViewData ( ) ;
23- }
24- return { } ;
25- } ,
12+ computed : {
13+ ...mapGetters ( {
14+ dataManager : 'SIMPUT_DATAMANAGER' ,
15+ } ) ,
16+ panelData ( ) {
17+ if ( this . dataManager ) {
18+ return this . dataManager . getPropertyList ( ) ;
19+ }
20+ return [ ] ;
2621 } ,
27- mapState ( {
28- dataManager : ( state ) => state . templates . dataManager ,
29- } )
30- ) ,
22+ viewData ( ) {
23+ if ( this . dataManager ) {
24+ return this . dataManager . getActiveViewData ( ) ;
25+ }
26+ return { } ;
27+ } ,
28+ } ,
3129} ;
Original file line number Diff line number Diff line change @@ -6,15 +6,13 @@ import { Getters } from 'simput/src/stores/types';
66export default {
77 name : 'WorkflowMenu' ,
88 computed : mapGetters ( {
9- dataModel : Getters . DATAMANAGER ,
9+ dataModel : 'SIMPUT_DATAMANAGER' ,
10+ getListComponentByName : 'SIMPUT_COMPONENT_GET' ,
1011 } ) ,
1112 methods : {
1213 viewHasChildren ( viewId ) {
1314 const viewItem = this . dataModel . model . views [ viewId ] ;
1415 return 'size' in viewItem || 'children' in viewItem ;
1516 } ,
16- getListComponentByName ( name ) {
17- return this . $store . state . properties . mapping [ name . toLowerCase ( ) ] ;
18- } ,
1917 } ,
2018} ;
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export default {
101101 } ,
102102 beforeMount ( ) {
103103 const update = ( ) => this . $nextTick ( this . $forceUpdate ) ;
104- this . unsubscribe = this . $store . state . templates . dataManager . subscribe (
104+ this . unsubscribe = this . $store . getters . SIMPUT_DATAMANAGER . subscribe (
105105 update
106106 ) . unsubscribe ;
107107 } ,
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export default {
2929 } ,
3030 beforeMount ( ) {
3131 const update = ( ) => this . $nextTick ( this . $forceUpdate ) ;
32- this . unsubscribe = this . $store . state . templates . dataManager . subscribe (
32+ this . unsubscribe = this . $store . getters . SIMPUT_DATAMANAGER . subscribe (
3333 update
3434 ) . unsubscribe ;
3535 } ,
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export default {
6060 } ,
6161 beforeMount ( ) {
6262 const update = ( ) => this . $nextTick ( this . $forceUpdate ) ;
63- this . unsubscribe = this . $store . state . templates . dataManager . subscribe (
63+ this . unsubscribe = this . $store . getters . SIMPUT_DATAMANAGER . subscribe (
6464 update
6565 ) . unsubscribe ;
6666 } ,
You can’t perform that action at this time.
0 commit comments