feat(grid): refine boolean editing and copy actions

This commit is contained in:
t8y2 committed 2026-08-05 14:22:52 +08:00
1 parent d65d712089
commit f67f02e107
16 files changed
+188 -279

No files matched your search

@@ -282,10 +282,10 @@ onBeforeUnmount(() => {
</div>
<button v-else :disabled="itemIsDisabled(item)" :class="[...itemButtonClass(item.variant), activeSubIndex === index ? 'bg-accent text-accent-foreground' : '']" @click="handleItemClick(item)" @mouseenter="(e) => onItemMouseEnter(index, e)" @mouseleave="onItemMouseLeave">
<span class="flex size-4 shrink-0 items-center justify-center">
<component :is="item.icon" v-if="item.icon" :class="['size-4', item.iconClass]" />
<Check v-if="item.checked" class="size-4 text-primary" />
<component :is="item.icon" v-else-if="item.icon" :class="['size-4', item.iconClass]" />
</span>
<span class="flex-1 whitespace-nowrap">{{ item.label }}</span>
<Check v-if="item.checked" class="ml-4 size-4 shrink-0 text-primary" />
<span v-if="item.shortcut" class="ml-8 inline-flex shrink-0 items-center gap-1 text-muted-foreground">
<kbd v-for="key in shortcutKeys(item.shortcut)" :key="key" class="min-w-4 rounded border border-border/70 bg-muted/60 px-1 py-0.5 text-center font-mono text-[10px] leading-none text-muted-foreground shadow-xs">{{ key }}</kbd>
</span>
@@ -313,10 +313,10 @@ onBeforeUnmount(() => {
</div>
<button v-else :disabled="itemIsDisabled(child)" :class="itemButtonClass(child.variant)" @click="handleSubItemClick(child)">
<span class="flex size-4 shrink-0 items-center justify-center">
<component :is="child.icon" v-if="child.icon" :class="['size-4', child.iconClass]" />
<Check v-if="child.checked" class="size-4 text-primary" />
<component :is="child.icon" v-else-if="child.icon" :class="['size-4', child.iconClass]" />
</span>
<span class="flex-1 whitespace-nowrap">{{ child.label }}</span>
<Check v-if="child.checked" class="ml-4 size-4 shrink-0 text-primary" />
<span v-if="child.shortcut" class="ml-8 inline-flex shrink-0 items-center gap-1 text-muted-foreground">
<kbd v-for="key in shortcutKeys(child.shortcut)" :key="key" class="min-w-4 rounded border border-border/70 bg-muted/60 px-1 py-0.5 text-center font-mono text-[10px] leading-none text-muted-foreground shadow-xs">{{ key }}</kbd>
</span>
@@ -164,7 +164,7 @@ describe("CustomContextMenu lifecycle", () => {
app.unmount();
});
it("renders checked state after the menu label", async () => {
it("renders checked state in the leading icon slot", async () => {
const root = defineComponent({
setup() {
return () =>
@@ -188,7 +188,8 @@ describe("CustomContextMenu lifecycle", () => {
const current = Array.from(document.body.querySelectorAll("button")).find((button) => button.textContent?.includes("Current"));
const other = Array.from(document.body.querySelectorAll("button")).find((button) => button.textContent?.includes("Other"));
expect(current?.lastElementChild?.tagName.toLowerCase()).toBe("svg");
expect(current?.firstElementChild?.querySelector("svg")).not.toBeNull();
expect(current?.lastElementChild?.tagName.toLowerCase()).toBe("span");
expect(other?.querySelector("svg")).toBeNull();
app.unmount();