-
Notifications
You must be signed in to change notification settings - Fork 57
[Demo][Component] Update: Implement Sprite panel spacing #3272
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
base: ui
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,7 @@ | ||
| <template> | ||
| <div class="flex-[1_1_0] flex"> | ||
| <div class="flex-none flex flex-col border-r border-dividing-line-2"> | ||
| <div | ||
| ref="itemsWrapper" | ||
| v-radar="listRadarInfo" | ||
| class="items mx-1.5 flex-[1_1_0] flex flex-col gap-2 overflow-y-auto" | ||
| > | ||
| <div ref="itemsWrapper" v-radar="listRadarInfo" class="items flex-[1_1_0] flex flex-col gap-2 overflow-y-auto"> | ||
| <slot></slot> | ||
| </div> | ||
| <UIDropdownWithTooltip> | ||
|
|
@@ -84,18 +80,13 @@ useDragSortable(sortableList, itemsWrapper, { | |
|
|
||
| <style scoped> | ||
| .items { | ||
| /* Here we keep the horizontal padding no more than `10px`, */ | ||
| /* as SortableJS uses `10` as `spacer` when deciding whether to put dragging item to the end of the list. */ | ||
| /* Padding no more than `10px` disables the `_ghostIsLast` check. */ | ||
| /* See details in https://github.com/SortableJS/Sortable/blob/ddd059717333d07b5b1125b7e1dc89514734bcf0/src/Sortable.js#L1822 */ | ||
| padding: 12px 10px; | ||
| padding: 12px; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By changing the horizontal padding of .items to 12px, you exceed the 10px limit that disables SortableJS's hardcoded _ghostIsLast spacer check (which is set to 10px). This can cause buggy behavior when dragging items to the very end of the list.\n\nTo achieve the desired 12px of visual spacing while keeping SortableJS happy, you can keep the horizontal padding at 10px and add a 2px horizontal margin (mx-0.5) to the container. |
||
| } | ||
|
|
||
| .items:deep(.sortable-ghost-item) { | ||
| /* Shadow-like effect */ | ||
| /* TODO: Use other tools like svg-filter to achieve shadow-like effect, to avoid coupling here with `UIBlockItem` */ | ||
| border-color: var(--ui-color-grey-400) !important; | ||
| background-color: var(--ui-color-grey-400) !important; | ||
| opacity: 0.6; | ||
| filter: grayscale(1); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [关键] 移除了 SortableJS 10px 水平内边距约束的说明注释 原注释记录了一个重要约束:SortableJS 使用 该注释的原始措辞在技术细节上可能并不完全精确(SortableJS 的 建议:在合并前验证 12px 水平 padding 下拖拽到列表末尾的行为是否正常(尤其是 ghost 元素是否会意外跳到最后一位)。无论结果如何,请补充一条注释说明已验证该行为,或解释为何原有约束不再适用。 |
||
| box-shadow: var(--ui-box-shadow-sm); | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [性能]
相比之下, 建议:考虑仅使用 |
||
| .items:deep(.sortable-ghost-item *) { | ||
|
|
||
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.
Add mx-0.5 (2px horizontal margin) to the container to compensate for keeping the horizontal padding at 10px (to avoid SortableJS sorting bugs at the end of the list), achieving the desired 12px of total visual spacing.