diff --git a/cateditor/src/components/SelectionMixin.js b/cateditor/src/components/SelectionMixin.js index dd6bf5c..7621bb6 100644 --- a/cateditor/src/components/SelectionMixin.js +++ b/cateditor/src/components/SelectionMixin.js @@ -1,72 +1,72 @@ const SelectionMixin = { // eslint-disable-line no-unused-vars computed: { selectedSectionID: { - get () { + get() { return this.$store.getters.SELECTED_SECTION_ID }, - set (value) { + set(value) { this.$store.dispatch('SET_SELECTED_SECTION_ID', value) } }, selectedFamilyID: { - get () { + get() { return this.$store.getters.SELECTED_FAMILY_ID }, - set (value) { + set(value) { this.$store.dispatch('SET_SELECTED_FAMILY_ID', value) } }, selectedModelID: { - get () { + get() { return this.$store.getters.SELECTED_MODEL_ID }, - set (value) { + set(value) { this.$store.dispatch('SET_SELECTED_MODEL_ID', value) } }, selectedMaterial: { - get () { + get() { return this.$store.getters.SELECTED_MATERIAL_ID }, - set (value) { + set(value) { this.$store.dispatch('SET_SELECTED_MATERIAL_ID', value) } }, }, methods: { - selectSection: function (id) { + selectSection: function(id) { this.selectedSectionID = id // this.selectedFamilyID = null // this.selectedModelID = null // this.selectedMaterial = null }, - selectFamily: function (id) { + selectFamily: function(id) { this.selectedFamilyID = id // this.selectedModelID = null // this.selectedMaterial = null }, - selectModel: function (id) { + selectModel: function(id) { this.selectedModelID = id // this.selectedFamilyID = null // this.selectedMaterial = null }, - selectMaterial: function (id) { + selectMaterial: function(id) { this.selectedMaterial = id }, - selectedFamilies: function () { + selectedFamilies: function() { let section = this.$store.getters.CAT_SECTION(this.selectedSectionID) let ids = this.sectionIDs(section) let materials = this.findMaterials(ids) return this.makeFamilies(materials) }, - selectedFamily: function () { + selectedFamily: function() { let families = this.selectedFamilies() return families.find(s => s.id === this.selectedFamilyID) }, - sectionIDs: function (section) { + sectionIDs: function(section) { let ids = [] - if (section !== undefined) { + if (section) { for (let page of section.pages) { for (let block of page) { ids.push(...block.ids) @@ -76,10 +76,10 @@ const SelectionMixin = { // eslint-disable-line no-unused-vars return ids }, - findMaterials: function (ids) { + findMaterials: function(ids) { return ids.map(id => this.$store.getters.MATERIAL(id)) }, - makeFamilies: function (materials) { + makeFamilies: function(materials) { let families = [] for (let mat of materials) { @@ -102,7 +102,7 @@ const SelectionMixin = { // eslint-disable-line no-unused-vars return families }, - uniquify: function (arr) { + uniquify: function(arr) { return [...new Set(arr)] }, }