-
Notifications
You must be signed in to change notification settings - Fork 12
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(table): auto resize actions column #381
Conversation
✅ Deploy Preview for sefirot-story ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for sefirot-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #381 +/- ##
==========================================
- Coverage 79.74% 79.50% -0.24%
==========================================
Files 152 153 +1
Lines 12187 12259 +72
Branches 516 522 +6
==========================================
+ Hits 9718 9746 +28
- Misses 2469 2513 +44
☔ View full report in Codecov by Sentry. |
ef6b21f
to
8a4ea96
Compare
ba264be
to
3a35465
Compare
Nicely done!
Yup, this is desirable I say. It should align left 👍
Yeah we are so close. Confirmed that It does work with cell being function, unless user use the cell argument to do something... (passing in But I guess this limitation makes sense. It too complicated to tweak the cell type just for this. One use case I have in mind is something I commented on #832, where we might wanna have different array rather than hiding action via But I think for that case, we can do so by making const isAdmin = ref(false)
useTable({
columns: computed(() => ({
actions: {
type: 'actions',
actions: getActions()
}
}))
})
function getActions() {
const actions = []
actions.push({ icon: 'edit', onClick: () => {} })
if (isAdmin.value) {
actions.push({ icon 'delete', onClick: () => {} })
}
return actions
} |
Yeah let's merge this and close #382 for now. If we need something complex, we probably can just specify the CSS variable. |
Sounds good 👍 |
closes #377
Also adjusted the code to always left align the action cell items. It was looking weird when some of the icons are hidden:
Before:
After:
Not sure though which is more desirable.
Close #382 if merging this.
show
is the recommended way if you want to hide some icons and use auto resize at the same time. This PR won't work when actions.cell is a function.