Skip to content

Commit 75d7655

Browse files
committed
refactor(uuid): use uuid 4 from uuid package
1 parent 805cf3c commit 75d7655

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dev/pages/samples/FormEditor.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ import { FormKitSchema } from '@formkit/vue'
44
import { ref } from 'vue'
55
import { useFormKitRepeater, useInputEditor, useInputEditorSchema } from 'my-library'
66
import { blueprint, formkitPreset } from '../../utils/presets'
7+
import { useFormKitSection } from '../../../src/composables'
78
89
const { editorSchema } = useInputEditorSchema()
9-
const { generateSchemaItemId, schemaToEditorData, editorDataToSchema } = useInputEditor()
10+
const { schemaToEditorData, editorDataToSchema } = useInputEditor()
1011
const { addListGroupFunctions } = useFormKitRepeater()
12+
const { generateId } = useFormKitSection()
1113
1214
const formSchema = ref(editorSchema)
1315
const formData = ref(null)
1416
1517
function enhanceValuesForInputList(values: any[]): any[] {
1618
const result = []
1719
values.forEach((value) => {
18-
result.push({ ...value, editableItemId: generateSchemaItemId(), selectButton: 'showBasic' })
20+
result.push({ ...value, editableItemId: generateId(), selectButton: 'showBasic' })
1921
})
2022
return result
2123
}
@@ -34,13 +36,13 @@ function actionEdit(schema: any) {
3436
3537
function actionInsert(schema: any) {
3638
const index = formInputList.value.indexOf(schema) + 1
37-
const schemaToInsert = { ...blueprint, editableItemId: generateSchemaItemId(), selectButton: 'showBasic' }
39+
const schemaToInsert = { ...blueprint, editableItemId: generateId(), selectButton: 'showBasic' }
3840
formInputList.value.splice(index, 0, schemaToInsert)
3941
}
4042
4143
function actionCopy(schema: any) {
4244
const index = formInputList.value.indexOf(schema) + 1
43-
const copyOfSchema = { ...schema, editableItemId: generateSchemaItemId() }
45+
const copyOfSchema = { ...schema, editableItemId: generateId() }
4446
formInputList.value.splice(index, 0, copyOfSchema)
4547
}
4648

0 commit comments

Comments
 (0)