-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): creation of the useInteractiveTable composable #7772
Conversation
@@ -80,7 +80,7 @@ const currentInteraction = computed(() => | |||
interactions.value.find(interaction => router.currentRoute.value.query[columnName] === interaction.id) | |||
) | |||
|
|||
const columnName = `${tableName}__${props.id}` | |||
const columnName = stringifyColumnName(tableName, props.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep prop reactivity, this should be a computed:
const columnName = stringifyColumnName(tableName, props.id) | |
const columnName = computed(() => stringifyColumnName(tableName, props.id)) |
{ id: 'sort-asc', icon: faArrowDown, label: t('core.sort.ascending') }, | ||
{ id: 'sort-desc', icon: faArrowUp, label: t('core.sort.descending') }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to remove the "coming soon" tooltip inside the template when the interaction is not disabled.
if (typeof prev === 'string' && typeof next === 'string') { | ||
return prev.localeCompare(next) | ||
} else if (typeof prev === 'number' && typeof next === 'number') { | ||
return prev - next | ||
} else if (prev instanceof Date && next instanceof Date) { | ||
return prev.getTime() - next.getTime() | ||
} else { | ||
return String(prev).localeCompare(String(next)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes down to personal preference and coding style, but what do you think of using this suggestion to improve readability?
if (typeof prev === 'string' && typeof next === 'string') { | |
return prev.localeCompare(next) | |
} else if (typeof prev === 'number' && typeof next === 'number') { | |
return prev - next | |
} else if (prev instanceof Date && next instanceof Date) { | |
return prev.getTime() - next.getTime() | |
} else { | |
return String(prev).localeCompare(String(next)) | |
} | |
if (typeof prev === 'string' && typeof next === 'string') { | |
return prev.localeCompare(next) | |
} | |
if (typeof prev === 'number' && typeof next === 'number') { | |
return prev - next | |
} | |
if (prev instanceof Date && next instanceof Date) { | |
return prev.getTime() - next.getTime() | |
} | |
return String(prev).localeCompare(String(next)) |
Closed in favor of #7936 |
Description
Short explanation of this PR (feel free to re-use commit message)
Checklist
Fixes #007
,See xoa-support#42
,See https://...
)Introduced by
CHANGELOG.unreleased.md