3
0

Fix field keys when using fieldID and system fields

This commit is contained in:
Jože Fortun
2023-09-11 17:51:18 +02:00
parent 65b6db343c
commit 7cef18c679
17 changed files with 13 additions and 40 deletions

View File

@@ -1,22 +1,12 @@
<template>
<div
v-if="text"
:id="id"
v-b-popover.hover.right="{ variant: 'dark', content: text }"
class="d-flex align-items-center ml-2"
>
<font-awesome-icon
:icon="['far', 'question-circle']"
/>
<b-tooltip
:target="id"
triggers="hover"
placement="right"
variant="dark"
custom-class="m-1"
>
{{ text }}
</b-tooltip>
</div>
</template>
@@ -27,10 +17,6 @@ export default {
type: String,
default: '',
},
id: {
type: String,
required: true,
},
},
}
</script>

View File

@@ -22,7 +22,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>
@@ -48,7 +47,6 @@
{{ label }}
<hint
:id="field.fieldID"
:text="hint"
/>
</div>

View File

@@ -21,7 +21,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -22,7 +22,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -21,7 +21,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -22,7 +22,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -21,7 +21,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -21,7 +21,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -21,7 +21,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -22,7 +22,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -21,7 +21,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -21,7 +21,6 @@
</span>
<hint
:id="field.fieldID"
:text="hint"
/>

View File

@@ -71,7 +71,7 @@
:get-option-label="getFieldLabel"
:get-option-key="getOptionKey"
:placeholder="$t('prefill.selectField')"
:reduce="field => field.fieldID"
:reduce="getOptionKey"
:calculate-position="calculateDropdownPosition"
append-to-body
class="bg-white"
@@ -92,7 +92,7 @@
:get-option-label="getFieldLabel"
:get-option-key="getOptionKey"
:placeholder="$t('prefill.selectField')"
:reduce="field => field.fieldID"
:reduce="getOptionKey"
:calculate-position="calculateDropdownPosition"
append-to-body
class="bg-white"
@@ -113,7 +113,7 @@
:get-option-label="getFieldLabel"
:get-option-key="getOptionKey"
:placeholder="$t('prefill.selectField')"
:reduce="field => field.fieldID"
:reduce="getOptionKey"
:calculate-position="calculateDropdownPosition"
append-to-body
class="bg-white"
@@ -137,7 +137,7 @@
:get-option-label="getFieldLabel"
:get-option-key="getOptionKey"
:placeholder="$t('prefill.selectField')"
:reduce="field => field.fieldID"
:reduce="getOptionKey"
:calculate-position="calculateDropdownPosition"
append-to-body
class="bg-white"
@@ -205,8 +205,8 @@ export default {
return label || name
},
getOptionKey ({ fieldID }) {
return fieldID
getOptionKey ({ fieldID, name }) {
return fieldID !== NoID ? fieldID : name
},
setDefaultValues () {

View File

@@ -33,7 +33,6 @@
</span>
<hint
:id="field.fieldID"
:text="((field.options.hint || {}).view || '')"
/>

View File

@@ -55,7 +55,7 @@
:get-option-label="getFieldLabel"
:get-option-key="getOptionKey"
:placeholder="$t('record.referenceRecordFieldPlaceholder')"
:reduce="field => field.fieldID"
:reduce="getOptionKey"
:calculate-position="calculateDropdownPosition"
append-to-body
class="bg-white"
@@ -231,7 +231,7 @@ import base from './base'
import FieldPicker from 'corteza-webapp-compose/src/components/Common/FieldPicker'
import { VueSelect } from 'vue-select'
import { mapActions } from 'vuex'
import { compose } from '@cortezaproject/corteza-js'
import { NoID, compose } from '@cortezaproject/corteza-js'
export default {
i18nOptions: {
@@ -275,6 +275,7 @@ export default {
{ value: 'modal', text: this.$t('record.openInModal') },
]
},
recordSelectorFields () {
return this.module.fields.filter(f => f.kind === 'Record' && !f.isMulti)
},
@@ -318,8 +319,8 @@ export default {
return label || name
},
getOptionKey ({ fieldID }) {
return fieldID
getOptionKey ({ fieldID, name }) {
return fieldID !== NoID ? fieldID : name
},
updateReferenceModule (fieldID, fields) {

View File

@@ -45,7 +45,6 @@
</span>
<hint
:id="field.fieldID"
:text="((field.options.hint || {}).view || '')"
/>
</div>

View File

@@ -28,7 +28,7 @@
>
<div
v-for="(field, index) in fields"
:key="field.fieldID"
:key="index"
class="position-relative"
>
<field-editor