Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 4x 4x 4x 4x 4x 4x 1x 1x 1x 1x 4x | import Vue, { PropType } from 'vue'; import Component, { mixins } from 'vue-class-component'; import { Form } from '../types'; import { Fields } from '../../FormFieldList/types'; const Props = Vue.extend({ props: { /** The form object */ form: { type: Object as PropType<Form>, required: true } } }); const MixinsDeclaration = mixins(Props); /** Handle main logic of the FormBuilder */ @Component<FormBuilderCore>({ model: { prop: 'form', event: 'change' } }) export class FormBuilderCore extends MixinsDeclaration { /** * When the form is updated, emit a * change event with updated form * Also emit 'refresh' event if the field is dynamic * * @param {Fields} fields The updated fields with new value * @param {string} sectionName The name of the section * @returns {void} */ sectionUpdated(fields: Fields, sectionName: string): void { const form = { ...this.form }; form[sectionName].questions = fields; this.$nextTick(() => { this.$emit('change', form); }); } } |