Skip to content

Commit

Permalink
fix: validation for position limits in list table block
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmendes21 committed Dec 17, 2024
1 parent 84fd437 commit 0aa7bae
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/templates/list-table-block/v2/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
const selectedColumns = ref([])
const columnSelectorPanel = ref(null)
const menuRef = ref({})
const valueInputedUser = ref(null)
const valueInputedUser = ref(0)
const dialog = useDialog()
const router = useRouter()
Expand Down Expand Up @@ -489,8 +489,25 @@
})
}
const displayPositionExceededToast = () => {
toast.add({
closable: true,
severity: 'info',
summary: 'Invalid Position',
detail:
'The entered position exceeds the list limit. The rule has been moved to the last position in the list.'
})
}
const checkPositionExceededMaxResults = (maxPosition) => {
if (valueInputedUser.value > maxPosition) {
displayPositionExceededToast()
valueInputedUser.value = 0
}
}
const onPositionChange = (updatedRow, newValue) => {
if (valueInputedUser.value > updatedRow.position.max) console.log('dispara o toast')
checkPositionExceededMaxResults(updatedRow.position.max)
const oldIndex = data.value.findIndex((item) => item.id === updatedRow.id)
if (oldIndex === -1) return
Expand Down

0 comments on commit 0aa7bae

Please sign in to comment.