fix: added name for section & column

This commit is contained in:
Shariq Ansari 2025-01-02 02:14:55 +05:30
parent e6470562a7
commit beedb11cd1
2 changed files with 11 additions and 4 deletions

View File

@ -42,7 +42,7 @@ import {
Badge, Badge,
ErrorMessage, ErrorMessage,
} from 'frappe-ui' } from 'frappe-ui'
import { evaluateDependsOnValue, createToast } from '@/utils' import { evaluateDependsOnValue, createToast, getRandom } from '@/utils'
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
const props = defineProps({ const props = defineProps({
@ -121,13 +121,18 @@ const tabs = computed(() => {
_tabs.push({ _tabs.push({
label: field.label, label: field.label,
name: field.value, name: field.value,
sections: [{ columns: [{ fields: [] }] }], sections: [
{
name: 'section_' + getRandom(),
columns: [{ name: 'column_' + getRandom(), fields: [] }],
},
],
}) })
} else if (field.type === 'Section Break') { } else if (field.type === 'Section Break') {
_sections.push({ _sections.push({
label: field.label, label: field.label,
name: field.value, name: field.value,
columns: [{ fields: [] }], columns: [{ name: 'column_' + getRandom(), fields: [] }],
}) })
} else if (field.type === 'Column Break') { } else if (field.type === 'Column Break') {
_sections[_sections.length - 1].columns.push({ _sections[_sections.length - 1].columns.push({

View File

@ -130,7 +130,8 @@
sections.push({ sections.push({
label: __('New Section'), label: __('New Section'),
opened: true, opened: true,
columns: [{ fields: [] }], name: 'section_' + getRandom(),
columns: [{ name: 'column_' + getRandom(), fields: [] }],
}) })
" "
> >
@ -145,6 +146,7 @@
import EditIcon from '@/components/Icons/EditIcon.vue' import EditIcon from '@/components/Icons/EditIcon.vue'
import Autocomplete from '@/components/frappe-ui/Autocomplete.vue' import Autocomplete from '@/components/frappe-ui/Autocomplete.vue'
import DragVerticalIcon from '@/components/Icons/DragVerticalIcon.vue' import DragVerticalIcon from '@/components/Icons/DragVerticalIcon.vue'
import { getRandom } from '@/utils'
import Draggable from 'vuedraggable' import Draggable from 'vuedraggable'
import { Input, createResource } from 'frappe-ui' import { Input, createResource } from 'frappe-ui'
import { computed, watch } from 'vue' import { computed, watch } from 'vue'