Fixes the field order sort issue

This commit is contained in:
Emmy Leke
2023-04-13 17:22:36 +02:00
committed by Jože Fortun
parent aabd81fb05
commit 5b29cdb9bb
2 changed files with 4 additions and 7 deletions
@@ -416,7 +416,7 @@ export default {
list[nodeID] = {}
for (const sm of this.sharedModules[nodeID]) {
let f = sm.fields.sort((a, b) => a.label.localeCompare(b.label))
let f = [...sm.fields].sort((a, b) => a.label.localeCompare(b.label))
// is there any mappings for this shared module?
const mappedFields = ((this.moduleMappings[nodeID] || {})[sm.moduleID] || {}).fields || []
@@ -125,23 +125,20 @@ export default {
},
options () {
let mFields = []
if (this.fieldSubset) {
mFields = this.module.filterFields(this.fieldSubset)
} else {
mFields = this.module.fields
}
let mFields = [...(this.fieldSubset ? this.module.filterFields(this.fieldSubset) : this.module.fields)]
if (this.disabledTypes.length > 0) {
mFields = mFields.filter(({ kind }) => !this.disabledTypes.find(t => t === kind))
}
let sysFields = []
if (!this.disableSystemFields) {
sysFields = this.module.systemFields().map(sf => {
sf.label = this.$t(`field:system.${sf.name}`)
return sf
})
if (this.systemFields) {
sysFields = sysFields.filter(({ name }) => this.systemFields.find(sf => sf === name))
}