diff --git a/src/components/generics/inputs/InputDocument.vue b/src/components/generics/inputs/InputDocument.vue index 2b4866a8bd..0551c5d7d6 100644 --- a/src/components/generics/inputs/InputDocument.vue +++ b/src/components/generics/inputs/InputDocument.vue @@ -23,7 +23,7 @@ {{ $gettext(type + 's') | uppercaseFirstLetter }}
- +
-
- -
+
@@ -47,6 +56,16 @@ export default { type: String, default: undefined, // default must be undefined. null means explicit no helper }, + + cardsFilter: { + type: Function, + default: () => true, + }, + + optionsFilter: { + type: Function, + default: (doc) => doc, + }, }, computed: { @@ -60,7 +79,7 @@ export default { methods: { showDeleteButton(document) { - return this.canRemove(this.document, document); // ! FIXME import mixin + return this.canRemove(this.document, document); }, }, }; diff --git a/src/views/wiki/edition/utils/FormField.vue b/src/views/wiki/edition/utils/FormField.vue index d2f831864c..539714905d 100644 --- a/src/views/wiki/edition/utils/FormField.vue +++ b/src/views/wiki/edition/utils/FormField.vue @@ -22,6 +22,7 @@ :min="min" :divisor="divisor" :is-expanded="isExpanded" + :prefix="prefix" /> @@ -80,6 +81,10 @@ export default { type: String, default: undefined, }, + prefix: { + type: String, + default: null, + }, }, data() { diff --git a/src/views/wiki/edition/utils/FormInput.vue b/src/views/wiki/edition/utils/FormInput.vue index 74c041f327..2fd281cd22 100644 --- a/src/views/wiki/edition/utils/FormInput.vue +++ b/src/views/wiki/edition/utils/FormInput.vue @@ -18,17 +18,15 @@ -
- +
+
@@ -46,7 +44,8 @@ multiple clear-input-on-toggle :has-error="hasError" - @add="$documentUtils.propagateProperties(document, arguments[0])" + @add="onAdd" + :options-filter="optionsFilter" v-model="object[field.name]" /> @@ -115,7 +114,9 @@ import InputConditionsLevels from './InputConditionsLevels'; import { requireDocumentProperty, requireFieldProperty } from '@/js/properties-mixins'; export default { - components: { InputConditionsLevels }, + components: { + InputConditionsLevels, + }, mixins: [requireFieldProperty, requireDocumentProperty], @@ -148,6 +149,10 @@ export default { type: Number, default: undefined, }, + optionsFilter: { + type: Function, + default: (doc) => doc, + }, }, computed: { @@ -191,5 +196,12 @@ export default { return this.field.error !== null; }, }, + + methods: { + onAdd(child) { + this.$documentUtils.propagateProperties(this.document, arguments[0]); + this.$emit('add', child); + }, + }, };