@@ -31,8 +28,10 @@
{{ pVal('buttonLabel', 'Submit') }}
@@ -45,7 +44,6 @@ import CPagination from '../common/CPagination.vue'
import { pVal } from '../utils.ts'
import CInputSelect from '../../input/CInputSelect.vue'
import { compose, NoID } from '@cortezaproject/corteza-js'
-import { createPopper } from '@popperjs/core'
import { debounce } from 'lodash'
export default {
@@ -79,12 +77,8 @@ export default {
},
computed: {
- // moduleFields returns the available field names
- moduleFields () {
- if (!this.module) {
- return []
- }
- return this.module.fields.map(({ name }) => name)
+ labelField () {
+ return this.module.fields.find(f => f.name === this.pVal('labelField'))
},
showPagination () {
@@ -165,7 +159,9 @@ export default {
return { '@type': 'Any', '@value': null }
}
- return { '@type': 'ComposeRecord', '@value': this.value.record }
+ const record = this.options.find(({ recordID }) => recordID === this.value)
+
+ return { '@type': 'ComposeRecord', '@value': record }
},
loadLatest () {
@@ -206,51 +202,6 @@ export default {
}
}, 300),
- calculateDropdownPosition (dropdownList, component, { width }) {
- /**
- * We need to explicitly define the dropdown width since
- * it is usually inherited from the parent with CSS.
- */
- dropdownList.style.width = width
- dropdownList.style['z-index'] = 10000
-
- /**
- * Here we position the dropdownList relative to the $refs.toggle Element.
- *
- * The 'offset' modifier aligns the dropdown so that the $refs.toggle and
- * the dropdownList overlap by 1 pixel.
- *
- * The 'toggleClass' modifier adds a 'drop-up' class to the Vue Select
- * wrapper so that we can set some styles for when the dropdown is placed
- * above.
- */
- const popper = createPopper(component.$refs.toggle, dropdownList, {
- placement: 'bottom',
- modifiers: [
- {
- name: 'offset',
- options: {
- offset: [0, -1],
- },
- },
- {
- name: 'toggleClass',
- enabled: true,
- phase: 'write',
- fn ({ state }) {
- component.$el.classList.toggle('drop-up', state.placement === 'top')
- },
- }],
- })
-
- /**
- * To prevent memory leaks Popper needs to be destroyed.
- * If you return function, it will be called just before dropdown is removed from DOM.
- */
- return () => popper.destroy()
- },
-
-
fetchPrefiltered (q) {
this.processing = true
@@ -273,11 +224,15 @@ export default {
this.options = set.map(r => {
const record = new compose.Record(this.module, r)
- const label = record.values[this.pVal('labelField')] || record.recordID
+
+ let label
+ if (this.labelField) {
+ label = this.labelField.isMulti ? record.values[this.pVal('labelField')].join(', ') : record.values[this.pVal('labelField')]
+ }
return {
recordID: record.recordID,
- label,
+ label: label || record.recordID,
record,
}
})
diff --git a/lib/vue/src/components/prompts/kinds/CPromptInput.vue b/lib/vue/src/components/prompts/kinds/CPromptInput.vue
index 02a4bef594..da69039722 100644
--- a/lib/vue/src/components/prompts/kinds/CPromptInput.vue
+++ b/lib/vue/src/components/prompts/kinds/CPromptInput.vue
@@ -1,6 +1,7 @@
-
+
+
{{ pVal('buttonLabel', 'Submit') }}
diff --git a/lib/vue/src/components/prompts/kinds/CPromptOptions.vue b/lib/vue/src/components/prompts/kinds/CPromptOptions.vue
index e42ccf2ddd..87ddcc559f 100644
--- a/lib/vue/src/components/prompts/kinds/CPromptOptions.vue
+++ b/lib/vue/src/components/prompts/kinds/CPromptOptions.vue
@@ -1,6 +1,7 @@
-
+
+
+
{{ pVal('buttonLabel', 'Submit') }}
diff --git a/lib/vue/src/components/prompts/kinds/base.vue b/lib/vue/src/components/prompts/kinds/base.vue
index 18162e56f0..bff189612d 100644
--- a/lib/vue/src/components/prompts/kinds/base.vue
+++ b/lib/vue/src/components/prompts/kinds/base.vue
@@ -15,7 +15,7 @@ export default {
computed: {
message () {
- return this.pVal('message', 'Default prompt message.')
+ return this.pVal('message', '')
},
},