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/FormInput.vue b/src/views/wiki/edition/utils/FormInput.vue index 74c041f327..e59b00942a 100644 --- a/src/views/wiki/edition/utils/FormInput.vue +++ b/src/views/wiki/edition/utils/FormInput.vue @@ -46,7 +46,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 +116,9 @@ import InputConditionsLevels from './InputConditionsLevels'; import { requireDocumentProperty, requireFieldProperty } from '@/js/properties-mixins'; export default { - components: { InputConditionsLevels }, + components: { + InputConditionsLevels, + }, mixins: [requireFieldProperty, requireDocumentProperty], @@ -148,6 +151,10 @@ export default { type: Number, default: undefined, }, + optionsFilter: { + type: Function, + default: (doc) => doc, + }, }, computed: { @@ -191,5 +198,12 @@ export default { return this.field.error !== null; }, }, + + methods: { + onAdd(child) { + this.$documentUtils.propagateProperties(this.document, arguments[0]); + this.$emit('add', child); + }, + }, };